forked from offtopia/ponydos
Add keyboard events
This commit is contained in:
parent
744da780f3
commit
13c69db33d
37
ponydos.asm
37
ponydos.asm
|
@ -13,6 +13,12 @@ ROWS equ 25
|
|||
|
||||
jmp 0:start
|
||||
|
||||
initialize_mouse_error:
|
||||
; https://www.ctyme.com/intr/rb-1601.htm
|
||||
mov ax, 0xc201
|
||||
int 0x15
|
||||
jmp initialize_mouse
|
||||
|
||||
start:
|
||||
cld
|
||||
|
||||
|
@ -89,7 +95,7 @@ mainloop:
|
|||
call draw_wallpaper
|
||||
|
||||
; Draw windows
|
||||
xor ax, ax ; WM_PAINT
|
||||
xor al, al ; WM_PAINT
|
||||
call window_event
|
||||
|
||||
call flip_mouse_cursor
|
||||
|
@ -113,26 +119,32 @@ mainloop:
|
|||
|
||||
mov dl, [di - mouse_column + mouse_buttons]
|
||||
|
||||
mov ax, WM_MOUSE
|
||||
mov al, WM_MOUSE
|
||||
call window_event
|
||||
.mouse_change_end:
|
||||
|
||||
mov ah, 1
|
||||
int 0x16
|
||||
jz .key_end
|
||||
.key:
|
||||
xor ah, ah
|
||||
int 0x16
|
||||
mov cx, ax
|
||||
mov al, WM_KEYBOARD
|
||||
call window_event
|
||||
.key_end:
|
||||
|
||||
hlt
|
||||
jmp mainloop
|
||||
|
||||
initialize_mouse_error:
|
||||
; https://www.ctyme.com/intr/rb-1601.htm
|
||||
mov ax, 0xc201
|
||||
int 0x15
|
||||
jmp initialize_mouse
|
||||
|
||||
; requires:
|
||||
; ds = 0
|
||||
; di = mouse_column
|
||||
; in:
|
||||
; ax = event
|
||||
; al = event
|
||||
; out:
|
||||
; clobbers bx
|
||||
; clobbers bp
|
||||
window_event:
|
||||
push cs ; Return segment
|
||||
push word draw_wallpaper.ret ; Return offset
|
||||
|
@ -314,10 +326,10 @@ shell_name db 'shell.bin', 0
|
|||
|
||||
; in:
|
||||
; ds:si = file name
|
||||
; dx = non-zero => do not create new file
|
||||
; out:
|
||||
; ax = LBA of first sector, 0 if no space left
|
||||
; cx = length in sectors
|
||||
; dx = non-zero => do not create new file
|
||||
; di = dirent address (in GLOBAL_DIRENTS)
|
||||
; [Far calls only]
|
||||
open_file:
|
||||
|
@ -478,10 +490,9 @@ mouse_handler:
|
|||
test bl, Y_OVERFLOW
|
||||
call xy_handler
|
||||
|
||||
mov bh, 1
|
||||
and bl, BUTTONS
|
||||
mov [cs:di], bl
|
||||
|
||||
mov byte [cs:di + 1], 1 ; Mark that mouse state has updated
|
||||
mov [cs:di], bx
|
||||
|
||||
popa
|
||||
retf
|
||||
|
|
|
@ -8,6 +8,7 @@ FS_FILE_MAX_SIZE equ 128
|
|||
|
||||
WM_PAINT equ 0
|
||||
WM_MOUSE equ 1
|
||||
WM_KEYBOARD equ 2
|
||||
|
||||
MOUSE_PRIMARY equ 0x01
|
||||
MOUSE_SECONDARY equ 0x02
|
||||
|
|
Loading…
Reference in New Issue