From 806ffaaa7765fd62ed07641e895e99ff2d1f8403 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sat, 25 Jun 2016 23:17:35 -0400 Subject: [PATCH] Improved Stage0 and reduced size of required binary --- stage0/stage0_monitor.hex | 16 +++++++--------- stage0/stage0_monitor.s | 6 ++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/stage0/stage0_monitor.hex b/stage0/stage0_monitor.hex index 8a4b12f..7c2951e 100644 --- a/stage0/stage0_monitor.hex +++ b/stage0/stage0_monitor.hex @@ -20,26 +20,24 @@ # ;; Check for Ctrl-D 1FE00004 # CMPUI R14 R0 4 2C6E0008 # JUMP.NE R14 @.L0 -2D0D00d0 # CALLI R13 @finish +2D0D00c8 # CALLI R13 @finish # .L0 # ;; Check for EOF -12E0ffff # CMPI R14 R0 -1 -2C6E0008 # JUMP.NE R14 @.L1 -2D0D00c4 # CALLI R13 @finish +2CB00008 # JUMP.P R0 @.L1 +2D0D00c0 # CALLI R13 @finish # .L1 2D211101 # LOADUI R1 0x1101 ; Write to TAPE_02 42100200 # FPUTC ; Print the Char -2D0D0038 # CALLI R13 @hex ; Convert it -12E00000 # CMPI R14 R0 0 ; Check if it is hex -2C8Effd0 # JUMP.L R14 @loop ; Don't use nonhex chars +2D0D0034 # CALLI R13 @hex ; Convert it +2CC0ffd8 # JUMP.NP R0 @loop ; Don't use nonhex chars 2C9B0010 # JUMP.Z R11 @.L99 ; Jump if toggled # ;; Process first byte of pair 05020F0A # AND R15 R0 R10 ; Store First nibble 0D00002B # FALSE R11 ; Flip the toggle -3C00ffc0 # JUMP @loop +3C00ffc8 # JUMP @loop # .L99 2D5F0004 # SL0I R15 4 ; Shift our first nibble @@ -48,7 +46,7 @@ 2D1B0001 # LOADI R11 1 ; Flip the toggle 2D211100 # LOADUI R1 0x1100 ; Write the combined byte 42100200 # FPUTC ; To TAPE_01 -3C00ffa4 # JUMP @loop ; Try to get more bytes +3C00ffac # JUMP @loop ; Try to get more bytes # hex # ;; Deal with line comments starting with # diff --git a/stage0/stage0_monitor.s b/stage0/stage0_monitor.s index 8765de2..41eaf69 100644 --- a/stage0/stage0_monitor.s +++ b/stage0/stage0_monitor.s @@ -24,16 +24,14 @@ loop .L0 ;; Check for EOF - CMPI R14 R0 -1 - JUMP.NE R14 @.L1 + JUMP.P R0 @.L1 CALLI R13 @finish .L1 LOADUI R1 0x1101 ; Write to TAPE_02 FPUTC ; Print the Char CALLI R13 @hex ; Convert it - CMPI R14 R0 0 ; Check if it is hex - JUMP.L R14 @loop ; Don't use nonhex chars + JUMP.NP R0 @loop ; Don't use nonhex chars JUMP.Z R11 @.L99 ; Jump if toggled ;; Process first byte of pair