blob: f732db1e617bd432b709f29ca336133d79ecb9bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
;; 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
mov A, #0
hlt
|