A2osX/LIB/LIBGUI.S.MENU.txt

922 lines
14 KiB
Plaintext
Raw Normal View History

NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
*--------------------------------------
2020-10-15 06:16:45 +00:00
* MENU.New(int X, int Y, *S.RECT parent *S.MITEM mitems)
2020-09-07 20:40:50 +00:00
*--------------------------------------
2020-10-13 15:54:55 +00:00
MENU.New ldy MENU.Stack.Top
cpy #MENU.MAX
2020-10-20 06:01:04 +00:00
bcc .10
jmp .90
2020-10-13 15:54:55 +00:00
2020-10-20 06:01:04 +00:00
.10 >LDYAI S.MENU
2020-10-09 06:02:45 +00:00
>SYSCALL2 getmem
2020-10-15 15:19:13 +00:00
bcs .99
2020-10-09 06:02:45 +00:00
>STYA ZPMENUPtr
2020-10-20 06:01:04 +00:00
txa hMenu
ldx MENU.Stack.Top
sta MENU.Stack,x
2020-10-09 06:02:45 +00:00
lda #S.OBJ.T.MENU
sta (ZPMENUPtr) S.OBJ.T
lda #0
ldy #S.MENU-1
.1 sta (ZPMENUPtr),y
dey
bne .1
2020-10-26 16:32:51 +00:00
2020-10-09 06:02:45 +00:00
>PULLA
2020-10-09 15:28:01 +00:00
ldy #S.MENU.MITEMS
2020-10-09 06:02:45 +00:00
sta (ZPMENUPtr),y
>PULLA
iny
sta (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
>PULLW ZPRECTPtr Parent RECT
2020-10-26 16:32:51 +00:00
2020-10-09 06:02:45 +00:00
>PULLA
ldy #S.OBJ.Y1
sta (ZPMENUPtr),y
>PULLA
iny
sta (ZPMENUPtr),y
>PULLA
ldy #S.OBJ.X1
sta (ZPMENUPtr),y
>PULLA
iny
sta (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
lda ZPMENUPtr
clc
adc #S.MENU.pX1
2020-10-20 06:01:04 +00:00
sta ZPPtr1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda ZPMENUPtr+1
adc /S.MENU.pX1
sta ZPPtr1+1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldy #S.RECT-1
2020-10-15 06:16:45 +00:00
2020-10-20 06:01:04 +00:00
.3 lda (ZPRECTPtr),y
sta (ZPPtr1),y
2020-10-15 06:16:45 +00:00
dey
bpl .3
2020-10-09 06:02:45 +00:00
2020-10-20 06:01:04 +00:00
jsr MENU.SetMenuSizePos
2020-10-09 15:28:01 +00:00
2020-10-13 15:54:55 +00:00
ldx MENU.Stack.Top
2020-10-20 06:01:04 +00:00
lda MENU.Stack,x
2020-10-13 15:54:55 +00:00
inc MENU.Stack.Top
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
2020-10-15 15:19:13 +00:00
.99 >POP 8
2020-10-09 15:28:01 +00:00
MENU.New.RTS rts
2020-10-20 06:01:04 +00:00
*--------------------------------------
* hMENU8, ItemID8, Prop8, Value16
*--------------------------------------
MENU.SetMItemProp
2020-10-23 15:23:19 +00:00
ldy #4 hMENU
lda (pStack),y
2020-10-20 06:01:04 +00:00
>SYSCALL2 GetMemPtr
>STYA ZPMENUPtr
ldy #3 ID8
2020-10-23 15:23:19 +00:00
lda (pStack),y
tax
2020-10-26 16:32:51 +00:00
jsr MENU.FindMItemByID
2020-10-23 15:23:19 +00:00
bcs .9
2020-10-20 06:01:04 +00:00
2020-10-23 15:23:19 +00:00
ldy #2 Prop8
2020-10-20 06:01:04 +00:00
lda (pStack),y
tay
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
>PULLA Value16
sta (ZPPtr1),y
iny
>PULLA
sta (ZPPtr1),y
2020-10-23 15:23:19 +00:00
* clc
.8 >POP 3
.9 rts
2020-10-22 06:08:25 +00:00
*--------------------------------------
2020-10-09 15:28:01 +00:00
MENU.Show >SYSCALL2 GetMemPtr
>STYA ZPMENUPtr
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jsr MENU.Save
bcs .9
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
jsr GetCBBuf
2020-10-20 06:01:04 +00:00
bcs .9
2020-10-09 15:28:01 +00:00
2020-10-20 06:01:04 +00:00
jsr MENU.ShowBorders
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jsr MENU.GetMItems
jsr MENU.GetDYW
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.6 lda (ZPPtr1)
beq .8
jsr MENU.GetDX
jsr MENU.ShowMItem
jsr MENU.NextMItem
bra .6
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.8 >LDYA L.WND.Screen
2020-10-26 16:32:51 +00:00
jmp DrawCBBufToYA
2020-10-20 06:01:04 +00:00
.9 rts
*--------------------------------------
MENU.Enter jsr MENU.GetDX
jsr MENU.GetDYW
lda Counter W
clc
adc DX
sta IE IE = X2
lda Counter+1
adc DX+1
sta IE+1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jsr MENU.GetMItems
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.1 lda (ZPPtr1)
2020-10-22 06:08:25 +00:00
beq .8
2020-10-09 15:28:01 +00:00
2020-10-20 06:01:04 +00:00
ldy #S.MITEM.F
lda (ZPPtr1),y
cmp #S.MITEM.F.SEP
2020-10-22 06:08:25 +00:00
beq .2
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda DY
sec
adc SYSFON.H
sta INE INE = Y2
lda DY+1
adc #0
sta INE+1
2020-10-26 16:32:51 +00:00
>LDYAI DX
2020-10-20 06:01:04 +00:00
jsr MOU.InRectYA
2020-10-22 06:08:25 +00:00
bcc .3
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
.2 jsr MENU.NextMItem
bra .1
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
.3 ldy #S.MENU.Selected
2020-10-20 09:38:48 +00:00
lda (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldy #S.MITEM.ID
2020-10-22 06:08:25 +00:00
cmp (ZPPtr1),y
beq .9 same a s before, nothing to do
pha old one
lda (ZPPtr1),y new one
2020-10-20 06:01:04 +00:00
ldy #S.MENU.Selected
sta (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jsr GetCBBuf
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
plx
2020-10-22 06:08:25 +00:00
beq .4 no previous selection
2020-10-26 16:32:51 +00:00
2020-10-23 06:03:23 +00:00
jsr MENU.ShowMItemByID deselect previous...
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
.4 ldy #S.MENU.Selected select new one
lda (ZPMENUPtr),y
tax
2020-10-26 16:32:51 +00:00
2020-10-23 06:03:23 +00:00
jsr MENU.ShowMItemByID
2020-10-22 06:08:25 +00:00
ldy #S.MITEM.F
lda (ZPPtr1),y
cmp #S.MITEM.F.SUBMENU
2020-10-23 06:03:23 +00:00
bne .80
2020-10-26 16:32:51 +00:00
2020-10-23 06:03:23 +00:00
>LDYA L.WND.Screen
2020-10-26 16:32:51 +00:00
jsr DrawCBBufToYA
2020-10-23 15:23:19 +00:00
jmp MENU.NewSubMenu
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
.8 ldy #S.MENU.Selected nothing to select....
lda (ZPMENUPtr),y
beq .9 ....and nothing to deselect
pha
lda #0
sta (ZPMENUPtr),y
jsr GetCBBuf
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
plx
2020-10-23 06:03:23 +00:00
jsr MENU.ShowMItemByID
.80 >LDYA L.WND.Screen
2020-10-26 16:32:51 +00:00
jmp DrawCBBufToYA
.9 lda MouseData+S.MOUSE.S
bit #S.MOUSE.S.CLK
beq .90
2020-10-27 16:33:10 +00:00
* >DEBUG
2020-10-27 07:09:20 +00:00
jmp MENU.DestroyAll
2020-10-26 16:32:51 +00:00
.90 clc
rts
2020-10-20 06:01:04 +00:00
*--------------------------------------
2020-10-23 15:23:19 +00:00
MENU.NewSubMenu ldy #S.MENU.Selected
lda (ZPMENUPtr),y
tax
jsr MENU.FindMItemByID
jsr MENU.GetDX
2020-10-26 16:32:51 +00:00
2020-10-23 15:23:19 +00:00
lda DX
clc
adc Counter
tay
lda DX+1
adc Counter+1
2020-10-26 16:32:51 +00:00
2020-10-23 15:23:19 +00:00
>PUSHYA X1
>PUSHW DY Y1
>PUSHWI DX Parent RECT
2020-10-26 16:32:51 +00:00
2020-10-23 15:23:19 +00:00
ldy #S.MITEM.pMENU+1
lda (ZPPtr1),y
>PUSHA
dey
lda (ZPPtr1),y
>PUSHA
2020-10-26 16:32:51 +00:00
2020-10-23 15:23:19 +00:00
jsr MENU.New
jmp MENU.Show
*--------------------------------------
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
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
2020-10-20 06:01:04 +00:00
jsr MENU.GetMItemW
jsr MENU.NextMItem
2020-10-09 15:28:01 +00:00
bra .1
2020-10-20 06:01:04 +00:00
.3 lda #2+MENU.LMargin+MENU.RMargin 2px Borders+5 LMARGIN (Checked) +5 RMARGIN (SubMenu)
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
2020-10-12 06:04:19 +00:00
sec 1px sep
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
2020-10-12 06:04:19 +00:00
sec 1px sep
2020-10-20 06:01:04 +00:00
adc INE Max Mod-Key W
2020-10-09 15:28:01 +00:00
sta DX
bcc .4
2020-10-26 16:32:51 +00:00
2020-10-09 15:28:01 +00:00
inc DX+1
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
.4 ldy #S.OBJ.W
sta (ZPMENUPtr),y
iny
lda DX+1
sta (ZPMENUPtr),y
iny #S.OBJ.H
lda DY
sta (ZPMENUPtr),y
iny
lda DY+1
sta (ZPMENUPtr),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 (ZPMENUPtr),y
2020-10-20 09:38:48 +00:00
iny #S.MENU.tW
2020-10-20 06:01:04 +00:00
lda IE
sta (ZPMENUPtr),y
iny
lda IE+1
sta (ZPMENUPtr),y
2020-10-20 09:38:48 +00:00
iny #S.MENU.kW
2020-10-20 06:01:04 +00:00
lda INE
sta (ZPMENUPtr),y
iny
lda INE+1
sta (ZPMENUPtr),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
2020-10-12 06:04:19 +00:00
adc (ZPMENUPtr),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
2020-10-12 06:04:19 +00:00
adc (ZPMENUPtr),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
2020-10-09 15:28:01 +00:00
lda (ZPMENUPtr),y
* sec
sbc DY
sta (ZPMENUPtr),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
2020-10-09 15:28:01 +00:00
lda (ZPMENUPtr),y
sbc DY+1
sta (ZPMENUPtr),y
2020-10-09 06:02:45 +00:00
2020-10-12 06:04:19 +00:00
.5 >LDYA ZPMENUPtr
jsr OBJ.SetX2Y2
2020-10-09 06:02:45 +00:00
2020-10-20 06:01:04 +00:00
rts
2020-10-09 15:28:01 +00:00
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.GetMItemW ldy #S.MITEM.F
2020-10-09 15:28:01 +00:00
lda (ZPPtr1),y
cmp #S.MITEM.F.SEP
2020-10-20 06:01:04 +00:00
beq .8
2020-10-09 15:28:01 +00:00
ldy #S.MITEM.pICON
lda (ZPPtr1),y
iny
ora (ZPPtr1),y
beq .1
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
lda #17 Reserve space for Icon W + 1px SEP
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
2020-10-09 15:28:01 +00:00
beq .8
ldx hSYSFON
jsr FON.GetTextSize
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
lda CB.Cache+S.CB.SrcW
cmp INE
bcc .8
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
sta INE set Max Mod-key W
2020-10-26 16:32:51 +00:00
.8 rts
2020-10-09 15:28:01 +00:00
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.ShowBorders
lda #S.CB.CMD.HLINE
jsr CB.InitCacheA
2020-10-09 15:28:01 +00:00
lda #S.CB.OP.SET
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.OP
2020-10-09 15:28:01 +00:00
lda #S.CB.M.MONO
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.M
2020-10-09 15:28:01 +00:00
lda PREFS.BORDERCOLOR
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.COLOR
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldy #S.OBJ.X2+1
ldx #5
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.1 lda (ZPMENUPtr),y
sta CB.Cache+S.CB.X1,x
dey
dex
bpl .1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda CB.Cache+S.CB.Y1
sta CB.Cache+S.CB.Y2
lda CB.Cache+S.CB.Y1+1
2020-10-26 16:32:51 +00:00
sta CB.Cache+S.CB.Y2+1 top X1,Y1,X2,Y1
2020-10-20 06:01:04 +00:00
jsr PutCBCache2CBBuf
ldy #S.OBJ.Y2
2020-10-09 15:28:01 +00:00
lda (ZPMENUPtr),y
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.Y1
sta CB.Cache+S.CB.Y2
2020-10-09 15:28:01 +00:00
iny
lda (ZPMENUPtr),y
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.Y1+1
sta CB.Cache+S.CB.Y2+1 bottom X1,Y2,X2,Y2
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
jsr PutCBCache2CBBuf
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
lda #S.CB.CMD.VLINE
sta CB.Cache+S.CB.CMD
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
ldy #S.OBJ.Y1
lda (ZPMENUPtr),y
sta CB.Cache+S.CB.Y1
iny
lda (ZPMENUPtr),y
sta CB.Cache+S.CB.Y1+1
2020-10-26 16:32:51 +00:00
2020-10-20 09:38:48 +00:00
lda CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X2
lda CB.Cache+S.CB.X1+1
2020-10-26 16:32:51 +00:00
sta CB.Cache+S.CB.X2+1 left X1,Y1,X1,Y2
2020-10-20 09:38:48 +00:00
jsr PutCBCache2CBBuf
ldy #S.OBJ.X2
lda (ZPMENUPtr),y
sta CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X2
iny
lda (ZPMENUPtr),y
sta CB.Cache+S.CB.X1+1
sta CB.Cache+S.CB.X2+1 right X2,Y1,X2,Y2
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jmp PutCBCache2CBBuf
*--------------------------------------
2020-10-23 06:03:23 +00:00
MENU.ShowMItemByID
jsr MENU.FindMItemByID
jsr MENU.GetDX
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.ShowMItem ldy #S.MITEM.F
2020-10-12 06:04:19 +00:00
lda (ZPPtr1),y
cmp #S.MITEM.F.SEP
2020-10-20 06:01:04 +00:00
bne MENU.ShowMItem1
2020-10-26 16:32:51 +00:00
lda #S.CB.CMD.HLINE
2020-10-20 06:01:04 +00:00
jsr CB.InitCacheA
2020-10-12 06:04:19 +00:00
lda #S.CB.OP.SET
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.OP
2020-10-12 06:04:19 +00:00
lda #S.CB.M.MONO
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.M
2020-10-12 06:04:19 +00:00
lda PREFS.BORDERCOLOR
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.COLOR
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldx #3
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.1 lda DX,x
sta CB.Cache+S.CB.X1,x
dex
bpl .1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda DX
2020-10-12 06:04:19 +00:00
clc
2020-10-20 06:01:04 +00:00
adc Counter
sta CB.Cache+S.CB.X2
lda DX+1
adc Counter+1
sta CB.Cache+S.CB.X2+1
jmp PutCBCache2CBBuf
*--------------------------------------
MENU.ShowMItem1 lda #S.CB.CMD.FILLRECT
jsr CB.InitCacheA
lda #S.CB.OP.SET
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldx PREFS.MENUCOLOR
2020-10-22 06:08:25 +00:00
jsr MENU.IsSelected
bcc .15
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
txa
eor #C.WHITE
tax
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.15 stx CB.Cache+S.CB.COLOR
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
ldx #3
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.10 lda DX,x
sta CB.Cache+S.CB.X1,x
dex
bpl .10
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda DX
clc
adc Counter
sta CB.Cache+S.CB.X2
lda DX+1
adc Counter+1
sta CB.Cache+S.CB.X2+1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
lda DY
sec
adc SYSFON.H
sta CB.Cache+S.CB.Y2
2020-10-12 06:04:19 +00:00
lda DY+1
adc #0
2020-10-20 06:01:04 +00:00
sta CB.Cache+S.CB.Y2+1
jsr PutCBCache2CBBuf
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
inc DY
bne .12
inc DY+1
2020-10-12 06:04:19 +00:00
2020-10-20 06:01:04 +00:00
.12 lda DX
clc
2020-10-26 16:32:51 +00:00
2020-10-13 15:54:55 +00:00
adc #MENU.LMargin TODO : Checked
2020-10-12 06:04:19 +00:00
sta DX
2020-10-20 06:01:04 +00:00
bcc .11
2020-10-12 06:04:19 +00:00
sta DX+1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.11 jsr MENU.GetIcon
2020-10-12 06:04:19 +00:00
beq .2
2020-10-26 16:32:51 +00:00
2020-10-26 06:38:50 +00:00
jsr DRAW.yaBMAtDXDY
2020-10-26 16:32:51 +00:00
2020-10-12 06:04:19 +00:00
.2 lda DX
clc
2020-10-20 09:38:48 +00:00
ldy #S.MENU.iW
adc (ZPMENUPtr),y
2020-10-12 06:04:19 +00:00
sta DX
2020-10-20 06:01:04 +00:00
bcc .21
2020-10-12 06:04:19 +00:00
2020-10-20 06:01:04 +00:00
inc DX+1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.21 jsr MENU.GetText
2020-10-12 06:04:19 +00:00
2020-10-22 06:08:25 +00:00
jsr MENU.IsSelected
2020-10-12 06:04:19 +00:00
ldx hSYSFON
jsr DRAW.YATextAtDXDY
lda DX
sec
2020-10-20 09:38:48 +00:00
ldy #S.MENU.tW
adc (ZPMENUPtr),y
2020-10-12 06:04:19 +00:00
sta DX
lda DX+1
2020-10-20 06:01:04 +00:00
iny
2020-10-20 09:38:48 +00:00
adc (ZPMENUPtr),y
2020-10-12 06:04:19 +00:00
sta DX+1
2020-10-13 15:54:55 +00:00
jsr MENU.GetKeyString
beq .3
2020-10-22 06:08:25 +00:00
jsr MENU.IsSelected
2020-10-12 06:04:19 +00:00
ldx hSYSFON
jsr DRAW.YATextAtDXDY
2020-10-26 16:32:51 +00:00
2020-10-16 15:25:29 +00:00
.3 ldy #S.MITEM.F
lda (ZPPtr1),y
cmp #S.MITEM.F.SUBMENU
bne .8
2020-10-12 06:04:19 +00:00
2020-10-16 15:25:29 +00:00
lda DX
sec
2020-10-20 09:38:48 +00:00
ldy #S.MENU.kW
adc (ZPMENUPtr),y
2020-10-16 15:25:29 +00:00
sta DX
lda DX+1
2020-10-20 06:01:04 +00:00
iny
2020-10-20 09:38:48 +00:00
adc (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
sta DX+1
2020-10-16 15:25:29 +00:00
ldx #BM.ID.RIGHT
2020-10-26 06:38:50 +00:00
jsr DRAW.xBMAtDXDY
2020-10-16 15:25:29 +00:00
2020-10-20 06:01:04 +00:00
.8 lda DY
bne .80
dec DY+1
2020-10-26 16:32:51 +00:00
.80 dec DY
2020-10-20 06:01:04 +00:00
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
*--------------------------------------
2020-10-22 06:08:25 +00:00
MENU.IsSelected phy
pha
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
ldy #S.MENU.Selected
lda (ZPMENUPtr),y
ldy #S.MITEM.ID
cmp (ZPPtr1),y
beq .9
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
clc
2020-10-26 16:32:51 +00:00
2020-10-22 06:08:25 +00:00
.9 pla
ply
rts
*--------------------------------------
2020-10-12 06:04:19 +00:00
MENU.GetText lda #S.MITEM.TEXT
clc
adc ZPPtr1
tay
lda ZPPtr1+1
adc #0
rts
*--------------------------------------
MENU.GetKeyString
2020-10-13 15:54:55 +00:00
ldy #S.MITEM.KEYSTR
2020-10-12 06:04:19 +00:00
lda (ZPPtr1),y
2020-10-13 15:54:55 +00:00
beq .8
2020-10-12 06:04:19 +00:00
2020-10-13 15:54:55 +00:00
clc
adc ZPPtr1
tay
lda ZPPtr1+1
adc #0 !0
2020-10-12 06:04:19 +00:00
2020-10-26 16:32:51 +00:00
.8 rts
2020-10-12 06:04:19 +00:00
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.Save lda #S.CB.CMD.GETRECTBUFSIZE
jsr CB.InitCacheA
2020-10-15 06:16:45 +00:00
ldy #S.OBJ.X1
ldx #0
.1 lda (ZPMENUPtr),y
sta CB.Cache+S.CB.X1,x
iny
inx
cpx #8 X1,Y1,X2,Y2
bne .1
jsr GFXWrite.CB
2021-02-22 17:17:37 +00:00
>SYSCALL2 NewStkObj
2020-10-15 06:16:45 +00:00
bcs .9
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
stx CB.Cache+S.CB.DstPtr
txa
ldy #S.MENU.hSAVEBUF
sta (ZPMENUPtr),y
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
lda #S.CB.CMD.BITBLT
sta CB.Cache+S.CB.CMD
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
lda #S.CB.OP.SAVE
sta CB.Cache+S.CB.OP
ldy #S.OBJ.W
ldx #0
.2 lda (ZPMENUPtr),y
sta CB.Cache+S.CB.SrcW,x
iny
inx
cpx #4 W,H
bne .2
jsr GFXWrite.CB
2020-10-12 06:04:19 +00:00
clc
2020-10-15 06:16:45 +00:00
2020-10-26 16:32:51 +00:00
.9 rts
2020-10-15 06:16:45 +00:00
*--------------------------------------
2020-10-27 07:09:20 +00:00
MENU.DestroyAll sec
.HS 90 BCC
MENU.Destroy clc
ldx MENU.Stack.Top
2020-10-15 06:16:45 +00:00
beq .8
2020-10-26 16:32:51 +00:00
2020-10-27 07:09:20 +00:00
php
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
bit CUR.bVisible
2020-10-27 07:09:20 +00:00
bpl .1
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
jsr HideCursor.I
2020-10-26 16:32:51 +00:00
2020-10-27 07:09:20 +00:00
.1 jsr CB.ClearCache
2020-10-15 06:16:45 +00:00
lda #S.CB.CMD.BITBLT
2020-10-27 07:09:20 +00:00
jsr CB.InitCacheA
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
lda #S.CB.OP.RESTORE
sta CB.Cache+S.CB.OP
2020-10-27 07:09:20 +00:00
plp
.2 php
ldx MENU.Stack.Top
lda MENU.Stack-1,x
2021-02-22 17:17:37 +00:00
>SYSCALL2 GetMemPtr
2020-10-27 07:09:20 +00:00
>STYA ZPMENUPtr
2020-10-15 06:16:45 +00:00
ldy #S.OBJ.X1
ldx #0
2020-10-27 07:09:20 +00:00
.3 lda (ZPMENUPtr),y
2020-10-15 06:16:45 +00:00
sta CB.Cache+S.CB.X1,x
iny
inx
cpx #8 X1,Y1,X2,Y2
2020-10-27 07:09:20 +00:00
bne .3
2020-10-15 06:16:45 +00:00
ldy #S.OBJ.W
ldx #0
2020-10-27 07:09:20 +00:00
.4 lda (ZPMENUPtr),y
2020-10-15 06:16:45 +00:00
sta CB.Cache+S.CB.SrcW,x
iny
inx
cpx #4 W,H
2020-10-27 07:09:20 +00:00
bne .4
2020-10-15 06:16:45 +00:00
ldy #S.MENU.hSAVEBUF
lda (ZPMENUPtr),y
sta CB.Cache+S.CB.DstPtr
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
jsr GFXWrite.CB
lda CB.Cache+S.CB.DstPtr
>SYSCALL2 FreeStkObj
ldx MENU.Stack.Top
lda MENU.Stack-1,x
>SYSCALL2 FreeMem
2020-10-27 07:09:20 +00:00
plp
2020-10-15 06:16:45 +00:00
dec MENU.Stack.Top
2020-10-27 07:09:20 +00:00
bcc .7
2020-10-26 16:32:51 +00:00
2020-10-27 07:09:20 +00:00
bne .2
.7 bit CUR.bVisible
2020-10-20 06:01:04 +00:00
bpl .8
2020-10-26 16:32:51 +00:00
2020-10-27 07:09:20 +00:00
jmp ShowCursor.I
2020-10-20 06:01:04 +00:00
.8 clc
rts
*--------------------------------------
MENU.GetDX ldy #S.OBJ.X1
lda (ZPMENUPtr),y
clc
adc #1
sta DX
iny
lda (ZPMENUPtr),y
adc #0
sta DX+1
rts
*--------------------------------------
MENU.GetDYW ldy #S.OBJ.Y1
lda (ZPMENUPtr),y
clc
adc #1
sta DY
iny
lda (ZPMENUPtr),y
adc #0
sta DY+1
ldy #S.OBJ.W
lda (ZPMENUPtr),y
sec
sbc #3 2Px border + correction from W
sta Counter
iny
lda (ZPMENUPtr),y
sbc #0
sta Counter+1
2020-10-15 06:16:45 +00:00
2020-10-20 06:01:04 +00:00
rts
*--------------------------------------
MENU.FindMItemByID
jsr MENU.GetMItems
2020-10-20 09:38:48 +00:00
jsr MENU.GetDYW
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.1 lda (ZPPtr1)
beq .9
2020-10-26 16:32:51 +00:00
2020-10-23 06:03:23 +00:00
ldy #S.MITEM.F
lda (ZPPtr1),y
cmp #S.MITEM.F.SEP
beq .7
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
txa
ldy #S.MITEM.ID
cmp (ZPPtr1),y
beq .8
2020-10-26 16:32:51 +00:00
2020-10-23 06:03:23 +00:00
.7 jsr MENU.NextMItem
2020-10-20 06:01:04 +00:00
bra .1
2020-10-26 16:32:51 +00:00
2020-10-15 06:16:45 +00:00
.8 clc
2020-10-12 06:04:19 +00:00
rts
2020-10-26 16:32:51 +00:00
2020-10-20 06:01:04 +00:00
.9 sec
rts
*--------------------------------------
MENU.GetMItems ldy #S.MENU.MITEMS
lda (ZPMENUPtr),y
sta ZPPtr1
iny
lda (ZPMENUPtr),y
sta ZPPtr1+1
rts
*--------------------------------------
MENU.NextMItem ldy #S.MITEM.F
lda (ZPPtr1),y
sec
eor #S.MITEM.F.SEP
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 .2
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
2020-10-20 06:01:04 +00:00
.2 lda (ZPPtr1)
clc
adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
2020-10-09 06:02:45 +00:00
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.menu
LOAD usr/src/lib/libgui.s
ASM