File-Manager/MOD2/EVENT.ASM
2025-04-04 00:37:36 +10:00

58 lines
1.2 KiB
NASM
Executable File

;-------------------------------------------------
; ˆ­¨æ¨ «¨§ æ¨ï ®¡à ¡®â稪  ᮡë⨩
;-------------------------------------------------
InitEvent:
ld hl,what
ld b,8
xor a
ld (hl),a
inc hl
djnz $-2
ld a,1 ; ®ç¨áâ¨âì ¡ãä¥à ª« ¢ë
rst 20h
ld a,4 ; Get Mouse coord and buttons
rst 30h
ret
;-------------------------------------------------
; —⥭¨¥ ᮡë⨩
;-------------------------------------------------
handle_event:
ld ix,what ; ¯®«¥ ᮡë⨩
ld (ix+0),evNothing
call get_mouse_info ; Get mouse coords & buttons
jr nz,ButtPress ; Button Press
ld a,2 ; ®¯à®á ª« ¢ë ¡¥§ ®¦¨¤ ­¨ï
rst 20h
ret z ; no keys
or a
jr z,CursKey
bit 7,d
jr z,CodeKey ; no press combination
cp 9 ; Tab + CombKeys
jr z,CursKey
CodeKey:
ld (ix+0),evKeyboard
ld (ix+1),e ; code key
ld (ix+2),d ; scan code
ret
CursKey:ld (ix+0),evCombKey ; Keyboard combination
ld (ix+1),b ; keyboard flag
ld (ix+2),d ; ª®¤ ªãàá. ª« ¢¨è
ret
ButtPress:
ld d,a
;bit 0,a ; ¯à ¢ë© ¡ãâ®­ ?
;jr nz,RgtButt ; ¤ 
ld (ix+0),evMouseFr ; Mouse buttons press
ld (ix+1),l ; coord X
ld (ix+2),h ; coord Y
ret
;RgtButt:ld (ix+0),evCommand
;ld (ix+1),cmLocMenuM
;ret
; ¯®«¥ ᮡë⨩
what: ds 8