ARM Assembly how to print numbers instead of their ascii representation of that number

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

@ write to num variable
    mov r8, #99
    ldr r9, =num
    str r8, [r9]

@read from num variable and print to screen
    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

    mov r7, #1
    swi 0

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

Kindly let me know how to output numbers using ARM assembly (possibly without using C libraries).

Thank You.

Parents Reply Children
More questions in this forum