diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-07-15 03:50:10 -0500 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-07-15 03:50:10 -0500 |
commit | b6462786840cea2e2c3197a36234363f91e41b1a (patch) | |
tree | 7de4c5c4d54e4240fd7f2e91aad820a8651e7625 /assembler/main.s | |
parent | d6ff9f5bda85206d163f02f7cc78e47968c434ce (diff) |
Improve assembler controls
Diffstat (limited to 'assembler/main.s')
-rw-r--r-- | assembler/main.s | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/assembler/main.s b/assembler/main.s index 1795823..a9fd109 100644 --- a/assembler/main.s +++ b/assembler/main.s @@ -5,22 +5,31 @@ .type main, %function .global main -main: - bl start_xosc - bl setup_clocks - bl setup_gpio - bl setup_uart - b assembler - -assembler: LDR R0, =0x20001000 // SRAM_BASE - MOV R11, R0 +main: LDR R0, =0x20000000 // SRAM_BASE +0: MOV R11, R0 ADDS R1, R0, 1 // JUMP ADDRESS MOV R12, R1 1: BL PROMPT // SHOW PROMPT BL assemble - B 2f // TODO condition + CMP R0, 1 // SET NEW ADDRESS + BNE 2f + MOVS R0, '\r // SEND CR + BL uart_send + MOV R1, R11 // GET ADDRESS + LSRS R1, 16 // SHIFT OUT LOWER HALFWORD + MOVS R0, R1 // SAVE IN R0 + LSLS R1, 16 // SHIFT BACK + MOV R11, R1 // SAVE ALTERRED ADDRESS + MOVS R1, 4 // SEND HEX WITH WIDTH 4 + BL send_hex + BL get_hex // GET HEX INPUT FOR OFFSET + MOV R0, R11 // ADD OFFSET TO ADDRESS + ADDS R0, R4 + B 0b +2: CMP R0, 2 // JUMP TO NEW CODE + BNE 3f BX R12 -2: MOV R7, R11 // STORE INSTRUCTION WORD +3: MOV R7, R11 // STORE INSTRUCTION WORD STRH R6, [R7] MOVS R0, '\r // NEW LINE BL uart_send @@ -35,11 +44,13 @@ assembler: LDR R0, =0x20001000 // SRAM_BASE PROMPT: PUSH {LR} MOV R0, R11 // CURRENT ADDRESS + MOVS R1, 8 BL send_hex MOVS R0, ' // SPACE BL uart_send MOV R1, R11 // CURRENT CONTENTS LDRH R0, [R1] + MOVS R1, 4 BL send_hex MOVS R0, ' // SPACE BL uart_send |