A2osX/SBIN/GUI.S.txt
2017-12-05 08:09:16 +01:00

221 lines
4.4 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.

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/SBIN/GUI
*--------------------------------------
.INB /A2OSX.BUILD/INC/IO.I
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/LIBGUI.I
*--------------------------------------
ZPPtr1 .EQ ZPBIN
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #2 ZP
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.INIT .DA MSG.INIT
L.LIBGUI .DA LIBGUI
L.Filename .DA Filename
L.MouseData .DA MouseData
L.CB.Rect .DA CB.Rect
L.CB.BitBlt .DA CB.BitBlt
L.CB.DrawLine .DA CB.DrawLine
.DA 0
*--------------------------------------
CS.INIT >LDYA L.MSG.INIT
>SYSCALL PrintF.YA
>LDYA L.LIBGUI
>SYSCALL LoadLib.YA
bcs .9
sta hLIBGUI
>LIBCALL hLIBGUI,LIBGUI.InitGUI
bcs .9
>PUSHWI 0 Aux type
>PUSHBI $CB Type
>PUSHBI SYS.FOpen.R
>PUSHW L.FILENAME
>SYSCALL LoadFile
bcs .9
txa
>SYSCALL GetMemPtr.A
>STYA CB.BitBlt+S.CB.SrcPtr
>STYA ZPPtr1
ldy #S.BM.W+3
ldx #3
.1 lda (ZPPtr1),y
sta CB.BitBlt+S.CB.SrcW,x
dey
dex
bpl .1
jsr Destop.Paint
lda #CUR.T.ARROW
>STA.G CUR.T
>LIBCALL hLIBGUI,LIBGUI.SetCursor.A
>LIBCALL hLIBGUI,LIBGUI.ShowCursor
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
.9 rts
*--------------------------------------
CS.RUN lda A2osX.ASCREEN GUI screen active ?
cmp #3
bne .8 no, exit....
>PUSHW L.MouseData
>LIBCALL hLIBGUI,LIBGUI.ReadMouse
bcs .4
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.A
lda MouseData+S.MOUSE.X1
sta CB.BitBlt+S.CB.DestX
lda MouseData+S.MOUSE.X1+1
sta CB.BitBlt+S.CB.DestX+1
lda MouseData+S.MOUSE.Y1
sta CB.BitBlt+S.CB.DestY
lda MouseData+S.MOUSE.Y1+1
sta CB.BitBlt+S.CB.DestY+1
jsr Destop.Paint
.4
.8 clc
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9
asl
bpl .9
>LIBCALL hLIBGUI,LIBGUI.UpdateCursor
.9 sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
Destop.Paint >LIBCALL hLIBGUI,LIBGUI.HideCursor
>PUSHW L.CB.Rect
>LIBCALL hLIBGUI,LIBGUI.Draw
>PUSHW L.CB.BitBlt
>LIBCALL hLIBGUI,LIBGUI.Draw
>LIBCALL hLIBGUI,LIBGUI.ShowCursor
rts
*--------------------------------------
CS.END
LIBGUI >CSTR "libgui.o"
MSG.INIT >CSTR "GUI:Init...\r\n"
hLIBGUI .BS 1
*--------------------------------------
Filename >CSTR "/A2OSX.BUILD/MARILYN"
*--------------------------------------
MouseData .BS S.MOUSE
*--------------------------------------
CB.Rect .DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.C16
.DA #2
.DA 0 X1
.DA 0 Y1
.DA 559 X2
.DA 191 Y2
.DA #0
*--------------------------------------
CB.BitBlt .DA #S.CB.CMD.BITBLT
.DA #S.CB.OP.SET
.DA #S.CB.MODE.MONO
.DA #0
.DA 0 X1
.DA 0 Y1
.BS 2 W
.BS 2 H
.DA 130 DestX
.DA 20 DestY
.BS 2 SrcPtr
.DA 0
.DA #0
*--------------------------------------
CB.DrawLine .DA #0
.DA #S.CB.CMD.DRAWLINE
.DA #S.CB.OP.XOR
.DA #S.CB.MODE.MONO
.DA #1
.BS 2 X1
.BS 2 Y1
.BS 2 X2
.BS 2 Y2
.DA #0
*--------------------------------------
.DUMMY
.OR 0
DS.START
CUR.T .BS 1
DS.END
.ED
MAN
SAVE /A2OSX.SRC/SBIN/GUI.S
ASM