A2osX/LIB/LIBGUI.S.MBAR.txt

400 lines
6.6 KiB
Plaintext
Raw Normal View History

2020-10-23 15:23:19 +00:00
NEW
AUTO 3,1
*--------------------------------------
* Y,A = MBAR definition
2020-10-28 16:35:04 +00:00
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.New >STYA ZPPtr1 MBAR definition
>STYA ZPObjPtr for pass #2
2020-10-28 16:35:04 +00:00
2022-10-25 06:05:54 +00:00
jsr MBAR.GetSize
>SYSCALL2 GetMem
bcs .9
>STYA ZPMENUPtr
phx hMBAR
lda #S.OBJ.T.MBAR
sta (ZPMENUPtr) S.OBJ.T
lda #0
ldy #S.MBAR.Items-1
.1 sta (ZPMENUPtr),y
dey
bne .1
>LDYA ZPObjPtr
>STYA ZPPtr1 MENU definition
jsr MBAR.GetData
pla hMBAR
clc
.9 rts
*--------------------------------------
* ZPPtr1 = defintion
*--------------------------------------
MBAR.GetSize lda #S.MBAR.Items+1 Ending\0
sta Counter
stz Counter+1
2022-10-25 06:05:54 +00:00
.1 lda (ZPPtr1)
beq .8
2020-10-28 16:35:04 +00:00
ldy #$ff
2022-10-25 06:05:54 +00:00
.2 iny
lda (ZPPtr1),y
bne .2
tya
2022-10-25 06:05:54 +00:00
sec text Ending\0
2022-10-25 06:05:54 +00:00
inc
inc skip pMENU
2022-10-25 06:05:54 +00:00
jsr SkipAPtr1
lda #S.MBITEM
clc
adc Counter
sta Counter
2022-10-25 06:05:54 +00:00
bcc .1
inc Counter+1
2022-10-25 06:05:54 +00:00
bra .1
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
.8 >LDYA Counter
rts
*--------------------------------------
* ZPPtr1 = defintion
* ZPMENUPtr = DstBuf
*--------------------------------------
MBAR.GetData lda ZPMENUPtr
2020-10-23 15:23:19 +00:00
clc
2022-10-25 06:05:54 +00:00
adc #S.MBAR.Items
sta ZPMENUPtr
bcc .1
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
inc ZPMENUPtr+1
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
.1 lda (ZPPtr1)
beq .8
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
lda #S.MBITEM.T.SUBMENU
jsr MBAR.AddByte
2022-10-25 06:05:54 +00:00
lda #0 S.MBITEM.S
jsr MBAR.AddByte
>LDYA ZPPtr1 pTEXT
ldx hSYSFON
jsr FON.GetTextSize
2022-10-25 06:05:54 +00:00
lda PREFS.MBarXMargin
asl x2
2020-10-23 15:23:19 +00:00
clc
adc CB.CACHE+S.CB.SrcW
2022-10-25 06:05:54 +00:00
tay
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
lda #0
2020-10-23 15:23:19 +00:00
adc CB.CACHE+S.CB.SrcW+1
2022-10-25 06:05:54 +00:00
jsr MBAR.AddWord S.MBITEM.W
2020-10-23 15:23:19 +00:00
>LDYA ZPPtr1 pTEXT
2022-10-25 06:05:54 +00:00
jsr MBAR.AddWord
2020-10-23 15:23:19 +00:00
jsr SkipStrZPtr1 skip "TEXT\0"
2022-10-25 06:05:54 +00:00
2022-10-27 06:20:09 +00:00
lda (ZPPtr1)
jsr MBAR.AddByte pMENU
ldy #1
lda (ZPPtr1),y
2022-10-25 06:05:54 +00:00
jsr MBAR.AddByte pMENU+1
lda #2
jsr SkipAPtr1 stkip pMENU
bra .1
.8 sta (ZPMENUPtr)
rts
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.AddWord pha
tya
jsr MBAR.AddByte
pla
MBAR.AddByte sta (ZPMENUPtr)
inc ZPMENUPtr
bne .8
inc ZPMENUPtr+1
.8 rts
*--------------------------------------
2022-10-25 06:05:54 +00:00
* ZPWNDPtr parent WND
* MSG.X1, MSG.Y1
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.Enter ldy #S.WND.pMBAR
lda (ZPWNDPtr),y
>SYSCALL2 GetMemPtr
>STYA ZPMENUPtr pMBAR
2022-10-26 06:12:16 +00:00
stz ZPPtr2
stz ZPPtr2+1
2022-10-25 06:05:54 +00:00
ldy #S.OBJ.X1
ldx #S.CB.X1
jsr CB.GetWndYCacheX
2022-10-26 06:12:16 +00:00
jsr MBAR.GetMBItems
2022-10-25 06:05:54 +00:00
.1 lda (ZPPtr1)
2022-10-26 06:12:16 +00:00
beq .3
2022-10-25 06:05:54 +00:00
jsr MBAR.SetX2
2022-10-25 06:05:54 +00:00
lda MSG+S.MSG.X1
cmp CB.Cache+S.CB.X1
lda MSG+S.MSG.X1+1
sbc CB.Cache+S.CB.X1+1
2022-10-26 06:12:16 +00:00
bcc .2
2022-10-25 06:05:54 +00:00
lda CB.Cache+S.CB.X2
cmp MSG+S.MSG.X1
lda CB.Cache+S.CB.X2+1
sbc MSG+S.MSG.X1+1
2022-10-26 06:12:16 +00:00
bcc .2
2022-10-25 15:23:50 +00:00
2022-10-26 06:12:16 +00:00
ldy #S.MBITEM.S in RECT....
2022-10-25 06:05:54 +00:00
lda (ZPPtr1),y
2022-10-25 15:23:50 +00:00
bmi .8 Already Selected, nothing to do
2022-10-26 06:12:16 +00:00
>LDYA ZPPtr1
>STYA ZPPtr2 save MBITEM to activate
2022-10-27 15:14:06 +00:00
2022-10-26 06:12:16 +00:00
.2 jsr MBAR.NextMBItem
bra .1
2022-10-27 06:20:09 +00:00
2022-10-27 15:14:06 +00:00
.3 lda ZPPtr2
ora ZPPtr2+1
bne MBAR.Set
2022-10-27 06:20:09 +00:00
.8 clc
.9 rts
2022-10-27 15:14:06 +00:00
*--------------------------------------
* ZPMENUPtr = MBAR
* ZPPtr2 = Item to activate
*--------------------------------------
MBAR.Reset stz ZPPtr2
stz ZPPtr2+1
2022-10-27 06:20:09 +00:00
2022-10-27 15:14:06 +00:00
MBAR.Set jsr MENU.DestroyAll
2022-10-26 06:12:16 +00:00
ldy #S.OBJ.X1
ldx #S.CB.X1
jsr CB.GetWndYCacheX
jsr MBAR.GetMBItems
2022-10-25 06:05:54 +00:00
jsr CB.GetBuf
bcs .9
2022-10-26 06:12:16 +00:00
.4 lda (ZPPtr1)
beq .7
2022-10-27 15:14:06 +00:00
jsr MBAR.SetX2 set X2 = X1 + W
2022-10-25 15:23:50 +00:00
ldy #S.MBITEM.S
lda (ZPPtr1),y
2022-10-26 06:12:16 +00:00
bmi .5
2022-10-27 15:14:06 +00:00
2022-10-26 06:12:16 +00:00
ldx ZPPtr1
cpx ZPPtr2
bne .6
ldx ZPPtr1+1
cpx ZPPtr2+1
bne .6
2022-10-27 15:14:06 +00:00
ldx CB.Cache+S.CB.X1
stx Counter
ldx CB.Cache+S.CB.X1+1
stx Counter+1
2022-10-26 06:12:16 +00:00
.5 eor #S.MBITEM.S.SELECTED
2022-10-25 15:23:50 +00:00
sta (ZPPtr1),y
2022-10-26 06:12:16 +00:00
jsr MBAR.DrawMBItem
bcs .9
2022-10-27 15:14:06 +00:00
.6 jsr MBAR.NextMBItem set X1 = X2
2022-10-26 06:12:16 +00:00
bra .4
2022-10-26 06:12:16 +00:00
.7 >LDYA L.WND.Screen
2022-10-27 06:20:09 +00:00
jsr CB.FlushBufToYA
bcs .9
2022-10-27 15:14:06 +00:00
>LDYA Counter
>STYA DX
ldy #S.WND.MBarY2
lda (ZPWNDPtr),y
sta DY
iny
lda (ZPWNDPtr),y
sta DY+1
2022-10-27 06:20:09 +00:00
ldy #S.MBITEM.pMENU
lda (ZPPtr2),y
pha
iny
lda (ZPPtr2),y
ply
2022-10-27 15:14:06 +00:00
2022-10-27 06:20:09 +00:00
jsr MENU.New.I
2022-10-27 15:14:06 +00:00
bcs .9
2022-10-27 06:20:09 +00:00
jmp MENU.Draw
2022-10-27 15:14:06 +00:00
.9 rts
2022-10-25 06:05:54 +00:00
*--------------------------------------
* ZPWNDPtr = parent WND
*--------------------------------------
MBAR.Draw >SYSCALL2 GetMemPtr
>STYA ZPMENUPtr pMBAR
ldy #S.OBJ.X1
ldx #S.CB.X1
jsr CB.GetWndYCacheX
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
jsr MBAR.GetMBItems
.1 lda (ZPPtr1)
beq .8
2022-10-27 15:14:06 +00:00
jsr MBAR.SetX2 set X2 = X1 + W
2022-10-25 06:05:54 +00:00
jsr MBAR.DrawMBItem
bcs .9
2022-10-25 15:23:50 +00:00
jsr MBAR.NextMBItem
2022-10-25 06:05:54 +00:00
bra .1
2022-10-26 06:12:16 +00:00
.8 lda CB.Cache+S.CB.X2
sta CB.Cache+S.CB.X1
lda CB.Cache+S.CB.X2+1
sta CB.Cache+S.CB.X1+1
2022-10-25 06:05:54 +00:00
2022-10-26 06:12:16 +00:00
ldy #S.OBJ.X2
ldx #S.CB.X2
jsr CB.GetWndYCacheX
2022-10-26 06:12:16 +00:00
jsr MBAR.SetY1Y2
2022-10-27 15:14:06 +00:00
2022-10-26 06:12:16 +00:00
lda PREFS.MBarColor
jsr CB.FillRectMonoA
2022-10-27 15:14:06 +00:00
2022-10-26 06:12:16 +00:00
jmp CB.Cache2CBBuf
2022-10-26 06:12:16 +00:00
.9 rts
*--------------------------------------
MBAR.DrawMBItem ldy #S.MBITEM.S
2022-10-25 06:05:54 +00:00
lda (ZPPtr1),y
asl
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
lda PREFS.MBarColor
bcc .1
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
eor #$ff
2022-10-26 06:12:16 +00:00
.1 jsr CB.FillRectMonoA
2022-10-25 06:05:54 +00:00
jsr MBAR.SetY1Y2
2022-10-25 06:05:54 +00:00
jsr CB.Cache2CBBuf
2022-10-25 06:05:54 +00:00
lda PREFS.MBarXMargin
clc
2022-10-25 06:05:54 +00:00
adc CB.Cache+S.CB.X1
sta CB.Cache+S.CB.X1
bcc .10
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
inc CB.Cache+S.CB.X1+1
2022-10-25 06:05:54 +00:00
.10 inc CB.Cache+S.CB.Y1
bne .11
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
inc CB.Cache+S.CB.Y1+1
2022-10-25 06:05:54 +00:00
.11 ldy #S.MBITEM.S
lda (ZPPtr1),y
asl
2022-10-25 06:05:54 +00:00
ldy #S.MBITEM.pTEXT
lda (ZPPtr1),y
pha
iny
lda (ZPPtr1),y
ply
ldx hSYSFON
jsr DRAW.YAText
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
jmp CB.Cache2CBBuf
*--------------------------------------
MBAR.GetMBItems lda ZPMENUPtr
clc
2022-10-25 06:05:54 +00:00
adc #S.MBAR.Items
sta ZPPtr1
2020-10-23 15:23:19 +00:00
2022-10-25 06:05:54 +00:00
lda ZPMENUPtr+1
adc /S.MBAR.Items
sta ZPPtr1+1
2020-10-23 15:23:19 +00:00
rts
*--------------------------------------
2022-10-25 15:23:50 +00:00
MBAR.NextMBItem lda CB.Cache+S.CB.X2
sta CB.Cache+S.CB.X1
lda CB.Cache+S.CB.X2+1
sta CB.Cache+S.CB.X1+1
2022-10-27 15:14:06 +00:00
2022-10-25 15:23:50 +00:00
lda #S.MBITEM
jmp SkipAPtr1
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.SetX2 lda CB.Cache+S.CB.X1
clc
ldy #S.MBITEM.W
adc (ZPPtr1),y
sta CB.Cache+S.CB.X2
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
lda CB.Cache+S.CB.X1+1
iny
adc (ZPPtr1),y
sta CB.Cache+S.CB.X2+1
2022-10-27 15:14:06 +00:00
2022-10-25 06:05:54 +00:00
rts
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.SetY1Y2 ldy #S.WND.MBarY1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1+1
2022-10-25 06:05:54 +00:00
ldy #S.WND.MBarY2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2+1
rts
*--------------------------------------
2020-10-23 15:23:19 +00:00
MAN
SAVE usr/src/lib/libgui.s.mbar
LOAD usr/src/lib/libgui.s
ASM