Implementing LSHIFT and RSHIFT per request

This commit is contained in:
Jeremiah Orians 2017-06-24 08:49:08 -04:00
parent 37b061defc
commit a51c243088
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
4 changed files with 32 additions and 3 deletions

View File

@ -29,6 +29,7 @@ Added region-comment "(" (note that it doesn't nest) to stage3 FORTH
Added hex dump printer DUMP and support words to stage3 FORTH Added hex dump printer DUMP and support words to stage3 FORTH
Added DOES> and supporting words, and used it to make VARIABLE, CONSTANT, and DEFER in stage3 FORTH Added DOES> and supporting words, and used it to make VARIABLE, CONSTANT, and DEFER in stage3 FORTH
Added TUCK, MIN, SPACES, :NONAME, FILL, and <> to stage3 FORTH Added TUCK, MIN, SPACES, :NONAME, FILL, and <> to stage3 FORTH
Added LSHIFT and RSHIFT to stage2 FORTH
** Changed ** Changed
Minor refactor of stage3 FORTH by reepa Minor refactor of stage3 FORTH by reepa

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: 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 3b54a0248b79b18d7afdbaae8c61e3afd8d3519e394e4f87ae8fd2bef59cde43 roms/forth should with the sha256sum of 53619f77736729edc06b79d27d835ada6a4235954c467dd0514e312ec4acf3dc
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)

View File

@ -379,11 +379,39 @@
PUSHR R0 R14 ; Store the result PUSHR R0 R14 ; Store the result
JSR_COROUTINE R11 ; NEXT JSR_COROUTINE R11 ; NEXT
:LSHIFT_Text
"LSHIFT"
:LSHIFT_Entry
&MOD_Entry ; Pointer to %
&LSHIFT_Text ; Pointer to Name
NOP ; Flags
&LSHIFT_Code ; Where assembly is Stored
:LSHIFT_Code
POPR R0 R14 ; Get top of stack
POPR R1 R14 ; Get second item on Stack
SAL R0 R1 R0 ; Left Shift
PUSHR R0 R14 ; Store the result
JSR_COROUTINE R11 ; NEXT
:RSHIFT_Text
"RSHIFT"
:RSHIFT_Entry
&LSHIFT_Entry ; Pointer to LSHIFT
&RSHIFT_Text ; Pointer to Name
NOP ; Flags
&RSHIFT_Code ; Where assembly is Stored
:RSHIFT_Code
POPR R0 R14 ; Get top of stack
POPR R1 R14 ; Get second item on Stack
SAR R0 R1 R0 ; Left Shift
PUSHR R0 R14 ; Store the result
JSR_COROUTINE R11 ; NEXT
;; = ;; =
:Equal_Text :Equal_Text
"=" "="
:Equal_Entry :Equal_Entry
&MOD_Entry ; Pointer to % &RSHIFT_Entry ; Pointer to RSHIFT
&Equal_Text ; Pointer to Name &Equal_Text ; Pointer to Name
NOP ; Flags NOP ; Flags
&Equal_Code ; Where assembly is Stored &Equal_Code ; Where assembly is Stored

View File

@ -1,6 +1,6 @@
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT 8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX 59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
3b54a0248b79b18d7afdbaae8c61e3afd8d3519e394e4f87ae8fd2bef59cde43 roms/forth 53619f77736729edc06b79d27d835ada6a4235954c467dd0514e312ec4acf3dc roms/forth
4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp 4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0 2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET 24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET