57
|
1 ; 6809 Test program.
|
|
2
|
|
3 testnr equ 32
|
|
4
|
|
5 org $100
|
|
6 jmp entry
|
|
7 error ldx #errmsg
|
|
8 bsr outs
|
|
9 lda testnr
|
|
10 bsr outa
|
|
11 ldx #newline
|
|
12 bsr outs
|
|
13 sync
|
|
14
|
|
15 errmsg fcb "ERROR ",0
|
|
16 newline fcb 13,10,0
|
|
17 outs ldb ,x+
|
|
18 beq done1
|
|
19 swi2
|
|
20 bra outs
|
|
21 done1 rts
|
|
22 outdig addb # 48
|
|
23 cmpb # 57
|
|
24 bls od2
|
|
25 addb #7
|
|
26 od2 swi2
|
|
27 rts
|
|
28 outa tfr a,b
|
|
29 lsrb
|
|
30 lsrb
|
|
31 lsrb
|
|
32 lsrb
|
|
33 bsr outdig
|
|
34 tfr a,b
|
|
35 andb # 15
|
|
36 bra outdig
|
|
37 passmsg fcb "PASSED ",0
|
|
38 good ldx #passmsg
|
|
39 jsr outs
|
|
40 lda testnr
|
|
41 jsr outa
|
|
42 ldx #newline
|
|
43 jsr outs
|
|
44 inc testnr
|
|
45 rts
|
|
46
|
|
47 entry clr testnr
|
|
48 jsr good ;test #0, does it print msg?
|
|
49 andcc #0 ;test #1, conditional (long) branches
|
|
50 lbvs error ; andcc, orcc
|
|
51 lbcs error
|
|
52 lbeq error
|
|
53 lbmi error
|
|
54 lbls error
|
|
55 lblt error
|
|
56 lble error
|
|
57 lbrn error
|
|
58 bvs errt1
|
|
59 bcs errt1
|
|
60 beq errt1
|
|
61 bmi errt1
|
|
62 bls errt1
|
|
63 blt errt1
|
|
64 ble errt1
|
|
65 brn errt1
|
|
66 lbvc goot1
|
|
67 errt1 jmp error
|
|
68 goot1 lbcc goot2
|
|
69 jmp error
|
|
70 goot2 lbne goot3
|
|
71 jmp error
|
|
72 goot3 lbpl goot4
|
|
73 jmp error
|
|
74 goot4 lbhi goot5
|
|
75 jmp error
|
|
76 goot5 lbge goot6
|
|
77 jmp error
|
|
78 goot6 lbgt goot7
|
|
79 jmp error
|
|
80 goot7 lbra goot8
|
|
81 jmp error
|
|
82 goot8 bvc goot9
|
|
83 jmp error
|
|
84 goot9 bcc goot10
|
|
85 jmp error
|
|
86 goot10 bne goot11
|
|
87 jmp error
|
|
88 goot11 bpl goot12
|
|
89 jmp error
|
|
90 goot12 bhi goot13
|
|
91 jmp error
|
|
92 goot13 bge goot14
|
|
93 jmp error
|
|
94 goot14 bgt goot15
|
|
95 jmp error
|
|
96 goot15 bra goot16
|
|
97 jmp error
|
|
98 goot16 tfr cc,a
|
|
99 tsta
|
|
100 lbne error
|
|
101 andcc #0
|
|
102 orcc #1
|
|
103 lbcc error
|
|
104 lbeq error
|
|
105 lbvs error
|
|
106 lbmi error
|
|
107 orcc #2
|
|
108 lbvc error
|
|
109 lbeq error
|
|
110 lbmi error
|
|
111 orcc #4
|
|
112 lbne error
|
|
113 lbmi error
|
|
114 orcc #8
|
|
115 lbpl error
|
|
116 tfr cc,a
|
|
117 cmpa #15
|
|
118 lbne error
|
|
119 orcc #15
|
|
120 orcc #240
|
|
121 tfr cc,a
|
|
122 inca
|
|
123 lbne error
|
|
124 orcc #255
|
|
125 andcc #$aa
|
|
126 tfr cc,a
|
|
127 cmpa #$aa
|
|
128 lbne error
|
|
129 jsr good
|
|
130
|
|
131 lds #0 ; test #2: registers and their values, tfr, exg
|
|
132 lda #$28
|
|
133 ldb #$7f
|
|
134 ldu #3417
|
|
135 ldx #2221
|
|
136 ldy #16555
|
|
137 cmpa #$28
|
|
138 lbne error
|
|
139 cmpb #$7f
|
|
140 lbne error
|
|
141 cmpd #$287f
|
|
142 lbne error
|
|
143 cmpx #2221
|
|
144 lbne error
|
|
145 cmpy #13
|
|
146 lbeq error
|
|
147 cmpy #16555
|
|
148 lbne error
|
|
149 cmpu #3417
|
|
150 lbne error
|
|
151 cmps #0
|
|
152 lbne error
|
|
153 exg x,y
|
|
154 cmpx #16555
|
|
155 lbne error
|
|
156 cmpy #2221
|
|
157 lbne error
|
|
158 exg x,d
|
|
159 cmpd #16555
|
|
160 lbne error
|
|
161 cmpx #$287f
|
|
162 lbne error
|
|
163 cmpy #2221
|
|
164 lbne error
|
|
165 exg x,d
|
|
166 exg a,dp
|
|
167 tsta
|
|
168 lbne error
|
|
169 exg a,dp
|
|
170 exg a,b
|
|
171 cmpa #$7f
|
|
172 lbne error
|
|
173 cmpb #$28
|
|
174 lbne error
|
|
175 tfr b,a
|
|
176 cmpb #$28
|
|
177 lbne error
|
|
178 cmpa #$28
|
|
179 lbne error
|
|
180 tfr u,x
|
|
181 cmpu #3417
|
|
182 lbne error
|
|
183 cmpx #3417
|
|
184 lbne error
|
|
185 tfr pc,x
|
|
186 here cmpx #here
|
|
187 lbne error
|
|
188 tfr u,s
|
|
189 cmps #3417
|
|
190 lbne error
|
|
191 lds #0
|
|
192 clra
|
|
193 tfr b,cc
|
|
194 tfr cc,a
|
|
195 cmpa #$28
|
|
196 lbne error
|
|
197 jsr good
|
|
198
|
|
199 lda #128 ;Arithmetic and their status.
|
|
200 adda #255
|
|
201 lbcc error
|
|
202 lbvc error
|
|
203 lbmi error
|
|
204 cmpa #127
|
|
205 lbne error
|
|
206 lda #0
|
|
207 adda #255
|
|
208 lbcs error
|
|
209 lbvs error
|
|
210 lbpl error
|
|
211 cmpa #255
|
|
212 lbne error
|
|
213 orcc #1
|
|
214 lda #255
|
|
215 adca #0
|
|
216 lbne error
|
|
217 lbmi error
|
|
218 lbcc error
|
|
219 lda #216
|
|
220 adda #40
|
|
221 lbne error
|
|
222 lda #80
|
|
223 adda #40
|
|
224 lbcs error
|
|
225 lbvs error
|
|
226 cmpa #120
|
|
227 lbne error
|
|
228 orcc #1
|
|
229 lda #80
|
|
230 adca #40
|
|
231 lbcs error
|
|
232 lbvs error
|
|
233 cmpa #121
|
|
234 lbne error
|
|
235 andcc #254
|
|
236 ldb #80
|
|
237 adcb #40
|
|
238 lbcs error
|
|
239 lbvs error
|
|
240 cmpb #120
|
|
241 lbne error
|
|
242 ldb #80
|
|
243 subb #120
|
|
244 lbcc error
|
|
245 lbvs error
|
|
246 cmpb #216
|
|
247 lbne error
|
|
248 andcc #254
|
|
249 lda #140
|
|
250 sbca #20
|
|
251 lbvc error
|
|
252 lbcs error
|
|
253 cmpa #120
|
|
254 lbne error
|
|
255 orcc #1
|
|
256 lda #140
|
|
257 sbca #20
|
|
258 lbvc error
|
|
259 lbcs error
|
|
260 cmpa #119
|
|
261 lbne error
|
|
262 ldd #40000
|
|
263 subd #20000
|
|
264 lbvc error
|
|
265 lbcs error
|
|
266 cmpd #20000
|
|
267 lbne error
|
|
268 ldd #20000
|
|
269 subd #40000
|
|
270 lbvc error
|
|
271 lbcc error
|
|
272 cmpd #-20000
|
|
273 lbne error
|
|
274 ldd #30000
|
|
275 addd #-20000
|
|
276 lbcc error
|
|
277 lbvs error
|
|
278 cmpd #10000
|
|
279 lbne error
|
|
280 jsr good
|
|
281
|
|
282 lda #$23 ;Test #4 decimal arithmetic.
|
|
283 adda #$34
|
|
284 daa
|
|
285 lbcs error
|
|
286 cmpa #$57
|
|
287 lbne error
|
|
288 orcc #1
|
|
289 lda #$19
|
|
290 adca #$29
|
|
291 daa
|
|
292 lbcs error
|
|
293 cmpa #$49
|
|
294 lbne error
|
|
295 lda #$92
|
|
296 adda #$8
|
|
297 daa
|
|
298 lbcc error
|
|
299 cmpa #$00
|
|
300 jsr good
|
|
301
|
|
302 lda #128 ;Test#5 MUL and SEX
|
|
303 ldb #2
|
|
304 mul
|
|
305 lbeq error
|
|
306 lbcs error
|
|
307 cmpd #256
|
|
308 lbne error
|
|
309 lda #0
|
|
310 ldb #23
|
|
311 mul
|
|
312 lbne error
|
|
313 lbcs error
|
|
314 cmpd #0
|
|
315 lbne error
|
|
316 lda #10
|
|
317 ldb #20
|
|
318 mul
|
|
319 lbcc error
|
|
320 cmpd #200
|
|
321 lbne error
|
|
322 lda #100
|
|
323 ldb #49
|
|
324 mul
|
|
325 cmpd #4900
|
|
326 lbne error
|
|
327 clrb
|
|
328 sex
|
|
329 cmpd #0
|
|
330 lbne error
|
|
331 ldb #128
|
|
332 sex
|
|
333 cmpd #-128
|
|
334 lbne error
|
|
335 ldb #50
|
|
336 sex
|
|
337 cmpd #50
|
|
338 lbne error
|
|
339 jsr good
|
|
340
|
|
341 lda #$55 ; Test #6 Shifts and rotates.
|
|
342 asla
|
|
343 lbcs error
|
|
344 cmpa #$aa
|
|
345 lbne error
|
|
346 asla
|
|
347 lbcc error
|
|
348 cmpa #$54
|
|
349 lbne error
|
|
350 lda #$0
|
|
351 andcc #254
|
|
352 rola
|
|
353 lbne error
|
|
354 orcc #1
|
|
355 rola
|
|
356 deca
|
|
357 lbne error
|
|
358 andcc #254
|
|
359 rora
|
|
360 lbne error
|
|
361 orcc #1
|
|
362 rora
|
|
363 cmpa #128
|
|
364 lbne error
|
|
365 asra
|
|
366 cmpa #192
|
|
367 lbne error
|
|
368 lsra
|
|
369 cmpa #96
|
|
370 lbne error
|
|
371 ldb # 54
|
|
372 aslb
|
|
373 cmpb # 108
|
|
374 lbne error
|
|
375 jsr good
|
|
376
|
|
377 orcc #15 ; Test #7 INC, DEC and NEG
|
|
378 lda # 33
|
|
379 inca
|
|
380 lbeq error
|
|
381 lbvs error
|
|
382 lbcc error
|
|
383 lbmi error
|
|
384 deca
|
|
385 lbeq error
|
|
386 lbvs error
|
|
387 lbcc error
|
|
388 lbmi error
|
|
389 clra
|
|
390 andcc #254
|
|
391 deca
|
|
392 lbcs error
|
|
393 lbpl error
|
|
394 inca
|
|
395 lbne error
|
|
396 ldb #126
|
|
397 negb
|
|
398 lbvs error
|
|
399 lbcc error
|
|
400 cmpb #130
|
|
401 lbne error
|
|
402 decb
|
|
403 decb
|
|
404 negb
|
|
405 lbvc error
|
|
406 cmpb #128
|
|
407 lbne error
|
|
408 clrb
|
|
409 negb
|
|
410 lbcs error
|
|
411 lbne error
|
|
412 jsr good
|
|
413
|
|
414 ;test #8 Addessing modes.
|
|
415 ldx #testdat+4
|
|
416 lda ,x
|
|
417 cmpa #5
|
|
418 lbne error
|
|
419 lda ,x+
|
|
420 cmpa #5
|
|
421 lbne error
|
|
422 cmpx #testdat+5
|
|
423 lbne error
|
|
424 ldd ,x++
|
|
425 cmpd #6*256+7
|
|
426 lbne error
|
|
427 cmpx #testdat+7
|
|
428 lbne error
|
|
429 ldx #testdat+4
|
|
430 lda ,-x
|
|
431 cmpa #4
|
|
432 lbne error
|
|
433 cmpx #testdat+3
|
|
434 lbne error
|
|
435 ldd ,--x
|
|
436 cmpd #2*256+3
|
|
437 lbne error
|
|
438 cmpx #testdat+1
|
|
439 lbne error
|
|
440 ldx #testdat+4
|
|
441 lda -2,x
|
|
442 cmpa #3
|
|
443 lbne error
|
|
444 lda 2,x
|
|
445 cmpa #7
|
|
446 lbne error
|
|
447 ldx #td1
|
|
448 ldd [,x]
|
|
449 cmpd #3*256+4
|
|
450 lbne error
|
|
451 cmpx #td1
|
|
452 lbne error
|
|
453 jsr good
|
|
454 bra next1
|
|
455 testdat fcb 1,2,3,4,5,6,7,8,9,10
|
|
456 td1 fdb testdat+2
|
|
457 next1
|
|
458
|
|
459 sync
|
|
460 end $100
|
|
461
|
|
462
|
|
463
|