From ed6f1106322f8ca4a6e26d08365bb9558ffa9d09 Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Wed, 21 Aug 2024 00:21:54 -0500 Subject: Start new assembler --- newasm/uart.s | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 newasm/uart.s (limited to 'newasm/uart.s') diff --git a/newasm/uart.s b/newasm/uart.s new file mode 100644 index 0000000..c4abb8a --- /dev/null +++ b/newasm/uart.s @@ -0,0 +1,44 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type uart_send, %function +.type uart_recv, %function +.type send_hex, %function + +.global uart_send +.global uart_recv +.global send_hex + +uart_send: LDR R1, =0x40034000 + MOVS R3, 0x20 +1: LDR R2, [R1, 0x18] + TST R2, R3 + BNE 1b + STRB R0, [R1] + BX LR + +uart_recv: LDR R1, =0x40034000 + MOVS R3, 0x10 +1: LDR R2, [R1, 0x18] + TST R2, R3 + BNE 1b + LDRB R0, [R1] + BX LR + +send_hex: PUSH {R4, R5, LR} + MOVS R4, R0 + MOVS R5, 8 +0: MOVS R0, 0x1C + RORS R4, R0 + MOVS R0, 0x0F + ANDS R0, R4 + CMP R0, 0x9 + BHI 1f + ADDS R0, 0x30 + B 2f +1: ADDS R0, 0x37 +2: BL uart_send + SUBS R5, 1 + BNE 0b + POP {R4, R5, PC} -- cgit v1.2.3