Fix bug with certain words not being found
diff --git a/BUGS.TXT b/BUGS.TXT
deleted file mode 100644
index e1fb972..0000000
--- a/BUGS.TXT
+++ /dev/null
@@ -1,14 +0,0 @@
-!! BUGS !!
-
-- For some reason, if the word `IMMEDIATE' is defined in DICTNRY.ASM,
- it shows up in `WORDS' but cannot actually be invoked. If it is
- shortened to `IMMED' it works fine, same if it's called
- `IMMEDIAT'. However, `IMMEDIATX' doesn't work. But if it's named
- something random like `123456789' it works. Also, other words 9
- characters long work fine! This is really weird. Moving the
- definition of `IMMEDIATE' to a different location in the binary
- (padding it from the start) doesn't solve the problem.
-
- Update: This seems to affect a whole lot of words, including
- `>CFA'. Can't seem to find a pattern between them, e.g. `>DFA' works
- fine.
diff --git a/CORE.F b/CORE.F
index b844633..10ab1f6 100644
--- a/CORE.F
+++ b/CORE.F
@@ -4,21 +4,21 @@
: / /MOD NIP ;
: MOD /MOD DROP ;
-: LITERAL IMMED ' LIT , , ;
-: [COMPILE] IMMED WORD FIND >CFA , ;
-: RECURSE IMMED LATEST , >CFA , ;
+: LITERAL IMMEDIATE ' LIT , , ;
+: [COMPILE] IMMEDIATE WORD FIND >CFA , ;
+: RECURSE IMMEDIATE LATEST , >CFA , ;
\ Control structures
\ cond IF <*b0> true ELSE false THEN rest
-: IF ( -- *then ) IMMED ' 0BRANCH , HERE @ 0 , ;
+: IF ( -- *then ) IMMEDIATE ' 0BRANCH , HERE @ 0 , ;
-: THEN ( *then -- *then ) IMMED
+: THEN ( *then -- *then ) IMMEDIATE
DUP HERE @ SWAP ( *then *then *here )
SWAP - ( *then *here-*then )
SWAP ! ;
-: ELSE ( *then -- *here ) IMMED
+: ELSE ( *then -- *here ) IMMEDIATE
' BRANCH ,
HERE @ ( *then *ph )
0 ,
@@ -28,5 +28,8 @@
SWAP - ( *ph *then diff )
SWAP ! ( *ph ) ;
+IMG-DUMPED
+
DUMP-IMAGE FORTH.COM
+
BYE
diff --git a/DICTNRY.ASM b/DICTNRY.ASM
index bc9689e..08a5dbf 100644
--- a/DICTNRY.ASM
+++ b/DICTNRY.ASM
@@ -10,7 +10,9 @@
;; BX and DI are clobbered
PUSH BX
PUSH DI
+ PUSH CX
CALL WORD_MATCHES
+ POP CX
POP DI
POP BX
@@ -187,7 +189,7 @@
NEXT
- DEFWORD_RAW_IMMEDIATE IMMEDIATE, 'IMMED'
+ DEFWORD_RAW_IMMEDIATE IMMEDIATE, 'IMMEDIATE'
MOV BX, [VAR_LATEST]
XOR BYTE [BX + 2], IMMEDIATE_BIT
NEXT
@@ -281,9 +283,6 @@
.NUM: ; ( addr len 0 )
DW DROP ; ( addr len )
- INCLUDE_STRING 'Parsing as a number'
- DW TYPE, CR
- DW _2DUP, TYPE, CR
DW NUMBER ; ( number unparsed )
DW ZEROBRANCH ; ( number )
RELATIVE_ADDRESS .NUMOK
diff --git a/FORTH.ASM b/FORTH.ASM
index 53bae75..de10e86 100644
--- a/FORTH.ASM
+++ b/FORTH.ASM
@@ -188,9 +188,19 @@
DEFWORD_RAW BYE, 'BYE'
+ MOV DX, .BYE_MSG
+ WRITESOUT
FLUSH
QUIT_PROC
+.BYE_MSG:
+ DB 'Bye!', 0Dh, 0Ah, '$'
+
+
+ DEFWORD_THREADED IMG_DUMPED, 'IMG-DUMPED'
+ INCLUDE_STRING 'Image dumped!'
+ DW TYPE, CR, EXIT
+
DEFWORD_RAW LIT, 'LIT'
LODSW ; Read next word from input to AX