From fa91704ef9a5fdb699c015c69879f5f2099b06f8 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sun, 16 May 2021 08:46:03 +0100 Subject: [PATCH] Prevented infinite loop when asma's output is empty --- projects/software/asma.usm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/software/asma.usm b/projects/software/asma.usm index 7974c32..8421041 100644 --- 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