diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-01-26 01:13:00 -0600 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-01-26 01:13:00 -0600 |
commit | 50b909927c1f7d7f1e51354c749005dceac37dca (patch) | |
tree | 535bd6431f19518e17872045e857142414eace18 | |
parent | 4c0cb6ded3dd38bfeb7c163397a480b029458326 (diff) |
Add parser for 3-bit register
-rw-r--r-- | assembler/register.s | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/assembler/register.s b/assembler/register.s index 9fbc76c..dd0e1ae 100644 --- a/assembler/register.s +++ b/assembler/register.s @@ -1,4 +1,4 @@ -register: +register4: PUSH {LR} 10: BL get_char @@ -37,3 +37,26 @@ register: 60: MOVS R4, 1 POP {PC} + +register3: + PUSH {LR} +10: + BL get_char + MOVS R1, 'R + CMPS R0, R1 + BNE 10b +20: + BL get_char + MOVS R1, '0 + CMPS R0, R1 + BLO 20b + MOVS R1, '7 + CMPS R0, R1 + BHI 20b +30: + SUBS R0, '0 + MOVS R4, 0 + ORRS R4, R0 + BL get_char + BNE 40b + POP {PC} |