-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop.s
36 lines (33 loc) · 829 Bytes
/
loop.s
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
27
28
29
30
31
32
33
34
35
36
# loop.s -- loop till overflow.
## LDI 8
## LDI 0
## CPAM # M = 0x80
## LDI 4
## LDI 5
## STM # RAM[0x80] <= 0x54
LDI 0
LDI 2 # A <= 2
SWAB # A <= 0, B <= 2
CPPA # M <= P
ADD
CPAM
## Loop body
SWAB
LDI 0
LDI 1
SWAB
ADD # A <= A + B
JG
## Test loads.
## LDI 8
## LDI 0 # A <= 0x80
## CPAM
## LDM # A <= RAM[0x80]
## Program done, forever loop.
LDI 0
LDI 2
SWAB
CPPA
ADD
CPAM
JU # Loop forever (halt).