Build FORTH.COM from CORE.F
diff --git a/.gitignore b/.gitignore
index 1c5e908..232d630 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.html
*.COM
+*.exe
diff --git a/BUILD.BAT b/BUILD.BAT
new file mode 100644
index 0000000..9598776
--- /dev/null
+++ b/BUILD.BAT
@@ -0,0 +1,6 @@
+@echo off
+echo [ ASM ] Assembling BASE.COM
+NASM FORTH.ASM -o BASE.COM -fbin
+echo [FORTH] Bootstrapping CORE.COM
+BASE < CORE.F
+echo [ OK ] CORE.COM
diff --git a/CORE.F b/CORE.F
index 67607a1..a965968 100644
--- a/CORE.F
+++ b/CORE.F
@@ -1,6 +1,6 @@
\ Core words for DOS FORTH
-: / /MOD SWAP DROP ;
-: A 10 ;
+: NIP SWAP DROP ;
-A . BYE
+DUMP-IMAGE FORTH.COM
+BYE
diff --git a/DICTNRY.ASM b/DICTNRY.ASM
index c7edce4..d180f8d 100644
--- a/DICTNRY.ASM
+++ b/DICTNRY.ASM
@@ -264,13 +264,9 @@
DW COMMA ; Add to HERE
DW EXIT
-.WORD_COMPILE_IMMED: ; ( cfa )
- INCLUDE_STRING 'immediate bit set'
- DW TYPE, CR
- DW EXECUTE, EXIT
-
.WORD_IMMED: ; ( cfa immediate? )
DW DROP ; ( cfa )
+.WORD_COMPILE_IMMED:
DW EXECUTE ; ( )
DW EXIT
diff --git a/FORTH.ASM b/FORTH.ASM
index 5dd77a7..8d8dc28 100644
--- a/FORTH.ASM
+++ b/FORTH.ASM
@@ -162,7 +162,6 @@
INDIRECT_START:
DW SETUP
DW QUIT
- DW BYE
SETUP:
@@ -306,41 +305,6 @@
NEXT
- DEFWORD_RAW TEST_WRITE_FILE, 'TEST-WRITE-FILE'
- MOV AL, F_WRITE
- MOV DX, DUMP
- OPENF
- JC .OPEN
-
- MOV BX, AX ; Handle
- MOV CX, 4
- MOV DX, DUMP
- WRITEF
- JC .WRITE
-
- CLOSEF
- JC .CLOSE
-
- NEXT
-
-.OPEN:
- MOV DX, MSG_OPENF_FAILED
- WRITESOUT
- NEXT
-
-.WRITE:
- ;; 06h - invalid handle
- PUSH AX
- MOV DX, MSG_WRITEF_FAILED
- WRITESOUT
- NEXT
-
-.CLOSE:
- MOV DX, MSG_CLOSEF_FAILED
- WRITESOUT
- NEXT
-
-
%INCLUDE "IOWORDS.ASM"
%INCLUDE "DICTNRY.ASM"
@@ -364,13 +328,8 @@
;;; PROGRAM DATA ;;;
MSG DB 'DOS FORTH', 0Dh, 0Ah, '$'
- DUMP DB 'DUMP.COM', 0
- DUMP_LEN EQU 8
-
- MSG_CLOSEF_FAILED DB 'CLOSEF FAILED', 0Dh, 0Ah, '$'
- MSG_WRITEF_FAILED DB 'WRITEF FAILED', 0Dh, 0Ah, '$'
- ALIGN 4
;;; FREE DATA ;;;
+ ALIGN 4
HERE_START:
diff --git a/IOWORDS.ASM b/IOWORDS.ASM
index b938137..b040458 100644
--- a/IOWORDS.ASM
+++ b/IOWORDS.ASM
@@ -70,9 +70,12 @@
.COMMENT:
CALL READ_KEY
- CMP AL, ASCII_RETURN
- JNE .COMMENT
+ CMP AL, ASCII_NEWLINE
JE .START
+ CMP AL, ASCII_RETURN
+ JE .START
+
+ JMP .COMMENT
.DONE:
SUB DI, WORD_BUFFER ; Length
diff --git a/Makefile b/Makefile
index b296c5d..40b7bb1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,11 @@
-FORTH.COM: FORTH.ASM DOS.ASM IOWORDS.ASM DICTNRY.ASM
+BASE.COM: FORTH.ASM DOS.ASM IOWORDS.ASM DICTNRY.ASM
nasm $< -fbin -o$@
-run: FORTH.COM
+FORTH.COM: BASE.COM CORE.F BUILD.BAT
+ dosbox BUILD.BAT
+
+run: BASE.COM
dosbox $^
+
+size: BASE.COM
+ @ls -al $^ | awk '{ print $$5 }'