mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
433 lines
8.1 KiB
Plaintext
433 lines
8.1 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BUILD/SBIN/GUI/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
|
||
ZPFontPtr .EQ ZPDRV+4
|
||
ZPCharPtr .EQ ZPDRV+6
|
||
*--------------------------------------
|
||
* 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
|
||
beq .1
|
||
|
||
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
|
||
* S.CB.X1 : SrcX1 in bitmap/mask
|
||
* S.CB.Y1 : SrcY1
|
||
* S.CB.SrcW : width
|
||
* S.CB.SrcH : height
|
||
|
||
* S.CB.DstX : Destination X (screen)
|
||
* S.CB.DstY : Destination Y (screen)
|
||
|
||
* S.CB.SrcPtr : pointer to S.BM
|
||
* S.CB.SrcPtr+1 = 0, hMem in S.CB.SrcPtr
|
||
* S.CB.DstPtr : pointer to Save Buffer
|
||
*--------------------------------------
|
||
BITBLT >LDYA CB.CACHE+S.CB.SrcPtr
|
||
bne BITBLT.1
|
||
|
||
tya
|
||
GO.GetMemPtr.A
|
||
|
||
BITBLT.1 >STYA ZPSrcBMDataPtr
|
||
*--------------------------------------
|
||
* In:
|
||
* S.CB.SrcW
|
||
* S.CB.SrcH
|
||
* Out:
|
||
* S.CB.DstPtr : Buffer Size (in bytes)
|
||
*--------------------------------------
|
||
GETRECTBUFSIZE
|
||
*--------------------------------------
|
||
* In:
|
||
* S.CB.S.CB.FONT : hFont
|
||
* S.CB.SrcPtr : Ptr to Text
|
||
* S.CB.DstPtr : Buffer Size (in bytes)
|
||
*--------------------------------------
|
||
DRAWTEXT lda CB.Cache+S.CB.FONT
|
||
GO.GetMemPtr.A
|
||
>STYA ZPFontPtr
|
||
|
||
ldy #S.FON-1
|
||
|
||
.1 lda (ZPFontPtr),y
|
||
sta FON.Cache,y
|
||
dey
|
||
bpl .1
|
||
|
||
lda ZPFontPtr
|
||
clc
|
||
adc #S.FON
|
||
sta ZPFontPtr
|
||
bcc .2
|
||
inc ZPFontPtr+1
|
||
|
||
.2 >LDYA CB.Cache+S.CB.SrcPtr
|
||
>STYA TXTPTR
|
||
|
||
lda S.BM.F.BBP1
|
||
sta DestBM.Cache+S.BM.F
|
||
|
||
stz DestBM.Cache+S.BM.W
|
||
stz DestBM.Cache+S.BM.W+1
|
||
|
||
lda FON.Cache+S.FON.PixH
|
||
sta DestBM.Cache+S.BM.H
|
||
stz DestBM.Cache+S.BM.H+1
|
||
|
||
.3 jsr TXTPTR.GetNext
|
||
beq .4
|
||
|
||
jsr FON.GetChar
|
||
lda (ZPCharPtr) Get Char PixelW
|
||
sec
|
||
adc DestBM.Cache+S.BM.W
|
||
sta DestBM.Cache+S.BM.W
|
||
bcc .3
|
||
|
||
inc DestBM.Cache+S.BM.W+1
|
||
bra .3
|
||
|
||
.4 jsr BM.Create
|
||
bcs .9
|
||
|
||
|
||
|
||
|
||
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
FON.GetChar cmp FON.Cache+S.FON.Last
|
||
bcc .1
|
||
bne .2
|
||
|
||
.1 sec
|
||
sbc FON.Cache+S.FON.First
|
||
bcs .3
|
||
|
||
.2 lda FON.Cache+S.FON.Default
|
||
|
||
.3 asl
|
||
php
|
||
clc
|
||
adc ZPFontPtr
|
||
sta ZPCharPtr
|
||
|
||
adc ZPFontPtr+1
|
||
sta ZPCharPtr+1
|
||
plp
|
||
bcc .8
|
||
inc ZPCharPtr+1
|
||
.8 rts
|
||
*--------------------------------------
|
||
BM.Create lda DestBM.Cache+S.BM.W
|
||
ldx DestBM.Cache+S.BM.W+1
|
||
bit #7
|
||
beq .1
|
||
and #7
|
||
clc
|
||
adc #8
|
||
bcc .1
|
||
inx
|
||
|
||
.1 sta DestBM.Cache+S.BM.RowBytes
|
||
txa
|
||
|
||
lsr
|
||
ror DestBM.Cache+S.BM.RowBytes
|
||
lsr
|
||
ror DestBM.Cache+S.BM.RowBytes
|
||
lsr
|
||
ror DestBM.Cache+S.BM.RowBytes
|
||
|
||
>LDYA DestBM.Cache+S.BM.H
|
||
ldx DestBM.Cache+S.BM.RowBytes
|
||
|
||
jsr YAMultX
|
||
|
||
pha
|
||
tya
|
||
clc
|
||
adc #S.BM
|
||
tay
|
||
pla
|
||
adc /S.BM
|
||
jsr GO.GetMem.YA
|
||
bcs .9
|
||
|
||
>STYA ZPDestBMPtr
|
||
|
||
ldy #S.BM-1
|
||
|
||
.2 lda DestBM.Cache,y
|
||
sta (ZPDestBMPtr),y
|
||
dey
|
||
bpl .2
|
||
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
* to move in LC or ZP/STK
|
||
*--------------------------------------
|
||
TXTPTR.GetNext sta CLRREADAUX
|
||
lda (TXTPTR)
|
||
sta SETREADAUX
|
||
beq .9
|
||
inc TXTPTR
|
||
bne .9
|
||
inc TXTPTR+1
|
||
.9 rts
|
||
*--------------------------------------
|
||
* 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
|
||
*--------------------------------------
|
||
GO.GetMem.YA ldx #SYS.GetMem.YA
|
||
.HS 2C BIT ABS
|
||
GO.GetMemPtr.A ldx #SYS.GetMemPtr.A
|
||
GO.Kernel jmp ($E000,x)
|
||
*--------------------------------------
|
||
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
|
||
FON.Cache .BS S.FON
|
||
DestBM.Cache .BS S.BM
|
||
GBYTE .BS 1
|
||
GWORD .BS 2
|
||
*--------------------------------------
|
||
.EP
|
||
GUIOSD.END .EQ *
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DS.END
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/GUIOSD
|
||
ASM
|