|
The square numbers are: 1, 4, 9, 16, 25, 36, ...
The pattern is made clear by writing down what we have to add to each number to get the next:
|
LDA #1 STA S LDA #3 STA A LOOP: OUT S LDA S ADD A STA S INC A INC A JMP LOOP |
LDA #1
STA S
LDA #3
STA A
LOOP: OUT S
LDA S
ADD A
STA S
INC A
INC A
JMP LOOP