NEW PREFIX AUTO 4,1 .LIST OFF .OP 65C02 .OR $2000 .TF sbin/gui *-------------------------------------- .INB inc/io.i .INB inc/macros.i .INB inc/a2osx.i .INB inc/gfx.i .INB inc/libgui.i *-------------------------------------- * Zero Page Segment, up to 32 bytes *-------------------------------------- .DUMMY .OR ZPBIN ZS.START * MyPtr .BS 2 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 #S.PS.F.EVENT .DA #0 .DA CS.END-CS.START Code Size (without Constants) .DA DS.END-DS.START Data SegmentSize .DA #64 Stack Size .DA #ZS.END-ZS.START Zero Page Size .DA 0 *-------------------------------------- * Relocation Table *-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT L.LIBGUI .DA LIBGUI L.MouseData .DA MouseData L.WND.TITLE .DA WND.TITLE L.WND.MENUBAR .DA WND.MENUBAR L.WND.STATUS .DA WND.STATUS .DA 0 *-------------------------------------- CS.INIT >LDYA L.LIBGUI >SYSCALL LoadLib bcs .9 sta hLIBGUI * clc .9 rts *-------------------------------------- CS.RUN CS.RUN.LOOP >SLEEP * lda A2osX.ASCREEN * cmp #8 * bne CS.RUN.LOOP >PUSHW L.MouseData >LIBCALL hLIBGUI,LIBGUI.ReadMouse bcs .8 lda MouseData+S.MOUSE.S bit #S.MOUSE.S.MOVE beq .1 >PUSHW L.MouseData >LIBCALL hLIBGUI,LIBGUI.SetCursorPos lda MouseData+S.MOUSE.S .1 bit #S.MOUSE.S.CLK beq .4 >LDA.G CUR.T inc inc cmp #CUR.T.WAIT+2 bne .2 lda #CUR.T.ARROW .2 >STA.G CUR.T >LIBCALL hLIBGUI,LIBGUI.SetCursor jsr WND.Test .4 .8 jmp CS.RUN.LOOP clc rts *-------------------------------------- CS.DOEVENT lda (pEvent) bpl .9 >LIBCALL hLIBGUI,LIBGUI.UpdateCursor .9 sec rts *-------------------------------------- CS.QUIT clc CS.QUIT.RTS rts *-------------------------------------- WND.Test >PUSHBI S.WND.F.RESIZE+S.WND.F.MOVE+S.WND.F.CLOSE+S.WND.F.MAX+S.WND.F.MIN >PUSHW MouseData+S.MOUSE.X1 >PUSHW MouseData+S.MOUSE.Y1 >PUSHWI 280 >PUSHWI 90 >LIBCALL hLIBGUI,LIBGUI.WND.Create bcs CS.QUIT.RTS sta hWND >PUSHA A = hWND >PUSHBI S.WND.TITLE >PUSHW L.WND.TITLE >LIBCALL hLIBGUI,LIBGUI.WND.SetProp lda hWND >PUSHA >PUSHBI S.WND.MENUBAR >PUSHW L.WND.MENUBAR >LIBCALL hLIBGUI,LIBGUI.WND.SetProp lda hWND >PUSHA >PUSHBI S.WND.STATUS >PUSHW L.WND.STATUS >LIBCALL hLIBGUI,LIBGUI.WND.SetProp >LIBCALL hLIBGUI,LIBGUI.HideCursor lda hWND >LIBCALL hLIBGUI,LIBGUI.WND.Show >LIBCALL hLIBGUI,LIBGUI.ShowCursor clc .9 rts *-------------------------------------- CS.END LIBGUI .AZ "libgui" hLIBGUI .BS 1 *-------------------------------------- MouseData .BS S.MOUSE *-------------------------------------- hWND .BS 1 WND.TITLE .AZ "Window Title" *-------------------------------------- WND.MENUBAR .DA #0 .DA #0 .DA #.1-* .AZ "File" .DA #02 ID .DA #S.MITEM.KEYMOD.CTRL .DA #'N' .AZ "New" .DA #04 ID .DA #S.MITEM.KEYMOD.CTRL .DA #'O' .AZ "Open..." .DA #06 ID .DA #S.MITEM.KEYMOD.CTRL .DA #'S' .AZ "Save" .DA #08 ID .DA #S.MITEM.KEYMOD.OA+S.MITEM.KEYMOD.CTRL .DA #'S' .AZ "Save As..." .DA #10 ID .DA #S.MITEM.KEYMOD.CTRL .DA #'Q' .AZ "Quit" .DA #0 .1 .DA #.2-* .AZ "Edit" .DA #12 ID .DA #S.MITEM.KEYMOD.OA .DA #'X' .AZ "Cut" .DA #14 ID .DA #S.MITEM.KEYMOD.OA .DA #'C' .AZ "Copy" .DA #16 ID .DA #S.MITEM.KEYMOD.OA .DA #'V' .AZ "Paste" .DA #0 .2 .DA #.3-* .AZ "Options" .DA #18 ID .DA #0 .DA #0 .AZ "Check Me" .DA #0 .3 .DA #.4-* .AZ "?" .DA #20 ID .DA #0 .DA #0 .AZ "About..." .DA #0 .4 .DA #0 *-------------------------------------- WND.STATUS .AZ "Window status bar message" *-------------------------------------- .DUMMY .OR 0 DS.START CUR.T .BS 1 DS.END .ED MAN SAVE usr/src/sbin/gui.s ASM