Assembly Code
NOP MOV #00 @20 ; sum = 0 MOV #01 @21 ; i = 1 (the next value to add) MOV #05 @22 ; n = 5 (how many terms to add) loop: MOV @20 A ; A = sum ADD @21 ; R = sum + i MOV R @20 ; sum = R MOV R DX ; show the running total (to display X) INC @21! ; i += 1 DEC @22! ; n -= 1 (sets ZERO when the last term is done) JPZ done ; ...then fall out of the loop JMP loop ; otherwise go again done: HLT
Compile
Download
Step
Unhalt
Run
Run Fast
Stop
Reset
Speed:
50 Hz
CPU State
Not Loaded
Cycles:
0
Instructions:
0
Registers
A (Accumulator)
0x00
R (Result)
0x00
PP (Program Ptr)
0x000
IR (Instruction)
0x00
Page Latch
0x00
Microstep
0
Flags
Zero (Z)
Carry (C)
RAM Bank
Current Bank
0
RAM (Bank
0
)
View Bank:
I/O Output
Format:
Hexadecimal
Decimal
String (ASCII)
Output X
-
Output Y
-
Push Input
Data to push:
Format:
Hexadecimal
Decimal
String (ASCII)
Push
Execution Log
Compile and run code to see execution log...