mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-30 08:51:06 +00:00
235 lines
4.3 KiB
Plaintext
235 lines
4.3 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BUILD/SBIN/DESKTOP
|
||
*--------------------------------------
|
||
.INB /A2OSX.BUILD/INC/IO.I
|
||
.INB /A2OSX.BUILD/INC/MACROS.I
|
||
.INB /A2OSX.BUILD/INC/A2OSX.I
|
||
.INB /A2OSX.BUILD/INC/LIBGFX.I
|
||
*--------------------------------------
|
||
* 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 CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBGFX .DA LIBGFX
|
||
L.DEVNAME.GFX .DA DEVNAME.GFX
|
||
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
|
||
L.MSG.INIT .DA MSG.INIT
|
||
L.SetPixel.X .DA SetPixel.X
|
||
L.DrawLine.X1 .DA DrawLine.X1
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.MSG.INIT
|
||
>SYSCALL CPrintFYA
|
||
|
||
>LDYA L.LIBGFX
|
||
>SYSCALL LoadLibYA
|
||
sta hLIBGFX
|
||
|
||
>LDYA L.DEVNAME.GFX
|
||
>SYSCALL GetDevByNameYA
|
||
bcc .10
|
||
rts
|
||
|
||
.10 stx hDevGFX
|
||
|
||
ldx pDev
|
||
phx
|
||
ldx pDev+1
|
||
phx
|
||
|
||
>STYA GoDevGFX+1
|
||
>STYA pDev
|
||
|
||
ldx #DEVMGR.OPEN
|
||
jsr GoDevGFX
|
||
|
||
.11 >LDYA L.DEVNAME.MOUSE
|
||
>SYSCALL GetDevByNameYA
|
||
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
|
||
>STYA pDev
|
||
|
||
ldx #DEVMGR.OPEN
|
||
jsr GoDevMouse
|
||
|
||
ldx #DEVMGR.SELECT Mouse driver disturb graphic mode....
|
||
jsr GoDevGFX
|
||
|
||
|
||
.21 pla
|
||
sta pDev+1
|
||
pla
|
||
sta pDev
|
||
|
||
lda hDevGFX
|
||
>LIBCALL hLibGFX,LIBGFX.InitGFXA
|
||
|
||
lda (pPs)
|
||
ora #S.PS.F.EVENT Now accept events
|
||
sta (pPs)
|
||
|
||
jsr Destop.Paint
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT ldy #S.EVT.hDEV
|
||
|
||
lda hDevMouse Mouse is active ?
|
||
beq .1 go check KB
|
||
|
||
cmp (pEvent),y Event coming from Mouse ?
|
||
bne .1 go check KB
|
||
|
||
lda A2osX.ASCREEN GUI screen active ?
|
||
cmp #3
|
||
bne .98 no, discard mouse event & exit
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (pEvent),y
|
||
and #4 mouse move
|
||
beq .98
|
||
|
||
ldy #S.EVT.DATAW2
|
||
lda (pEvent),y
|
||
sta SetPixel.Y
|
||
|
||
dey
|
||
lda (pEvent),y X.HI
|
||
sta SetPixel.X+1
|
||
|
||
dey
|
||
lda (pEvent),y X.LO
|
||
sta SetPixel.X
|
||
|
||
lda #4
|
||
sta SetPixel.Mode
|
||
|
||
lda #15
|
||
sta SetPixel.Color
|
||
|
||
>LDYA L.SetPixel.X
|
||
ldx #DEVMGR.GFX.SETPIXEL
|
||
jsr GoDevGFX
|
||
.98 clc Mark event proceeded
|
||
rts
|
||
|
||
.1 lda A2osX.ASCREEN GUI screen active ?
|
||
cmp #3
|
||
bne .99 not for us...
|
||
|
||
sec
|
||
rts
|
||
|
||
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT clc
|
||
rts
|
||
*--------------------------------------
|
||
Destop.Paint lda #4
|
||
sta SetPixel.Mode
|
||
|
||
lda #0
|
||
sta SetPixel.Color
|
||
|
||
lda #0
|
||
sta SetPixel.Y
|
||
|
||
.1 lda #0
|
||
sta SetPixel.X
|
||
lda /0
|
||
sta SetPixel.X+1
|
||
|
||
.2 >LDYA L.SetPixel.X
|
||
|
||
ldx #DEVMGR.GFX.SETPIXEL
|
||
jsr GoDevGFX
|
||
|
||
lda SetPixel.X
|
||
clc
|
||
adc #4
|
||
sta SetPixel.X
|
||
bcc .3
|
||
inc SetPixel.X+1
|
||
|
||
.3 lda SetPixel.X
|
||
cmp #279
|
||
lda SetPixel.X+1
|
||
sbc /279
|
||
bcc .2
|
||
|
||
inc SetPixel.Y
|
||
lda SetPixel.Y
|
||
cmp #192
|
||
beq .8
|
||
and #$7
|
||
bne .1
|
||
|
||
inc SetPixel.Color
|
||
lda SetPixel.Color
|
||
cmp #16
|
||
bne .1
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
*--------------------------------------
|
||
*--------------------------------------
|
||
GoDevGFX jmp $ffff
|
||
GoDevMouse jmp $ffff
|
||
*--------------------------------------
|
||
CS.END
|
||
DEVNAME.GFX >PSTR "GFX"
|
||
DEVNAME.MOUSE >PSTR "MOU1"
|
||
LIBGFX >PSTR "libgfx.o"
|
||
MSG.INIT >CSTR "DESKTOP:Init...\n"
|
||
hLibGFX .BS 1
|
||
hDevGFX .BS 1
|
||
hDevMouse .BS 1
|
||
SetPixel.X .BS 2
|
||
SetPixel.Y .BS 2
|
||
SetPixel.Mode .BS 1
|
||
SetPixel.Color .BS 1
|
||
DrawLine.X1 .BS 2
|
||
DrawLine.Y1 .BS 2
|
||
DrawLine.X2 .BS 2
|
||
DrawLine.Y2 .BS 2
|
||
DrawLine.Mode .BS 1
|
||
DrawLine.Color .BS 1
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/DESKTOP.S
|
||
ASM
|