Added requested ABORT function to forth
This commit is contained in:
parent
8b0384b370
commit
c43171c7d2
|
@ -20,6 +20,7 @@ Incorporated High level prototypes into makefile
|
||||||
Added logic to catch non-existent input files and report a useful error message
|
Added logic to catch non-existent input files and report a useful error message
|
||||||
Added DP! to stage2 forth
|
Added DP! to stage2 forth
|
||||||
Added EXECUTE to stage2 forth
|
Added EXECUTE to stage2 forth
|
||||||
|
Added ABORT to stage2 forth
|
||||||
Added string print and address to output of High level prototype disassembler
|
Added string print and address to output of High level prototype disassembler
|
||||||
|
|
||||||
** Changed
|
** Changed
|
||||||
|
@ -34,6 +35,8 @@ Fixed 2DUP and ?DUP in stage2 forth
|
||||||
Swapped TRUE and FALSE values in stage2 forth to match http://lars.nocrew.org/dpans/dpans3.htm#3.1.3
|
Swapped TRUE and FALSE values in stage2 forth to match http://lars.nocrew.org/dpans/dpans3.htm#3.1.3
|
||||||
Adjusted order of comparisions to better match ans
|
Adjusted order of comparisions to better match ans
|
||||||
Stack leak in stage2 forth found and corrected
|
Stack leak in stage2 forth found and corrected
|
||||||
|
Stage2 forth no longer attempts to parse carriage returns
|
||||||
|
Stage2 forth now will display and error and clear the stacks in the event of an undefined input
|
||||||
|
|
||||||
** Removed
|
** Removed
|
||||||
Removed need for sponge to be used to run webIDE
|
Removed need for sponge to be used to run webIDE
|
||||||
|
|
|
@ -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:
|
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
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/forth --memory 48K
|
||||||
|
|
||||||
roms/forth should with the sha256sum of bfa6723d360439c9893951f1101e343b03369bf2267a820b8a1c80543595bf33
|
roms/forth should with the sha256sum of 17d8626f74004d39f38e7a69c8d30f16084ae5c191e3ad6a8292e5037447ab3e
|
||||||
|
|
||||||
Our forth will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in
|
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)
|
(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)
|
||||||
|
|
|
@ -870,6 +870,10 @@
|
||||||
|
|
||||||
:Word_Start
|
:Word_Start
|
||||||
FGETC ; Read a byte
|
FGETC ; Read a byte
|
||||||
|
|
||||||
|
CMPSKIPI.NE R0 13 ; If Carriage return
|
||||||
|
LOADUI R0 10 ; Convert to linefeed
|
||||||
|
|
||||||
CMPSKIPI.NE R1 0 ; Don't output unless TTY
|
CMPSKIPI.NE R1 0 ; Don't output unless TTY
|
||||||
FPUTC ; Make it visible
|
FPUTC ; Make it visible
|
||||||
CMPSKIPI.NE R0 9 ; If Tab
|
CMPSKIPI.NE R0 9 ; If Tab
|
||||||
|
@ -878,6 +882,10 @@
|
||||||
CMPSKIPI.NE R0 32 ; If space
|
CMPSKIPI.NE R0 32 ; If space
|
||||||
JUMP @Word_Start ; Get another byte
|
JUMP @Word_Start ; Get another byte
|
||||||
|
|
||||||
|
|
||||||
|
CMPSKIPI.NE R0 10 ; If Newline
|
||||||
|
JUMP @Word_Start ; Get another byte
|
||||||
|
|
||||||
:Word_Main
|
:Word_Main
|
||||||
CMPSKIPI.NE R0 4 ; If EOF
|
CMPSKIPI.NE R0 4 ; If EOF
|
||||||
JUMP @cold_done ; Stop processing
|
JUMP @cold_done ; Stop processing
|
||||||
|
@ -966,9 +974,9 @@
|
||||||
MUL R3 R3 R4 ; Shift counter by 10
|
MUL R3 R3 R4 ; Shift counter by 10
|
||||||
SUBI R0 R0 48 ; Convert ascii to number
|
SUBI R0 R0 48 ; Convert ascii to number
|
||||||
CMPSKIPI.GE R0 0 ; If less than a number
|
CMPSKIPI.GE R0 0 ; If less than a number
|
||||||
JUMP @numerate_string_done ; Terminate NOW
|
JUMP @ABORT_Code ; Dealing with an undefined symbol
|
||||||
CMPSKIPI.L R0 10 ; If more than a number
|
CMPSKIPI.L R0 10 ; If more than a number
|
||||||
JUMP @numerate_string_done ; Terminate NOW
|
JUMP @ABORT_Code ; Dealing with an undefined symbol
|
||||||
ADDU R3 R3 R0 ; Don't add to the count
|
ADDU R3 R3 R0 ; Don't add to the count
|
||||||
|
|
||||||
ADDUI R1 R1 1 ; Move onto next byte
|
ADDUI R1 R1 1 ; Move onto next byte
|
||||||
|
@ -1003,11 +1011,42 @@
|
||||||
PUSHR R3 R14 ; Store result
|
PUSHR R3 R14 ; Store result
|
||||||
RET R15 ; Return to whoever called it
|
RET R15 ; Return to whoever called it
|
||||||
|
|
||||||
|
;; ABORT
|
||||||
|
:ABORT_Text
|
||||||
|
"ABORT"
|
||||||
|
:ABORT_Entry
|
||||||
|
&Number_Entry ; Pointer to NUMBER
|
||||||
|
&ABORT_Text ; Pointer to Name
|
||||||
|
NOP ; Flags
|
||||||
|
&ABORT_Code ; Where assembly is Stored
|
||||||
|
:ABORT_Code
|
||||||
|
MOVE R2 R1 ; Protect the string pointer and set output to TTY
|
||||||
|
CALLI R15 @ABORT_PRINT ; Print our unknown
|
||||||
|
LOADUI R2 $ABORT_String ; Get our string
|
||||||
|
CALLI R15 @ABORT_PRINT ; Print it
|
||||||
|
LOADUI R0 10 ; NEWLINE
|
||||||
|
FPUTC ; Printed
|
||||||
|
LOADR R15 @RETURN_BASE ; Load Base of Return Stack
|
||||||
|
LOADR R14 @PARAMETER_BASE ; Load Base of Parameter Stack
|
||||||
|
LOADUI R13 $Cold_Start ; Intialize via QUIT
|
||||||
|
JSR_COROUTINE R11 ; NEXT
|
||||||
|
|
||||||
|
:ABORT_String
|
||||||
|
" was not defined nor a valid number"
|
||||||
|
|
||||||
|
:ABORT_PRINT
|
||||||
|
LOAD8 R0 R2 0 ; Get a byte
|
||||||
|
ADDUI R2 R2 1 ; Increment to next byte
|
||||||
|
CMPSKIPI.NE R0 0 ; If NULL
|
||||||
|
RET R15 ; Return to caller
|
||||||
|
FPUTC ; Write the CHAR
|
||||||
|
JUMP @ABORT_PRINT ; Loop until NULL
|
||||||
|
|
||||||
;; strcmp
|
;; strcmp
|
||||||
:Strcmp_Text
|
:Strcmp_Text
|
||||||
"STRCMP"
|
"STRCMP"
|
||||||
:Strcmp_Entry
|
:Strcmp_Entry
|
||||||
&Number_Entry ; Pointer to NUMBER
|
&ABORT_Entry ; Pointer to ABORT
|
||||||
&Strcmp_Text ; Pointer to Name
|
&Strcmp_Text ; Pointer to Name
|
||||||
NOP ; Flags
|
NOP ; Flags
|
||||||
&Strcmp_Code ; Where assembly is Stored
|
&Strcmp_Code ; Where assembly is Stored
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
|
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
|
||||||
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
|
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
|
||||||
bfa6723d360439c9893951f1101e343b03369bf2267a820b8a1c80543595bf33 roms/forth
|
17d8626f74004d39f38e7a69c8d30f16084ae5c191e3ad6a8292e5037447ab3e roms/forth
|
||||||
4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp
|
4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp
|
||||||
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
|
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
|
||||||
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET
|
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET
|
||||||
|
|
Loading…
Reference in New Issue