Fixed lisp's behavior when there is insufficient memory

This commit is contained in:
Jeremiah Orians 2017-06-24 11:49:28 -04:00
parent d3bed26e0a
commit 23b12e0ef9
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
4 changed files with 29 additions and 2 deletions

View File

@ -42,6 +42,7 @@ Stage0 vm now will show an error message if the size of the rom exceeds the avai
** Fixed
Updated checksums to reflect changes in stage2 FORTH
Fixed dis behavior in regards to hex values in strings
Updated checksums to reflect changes in stage2 Lisp
** Removed
the HERE and DP! are gone from ' now in stage3 FORTH

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 4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a
roms/lisp should have the sha256sum of b386b0e08250421a4d7eb14817b4c3359aef52d7773b3667bb1caaa933cbfe66
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

@ -29,11 +29,21 @@
;; Start function
:start
;; Check if we are going to hit outside the world
HAL_MEM ; Get total amount of Memory
LOADR R1 @MINIMAL_MEMORY ; Get our Minimal Value
CMPSKIP.GE R0 R1 ; Check if we have enough
JUMP @FAILED_INITIALIZATION ; If not fail gracefully
LOADR R15 @stack_start ; Put stack after CONS and HEAP
;; We will be using R14 for our condition codes
;; We will be using R13 for which Input we will be using
;; We will be using R12 for which Output we will be using
;; Ensure a known good state
FALSE R0 ; Reset R0
FALSE R1 ; Reset R1
;; Initialize
CALLI R15 @garbage_init
CALLI R15 @init_sl3
@ -69,6 +79,22 @@
:stack_start
'00180000'
;; How much memory is too little
:MINIMAL_MEMORY
'00180000'
;; Halt the machine in the event of insufficient Memory
:FAILED_INITIALIZATION
FALSE R1 ; Set output to TTY
LOADUI R0 $FAILED_STRING ; Prepare our Message
CALLI R15 @Print_String ; Print it
HALT ; Prevent any further damage
:FAILED_STRING
"Please provide 1600KB of Memory for this Lisp to run (More is recommended for large programs)
"
;; Append_Cell
;; Adds a cell to the end of a CDR chain
;; Recieves HEAD in R0 and Tail in R1

View File

@ -1,7 +1,7 @@
8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT
59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX
3a4a15691297345ac808ce41fae26d5592cd09d759d2feef88c1ef262ddaa5b8 roms/forth
4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp
b386b0e08250421a4d7eb14817b4c3359aef52d7773b3667bb1caaa933cbfe66 roms/lisp
2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0
24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET
0a427b14020354d1c785f5f900677e0059fce8f8d4456e9c19e5528cb17101eb roms/stage0_monitor