/drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc |
---|
1,7 → 1,7 |
kbd_read: |
push ecx edx |
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
mov ecx,0xfffff ; last 0xffff, new value in view of fast CPU's |
kr_loop: |
in al,0x64 |
test al,1 |
10,11 → 10,6 |
mov ah,1 |
jmp kr_exit |
kr_ready: |
push ecx |
mov ecx,32 |
kr_delay: |
loop kr_delay |
pop ecx |
in al,0x60 |
xor ah,ah |
kr_exit: |
27,40 → 22,19 |
push ecx edx |
mov dl,al |
in al,0x60 |
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
kw_loop: |
mov ecx,0x1ffff |
@@: |
in al,0x64 |
test al,2 |
jz kw_ok |
loop kw_loop |
jz @f |
loop @b |
mov ah,1 |
jmp kw_exit |
kw_ok: |
jmp .nothing |
@@: |
mov al,dl |
out 0x60,al |
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
kw_loop3: |
in al,0x64 |
test al,2 |
jz kw_ok3 |
loop kw_loop3 |
mov ah,1 |
jmp kw_exit |
kw_ok3: |
mov ah,8 |
kw_loop4: |
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
kw_loop5: |
in al,0x64 |
test al,1 |
jnz kw_ok4 |
loop kw_loop5 |
dec ah |
jnz kw_loop4 |
kw_ok4: |
xor ah,ah |
kw_exit: |
mov ah,0 |
.nothing: |
pop edx ecx |
ret |
73,20 → 47,11 |
test al,2 |
jz c_send |
loop c_wait |
jmp c_error |
mov ah,1 |
jmp c_exit |
c_send: |
mov al,bl |
out 0x64,al |
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
c_accept: |
in al,0x64 |
test al,2 |
jz c_ok |
loop c_accept |
c_error: |
mov ah,1 |
jmp c_exit |
c_ok: |
xor ah,ah |
c_exit: |
ret |
/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm |
---|
36,8 → 36,27 |
proc START stdcall, state:dword |
cmp [state], DRV_ENTRY |
jne .fin |
jne .nothing |
.init: |
; disable keyboard and mouse interrupts |
; keyboard IRQ handler can interfere badly otherwise |
pushf |
cli |
mov bl, 0x20 ; read command byte |
call kbd_cmd |
test ah,ah |
jnz .fin |
call kbd_read |
test ah,ah |
jnz .fin |
popf |
and al, 0xFC ; disable interrupts |
or al, 0x10 ; disable keyboard |
push eax |
mov bl, 0x60 ; write command byte |
call kbd_cmd |
pop eax |
call kbd_write |
call detect_mouse |
test eax,eax |
57,41 → 76,31 |
.stop_try: |
mov al, 0xF4 ; enable data reporting |
call mouse_cmd |
; enable keyboard and mouse interrupts |
mov bl, 0x20 ; read command byte |
call kbd_cmd |
cmp ah,1 |
je .exit |
call kbd_read |
cmp ah,1 |
je .exit |
or al, 10b |
or al, 3 ; enable interrupts |
and al, not 0x10 ; enable keyboard |
push eax |
mov bl, 0x60 ; write command byte |
call kbd_cmd |
cmp ah,1 |
je .exit |
pop eax |
call kbd_write |
cmp ah,1 |
je .exit |
mov al, 0xF4 ; enable data reporting |
call mouse_cmd |
mov bl, 0xAE ; enable keyboard interface |
call kbd_cmd |
stdcall AttachIntHandler, 12, irq_handler, dword 0 |
stdcall AttachIntHandler, 12, irq_handler, 0 |
stdcall RegService, my_service, service_proc |
ret |
.fin: |
popf |
;stdcall DetachIntHandler, 12, irq_handler |
mov bl, 0xA7 ; disable mouse interface |
call kbd_cmd |
.nothing: |
xor eax, eax |
ret |
98,8 → 107,19 |
.exit: |
mov bl, 0xA7 ; disable mouse interface |
call kbd_cmd |
mov bl, 0xAE ; enable keyboard interface |
; enable keyboard interrupt, leave mouse interrupt disabled |
mov bl, 0x20 ; read command byte |
call kbd_cmd |
call kbd_read |
or al, 1 ; enable keyboard interrupt |
and al, not 0x10 ; enable keyboard |
push eax |
mov bl, 0x60 ; write command byte |
call kbd_cmd |
pop eax |
call kbd_write |
xor eax, eax |
ret |
endp |
137,11 → 157,6 |
detect_mouse: |
mov bl, 0xAD ; disable keyboard interface |
call kbd_cmd |
cmp ah,1 |
je .fail |
mov bl, 0xA8 ; enable mouse interface |
call kbd_cmd |
cmp ah,1 |
161,6 → 176,7 |
jc .fail |
cmp al, 0x00 |
jne .fail ; unknown device |
xor eax,eax |
ret |
/kernel/trunk/kernel.asm |
---|
882,6 → 882,7 |
mov esi, 250 ; wait 1/4 a second |
call delay_ms |
rdtsc |
sti |
sub eax, ecx |
xor edx, edx |
949,26 → 950,6 |
stdcall map_page, tss._io_map_1, \ |
[SLOT_BASE+256+APPDATA.io_map+4], PG_MAP |
; LOAD FIRST APPLICATION |
cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes) |
jnz first_app_found |
cli |
mov ebp, firstapp |
call fs_execute_from_sysdir |
test eax, eax |
jns first_app_found |
mov esi, boot_failed |
call boot_log |
mov eax, 0xDEADBEEF ; otherwise halt |
hlt |
first_app_found: |
cli |
; SET KEYBOARD PARAMETERS |
mov al, 0xf6 ; reset keyboard, scan enabled |
call kb_write_wait_ack |
1008,6 → 989,24 |
call boot_log |
call setmouse |
; LOAD FIRST APPLICATION |
cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes) |
jnz first_app_found |
cli |
mov ebp, firstapp |
call fs_execute_from_sysdir |
test eax, eax |
jns first_app_found |
mov esi, boot_failed |
call boot_log |
mov eax, 0xDEADBEEF ; otherwise halt |
hlt |
first_app_found: |
; START MULTITASKING |
; A 'All set - press ESC to start' messages if need |