diff --git a/CHANGELOG.org b/CHANGELOG.org index 276a41f..3290576 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -19,6 +19,7 @@ Added HACKING guide covering critical sections Added rom building steps to make Added more advanced cleaning options to makefile +Extended stage2 lisp with null? ** Changed Cleaned up x86 notes and moved into x86 folder diff --git a/bootstrapping Steps.org b/bootstrapping Steps.org index 5789e6f..75ef293 100644 --- a/bootstrapping Steps.org +++ b/bootstrapping Steps.org @@ -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 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. It is recommended to run with no less than 4MB of Memory diff --git a/stage2/lisp.s b/stage2/lisp.s index f617195..34ec5d0 100644 --- a/stage2/lisp.s +++ b/stage2/lisp.s @@ -1360,6 +1360,22 @@ 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 ;; Recieves a list in R0 ;; Adds all values and returns a Cell with result in R0 @@ -2263,6 +2279,13 @@ CALLI R15 @spinup ; SPINUP ;; 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 CALLI R15 @make_prim ; MAKE_PRIM MOVE R1 R0 ; Put Primitive in correct location