From 261c210c9c4c1e55103a7af31dfcc539c0e0e5cc Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Fri, 19 Jan 2024 16:41:29 -0600 Subject: Add subroutine for printing hexadecimal word --- hexedit/hexedit.s | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 hexedit/hexedit.s (limited to 'hexedit/hexedit.s') diff --git a/hexedit/hexedit.s b/hexedit/hexedit.s new file mode 100644 index 0000000..0bc03a9 --- /dev/null +++ b/hexedit/hexedit.s @@ -0,0 +1,25 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type hexedit, %function +.global hexedit + +hexedit: + ldr r2, =0x20000100 + movs r1, 0 +getchar: + bl uart_recv + cmp r0, 'g + beq stop + subs r0, '0 // The ASCII char '0' + bmi next + lsls r1, 4 + adds r1, r0 + b getchar +next: + ldr r0, [r2, 0] + adds r2, 4 + b hexedit +stop: + b 0x20000100 -- cgit v1.2.3