Add DUMP and SAVE-STATE to be able to save the state of a computer.

This commit is contained in:
Novatux 2013-11-24 16:39:12 +01:00
parent 27e67c6f5e
commit cb316c45b5
3 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,7 @@ bit32.band = function(x, y)
-- Common usecases, they deserve to be optimized
if y == 0xff then return x%0x100 end
if y == 0xffff then return x%0x10000 end
if y == 0xffffffff then return x%0x100000000 end
x, y = x%P, y%P
local r = 0

View File

@ -282,4 +282,6 @@ FORTH
: PREVIOUS WORDER CELL+ WORDER NWORDER @ 1- 2* MOVE NWORDER -2 +! ;
: SEARCH-WORDLIST GET-WL-LATEST FIND-WORD-DICO DUP IF DUP 1- C@ 128 AND IF 1 ELSE -1 THEN THEN ;
: FIND DUP COUNT WORDER NWORDER @ 2* + WORDER DO 2DUP I @ SEARCH-WORDLIST ?DUP IF 2>R 2DROP DROP 2R> UNLOOP EXIT THEN 2 +LOOP 2DROP 0 ;
: DUMP SET-CHANNEL 256 0 DO I 64 * PAD 1+ 64 MOVE I PAD C! PAD 65 SEND LOOP ;
: SAVE-STATE S" boot" DUMP ;
: COLD S" Computer is ready (" TYPE UNUSED U. S" bytes free)" TYPE QUIT ;

File diff suppressed because one or more lines are too long