Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2434 → Rev 2268

/kernel/branches/Kolibri-acpi/kernel.asm
67,7 → 67,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
include 'macros.inc'
include 'struct.inc'
 
$Revision$
 
172,20 → 171,17
mov al, 255 ; mask all irqs
out 0xa1, al
out 0x21, al
l.5:
in al, 0x64 ; Enable A20
l.5: in al, 0x64 ; Enable A20
test al, 2
jnz l.5
mov al, 0xD1
out 0x64, al
l.6:
in al, 0x64
l.6: in al, 0x64
test al, 2
jnz l.6
mov al, 0xDF
out 0x60, al
l.7:
in al, 0x64
l.7: in al, 0x64
test al, 2
jnz l.7
mov al, 0xFF
374,6 → 370,7
 
mov [_display.bpp], eax
mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
 
movzx eax, word [BOOT_VAR+0x900A]; X max
mov [_display.width], eax
387,8 → 384,8
mov [screen_workarea.bottom], eax
movzx eax, word [BOOT_VAR+0x9008]; screen mode
mov [SCR_MODE], eax
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
; mov [BANK_SWITCH], eax
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
mov [BANK_SWITCH],eax
mov [BytesPerScanLine], word 640*4 ; Bytes PerScanLine
cmp [SCR_MODE], word 0x13 ; 320x200
je @f
416,17 → 413,16
 
