File-Manager/OBJS/BUTTON.ASM
2025-04-04 00:37:36 +10:00

230 lines
4.8 KiB
NASM
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;=====================================================================
; <20>à®à¨á®¢ª  ®¡ê¥ªâ 
; object ~Button~ (¨¬¥¥â 䮪ãá)
; Input: HL=®¯¨á â¥«ì ®¡ê¥ªâ 
; Format table:
; +0 - ­®¬¥à ®¡ê¥ªâ  ~Claster check buttons"
; +1 - Xo «¥¢ ï ¯®§¨æ¨ï ®¡ê¥ªâ 
; +2 - Xi ¯à ¢ ï ¯®§¨æ¨ï ®¡ê¥ªâ 
; +3 - Y ¯®§¨æ¨ï ®¡ê¥ªâ 
; +4 - ­®¬¥à ª®¬ ­¤ë
; +5 - ᪥­-ª®¤ hot-ª« ¢¨è¨
; +6 - ª®­â¥ªáâ
;---------------------------------------------------------------------
; ”®à¬ â ®¯¨á â¥«ï:
; db Button ; ­®¬¥à ®¡ê¥ªâ 
; dw 0205h ; Yo,Xo
; db " ~O~k ",0 ; ¨¬ï ¡ãâ®­ 
; db 18h ; ᪥­-ª®¤ hot-ª« ¢¨è¨
; db cmOkey ; ­®¬¥à ª®¬ ­¤ë
; db 5 ; ª®­â¥ªáâ
;=====================================================================
PutButton:
push iy
inc iy ; ¯à®©â¨ ï祩ªã à §¬¥à  â ¡«¨æë
ld (iy+0),a ; +0 ­®¬¥à ®¡ê¥ªâ 
ld a,(hl) ; X pos
inc hl
ld c,a
add a,(ix+0) ; Pos X from begin screen
ld (iy+1),a ; +1 Xo left
ld a,(hl) ; Y pos
inc hl
ld b,a
add a,(ix+1) ; Pos Y from begin screen
ld (iy+3),a ;+3 Yo
call GetPutA
ex de,hl
ld a,(color_array+24) ; 梥⠤¨ «. ®ª­ 
ld c,a
ld b,0 ; áç¥â稪 è¨à¨­ë ¡ãâ®­ 
ld (iy+5),b ; hot-key
; ¢áâ ¢¨âì ¨¬ï ¡ãâ®­ 
ld a,(de)
PButLp1:inc de
cp "&"
jr nz,PButN0
; ¢áâ ¢¨âì hot-¡ãª¢ã
ld a,(de)
ld (hl),a ; hot-¡ãª¢ã ¢ ¡ãä¥à
inc hl
inc de
push bc
ld a,(color_array+25) ; 梥â hot-¡ãª¢ë ¤¨ «. ®ª­ 
ld b,a
ld a,c ; 梥⠡ãâ®­ 
and 0F0h
or b
ld (hl),a ;  âਡãâ
pop bc
inc hl
inc b
ld a,(de)
inc de
PButN0: ld (hl),a
inc hl
ld (hl),c
inc hl
inc b
ld a,(de)
or a
jr nz,PButLp1 ; ­¥ ª®­¥æ ¨¬¥­¨
inc de
ld a,(de) ; ᪥­-ª®¤ hot-ª« ¢¨è¨
inc de
ld (iy+5),a ; hot-ª« ¢¨è 
ld a,(iy+1) ; Xi left
add a,b ; + è¨à¨­  ¡ãâ®­ 
ld (iy+2),a ; Xi right
ex de,hl
ld a,(hl) ; ®¯¨á â¥«ì ®¡ê¥ªâ 
inc hl
ld (iy+4),a ; ­®¬¥à ª®¬ ­¤ë
ld a,(hl)
inc hl
ld (iy+6),a ; ª®­â¥ªáâ
ld bc,7 ; à §¬¥à â ¡«¨æë ®¡ê¥ªâ  "Button"
add iy,bc
push iy
exx
pop hl
pop de ; de=iy
and a
sbc hl,de ; de=DialTab+5
ld a,l
ld (de),a ; à §¬¥à â ¡«¨æë ®¡ê¥ªâ  "Button"
exx
ret
;-------------------------------------------------
; ”®ªãá ­  ®¡ê¥ªâ "Button"
;-------------------------------------------------
ButtonI:ld de,color_array+34 ; 梥â Selected buttons
ld (set_dial_tmp_inv+1),de
ld e,(ix+2) ; Xo left
ld d,(ix+4) ; Y
ld a,(ix+3) ; Xi right
sub e
ld c,a
call SetDialInv ; ¢ë¤¥«¨âì æ¢¥â®¬
ld hl,color_array+26 ; Selected title (®¡ê¥ªâ )
ld (set_dial_tmp_inv+1),hl ; ¢®ááâ. ï祩ªã
ret
;=====================================================================
;
; Ž¡à ¡®â稪 ᮡë⨩ ®¡ê¥ªâ®¢ "Button"
;
;=====================================================================
EvButton:
ld hl,what ; ¯®«¥ ᮡë⨩
ld a,(hl) ;+0
inc hl
cp evMouseFr
jr z,EBmouse
cp evKeyboard
jp z,EBkeys
cp evCombKey
ret nz
bit 7,(ix+1) ; sel or nosel
ret nz ; ®¡ê¥ªâ 㦥 ¢ë¤¥«¥­
ld b,(hl) ;+1 what
inc hl
ld a,(hl) ;+2 what
cp 56h ; ªãàá®à ¢¯à ¢®
jr z,tb__
push ix
ld e,(ix+0) ; à §¬¥à â ¡«¨æë "Button"
ld d,0
add ix,de
bit 7,(ix+0)
pop ix
ret z ; ¥é¥ ­¥ ª®­¥æ ®¡ê¥ªâ®¢
cp 54h ; ªãàá®à ¢«¥¢®
jr z,tb__
ld a,b
and 00111111b ; ¡¨âë Ctrl, Alt
ret nz
ld a,(hl) ;+2 what
cp 15+80h ; Tab ᪥­-ª®¤+80h
ret nz
; Shift+Tab
tb__: xor a
ld (_Push+1),a ; Push flag
jp SetButton ; select my
; ‘®¡ë⨥ - ¬ë誠
EBmouse:ld e,(hl) ;+1 X coord
inc hl
ld d,(hl) ;+2 Y coord
ld a,d
cp (ix+4) ; Y pos button
jr nz,get_fr ; if <> exit
ld a,e
bit 7,(ix+2)
jr nz,$+6
cp (ix+2) ; Xo pos
jr c,get_fr ; <
bit 7,(ix+3)
jr nz,get_fr
cp (ix+3) ; Xi pos
jr nc,get_fr ; >
xor a
inc a
ld (_Push+1),a ; Push flag
bit 7,(ix+1)
jr nz,_Push
jr SetButton
; ‘®¡ë⨥ - ®¡ëç­ ï ª« ¢¨è 
EBkeys: xor a
ld (_Push+1),a ; Push flag
ld a,(hl) ;+1 what ª®¤ ª« ¢¨è¨
bit 7,(ix+1) ; Sel or nosel
jr nz,EBkeyN
cp 9 ; Tab
jr z,SetButton ; if tab then set button
jr EBkeyN1
;
EBkeyN: cp 0Dh ; Enter
jr z,EBent
EBkeyN1:inc hl
ld a,(hl) ;+2 what ᪥­-ª®¤
cp (ix+6) ; hot-¡ãª¢ 
ret nz
EBent: ld a,1
ld (_Push+1),a
SetButton:
call MoveObj ; Select Button
call ResDialInv ; Reset previos invert
ld ix,DialTab+5
ld de,color_array+34 ; 梥â Selected buttons
ld (set_dial_tmp_inv+1),de
ld e,(ix+2) ; Xo
ld d,(ix+4) ; Y
ld a,(ix+3) ; Xi
sub e
ld c,a
call SetDialInv ; ¢ë¤¥«¨âì ¡ãâ®­ 梥⮬
ld de,color_array+26 ; 梥â Selected title (®¡ê¥ªâ )
ld (set_dial_tmp_inv+1),de
_Push: ld a,0
or a
jr z,BTexit
call PushBut ; § á¢¥â¨âì ªãàá®à
ld hl,what
ld (hl),evCommand
inc hl
ld a,(ix+5) ; ­®¬¥à ª®¬ ­¤ë
ld (hl),a
get_fr: jp get_fire
;
; Button exit
BTexit: ld hl,what
ld (hl),evNothing
ret