(screen.tal) Improved screen testing rom

This commit is contained in:
Devine Lu Linvega 2023-04-14 19:51:05 -07:00
parent c7203de2ea
commit 25cc4a1329
3 changed files with 72 additions and 32 deletions

View File

@ -137,6 +137,7 @@ JMP2r
POP2
INC GTHk ?&horver
POP2
( ver lines )
[ LIT2 02 -Screen/auto ] DEO
;ver-icn .Screen/addr DEO2

View File

@ -3,6 +3,7 @@
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|0000
@ -24,10 +25,10 @@
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( draw )
;draw-size JSR2
;draw-sprites JSR2
;draw-1bpp JSR2
;draw-2bpp JSR2
draw-size
draw-sprites
draw-1bpp
draw-2bpp
BRK
@ -36,11 +37,24 @@ BRK
@on-frame ( -> )
( scroll background )
[ LIT2 &f $2 ] INC2k ,&f STR2
#01 SFT2
#001f AND2
#0040 SUB2
DUP2 .Screen/x DEO2
.Screen/y DEO2
;patt-icn draw-fill
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
;anim-chr #00 [ LIT &f $1 ] INCk ,&f STR
#02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2
#81 .Screen/sprite DEO
;anim-chr ,&f LDR2 #00ff AND2 #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2
#8f .Screen/sprite DEO
draw-size
draw-sprites
draw-1bpp
draw-2bpp
BRK
@ -54,13 +68,13 @@ BRK
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
;font-icn .Screen/addr DEO2
#f6 .Screen/auto DEO
#01 .Screen/sprite DEO
#05 .Screen/sprite DEO
( vertical )
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2
.center/y LDZ2 #0038 SUB2 .Screen/y DEO2
;font-icn .Screen/addr DEO2
#f5 .Screen/auto DEO
#01 .Screen/sprite DEO
#05 .Screen/sprite DEO
( table )
#00 .Screen/auto DEO
;preview-chr .Screen/addr DEO2
@ -71,7 +85,7 @@ BRK
( move ) #00 OVR #f0 AND #01 SFT
.center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2
( draw ) DUP .Screen/sprite DEO
INC DUP ,&loop JCN
INC DUP ?&loop
POP
JMP2r
@ -85,8 +99,8 @@ JMP2r
.center/y LDZ2 #0038 SUB2 ADD2 STH2
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2
.center/x LDZ2 #0010 SUB2 ADD2
STH2r STHr #00 ,draw-circle JSR
INC GTHk ,&loop JCN
STH2r STHr #00 draw-circle
INC GTHk ?&loop
POP2
JMP2r
@ -100,8 +114,8 @@ JMP2r
.center/y LDZ2 #0008 ADD2 ADD2 STH2
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2
.center/x LDZ2 #0010 SUB2 ADD2
STH2r STHr #80 ,draw-circle JSR
INC GTHk ,&loop JCN
STH2r STHr #80 draw-circle
INC GTHk ?&loop
POP2
JMP2r
@ -123,12 +137,33 @@ JMP2r
JMP2r
@draw-fill ( patt* color -- )
.Screen/addr DEO2
[ LIT2 01 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2
.Screen/width DEI2 #03 SFT2 NIP #08 ADD ,&x STR
.Screen/height DEI2 #03 SFT2 NIP #08 ADD #00
&h
DUP #02 SFT STH
[ LIT &x $1 ] #00
&w
DUP #02 SFT STHkr ADD #01 AND .Screen/sprite DEO
INC GTHk ?&w
.Screen/y DEI2k #0008 ADD2 ROT DEO2
[ LIT2 &anchor $2 ] .Screen/x DEO2
POP2 POPr
INC GTHk ?&h
POP2
JMP2r
@draw-size ( -- )
#01 .Screen/auto DEO
.center/x LDZ2 #0030 ADD2 .Screen/x DEO2
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
.Screen/width DEI2 ;draw-dec JSR2
.Screen/width DEI2 draw-dec
;x-icn .Screen/addr DEO2
#01 .Screen/sprite DEO
.Screen/height DEI2
@ -136,13 +171,13 @@ JMP2r
@draw-dec ( short* -- )
#00 ,&z STR
#2710 ,&parse JSR
#03e8 ,&parse JSR
#0064 ,&parse JSR
#000a ,&parse JSR
#2710 draw-dec/parse
#03e8 draw-dec/parse
#0064 draw-dec/parse
#000a draw-dec/parse
NIP
&emit
DUP [ LIT &z $1 ] EQU ,&skip JCN
DUP [ LIT &z $1 ] EQU ?&skip
#ff ,&z STR #00 OVR #30 SFT ;font-icn ADD2 .Screen/addr DEO2
#01 .Screen/sprite DEO
&skip
@ -154,6 +189,8 @@ JMP2r
(
@|assets )
@patt-icn [
aa55 aa55 aa55 aa55 ]
@x-icn [
0000 0018 1800 0000 ]
@preview-chr [
@ -168,9 +205,13 @@ JMP2r
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 [
@anim-chr [
0000 0018 1800 0000 c381 0000 0000 81c3 0000 183c 3c18 0000 0000 0000 0000 0000
0018 3c7e 7e3c 1800 0000 0000 0000 0000 3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000
ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800
c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c 0000 0000 0000 0000 ffff e7c3 c3e7 ffff
0000 0018 1800 0000 c381 0000 0000 81c3
0000 183c 3c18 0000 0000 0000 0000 0000
0018 3c7e 7e3c 1800 0000 0000 0000 0000
3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000
ffff e7c3 c3e7 ffff 0000 183c 3c18 0000
ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800
c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c
0000 0000 0000 0000 ffff e7c3 c3e7 ffff
0000 0000 0000 0000 ffe7 c381 81c3 e7ff ]

View File

@ -37,8 +37,6 @@ static void
screen_blit(UxnScreen *s, Uint8 *pixels, Uint16 x1, Uint16 y1, Uint8 *ram, Uint16 addr, Uint8 color, Uint8 flipx, Uint8 flipy, Uint8 twobpp)
{
int v, h, width = s->width, height = s->height, opaque = (color % 5) || !color;
if(!color)
return screen_fill(s, pixels, x1, y1, x1 + 8, y1 + 8, 0);
for(v = 0; v < 8; v++) {
Uint16 c = ram[(addr + v) & 0xffff] | (twobpp ? (ram[(addr + v + 8) & 0xffff] << 8) : 0);
Uint16 y = y1 + (flipy ? 7 - v : v);