A2osX/SBIN/DESKTOP.S.txt

323 lines
6.2 KiB
Plaintext
Raw Normal View History

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
*--------------------------------------
2015-06-03 18:30:57 +00:00
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
2015-06-03 18:30:57 +00:00
.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
2016-06-15 06:21:42 +00:00
L.LIBGFX .DA LIBGFX
L.DEVNAME.GFX .DA DEVNAME.GFX
2015-06-03 18:30:57 +00:00
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
2016-06-07 06:10:18 +00:00
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
*--------------------------------------
2016-06-07 06:10:18 +00:00
CS.INIT >LDYA L.MSG.INIT
>SYSCALL PrintF.YA
2016-06-07 06:10:18 +00:00
2016-06-15 06:21:42 +00:00
>LDYA L.LIBGFX
>SYSCALL LoadLibYA
2016-06-15 06:21:42 +00:00
sta hLIBGFX
2016-06-07 06:10:18 +00:00
>LDYA L.DEVNAME.GFX
>SYSCALL GetDevByNameYA
bcc .10
rts
2015-06-03 18:30:57 +00:00
.10 stx hDevGFX
2016-07-22 14:11:13 +00:00
>STYA GoDevGFX+1
2016-07-22 14:11:13 +00:00
txa
2016-07-22 14:11:13 +00:00
ldx #DEVMGR.OPEN
jsr GoDevGFX
2016-06-07 06:10:18 +00:00
2015-06-03 18:30:57 +00:00
.11 >LDYA L.DEVNAME.MOUSE
>SYSCALL GetDevByNameYA
2015-06-03 18:30:57 +00:00
bcc .20
inc DEVNAME.MOUSE+4
lda DEVNAME.MOUSE+4
cmp #'8'
bne .11
2016-07-22 14:11:13 +00:00
beq .21 No mouse found, skip mouse init
2015-06-03 18:30:57 +00:00
.20 stx hDevMouse
>STYA GoDevMouse+1
2016-06-07 06:10:18 +00:00
ldx #DEVMGR.OPEN
jsr GoDevMouse
2016-06-07 06:10:18 +00:00
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
2016-07-22 14:11:13 +00:00
>LIBCALL hLibGFX,LIBGFX.InitGFXA
2016-07-22 14:11:13 +00:00
lda (pPs)
2015-06-03 18:30:57 +00:00
ora #S.PS.F.EVENT Now accept events
sta (pPs)
2016-07-22 14:11:13 +00:00
jsr Destop.Paint
clc
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
CS.RUN lda A2osX.ASCREEN GUI screen active ?
2016-07-22 14:11:13 +00:00
cmp #3
bne .8 no, exit....
2016-07-22 14:11:13 +00:00
lda hDevMouse Mouse is active ?
beq .4 go check KB
2015-06-03 18:30:57 +00:00
>LDYA L.MouseData
ldx #DEVMGR.READBLOCK
jsr GoDevMouse
bcs .4 go check KB
lda MouseData
bit #4 mouse move
beq .1
2015-06-03 18:30:57 +00:00
lda MouseData+1
sta SetPixel.X
lda MouseData+2
2016-07-22 14:11:13 +00:00
sta SetPixel.X+1
2015-06-03 18:30:57 +00:00
lda MouseData+3
sta SetPixel.Y
lda MouseData+4
sta SetPixel.Y+1
2015-06-03 18:30:57 +00:00
lda #0 S.CB.OP.XOR
sta SetPixel.OP
lda #S.CB.MODE.MONO
2016-07-22 14:11:13 +00:00
sta SetPixel.Mode
lda #1
2016-07-22 14:11:13 +00:00
sta SetPixel.Color
>LDYA L.SetPixel.CB
2015-06-03 18:30:57 +00:00
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
clc
rts
2015-06-03 18:30:57 +00:00
.1 bit #$20
beq .4
jsr Destop.Paint
.4
.8 clc
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
Destop.Paint lda #S.CB.MODE.C16
2016-07-22 14:11:13 +00:00
sta SetPixel.Mode
lda #0
sta SetPixel.Color
lda #20
2016-07-22 14:11:13 +00:00
sta SetPixel.Y
.1 lda #28
2016-07-22 14:11:13 +00:00
sta SetPixel.X
lda /28
2016-07-22 14:11:13 +00:00
sta SetPixel.X+1
.2 >LDYA L.SetPixel.CB
2016-07-22 14:11:13 +00:00
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
2016-07-22 14:11:13 +00:00
lda SetPixel.X+1
sbc /84
2016-07-22 14:11:13 +00:00
bcc .2
inc SetPixel.Y
lda SetPixel.Y
cmp #192
beq .4
2016-07-22 14:11:13 +00:00
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
2016-07-22 14:11:13 +00:00
*--------------------------------------
*--------------------------------------
*--------------------------------------
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"
2016-06-15 06:21:42 +00:00
hLibGFX .BS 1
hDevGFX .BS 1
2015-06-03 18:30:57 +00:00
hDevMouse .BS 1
MouseClamp .BS 8
MouseData .BS 5
*--------------------------------------
SetPixel.CB .BS 1 hDC
SetPixel.OP .BS 1
2016-07-22 14:11:13 +00:00
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