Start New Discussion within our **Software Development Community** # Displaying an Integer

```
;Outputs an integer loaded in from memory
.ORIG x3000
LD R5,NUM ;ASCII MASK
LEA R4,TENS ; SPACE FOR 2 DIGITS
LD R1,NUMBER ;NUMBER TO DISPLAY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TENPLACE
ADD R2,R2,#1 ;INCREMENT COUNTER
ADD R1,R1,#-10 ;ADD -10 TO NUMBER
BRP TENPLACE ;IF POSITIVE LOOP UP
ADD R2,R2,#-1
STR R2,R4,#0
LDR R0,R4,#0
ADD R0,R0,R5
TRAP x21
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AND R2,R2,#0 ;counter
LD R1,NUMBER ;LOAD NUMBER BACK
ONEPLACE ;IF POSITIVE LOOP UP
ADD R1,R1,#-10 ;ADD -10 TO NUMBER
BRP ONEPLACE
ADD R1,R1,#10 ;GET POSITIVE NUMBER BACK
STR R1,R4,#1 ;STORE IN ONES SPOT
LDR R0,R4,#1
ADD R0,R0,R5
TRAP x21
HALT
NUM .FILL x30
TENS .blkw 2
NUMBER .FILL #98
MINUSTEN .FILL #-10
TEN .FILL #10
.END
```