A2osX/SBIN/GUIOSD.S.txt

258 lines
5.0 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.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/SBIN/GUIOSD
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/PRODOS.I
.INB /A2OSX.BUILD/INC/IO.I
.INB /A2OSX.BUILD/INC/LIBGUI.I
*--------------------------------------
A1L .EQ $3C
A2L .EQ $3E
A4L .EQ $42
MoveAux .EQ $C311
XFer .EQ $C314
*--------------------------------------
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 CS
.DA DS.END-DS.START DS
.DA #64 SS
.DA #0 ZP
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
.DA 0
*--------------------------------------
CS.INIT
lda #0
sec
rts
*--------------------------------------
CS.RUN clc
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
*--------------------------------------
.PH $0C00
*--------------------------------------
ZPCmdPtr .EQ ZPDRV
ZPDestBMPtr .EQ ZPDRV+2
*--------------------------------------
* YA =Ptr to S.CB in MAIN****
* X = DestBM hMem
*--------------------------------------
GUIOSD >STYA A1L Src Start Address (MAIN)
pha
tya
clc
adc #S.CB
sta A2L Src End Address (MAIN)
pla
adc /S.CB
sta A2L+1
>LDYA CB.Cache
>STYA A4L Dst Address (AUX)
sec Main To Aux
jsr MoveAux
txa
ldx #SYS.GetMemPtr.A Get AUX Stock Object
jsr $E000 with GetMem
>STYA ZPDestBMPtr
ldx #0
.1 lda (ZPDestBMPtr)
sta DestBM.Cache,x
inc ZPDestBMPtr
bne .2
inc ZPDestBMPtr+1
.2 inx
cpx #S.BM
bne .1
ldx CB.Cache+S.CB.CMD
jmp (J.Cmds,x)
*--------------------------------------
J.Cmds .DA SETPIXEL
.DA GETPIXEL
.DA HLINE
.DA VLINE
.DA FILLRECT
.DA BITBLT
.DA GETRECTBUFSIZE
*--------------------------------------
SETPIXEL >LDYA CB.Cache+S.CB.Y1
ldx DestBM.Cache+S.BM.RowBytes
jsr YAMultX
pha
tya
clc
adc ZPDestBMPtr
sta ZPDestBMPtr
pla
adc ZPDestBMPtr+1
sta ZPDestBMPtr+1
lda CB.Cache+S.CB.MODE
bit #S.CB.MODE.C16
bne SETPIXEL.C16
SETPIXEL.MONO lda CB.Cache+S.CB.X1
pha
and #$7 MOD 7
tax
pla
lsr CB.Cache+S.CB.X1
ror
lsr CB.Cache+S.CB.X1
ror
lsr CB.Cache+S.CB.X1
ror
clc
adc ZPDestBMPtr
sta ZPDestBMPtr
lda CB.Cache+S.CB.X1
adc ZPDestBMPtr+1
sta ZPDestBMPtr+1
lda CB.Cache+S.CB.OP
* cmp #S.CB.OP.XOR
beq SETPIXEL.MONO.XOR
lda CB.Cache+S.CB.COLOR
bne SETPIXEL.MONO.WHITE
SETPIXEL.MONO.BLACK
lda (ZPDestBMPtr)
and Mono.NMasks,x
sta (ZPDestBMPtr)
rts
SETPIXEL.MONO.WHITE
lda (ZPDestBMPtr)
ora Mono.Masks,x
sta (ZPDestBMPtr)
rts
SETPIXEL.MONO.XOR
lda (ZPDestBMPtr)
eor Mono.Masks,x
sta (ZPDestBMPtr)
rts
SETPIXEL.C16
*--------------------------------------
GETPIXEL
*--------------------------------------
HLINE
*--------------------------------------
VLINE
*--------------------------------------
FILLRECT
*--------------------------------------
BITBLT
*--------------------------------------
GETRECTBUFSIZE
*--------------------------------------
*--------------------------------------
* IN:
* Y,A = num1 (16)
* X = num2 (8)
* OUT:
* Y,A = (Y,A) * X
*--------------------------------------
YAMultX stx GBYTE
sty GWORD
sta GWORD+1
ldy #0 Result LO
tya Result HI
bra .3
.1 pha
tya
clc
adc GWORD
tay
pla
adc GWORD+1
.2 asl GWORD
rol GWORD+1
.3 lsr GBYTE
bcs .1
bne .2
rts
*--------------------------------------
Mono.NMasks .DA #%11111110
.DA #%11111101
.DA #%11111011
.DA #%11110111
.DA #%11101111
.DA #%11011111
.DA #%10111111
.DA #%01111111
*--------------------------------------
Mono.Masks .DA #%00000001
.DA #%00000010
.DA #%00000100
.DA #%00001000
.DA #%00010000
.DA #%00100000
.DA #%01000000
.DA #%10000000
*--------------------------------------
CB.Cache .BS S.CB
DestBM.Cache .BS S.BM
GBYTE .BS 1
GWORD .BS 2
*--------------------------------------
.EP
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END
.ED
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/GUIOSD
ASM