leave stack at zero; to not do FALSE R15 because it is zero on start
This commit is contained in:
parent
c9232a21c7
commit
d21dc971d1
|
@ -21,9 +21,19 @@
|
|||
# ;; Prepare often-used values that will be held in registers
|
||||
090001AC # ABS R10 R12 ; Set R10 to 1
|
||||
E0002D2B1100 # LOADUI R11 0x1100 ; R11 will hold 0x1100
|
||||
090004DB # COPY R13 R11 ; Stack will start at 0x1100
|
||||
# ;; R14 will be storing our condition
|
||||
0D00002F # FALSE R15 ; Our holder
|
||||
#
|
||||
# ;; R14 will be storing our condition
|
||||
# ;;
|
||||
# ;; R13 will be a stack pointer. It will be zero
|
||||
# ;; on the start, and the stack grows up.
|
||||
# ;; This means that when stack is used, the
|
||||
# ;; first instructions of this program will be
|
||||
# ;; overwritten. But because this is initialization
|
||||
# ;; code, it is already not used at the time.
|
||||
# ;; And the stack usage is fixed - there is only one CALL
|
||||
# ;; instruction in this file
|
||||
# ;;
|
||||
# ;; R15 Is our holder. It is initialized to zero on start.
|
||||
|
||||
# ;; Prep TAPE_01
|
||||
0900040B # COPY R0 R11 ; 0x1100
|
||||
|
@ -33,7 +43,7 @@ E0002D2B1100 # LOADUI R11 0x1100 ; R11 will hold 0x1100
|
|||
050210BA # OR R0 R11 R10 ; 0x1101
|
||||
42100001 # FOPEN_WRITE
|
||||
|
||||
# :loop ; offset = 26
|
||||
# :loop ; offset = 1e
|
||||
0D000021 # FALSE R1 ; Read from tty
|
||||
42100100 # FGETC ; Read a Char
|
||||
E000A030000d # CMPSKIPI.NE R0 13 ; Replace all CR
|
||||
|
@ -67,7 +77,7 @@ E100B0F0000f # ANDI R15 R0 0x0F ; Store First nibble
|
|||
|
||||
# ;; Combined second nybble in pair with first
|
||||
|
||||
# :second_nybble ; offset = 76
|
||||
# :second_nybble ; offset = 6e
|
||||
E0002D5F0004 # SL0I R15 4 ; Shift our first nibble
|
||||
E100B000000f # ANDI R0 R0 0x0F ; Mask out top
|
||||
0500000F # ADD R0 R0 R15 ; Combine nibbles
|
||||
|
@ -80,7 +90,7 @@ E100B000000f # ANDI R0 R0 0x0F ; Mask out top
|
|||
42100200 # FPUTC
|
||||
3C00ff90 # JUMP @loop ; Try to get more bytes
|
||||
|
||||
# :hex ; offset = 96
|
||||
# :hex ; offset = 8e
|
||||
|
||||
# ;; Deal with line comments starting with #
|
||||
E1001FE00023 # CMPUI R14 R0 35
|
||||
|
@ -117,23 +127,23 @@ E0002C7E000e # JUMP.LE R14 @ascii_low
|
|||
# ;; Ignore the rest
|
||||
3C00001e # JUMP @ascii_other
|
||||
|
||||
# :ascii_num ; offset = fa
|
||||
# :ascii_num ; offset = f2
|
||||
E10011000030 # SUBUI R0 R0 48
|
||||
0D01001D # RET R13
|
||||
|
||||
# :ascii_low ; offset = 104
|
||||
# :ascii_low ; offset = fc
|
||||
E10011000057 # SUBUI R0 R0 87
|
||||
0D01001D # RET R13
|
||||
|
||||
# :ascii_high ; offset = 10e
|
||||
# :ascii_high ; offset = 106
|
||||
E10011000037 # SUBUI R0 R0 55
|
||||
0D01001D # RET R13
|
||||
|
||||
# :ascii_other ; offset = 118
|
||||
# :ascii_other ; offset = 110
|
||||
0D000030 # TRUE R0
|
||||
0D01001D # RET R13
|
||||
|
||||
# :ascii_comment ; offset = 120
|
||||
# :ascii_comment ; offset = 118
|
||||
0D000021 # FALSE R1 ; Read from tty
|
||||
42100100 # FGETC ; Read another char
|
||||
E000A030000d # CMPSKIPI.NE R0 13 ; Replace all CR
|
||||
|
@ -145,7 +155,7 @@ E1001FE0000a # CMPUI R14 R0 10 ; Stop at the end of line
|
|||
E0002C6Effd4 # JUMP.NE R14 @ascii_comment ; Otherwise keep looping
|
||||
3C00ffc8 # JUMP @ascii_other
|
||||
|
||||
# :finish ; offset = 150
|
||||
# :finish ; offset = 148
|
||||
0900040B # COPY R0 R11 ; Close TAPE_01
|
||||
42100002 # FCLOSE
|
||||
050210BA # OR R0 R11 R10 ; Close TAPE_02
|
||||
|
|
|
@ -21,9 +21,18 @@
|
|||
ABS R10 R12 ; Set R10 to 1
|
||||
LOADUI R11 0x1100 ; R11 will hold 0x1100
|
||||
|
||||
COPY R13 R11 ; Stack will start at 0x1100
|
||||
;; R14 will be storing our condition
|
||||
FALSE R15 ; Our holder
|
||||
;; R14 will be storing our condition
|
||||
;;
|
||||
;; R13 will be a stack pointer. It will be zero
|
||||
;; on the start, and the stack grows up.
|
||||
;; This means that when stack is used, the
|
||||
;; first instructions of this program will be
|
||||
;; overwritten. But because this is initialization
|
||||
;; code, it is already not used at the time.
|
||||
;; And the stack usage is fixed - there is only one CALL
|
||||
;; instruction in this file
|
||||
;;
|
||||
;; R15 Is our holder. It is initialized to zero on start.
|
||||
|
||||
;; Prep TAPE_01
|
||||
COPY R0 R11 ; 0x1100
|
||||
|
|
Loading…
Reference in New Issue