Browse code

Prevented infinite loop when asma's output is empty

Andrew Alderwick authored on 16/05/2021 07:46:03
Showing 1 changed files
... ...
@@ -46,12 +46,17 @@
46 46
 		DEO2 instruction to 0x00ff. In order to execute File/load and have the
47 47
 		CPU continue at memory location 0x0100, we write the final DEO2
48 48
 		instruction there and jump there as our final act.
49
+
50
+		Just in case the assembled code is zero-length (which can occur when
51
+		assembling an empty source file), we write a BRK to the reset vector so
52
+		that will prevent an infinite loop.
49 53
 	)
50 54
 	;&dest-file .File/name DEO2
51 55
 	#0000 .File/offset DEO2
52 56
 	#ff00 .File/length DEO2
53 57
 	#0100 .File/load
54 58
 	LIT DEO2 #00ff STA
59
+	LIT BRK #0100 STA
55 60
 	#00ff JMP2
56 61
 
57 62
 	&source-file