Incorporated requested function into stage2 forth

This commit is contained in:
Jeremiah Orians 2017-06-14 23:07:50 -04:00
parent 37fc186cbc
commit 54f4019767
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
4 changed files with 27 additions and 10 deletions

View File

@ -18,6 +18,7 @@
** Added
Incorporated High level prototypes into makefile
Added logic to catch non-existent input files and report a useful error message
Added DP! to stage2 forth
** Changed
Extended VPATH in makefile to shorten dependency names

View File

@ -174,7 +174,7 @@ Then we use our M0 Line macro assembler to convert our assembly into hex2 format
Then we need to assemble that hex into our desired program:
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/forth --memory 48K
roms/forth should with the sha256sum of 2328f09db939a69cbd244293d6131060c95e253ffe1212aae43890fdfd263a42
roms/forth should with the sha256sum of 110dfd9cf2187ed8bf68a07510f054d96a55ec26377fe9d3a8e1f44ced2313f4
Our forth will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in
(Otherwise there is no way for a forth fan to have a chance against the lisp in terms of being able to bootstrap something cool)

View File

@ -699,13 +699,25 @@
PUSHR R8 R14 ; Put HERE onto stack
JSR_COROUTINE R11 ; NEXT
;; UPDATE_HERE
:Update_Here_Text
"DP!"
:Update_Here_Entry
&Here_Entry ; Pointer to HERE
&Update_Here_Text ; Pointer to Name
NOP ; Flags
&Update_Here_Code ; Where assembly is Stored
:Update_Here_Code
POPR R8 R14 ; Pop STACK onto HERE
JSR_COROUTINE R11 ; NEXT
;; Return Stack functions
;; >R
:TOR_Text
">R"
:TOR_Entry
&Here_Entry ; Pointer to HERE
&Update_Here_Entry ; Pointer to UPDATE_HERE
&TOR_Text ; Pointer to Name
NOP ; Flags
&TOR_Code ; Where assembly is Stored
@ -1087,13 +1099,17 @@
NOP ; Flags
&Create_Code ; Where assembly is Stored
:Create_Code
COPY R0 R8 ; Preserve HERE for next LATEST
PUSHR R9 R8 ; Store LATEST onto HEAP
POPR R1 R14 ; Get pointer to string
PUSHR R1 R8 ; Store string pointer onto HEAP
FALSE R1 ; Prepare NOP for Flag
PUSHR R1 R8 ; Push NOP Flag
MOVE R0 R9 ; Set LATEST
POPR R0 R14 ; Get Length
POPR R1 R14 ; Get Pointer
FALSE R2 ; Set to Zero
CMPJUMPI.LE R0 R2 @Create_Code_1 ; Prevent size below 1
:Create_Code_0
LOAD8 R2 R1 0 ; Read Byte
STORE8 R2 R8 0 ; Write at HERE
ADDUI R8 R8 1 ; Increment HERE
SUBUI R0 R0 1 ; Decrement Length
JUMP.NZ R0 @Create_Code_0 ; Keep Looping
:Create_Code_1
JSR_COROUTINE R11 ; NEXT
;; DEFINE

View File

@ -1,6 +1,6 @@
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
2328f09db939a69cbd244293d6131060c95e253ffe1212aae43890fdfd263a42 roms/forth
110dfd9cf2187ed8bf68a07510f054d96a55ec26377fe9d3a8e1f44ced2313f4 roms/forth
4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET