A2osX/SBIN/DESKTOP.S.txt
2016-06-15 08:21:42 +02:00

209 lines
3.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.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/SBIN/DESKTOP
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB 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
.DA 0
*--------------------------------------
CS.INIT >LDYA L.MSG.INIT
>SYSCALL SYS.PSTROutYA
>LDYA L.LIBGFX
>SYSCALL SYS.LoadLibYA
sta hLIBGFX
>LDYA L.DEVNAME.GFX
>SYSCALL SYS.GetDevByNameYA
bcc .10
rts
.10 stx hDevGFX
>STYA pDevGFX
.11 >LDYA L.DEVNAME.MOUSE
>SYSCALL SYS.GetDevByNameYA
bcc .20
inc DEVNAME.MOUSE+4
lda DEVNAME.MOUSE+4
cmp #'8'
bne .11
sec
rts
.20 stx hDevMouse
>STYA pDevMouse
ldx #DEVMGR.OPEN
jsr GoDevMouse
lda pDev
pha
lda pDev+1
pha
lda pDevGFX
sta pDev
lda pDevGFX+1
sta pDev+1
ldx #DEVMGR.OPEN
jsr GoDevGFX
pla
sta pDev+1
pla
sta pDev
lda hDevGFX
>LIBCALL hLibGFX,LIBGFX.InitDevA
* jmp .8
lda #15
sta C
lda #0
sta Y
.1 lda #0
sta X
lda /0
sta X+1
.2 >PUSHB C
>PUSHB Y
>PUSHW X
>PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
lda X
clc
adc #4
sta X
bcc .3
inc X+1
.3 lda X
sec
sbc #559
lda X+1
sbc /559
bcc .2
.4 inc Y
lda Y
cmp #192
beq .8
and #$7
bne .1
dec C
bpl .1
lda #15
sta C
bra .1
.8 lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
rts
*--------------------------------------
CS.RUN clc
rts
*--------------------------------------
CS.DOEVENT ldy #S.EVT.hDEV
lda (pEvent),y
cmp hDevMouse
bne .99
ldy #S.EVT.DATALO
lda (pEvent),y
and #4 mouse move
beq .98
>PUSHBI 15 COLOR
ldy #S.EVT.DATAW2
lda (pEvent),y
>PUSHA Y
dey
lda (pEvent),y X.HI
>PUSHA
dey
lda (pEvent),y
>PUSHA X.LO
>PUSHBI 128 Mode:1=B/W,2=16 colors,...,128=XOR
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
.98 clc
rts
.99 sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
GoDevGFX jmp (pDevGFX)
GoDevMouse jmp (pDevMouse)
*--------------------------------------
CS.END
DEVNAME.GFX >PSTRING "GFX"
DEVNAME.MOUSE >PSTRING "MOU1"
LIBGFX >PSTRING "libgfx.o"
MSG.INIT >PSTRING "DESKTOP:Init...\n"
hLibGFX .BS 1
hDevGFX .BS 1
pDevGFX .BS 2
hDevMouse .BS 1
pDevMouse .BS 2
X .BS 2
Y .BS 1
C .BS 1
MAN
SAVE SBIN/DESKTOP.S
ASM