From 3b05f83e6a1ca76c3b3ac9f6d6e481cd5c648c1f Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sat, 17 Jun 2017 22:05:33 -0400 Subject: [PATCH] Fixed the Carriage return issue and CMOVE zeroing issue --- CHANGELOG.org | 1 + bootstrapping Steps.org | 2 +- stage2/forth.s | 5 ++--- test/SHA256SUMS | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 8d34e25..312e853 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -40,6 +40,7 @@ Stack leak in stage2 forth found and corrected Stage2 forth no longer attempts to parse carriage returns Stage2 forth now will display and error and clear the stacks in the event of an undefined input Stage2 forth now respects the HIDDEN Flag +Stage2 forth now no longer clears during CMOVE to better comply with the spec ** Removed Removed need for sponge to be used to run webIDE diff --git a/bootstrapping Steps.org b/bootstrapping Steps.org index 3a0a409..52cc0dc 100644 --- a/bootstrapping Steps.org +++ b/bootstrapping Steps.org @@ -174,7 +174,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/forth --memory 48K -roms/forth should with the sha256sum of 9b84fb95fd00d83f27a2d9b96472a78baa40f10f4b1868624e299bfb16cda399 +roms/forth should with the sha256sum of 65b93c67f5d369190d3deaa5ef94948071e6502cd64cc1cc2de9672f7dc859e6 Our forth will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in (Otherwise there is no way for a forth fan to have a chance against the lisp in terms of being able to bootstrap something cool) diff --git a/stage2/forth.s b/stage2/forth.s index f2a0548..07f138e 100644 --- a/stage2/forth.s +++ b/stage2/forth.s @@ -634,13 +634,11 @@ POPR R0 R14 ; Get number of bytes to Move POPR R1 R14 ; Where to put the result POPR R2 R14 ; Where it is coming from - FALSE R4 ; Prepare for Zeroing :Cmove_Main CMPSKIPI.GE R0 4 ; Loop if we have 4 or more bytes to move JUMP @Cmove_Slow ; Otherwise slowly move bytes LOAD R3 R2 0 ; Get 4 Bytes - STORE R4 R2 0 ; Overwrite that memory with Zeros STORE R3 R1 0 ; Store them at the destination ADDUI R1 R1 4 ; Increment Source by 4 ADDUI R2 R2 4 ; Increment Destination by 4 @@ -651,7 +649,6 @@ CMPSKIPI.G R0 0 ; While number of bytes is greater than 0 JUMP @Cmove_Done ; Otherwise be done LOADU8 R3 R2 0 ; Get 4 Bytes - STORE8 R4 R2 0 ; Overwrite that memory with Zeros STORE8 R3 R1 0 ; Store them at the destination ADDUI R1 R1 1 ; Increment Source by 1 ADDUI R2 R2 1 ; Increment Destination by 1 @@ -817,6 +814,8 @@ :Key_Code COPY R1 R7 ; Using designated IO FGETC ; Get a byte + CMPSKIPI.NE R0 13 ; If Carriage return + LOADUI R0 10 ; Replace with Line Feed CMPSKIPI.NE R1 0 ; If not TTY FPUTC ; Skip Echoing PUSHR R0 R14 ; And push it onto the stack diff --git a/test/SHA256SUMS b/test/SHA256SUMS index e70ea21..bfbaf1d 100644 --- a/test/SHA256SUMS +++ b/test/SHA256SUMS @@ -1,6 +1,6 @@ 8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT 59f0502748af32e3096e026a95e77216179cccfe803a05803317414643e2fcec roms/DEHEX -9b84fb95fd00d83f27a2d9b96472a78baa40f10f4b1868624e299bfb16cda399 roms/forth +65b93c67f5d369190d3deaa5ef94948071e6502cd64cc1cc2de9672f7dc859e6 roms/forth 4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp 2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0 24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET