A2osX/LIB/LIBGUI.S.MBAR.txt

262 lines
4.2 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
*--------------------------------------
MBAR.New >STYA ZPMENUPtr MBAR definition
>STYA ZPPtr1 for pass #2
2020-10-28 16:35:04 +00:00
lda #S.MBAR.Items+1 Ending\0
sta Counter
stz Counter+1
2020-10-28 16:35:04 +00:00
.10 lda (ZPMENUPtr)
beq .3
2020-10-28 16:35:04 +00:00
ldy #$ff
.1 iny
lda (ZPMENUPtr),y
2020-10-28 16:35:04 +00:00
bne .1
tya
sec text Ending\0
inc
inc skip pMENU
adc ZPMENUPtr
sta ZPMENUPtr
bcc .2
inc ZPMENUPtr+1
.2 tya
sec
adc #S.MBITEM
adc Counter
sta Counter
bcc .10
inc Counter+1
bra .10
2020-10-23 15:23:19 +00:00
.3 >LDYA Counter
>SYSCALL2 GetMem
bcs .9
2020-10-23 15:23:19 +00:00
>STYA ZPObjPtr
2020-10-23 15:23:19 +00:00
phx hMBAR
ldy #S.OBJ-1
lda #S.OBJ.T.MBAR
jsr OBJ.Init
lda #S.MBAR.Items
2020-10-23 15:23:19 +00:00
clc
adc ZPObjPtr
sta ZPObjPtr
bcc .4
2020-10-23 15:23:19 +00:00
inc ZPObjPtr+1
2020-10-23 15:23:19 +00:00
.4 stz DX
stz DX+1
.5 lda (ZPPtr1)
beq .8
2020-10-23 15:23:19 +00:00
>LDYA DX
jsr OBJ.AddWord S.MBITEM.X1
2020-10-23 15:23:19 +00:00
lda DX
clc
adc PREFS.MBARXMARGIN
sta DX
bcc .6
2020-10-23 15:23:19 +00:00
sta DX+1
.6 >LDYA DX
jsr OBJ.AddWord S.MBITEM.XT
>LDYA ZPPtr1 pTEXT
ldx hSYSFON
jsr FON.GetTextSize
2020-10-23 15:23:19 +00:00
lda DX
clc
adc CB.CACHE+S.CB.SrcW
sta DX
lda DX+1
adc CB.CACHE+S.CB.SrcW+1
sta DX+1
>LDYA DX
jsr OBJ.AddWord S.MBITEM.X2
2020-10-23 15:23:19 +00:00
>LDYA ZPPtr1 pTEXT
jsr OBJ.AddWord
2020-10-23 15:23:19 +00:00
jsr SkipStrZPtr1 skip "TEXT\0"
2020-10-23 15:23:19 +00:00
ldy #1
lda (ZPPtr1),y
jsr OBJ.AddByte pMENU+1
2020-10-23 15:23:19 +00:00
lda (ZPPtr1)
jsr OBJ.AddByte pMENU
lda ZPPtr1
2020-10-23 15:23:19 +00:00
clc
adc #2
2020-10-23 15:23:19 +00:00
sta ZPPtr1
bcc .5
2020-10-23 15:23:19 +00:00
inc ZPPtr1+1
bra .5 stkip pMENU
2020-10-23 15:23:19 +00:00
.8 pla hMBAR
clc
.9 rts
*--------------------------------------
*--------------------------------------
*--------------------------------------
* ZPWNDPtr = parent WND
*--------------------------------------
MBAR.Paint 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
lda PREFS.MBARCOLOR
sta CB.Cache+S.CB.COLOR
ldy #S.OBJ.X1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1+1
ldy #S.OBJ.X2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2+1
ldy #S.WND.MBarY1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1+1
iny #S.WND.MBarY2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2+1
jsr CB.Cache2CBBuf
ldy #S.WND.pMBAR
lda (ZPWNDPtr),y
sta ZPMENUPtr
iny
lda (ZPWNDPtr),y
sta ZPMENUPtr+1
.1 lda (ZPMENUPtr)
beq .8
jsr CB.ClearCache
lda #S.CB.CMD.DRAWTEXT2
sta CB.CACHE+S.CB.CMD
lda #S.CB.OP.SET+S.CB.OP.INVERSE
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda hSYSFON
sta CB.CACHE+S.CB.hFont
ldy #S.MBITEM.XT
lda (ZPMENUPtr),y
clc
ldy #S.OBJ.X1
adc (ZPWNDPtr),y
sta CB.CACHE+S.CB.X1
ldy #S.MBITEM.XT+1
lda (ZPMENUPtr),y
ldy #S.OBJ.X1+1
adc (ZPWNDPtr),y
sta CB.CACHE+S.CB.X1+1
ldy #S.WND.MBarY1
lda (ZPWNDPtr),y
clc
adc #1
sta CB.CACHE+S.CB.Y1
iny
lda (ZPWNDPtr),y
adc #0
sta CB.CACHE+S.CB.Y1+1
lda #S.MBITEM.pTEXT
clc
adc ZPMENUPtr
sta CB.CACHE+S.CB.TxtPtr
lda #0
adc ZPMENUPtr+1
sta CB.CACHE+S.CB.TxtPtr+1
jsr CB.Cache2CBBuf
lda (ZPMENUPtr)
clc
adc ZPMENUPtr
sta ZPMENUPtr
bcc .1
inc ZPMENUPtr+1
bra .1
.8 clc
2020-10-23 15:23:19 +00:00
rts
*--------------------------------------
* ZPWNDPtr parent WND
* MSG.X1, MSG.Y1
*--------------------------------------
MBAR.Enter
* >DEBUG
*--------------------------------------
MBAR.Leave
clc
rts
*--------------------------------------
2020-10-23 15:23:19 +00:00
MAN
SAVE usr/src/lib/libgui.s.mbar
LOAD usr/src/lib/libgui.s
ASM