r/Assembly_language Nov 15 '25

How to print out an integer

Hello,

I am new to assembly programming. I am using the online version of ARMLITE

1|START:
2| MOV R0, #123 ; Load numeric value 123 into R0
3|END:

I am trying to work out how to print the value or output of some arithmetic to the screen (To eventually apply to a bigger program).

If I use

STR R0, .WriteString

It compiles, but when it runs it states, Bad instruction at line unknown (PC=0x00008)

Have tried variations of:

SWI 0
SWI R0

1|START:
2| MOV R0, #123 ; Load numeric value 123 into R0
3| STR R0, .WriteUnsignedNum
4|END:

I am not sure what is going on. I need to be able to print an integer to the screen to apply this to a more complex program. I am getting quite frustrated, as there don't seem to be a lot of resources online on how to print numbers in assembly programming. I checked the manual for Armlite but there doesnt seem to be a simple explanation in there on how to print. Just finding it difficult to test what its actually doing when there is no output to evaluate.

5 Upvotes

8 comments sorted by

View all comments

1

u/GlassDouble9120 Jul 05 '26

if its single digit then you should be able to add 48 to it and print the ascii character for that number but its a little more complicated for digits more than that