Clear screen when ROM is loaded.

This commit is contained in:
Andrew Alderwick 2021-09-22 16:41:25 +01:00
parent dd7401bc4c
commit 7fe99617b2
2 changed files with 30 additions and 6 deletions

View File

@ -4,11 +4,10 @@
and has non-zero length, this function does not return, because the new ROM
is executing in its place.
Both stacks are cleared and all the device vectors are written to zero as a
convenience, but the screen is not cleared. All ROMs that use the screen
define the palette (usually in the reset vector) so that should clear the
screen anyway. All other device bytes are left untouched, so they could
introduce a device state to the next ROM that it's not expecting.
The screen and both stacks are cleared and all the device vectors are
written to zero as a convenience. All other device bytes are left
untouched, so they could introduce a device state to the next ROM that
it's not expecting.
)
.File/name DEO2
@ -32,6 +31,31 @@
POPr
.System/rst DEI ,&rst-loop JCN
( clear screen )
#01 .Screen/auto DEO
#0000 .Screen/y DEO2
.Screen/width DEI2 #0007 ADD2 #03 SFT2 #ffff MUL2 STH2
&screen-yloop
#0000 .Screen/x DEO2
STH2kr
&screen-xloop-bg
#00 .Screen/sprite DEO
INC2
ORAk ,&screen-xloop-bg JCN
POP2
#0000 .Screen/x DEO2
STH2kr
&screen-xloop-fg
#40 .Screen/sprite DEO
INC2
ORAk ,&screen-xloop-fg JCN
POP2
.Screen/y DEI2 #0008 ADD2
DUP2 .Screen/y DEO2
.Screen/height DEI2 LTH2 ,&screen-yloop JCN
POP2r
#00 .Screen/auto DEO
( reset device vectors )
LIT2r 0000 #00
&device-vector-loop

View File

@ -19,7 +19,7 @@
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2