aboutsummaryrefslogtreecommitdiff
path: root/assembler
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-05-26 14:23:17 -0500
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2024-05-26 14:23:17 -0500
commit50dc62be4128b6c17b4ff42c0440250526a23215 (patch)
tree136c7ca76f55f1b6c8604dbde09b2f29b5d2519b /assembler
parent5bbad5026cb810f61c2466d5c4bf3438ba820842 (diff)
Use CMP immediate
Diffstat (limited to 'assembler')
-rw-r--r--assembler/register.s20
1 files changed, 6 insertions, 14 deletions
diff --git a/assembler/register.s b/assembler/register.s
index 348d8cf..f8197fd 100644
--- a/assembler/register.s
+++ b/assembler/register.s
@@ -12,33 +12,26 @@ register:
ADDS R4, ('0 + 1)
10:
BL get_char
- MOVS R1, 'R
- CMP R0, R1
+ CMP R0, 'R
BNE 10b
BL uart_send
20:
BL get_char
- MOVS R1, '0
- CMP R0, R1
+ CMP R0, '0
BLO 20b
CMP R0, R4
BHI 20b
BL uart_send
- MOVS R1, '1
- CMP R0, R1
+ CMP R0, '1
BNE 30f
- MOVS R1, '7
- CMP R4, R1
+ CMP R4, '7
BEQ 30f
50:
BL get_char
- // CMP R0, ' // space is stop char
BEQ 60f
- MOVS R1, '0
- CMP R0, R1
+ CMP R0, '0
BLO 50b
- MOVS R1, '5
- CMP R0, R1
+ CMP R0, '5
BHI 50b
BL uart_send
ADDS R0, 10
@@ -47,7 +40,6 @@ register:
MOV R4, R0
40:
BL get_char
- // CMP R0, ' // space is stop char
BNE 40b
POP {PC}
60: