-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hangman_ROM_Program.asm
145 lines (132 loc) · 1.43 KB
/
Hangman_ROM_Program.asm
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
asect 0x00
welcome:
ldi r0,a
while
ld r0,r1
tst r1
stays nz
ldi r2,0xf1
st r2,r1
ldi r3,0xff
ldi r2,1
st r3,r2
inc r0
wend
ldi r0, 0xfa
ldi r1, 1
st r0, r1
ldi r1, 0
st r0, r1
clr r1
clr r0
readwinlose:
while
ldi r0, 0xf9
ld r0, r1
tst r1
stays pl
wend
if
ldi r3, 0x81
cmp r1, r3
is eq
ldi r0,b
while
ld r0,r1
tst r1
stays nz
ldi r2,0xf1
st r2,r1
ldi r3,0xff
ldi r2,1
st r3,r2
inc r0
wend
fi
if
ldi r3, 0x82
cmp r1, r3
is eq
ldi r0,c
while
ld r0,r1
tst r1
stays nz
ldi r2,0xf1
st r2,r1
ldi r3,0xff
ldi r2,1
st r3,r2
inc r0
wend
fi
ldi r0,d
while
ld r0,r1
tst r1
stays nz
ldi r2,0xf1
st r2,r1
ldi r3,0xff
ldi r2,1
st r3,r2
inc r0
wend
while
#keeps looping until user presses new game or end game button#
ldi r0, 0xfa
ld r0, r1
tst r1
stays pl
wend
if
#new game button press#
ldi r3, 0x81
cmp r1, r3
is eq
clr r0
clr r1
clr r2
clr r3
br readwinlose
fi
if
#end game button press#
ldi r3, 0x82
cmp r1, r2
is eq
br endgame
fi
endgame:
# checks to see wether end game button has been pressed
if
ldi r3, 0x82
cmp r1, r3
is eq
ldi r0,e
while
ld r0,r1
tst r1
stays nz
ldi r2,0xf1
st r2,r1
ldi r3,0xff
ldi r2,1
st r3,r2
inc r0
wend
halt
fi
asect 0xa0
inputs>
a:
asect 0xb4
b:
asect 0xc1
c:
asect 0xcf
d:
asect 0x98
e:
endinputs>
end