I am trying to print a triangle of asterisks based on a value of N. The code I have here will just print an entire row of N *'s. The end result i am looking for is:
*
**
***
****
If N = 4
The code I have right now
.ORIG x3000
LD R1, N
NOT R1, R1
ADD R1, R1, #1 ; R1 = -N
AND R2, R2, #0 ; R2 = 0
LOOP ADD R3, R2, R1 ; while (R2 < N)
BRzp
LD R0, STAR ; R0 = *
OUT ; Write *
LEA R0, NEWLN ; R2 = R2 + 1
PUTS
ADD R2, R2, #1 ;
BRnzp LOOP
ELOOP
LEA R0, NEWLN
PUTS
STOP HALT
N .FILL 4
STAR .FILL x2A
NEWLN .STRINGZ "\n"
Can anyone help me out with accomplishing this?