From 83a89e9e9793e18d26f9d8e67ab6385d31256346 Mon Sep 17 00:00:00 2001
From: Ralph Ronnquist <ralph.ronnquist@gmail.com>
Date: Tue, 8 Jun 2021 16:23:39 +1000
Subject: [PATCH] abort loading files on error

---
 rrqforth.asm | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/rrqforth.asm b/rrqforth.asm
index 5187c90..18009d4 100644
--- a/rrqforth.asm
+++ b/rrqforth.asm
@@ -272,7 +272,10 @@ p_process_args_loop:
 	je p_process_args_loop
 	push rax
 	push rax
-	DOFORTH p_strlen, p_load_file, p_drop
+	FORTH
+	dq p_strlen, p_load_file
+	BRANCH 0, p_quit_ERROR
+	ENDFORTH
 	jmp p_process_args_loop
 p_process_args_done:
 	popr rsi
@@ -296,26 +299,19 @@ last_forth_word:
 p_quit_INITIALIZED:
 	;; Setup INPUT from STDIN
 	FORTH
-	dq p_verboseQ
-	dq p_get
+	dq p_verboseQ, p_get
 	BRANCH 0,p_quit_EVAL
-	dq p_program_version
-	dq p_tell
+	dq p_program_version, p_tell
 p_quit_EVAL:
 	dq p_stdin, p_evaluate_stream
 	BRANCH 0,p_quit_ERROR
-	dq p_false
-	dq sys_exit
+	dq p_false, sys_exit
 p_quit_ERROR:
 	dq p_literal_string
 	STRING 10,'*** Unknown word: '
 	dq p_tell
-	dq p_this_word
-	dq p_2get
-	dq p_tell
-	dq p_literal_string
-	STRING 10
-	dq p_tell
+	dq p_this_word, p_2get, p_tell
+	dq p_nl, p_emit
 	ENDFORTH
 	mov rbp,RS_TOP		; reset the return stack
 	jmp p_quit_INITIALIZED
-- 
2.39.5