@@ 535,7 535,15 @@ impl ForthCompiler {
self.asm.label("error");
let question = self.asm.reference_label("question");
self.asm.load(R0, question);
- self.asm.out_char().out_char();
+ self.out_char().out_char();
+ self.asm
+ .zero(R0)
+ .add(R0, R0, AddMode::Immediate('\n' as Word));
+ self.out_char();
+
+ // Restart
+ let start = self.asm.reference_label("start");
+ self.asm.branch_unconditionally(start);
self
}
@@ 563,8 571,7 @@ impl ForthCompiler {
}
pub fn compile(&mut self) -> Result<&mut Self> {
- self.error()
- .start()
+ self.start()
.interpret_loop()
.parse_words()
.read_input()
@@ 574,6 581,7 @@ impl ForthCompiler {
.load_intermediate_cells()
// .print_tib()?
.halt()
+ .error()
.assemble()?;
// eprintln!("{:?}", self.asm.instructions);