mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-24 14:31:05 +00:00
498 lines
9.0 KiB
Plaintext
498 lines
9.0 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF root/asmtest/gtest
|
||
*--------------------------------------
|
||
.INB inc/macros.i
|
||
.INB inc/a2osx.i
|
||
.INB inc/mli.i
|
||
.INB inc/gfx.i
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPBIN
|
||
ZS.START
|
||
hDevGFX .BS 1
|
||
hFont .BS 1
|
||
hFontB .BS 1
|
||
bVBL .BS 1
|
||
xDir .BS 1
|
||
yDir .BS 1
|
||
ZS.END .ED
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA #S.PS.F.EVENT S.PS.F
|
||
.DA #0
|
||
.DA CS.END-CS.START Code Size (without Constants)
|
||
.DA DS.END-DS.START Data Segment Size
|
||
.DA #64 Stack Size
|
||
.DA #ZS.END-ZS.START Zero Page Size
|
||
.DA 0
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.DEVNAME.GFX .DA DEVNAME.GFX
|
||
L.FONTFILE .DA FONTFILE
|
||
L.FONTFILEB .DA FONTFILEB
|
||
L.MARILYNFILE .DA MARILYNFILE
|
||
L.LOGOFILE .DA LOGOFILE
|
||
L.PALETTEFILE .DA PALETTEFILE
|
||
L.CB.RECT .DA CB.RECT
|
||
L.CB.RECT2 .DA CB.RECT2
|
||
L.CB.TEXTB .DA CB.TEXTB
|
||
L.CB.TEXT .DA CB.TEXT
|
||
L.CB.PIX .DA CB.PIX
|
||
L.CB.LOGO .DA CB.LOGO
|
||
L.CB.PALETTE .DA CB.PALETTE
|
||
L.CB.Apple .DA CB.Apple
|
||
L.BM.Apple .DA BM.Apple
|
||
L.MESSAGEB .DA MESSAGEB
|
||
L.MESSAGE .DA MESSAGE
|
||
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT clc
|
||
CS.INIT.RTS rts
|
||
*--------------------------------------
|
||
CS.RUN jsr GFX.Open
|
||
bcs CS.INIT.RTS
|
||
|
||
jsr LoadResources
|
||
bcs CS.INIT.RTS
|
||
|
||
>LDYA L.CB.RECT
|
||
jsr GFX.Write.YA
|
||
|
||
.1 >LDYA L.CB.RECT2
|
||
jsr GFX.Write.YA
|
||
|
||
inc CB.RECT2+S.CB.COLOR
|
||
lda CB.RECT2+S.CB.COLOR
|
||
cmp #16
|
||
beq .3
|
||
|
||
lda CB.RECT2+S.CB.X1
|
||
clc
|
||
adc #28
|
||
sta CB.RECT2+S.CB.X1
|
||
bcc .2
|
||
inc CB.RECT2+S.CB.X1+1
|
||
|
||
.2 lda CB.RECT2+S.CB.X2
|
||
clc
|
||
adc #28
|
||
sta CB.RECT2+S.CB.X2
|
||
bcc .1
|
||
inc CB.RECT2+S.CB.X2+1
|
||
bra .1
|
||
|
||
.3 >LDYA L.CB.PIX
|
||
jsr GFX.Write.YA
|
||
|
||
>LDYA L.CB.PALETTE
|
||
jsr GFX.Write.YA
|
||
|
||
>LDYA L.BM.Apple
|
||
>STYA CB.Apple+S.CB.SrcPtr
|
||
|
||
>LDYA L.CB.Apple
|
||
jsr GFX.Write.YA
|
||
|
||
lda hFontB
|
||
sta CB.TEXTB+S.CB.hFont
|
||
>LDYA L.MESSAGEB
|
||
>STYA CB.TEXTB+S.CB.TxtPtr
|
||
|
||
>LDYA L.CB.TEXTB
|
||
jsr GFX.Write.YA
|
||
bcs .9
|
||
|
||
>LDYA L.CB.TEXTB
|
||
jsr GFX.Write.YA
|
||
|
||
lda hFont
|
||
sta CB.TEXT+S.CB.hFont
|
||
|
||
>LDYA L.MESSAGE
|
||
>STYA CB.TEXT+S.CB.TxtPtr
|
||
|
||
>LDYA L.CB.TEXT
|
||
jsr GFX.Write.YA
|
||
bcs .9
|
||
|
||
>LDYA L.CB.TEXT
|
||
jsr GFX.Write.YA
|
||
|
||
jsr CS.RUN.LOGO.SHOW
|
||
bcs .9
|
||
|
||
lda #0
|
||
sec
|
||
.9
|
||
CS.RUN.RTS rts
|
||
*--------------------------------------
|
||
CS.RUN.LOGO.SHOW
|
||
* lda #S.CB.CMD.GETRECTBUFSIZE
|
||
* sta CB.LOGO+S.CB.CMD
|
||
|
||
>LDYA L.CB.LOGO
|
||
jsr GFX.Write.YA
|
||
bcs CS.RUN.RTS
|
||
|
||
>SYSCALL NewStkObj
|
||
bcs CS.RUN.RTS
|
||
|
||
stx CB.LOGO+S.CB.DstPtr
|
||
|
||
lda #S.CB.CMD.BITBLT
|
||
sta CB.LOGO+S.CB.CMD
|
||
|
||
.1 lda #S.CB.OP.SET+S.CB.OP.COLOR+S.CB.OP.SAVE
|
||
sta CB.LOGO+S.CB.OP
|
||
|
||
>LDYA L.CB.LOGO
|
||
jsr GFX.Write.YA
|
||
|
||
ldy #S.PS.hStdIn
|
||
lda (pPS),y
|
||
|
||
>SYSCALL FEOF
|
||
bcs CS.RUN.RTS
|
||
tay
|
||
beq .80
|
||
|
||
.2 >SLEEP
|
||
|
||
bit bVBL
|
||
bpl .2
|
||
|
||
stz bVBL
|
||
|
||
lda #S.CB.OP.RESTORE
|
||
sta CB.LOGO+S.CB.OP
|
||
|
||
>LDYA L.CB.LOGO
|
||
jsr GFX.Write.YA
|
||
|
||
bit xDir
|
||
bmi .4
|
||
|
||
lda CB.LOGO+S.CB.X1
|
||
clc
|
||
adc #4
|
||
tay
|
||
|
||
lda CB.LOGO+S.CB.X1+1
|
||
adc #0
|
||
pha
|
||
cpy #244
|
||
sbc /244
|
||
pla
|
||
bcc .5
|
||
|
||
.3 lda xDir
|
||
eor #$ff
|
||
sta xDir
|
||
bra .6
|
||
|
||
.4 lda CB.LOGO+S.CB.X1
|
||
sec
|
||
sbc #4
|
||
tay
|
||
lda CB.LOGO+S.CB.X1+1
|
||
sbc #0
|
||
bcc .3
|
||
|
||
.5 sty CB.LOGO+S.CB.X1
|
||
sta CB.LOGO+S.CB.X1+1
|
||
|
||
.6 lda CB.LOGO+S.CB.Y1
|
||
bit yDir
|
||
bmi .8
|
||
|
||
inc
|
||
sta CB.LOGO+S.CB.Y1
|
||
cmp #144
|
||
bne .1
|
||
|
||
.7 lda yDir
|
||
eor #$ff
|
||
sta yDir
|
||
jmp .1
|
||
|
||
.8 sec
|
||
sbc #1
|
||
sta CB.LOGO+S.CB.Y1
|
||
beq .7
|
||
|
||
jmp .1
|
||
|
||
.80 >SYSCALL GetChar
|
||
|
||
lda CB.LOGO+S.CB.DstPtr
|
||
>SYSCALL FreeStkObj
|
||
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT lda (pEvent)
|
||
bpl .9
|
||
|
||
sta bVBL
|
||
|
||
.9 sec never discard TIME event
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hFont
|
||
beq .1
|
||
>SYSCALL FreeStkObj
|
||
|
||
.1 lda hFontB
|
||
beq .2
|
||
>SYSCALL FreeStkObj
|
||
|
||
.2 lda CB.PIX+S.CB.SrcPtr
|
||
beq .3
|
||
>SYSCALL FreeStkObj
|
||
|
||
.3 lda CB.LOGO+S.CB.SrcPtr
|
||
beq .4
|
||
>SYSCALL FreeStkObj
|
||
|
||
.4 lda CB.TEXTB+S.CB.SrcPtr
|
||
beq .5
|
||
>SYSCALL FreeStkObj
|
||
|
||
.5 lda CB.TEXT+S.CB.SrcPtr
|
||
beq .6
|
||
>SYSCALL FreeStkObj
|
||
|
||
.6 lda CB.PALETTE+S.CB.SrcPtr
|
||
beq .7
|
||
>SYSCALL FreeStkObj
|
||
|
||
.7 lda hDevGFX
|
||
beq .8
|
||
|
||
>SYSCALL Close
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
LoadResources >LDYA L.FONTFILE
|
||
ldx #S.FI.T.FON
|
||
jsr .1
|
||
bcs .9
|
||
|
||
stx hFont
|
||
|
||
>LDYA L.FONTFILEB
|
||
ldx #S.FI.T.FON
|
||
jsr .1
|
||
bcs .9
|
||
|
||
stx hFontB
|
||
|
||
>LDYA L.MARILYNFILE
|
||
ldx #S.FI.T.PIX
|
||
jsr .1
|
||
bcs .9
|
||
|
||
stx CB.PIX+S.CB.SrcPtr
|
||
|
||
>LDYA L.LOGOFILE
|
||
ldx #S.FI.T.PIX
|
||
jsr .1
|
||
bcs .9
|
||
|
||
stx CB.LOGO+S.CB.SrcPtr
|
||
|
||
>LDYA L.PALETTEFILE
|
||
ldx #S.FI.T.PIX
|
||
jsr .1
|
||
bcs .9
|
||
|
||
stx CB.PALETTE+S.CB.SrcPtr
|
||
|
||
.9 rts
|
||
|
||
.1 >PUSHYA
|
||
>PUSHBI O.RDONLY
|
||
txa
|
||
>PUSHA type
|
||
>PUSHWZ Aux type
|
||
>SYSCALL LoadStkObj
|
||
rts
|
||
*--------------------------------------
|
||
GFX.Open >PUSHW L.DEVNAME.GFX
|
||
>PUSHBI 0
|
||
>SYSCALL Open
|
||
bcs .9
|
||
sta hDevGFX
|
||
.9 rts
|
||
*--------------------------------------
|
||
GFX.Write.YA pha
|
||
>PUSHB hDevGFX
|
||
>PUSHBI IOCTL.WRITE
|
||
pla
|
||
>PUSHYA
|
||
>SYSCALL IOCTL
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
DEVNAME.GFX .AZ "/dev/gfx"
|
||
FONTFILE .AZ "${ROOT}opt/gui/fonts/sysx7"
|
||
FONTFILEB .AZ "${ROOT}opt/gui/fonts/sysx7b"
|
||
MARILYNFILE .AZ "${ROOT}root/bmp/MARILYN"
|
||
LOGOFILE .AZ "${ROOT}A2osX.logo"
|
||
*LOGOFILE .AZ "${ROOT}root/bmp/A2OSX.LOGO"
|
||
PALETTEFILE .AZ "${ROOT}root/bmp/PALETTE"
|
||
MESSAGEB .AZ " DHGR Driver & OSD 'Off-Screen Driver' Test (SYSX7B Font, Inverse) "
|
||
MESSAGE .AZ " 1234567890 abcdefghijklmnopqrstuvwxyz { + - * / } (SYSX7 Font, Normal) "
|
||
|
||
CB.RECT .DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.M.C16
|
||
.DA #11 Color
|
||
.DA 28
|
||
.DA 10
|
||
.DA 532
|
||
.DA 182
|
||
|
||
CB.RECT2 .DA #S.CB.CMD.FILLRECT
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.M.C16
|
||
.DA #0 Color
|
||
.DA 60 X1
|
||
.DA 150 Y1
|
||
.DA 88 X2
|
||
.DA 180 Y2
|
||
|
||
CB.Apple .DA #S.CB.CMD.BITBLT
|
||
.DA #S.CB.OP.ORA+S.CB.OP.MASK+S.CB.OP.COLOR
|
||
.DA #S.CB.M.C16
|
||
.DA #0
|
||
.DA 20 X1
|
||
.DA 172 Y1
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 16 SrcW
|
||
.DA 7 SrcH
|
||
.BS 2 SrcPtr
|
||
.DA 0 DstPtr
|
||
|
||
CB.PIX .DA #S.CB.CMD.BITBLT
|
||
.DA #S.CB.OP.SET+S.CB.OP.COLOR
|
||
.DA #S.CB.M.MONO
|
||
.DA #0
|
||
.DA 56 X1
|
||
.DA 30 Y1
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 120 SrcW
|
||
.DA 100 SrcH
|
||
.BS 2 SrcPtr
|
||
.DA 0 DstPtr
|
||
|
||
CB.PALETTE .DA #S.CB.CMD.BITBLT
|
||
.DA #S.CB.OP.SET+S.CB.OP.COLOR
|
||
.DA #S.CB.M.C16
|
||
.DA #0
|
||
.DA 200 X1
|
||
.DA 100 Y1
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 320 SrcW
|
||
.DA 40 SrcH
|
||
.BS 2 SrcPtr
|
||
.DA 0 DstPtr
|
||
|
||
CB.TEXTB .DA #S.CB.CMD.DRAWTEXT+S.CB.CMD.OSD
|
||
.DA #S.CB.OP.SET+S.CB.OP.INVERSE
|
||
.DA #S.CB.M.MONO
|
||
.BS 1 hFONT
|
||
.DA 7 X1
|
||
.DA 1 Y1
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.BS 2 DstPtr
|
||
.BS 2 TXTPTR
|
||
|
||
CB.TEXT .DA #S.CB.CMD.DRAWTEXT+S.CB.CMD.OSD
|
||
.DA #S.CB.OP.SET
|
||
.DA #S.CB.M.MONO
|
||
.BS 1 hFONT
|
||
.DA 50 X1
|
||
.DA 184 Y1
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.BS 2 DstPtr
|
||
.BS 2 TXTPTR
|
||
*--------------------------------------
|
||
BM.Apple .DA #S.BM.F.BBP4
|
||
.DA #2 RowBytes
|
||
.DA 16 W
|
||
.DA 7 H
|
||
.DA BM.Apple.AND-BM.Apple
|
||
.HS 0006 green (8)
|
||
.HS 6006 green (8)
|
||
.HS EEEE yellow (15)
|
||
.HS CC0C orange (14)
|
||
.HS 9909 magenta (10)
|
||
.HS 8888 violet (11)
|
||
.HS 1001 Dark blue (4)
|
||
BM.Apple.AND .HS FFF0
|
||
.HS 0FF0
|
||
.HS 0000
|
||
.HS 00F0
|
||
.HS 00F0
|
||
.HS 0000
|
||
.HS 0FF0
|
||
*--------------------------------------
|
||
CB.LOGO .DA #S.CB.CMD.GETRECTBUFSIZE
|
||
.DA #S.CB.OP.SET+S.CB.OP.COLOR+S.CB.OP.SAVE
|
||
.DA #S.CB.M.C16
|
||
.DA #0
|
||
.DA 200 X1
|
||
.DA 50 Y1
|
||
.DA 200+319 X2 For GETRECTBUFSIZE
|
||
.DA 50+39 Y2 For GETRECTBUFSIZE
|
||
.DA 0 SrcX
|
||
.DA 0 SrcY
|
||
.DA 320 SrcW
|
||
.DA 40 SrcH
|
||
.BS 2 SrcPtr
|
||
.DA 0 DstPtr
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DS.END .ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/gtest.s
|
||
ASM
|