A2osX/LIB/LIBGUI.S.MENU.txt

896 lines
14 KiB
Plaintext
Raw Normal View History

NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
*--------------------------------------
* NewMenu(pMENU, x, y)
2020-09-07 20:40:50 +00:00
*--------------------------------------
MENU.New jsr OBJ.PullDXDY
>PULLYA
2022-10-27 06:20:09 +00:00
MENU.New.I >STYA ZPPtr1 MENU definition
>STYA ZPPtr2 for pass #2
2022-10-19 06:26:48 +00:00
2022-10-25 06:05:54 +00:00
ldx MENU.Stack.Cnt
cpx #MENU.MAX
beq .90
2020-10-13 15:54:55 +00:00
jsr MENU.GetSize
>SYSCALL2 GetMem
2020-10-15 15:19:13 +00:00
bcs .99
2020-10-09 06:02:45 +00:00
>STYA ZPObjPtr
2020-10-20 06:01:04 +00:00
txa hMenu
ldx MENU.Stack.Cnt
2020-10-20 06:01:04 +00:00
sta MENU.Stack,x
2020-10-09 06:02:45 +00:00
lda #S.OBJ.T.MENU
sta (ZPObjPtr) S.OBJ.T
2020-10-09 06:02:45 +00:00
lda #0
ldy #S.MENU.Items-1
2020-10-09 06:02:45 +00:00
.1 sta (ZPObjPtr),y
2020-10-09 06:02:45 +00:00
dey
bne .1
2020-10-26 16:32:51 +00:00
lda #S.OBJ.F.BORDER
ldy #S.OBJ.F
sta (ZPObjPtr),y
2020-10-15 06:16:45 +00:00
jsr OBJ.SetDXDYX1Y1
2022-10-19 06:26:48 +00:00
jsr MENU.GetData
2020-10-20 06:01:04 +00:00
jsr MENU.SetMenuSizePos
2020-10-09 15:28:01 +00:00
ldx MENU.Stack.Cnt
2020-10-20 06:01:04 +00:00
lda MENU.Stack,x
inc MENU.Stack.Cnt
2020-10-13 15:54:55 +00:00
2020-10-15 15:19:13 +00:00
clc
2020-10-09 15:28:01 +00:00
rts
2020-10-13 15:54:55 +00:00
.90 lda #E.OOH
sec
2022-10-25 06:05:54 +00:00
.99
2020-10-09 15:28:01 +00:00
MENU.New.RTS rts
2020-10-20 06:01:04 +00:00
*--------------------------------------
* ZPPtr1 = defintion
2020-10-20 06:01:04 +00:00
*--------------------------------------
MENU.GetSize lda #S.MENU.Items+1 Ending\0
sta Counter
stz Counter+1
2022-10-25 06:05:54 +00:00
.1 lda (ZPPtr1)
beq .8
2020-10-20 06:01:04 +00:00
lda #S.MITEM
clc
adc Counter
sta Counter
bcc .2
2022-10-25 06:05:54 +00:00
inc Counter+1
2020-10-20 06:01:04 +00:00
.2 lda (ZPPtr1)
cmp #S.MITEM.T.SEP
bne .3
2022-10-25 06:05:54 +00:00
inc ZPPtr1
bne .1
2022-10-25 06:05:54 +00:00
inc ZPPtr1+1
bra .1
2022-10-25 06:05:54 +00:00
.3 cmp #S.MITEM.T.ITEM
bne .4
2020-10-26 16:32:51 +00:00
lda #6 T+ID+KEMOD+KEY+pICON+"TEXT"
bra .5
2020-10-20 06:01:04 +00:00
.4 lda #5 T+pMENU+pICON+"TEXT"
2020-10-20 06:01:04 +00:00
.5 jsr SkipAPtr1
jsr SkipStrZPtr1 skip "TEXT\0"
bra .1
2020-10-23 15:23:19 +00:00
.8 >LDYA Counter
rts
2020-10-22 06:08:25 +00:00
*--------------------------------------
* ZPPtr2 = defintion
* ZPObjPtr = DstMenu
* ZPPtr1 = DstMItem
2020-10-20 06:01:04 +00:00
*--------------------------------------
MENU.GetData jsr MENU.GetMItems
2022-10-25 06:05:54 +00:00
.1 lda (ZPPtr2)
sta (ZPPtr1)
2020-10-22 06:08:25 +00:00
beq .8
2020-10-09 15:28:01 +00:00
cmp #S.MITEM.T.SEP
bne .2
2022-10-25 06:05:54 +00:00
inc ZPPtr2 skip 1 byte
2022-10-20 06:07:40 +00:00
bne .5
2022-10-25 06:05:54 +00:00
inc ZPPtr2+1
bra .5
*--------------------------------------
.2 cmp #S.MITEM.T.ITEM
bne .3
2022-10-25 06:05:54 +00:00
ldy #1 T+ID+KEMOD+KEY+pICON+"text"
lda (ZPPtr2),y
2020-10-20 06:01:04 +00:00
ldy #S.MITEM.ID
sta (ZPPtr1),y
2020-10-26 16:32:51 +00:00
ldy #2
lda (ZPPtr2),y
2020-10-22 06:08:25 +00:00
tax
iny
lda (ZPPtr2),y
2022-10-25 06:05:54 +00:00
ldy #S.MITEM.KEYMOD+1
sta (ZPPtr1),y
dey KEY
txa
sta (ZPPtr1),y
2020-10-27 07:09:20 +00:00
lda #4
bra .4 skip 4 bytes
2022-10-25 06:05:54 +00:00
*--------------------------------------
.3 ldy #1 skip T+pMENU+pICON+"text"
lda (ZPPtr2),y
2020-10-23 15:23:19 +00:00
tax
iny
lda (ZPPtr2),y
2020-10-26 16:32:51 +00:00
2020-10-23 15:23:19 +00:00
ldy #S.MITEM.pMENU+1
sta (ZPPtr1),y
2020-10-23 15:23:19 +00:00
dey
txa
sta (ZPPtr1),y
lda #3 skip 3 bytes
2022-10-25 06:05:54 +00:00
.4 jsr SkipAPtr2
ldy #1
lda (ZPPtr2),y
ldy #S.MITEM.pICON+1
sta (ZPPtr1),y
dey
lda (ZPPtr2)
sta (ZPPtr1),y
2022-10-25 06:05:54 +00:00
lda #2 skip pICON
jsr SkipAPtr2
2022-10-25 06:05:54 +00:00
2022-10-20 06:07:40 +00:00
ldy #S.MITEM.pTEXT
lda ZPPtr2
sta (ZPPtr1),y
iny
lda ZPPtr2+1
sta (ZPPtr1),y
2022-10-25 06:05:54 +00:00
jsr SkipStrZPtr2 skip "TEXT\0"
2020-10-26 16:32:51 +00:00
2022-10-19 06:26:48 +00:00
ldy #S.MITEM.S
lda #0
sta (ZPPtr1),y
2022-10-25 06:05:54 +00:00
.5 jsr MENU.NextMItem
bra .1
.8 clc
rts
2020-10-23 15:23:19 +00:00
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.SetMenuSizePos
2020-10-09 15:28:01 +00:00
stz IY Icon Margin W
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
stz IE Max Text W
stz IE+1
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
stz INE Max Mod-Key W
2022-10-19 06:26:48 +00:00
stz INE+1
2020-10-09 15:28:01 +00:00
lda #2 2px Borders
sta DY Menu H
2020-10-09 06:02:45 +00:00
stz DY+1
2020-10-20 06:01:04 +00:00
jsr MENU.GetMItems
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
.1 lda (ZPPtr1)
beq .3
2020-10-12 06:04:19 +00:00
2022-10-19 06:26:48 +00:00
cmp #S.MITEM.T.SEP
beq .2
2020-10-20 06:01:04 +00:00
jsr MENU.GetMItemW
2022-10-19 06:26:48 +00:00
.2 jsr MENU.NextMItemDY
2020-10-09 15:28:01 +00:00
bra .1
*--------------------------------------
.3 lda #8+8 1px Border+7 (Checked) +7 (SubMenu)+1px Border
2020-10-09 15:28:01 +00:00
clc
2020-10-20 06:01:04 +00:00
adc IY Icon W
2020-10-12 06:04:19 +00:00
sta DX
2020-10-20 06:01:04 +00:00
stz DX+1
2020-10-12 06:04:19 +00:00
2020-10-20 06:01:04 +00:00
lda DX
clc
2020-10-20 06:01:04 +00:00
adc IE Max Text W
2020-10-09 15:28:01 +00:00
sta DX
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
lda DX+1
adc IE+1
sta DX+1
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
lda DX
clc
2020-10-20 06:01:04 +00:00
adc INE Max Mod-Key W
2020-10-09 15:28:01 +00:00
sta DX
2020-10-26 16:32:51 +00:00
lda DX+1
adc INE+1
sta DX+1
ldy #S.OBJ.W
lda DX
sta (ZPObjPtr),y
2020-10-12 06:04:19 +00:00
iny
lda DX+1
sta (ZPObjPtr),y
2020-10-12 06:04:19 +00:00
iny #S.OBJ.H
lda DY
sta (ZPObjPtr),y
2020-10-12 06:04:19 +00:00
iny
lda DY+1
sta (ZPObjPtr),y
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
ldy #S.MENU.iW
2020-10-20 06:01:04 +00:00
lda IY
sta (ZPObjPtr),y
2020-10-20 09:38:48 +00:00
2022-10-19 06:26:48 +00:00
ldy #S.MENU.tW
2020-10-20 06:01:04 +00:00
lda IE
sta (ZPObjPtr),y
2020-10-20 06:01:04 +00:00
iny
lda IE+1
sta (ZPObjPtr),y
2020-10-20 06:01:04 +00:00
ldy #S.MENU.kW
2020-10-20 06:01:04 +00:00
lda INE
sta (ZPObjPtr),y
2020-10-20 06:01:04 +00:00
iny
lda INE+1
sta (ZPObjPtr),y
*--------------------------------------
2020-10-12 06:04:19 +00:00
ldy #S.OBJ.Y1
2020-10-20 06:01:04 +00:00
lda DY
2020-10-09 15:28:01 +00:00
clc
adc (ZPObjPtr),y
2020-10-09 15:28:01 +00:00
tax
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
iny
2020-10-20 06:01:04 +00:00
lda DY+1
adc (ZPObjPtr),y
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
cpx WND.Screen+S.OBJ.H
sbc WND.Screen+S.OBJ.H+1
bcc .5
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
ldy #S.OBJ.Y1
2020-10-26 16:32:51 +00:00
lda (ZPObjPtr),y
2020-10-09 15:28:01 +00:00
* sec
sbc DY
sta (ZPObjPtr),y
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
iny
2020-10-26 16:32:51 +00:00
lda (ZPObjPtr),y
2020-10-09 15:28:01 +00:00
sbc DY+1
sta (ZPObjPtr),y
2020-10-09 06:02:45 +00:00
.5 >LDYA ZPObjPtr
2022-11-02 06:54:30 +00:00
jmp OBJ.SetX2Y2
2020-10-09 15:28:01 +00:00
*--------------------------------------
2022-10-19 06:26:48 +00:00
MENU.GetMItemW ldy #S.MITEM.pICON
2020-10-09 15:28:01 +00:00
lda (ZPPtr1),y
iny
ora (ZPPtr1),y
beq .1
2020-10-26 16:32:51 +00:00
lda #20 Reserve space for Icon W + 4px SEP
2020-10-12 06:04:19 +00:00
sta IY
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
.1 jsr MENU.GetText
2020-10-09 15:28:01 +00:00
ldx hSYSFON
jsr FON.GetTextSize
2020-10-12 06:04:19 +00:00
ldx CB.Cache+S.CB.SrcW
cpx IE
2020-10-09 15:28:01 +00:00
lda CB.Cache+S.CB.SrcW+1
sbc IE+1
bcc .2
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
stx IE Set Max text W
2020-10-09 15:28:01 +00:00
lda CB.Cache+S.CB.SrcW+1
sta IE+1
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
.2 jsr MENU.GetKeyString
2022-11-02 06:54:30 +00:00
beq .8
2020-10-09 15:28:01 +00:00
ldx hSYSFON
jsr FON.GetTextSize
2020-10-26 16:32:51 +00:00
2022-10-19 06:26:48 +00:00
ldx CB.Cache+S.CB.SrcW
cpx INE
2022-10-19 06:26:48 +00:00
lda CB.Cache+S.CB.SrcW+1
sbc INE+1
2020-10-12 06:04:19 +00:00
bcc .8
2020-10-26 16:32:51 +00:00
2022-10-19 06:26:48 +00:00
stx INE set Max Mod-key W
lda CB.Cache+S.CB.SrcW+1
sta INE+1
2020-10-26 16:32:51 +00:00
.8 rts
2020-10-09 15:28:01 +00:00
*--------------------------------------
MENU.FindMItemByID
jsr MENU.GetMItems
.1 lda (ZPPtr1)
beq .9
cmp #S.MITEM.T.SEP
beq .7
txa
ldy #S.MITEM.ID
cmp (ZPPtr1),y
beq .8
.7 jsr MENU.NextMItem
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------
* ZPObjPtr = Menu
*--------------------------------------
MENU.Enter >LDYA L.WND.Screen
jsr CLIP.GetRect
jsr MENU.GetDXDY
2022-10-25 06:05:54 +00:00
stz D
stz D+1
ldy #S.OBJ.X2
lda DX X1
clc
adc (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
sta IE IE = X2
iny
lda DX+1
adc (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
sta IE+1
jsr MENU.GetMItems
.1 lda (ZPPtr1)
beq .4
cmp #S.MITEM.T.SEP
beq .2
lda DY Y1
2022-10-25 06:05:54 +00:00
clc
adc SYSFON.Hp1
sta INE INE = Y2
lda DY+1
adc #0
sta INE+1
>LDYAI DX X1,X2,Y1,Y2
jsr MOU.InRectYA
bcc .3
ldy #S.MITEM.S
lda (ZPPtr1),y
bpl .2
2022-10-25 06:05:54 +00:00
eor #S.MITEM.S.SELECTED
2022-10-20 06:07:40 +00:00
sta (ZPPtr1),y was selected before...
2022-11-02 06:54:30 +00:00
jsr MENU.DrawMItemBuf
bcs .9
2022-10-25 06:05:54 +00:00
.2 jsr MENU.NextMItemDY
bra .1
2022-10-25 06:05:54 +00:00
*--------------------------------------
.3 ldy #S.MITEM.S
lda (ZPPtr1),y
2022-10-25 06:05:54 +00:00
bmi .5 already selected, nothing to do
eor #S.MITEM.S.SELECTED
sta (ZPPtr1),y
2022-10-25 06:05:54 +00:00
2022-11-02 06:54:30 +00:00
jsr MENU.DrawMItemBuf
bcs .9
2022-10-25 06:05:54 +00:00
.30 ldx MENU.Stack.Idx
inx
cpx MENU.Stack.Cnt
beq .31
2022-10-25 06:05:54 +00:00
jsr MENU.Destroy
bra .30
2022-10-25 06:05:54 +00:00
.31 lda (ZPPtr1)
cmp #S.MITEM.T.SUBMENU
bne .2
2022-10-25 06:05:54 +00:00
ldy #S.MITEM.pMENU
lda (ZPPtr1),y
2022-10-25 06:05:54 +00:00
sta D
iny
lda (ZPPtr1),y
sta D+1
2022-10-25 06:05:54 +00:00
lda DY
sec
sbc #1
2022-10-25 06:05:54 +00:00
sta Counter
lda DY+1
sbc #0
2022-10-25 06:05:54 +00:00
sta Counter+1
bra .2
*--------------------------------------
.8 clc
.9 rts
*--------------------------------------
.4 lda D
2022-10-25 06:05:54 +00:00
ora D+1
beq .5
>PUSHW D pMENU
ldy #S.OBJ.X2
lda (ZPObjPtr),y
clc
adc #1
tax
iny
lda (ZPObjPtr),y
adc #0
>PUSHA
txa
>PUSHA
>PUSHW Counter Y1
jsr MENU.New
bcc MENU.Draw
rts
2022-10-25 06:05:54 +00:00
*--------------------------------------
.5 lda MSG+S.MSG.S
bit #S.XY.S.CLK
2022-10-25 06:05:54 +00:00
beq .8
lda #S.MSG.T.ID
sta MSG+S.MSG.T
2022-10-25 06:05:54 +00:00
ldy #S.MITEM.ID
lda (ZPPtr1),y
sta MSG+S.MSG.ID
jmp MENU.DestroyAll
*--------------------------------------
MENU.Leave clc
rts
*--------------------------------------
* DrawMenu(hMENU)
*--------------------------------------
MENU.Draw >SYSCALL2 GetMemPtr
>STYA ZPObjPtr
>LDYA L.WND.Screen
jsr CLIP.GetRect
lda #S.CB.CMD.GETRECTBUFSIZE
sta CB.Cache+S.CB.CMD
2022-10-25 06:05:54 +00:00
jsr CB.GetObjX1Y1X2Y2
jsr CB.GFXWriteClip
bcs .9
>SYSCALL2 NewStkObj
bcs .9
stx CB.Cache+S.CB.DstPtr
stz CB.Cache+S.CB.DstPtr+1
txa
ldy #S.MENU.hSAVEBUF
sta (ZPObjPtr),y
lda #S.CB.CMD.BITBLT
sta CB.Cache+S.CB.CMD
lda #S.CB.OP.SAVE
sta CB.Cache+S.CB.OP
jsr CB.ResetSrcXY
jsr CB.GetObjSrcWH
jsr CB.Write
>LDYA ZPObjPtr
2022-10-25 06:05:54 +00:00
ldx #0
jsr OBJ.DrawBorders
bcs .9
2022-10-25 06:05:54 +00:00
jsr MENU.GetDXDY
jsr MENU.GetMItems
2022-10-19 06:26:48 +00:00
.1 lda (ZPPtr1)
beq .8
jsr MENU.DrawMItemBuf
bcs .9
jsr MENU.NextMItemDY
2022-10-19 06:26:48 +00:00
bra .1
.8 clc
2022-11-02 06:54:30 +00:00
.9 rts
*--------------------------------------
MENU.DrawMItemBuf
jsr CB.GetBuf
bcs .9
jsr MENU.DrawMItem
bcs .9
jmp CB.FlushBuf
.9 rts
*--------------------------------------
2022-10-25 06:05:54 +00:00
MENU.DrawMItem jsr MENU.ResetX1Y1X2
2020-10-20 09:38:48 +00:00
2022-10-25 06:05:54 +00:00
lda (ZPPtr1)
cmp #S.MITEM.T.SEP
bne .1
2020-10-26 16:32:51 +00:00
2022-10-27 15:14:06 +00:00
jsr CB.BorderLineH
jmp CB.Cache2CBBuf
2020-10-20 06:01:04 +00:00
*--------------------------------------
.1 jsr MENU.IsSelected
2020-10-26 16:32:51 +00:00
2022-11-02 06:54:30 +00:00
lda PREFS.MenuColor
bcc .2
2020-10-26 16:32:51 +00:00
2022-11-02 06:54:30 +00:00
eor #$ff
2020-10-26 16:32:51 +00:00
.2 jsr CB.FillRectMonoA
2020-10-26 16:32:51 +00:00
2022-10-25 06:05:54 +00:00
lda CB.Cache+S.CB.Y1
2020-10-20 06:01:04 +00:00
sec
adc SYSFON.H
sta CB.Cache+S.CB.Y2
2022-10-25 06:05:54 +00:00
lda CB.Cache+S.CB.Y1+1
2020-10-12 06:04:19 +00:00
adc #0
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.Y2+1
jsr CB.Cache2CBBuf
2022-10-19 15:23:41 +00:00
*--------------------------------------
jsr CB.IncY1 Y1:1px margin
lda #8 TODO : Checked
jsr CB.AddA2X1
2020-10-20 06:01:04 +00:00
jsr MENU.GetIcon
beq .3
2020-10-26 16:32:51 +00:00
2022-10-19 15:23:41 +00:00
jsr DRAW.yaBM
*--------------------------------------
.3 ldy #S.MENU.iW
lda (ZPObjPtr),y
jsr CB.AddA2X1
2020-10-26 16:32:51 +00:00
2022-11-02 06:54:30 +00:00
jsr MENU.GetText
2020-10-12 06:04:19 +00:00
ldx hSYSFON
2022-10-19 15:23:41 +00:00
jsr DRAW.YAText
2020-10-12 06:04:19 +00:00
ldy #S.MENU.tW+1
lda (ZPObjPtr),y
tax
dey
lda (ZPObjPtr),y
jsr CB.AddAX2X1
*--------------------------------------
2022-10-19 15:23:41 +00:00
lda (ZPPtr1)
cmp #S.MITEM.T.ITEM
bne .4
2022-10-25 06:05:54 +00:00
2022-11-02 06:54:30 +00:00
jsr MENU.GetKeyString C untouched
beq .8
2022-11-02 06:54:30 +00:00
2020-10-12 06:04:19 +00:00
ldx hSYSFON
jmp DRAW.YAText
*--------------------------------------
.4 cmp #S.MITEM.T.SUBMENU
2020-10-16 15:25:29 +00:00
bne .8
2020-10-12 06:04:19 +00:00
ldy #S.MENU.kW+1
lda (ZPObjPtr),y
tax
dey
lda (ZPObjPtr),y
jsr CB.AddAX2X1
2020-10-26 16:32:51 +00:00
2020-10-16 15:25:29 +00:00
ldx #BM.ID.RIGHT
2022-10-19 15:23:41 +00:00
jmp DRAW.xBM
2022-10-19 15:23:41 +00:00
.8 clc
2020-10-12 06:04:19 +00:00
rts
*--------------------------------------
MENU.GetIcon ldy #S.MITEM.pICON+1
lda (ZPPtr1),y
bne .1
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
dey
lda (ZPPtr1),y
beq .8
tax
ldy L.BMs,x
lda L.BMs+1,x NON ZERO
.8 rts
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
.1 pha
dey
lda (ZPPtr1),y
tay
pla NON ZERO
2020-10-26 16:32:51 +00:00
rts
2020-10-12 06:04:19 +00:00
*--------------------------------------
2022-11-02 06:54:30 +00:00
MENU.IsSelected ldy #S.MITEM.S
lda (ZPPtr1),y
asl
2020-10-22 06:08:25 +00:00
rts
*--------------------------------------
MENU.GetText ldy #S.MITEM.pTEXT
2022-10-25 06:05:54 +00:00
lda (ZPPtr1),y
pha
iny
lda (ZPPtr1),y
ply
2020-10-12 06:04:19 +00:00
rts
*--------------------------------------
* ZPPtr1 = pMITEM
*--------------------------------------
2020-10-12 06:04:19 +00:00
MENU.GetKeyString
ldy #S.MITEM.KEY
2020-10-12 06:04:19 +00:00
lda (ZPPtr1),y
dey S.MITEM.KEYMOD
ora (ZPPtr1),y
beq .9
2020-10-12 06:04:19 +00:00
ldx #0
lda (ZPPtr1),y
beq .3
2022-10-25 06:05:54 +00:00
bit #KEYMOD.CTRL
beq .1
2022-10-25 06:05:54 +00:00
ldy #KEYMOD.S.CTRL
jsr .4
.1 bit #KEYMOD.OA
beq .2
ldy #KEYMOD.S.OA
jsr .4
.2 bit #KEYMOD.CA
beq .3
2022-10-25 06:05:54 +00:00
ldy #KEYMOD.S.CA
jsr .4
.3 ldy #S.MITEM.KEY
lda (ZPPtr1),y
sta TEXTBUF,x
stz TEXTBUF+1,x
2022-11-02 06:54:30 +00:00
>LDYA L.TEXTBUF NZ
rts
*--------------------------------------
.4 pha
2020-10-12 06:04:19 +00:00
.5 lda KEYMOD.S,y
sta TEXTBUF,x
beq .6
2022-10-25 06:05:54 +00:00
inx
iny
bra .5
.6 pla
2020-10-26 16:32:51 +00:00
.9 rts
2020-10-15 06:16:45 +00:00
*--------------------------------------
2022-10-25 06:05:54 +00:00
MENU.GetDXDY ldy #S.OBJ.X1
lda (ZPObjPtr),y
2022-10-19 15:23:41 +00:00
clc
adc #1
sta DX
iny
lda (ZPObjPtr),y
2022-10-19 15:23:41 +00:00
adc #0
sta DX+1
ldy #S.OBJ.Y1
lda (ZPObjPtr),y
2022-10-19 06:26:48 +00:00
clc
adc #1
2022-10-19 15:23:41 +00:00
sta DY
2022-10-19 06:26:48 +00:00
iny
lda (ZPObjPtr),y
2022-10-19 06:26:48 +00:00
adc #0
2022-10-19 15:23:41 +00:00
sta DY+1
2022-10-19 06:26:48 +00:00
2020-10-20 06:01:04 +00:00
rts
*--------------------------------------
2022-10-20 06:07:40 +00:00
MENU.ResetX1Y1X2
2022-10-25 06:05:54 +00:00
ldy #S.OBJ.X1
lda (ZPObjPtr),y
2022-10-20 06:07:40 +00:00
clc
2022-10-25 06:05:54 +00:00
adc #1
sta CB.Cache+S.CB.X1
iny
lda (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
adc #0
2022-10-19 15:23:41 +00:00
sta CB.Cache+S.CB.X1+1
2022-10-25 06:05:54 +00:00
2022-10-20 06:07:40 +00:00
lda DY
sta CB.Cache+S.CB.Y1
lda DY+1
sta CB.Cache+S.CB.Y1+1
2020-10-26 16:32:51 +00:00
2022-10-25 06:05:54 +00:00
ldy #S.OBJ.X2
lda (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
sec
sbc #1
sta CB.Cache+S.CB.X2
iny
lda (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
sbc #0
sta CB.Cache+S.CB.X2+1
rts
*--------------------------------------
MENU.GetMItems lda ZPObjPtr
clc
adc #S.MENU.Items
2020-10-20 06:01:04 +00:00
sta ZPPtr1
lda ZPObjPtr+1
adc /S.MENU.Items
2020-10-20 06:01:04 +00:00
sta ZPPtr1+1
rts
*--------------------------------------
MENU.NextMItemDY
lda (ZPPtr1)
2020-10-20 06:01:04 +00:00
sec
eor #S.MITEM.T.SEP
2020-10-20 06:01:04 +00:00
beq .1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda SYSFON.Hp2
clc
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.1 adc DY
sta DY
bcc MENU.NextMItem
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
inc DY+1
2020-10-26 16:32:51 +00:00
MENU.NextMItem lda #S.MITEM
jmp SkipAPtr1
2020-10-09 06:02:45 +00:00
*--------------------------------------
2022-10-25 06:05:54 +00:00
MENU.DestroyAll sec
.HS 90 BCC
MENU.Destroy clc
ldx MENU.Stack.Cnt
beq .8
php
2022-11-02 06:54:30 +00:00
jsr PTR.Disable
2022-10-25 06:05:54 +00:00
2022-11-03 16:21:26 +00:00
lda #S.CB.CMD.BITBLT
sta CB.Cache+S.CB.CMD
2022-10-25 06:05:54 +00:00
lda #S.CB.OP.RESTORE
sta CB.Cache+S.CB.OP
plp
lda ZPObjPtr+1
pha
lda ZPObjPtr
pha
2022-10-25 06:05:54 +00:00
.2 php
ldx MENU.Stack.Cnt
lda MENU.Stack-1,x
>SYSCALL2 GetMemPtr
>STYA ZPObjPtr
jsr CB.GetObjX1Y1X2Y2
2022-10-25 06:05:54 +00:00
jsr CB.ResetSrcXY
2022-10-25 06:05:54 +00:00
jsr CB.GetObjSrcWH
2022-10-25 06:05:54 +00:00
ldy #S.MENU.hSAVEBUF
lda (ZPObjPtr),y
sta CB.Cache+S.CB.DstPtr
stz CB.Cache+S.CB.DstPtr+1
2022-10-25 06:05:54 +00:00
ldx #0 Select CB.Cache
jsr CB.GFXWriteX Direct Write (no clip)
2022-10-25 06:05:54 +00:00
ldy #S.MENU.hSAVEBUF
lda (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
>SYSCALL2 FreeStkObj
ldx MENU.Stack.Cnt
lda MENU.Stack-1,x
>SYSCALL2 FreeMem
plp Destroy all ?
dec MENU.Stack.Cnt
bcc .7 no
bne .2
.7 pla
sta ZPObjPtr
pla
sta ZPObjPtr+1
jmp PTR.Enable
2022-10-25 06:05:54 +00:00
.8 clc
rts
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.menu
LOAD usr/src/lib/libgui.s
ASM