cmp [SCR_MODE], word 0100000000000000b
jge setvesa20
cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors
cmp [SCR_MODE],word 0x13
je v20ga32
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
mov [GETPIXEL],dword Vesa12_getpixel24
cmp [ScreenBPP],byte 24
jz ga24
mov [PUTPIXEL],dword Vesa12_putpixel32
mov [GETPIXEL],dword Vesa12_getpixel32
ga24:
jmp v20ga24
; mov [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2
; mov [GETPIXEL], dword Vesa12_getpixel24
; cmp [ScreenBPP], byte 24
; jz ga24
; mov [PUTPIXEL], dword Vesa12_putpixel32
; mov [GETPIXEL], dword Vesa12_getpixel32
; ga24:
; jmp v20ga24
setvesa20:
mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0
mov [GETPIXEL], dword Vesa20_getpixel24
435,7 → 431,6
v20ga32:
mov [PUTPIXEL], dword Vesa20_putpixel32
mov [GETPIXEL], dword Vesa20_getpixel32
jmp no_mode_0x12
v20ga24:
cmp [SCR_MODE], word 0x12 ; 16 C VGA 640x480
jne no_mode_0x12
567,7 → 562,7
mov [unpack.p], eax
 
call init_events
mov eax, srv.fd-SRV.fd
mov eax, srv.fd-SRV_FD_OFFSET
mov [srv.fd], eax
mov [srv.bk], eax
 
670,10 → 665,6
stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560
 
mov [MOUSE_PICTURE], dword mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel
 
mov esi, boot_fonts
call boot_log
 
870,6 → 861,9
call set_network_conf
no_st_network:
 
xchg bx, bx
stdcall load_driver, ahci_driver
 
; LOAD FIRST APPLICATION
cli
 
991,8 → 985,7
if preboot_blogesc
mov esi, boot_tasking
call boot_log
.bll1:
in al, 0x60 ; wait for ESC key press
.bll1: in al, 0x60 ; wait for ESC key press
cmp al, 129
jne .bll1
end if
1012,6 → 1005,8
include 'unpacker.inc'
include 'fdo.inc'
 
ahci_driver db 'AHCI',0
 
align 4
boot_log:
pushad
1920,30 → 1915,7
ret
 
sys_end:
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; restore default cursor before killing
pusha
mov ecx, [current_slot]
mov eax, [def_cursor]
mov [ecx+APPDATA.cursor], eax
 
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa
@@:
;--------------------------------------
mov ecx, [current_slot]
mov eax, [ecx+APPDATA.tls_base]
test eax, eax
2011,8 → 1983,7
exit_for_anyone:
ret
uglobal
shutdown_processes:
dd 0x0
shutdown_processes: dd 0x0
endg
;------------------------------------------------------------------------------
sysfn_terminate: ; 18.2 = TERMINATE
2022,38 → 1993,12
cmp ecx, edx
ja noprocessterminate
mov eax, [TASK_COUNT]
push ecx
shl ecx, 5
mov edx, [ecx+CURRENT_TASK+TASKDATA.pid]
add ecx, CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9
jz noprocessterminate
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; restore default cursor before killing
pusha
mov ecx, [esp+32]
shl ecx, 8
mov eax, [def_cursor]
mov [ecx+SLOT_BASE+APPDATA.cursor], eax
 
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa
@@:
add esp, 4
;--------------------------------------
;call MEM_Heap_Lock ;guarantee that process isn't working with heap
mov [ecx], byte 3; clear possible i40's
;call MEM_Heap_UnLock
2839,8 → 2784,7
sys_clock:
cli
; Mikhail Lisovin xx Jan 2005
@@:
mov al, 10
@@: mov al, 10
out 0x70, al
in al, 0x71
test al, al
2877,8 → 2821,7
sys_date:
 
cli
@@:
mov al, 10
@@: mov al, 10
out 0x70, al
in al, 0x71
test al, al
3131,52 → 3074,13
cmp [mouse_active], 1
jne mouse_not_active
mov [mouse_active], 0
 
xor edi, edi
mov ebx, CURRENT_TASK
 
mov ecx, [TASK_COUNT]
movzx eax, word [WIN_POS + ecx*2] ; active window
shl eax, 8
push eax
 
movzx eax, word [MOUSE_X]
movzx edx, word [MOUSE_Y]
 
align 4
.set_mouse_event:
set_mouse_event:
add edi, 256
add ebx, 32
test [ebx+TASKDATA.event_mask], 0x80000000
jz .pos_filter
or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
loop set_mouse_event
 
cmp edi, [esp] ; skip if filtration active
jne .skip
 
.pos_filter:
test [ebx+TASKDATA.event_mask], 0x40000000
jz .set
 
mov esi, [ebx-twdw+WDATA.box.left]
cmp eax, esi
jb .skip
add esi, [ebx-twdw+WDATA.box.width]
cmp eax, esi
ja .skip
 
mov esi, [ebx-twdw+WDATA.box.top]
cmp edx, esi
jb .skip
add esi, [ebx-twdw+WDATA.box.height]
cmp edx, esi
ja .skip
.set:
or [edi+SLOT_BASE+APPDATA.event_mask], 100000b
.skip:
loop .set_mouse_event
 
pop eax
 
mouse_not_active:
cmp byte[BACKGROUND_CHANGED], 0
jz no_set_bgr_event
3233,6 → 3137,8
 
no_mark_system_shutdown:
 
call [_display.disable_mouse]
 
dec byte [SYS_SHUTDOWN]
je system_shutdown
 
3428,8 → 3334,7
mov ah, al
cld
 
cnt1:
in al, 0x61
cnt1: in al,0x61
and al, 0x10
cmp al, ah
jz cnt1
3442,15 → 3347,12
 
ret
 
align 4
 
set_app_param:
mov edi, [TASK_BASE]
mov eax, ebx
btr eax, 3 ; move MOUSE_FILTRATION
mov ebx, [current_slot] ; bit into event_filter
setc byte [ebx+APPDATA.event_filter]
xchg eax, [edi + TASKDATA.event_mask] ; set new event mask
mov [esp+32], eax ; return old mask value
mov eax, [edi + TASKDATA.event_mask]
mov [edi + TASKDATA.event_mask], ebx
mov [esp+32], eax
ret
 
 
3729,23 → 3631,37
; popad ; end disable io map
xor eax, eax
ret
;-----------------------------------------------------------------------------
 
 
align 4
drawbackground:
inc [mouse_pause]
cmp [SCR_MODE],word 0x12
je dbrv20
dbrv12:
cmp [SCR_MODE],word 0100000000000000b
jge dbrv20
cmp [SCR_MODE],word 0x13
je dbrv20
call vesa12_drawbackground
dec [mouse_pause]
call [draw_pointer]
ret
dbrv20:
cmp [BgrDrawMode], dword 1
jne bgrstr
call vesa20_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer]
ret
;--------------------------------------
align 4
bgrstr:
call vesa20_drawbackground_stretch
dec [mouse_pause]
call [draw_pointer]
ret
;-----------------------------------------------------------------------------
 
