1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
;; sum numbers from 1 to X
; zero everything
and ADM, #0, A
; initialize counter
mov A, #10
add D, #0, A
;loop:
; set memory location
mov A, #0
; add to memory location
add M, M, D
; prepare jump address
mov A, #3
; decrement counter
dec.jne D, D
; set memory location again
; end
; I have no idea why, but my simulator
; either aborts too early (before state is displayed)
; or too late (when invalid ins. is already shown).
mov A, #0
mov A, #0
mov A, #0
hlt
|