A2osX/SBIN/GUI.S.txt
2020-10-12 08:04:19 +02:00

273 lines
5.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,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.LOGOFILE .DA LOGOFILE
L.WND.TITLE .DA WND.TITLE
L.WND.MBAR .DA WND.MBAR
L.WND.STATUS .DA WND.STATUS
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBGUI
>SYSCALL LoadLib
bcs .9
sta hLIBGUI
* clc
.9
CS.INIT.RTS rts
*--------------------------------------
CS.RUN >LIBCALL hLIBGUI,LIBGUI.ShowCursor
>PUSHW L.LOGOFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs CS.INIT.RTS
stx hLogo
CS.RUN.LOOP >SLEEP
>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 .2
>LDA.G CUR.T
inc
inc
cmp #CUR.T.WAIT+2
bne .11
lda #CUR.T.ARROW
.11 >STA.G CUR.T
>LIBCALL hLIBGUI,LIBGUI.SetCursor
jmp CS.RUN.LOOP
.2 bit #S.MOUSE.S.DCLK
beq .8
jsr WND.Test
.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 96
>LIBCALL hLIBGUI,LIBGUI.WND.New
bcs CS.QUIT.RTS
sta hWND
>PUSHA A = hWND
>PUSHBI S.WND.TITLE
>PUSHW L.WND.TITLE
>LIBCALL hLIBGUI,LIBGUI.WND.SetProp
>PUSHB hWND
>PUSHBI S.WND.MBAR
>PUSHW L.WND.MBAR
>LIBCALL hLIBGUI,LIBGUI.WND.SetProp
>PUSHB hWND
>PUSHBI S.WND.STATUS
>PUSHW L.WND.STATUS
>LIBCALL hLIBGUI,LIBGUI.WND.SetProp
>PUSHB hWND
>PUSHBI S.WND.BGCOLOR
>PUSHWI C.WHITE
>LIBCALL hLIBGUI,LIBGUI.WND.SetProp
lda hWND
>LIBCALL hLIBGUI,LIBGUI.WND.Show
lda hWND
>LIBCALL hLIBGUI,LIBGUI.WND.Paint
rts
>PUSHB hWND
>PUSHBI S.CB.OP.SET
>PUSHBI C.BLACK
>PUSHWI 0
>PUSHWI 0
>PUSHWI 300
>PUSHWI 80
>LIBCALL hLIBGUI,LIBGUI.DrawLine
rts
*--------------------------------------
CS.END
LIBGUI .AZ "libgui"
hLIBGUI .BS 1
*--------------------------------------
MouseData .BS S.MOUSE
*--------------------------------------
hLogo .BS 1
LOGOFILE .AZ "${ROOT}root/bmp/A2OSX.LOGO"
hWND .BS 1
WND.TITLE .AZ "Window Title"
*--------------------------------------
WND.MBAR .DA #.1-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "File"
.1 .DA #.2-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "Edit"
.2 .DA #.3-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "Options"
.3 .DA #.4-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "?"
.4 .DA #0
*--------------------------------------
WND.STATUS .AZ "Window status bar message"
*--------------------------------------
WND.MENU.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
*--------------------------------------
WND.MENU.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
*--------------------------------------
WND.MENU.OPTIONS .DA #18 ID
.DA #0
.DA #0
.AZ "Check Me"
.DA #0
*--------------------------------------
WND.MENU.HELP .DA #20 ID
.DA #0
.DA #0
.AZ "About..."
.DA #0
*--------------------------------------
.DUMMY
.OR 0
DS.START
CUR.T .BS 1
DS.END .ED
MAN
SAVE usr/src/sbin/gui.s
ASM