align 4
 
syscall_putimage: ; PutImage
sys_putimage:
test ecx, 0x80008000
3754,12 → 3670,8
jz .exit
test ecx, 0xFFFF0000
jnz @f
;--------------------------------------
align 4
.exit:
ret
;--------------------------------------
align 4
@@:
mov edi, [current_slot]
add dx, word[edi+APPDATA.wnd_clientbox.top]
3766,20 → 3678,28
rol edx, 16
add dx, word[edi+APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
.forced:
push ebp esi 0
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
;--------------------------------------
align 4
sys_putimage_bpp:
call vesa20_putimage
; call [disable_mouse] ; this will be done in xxx_putimage
; mov eax, vga_putimage
cmp [SCR_MODE], word 0x12
jz @f ;.doit
mov eax, vesa12_putimage
cmp [SCR_MODE], word 0100000000000000b
jae @f
cmp [SCR_MODE], word 0x13
jnz .doit
@@:
mov eax, vesa20_putimage
.doit:
inc [mouse_pause]
call eax
dec [mouse_pause]
pop ebp esi ebp
ret
; jmp [draw_pointer]
;-----------------------------------------------------------------------------
jmp [draw_pointer]
align 4
sys_putimage_palette:
; ebx = pointer to image
3794,8 → 3714,6
rol edx, 16
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
.forced:
cmp esi, 1
jnz @f
3810,8 → 3728,6
add esp, 12
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 2
jnz @f
3822,8 → 3738,6
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 4
jnz @f
3834,8 → 3748,6
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
push ebp esi ebp
cmp esi, 8
3843,8 → 3755,6
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 15
jnz @f
3851,8 → 3761,6
mov ebp, putimage_get15bpp
mov esi, putimage_init15bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 16
jnz @f
3859,8 → 3767,6
mov ebp, putimage_get16bpp
mov esi, putimage_init16bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 24
jnz @f
3867,8 → 3773,6
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 32
jnz @f
3875,39 → 3779,31
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
pop ebp esi ebp
ret
;-----------------------------------------------------------------------------
align 4
 
put_mono_image:
push ebp esi ebp
mov ebp, putimage_get1bpp
mov esi, putimage_init1bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_2bit_image:
push ebp esi ebp
mov ebp, putimage_get2bpp
mov esi, putimage_init2bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_4bit_image:
push ebp esi ebp
mov ebp, putimage_get4bpp
mov esi, putimage_init4bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
 
putimage_init24bpp:
lea eax, [eax*3]
putimage_init8bpp:
ret
;-----------------------------------------------------------------------------
 
align 16
putimage_get24bpp:
movzx eax, byte [esi+2]
3915,7 → 3811,6
mov ax, [esi]
add esi, 3
ret 4
;-----------------------------------------------------------------------------
align 16
putimage_get8bpp:
movzx eax, byte [esi]
3925,8 → 3820,7
pop edx
inc esi
ret 4
;-----------------------------------------------------------------------------
align 4
 
putimage_init1bpp:
add eax, ecx
push ecx
3937,7 → 3831,6
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get1bpp:
push edx
3954,8 → 3847,7
add eax, [edx+4]
pop edx
ret 4
;-----------------------------------------------------------------------------
align 4
 
putimage_init2bpp:
add eax, ecx
push ecx
3966,7 → 3858,6
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get2bpp:
push edx
3988,8 → 3879,7
mov eax, [edx+eax*4]
pop edx
ret 4
;-----------------------------------------------------------------------------
align 4
 
putimage_init4bpp:
add eax, ecx
push ecx
4000,7 → 3890,6
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get4bpp:
push edx
4022,23 → 3911,19
mov eax, [edx+eax*4]
pop edx
ret 4
;-----------------------------------------------------------------------------
align 4
 
putimage_init32bpp:
shl eax, 2
ret
;-----------------------------------------------------------------------------
align 16
putimage_get32bpp:
lodsd
ret 4
;-----------------------------------------------------------------------------
align 4
 
putimage_init15bpp:
putimage_init16bpp:
add eax, eax
ret
;-----------------------------------------------------------------------------
align 16
putimage_get15bpp:
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
4057,7 → 3942,7
or eax, edx
pop edx ecx
ret 4
;-----------------------------------------------------------------------------
 
align 16
putimage_get16bpp:
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
4076,27 → 3961,41
or eax, edx
pop edx ecx
ret 4
;-----------------------------------------------------------------------------
;align 4
 
; eax x beginning
; ebx y beginning
; ecx x end
; edx y end
; edi color
;__sys_drawbar:
; mov esi, [current_slot]
; add eax, [esi+APPDATA.wnd_clientbox.left]
; add ecx, [esi+APPDATA.wnd_clientbox.left]
; add ebx, [esi+APPDATA.wnd_clientbox.top]
; add edx, [esi+APPDATA.wnd_clientbox.top]
;--------------------------------------
;align 4
;.forced:
; call vesa20_drawbar
; call [draw_pointer]
; ret
;-----------------------------------------------------------------------------
align 4
 
__sys_drawbar:
mov esi,[current_slot]
add eax,[esi+APPDATA.wnd_clientbox.left]
add ecx,[esi+APPDATA.wnd_clientbox.left]
add ebx,[esi+APPDATA.wnd_clientbox.top]
add edx,[esi+APPDATA.wnd_clientbox.top]
.forced:
inc [mouse_pause]
; call [disable_mouse]
cmp [SCR_MODE],word 0x12
je dbv20
sdbv20:
cmp [SCR_MODE],word 0100000000000000b
jge dbv20
cmp [SCR_MODE],word 0x13
je dbv20
call vesa12_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
dbv20:
call vesa20_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
 
 
 
kb_read:
 
push ecx edx
4122,8 → 4021,8
pop edx ecx
 
ret
;-----------------------------------------------------------------------------
align 4
 
 
kb_write:
 
push ecx edx
4176,8 → 4075,8
pop edx ecx
 
ret
;-----------------------------------------------------------------------------
align 4
 
 
kb_cmd:
 
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
4208,7 → 4107,7
setmouse: ; set mousepicture -pointer
; ps2 mouse enable
 
; mov [MOUSE_PICTURE], dword mousepointer
mov [MOUSE_PICTURE],dword mousepointer
 
cli
 
4284,8 → 4183,7
ret
 
uglobal
msg_board_data:
times 4096 db 0
msg_board_data: times 4096 db 0
msg_board_count dd 0x0
endg
 
4513,7 → 4411,8
add eax, [edi+APPDATA.wnd_clientbox.left]
add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
; mov edi, 1
call [_display.disable_mouse]
jmp [putpixel]
 
align 4
4653,7 → 4552,6
div ecx
mov ebx, edx
xchg eax, ebx
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y
mov [esp + 32], ecx
ret
4666,6 → 4564,20
;ecx = [size x]*65536 + [size y]
;edx = [start x]*65536 + [start y]
pushad
inc [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
; Since the test for the coordinates of the mouse should not be used,
; then use the call [disable_mouse] is not possible!
cmp dword [MOUSE_VISIBLE],dword 0
jne @f
pushf
cli
call draw_mouse_under
popf
mov [MOUSE_VISIBLE],dword 1
@@:
mov edi, ebx
mov eax, edx
shr eax, 16
4702,7 → 4614,6
push eax ebx ecx
add eax, ecx
 
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL]; eax - x, ebx - y
 
mov [ebp], cx
4717,6 → 4628,12
dec ebx
dec edx
jnz .start_y
dec [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
call [draw_pointer]
@@:
popad
ret