1 |
2 |
olivier.gi |
/*===========================================================================*/
|
2 |
|
|
/* Copyright (C) 2001 Authors */
|
3 |
|
|
/* */
|
4 |
|
|
/* This source file may be used and distributed without restriction provided */
|
5 |
|
|
/* that this copyright statement is not removed from the file and that any */
|
6 |
|
|
/* derivative work contains the original copyright notice and the associated */
|
7 |
|
|
/* disclaimer. */
|
8 |
|
|
/* */
|
9 |
|
|
/* This source file is free software; you can redistribute it and/or modify */
|
10 |
|
|
/* it under the terms of the GNU Lesser General Public License as published */
|
11 |
|
|
/* by the Free Software Foundation; either version 2.1 of the License, or */
|
12 |
|
|
/* (at your option) any later version. */
|
13 |
|
|
/* */
|
14 |
|
|
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
|
15 |
|
|
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
|
16 |
|
|
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
|
17 |
|
|
/* License for more details. */
|
18 |
|
|
/* */
|
19 |
|
|
/* You should have received a copy of the GNU Lesser General Public License */
|
20 |
|
|
/* along with this source; if not, write to the Free Software Foundation, */
|
21 |
|
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
22 |
|
|
/* */
|
23 |
|
|
/*===========================================================================*/
|
24 |
|
|
/* TWO-OPERAND ARITHMETIC: ADD INSTRUCTION */
|
25 |
|
|
/*---------------------------------------------------------------------------*/
|
26 |
|
|
/* Test the ADD instruction with all addressing modes */
|
27 |
18 |
olivier.gi |
/* */
|
28 |
|
|
/* Author(s): */
|
29 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
30 |
|
|
/* */
|
31 |
|
|
/*---------------------------------------------------------------------------*/
|
32 |
|
|
/* $Rev: 17 $ */
|
33 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
34 |
|
|
/* $LastChangedDate: 2009-08-04 23:15:39 +0200 (Tue, 04 Aug 2009) $ */
|
35 |
2 |
olivier.gi |
/*===========================================================================*/
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
.global main
|
39 |
|
|
|
40 |
|
|
main:
|
41 |
|
|
/* ---------------------- INITIALIZE REGISTERS --------------------- */
|
42 |
|
|
mov #0x2222, r2
|
43 |
|
|
mov #0x3333, r3
|
44 |
|
|
mov #0x4444, r4
|
45 |
|
|
mov #0x5555, r5
|
46 |
|
|
mov #0x6666, r6
|
47 |
|
|
mov #0x7777, r7
|
48 |
|
|
mov #0x8888, r8
|
49 |
|
|
mov #0x9999, r9
|
50 |
|
|
mov #0xaaaa, r10
|
51 |
|
|
mov #0xbbbb, r11
|
52 |
|
|
mov #0xcccc, r12
|
53 |
|
|
mov #0xdddd, r13
|
54 |
|
|
mov #0xeeee, r14
|
55 |
|
|
|
56 |
|
|
mov #0x1000, r15
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
/* ---------------------- TEST WHEN SOURCE IS Rn ------------------- */
|
60 |
|
|
.set Rn_EDE, (__data_start+0x0012)
|
61 |
|
|
.set Rn_TONY, 0x0214
|
62 |
|
|
|
63 |
|
|
mov #0x4444, r4
|
64 |
|
|
mov #0x5555, r5
|
65 |
|
|
add r4, r5 ;# Add r4+r5 (0x4444+0x5555=0x9999)
|
66 |
|
|
|
67 |
|
|
mov #0x000a, r4
|
68 |
|
|
add r4, r0
|
69 |
|
|
nop
|
70 |
|
|
nop
|
71 |
|
|
nop
|
72 |
|
|
mov #0x1234, r4 ;# Make sure the jump is taken
|
73 |
|
|
test_Rn_PC:
|
74 |
|
|
|
75 |
|
|
mov #0x2222, &0x0210
|
76 |
|
|
mov #0x0200, r6
|
77 |
|
|
mov #0x3333, r7
|
78 |
|
|
add r7, 16(r6) ;# Write 0x2222+0x3333=0x5555 to memory @0x0210
|
79 |
|
|
|
80 |
|
|
mov #0x4444, &0x0212
|
81 |
|
|
mov #0x5678, r7
|
82 |
|
|
add r7, Rn_EDE ;# Write 0x4444+0x5678=0x9abc to memory @0x0212
|
83 |
|
|
|
84 |
|
|
mov #0x5555, &0x0214
|
85 |
|
|
mov #0x1234, r8
|
86 |
|
|
add r8, &Rn_TONY ;# Write 0x5555+0x1234=0x6789 to memory @0x0214
|
87 |
|
|
|
88 |
|
|
mov #0x2000, r15
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
/* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */
|
92 |
|
|
.set aRn_EDE, (__data_start+0x0012)
|
93 |
|
|
.set aRn_TONY, 0x0214
|
94 |
|
|
|
95 |
|
|
mov #0x0200, r4
|
96 |
|
|
mov #0x1111, &0x0200
|
97 |
|
|
mov #0x6666, r5
|
98 |
|
|
add @r4, r5 ;# Add @r4+r5 (0x1111+0x6666=0x7777)
|
99 |
|
|
|
100 |
|
|
mov #0x0200, r4
|
101 |
|
|
mov #0x000a, &0x0200
|
102 |
|
|
add @r4, r0
|
103 |
|
|
nop
|
104 |
|
|
nop
|
105 |
|
|
nop
|
106 |
|
|
mov #0x1234, r4 ;# Make sure the jump is taken
|
107 |
|
|
test_aRn_PC:
|
108 |
|
|
|
109 |
|
|
mov #0x1234, &0x020e
|
110 |
|
|
mov #0x5432, &0x0210
|
111 |
|
|
mov #0x0200, r6
|
112 |
|
|
mov #0x020e, r7
|
113 |
|
|
add @r7, 16(r6) ;# Write 0x1234+0x5432=0x6666 to memory @0x0210
|
114 |
|
|
|
115 |
|
|
mov #0x5f12, &0x0200
|
116 |
|
|
mov #0x8e1c, &0x0212
|
117 |
|
|
mov #0x0200, r7
|
118 |
|
|
add @r7, aRn_EDE ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212
|
119 |
|
|
|
120 |
|
|
mov #0x3112, &0x0202
|
121 |
|
|
mov #0x1541, &0x0214
|
122 |
|
|
mov #0x0202, r8
|
123 |
|
|
add @r8, &aRn_TONY ;# Write 0x3112+0x1541=0x4653 to memory @0x0214
|
124 |
|
|
|
125 |
|
|
mov #0x3000, r15
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
/* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */
|
130 |
|
|
.set aRni_EDE, (__data_start+0x0012)
|
131 |
|
|
.set aRni_TONY, 0x0214
|
132 |
|
|
|
133 |
|
|
mov #0x0200, r4
|
134 |
|
|
mov #0x2222, &0x0200
|
135 |
|
|
mov #0x8888, r5
|
136 |
|
|
add @r4+, r5 ;# Add @r4+r5 (0x2222+0x8888=0xaaaa)
|
137 |
|
|
|
138 |
|
|
mov #0x0204, r6
|
139 |
|
|
mov #0x000a, &0x0204
|
140 |
|
|
add @r6+, r0
|
141 |
|
|
nop
|
142 |
|
|
nop
|
143 |
|
|
nop
|
144 |
|
|
mov #0x1234, r6 ;# Make sure the jump is taken
|
145 |
|
|
test_aRni_PC:
|
146 |
|
|
|
147 |
|
|
mov #0x1234, &0x020e
|
148 |
|
|
mov #0x5432, &0x0210
|
149 |
|
|
mov #0x0200, r8
|
150 |
|
|
mov #0x020e, r7
|
151 |
|
|
add @r7+, 16(r8) ;# Write 0x1234+0x5432=0x6666 to memory @0x0210
|
152 |
|
|
|
153 |
|
|
mov #0x5f12, &0x0206
|
154 |
|
|
mov #0x8e1c, &0x0212
|
155 |
|
|
mov #0x0206, r8
|
156 |
|
|
add @r8+, aRni_EDE ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212
|
157 |
|
|
|
158 |
|
|
mov #0x3112, &0x0202
|
159 |
|
|
mov #0x1541, &0x0214
|
160 |
|
|
mov #0x0202, r9
|
161 |
|
|
add @r9+, &aRni_TONY ;# Write 0x3112+0x1541=0x4653 to memory @0x0214
|
162 |
|
|
|
163 |
|
|
mov #0x4000, r15
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
/* ---------------------- TEST WHEN SOURCE IS #N ------------------- */
|
168 |
|
|
.set N_EDE, (__data_start+0x0010)
|
169 |
|
|
.set N_TONY, 0x0206
|
170 |
|
|
|
171 |
|
|
mov #0x3210, r4
|
172 |
|
|
add #0x1234, r4 ;# Write 0x3210+0x1234=0x4444 to R4
|
173 |
|
|
|
174 |
|
|
mov #0x0000, r5
|
175 |
|
|
add #0x000a, r0
|
176 |
|
|
nop
|
177 |
|
|
nop
|
178 |
|
|
nop
|
179 |
|
|
mov #0x1234, r5 ;# Make sure the jump is taken
|
180 |
|
|
test_N_PC:
|
181 |
|
|
|
182 |
|
|
mov #0x5432, &0x0230
|
183 |
|
|
mov #0x0200, r6
|
184 |
|
|
add #0x5a5a, 48(r6) ;# Write 0x5432+0x5a5a=0xae8c to memory @0x0230
|
185 |
|
|
|
186 |
|
|
mov #0x4325, &0x0210
|
187 |
|
|
add #0x1a2b, N_EDE ;# Write 0x4325+0x1a2b=0x5d50 to memory @0x0210
|
188 |
|
|
|
189 |
|
|
mov #0x3254, &0x0206
|
190 |
|
|
add #0x3c4d, &N_TONY ;# Write 0x3254+0x3c4d=0x6ea1 to memory @0x0206
|
191 |
|
|
|
192 |
|
|
mov #0x5000, r15
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
/* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */
|
196 |
|
|
.set xRn_EDE, (__data_start+0x0020)
|
197 |
|
|
.set xRn_TONY, 0x0208
|
198 |
|
|
|
199 |
|
|
mov #0x8347, &0x0210
|
200 |
|
|
mov #0x1234, r5
|
201 |
|
|
mov #0x0200, r4
|
202 |
|
|
add 16(r4), r5 ;# Write 0x8347+0x1234=0x957b to R5
|
203 |
|
|
|
204 |
|
|
mov #0x000a, &0x0208
|
205 |
|
|
mov #0x0200, r4
|
206 |
|
|
mov #0x1234, r6
|
207 |
|
|
add 8(r4), r0
|
208 |
|
|
nop
|
209 |
|
|
nop
|
210 |
|
|
nop
|
211 |
|
|
nop
|
212 |
|
|
mov #0x0000, r6 ;# Make sure the jump is taken
|
213 |
|
|
test_xRn_PC:
|
214 |
|
|
|
215 |
|
|
mov #0x4241, &0x0210
|
216 |
|
|
mov #0x1535, &0x0214
|
217 |
|
|
mov #0x0200, r7
|
218 |
|
|
mov #0x0202, r8
|
219 |
|
|
add 16(r7), 18(r8) ;# Write 0x4241+0x1535=0x5776 to memory @0x214
|
220 |
|
|
|
221 |
|
|
mov #0x7238, &0x0204
|
222 |
|
|
mov #0x2143, &0x0220
|
223 |
|
|
mov #0x0200, r7
|
224 |
|
|
add 4(r7), xRn_EDE ;# Write 0x7238+0x2143=0x937b to memory @0x220
|
225 |
|
|
|
226 |
|
|
mov #0x98b2, &0x0216
|
227 |
|
|
mov #0x1432, &0x0208
|
228 |
|
|
mov #0x0200, r7
|
229 |
|
|
add 22(r4), &xRn_TONY ;# Write 0x0x98b2+0x1432=0xace4 to memory @0x208
|
230 |
|
|
|
231 |
|
|
mov #0x6000, r15
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
/* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */
|
235 |
|
|
.set EDE_EDE, (__data_start+0x0016)
|
236 |
|
|
.set EDE_TONY, 0x0212
|
237 |
|
|
|
238 |
|
|
.set EDE_200, (__data_start+0x0000)
|
239 |
|
|
.set EDE_202, (__data_start+0x0002)
|
240 |
|
|
.set EDE_204, (__data_start+0x0004)
|
241 |
|
|
.set EDE_206, (__data_start+0x0006)
|
242 |
|
|
.set EDE_208, (__data_start+0x0008)
|
243 |
|
|
|
244 |
|
|
mov #0xc3d6, &0x0200
|
245 |
|
|
mov #0x1234, &0x0204
|
246 |
|
|
mov #0x4321, r4
|
247 |
|
|
add EDE_200, r4 ;# Write 0xc3d6+0x4321=0x06f7 to R4
|
248 |
|
|
|
249 |
|
|
mov #0x000a, &0x0202
|
250 |
|
|
mov #0x1234, &0x0204
|
251 |
|
|
mov #0x3456, r6
|
252 |
|
|
add EDE_202, r0
|
253 |
|
|
nop
|
254 |
|
|
nop
|
255 |
|
|
nop
|
256 |
|
|
nop
|
257 |
|
|
mov #0x0000, r6 ;# Make sure the jump is taken
|
258 |
|
|
test_EDE_PC:
|
259 |
|
|
|
260 |
|
|
mov #0x0202, r8
|
261 |
|
|
mov #0xf712, &0x0204
|
262 |
|
|
mov #0x1234, &0x0214
|
263 |
|
|
mov #0x0000, &0x0208
|
264 |
|
|
add EDE_204, 18(r8) ;# Write 0xf712+0x1234=0x0946 to memory @0x214
|
265 |
|
|
|
266 |
|
|
mov #0xb3a9, &0x0206
|
267 |
|
|
mov #0x058a, &0x0216
|
268 |
|
|
mov #0x1234, &0x0208
|
269 |
|
|
add EDE_206, EDE_EDE ;# Write 0xb3a9+0x058a=0xb933 to memory @0x216
|
270 |
|
|
|
271 |
|
|
mov #0x837A, &0x0208
|
272 |
|
|
mov #0xA738, &0x0212
|
273 |
|
|
mov #0x1234, &0x020A
|
274 |
|
|
add EDE_208, &EDE_TONY ;# Write 0x837A+0xA738=0x2ab2 to memory @0x212
|
275 |
|
|
|
276 |
|
|
mov #0x7000, r15
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
/* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */
|
281 |
|
|
.set aEDE_EDE, (__data_start+0x0018)
|
282 |
|
|
.set aEDE_TONY, 0x0202
|
283 |
|
|
|
284 |
|
|
mov #0x23d4, &0x0200
|
285 |
|
|
mov #0x1234, &0x0202
|
286 |
|
|
mov #0x4321, r4
|
287 |
|
|
add &0x0200, r4 ;# Write 0x23d4+0x4321=0x66f5 to R4
|
288 |
|
|
|
289 |
|
|
mov #0x000a, &0x0202
|
290 |
|
|
mov #0x1234, &0x0204
|
291 |
|
|
mov #0x3456, r6
|
292 |
|
|
add &0x0202, r0
|
293 |
|
|
nop
|
294 |
|
|
nop
|
295 |
|
|
nop
|
296 |
|
|
nop
|
297 |
|
|
mov #0x0000, r6 ;# Make sure the jump is taken
|
298 |
|
|
test_aEDE_PC:
|
299 |
|
|
|
300 |
|
|
mov #0x0202, r7
|
301 |
|
|
mov #0x481c, &0x0204
|
302 |
|
|
mov #0x3ab5, &0x0214
|
303 |
|
|
mov #0x1234, &0x0206
|
304 |
|
|
add &0x0204, 18(r7) ;# Write 0x481c+0x3ab5=0x82d1 to memory @0x214
|
305 |
|
|
|
306 |
|
|
mov #0x5c1f, &0x0206
|
307 |
|
|
mov #0x6e2f, &0x0218
|
308 |
|
|
mov #0x1234, &0x0208
|
309 |
|
|
add &0x0206, aEDE_EDE ;# Write 0x5c1f+0x6e2f=0xca4e to memory @0x218
|
310 |
|
|
|
311 |
|
|
mov #0xc16e, &0x0208
|
312 |
|
|
mov #0x51ca, &0x0202
|
313 |
|
|
mov #0x1234, &0x020A
|
314 |
|
|
add &0x0208, &aEDE_TONY ;# Write 0xc16e+0x51ca=0x1338 to memory @0x202
|
315 |
|
|
|
316 |
|
|
mov #0x8000, r15
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
/* ---------------------- TEST WHEN SOURCE IS CONSTANT ------------- */
|
320 |
|
|
.set CONST_EDE0, (__data_start+0x0020)
|
321 |
|
|
.set CONST_EDE1, (__data_start+0x0022)
|
322 |
|
|
.set CONST_EDE2, (__data_start+0x0024)
|
323 |
|
|
.set CONST_EDE4, (__data_start+0x0026)
|
324 |
|
|
.set CONST_EDE8, (__data_start+0x0028)
|
325 |
|
|
.set CONST_EDEm1, (__data_start+0x002A)
|
326 |
|
|
|
327 |
|
|
.set CONST_TONY0, 0x0230
|
328 |
|
|
.set CONST_TONY1, 0x0232
|
329 |
|
|
.set CONST_TONY2, 0x0234
|
330 |
|
|
.set CONST_TONY4, 0x0236
|
331 |
|
|
.set CONST_TONY8, 0x0238
|
332 |
|
|
.set CONST_TONYm1, 0x023A
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
mov #0x4444, r4 ;# Initialize registers
|
336 |
|
|
mov #0x5555, r5
|
337 |
|
|
mov #0x6666, r6
|
338 |
|
|
mov #0x7777, r7
|
339 |
|
|
mov #0x8888, r8
|
340 |
|
|
mov #0x9999, r9
|
341 |
|
|
add #0x0000, r4 ;# Write 0x4444+0 to R4
|
342 |
|
|
add #0x0001, r5 ;# Write 0x5555+1 to R5
|
343 |
|
|
add #0x0002, r6 ;# Write 0x6666+2 to R6
|
344 |
|
|
add #0x0004, r7 ;# Write 0x7777+4 to R7
|
345 |
|
|
add #0x0008, r8 ;# Write 0x8888+8 to R8
|
346 |
|
|
add #0xffff, r9 ;# Write 0x9999-1 to R9
|
347 |
|
|
|
348 |
|
|
mov #0x1234, r11
|
349 |
|
|
add #0x0004, r0
|
350 |
|
|
clr r11
|
351 |
|
|
clr r11
|
352 |
|
|
jmp end_const_r0
|
353 |
|
|
clr r11
|
354 |
|
|
clr r11
|
355 |
|
|
end_const_r0:
|
356 |
|
|
|
357 |
|
|
mov #0x0202, r10
|
358 |
|
|
mov #0x4444, &0x0210 ;# Initialize Memory
|
359 |
|
|
mov #0x5555, &0x0212
|
360 |
|
|
mov #0x6666, &0x0214
|
361 |
|
|
mov #0x7777, &0x0216
|
362 |
|
|
mov #0x8888, &0x0218
|
363 |
|
|
mov #0x9999, &0x021A
|
364 |
|
|
add #0x0000, 14(r10) ;# Move 0x4444+0 to memory @0x210
|
365 |
|
|
add #0x0001, 16(r10) ;# Move 0x5555+1 to memory @0x212
|
366 |
|
|
add #0x0002, 18(r10) ;# Move 0x6666+2 to memory @0x214
|
367 |
|
|
add #0x0004, 20(r10) ;# Move 0x7777+4 to memory @0x216
|
368 |
|
|
add #0x0008, 22(r10) ;# Move 0x8888+8 to memory @0x218
|
369 |
|
|
add #0xffff, 24(r10) ;# Move 0x9999-1 to memory @0x21A
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
mov #0x4444, &0x0220 ;# Initialize Memory
|
373 |
|
|
mov #0x5555, &0x0222
|
374 |
|
|
mov #0x6666, &0x0224
|
375 |
|
|
mov #0x7777, &0x0226
|
376 |
|
|
mov #0x8888, &0x0228
|
377 |
|
|
mov #0x9999, &0x022A
|
378 |
|
|
add #0x0000, CONST_EDE0 ;# Move 0x4444+0 to memory @0x220
|
379 |
|
|
add #0x0001, CONST_EDE1 ;# Move 0x5555+1 to memory @0x222
|
380 |
|
|
add #0x0002, CONST_EDE2 ;# Move 0x6666+2 to memory @0x224
|
381 |
|
|
add #0x0004, CONST_EDE4 ;# Move 0x7777+4 to memory @0x226
|
382 |
|
|
add #0x0008, CONST_EDE8 ;# Move 0x8888+8 to memory @0x228
|
383 |
|
|
add #0xffff, CONST_EDEm1 ;# Move 0x9999-1 to memory @0x22A
|
384 |
|
|
|
385 |
|
|
mov #0x4444, &0x0230 ;# Initialize Memory
|
386 |
|
|
mov #0x5555, &0x0232
|
387 |
|
|
mov #0x6666, &0x0234
|
388 |
|
|
mov #0x7777, &0x0236
|
389 |
|
|
mov #0x8888, &0x0238
|
390 |
|
|
mov #0x9999, &0x023A
|
391 |
|
|
add #0x0000, &CONST_TONY0 ;# Move 0x4444+0 to memory @0x230
|
392 |
|
|
add #0x0001, &CONST_TONY1 ;# Move 0x5555+1 to memory @0x232
|
393 |
|
|
add #0x0002, &CONST_TONY2 ;# Move 0x6666+2 to memory @0x234
|
394 |
|
|
add #0x0004, &CONST_TONY4 ;# Move 0x7777+4 to memory @0x236
|
395 |
|
|
add #0x0008, &CONST_TONY8 ;# Move 0x8888+8 to memory @0x238
|
396 |
|
|
add #0xffff, &CONST_TONYm1 ;# Move 0x9999-1 to memory @0x23A
|
397 |
|
|
|
398 |
|
|
mov #0x9000, r15
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
/* ------------------------------ TEST FLAGS ---------------------- */
|
402 |
|
|
|
403 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=0
|
404 |
|
|
mov #0x0444, r4 ;#
|
405 |
|
|
mov #0x0555, r5 ;#
|
406 |
|
|
add r4, r5 ;# Add r4+r5 (0x0444+0x0555=0x0999)
|
407 |
|
|
mov #0xA000, r15
|
408 |
|
|
|
409 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=1
|
410 |
|
|
mov #0x0011, r4 ;#
|
411 |
|
|
mov #0xfff0, r5 ;#
|
412 |
|
|
add r4, r5 ;# Add r4+r5 (0xfff0+0x0011=0x0001)
|
413 |
|
|
mov #0xA001, r15
|
414 |
|
|
|
415 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=1, C=0
|
416 |
|
|
mov #0x0000, r4 ;#
|
417 |
|
|
mov #0x0000, r5 ;#
|
418 |
|
|
add r4, r5 ;# Add r4+r5 (0x0000+0x0000=0x0000)
|
419 |
|
|
mov #0xA002, r15
|
420 |
|
|
|
421 |
|
|
mov #0x0000, r2 ;# V=0, N=1, Z=0, C=0
|
422 |
|
|
mov #0xff00, r4 ;#
|
423 |
|
|
mov #0x0010, r5 ;#
|
424 |
|
|
add r4, r5 ;# Add r4+r5 (0xff00+0x0010=0xff10)
|
425 |
|
|
mov #0xA003, r15
|
426 |
|
|
|
427 |
|
|
mov #0x0000, r2 ;# V=1, N=1, Z=0, C=0
|
428 |
|
|
mov #0x7fff, r4 ;#
|
429 |
|
|
mov #0x0010, r5 ;#
|
430 |
|
|
add r4, r5 ;# Add r4+r5 (0x7fff+0x0010=0x800f)
|
431 |
|
|
mov #0xA004, r15
|
432 |
|
|
|
433 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=0, C=1
|
434 |
|
|
mov #0xff00, r4 ;#
|
435 |
|
|
mov #0x8000, r5 ;#
|
436 |
|
|
add r4, r5 ;# Add r4+r5 (0xff00+0x8000=0x7f00)
|
437 |
|
|
mov #0xA005, r15
|
438 |
|
|
|
439 |
|
|
/* ---------------- TEST WHEN SOURCE IS CONSTANT IN BYTE MODE ------ */
|
440 |
|
|
#
|
441 |
|
|
# NOTE: The following section would not fit in the smallest ROM
|
442 |
|
|
# configuration for the "two-op_add-b.s43" pattern.
|
443 |
|
|
# It is therefore executed here.
|
444 |
|
|
#
|
445 |
|
|
.set CONSTL_TONY0, 0x0250
|
446 |
|
|
.set CONSTL_TONY1, 0x0252
|
447 |
|
|
.set CONSTL_TONY2, 0x0254
|
448 |
|
|
.set CONSTL_TONY4, 0x0256
|
449 |
|
|
.set CONSTL_TONY8, 0x0258
|
450 |
|
|
.set CONSTL_TONYm1, 0x025A
|
451 |
|
|
.set CONSTH_TONY0, 0x025D
|
452 |
|
|
.set CONSTH_TONY1, 0x025F
|
453 |
|
|
.set CONSTH_TONY2, 0x0261
|
454 |
|
|
.set CONSTH_TONY4, 0x0263
|
455 |
|
|
.set CONSTH_TONY8, 0x0265
|
456 |
|
|
.set CONSTH_TONYm1, 0x0267
|
457 |
|
|
|
458 |
|
|
mov #0xaa44, &0x0250 ;# Initialize Memory
|
459 |
|
|
mov #0xaa55, &0x0252
|
460 |
|
|
mov #0xaa66, &0x0254
|
461 |
|
|
mov #0xaa77, &0x0256
|
462 |
|
|
mov #0xaa35, &0x0258
|
463 |
|
|
mov #0xaa99, &0x025A
|
464 |
|
|
mov #0xaa55, &0x025C
|
465 |
|
|
mov #0xbb55, &0x025E
|
466 |
|
|
mov #0xcc55, &0x0260
|
467 |
|
|
mov #0xdd55, &0x0262
|
468 |
|
|
mov #0xee55, &0x0264
|
469 |
|
|
mov #0x3355, &0x0266
|
470 |
|
|
|
471 |
|
|
add.b #0x0000, &CONSTL_TONY0 ;# Move +0 to memory @0x250
|
472 |
|
|
add.b #0x0001, &CONSTL_TONY1 ;# Move +1 to memory @0x252
|
473 |
|
|
add.b #0x0002, &CONSTL_TONY2 ;# Move +2 to memory @0x254
|
474 |
|
|
add.b #0x0004, &CONSTL_TONY4 ;# Move +4 to memory @0x256
|
475 |
|
|
add.b #0x0008, &CONSTL_TONY8 ;# Move +8 to memory @0x258
|
476 |
|
|
add.b #0xffff, &CONSTL_TONYm1 ;# Move -1 to memory @0x25A
|
477 |
|
|
add.b #0x0000, &CONSTH_TONY0 ;# Move +0 to memory @0x25D
|
478 |
|
|
add.b #0x0001, &CONSTH_TONY1 ;# Move +1 to memory @0x25F
|
479 |
|
|
add.b #0x0002, &CONSTH_TONY2 ;# Move +2 to memory @0x261
|
480 |
|
|
add.b #0x0004, &CONSTH_TONY4 ;# Move +4 to memory @0x263
|
481 |
|
|
add.b #0x0008, &CONSTH_TONY8 ;# Move +8 to memory @0x265
|
482 |
|
|
add.b #0xffff, &CONSTH_TONYm1 ;# Move -1 to memory @0x267
|
483 |
|
|
|
484 |
|
|
mov #0xB000, r15
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
/* ------------------ TEST FLAGS IN BYTE MODE --------------------- */
|
488 |
|
|
|
489 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=0
|
490 |
|
|
mov #0xaa04, r4 ;#
|
491 |
|
|
mov #0x6605, r5 ;#
|
492 |
|
|
add.b r4, r5 ;# Add r4+r5 (0xaa04+0x6605=0x0009)
|
493 |
|
|
mov #0xC000, r15
|
494 |
|
|
|
495 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=1
|
496 |
|
|
mov #0xaa11, r4 ;#
|
497 |
|
|
mov #0x66f0, r5 ;#
|
498 |
|
|
add.b r4, r5 ;# Add r4+r5 (0x0011+0x00f0=0x0001)
|
499 |
|
|
mov #0xC001, r15
|
500 |
|
|
|
501 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=1, C=0
|
502 |
|
|
mov #0xaa00, r4 ;#
|
503 |
|
|
mov #0x6600, r5 ;#
|
504 |
|
|
add.b r4, r5 ;# Add r4+r5 (0x0000+0x0000=0x0000)
|
505 |
|
|
mov #0xC002, r15
|
506 |
|
|
|
507 |
|
|
mov #0x0000, r2 ;# V=0, N=1, Z=0, C=0
|
508 |
|
|
mov #0xaaf0, r4 ;#
|
509 |
|
|
mov #0x6603, r5 ;#
|
510 |
|
|
add.b r4, r5 ;# Add r4+r5 (0x00f0+0x0003=0x00f3)
|
511 |
|
|
mov #0xC003, r15
|
512 |
|
|
|
513 |
|
|
mov #0x0000, r2 ;# V=1, N=1, Z=0, C=0
|
514 |
|
|
mov #0x007f, r4 ;#
|
515 |
|
|
mov #0x0010, r5 ;#
|
516 |
|
|
add.b r4, r5 ;# Add r4+r5 (0x007f+0x0010=0x008f)
|
517 |
|
|
mov #0xC004, r15
|
518 |
|
|
|
519 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=0, C=1
|
520 |
|
|
mov #0x00ff, r4 ;#
|
521 |
|
|
mov #0x0080, r5 ;#
|
522 |
|
|
add.b r4, r5 ;# Add r4+r5 (0x00ff+0x0080=0x007f)
|
523 |
|
|
mov #0xC005, r15
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
/* ---------------------- END OF TEST --------------- */
|
528 |
|
|
mov #0xD000, r15
|
529 |
|
|
end_of_test:
|
530 |
|
|
nop
|
531 |
|
|
br #0xffff
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
/* ---------------------- INTERRUPT VECTORS --------------- */
|
535 |
|
|
|
536 |
|
|
.section .vectors, "a"
|
537 |
|
|
.word end_of_test ; Interrupt 0 (lowest priority)
|
538 |
|
|
.word end_of_test ; Interrupt 1
|
539 |
|
|
.word end_of_test ; Interrupt 2
|
540 |
|
|
.word end_of_test ; Interrupt 3
|
541 |
|
|
.word end_of_test ; Interrupt 4
|
542 |
|
|
.word end_of_test ; Interrupt 5
|
543 |
|
|
.word end_of_test ; Interrupt 6
|
544 |
|
|
.word end_of_test ; Interrupt 7
|
545 |
|
|
.word end_of_test ; Interrupt 8
|
546 |
|
|
.word end_of_test ; Interrupt 9
|
547 |
|
|
.word end_of_test ; Interrupt 10 Watchdog timer
|
548 |
|
|
.word end_of_test ; Interrupt 11
|
549 |
|
|
.word end_of_test ; Interrupt 12
|
550 |
|
|
.word end_of_test ; Interrupt 13
|
551 |
|
|
.word end_of_test ; Interrupt 14 NMI
|
552 |
|
|
.word main ; Interrupt 15 (highest priority) RESET
|