Adding string? primitive to stage2 lisp

This commit is contained in:
Jeremiah Orians 2017-07-30 21:01:09 -04:00
parent 157bec9609
commit 51c7c98a05
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
4 changed files with 34 additions and 2 deletions

View File

@ -39,6 +39,7 @@ Added Most primitive raw string support to stage2 lisp
Added integer->char and char->integer to stage2 lisp
Added string->list primitive to stage2 lisp
Added char? primitive to stage2 lisp
Added string? primitive to stage2 lisp
** Changed
Minor refactor of stage3 FORTH by reepa

View File

@ -152,7 +152,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/lisp --memory 48K
roms/lisp should have the sha256sum of 15fdc4c90e919ddd6d5c2660a2d3d9bd1589dfbc6559b82d91ab99a9c10d2d81
roms/lisp should have the sha256sum of ff5955ddee3e35bb1d7c11e0d3030f4ff4dcdcde5e87c3062b775c2dd5e9bb6b
Our lisp will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in.
It is recommended to run with no less than 4MB of Memory

View File

@ -1958,6 +1958,30 @@
RET R15
;; prim_stringp
;; Recieves argslist in R0
;; Returns #t if CHAR else NIL
:prim_stringp_String
"string?"
:prim_stringp
CMPSKIPI.NE R0 $NIL ; If NIL Expression
RET R15 ; Just get the Hell out
LOAD32 R0 R0 4 ; Get ARGS->CAR
LOAD32 R0 R0 0 ; Get ARGS->CAR->TYPE
CMPSKIPI.NE R0 256 ; If CHAR
JUMP @prim_stringp_0 ; Return TEE
LOADUI R0 $NIL ; Otherwise return NIL
JUMP @prim_stringp_done
:prim_stringp_0
LOADUI R0 $TEE ; Make TEE
:prim_stringp_done
RET R15
;; prim_output
;; Recieves argslist in R0
;; Outputs to whatever is specified in R12 and returns TEE
@ -2645,6 +2669,13 @@
CALLI R15 @make_sym ; MAKE_SYM
CALLI R15 @spinup ; SPINUP
LOADUI R0 $prim_stringp ; Using PRIM_STRINGP
CALLI R15 @make_prim ; MAKE_PRIM
MOVE R1 R0 ; Put Primitive in correct location
LOADUI R0 $prim_stringp_String ; Using PRIM_STRINGP_STRING
CALLI R15 @make_sym ; MAKE_SYM
CALLI R15 @spinup ; SPINUP
LOADUI R0 $prim_display ; Using PRIM_DISPLAY
CALLI R15 @make_prim ; MAKE_PRIM
MOVE R1 R0 ; Put Primitive in correct location

View File

@ -1,7 +1,7 @@
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
d7967248be71937d4fa1f38319a5a8473a842b1f6806b977e5fb184565bde0a4 roms/forth
15fdc4c90e919ddd6d5c2660a2d3d9bd1589dfbc6559b82d91ab99a9c10d2d81 roms/lisp
ff5955ddee3e35bb1d7c11e0d3030f4ff4dcdcde5e87c3062b775c2dd5e9bb6b roms/lisp
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET
0a427b14020354d1c785f5f900677e0059fce8f8d4456e9c19e5528cb17101eb roms/stage0_monitor