A2osX/LIB/LIBGUI.S.MBAR.txt

381 lines
6.1 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 ZPPtr2 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 ZPObjPtr
2022-10-25 06:05:54 +00:00
phx hMBAR
lda #S.OBJ.T.MBAR
sta (ZPObjPtr) S.OBJ.T
2022-10-25 06:05:54 +00:00
lda #0
ldy #S.MBAR.Items-1
.1 sta (ZPObjPtr),y
2022-10-25 06:05:54 +00:00
dey
bne .1
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
*--------------------------------------
* ZPPtr2 = defintion
* ZPObjPtr = DstMBar
* ZPPtr1 = DstMBItem
2022-10-25 06:05:54 +00:00
*--------------------------------------
MBAR.GetData jsr MBAR.GetMBItems
2020-10-23 15:23:19 +00:00
.1 lda (ZPPtr2)
2022-10-25 06:05:54 +00:00
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 ZPPtr2 pTEXT
ldx hSYSFON
jsr FON.GetTextSize
lda PREFS.XMargin
2022-10-25 06:05:54 +00:00
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 ZPPtr2 pTEXT
2022-10-25 06:05:54 +00:00
jsr MBAR.AddWord
2020-10-23 15:23:19 +00:00
jsr SkipStrZPtr2 skip "TEXT\0"
2022-10-25 06:05:54 +00:00
lda (ZPPtr2)
2022-10-27 06:20:09 +00:00
jsr MBAR.AddByte pMENU
ldy #1
lda (ZPPtr2),y
2022-10-25 06:05:54 +00:00
jsr MBAR.AddByte pMENU+1
lda #2
jsr SkipAPtr2 stkip pMENU
2022-10-25 06:05:54 +00:00
bra .1
.8 sta (ZPPtr1)
2022-10-25 06:05:54 +00:00
rts
*--------------------------------------
2022-10-25 06:05:54 +00:00
MBAR.AddWord pha
tya
jsr MBAR.AddByte
pla
MBAR.AddByte sta (ZPPtr1)
inc ZPPtr1
2022-10-25 06:05:54 +00:00
bne .8
inc ZPPtr1+1
2022-10-25 06:05:54 +00:00
.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 ZPObjPtr 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
jsr MBAR.SetX2 set X2 = X1 + W - 1
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
*--------------------------------------
MBAR.Leave clc
rts
*--------------------------------------
* ZPWNDPtr parent WND
* ZPObjPtr = MBAR
2022-10-27 15:14:06 +00:00
* 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 - 1
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
.7 jsr CB.FlushBuf
2022-10-27 06:20:09 +00:00
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 ZPObjPtr pMBAR
2022-10-25 06:05:54 +00:00
ldy #S.OBJ.X1
ldx #S.CB.X1
jsr CB.GetWndYCacheX
2022-10-27 15:14:06 +00:00
jsr CB.GetBuf
bcs .9
2022-10-25 06:05:54 +00:00
jsr MBAR.GetMBItems
.1 lda (ZPPtr1)
beq .8
jsr MBAR.SetX2 set X2 = X1 + W - 1
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
.8 jsr CB.X2ToX1
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
jsr CB.Cache2CBBuf
jmp CB.FlushBuf
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
lda PREFS.XMargin
jsr CB.AddA2X1
jsr CB.IncY1
2022-10-25 06:05:54 +00:00
ldy #S.MBITEM.pTEXT
lda (ZPPtr1),y
pha
iny
lda (ZPPtr1),y
ply
ldx hSYSFON
jmp DRAW.YAText
2022-10-25 06:05:54 +00:00
*--------------------------------------
MBAR.GetMBItems lda ZPObjPtr
clc
2022-10-25 06:05:54 +00:00
adc #S.MBAR.Items
sta ZPPtr1
2020-10-23 15:23:19 +00:00
lda ZPObjPtr+1
2022-10-25 06:05:54 +00:00
adc /S.MBAR.Items
sta ZPPtr1+1
2020-10-23 15:23:19 +00:00
rts
*--------------------------------------
MBAR.NextMBItem jsr CB.X2ToX1
2022-10-27 15:14:06 +00:00
2022-10-25 15:23:50 +00:00
lda #S.MBITEM
jmp SkipAPtr1
*--------------------------------------
MBAR.SetX2 ldy #S.MBITEM.W
lda (ZPPtr1),y
2022-10-25 06:05:54 +00:00
clc
adc CB.Cache+S.CB.X1
pha
2022-10-25 06:05:54 +00:00
iny
lda (ZPPtr1),y
adc CB.Cache+S.CB.X1+1
ply
bne .1
dec
.1 dey
sty CB.Cache+S.CB.X2
2022-10-25 06:05:54 +00:00
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
ldx #S.CB.Y1
jsr CB.GetWndYCacheX
2022-10-25 06:05:54 +00:00
ldy #S.WND.MBarY2
ldx #S.CB.Y2
jmp CB.GetWndYCacheX
*--------------------------------------
2020-10-23 15:23:19 +00:00
MAN
SAVE usr/src/lib/libgui.s.mbar
LOAD usr/src/lib/libgui.s
ASM