A2osX/SBIN/GUI.S.txt
2015-06-03 20:30:57 +02:00

201 lines
3.2 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/GUI
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.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.DEVNAME.GFX .DA DEVNAME.GFX
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
.DA 0
*--------------------------------------
CS.INIT >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
lda #A2osX.SCREENS.G
>SYSCALL SYS.ScreenSelectA
ldx #DEVMGR.OPEN
jsr GoDevGFX
bcs *
ldx #DEVMGR.OPEN
jsr GoDevMouse
bcs *
jmp .8
lda #2
sta BW
stz C
lda #4
sta X
lda /4
sta X+1
.1 lda #2
sta Y
.2 lda Y
lsr
lsr
lsr
clc
adc C
and #$0F
>PUSHA
>PUSHB Y
>PUSHW X
>PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
inc Y
lda Y
cmp #190
bne .2
dec BW
bne .3
lda #2
sta BW
inc C
lda C
cmp #16
bne .3
stz C
.3 lda X
clc
adc #4
sta X
bcc .4
inc X+1
.4 sec
sbc #556
lda X+1
sbc /556
bcc .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
lda (pEvent)
and #S.EVT.F.MOUSE
beq .99
ldy #S.EVT.DATALO
lda (pEvent),y
and #4 mouse move
beq .99
>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 2 Mode:1=B/W,2=16 colors,...,128=XOR
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
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"
hDevGFX .BS 1
pDevGFX .BS 2
hDevMouse .BS 1
pDevMouse .BS 2
X .BS 2
Y .BS 1
C .BS 1
BW .BS 1
MAN
SAVE SBIN/GUI.S
ASM