A2osX/LIB/LIBGUI.S.txt
2019-05-05 19:15:37 +02:00

326 lines
6.6 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
PREFIX
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF LIB/GUI/LIBGUI
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/GFX.I
.INB INC/LIBGUI.I
*--------------------------------------
WND.MAX .EQ 64
*--------------------------------------
.MA SWAP16
lda ]1
ldx ]2
stx ]1
sta ]2
lda ]1+1
ldx ]2+1
stx ]1+1
sta ]2+1
.EM
.MA NOT16
sec
lda #0
sbc ]1
sta ]1
lda #0
sbc ]1+1
sta ]1+1
.EM
.MA SCMPAX
sec
sbc ]1
txa
sbc ]1+1
bvc :1
eor #$80
:1 .EQ *
.EM
*--------------------------------------
ZPPtr1 .EQ ZPLIB
ZPObjPtr .EQ ZPLIB+4
ZPCBPtr .EQ ZPLIB+6
ZPWNDPtr .EQ ZPLIB+8
*--------------------------------------
* 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
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
.DA Draw
.DA SetCursor
.DA SetCursorPos
.DA HideCursor
.DA ShowCursor
.DA UpdateCursor
.DA MOU.ReadMouse
*--------------------------------------
J.Cmds .DA DrawLine
.DA DrawText
*--------------------------------------
L.DEVNAME.GFX .DA DEVNAME.GFX
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
L.SYSX7 .DA SYSX7
L.SYSX7B .DA SYSX7B
L.IOCTL .DA IOCTL
L.DCB.GFX .DA DCB.GFX
L.MouseClamp .DA MouseClamp
L.CB.Cache .DA CB.Cache
L.SCR .DA SCR
L.WND.Desktop .DA WND.Desktop
L.WND.SysBar .DA WND.SysBar
*--------------------------------------
L.BM.Apple .DA BM.Apple
*--------------------------------------
L.CUR.CB .DA CUR.CB
L.CUR.SaveBuf .DA CUR.SaveBuf
L.Cursors .DA CUR.Arrow
.DA CUR.ResizeX
.DA CUR.ResizeY
.DA CUR.ResizeXY1
.DA CUR.ResizeXY2
.DA CUR.Cross
.DA CUR.Text
.DA CUR.Wait1
.DA CUR.Wait2
.DA CUR.Wait3
.DA CUR.Wait4
.DA CUR.Wait5
.DA CUR.Wait6
J.Clip .DA CLIP.Point SETPIXEL
.DA CLIP.Point GETPIXEL
.DA CLIP.HLine
.DA CLIP.VLine
.DA CLIP.Rect FILLRECT
.DA CLIP.BitBlt
.DA CLIP.Rect GETRECTBUFSIZE
.DA CLIP.Line
.DA CLIP.Text
.DA 0
*--------------------------------------
LIB.LOAD lda LibCount
bne .8
jsr FON.Init
bcs .9
jsr MOU.Init
bcs .9
jsr WND.Init
bcs .9
jsr WND.Setup
lda hDevMouse
beq .8
jsr MOU.Setup
.8 inc LibCount
clc
.9 rts
*--------------------------------------
LIB.UNLOAD dec LibCount
bne .8
jsr MOU.Quit
.8 clc
rts
*--------------------------------------
OBJ.Get >STYA .1+1
ldx #S.OBJ-1
.1 lda $ffff,x SELF MODIFIED
sta OBJ.Cache,x
dex
bpl .1
rts
*--------------------------------------
OBJ.SetX2Y2 >STYA ZPObjPtr
ldy #S.OBJ.W
lda (ZPObjPtr),y
clc
sbc #0
pha
iny
lda (ZPObjPtr),y
sbc #0
tax
pla
clc
ldy #S.OBJ.X1
adc (ZPObjPtr),y
pha
txa
iny
adc (ZPObjPtr),y
ldy #S.OBJ.X2+1
sta (ZPObjPtr),y
dey
pla
sta (ZPObjPtr),y
ldy #S.OBJ.H
lda (ZPObjPtr),y
clc
sbc #0
pha
iny
lda (ZPObjPtr),y
sbc #0
tax
pla
clc
ldy #S.OBJ.Y1
adc (ZPObjPtr),y
pha
txa
iny
adc (ZPObjPtr),y
ldy #S.OBJ.Y2+1
sta (ZPObjPtr),y
dey
pla
sta (ZPObjPtr),y
rts
*--------------------------------------
CB.Get >STYA .1+1
ldx #S.CB-1
.1 lda $ffff,x SELF MODIFIED
sta CB.Cache,x
dex
bpl .1
rts
*--------------------------------------
GFXWrite.CB >LDYA L.CB.Cache
GFXWrite.YA >PUSHYA
>PUSHBI IOCTL.WRITE
lda SCR+S.SCREEN.hDEV
>SYSCALL2 IOCTL
rts
*--------------------------------------
.INB USR/SRC/LIB/LIBGUI.S.BM
.INB USR/SRC/LIB/LIBGUI.S.BUT
.INB USR/SRC/LIB/LIBGUI.S.CLIP
.INB USR/SRC/LIB/LIBGUI.S.CUR
.INB USR/SRC/LIB/LIBGUI.S.DRAW
.INB USR/SRC/LIB/LIBGUI.S.FON
.INB USR/SRC/LIB/LIBGUI.S.MENU
.INB USR/SRC/LIB/LIBGUI.S.MOU
.INB USR/SRC/LIB/LIBGUI.S.PAT
.INB USR/SRC/LIB/LIBGUI.S.WND
*--------------------------------------
CS.END
*--------------------------------------
.INB USR/SRC/LIB/LIBGUI.G.BM
.INB USR/SRC/LIB/LIBGUI.G.CUR
.INB USR/SRC/LIB/LIBGUI.G.FON
.INB USR/SRC/LIB/LIBGUI.G.WND
*--------------------------------------
DEVNAME.GFX .AZ "/DEV/GFX"
DEVNAME.MOUSE .AZ "/DEV/MOU1"
*--------------------------------------
SYSX7 .AZ "/A2OSX.BUILD/SBIN/GUI/SYSX7"
SYSX7B .AZ "/A2OSX.BUILD/SBIN/GUI/SYSX7B"
*--------------------------------------
LibCount .BS 1
hDevMouse .BS 1
*--------------------------------------
DX .BS 2
DY .BS 2
IY .BS 1
IE .BS 2
D .BS 2
INE .BS 2
Counter .BS 2
CLIP.Line.P1 .BS 1
CLIP.Line.P2 .BS 1
*--------------------------------------
CB.CmdLen .DA S.CB.Y1+1 SETPIXEL
.DA S.CB.Y1+1 GETPIXEL
.DA S.CB.X2+1 HLINE
.DA S.CB.Y2+1 VLINE
.DA S.CB.Y2+1 FILLRECT
.DA S.CB.DstPtr+1 BITBLT
.DA S.CB.DstPtr+1 GETRECTBUFSIZE
.DA S.CB.Y2+1 DRAWLINE
.DA S.CB.TxtPtr+1 DRAWTEXT
*--------------------------------------
PAT.Buf .BS 1 S.BM.F
.DA #1 S.BM.RowBytes
.DA 8 S.BM.W
.DA 8 S.BM.H
.DA 0 S.BM.MASK.OFS
.BS 8 (data)
*--------------------------------------
IOCTL .BS S.IOCTL
DCB.GFX .BS S.DCB.GFX
*--------------------------------------
MouseClamp .BS 8
*--------------------------------------
CB.Cache .BS S.CB
OBJ.Cache .BS S.OBJ
*--------------------------------------
SCR .BS S.SCREEN S.OBJ.T.SCREEN
SCR.Childs .BS 2 WND.Desktop
.BS 2 WND.SysBar
.DA 0
*--------------------------------------
WND.Desktop .DA #S.OBJ.T.WND
.BS S.WND-1
*--------------------------------------
WND.SysBar .DA #S.OBJ.T.WND
.BS S.WND-1
WND.SysBar.Childs
.BS 2 BUT.Sys
.DA 0
*--------------------------------------
BUT.Sys .DA #S.OBJ.T.BUT
.DA #0 F
.DA #0 S
.DA #0 ID
.DA 0 hOWNER
.DA 0 pPARENT
*--------------------------------------
MENU.Sys
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBGUI.S
ASM