diff --git a/CHANGELOG.org b/CHANGELOG.org index 587f7d9..14479df 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -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 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 LSHIFT and RSHIFT to stage2 FORTH ** Changed Minor refactor of stage3 FORTH by reepa diff --git a/bootstrapping Steps.org b/bootstrapping Steps.org index d4b85bb..308087b 100644 --- a/bootstrapping Steps.org +++ b/bootstrapping Steps.org @@ -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 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 (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) diff --git a/stage2/forth.s b/stage2/forth.s index a0b28c1..0339a86 100644 --- a/stage2/forth.s +++ b/stage2/forth.s @@ -379,11 +379,39 @@ PUSHR R0 R14 ; Store the result 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_Entry - &MOD_Entry ; Pointer to % + &RSHIFT_Entry ; Pointer to RSHIFT &Equal_Text ; Pointer to Name NOP ; Flags &Equal_Code ; Where assembly is Stored diff --git a/test/SHA256SUMS b/test/SHA256SUMS index 81e1084..5e6b644 100644 --- a/test/SHA256SUMS +++ b/test/SHA256SUMS @@ -1,6 +1,6 @@ 8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT 59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX -3b54a0248b79b18d7afdbaae8c61e3afd8d3519e394e4f87ae8fd2bef59cde43 roms/forth +53619f77736729edc06b79d27d835ada6a4235954c467dd0514e312ec4acf3dc roms/forth 4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp 2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0 24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET