A2osX/BIN/GTEST.S.txt

482 lines
9.1 KiB
Plaintext
Raw Normal View History

2019-07-30 15:35:42 +00:00
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2020-07-01 05:48:31 +00:00
.TF bin/gtest
2019-07-30 15:35:42 +00:00
*--------------------------------------
2020-07-01 05:48:31 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/gfx.i
2019-07-30 15:35:42 +00:00
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
hDevGFX .BS 1
hFont .BS 1
2019-08-06 07:14:22 +00:00
hFontB .BS 1
2020-07-04 19:00:47 +00:00
bVBL .BS 1
xDir .BS 1
yDir .BS 1
2019-07-30 15:35:42 +00:00
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
2020-07-04 19:00:47 +00:00
.DA #S.PS.F.EVENT S.PS.F
2019-07-30 15:35:42 +00:00
.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
2019-08-06 15:58:01 +00:00
L.FONTFILEB .DA FONTFILEB
2020-07-23 10:18:11 +00:00
L.MARILYNFILE .DA MARILYNFILE
2020-07-02 14:14:30 +00:00
L.LOGOFILE .DA LOGOFILE
2020-07-03 20:55:40 +00:00
L.PALETTEFILE .DA PALETTEFILE
2019-07-30 15:35:42 +00:00
L.CB.RECT .DA CB.RECT
2020-07-03 20:55:40 +00:00
L.CB.RECT2 .DA CB.RECT2
2019-08-06 15:58:01 +00:00
L.CB.TEXTB .DA CB.TEXTB
2019-07-30 15:35:42 +00:00
L.CB.TEXT .DA CB.TEXT
2019-08-06 07:14:22 +00:00
L.CB.PIX .DA CB.PIX
2020-07-02 14:14:30 +00:00
L.CB.LOGO .DA CB.LOGO
2020-07-03 20:55:40 +00:00
L.CB.PALETTE .DA CB.PALETTE
2019-07-30 15:35:42 +00:00
L.CB.Apple .DA CB.Apple
L.BM.Apple .DA BM.Apple
2019-08-06 15:58:01 +00:00
L.MESSAGEB .DA MESSAGEB
2019-07-30 15:35:42 +00:00
L.MESSAGE .DA MESSAGE
.DA 0
*--------------------------------------
CS.INIT clc
2020-07-02 14:14:30 +00:00
CS.INIT.RTS rts
2019-07-30 15:35:42 +00:00
*--------------------------------------
CS.RUN jsr GFX.Open
2020-07-02 14:14:30 +00:00
bcs CS.INIT.RTS
2020-07-02 06:11:15 +00:00
2019-08-06 15:58:01 +00:00
jsr LoadResources
2020-07-02 14:14:30 +00:00
bcs CS.INIT.RTS
2020-07-02 06:11:15 +00:00
2019-07-30 15:35:42 +00:00
>LDYA L.CB.RECT
jsr GFX.Write.YA
2020-07-03 20:55:40 +00:00
.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
2019-08-06 07:14:22 +00:00
jsr GFX.Write.YA
2020-07-03 20:55:40 +00:00
>LDYA L.CB.PALETTE
jsr GFX.Write.YA
2020-07-02 14:14:30 +00:00
>LDYA L.BM.Apple
>STYA CB.Apple+S.CB.SrcPtr
2019-07-30 15:35:42 +00:00
>LDYA L.CB.Apple
jsr GFX.Write.YA
2020-07-01 05:48:31 +00:00
2019-08-06 15:58:01 +00:00
lda hFontB
sta CB.TEXTB+S.CB.hFont
>LDYA L.MESSAGEB
>STYA CB.TEXTB+S.CB.TxtPtr
2020-07-02 14:14:30 +00:00
2019-08-06 15:58:01 +00:00
>LDYA L.CB.TEXTB
2020-07-02 06:11:15 +00:00
jsr GFX.Write.YA
2019-08-06 15:58:01 +00:00
bcs .9
>LDYA L.CB.TEXTB
jsr GFX.Write.YA
2019-08-06 07:14:22 +00:00
lda hFont
sta CB.TEXT+S.CB.hFont
2019-08-06 15:58:01 +00:00
2019-08-06 07:14:22 +00:00
>LDYA L.MESSAGE
>STYA CB.TEXT+S.CB.TxtPtr
2019-08-06 15:58:01 +00:00
2019-08-06 07:14:22 +00:00
>LDYA L.CB.TEXT
2020-07-02 06:11:15 +00:00
jsr GFX.Write.YA
2019-08-06 07:14:22 +00:00
bcs .9
>LDYA L.CB.TEXT
jsr GFX.Write.YA
2020-07-04 19:00:47 +00:00
jsr CS.RUN.LOGO.SHOW
2019-08-06 07:14:22 +00:00
2019-07-30 15:35:42 +00:00
lda #0
sec
.9 rts
*--------------------------------------
2020-07-04 19:00:47 +00:00
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.DstX
clc
adc #4
tay
lda CB.LOGO+S.CB.DstX+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.DstX
sec
sbc #4
tay
lda CB.LOGO+S.CB.DstX+1
sbc #0
bcc .3
.5 sty CB.LOGO+S.CB.DstX
sta CB.LOGO+S.CB.DstX+1
.6 lda CB.LOGO+S.CB.DstY
bit yDIR
bmi .8
inc
cmp #152
bne .7
.60 lda yDIR
eor #$ff
sta yDIR
bra .1
.7 sta CB.LOGO+S.CB.DstY
bra .1
.8 sec
sbc #1
bcc .60
sta CB.LOGO+S.CB.DstY
jmp .1
.80 >SYSCALL GetChar
2020-07-04 21:15:38 +00:00
lda CB.LOGO+S.CB.DstPtr
>SYSCALL FreeStkObj
2020-07-04 19:00:47 +00:00
.99 rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9
sta bVBL
.9 sec never discard TIME event
2019-07-30 15:35:42 +00:00
rts
*--------------------------------------
CS.QUIT lda hFont
2019-08-02 14:36:49 +00:00
beq .1
2019-07-30 15:35:42 +00:00
>SYSCALL FreeStkObj
2020-07-02 14:14:30 +00:00
2019-08-06 07:14:22 +00:00
.1 lda hFontB
2019-08-06 15:58:01 +00:00
beq .2
2019-08-06 07:14:22 +00:00
>SYSCALL FreeStkObj
2020-07-02 14:14:30 +00:00
2019-08-06 15:58:01 +00:00
.2 lda CB.PIX+S.CB.SrcPtr
2019-08-06 07:14:22 +00:00
beq .3
2020-07-02 14:14:30 +00:00
>SYSCALL FreeStkObj
.3 lda CB.LOGO+S.CB.SrcPtr
beq .4
>SYSCALL FreeStkObj
2019-08-06 07:14:22 +00:00
2020-07-02 14:14:30 +00:00
.4 lda CB.TEXTB+S.CB.SrcPtr
beq .5
>SYSCALL FreeStkObj
.5 lda CB.TEXT+S.CB.SrcPtr
beq .6
2019-08-06 07:14:22 +00:00
>SYSCALL FreeStkObj
2020-07-04 21:15:38 +00:00
.6 lda CB.PALETTE+S.CB.SrcPtr
beq .7
>SYSCALL FreeStkObj
.7 lda hDevGFX
2019-08-06 07:14:22 +00:00
beq .8
2019-08-02 14:36:49 +00:00
* >DEBUG
* >SYSCALL close
2020-07-04 21:15:38 +00:00
.8 clc
2019-07-30 15:35:42 +00:00
rts
*--------------------------------------
2020-07-01 15:40:32 +00:00
LoadResources >PUSHW L.FONTFILE
2019-08-06 15:58:01 +00:00
>PUSHBI O.RDONLY
2020-07-01 15:40:32 +00:00
>PUSHBI $CC Type
>PUSHWZ Aux type
2019-08-06 15:58:01 +00:00
>SYSCALL LoadStkObj
2020-07-02 14:14:30 +00:00
bcs .99
2019-08-06 15:58:01 +00:00
stx hFont
2020-07-01 15:40:32 +00:00
>PUSHW L.FONTFILEB
2019-08-06 15:58:01 +00:00
>PUSHBI O.RDONLY
2020-07-01 15:40:32 +00:00
>PUSHBI $CC Type
>PUSHWZ Aux type
2019-08-06 15:58:01 +00:00
>SYSCALL LoadStkObj
2020-07-03 20:55:40 +00:00
bcs .99
2019-08-06 15:58:01 +00:00
stx hFontb
2020-07-23 10:18:11 +00:00
>PUSHW L.MARILYNFILE
2019-08-06 15:58:01 +00:00
>PUSHBI O.RDONLY
2020-07-01 15:40:32 +00:00
>PUSHBI $CB Type
>PUSHWZ Aux type
2019-08-06 15:58:01 +00:00
>SYSCALL LoadStkObj
2020-07-02 14:14:30 +00:00
.99 bcs .9
2019-08-06 15:58:01 +00:00
stx CB.PIX+S.CB.SrcPtr
2020-07-02 14:14:30 +00:00
>PUSHW L.LOGOFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .9
stx CB.LOGO+S.CB.SrcPtr
2020-07-03 20:55:40 +00:00
>PUSHW L.PALETTEFILE
>PUSHBI O.RDONLY
>PUSHBI $CB Type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .9
stx CB.PALETTE+S.CB.SrcPtr
2020-07-02 14:14:30 +00:00
2019-08-06 15:58:01 +00:00
.9 rts
*--------------------------------------
2019-07-30 15:35:42 +00:00
GFX.Open >PUSHBI 0
>LDYA L.DEVNAME.GFX
>SYSCALL open
bcs .9
sta hDevGFX
.9 rts
*--------------------------------------
2020-07-01 15:40:32 +00:00
GFX.Write.YA pha
>PUSHB hDevGFX
2019-07-30 15:35:42 +00:00
>PUSHBI IOCTL.WRITE
2020-07-01 15:40:32 +00:00
pla
>PUSHYA
2019-07-30 15:35:42 +00:00
>SYSCALL IOCTL
rts
*--------------------------------------
CS.END
2020-07-01 05:48:31 +00:00
DEVNAME.GFX .AZ "/dev/gfx"
FONTFILE .AZ "${ROOT}sbin/sysx7"
FONTFILEB .AZ "${ROOT}sbin/sysx7b"
2020-07-23 10:18:11 +00:00
MARILYNFILE .AZ "${ROOT}root/bmp/MARILYN"
2020-07-03 20:55:40 +00:00
*LOGOFILE .AZ "${ROOT}A2osX.logo"
2020-07-23 10:18:11 +00:00
LOGOFILE .AZ "${ROOT}root/bmp/A2OSX.LOGO"
PALETTEFILE .AZ "${ROOT}root/bmp/PALETTE"
2019-08-06 15:58:01 +00:00
MESSAGEB .AZ " DHGR Driver & OSD 'Off-Screen Driver' Test (SYSX7B Font, Inverse) "
2020-07-02 14:14:30 +00:00
MESSAGE .AZ " 1234567890 abcdefghijklmnopqrstuvwxyz { + - * / } (SYSX7 Font, Normal) "
2019-07-30 15:35:42 +00:00
CB.RECT .DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.M.C16
2020-07-04 19:00:47 +00:00
.DA #11 Color
2019-07-30 15:35:42 +00:00
.DA 20
.DA 10
.DA 540
.DA 182
2020-07-03 20:55:40 +00:00
CB.RECT2 .DA #S.CB.CMD.FILLRECT
.DA #S.CB.OP.SET
.DA #S.CB.M.C16
.DA #0 Color
2020-07-04 19:00:47 +00:00
.DA 60 X1
.DA 150 Y1
.DA 88 X2
.DA 180 Y2
2020-07-03 20:55:40 +00:00
2019-08-06 07:14:22 +00:00
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 0 X1
.DA 0 Y1
.DA 16 SrcW
.DA 7 SrcH
.DA 20 DstX
2020-07-04 19:00:47 +00:00
.DA 172 DstY
2019-08-06 07:14:22 +00:00
.BS 2 SrcPtr
2020-07-04 19:00:47 +00:00
.DA 0 DstPtr
2019-08-06 07:14:22 +00:00
CB.PIX .DA #S.CB.CMD.BITBLT
.DA #S.CB.OP.SET+S.CB.OP.COLOR
.DA #S.CB.M.MONO
.DA #0
.DA 10 X1
.DA 20 Y1
.DA 120 SrcW
.DA 100 SrcH
2020-07-04 19:00:47 +00:00
.DA 56 DstX
2020-07-03 20:55:40 +00:00
.DA 30 DstY
2019-08-06 07:14:22 +00:00
.BS 2 SrcPtr
2020-07-04 19:00:47 +00:00
.DA 0 DstPtr
2020-07-02 14:14:30 +00:00
2020-07-03 20:55:40 +00:00
CB.PALETTE .DA #S.CB.CMD.BITBLT
.DA #S.CB.OP.SET+S.CB.OP.COLOR
.DA #S.CB.M.C16
.DA #0
.DA 0 X1
.DA 0 Y1
.DA 320 SrcW
.DA 40 SrcH
.DA 200 DstX
.DA 100 DstY
.BS 2 SrcPtr
2020-07-04 19:00:47 +00:00
.DA 0 DstPtr
2020-07-03 20:55:40 +00:00
2020-07-02 06:11:15 +00:00
CB.TEXTB .DA #S.CB.CMD.DRAWTEXT+S.CB.CMD.OSD
2019-08-06 15:58:01 +00:00
.DA #S.CB.OP.SET+S.CB.OP.INVERSE
.DA #S.CB.M.MONO
.BS 1 hFONT
.DA 0 X1
.DA 0 Y1
.DA 0 X2
.DA 0 Y2
.DA 7 DstX
.DA 1 DstY
.BS 2 TXTPTR
2020-07-04 19:00:47 +00:00
.DA 0 DstPtr
2019-08-06 15:58:01 +00:00
2020-07-02 06:11:15 +00:00
CB.TEXT .DA #S.CB.CMD.DRAWTEXT+S.CB.CMD.OSD
2019-07-30 15:35:42 +00:00
.DA #S.CB.OP.SET
.DA #S.CB.M.MONO
.BS 1 hFONT
.DA 0 X1
.DA 0 Y1
.DA 0 X2
.DA 0 Y2
2019-08-06 15:58:01 +00:00
.DA 50 DstX
.DA 184 DstY
2019-07-30 15:35:42 +00:00
.BS 2 TXTPTR
2020-07-04 19:00:47 +00:00
.DA 0 DstPtr
2019-07-30 15:35:42 +00:00
*--------------------------------------
BM.Apple .DA #S.BM.F.BBP4
.DA #2 RowBytes
.DA 16 W
.DA 7 H
2019-08-06 07:14:22 +00:00
.DA BM.Apple.AND-BM.Apple
.HS 0006 green (8)
.HS 6006 green (8)
2019-07-30 15:35:42 +00:00
.HS EEEE yellow (15)
2019-08-06 07:14:22 +00:00
.HS CC0C orange (14)
2020-07-04 19:00:47 +00:00
.HS 9909 magenta (10)
.HS 8888 violet (11)
2019-08-06 07:14:22 +00:00
.HS 1001 Dark blue (4)
BM.Apple.AND .HS FFF0
.HS 0FF0
.HS 0000
.HS 00F0
.HS 00F0
.HS 0000
.HS 0FF0
2020-07-04 19:00:47 +00:00
*--------------------------------------
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 0 X1
.DA 0 Y1
.DA 320 SrcW
.DA 40 SrcH
.DA 200 DstX
.DA 50 DstY
.BS 2 SrcPtr
.DA 0 DstPtr
2019-07-30 15:35:42 +00:00
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END
.ED
*--------------------------------------
MAN
2020-07-01 05:48:31 +00:00
SAVE usr/src/bin/gtest.s
2019-07-30 15:35:42 +00:00
ASM