mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-16 23:21:24 +00:00
323 lines
6.2 KiB
Plaintext
323 lines
6.2 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
|
||
*--------------------------------------
|
||
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
|
||
.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.MouseClamp .DA MouseClamp
|
||
L.MouseData .DA MouseData
|
||
L.SetPixel.CB .DA SetPixel.CB
|
||
L.DrawLine1.CB .DA DrawLine1.CB
|
||
L.DrawLine2.CB .DA DrawLine2.CB
|
||
L.DrawLine3.CB .DA DrawLine3.CB
|
||
L.DrawLine4.CB .DA DrawLine4.CB
|
||
L.DrawLine5.CB .DA DrawLine5.CB
|
||
L.DrawLine6.CB .DA DrawLine6.CB
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.MSG.INIT
|
||
>SYSCALL PrintF.YA
|
||
|
||
>LDYA L.LIBGFX
|
||
>SYSCALL LoadLibYA
|
||
sta hLIBGFX
|
||
|
||
>LDYA L.DEVNAME.GFX
|
||
>SYSCALL GetDevByNameYA
|
||
bcc .10
|
||
rts
|
||
|
||
.10 stx hDevGFX
|
||
|
||
>STYA GoDevGFX+1
|
||
|
||
txa
|
||
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
|
||
|
||
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.DEVSTAT+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 hLibGFX,LIBGFX.InitGFXA
|
||
|
||
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
|
||
|
||
>LDYA L.SetPixel.CB
|
||
ldx #DEVMGR.GFX.SETPIXEL
|
||
jsr GoDevGFX
|
||
clc
|
||
rts
|
||
|
||
.1 bit #$20
|
||
beq .4
|
||
|
||
jsr Destop.Paint
|
||
|
||
|
||
.4
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT clc
|
||
rts
|
||
*--------------------------------------
|
||
Destop.Paint 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 >LDYA L.SetPixel.CB
|
||
|
||
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 #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.DrawLine1.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
>PUSHW L.DrawLine2.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
>PUSHW L.DrawLine3.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
>PUSHW L.DrawLine4.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
>PUSHW L.DrawLine5.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
>PUSHW L.DrawLine6.CB
|
||
>LIBCALL hLibGFX,LIBGFX.DrawLine
|
||
|
||
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...\r\n"
|
||
hLibGFX .BS 1
|
||
hDevGFX .BS 1
|
||
hDevMouse .BS 1
|
||
MouseClamp .BS 8
|
||
MouseData .BS 5
|
||
*--------------------------------------
|
||
SetPixel.CB .BS 1 hDC
|
||
SetPixel.OP .BS 1
|
||
SetPixel.Mode .BS 1
|
||
SetPixel.Color .BS 1
|
||
SetPixel.X .BS 2
|
||
SetPixel.Y .BS 2
|
||
*--------------------------------------
|
||
DrawLine1.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.C16
|
||
.DA #1
|
||
.DA 80
|
||
.DA 191
|
||
.DA 80+191
|
||
.DA 0
|
||
*--------------------------------------
|
||
DrawLine2.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 90
|
||
.DA 0
|
||
.DA 140
|
||
.DA 191
|
||
*--------------------------------------
|
||
DrawLine3.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 100
|
||
.DA 0
|
||
.DA 100+191
|
||
.DA 191
|
||
*--------------------------------------
|
||
DrawLine4.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 110
|
||
.DA 0
|
||
.DA 559
|
||
.DA 191
|
||
*--------------------------------------
|
||
DrawLine5.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 28
|
||
.DA 0
|
||
.DA 28
|
||
.DA 191
|
||
*--------------------------------------
|
||
DrawLine6.CB .BS 1 hDC
|
||
.DA #0
|
||
.DA #S.CB.MODE.MONO
|
||
.DA #1
|
||
.DA 84
|
||
.DA 0
|
||
.DA 84
|
||
.DA 191
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/DESKTOP.S
|
||
ASM
|