mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
233 lines
4.8 KiB
Plaintext
233 lines
4.8 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF root/tuitest
|
||
*--------------------------------------
|
||
.INB inc/macros.i
|
||
.INB inc/a2osx.i
|
||
.INB inc/libtui.i
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPBIN
|
||
ZS.START
|
||
ZPPtr1 .BS 2
|
||
hSCRN .BS 1
|
||
hTBOX1 .BS 1
|
||
hLBOX1 .BS 1
|
||
ZS.END .ED
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA #0 S.PS.F.EVENT
|
||
.DA #0
|
||
.DA CS.END-CS.START Code Size (without Constants)
|
||
.DA DS.END-DS.START Data Segment Size
|
||
.DA #64 Stack Size
|
||
.DA #ZS.END-ZS.START Zero Page Size
|
||
.DA 0
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBTUI .DA LIBTUI
|
||
*--------------------------------------
|
||
L.SCRN.Title .DA SCRN.Title
|
||
L.SCRN.Status .DA SCRN.Status
|
||
L.CS.SCRN.fResize .DA CS.SCRN.fResize
|
||
L.TBOX1 .DA TBOX1
|
||
L.TBOX1.Title .DA TBOX1.Title
|
||
L.TBOX1.Status .DA TBOX1.Status
|
||
L.LBOX1 .DA LBOX1
|
||
L.LBOX1.L .DA LBOX1.L
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBTUI
|
||
>SYSCALL LoadLib
|
||
bcs CS.INIT.RTS
|
||
|
||
sta hLIBTUI
|
||
|
||
* clc
|
||
|
||
CS.INIT.RTS rts
|
||
*--------------------------------------
|
||
CS.RUN lda #S.OBJ.F.bTITLE+S.OBJ.F.bSTATUS
|
||
>LIBCALL hLIBTUI,LIBTUI.Init
|
||
bcs CS.INIT.RTS
|
||
|
||
sta hSCRN
|
||
>PUSHA
|
||
>PUSHBI S.OBJ.pTITLE
|
||
>PUSHEA.G SCRN.Buf
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
>PUSHB hSCRN
|
||
>PUSHBI S.OBJ.pSTATUS
|
||
>PUSHW L.SCRN.Status
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
>PUSHB hSCRN
|
||
>PUSHBI S.OBJ.fRESIZE
|
||
>PUSHW L.CS.SCRN.fResize
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
jsr CS.TBOX1.Init
|
||
bcs CS.RUN.RTS
|
||
|
||
jsr CS.LBOX1.Init
|
||
bcs CS.RUN.RTS
|
||
|
||
jsr CS.SCRN.fResize Will Call SCRN.Draw
|
||
|
||
lda hTBOX1
|
||
>LIBCALL hLIBTUI,LIBTUI.Activate
|
||
*--------------------------------------
|
||
CS.RUN.LOOP >SLEEP
|
||
|
||
lda hSCRN
|
||
>LIBCALL hLIBTUI,LIBTUI.GetEvent
|
||
bcs .9
|
||
|
||
tay
|
||
beq CS.RUN.LOOP
|
||
|
||
>PUSHB hSCRN
|
||
tya
|
||
>PUSHA
|
||
>LIBCALL hLIBTUI,LIBTUI.Dispatch
|
||
bcc CS.RUN.LOOP
|
||
|
||
|
||
|
||
.9 pha
|
||
lda hSCRN
|
||
>LIBCALL hLIBTUI,LIBTUI.Close
|
||
pla
|
||
sec
|
||
|
||
CS.RUN.RTS rts
|
||
*--------------------------------------
|
||
CS.TBOX1.Init >PUSHB hSCRN
|
||
>PUSHW L.TBOX1
|
||
>LIBCALL hLIBTUI,LIBTUI.New
|
||
bcs .9
|
||
|
||
sta hTBOX1
|
||
|
||
>PUSHA
|
||
>PUSHBI S.OBJ.pTITLE
|
||
>PUSHW L.TBOX1.Title
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
>PUSHB hTBOX1
|
||
>PUSHBI S.OBJ.pSTATUS
|
||
>PUSHW L.TBOX1.Status
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.LBOX1.Init >PUSHB hSCRN
|
||
>PUSHW L.LBOX1
|
||
>LIBCALL hLIBTUI,LIBTUI.New
|
||
bcs .9
|
||
|
||
sta hLBOX1
|
||
|
||
>PUSHA
|
||
>PUSHBI S.LBOX.pL
|
||
>PUSHW L.LBOX1.L
|
||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec do not discard TIMER event
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTUI
|
||
beq .8
|
||
|
||
>SYSCALL UnloadLib
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.SCRN.fResize lda hSCRN
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPPtr1
|
||
|
||
>PUSHEA.G SCRN.Buf
|
||
>PUSHW L.SCRN.Title
|
||
|
||
ldy #S.OBJ.X1
|
||
|
||
.1 lda (ZPPtr1),y
|
||
>PUSHA
|
||
iny
|
||
cpy #S.OBJ.InnerH+1
|
||
bne .1
|
||
|
||
>PUSHBI 10
|
||
>SYSCALL sprintf
|
||
|
||
lda hSCRN
|
||
>LIBCALL hLIBTUI,LIBTUI.Draw
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
LIBTUI .AZ "libtui"
|
||
hLIBTUI .BS 1
|
||
*--------------------------------------
|
||
SCRN.Title .AZ "Window: X1=%d,Y1=%d, W=%d,H=%d, X2=%d,Y2=%d, iX=%d,iY=%d, iW=%d,iH=%d"
|
||
SCRN.Status .AZ "Status bar..."
|
||
*--------------------------------------
|
||
TBOX1 .DA #S.OBJ.T.TBOX T
|
||
.DA #S.OBJ.F.bHBorder+S.OBJ.F.bVBorder+S.OBJ.F.bTITLE+S.OBJ.F.bSTATUS
|
||
.BS 2
|
||
.DA #4 X1
|
||
.DA #4 Y1
|
||
.DA #40 W
|
||
.DA #15 H
|
||
TBOX1.Title .AZ "Text Box Title"
|
||
TBOX1.Status .AZ "Text Box Status"
|
||
*--------------------------------------
|
||
LBOX1 .DA #S.OBJ.T.LBOX T
|
||
.DA #S.OBJ.F.bHBorder+S.OBJ.F.bVBorder
|
||
.BS 2
|
||
.DA #50 X1
|
||
.DA #4 Y1
|
||
.DA #20 W
|
||
.DA #10 H
|
||
LBOX1.L .AZ "Item 1"
|
||
.AZ "Item 2"
|
||
.AZ "Item 3"
|
||
.AZ "Item 4"
|
||
.AZ "Item 5"
|
||
.AZ "Item 6 very long line"
|
||
.AZ "Item 7"
|
||
.AZ "Item 8"
|
||
.AZ "Item 9"
|
||
.AZ "Item 10"
|
||
.AZ "Item 11"
|
||
.AZ "Item 12"
|
||
.AZ "Item 13"
|
||
.AZ "Item 14 last one"
|
||
.DA #0
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
SCRN.Buf .BS 80
|
||
DS.END .ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE root/tuitest.s
|
||
ASM
|