mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
375 lines
6.7 KiB
Plaintext
375 lines
6.7 KiB
Plaintext
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.LIBGUI .DA LIBGUI
|
||
L.DEVNAME.GFX .DA DEVNAME.GFX
|
||
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
|
||
L.MSG.INIT .DA MSG.INIT
|
||
L.MouseClamp .DA MouseClamp
|
||
L.MouseData .DA MouseData
|
||
L.Rect.CB .DA Rect.CB
|
||
L.SetPixel.CB .DA SetPixel.CB
|
||
L.DrawLines.CB .DA DrawLines.CB
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.MSG.INIT
|
||
>SYSCALL PrintF.YA
|
||
|
||
>LDYA L.LIBGUI
|
||
>SYSCALL LoadLib.YA
|
||
sta hLIBGUI
|
||
|
||
>LDYA L.DEVNAME.GFX
|
||
>SYSCALL GetDevByName.YA
|
||
bcc .10
|
||
rts
|
||
|
||
.10 stx hDevGFX
|
||
|
||
>STYA GoDevGFX+1
|
||
|
||
txa
|
||
ldx #DEVMGR.OPEN
|
||
jsr GoDevGFX
|
||
|
||
.11 >LDYA L.DEVNAME.MOUSE
|
||
>SYSCALL GetDevByName.YA
|
||
bcc .20
|
||
|
||
inc DEVNAME.MOUSE+4
|
||
lda DEVNAME.MOUSE+4
|
||
cmp #'8'
|
||
bne .11
|
||
beq .21 No mouse found, skip mouse init
|
||
|
||
.20 stx hDevMouse
|
||
>STYA GoDevMouse+1
|
||
|
||
ldx #DEVMGR.OPEN
|
||
jsr GoDevMouse
|
||
|
||
ldx #DEVMGR.CONTROL Mouse driver disturb graphic screen....
|
||
jsr GoDevGFX
|
||
|
||
ldx #DEVMGR.STATUS get graphic mode and resolution....
|
||
jsr GoDevGFX
|
||
|
||
>STYA ZPPtr1
|
||
|
||
ldy #S.DSTAT+1
|
||
lda (ZPPtr1),y
|
||
sta MouseClamp+2
|
||
iny
|
||
lda (ZPPtr1),y
|
||
sta MouseClamp+3
|
||
|
||
iny
|
||
lda (ZPPtr1),y
|
||
sta MouseClamp+6
|
||
iny
|
||
lda (ZPPtr1),y
|
||
sta MouseClamp+7
|
||
|
||
>LDYA L.MouseClamp
|
||
ldx #DEVMGR.CONTROL
|
||
jsr GoDevMouse
|
||
|
||
.21 lda hDevGFX
|
||
>LIBCALL hLIBGUI,LIBGUI.InitGUI.A
|
||
|
||
lda (pPs)
|
||
ora #S.PS.F.EVENT Now accept events
|
||
sta (pPs)
|
||
|
||
jsr Destop.Paint
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN lda A2osX.ASCREEN GUI screen active ?
|
||
cmp #3
|
||
bne .8 no, exit....
|
||
|
||
lda hDevMouse Mouse is active ?
|
||
beq .4 go check KB
|
||
|
||
>LDYA L.MouseData
|
||
ldx #DEVMGR.READBLOCK
|
||
jsr GoDevMouse
|
||
bcs .4 go check KB
|
||
|
||
lda MouseData
|
||
bit #4 mouse move
|
||
beq .1
|
||
|
||
lda MouseData+1
|
||
sta SetPixel.X
|
||
|
||
lda MouseData+2
|
||
sta SetPixel.X+1
|
||
|
||
lda MouseData+3
|
||
sta SetPixel.Y
|
||
|
||
lda MouseData+4
|
||
sta SetPixel.Y+1
|
||
|
||
lda #0 S.CB.OP.XOR
|
||
sta SetPixel.OP
|
||
lda #S.CB.MODE.MONO
|
||
sta SetPixel.Mode
|
||
|
||
lda #1
|
||
sta SetPixel.Color
|
||
|
||
>PUSHW L.SetPixel.CB
|
||
>LIBCALL hLIBGUI,LIBGUI.Draw
|
||
clc
|
||
rts
|
||
|
||
.1 bit #$20
|
||
beq .4
|
||
|
||
jsr Destop.Paint
|
||
|
||
|
||
.4
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT clc
|
||
rts
|
||
*--------------------------------------
|
||
Destop.Paint >PUSHW L.Rect.CB
|
||
>LIBCALL hLIBGUI,LIBGUI.Draw
|
||
|
||
lda #S.CB.MODE.C16
|
||
sta SetPixel.Mode
|
||
|
||
lda #0
|
||
sta SetPixel.Color
|
||
|
||
lda #20
|
||
sta SetPixel.Y
|
||
|
||
.1 lda #28
|
||
sta SetPixel.X
|
||
lda /28
|
||
sta SetPixel.X+1
|
||
|
||
.2 >PUSHW L.SetPixel.CB
|
||
>LIBCALL hLIBGUI,LIBGUI.Draw
|
||
|
||
lda SetPixel.X
|
||
clc
|
||
adc #4
|
||
sta SetPixel.X
|
||
bcc .3
|
||
inc SetPixel.X+1
|
||
|
||
.3 lda SetPixel.X
|
||
cmp #84
|
||
lda SetPixel.X+1
|
||
sbc /84
|
||
bcc .2
|
||
|
||
inc SetPixel.Y
|
||
lda SetPixel.Y
|
||
cmp #192
|
||
beq .4
|
||
and #$7
|
||
bne .1
|
||
|
||
inc SetPixel.Color
|
||
lda SetPixel.Color
|
||
cmp #16
|
||
bne .1
|
||
|
||
.4
|
||
>PUSHW L.DrawLines.CB
|
||
>LIBCALL hLIBGUI,LIBGUI.Draw
|
||
|
||
rts
|
||
*--------------------------------------
|
||
*--------------------------------------
|
||
*--------------------------------------
|
||
GoDevGFX jmp $ffff
|
||
GoDevMouse jmp $ffff
|
||
*--------------------------------------
|
||
CS.END
|
||
DEVNAME.GFX >CSTR "GFX"
|
||
DEVNAME.MOUSE >CSTR "MOU1"
|
||
LIBGUI >CSTR "libgui.o"
|
||
MSG.INIT >CSTR "GUI:Init...\r\n"
|
||
hLIBGUI .BS 1
|
||
hDevGFX .BS 1
|
||
hDevMouse .BS 1
|
||
MouseClamp .BS 8
|
||
MouseData .BS 5
|
||
*--------------------------------------
|
||
Rect.CB .DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.C16
|
||
.DA #11
|
||
.DA 0
|
||
.DA 0
|
||
.DA 559
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 10
|
||
.DA 10
|
||
.DA 550
|
||
.DA 180
|
||
|
||
.DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.ORA
|
||
.DA #S.CB.MODE.C16
|
||
.DA #0
|
||
.DA 20
|
||
.DA 20
|
||
.DA 540
|
||
.DA 170
|
||
|
||
.DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.C16
|
||
.DA #9
|
||
.DA 30
|
||
.DA 30
|
||
.DA 530
|
||
.DA 160
|
||
|
||
.DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.XOR
|
||
.DA #S.CB.MODE.C16
|
||
.DA #8
|
||
.DA 40
|
||
.DA 40
|
||
.DA 520
|
||
.DA 150
|
||
|
||
.DA #0
|
||
*--------------------------------------
|
||
DrawLines.CB .DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.C16
|
||
.DA #1
|
||
.DA 80
|
||
.DA 191
|
||
.DA 80+191
|
||
.DA 191+191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.XOR
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 90
|
||
.DA 0
|
||
.DA 140
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 100
|
||
.DA 0
|
||
.DA 100+191
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.C16
|
||
.DA #15
|
||
.DA 110
|
||
.DA 0
|
||
.DA 559
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 28
|
||
.DA 0
|
||
.DA 28
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 84
|
||
.DA 0
|
||
.DA 84
|
||
.DA 191
|
||
|
||
.DA #S.CB.CMD.DRAWLINE
|
||
.DA #S.CB.OP.XOR
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 0
|
||
.DA 92
|
||
.DA 559
|
||
.DA 92
|
||
|
||
.DA #0
|
||
*--------------------------------------
|
||
SetPixel.CB .DA #S.CB.CMD.SETPIXEL
|
||
SetPixel.OP .BS 1
|
||
SetPixel.Mode .BS 1
|
||
SetPixel.Color .BS 1
|
||
SetPixel.X .BS 2
|
||
SetPixel.Y .BS 2
|
||
.DA #0
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DS.END
|
||
.ED
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/GUI.S
|
||
ASM
|