From 50b909927c1f7d7f1e51354c749005dceac37dca Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Fri, 26 Jan 2024 01:13:00 -0600 Subject: Add parser for 3-bit register --- assembler/register.s | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'assembler/register.s') 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} -- cgit v1.2.3