aboutsummaryrefslogtreecommitdiff
path: root/src/uart.S
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-11-13 00:50:48 -0700
committerChristian Cunningham <cc@localhost>2021-11-13 00:50:48 -0700
commitdbd54a6adc72213f8bb015ed156164d140c43b69 (patch)
tree29bb39b178453f0ea9277908e4376ac99244c282 /src/uart.S
parentc5144008ec49e0bc8e97fb3262e07bff63e8bf40 (diff)
Added Hex output
Diffstat (limited to 'src/uart.S')
-rw-r--r--src/uart.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/uart.S b/src/uart.S
index bd98bac..94ce458 100644
--- a/src/uart.S
+++ b/src/uart.S
@@ -44,3 +44,30 @@ uart_string.loop:
cmp r0, #0
bne uart_string.loop
pop {r4, pc}
+
+.globl uart_hex
+uart_hex:
+ push {r4, lr}
+ mov r2, #0x1000
+ movt r2, #0x3f20
+uart_hex.loop:
+ ldr r3, [r2, #24]
+ tst r3, #0b100000
+ bne uart_hex.loop
+ mov r3, #7
+uart_hex.hloop:
+ mov r1, r0
+ asr r1, r3
+ asr r1, r3
+ asr r1, r3
+ asr r1, r3
+ and r1, #0xf
+ add r1, #0x30
+ cmp r1, #0x3A
+ blt uart_hex.print
+ add r1, #7
+uart_hex.print:
+ str r1, [r2]
+ subs r3, #1
+ bge uart_hex.hloop
+ pop {r4, pc}