From 0b210d7754bd1f23368a586a70a8d12fba062c19 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Sun, 10 Nov 2019 10:58:47 -0800 Subject: [PATCH] halt. --- thun/compiler.markII.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/thun/compiler.markII.pl b/thun/compiler.markII.pl index 77838f4..af80bbf 100644 --- a/thun/compiler.markII.pl +++ b/thun/compiler.markII.pl @@ -77,13 +77,11 @@ Mark II label(Done), store_word(TOS, SP, 0), % RAM[SP] := TOS - do_offset(Main), + do_offset(Main) - label(HALT), % This is a HALT loop, the emulator detects and traps - do_offset(HALT) % on this "10 goto 10" instruction. + ],⟐([ -% ====================================== -],⟐([ + halt(HALT), % ====================================== definition(Cons), % Let's cons. @@ -147,6 +145,9 @@ language. ⟐(jump(To)) --> [do_offset(To)]. % Pass through. +⟐(halt(Halt)) --> [label(Halt), do_offset(Halt)]. +% This is a HALT loop, the emulator detects and traps on this "10 goto 10" instruction. + ⟐(incr(SP)) --> [sub_imm(SP, SP, 4)]. % SP -= 1 (word, not byte). ⟐(if_literal(TERM, Push, TEMP)) -->