A2osX/LIB/LIBGUI.S.txt

315 lines
6.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.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/LIB/LIBGUI.O
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/GUI.I
.INB /A2OSX.BUILD/INC/LIBGUI.I
.INB /A2OSX.BUILD/INC/GFX.I
*--------------------------------------
.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
ZPGCPtr .EQ ZPLIB+2
ZPCBPtr .EQ ZPLIB+4
*--------------------------------------
* 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 InitGUI
.DA CloseGUI
.DA Draw
.DA SetCursor.A
.DA SetCursorPos
.DA HideCursor
.DA ShowCursor
.DA UpdateCursor
.DA ReadMouse
.DA GetScreenGC
J.Cmds .DA DrawLine
.DA DrawText
L.DEVNAME.GFX .DA DEVNAME.GFX
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
L.MouseClamp .DA MouseClamp
L.GC.Screen .DA GC.Screen
L.CB.Cache .DA CB.Cache
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
LIB.UNLOAD clc
rts
*--------------------------------------
InitGUI lda GC.Screen+S.GC.hDev
bne .8
>LDYA L.DEVNAME.GFX
>SYSCALL GetDevByName.YA
bcs .9
stx GC.Screen+S.GC.hDev
>STYA GoDevGfx.Jmp+1
txa
ldx #DEVMGR.OPEN
jsr GoDevGfx.Jmp
ldx #DEVMGR.STATUS get graphic mode and resolution....
jsr GoDevGfx.Jmp
>STYA ZPPtr1
ldy #S.DSTAT.GFX.W
lda (ZPPtr1),y
clc
sbc #0
sta GC.Screen+S.GC.X2
iny
lda (ZPPtr1),y
sbc #0
sta GC.Screen+S.GC.X2+1
iny #S.DSTAT.GFX.H
lda (ZPPtr1),y
clc
sbc #0
sta GC.Screen+S.GC.Y2
iny
lda (ZPPtr1),y
sbc #0
sta GC.Screen+S.GC.Y2+1
.1 >LDYA L.DEVNAME.MOUSE
>SYSCALL GetDevByName.YA
bcc .2
inc DEVNAME.MOUSE+3
lda DEVNAME.MOUSE+3
cmp #'8'
bne .1
.8 ldx #DEVMGR.CONTROL Mouse driver disturb graphic screen....
jsr GoDevGfx.Jmp
clc
.9 rts
* Mouse Setup
.2 stx hDevMouse
>STYA GoDevMouse+1
txa
ldx #DEVMGR.OPEN
jsr GoDevMouse
lda GC.Screen+S.GC.X2+1
sta MouseClamp+3
lsr
sta CUR.Pos+S.POINT.X+1
lda GC.Screen+S.GC.X2
sta MouseClamp+2
ror
sta CUR.Pos+S.POINT.X
lda GC.Screen+S.GC.Y2+1
sta MouseClamp+7
lsr
sta CUR.Pos+S.POINT.Y+1
lda GC.Screen+S.GC.Y2
sta MouseClamp+6
ror
sta CUR.Pos+S.POINT.Y
>LDYA L.MouseClamp
ldx #DEVMGR.CONTROL
jsr GoDevMouse
>LDYA L.CUR.SaveBuf
>STYA CUR.CB+S.CB.DstPtr
lda #CUR.T.ARROW
jsr SetCursor.A
bra .8
*--------------------------------------
CloseGUI lda hDevMouse
beq .1
ldx #DEVMGR.CLOSE
jsr GoDevMouse
.1 stz GC.Screen+S.GC.hDev
sec
rts
*--------------------------------------
GC.Get >STYA .1+1
ldx #S.GC-1
.1 lda $ffff,x SELF MODIFIED
sta GC.Cache,x
dex
bpl .1
rts
*--------------------------------------
CB.Get >STYA .1+1
ldx #S.CB-1
.1 lda $ffff,x SELF MODIFIED
sta CB.Cache,x
dex
bpl .1
rts
*--------------------------------------
ReadMouse >PULLYA
ldx hDevMouse Mouse is active ?
beq .9
ldx #DEVMGR.READBLOCK
jmp GoDevMouse
.9 sec
rts
*--------------------------------------
GetScreenGC >LDYA L.GC.Screen
rts
*--------------------------------------
GoDevGfx >LDYA L.CB.Cache
ldx #DEVMGR.WRITE
GoDevGfx.Jmp jmp $ffff
*--------------------------------------
GoDevMouse jmp $ffff
*--------------------------------------
.INB /A2OSX.SRC/LIB/LIBGUI.S.DRAW
.INB /A2OSX.SRC/LIB/LIBGUI.S.CLIP
.INB /A2OSX.SRC/LIB/LIBGUI.S.CUR
.INB /A2OSX.SRC/LIB/LIBGUI.S.PAT
.INB /A2OSX.SRC/LIB/LIBGUI.S.WND
*--------------------------------------
CS.END
*--------------------------------------
.INB /A2OSX.SRC/LIB/LIBGUI.G.CUR
*--------------------------------------
DEVNAME.GFX .AZ "GFX"
DEVNAME.MOUSE .AZ "MOU1"
*--------------------------------------
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
*--------------------------------------
MouseClamp .BS 8
*--------------------------------------
GC.Screen .BS S.GC
GC.Desktop .BS S.GC
GC.TaskBar .BS S.GC
*--------------------------------------
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)
*--------------------------------------
GC.Cache .BS S.GC
CB.Cache .BS S.CB
BM.Cache .BS S.BM
WND.Cache .BS S.WND
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBGUI.S
ASM