commit fa91704ef9a5fdb699c015c69879f5f2099b06f8
parent 3b9519d945d8e9b8752efb97e9ce17e80078384e
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sun, 16 May 2021 08:46:03 +0100
Prevented infinite loop when asma's output is empty
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/projects/software/asma.usm b/projects/software/asma.usm
@@ -46,12 +46,17 @@
DEO2 instruction to 0x00ff. In order to execute File/load and have the
CPU continue at memory location 0x0100, we write the final DEO2
instruction there and jump there as our final act.
+
+ Just in case the assembled code is zero-length (which can occur when
+ assembling an empty source file), we write a BRK to the reset vector so
+ that will prevent an infinite loop.
)
;&dest-file .File/name DEO2
#0000 .File/offset DEO2
#ff00 .File/length DEO2
#0100 .File/load
LIT DEO2 #00ff STA
+ LIT BRK #0100 STA
#00ff JMP2
&source-file