Implemented NULL? into stage2 lisp and adjusted accordingly

This commit is contained in:
Jeremiah Orians 2017-05-29 22:36:22 -04:00
parent 9c9b810c89
commit f28b86d697
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
3 changed files with 25 additions and 1 deletions

View File

@ -19,6 +19,7 @@
Added HACKING guide covering critical sections Added HACKING guide covering critical sections
Added rom building steps to make Added rom building steps to make
Added more advanced cleaning options to makefile Added more advanced cleaning options to makefile
Extended stage2 lisp with null?
** Changed ** Changed
Cleaned up x86 notes and moved into x86 folder Cleaned up x86 notes and moved into x86 folder

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: 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 ./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/lisp --memory 48K
roms/lisp should have the sha256sum of d9bb13beced1c98daa4a62512ba35faa137f3ed6f23cdc1cdf724e25e8c6d80a roms/lisp should have the sha256sum of 3b09ddadc89f5afb9b6c73f1deb488d592500c3799f84b81d3976545b0d9ff46
Our lisp will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in. 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 It is recommended to run with no less than 4MB of Memory

View File

@ -1360,6 +1360,22 @@
RET R15 RET R15
;; nullp
;; Recieves a CELL in R0
;; Returns NIL if not NIL or TEE if NIL
:nullp_String
"null?"
:nullp
PUSHR R1 R15 ; Protect R1
LOAD32 R0 R0 4 ; Get ARGS->CAR
LOADUI R1 $NIL ; Using NIL
CMPSKIPI.NE R0 $NIL ; If NIL Expression
LOADUI R1 $TEE ; Return TEE
MOVE R0 R1 ; Put result in correct register
POPR R1 R15 ; Restore R1
RET R15
;; prim_sum ;; prim_sum
;; Recieves a list in R0 ;; Recieves a list in R0
;; Adds all values and returns a Cell with result in R0 ;; Adds all values and returns a Cell with result in R0
@ -2263,6 +2279,13 @@
CALLI R15 @spinup ; SPINUP CALLI R15 @spinup ; SPINUP
;; Add Primitive Specials ;; Add Primitive Specials
LOADUI R0 $nullp ; Using NULLP
CALLI R15 @make_prim ; MAKE_PRIM
MOVE R1 R0 ; Put Primitive in correct location
LOADUI R0 $nullp_String ; Using NULLP_STRING
CALLI R15 @make_sym ; MAKE_SYM
CALLI R15 @spinup ; SPINUP
LOADUI R0 $prim_sum ; Using PRIM_SUM LOADUI R0 $prim_sum ; Using PRIM_SUM
CALLI R15 @make_prim ; MAKE_PRIM CALLI R15 @make_prim ; MAKE_PRIM
MOVE R1 R0 ; Put Primitive in correct location MOVE R1 R0 ; Put Primitive in correct location