Browse code

Clear screen when ROM is loaded.

Andrew Alderwick authored on 22/09/2021 15:41:25
Showing 2 changed files
... ...
@@ -4,11 +4,10 @@
4 4
 	and has non-zero length, this function does not return, because the new ROM
5 5
 	is executing in its place.
6 6
 
7
-	Both stacks are cleared and all the device vectors are written to zero as a
8
-	convenience, but the screen is not cleared. All ROMs that use the screen
9
-	define the palette (usually in the reset vector) so that should clear the
10
-	screen anyway. All other device bytes are left untouched, so they could
11
-	introduce a device state to the next ROM that it's not expecting.
7
+	The screen and both stacks are cleared and all the device vectors are
8
+	written to zero as a convenience. All other device bytes are left
9
+	untouched, so they could introduce a device state to the next ROM that
10
+	it's not expecting.
12 11
 )
13 12
 
14 13
 	.File/name DEO2
... ...
@@ -32,6 +31,31 @@
32 31
 	POPr
33 32
 	.System/rst DEI ,&rst-loop JCN
34 33
 
34
+	( clear screen )
35
+	#01 .Screen/auto DEO
36
+	#0000 .Screen/y DEO2
37
+	.Screen/width DEI2 #0007 ADD2 #03 SFT2 #ffff MUL2 STH2
38
+	&screen-yloop
39
+		#0000 .Screen/x DEO2
40
+		STH2kr
41
+		&screen-xloop-bg
42
+			#00 .Screen/sprite DEO
43
+			INC2
44
+			ORAk ,&screen-xloop-bg JCN
45
+		POP2
46
+		#0000 .Screen/x DEO2
47
+		STH2kr
48
+		&screen-xloop-fg
49
+			#40 .Screen/sprite DEO
50
+			INC2
51
+			ORAk ,&screen-xloop-fg JCN
52
+		POP2
53
+		.Screen/y DEI2 #0008 ADD2
54
+		DUP2 .Screen/y DEO2
55
+		.Screen/height DEI2 LTH2 ,&screen-yloop JCN
56
+	POP2r
57
+	#00 .Screen/auto DEO
58
+
35 59
 	( reset device vectors )
36 60
 	LIT2r 0000 #00
37 61
 	&device-vector-loop
... ...
@@ -19,7 +19,7 @@
19 19
 
20 20
 |00 @System     [ &vector $2 &wst      $1 &rst    $1 &pad   $4 &r      $2 &g      $2 &b    $2 &debug  $1 &halt $1 ]
21 21
 |10 @Console    [ &vector $2 &read     $1 &pad    $5 &write $1 &error  $1 ]
22
-|20 @Screen  &vector $2 &width   $2 &height $2 &pad   $2 &x      $2 &y      $2 &addr $2 &pixel $1 &sprite $1
22
+|20 @Screen  &vector $2 &width   $2 &height $2 &auto $1 &pad $1 &x      $2 &y      $2 &addr $2 &pixel $1 &sprite $1
23 23
 |80 @Controller [ &vector $2 &button $1 &key    $1 ]
24 24
 |90 @Mouse      [ &vector $2 &x        $2 &y      $2 &state $1 &wheel  $1 ]
25 25
 |a0 @File    &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2