I am new to arm assembly, i'm trying to print integer to screen instead of their ASCII representation of that number. Below is the code which i'm trying with instead of printing 99 i'm getting 'c'.
.global _start
.text
_start:
@ write to num variable
_write:
mov r8, #99
ldr r9, =num
str r8, [r9]
@read from num variable and print to screen
_read:
mov r7, #4 @ syscall
mov r0, #1 @ std output
ldr r1, =num @ starting address
mov r2, #2 @ number of character to print
swi 0 @ interrupt
_end:
mov r7, #1
swi 0
.data
num: .word 0
I have checked online resources which has numerous examples of printing strings but not numbers.
[root@alarmpi]# make
as -o num.o num.s
ld - num num.o
[root@alarmpi ]# ./num
c
Kindly let me know how to output numbers using ARM assembly (possibly without using C libraries).
Thank You.