From 57e4f621e28e31bd08cdc14639dca148cdcf96d8 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Thu, 6 Oct 2016 09:17:57 +1300 Subject: [PATCH] Working on getting initialization working again. --- src/forth.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/forth.jl b/src/forth.jl index 90fb3ae..f125707 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -1214,7 +1214,7 @@ INTERPRET_CFA = defWord("INTERPRET", LIT_CFA, 32, WORD_CFA, # Read next word from current input source - FAM_RO_CFA, FILE_OPEN, DROP_CFA, # Open the file named by this word. + FAM_RO_CFA, OPEN_FILE_CFA, DROP_CFA, # Open the file named by this word. DUP_CFA, SOURCE_ID_CFA, STORE_CFA, # Mark this as the current source @@ -1222,7 +1222,7 @@ INTERPRET_CFA = defWord("INTERPRET", INTERPRET_CFA, - BRANCH_CFA, -4] + BRANCH_CFA, -4]) ABORT_CFA = defWord("ABORT", @@ -1249,6 +1249,10 @@ end function run(;initialize=true) + # Start with IP pointing to first instruction of outer interpreter + pushRS(QUIT_CFA+1) + + # Load library files global initialized, initFileName if !initialized && initialize if initFileName != nothing @@ -1262,12 +1266,10 @@ function run(;initialize=true) end end - # Start with IP pointing to first instruction of outer interpreter - reg.IP = QUIT_CFA + 1 # Primitive processing loop. # Everyting else is simply a consequence of this loop! - jmp = NEXT + jmp = mem[EXIT_CFA] while jmp != 0 try #println("Entering prim $(getPrimName(jmp))") -- 2.20.1