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 *-------------------------------------- EV.SAVE .EQ $C0 EV.OK .EQ $CE EV.CANCEL .EQ $CF *-------------------------------------- .DUMMY .OR ZPBIN ZS.START ZPPtr1 .BS 2 hCTX .BS 1 hSCRN .BS 1 hTBOX1 .BS 1 hDLGS .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.TBOX1.Title .DA TBOX1.Title L.TBOX1.Status .DA TBOX1.Status L.LBOX1.List .DA LBOX1.List L.LABEL.Label .DA LABEL.Label L.RADIO1.List .DA RADIO1.List L.CBOX1.Label .DA CBOX1.Label L.BUTQ.Label .DA BUTQ.Label L.BUTS.Label .DA BUTS.Label L.DLGS.Title .DA DLGS.Title L.BUT.OK .DA BUT.OK L.BUT.Cancel .DA BUT.Cancel .DA 0 *-------------------------------------- CS.INIT >LDYA L.LIBTUI >SYSCALL LoadLib bcs CS.INIT.RTS sta hLIBTUI * clc CS.INIT.RTS rts *-------------------------------------- CS.RUN >LIBCALL hLIBTUI,LIBTUI.Init bcs CS.RUN.RTS sta hCTX jsr CS.SCRN.Init bcs CS.RUN.RTS jsr CS.TBOX1.Init bcs CS.RUN.RTS jsr CS.LBOX1.Init bcs CS.RUN.RTS jsr CS.TLINE.Init bcs CS.RUN.RTS jsr CS.RADIO.Init bcs CS.RUN.RTS jsr CS.CBOX.Init bcs CS.RUN.RTS jsr CS.BUT.Init bcs CS.RUN.RTS jsr CS.SCRN.Draw Will Call SCRN.Draw lda hTBOX1 >LIBCALL hLIBTUI,LIBTUI.Activate *-------------------------------------- CS.RUN.LOOP lda hSCRN >LIBCALL hLIBTUI,LIBTUI.Exec bcs .9 cmp #EV.RESIZE bne .1 jsr CS.SCRN.Draw bcs .9 bra CS.RUN.LOOP .1 cmp #EV.SAVE bne .2 jsr CS.RUN.DLGSAVE bcc CS.RUN.LOOP .2 cmp #EV.QUIT bne CS.RUN.LOOP lda hSCRN >LIBCALL hLIBTUI,LIBTUI.Destroy lda #0 sec .9 CS.RUN.RTS rts *-------------------------------------- CS.SCRN.Init >PUSHB hCTX hParent >PUSHBI S.OBJ.F.bTitle+S.OBJ.F.bStatus lda #S.OBJ.T.SCRN >LIBCALL hLIBTUI,LIBTUI.New bcs .9 sta hSCRN >PUSHA >PUSHBI S.OBJ.pTITLE >PUSHEA.G SCRN.TitleBuf >LIBCALL hLIBTUI,LIBTUI.SetProp >PUSHB hSCRN >PUSHBI S.OBJ.pSTATUS >PUSHW L.SCRN.Status >LIBCALL hLIBTUI,LIBTUI.SetProp .9 rts *-------------------------------------- CS.TBOX1.Init >LDYAI 1024 >SYSCALL GetMem bcs CS.RUN.RTS >STYA ZPPtr1 txa >STA.G TBOX1.hBuf lda #0 sta (ZPPtr1) >PUSHB hSCRN hParent >PUSHBI 1 X1 >PUSHBI 1 Y1 >PUSHBI 44 W >PUSHBI 20 H >PUSHBI S.OBJ.F.bHBorder+S.OBJ.F.bVBorder+S.OBJ.F.bTitle+S.OBJ.F.bStatus >PUSHB.G TBOX1.hBuf >PUSHWI 1024 lda #S.OBJ.T.TBOX >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 hParent >PUSHBI 50 X1 >PUSHBI 1 Y1 >PUSHBI 20 W >PUSHBI 9 H >PUSHBI S.OBJ.F.bHBorder+S.OBJ.F.bVBorder >PUSHW L.LBOX1.List >PUSHEA.G LBOX1.Var lda #S.OBJ.T.LBOX >LIBCALL hLIBTUI,LIBTUI.New rts *-------------------------------------- CS.TLINE.Init >PUSHB hSCRN hParent >PUSHBI 50 X1 >PUSHBI 11 Y1 >PUSHW L.LABEL.Label lda #S.OBJ.T.LABEL >LIBCALL hLIBTUI,LIBTUI.New bcs .9 >PUSHB hSCRN hParent >PUSHBI 50 X1 >PUSHBI 12 Y1 >PUSHBI 25 W >PUSHEA.G TLINE.Buf >PUSHBI 65 Len lda #S.OBJ.T.TLINE >LIBCALL hLIBTUI,LIBTUI.New .9 rts *-------------------------------------- CS.RADIO.Init >PUSHB hSCRN hParent >PUSHBI 50 X1 >PUSHBI 14 Y1 >PUSHBI 0 >PUSHBI 0 >PUSHW L.RADIO1.List >PUSHEA.G RADIO1.Var lda #S.OBJ.T.RADIO >LIBCALL hLIBTUI,LIBTUI.New rts *-------------------------------------- CS.CBOX.Init >PUSHB hSCRN hParent >PUSHBI 50 X1 >PUSHBI 18 Y1 >PUSHBI 0 >PUSHBI 0 >PUSHW L.CBOX1.Label >PUSHEA.G CBOX1.Var lda #S.OBJ.T.CBOX >LIBCALL hLIBTUI,LIBTUI.New rts *-------------------------------------- CS.BUT.Init >PUSHB hSCRN hParent >PUSHBI 50 X1 >PUSHBI 20 Y1 >PUSHBI 19 Ctrl-S >PUSHBI EV.SAVE >PUSHW L.BUTS.Label lda #S.OBJ.T.BUT >LIBCALL hLIBTUI,LIBTUI.New bcs .9 >PUSHB hSCRN hParent >PUSHBI 65 X1 >PUSHBI 20 Y1 >PUSHBI 17 Ctrl-Q >PUSHBI EV.QUIT >PUSHW L.BUTQ.Label lda #S.OBJ.T.BUT >LIBCALL hLIBTUI,LIBTUI.New .9 CS.BUT.Init.RTS rts *-------------------------------------- CS.RUN.DLGSAVE >PUSHB hCTX hParent >PUSHBI 70 W >PUSHBI 11 H >PUSHW L.DLGS.Title lda #S.OBJ.T.DLG >LIBCALL hLIBTUI,LIBTUI.New bcs CS.BUT.Init.RTS sta hDLGS >PUSHB hDLGS hParent >PUSHBI 50 X1 >PUSHBI 7 Y1 >PUSHBI C.CR >PUSHBI EV.OK >PUSHW L.BUT.OK lda #S.OBJ.T.BUT >LIBCALL hLIBTUI,LIBTUI.New bcs .9 sta ZPPtr1 >PUSHB hDLGS hParent >PUSHBI 57 X1 >PUSHBI 7 Y1 >PUSHBI 3 Ctrl-C >PUSHBI EV.CANCEL >PUSHW L.BUT.Cancel lda #S.OBJ.T.BUT >LIBCALL hLIBTUI,LIBTUI.New bcs .9 lda hDLGS >LIBCALL hLIBTUI,LIBTUI.Draw bcs .9 lda ZPPtr1 >LIBCALL hLIBTUI,LIBTUI.Activate .1 lda hDLGS >LIBCALL hLIBTUI,LIBTUI.Exec .9 php pha lda hDLGS >LIBCALL hLIBTUI,LIBTUI.Destroy lda hSCRN >LIBCALL hLIBTUI,LIBTUI.Draw pla plp rts *-------------------------------------- CS.DOEVENT sec do not discard TIMER event rts *-------------------------------------- CS.QUIT >LDA.G TBOX1.hBuf beq .1 >SYSCALL FreeMem .1 lda hCTX beq .2 >LIBCALL hLIBTUI,LIBTUI.Close .2 lda hLIBTUI beq .8 >SYSCALL UnloadLib .8 clc rts *-------------------------------------- CS.SCRN.Draw lda hSCRN >SYSCALL GetMemPtr >STYA ZPPtr1 >PUSHEA.G SCRN.TitleBuf >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.Title .AZ "Text Box Title" TBOX1.Status .AZ "Text Box Status" *-------------------------------------- LBOX1.List .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 *-------------------------------------- LABEL.Label .AZ "This is a label." *-------------------------------------- RADIO1.List .DA #C.ESC .AZ "[91mRed" .DA #C.ESC .AZ "[92mGreen" .DA #C.ESC .AZ "[96mBlue" .DA #0 *-------------------------------------- CBOX1.Label .AZ "Check Me" *-------------------------------------- BUTS.Label .AZ "(^S)ave..." BUTQ.Label .AZ "(^Q)uit" DLGS.Title .AZ "Save As..." BUT.OK .AZ " OK " BUT.Cancel .AZ "Cancel" *-------------------------------------- .DUMMY .OR 0 DS.START SCRN.TitleBuf .BS 80 CBOX1.Var .BS 1 TLINE.Buf .BS 65 RADIO1.Var .BS 1 LBOX1.Var .BS 1 TBOX1.hBuf .BS 1 DS.END .ED *-------------------------------------- MAN SAVE root/tuitest.s ASM