A2osX/BIN/GTEST.S.txt
2020-09-05 15:38:04 +02:00

494 lines
9.3 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.

NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/gtest
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.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
lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.LOGO.SHOW
lda #S.CB.CMD.GETRECTBUFSIZE
sta CB.LOGO+S.CB.CMD
>LDYA L.CB.LOGO
jsr GFX.Write.YA
>SYSCALL NewStkObj
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 .99
tay
beq .80
.2 >SLEEP
bit bVBL
bpl .2
stz bVBL
lda #S.CB.OP.SET+S.CB.OP.COLOR+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
cmp #152
bne .7
.60 lda yDir
eor #$ff
sta yDir
bra .1
.7 sta CB.LOGO+S.CB.Y1
bra .1
.8 sec
sbc #1
bcc .60
sta CB.LOGO+S.CB.Y1
jmp .1
.80 >SYSCALL GetChar
lda CB.LOGO+S.CB.DstPtr
>SYSCALL FreeStkObj
.99 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
* >DEBUG
* >SYSCALL close
.8 clc
rts
*--------------------------------------
LoadResources >PUSHW L.FONTFILE
>PUSHBI O.RDONLY
>PUSHBI $CC Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .99
stx hFont
>PUSHW L.FONTFILEB
>PUSHBI O.RDONLY
>PUSHBI $CC Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .99
stx hFontB
>PUSHW L.MARILYNFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
.99 bcs .9
stx CB.PIX+S.CB.SrcPtr
>PUSHW L.LOGOFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .9
stx CB.LOGO+S.CB.SrcPtr
>PUSHW L.PALETTEFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .9
stx CB.PALETTE+S.CB.SrcPtr
.9 rts
*--------------------------------------
GFX.Open >PUSHBI 0
>LDYA L.DEVNAME.GFX
>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}sbin/sysx7"
FONTFILEB .AZ "${ROOT}sbin/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.BITBLT
.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+320 X2 For GETRECTBUFSIZE
.DA 50+40 XZ 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