OpenCores
URL https://opencores.org/ocsvn/light8080/light8080/trunk

Subversion Repositories light8080

[/] [light8080/] [trunk/] [sw/] [tb/] [tb0/] [tb0.asm] - Blame information for rev 78

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 74 ja_rd
;***********************************************************************
2
; MICROCOSM ASSOCIATES  8080/8085 CPU DIAGNOSTIC VERSION 1.0  (C) 1980
3
;***********************************************************************
4
;
5
;DONATED TO THE "SIG/M" CP/M USER'S GROUP BY:
6
;KELLY SMITH, MICROCOSM ASSOCIATES
7
;3055 WACO AVENUE
8
;SIMI VALLEY, CALIFORNIA, 93065
9
;(805) 527-9321 (MODEM, CP/M-NET (TM))
10
;(805) 527-0518 (VERBAL)
11
;
12
;***********************************************************************
13
; Modified 2001/02/28 by Richard Cini for use in the Altair32 Emulator
14
;       Project
15
;
16
; Need to somehow connect this code to Windows so that failure messages
17
;       can be posted to Windows. Maybe just store error code in
18
;       Mem[0xffff]. Maybe trap NOP in the emulator code?
19
;
20
;***********************************************************************
21
; Modified 2006/11/16 by Scott Moore to work on CPU8080 FPGA core
22
;
23
;***********************************************************************
24
; Modified 2007/09/24 by Jose Ruiz for use in light8080 FPGA core
25
;
26
; 1.- Changed formatting for compatibility to CP/M's ASM
27
; 2.- Commented out all Altair / MITS hardware related stuff
28
; 3.- Set origin at 0H
29
;
30
; Modified again in 2008 to make it compatible with TASM assembler.
31
;
32
; Modified 2012/02/12 to add a few CY checks.
33
; Flags go almost completely unchecked in this test.
34
;***********************************************************************
35
 
36
; DS pseudo-directive; reserve space in bytes, without initializing it
37
; (TASM does not have a DS directive)
38
#define ds(n)    \.org $+n
39
 
40
;
41
; Select controller defines
42
;
43
;selmain: equ    00H             ; offset of main control register
44
;sel1msk: equ    02H             ; offset of select 1 mask
45
;sel1cmp: equ    03H             ; offset of select 1 compare
46
;sel2msk: equ    04H             ; offset of select 1 mask
47
;sel2cmp: equ    05H             ; offset of select 1 compare
48
;sel3msk: equ    06H             ; offset of select 1 mask
49
;sel3cmp: equ    07H             ; offset of select 1 compare
50
;sel4msk: equ    08H             ; offset of select 1 mask
51
;sel4cmp: equ    09H             ; offset of select 1 compare
52
;
53
; bits
54
;
55
;selenb:  equ    01H             ; enable select
56
;selio:   equ    02H             ; I/O address or memory
57
 
58
;
59
; Note: select 1 is ROM, 2, is RAM, 3 is interrupt controller, 4 is serial I/O.
60
;
61
 
62
;
63
; Where to place ROM and RAM for this test
64
;
65
;rombas: equ     0000H
66
;rambas: equ     rombas+4*1024
67
;
68
; Interrupt controller defines
69
;
70
;intbas: equ     10H
71
;intmsk: equ     intbas+00H      ; mask
72
;intsts: equ     intbas+01H      ; status
73
;intact: equ     intbas+02H      ; active interrupt
74
;intpol: equ     intbas+03H      ; polarity select
75
;intedg: equ     intbas+04H      ; edge/level select
76
;intvec: equ     intbas+05H      ; vector base page
77
;
78
; Mits Serial I/O card
79
;
80
;siobas: equ     20H
81
;sioctl: equ     siobas+00H      ; control register
82
;siodat: equ     siobas+01H      ; data
83
 
84
;
85
; Set up selectors
86
;
87
 
88
;
89
; ROM
90
;
91
;        mvi     a,rombas shr 8  ; enable select 1 to 4kb at base
92
;        out     sel1cmp
93
;        mvi     a,(0f000H shr 8) or selenb
94
;        out     sel1msk
95
;
96
; RAM
97
;
98
;        mvi     a,rambas shr 8  ; enable select 2 to 1kb at base
99
;        out     sel2cmp
100
;        mvi     a,(0fc00H shr 8) or selenb
101
;        out     sel2msk
102
;
103
; ROM and RAM set up, exit bootstrap mode
104
;
105
;        mvi     a,00H           ; exit bootstrap mode
106
;        out     selmain
107
;
108
; Serial I/O
109
;
110
;        mvi     a,siobas        ; enable serial controller for 4 addresses
111
;        out     sel4cmp
112
;        mvi     a,0fcH or selio or selenb
113
;        out     sel4msk
114
 
115
;************************************************************
116
;                8080/8085 CPU TEST/DIAGNOSTIC
117
;************************************************************
118
;
119
;note: (1) program assumes "call",and "lxi sp" instructions work;
120
;
121
;      (2) instructions not tested are "hlt","di","ei",
122
;          and "rst 0" thru "rst 7"
123
;
124
;
125
;
126
;test jump instructions and flags
127
;
128
        .org    0H
129
 
130
cpu:    lxi     sp,stack ;set the stack pointer
131
        mvi     a,077H  ;@ initialize A to remove X values from simulation
132
        ani     0       ;initialize a reg. and clear all flags
133
        jz      j010    ;test "jz"
134
        call    cpuer
135
j010:   jnc     j020    ;test "jnc"
136
        call    cpuer
137
j020:   jpe     j030    ;test "jpe"
138
        call    cpuer
139
j030:   jp      j040    ;test "jp"
140
        call    cpuer
141
j040:   jnz     j050    ;test "jnz"
142
        jc      j050    ;test "jc"
143
        jpo     j050    ;test "jpo"
144
        jm      j050    ;test "jm"
145
        jmp     j060    ;test "jmp" (it's a little late,but what the hell;
146
j050:   call    cpuer
147
j060:   adi     6       ;a=6,c=0,p=1,s=0,z=0
148
        jnz     j070    ;test "jnz"
149
        call    cpuer
150
j070:   jc      j080    ;test "jc"
151
        jpo     j080    ;test "jpo"
152
        jp      j090    ;test "jp"
153
j080:   call    cpuer
154
j090:   adi     70H     ;a=76h,c=0,p=0,s=0,z=0
155
        jpo     j100    ;test "jpo"
156
        call    cpuer
157
j100:   jm      j110    ;test "jm"
158
        jz      j110    ;test "jz"
159
        jnc     j120    ;test "jnc"
160
j110:   call    cpuer
161
j120:   adi     81H     ;a=f7h,c=0,p=0,s=1,z=0
162
        jm      j130    ;test "jm"
163
        call    cpuer
164
j130:   jz      j140    ;test "jz"
165
        jc      j140    ;test "jc"
166
        jpo     j150    ;test "jpo"
167
j140:   call    cpuer
168
j150:   adi     0feH    ;a=f5h,c=1,p=1,s=1,z=0
169
        jc      j160    ;test "jc"
170
        call    cpuer
171
j160:   jz      j170    ;test "jz"
172
        jpo     j170    ;test "jpo"
173
        jm      aimm    ;test "jm"
174
j170:   call    cpuer
175
;
176
;
177
;
178
;test accumulator immediate instructions
179
;
180
aimm:   cpi     0       ;a=f5h,c=0,z=0
181
        jc      cpie    ;test "cpi" for re-set carry
182
        jz      cpie    ;test "cpi" for re-set zero
183
        cpi     0f5H    ;a=f5h,c=0,z=1
184
        jc      cpie    ;test "cpi" for re-set carry ("adi")
185
        jnz     cpie    ;test "cpi" for re-set zero
186
        cpi     0ffH    ;a=f5h,c=1,z=0
187
        jz      cpie    ;test "cpi" for re-set zero
188
        jc      acii    ;test "cpi" for set carry
189
cpie:   call    cpuer
190
acii:   aci     00aH    ;a=f5h+0ah+carry(1)=0,c=1
191
        aci     00aH    ;a=0+0ah+carry(0)=0bh,c=0
192
        cpi     00bH
193
        jz      suii    ;test "aci"
194
        call    cpuer
195
suii:   sui     00cH    ;a=ffh,c=0
196
        sui     00fH    ;a=f0h,c=1
197
        cpi     0f0H
198
        jz      sbii    ;test "sui"
199
        call    cpuer
200
sbii:   sbi     0f1H    ;a=f0h-0f1h-carry(0)=ffh,c=1
201
        sbi     0eH    ;a=ffh-oeh-carry(1)=f0h,c=0
202
        cpi     0f0H
203
        jz      anii    ;test "sbi"
204
        call    cpuer
205
anii:   ani     055H    ;a=f0h55h=50h,c=0,p=1,s=0,z=0
206
        cc      cpuer
207
        cz      cpuer
208
        cpi     050H
209
        jz      orii    ;test "ani"
210
        call    cpuer
211
orii:   ori     03aH    ;a=50h3ah=7ah,c=0,p=0,s=0,z=0
212
        cc      cpuer
213
        cz      cpuer
214
        cpi     07aH
215
        jz      xrii    ;test "ori"
216
        call    cpuer
217
xrii:   xri     00fH    ;a=7ah0fh=75h,c=0,p=0,s=0,z=0
218
        cc      cpuer
219
        cz      cpuer
220
        cpi     075H
221
        jz      c010    ;test "xri"
222
        call    cpuer
223
;
224
;
225
;
226
;test calls and returns
227
;
228
c010:   ani     0H      ;a=0,c=0,p=1,s=0,z=1
229
        cc      cpuer   ;test "cc"
230
        cpo     cpuer   ;test "cpo"
231
        cm      cpuer   ;test "cm"
232
        cnz     cpuer   ;test "cnz"
233
        cpi     0H
234
        jz      c020    ;a=0,c=0,p=0,s=0,z=1
235
        call    cpuer
236
c020:   sui     077H    ;a=89h,c=1,p=0,s=1,z=0
237
        cnc     cpuer   ;test "cnc"
238
        cpe     cpuer   ;test "cpe"
239
        cp      cpuer   ;test "cp"
240
        cz      cpuer   ;test "cz"
241
        cpi     089H
242
        jz      c030    ;test for "calls" taking branch
243
        call    cpuer
244
c030:   ani     0ffH    ;set flags back;
245
        cpo     cpoi    ;test "cpo"
246
        cpi     0d9H
247
        jz      movi    ;test "call" sequence success
248
        call    cpuer
249
cpoi:   rpe             ;test "rpe"
250
        adi     010H    ;a=99h,c=0,p=0,s=1,z=0
251
        cpe     cpei    ;test "cpe"
252
        adi     002H    ;a=d9h,c=0,p=0,s=1,z=0
253
        rpo             ;test "rpo"
254
        call    cpuer
255
cpei:   rpo             ;test "rpo"
256
        adi     020H    ;a=b9h,c=0,p=0,s=1,z=0
257
        cm      cmi     ;test "cm"
258
        adi     004H    ;a=d7h,c=0,p=1,s=1,z=0
259
        rpe             ;test "rpe"
260
        call    cpuer
261
cmi:    rp              ;test "rp"
262
        adi     080H    ;a=39h,c=1,p=1,s=0,z=0
263
        cp      tcpi    ;test "cp"
264
        adi     080H    ;a=d3h,c=0,p=0,s=1,z=0
265
        rm              ;test "rm"
266
        call    cpuer
267
tcpi:   rm              ;test "rm"
268
        adi     040H    ;a=79h,c=0,p=0,s=0,z=0
269
        cnc     cnci    ;test "cnc"
270
        adi     040H    ;a=53h,c=0,p=1,s=0,z=0
271
        rp              ;test "rp"
272
        call    cpuer
273
cnci:   rc              ;test "rc"
274
        adi     08fH    ;a=08h,c=1,p=0,s=0,z=0
275
        cc      cci     ;test "cc"
276
        sui     002H    ;a=13h,c=0,p=0,s=0,z=0
277
        rnc             ;test "rnc"
278
        call    cpuer
279
cci:    rnc             ;test "rnc"
280
        adi     0f7H    ;a=ffh,c=0,p=1,s=1,z=0
281
        cnz     cnzi    ;test "cnz"
282
        adi     0feH    ;a=15h,c=1,p=0,s=0,z=0
283
        rc              ;test "rc"
284
        call    cpuer
285
cnzi:   rz              ;test "rz"
286
        adi     001H    ;a=00h,c=1,p=1,s=0,z=1
287
        cz      czi     ;test "cz"
288
        adi     0d0H    ;a=17h,c=1,p=1,s=0,z=0
289
        rnz             ;test "rnz"
290
        call    cpuer
291
czi:    rnz             ;test "rnz"
292
        adi     047H    ;a=47h,c=0,p=1,s=0,z=0
293
        cpi     047H    ;a=47h,c=0,p=1,s=0,z=1
294
        rz              ;test "rz"
295
        call    cpuer
296
;
297
;
298
;
299
;test "mov","inr",and "dcr" instructions
300
;
301
movi:   mvi     a,077H
302
        inr     a
303
        mov     b,a
304
        inr     b
305
        mov     c,b
306
        dcr     c
307
        mov     d,c
308
        mov     e,d
309
        mov     h,e
310
        mov     l,h
311
        mov     a,l     ;test "mov" a,l,h,e,d,c,b,a
312
        dcr     a
313
        mov     c,a
314
        mov     e,c
315
        mov     l,e
316
        mov     b,l
317
        mov     d,b
318
        mov     h,d
319
        mov     a,h     ;test "mov" a,h,d,b,l,e,c,a
320
        mov     d,a
321
        inr     d
322
        mov     l,d
323
        mov     c,l
324
        inr     c
325
        mov     h,c
326
        mov     b,h
327
        dcr     b
328
        mov     e,b
329
        mov     a,e     ;test "mov" a,e,b,h,c,l,d,a
330
        mov     e,a
331
        inr     e
332
        mov     b,e
333
        mov     h,b
334
        inr     h
335
        mov     c,h
336
        mov     l,c
337
        mov     d,l
338
        dcr     d
339
        mov     a,d     ;test "mov" a,d,l,c,h,b,e,a
340
        mov     h,a
341
        dcr     h
342
        mov     d,h
343
        mov     b,d
344
        mov     l,b
345
        inr     l
346
        mov     e,l
347
        dcr     e
348
        mov     c,e
349
        mov     a,c     ;test "mov" a,c,e,l,b,d,h,a
350
        mov     l,a
351
        dcr     l
352
        mov     h,l
353
        mov     e,h
354
        mov     d,e
355
        mov     c,d
356
        mov     b,c
357
        mov     a,b
358
        cpi     077H
359
        cnz     cpuer   ;test "mov" a,b,c,d,e,h,l,a
360
;
361
;
362
;
363
;test arithmetic and logic instructions
364
;
365
        xra     a
366
        mvi     b,001H
367
        mvi     c,003H
368
        mvi     d,007H
369
        mvi     e,00fH
370
        mvi     h,01fH
371
        mvi     l,03fH
372
        add     b
373
        add     c
374
        add     d
375
        add     e
376
        add     h
377
        add     l
378
        add     a
379
        cpi     0f0H
380
        cnz     cpuer   ;test "add" b,c,d,e,h,l,a
381
        sub     b
382
        sub     c
383
        sub     d
384
        sub     e
385
        sub     h
386
        sub     l
387
        cpi     078H
388
        cnz     cpuer   ;test "sub" b,c,d,e,h,l
389
        sub     a
390
        cnz     cpuer   ;test "sub" a
391
        mvi     a,080H
392
        add     a
393
        mvi     b,001H
394
        mvi     c,002H
395
        mvi     d,003H
396
        mvi     e,004H
397
        mvi     h,005H
398
        mvi     l,006H
399
        adc     b
400
        mvi     b,080H
401
        add     b
402
        add     b
403
        adc     c
404
        add     b
405
        add     b
406
        adc     d
407
        add     b
408
        add     b
409
        adc     e
410
        add     b
411
        add     b
412
        adc     h
413
        add     b
414
        add     b
415
        adc     l
416
        add     b
417
        add     b
418
        adc     a
419
        cpi     037H
420
        cnz     cpuer   ;test "adc" b,c,d,e,h,l,a
421
        mvi     a,080H
422
        add     a
423
        mvi     b,001H
424
        sbb     b
425
        mvi     b,0ffH
426
        add     b
427
        sbb     c
428
        add     b
429
        sbb     d
430
        add     b
431
        sbb     e
432
        add     b
433
        sbb     h
434
        add     b
435
        sbb     l
436
        cpi     0e0H
437
        cnz     cpuer   ;test "sbb" b,c,d,e,h,l
438
        mvi     a,080H
439
        add     a
440
        sbb     a
441
        cpi     0ffH
442
        cnz     cpuer   ;test "sbb" a
443
        mvi     a,0ffH
444
        mvi     b,0feH
445
        mvi     c,0fcH
446
        mvi     d,0efH
447
        mvi     e,07fH
448
        mvi     h,0f4H
449
        mvi     l,0bfH
450
        stc
451
        ana     a
452
        cc      cpuer
453
        ana     c
454
        ana     d
455
        ana     e
456
        ana     h
457
        ana     l
458
        ana     a
459
        cpi     024H
460
        cnz     cpuer   ;test "ana" b,c,d,e,h,l,a
461
        xra     a
462
        mvi     b,001H
463
        mvi     c,002H
464
        mvi     d,004H
465
        mvi     e,008H
466
        mvi     h,010H
467
        mvi     l,020H
468
        stc
469
        ora     b
470
        cc      cpuer
471
        ora     c
472
        ora     d
473
        ora     e
474
        ora     h
475
        ora     l
476
        ora     a
477
        cpi     03fH
478
        cnz     cpuer   ;test "ora" b,c,d,e,h,l,a
479
        mvi     a,0H
480
        mvi     h,08fH
481
        mvi     l,04fH
482
        stc
483
        xra     b
484
        cc      cpuer
485
        xra     c
486
        xra     d
487
        xra     e
488
        xra     h
489
        xra     l
490
        cpi     0cfH
491
        cnz     cpuer   ;test "xra" b,c,d,e,h,l
492
        xra     a
493
        cnz     cpuer   ;test "xra" a
494
        mvi     b,044H
495
        mvi     c,045H
496
        mvi     d,046H
497
        mvi     e,047H
498
        mvi     h,temp0 / 0ffH        ;high byte of test memory location
499
        mvi     l,temp0 & 0ffH        ;low byte of test memory location
500
        mov     m,b
501
        mvi     b,0H
502
        mov     b,m
503
        mvi     a,044H
504
        cmp     b
505
        cnz     cpuer   ;test "mov" m,b and b,m
506
        mov     m,d
507
        mvi     d,0H
508
        mov     d,m
509
        mvi     a,046H
510
        cmp     d
511
        cnz     cpuer   ;test "mov" m,d and d,m
512
        mov     m,e
513
        mvi     e,0H
514
        mov     e,m
515
        mvi     a,047H
516
        cmp     e
517
        cnz     cpuer   ;test "mov" m,e and e,m
518
        mov     m,h
519
        mvi     h,temp0 / 0ffH
520
        mvi     l,temp0 & 0ffH
521
        mov     h,m
522
        mvi     a,temp0 / 0ffH
523
        cmp     h
524
        cnz     cpuer   ;test "mov" m,h and h,m
525
        mov     m,l
526
        mvi     h,temp0 / 0ffH
527
        mvi     l,temp0 & 0ffH
528
        mov     l,m
529
        mvi     a,temp0 & 0ffH
530
        cmp     l
531
        cnz     cpuer   ;test "mov" m,l and l,m
532
        mvi     h,temp0 / 0ffH
533
        mvi     l,temp0 & 0ffH
534
        mvi     a,032H
535
        mov     m,a
536
        cmp     m
537
        cnz     cpuer   ;test "mov" m,a
538
        add     m
539
        cpi     064H
540
        cnz     cpuer   ;test "add" m
541
        xra     a
542
        mov     a,m
543
        cpi     032H
544
        cnz     cpuer   ;test "mov" a,m
545
        mvi     h,temp0 / 0ffH
546
        mvi     l,temp0 & 0ffH
547
        mov     a,m
548
        sub     m
549
        cnz     cpuer   ;test "sub" m
550
        mvi     a,080H
551
        add     a
552
        adc     m
553
        cpi     033H
554
        cnz     cpuer   ;test "adc" m
555
        mvi     a,080H
556
        add     a
557
        sbb     m
558
        cpi     0cdH
559
        cnz     cpuer   ;test "sbb" m
560
        stc
561
        ana     m
562
        cc      cpuer
563
        cnz     cpuer   ;test "ana" m
564
        mvi     a,025H
565
        stc
566
        ora     m
567
        cc      cpuer
568
        cpi     37H
569
        cnz     cpuer   ;test "ora" m
570
        stc
571
        xra     m
572
        cc      cpuer
573
        cpi     005H
574
        cnz     cpuer   ;test "xra" m
575
        mvi     m,055H
576
        inr     m
577
        dcr     m
578
        add     m
579
        cpi     05aH
580
        cnz     cpuer   ;test "inr","dcr",and "mvi" m
581
        lxi     b,12ffH
582
        lxi     d,12ffH
583
        lxi     h,12ffH
584
        inx     b
585
        inx     d
586
        inx     h
587
        mvi     a,013H
588
        cmp     b
589
        cnz     cpuer   ;test "lxi" and "inx" b
590
        cmp     d
591
        cnz     cpuer   ;test "lxi" and "inx" d
592
        cmp     h
593
        cnz     cpuer   ;test "lxi" and "inx" h
594
        mvi     a,0H
595
        cmp     c
596
        cnz     cpuer   ;test "lxi" and "inx" b
597
        cmp     e
598
        cnz     cpuer   ;test "lxi" and "inx" d
599
        cmp     l
600
        cnz     cpuer   ;test "lxi" and "inx" h
601
        dcx     b
602
        dcx     d
603
        dcx     h
604
        mvi     a,012H
605
        cmp     b
606
        cnz     cpuer   ;test "dcx" b
607
        cmp     d
608
        cnz     cpuer   ;test "dcx" d
609
        cmp     h
610
        cnz     cpuer   ;test "dcx" h
611
        mvi     a,0ffH
612
        cmp     c
613
        cnz     cpuer   ;test "dcx" b
614
        cmp     e
615
        cnz     cpuer   ;test "dcx" d
616
        cmp     l
617
        cnz     cpuer   ;test "dcx" h
618
        sta     temp0
619
        xra     a
620
        lda     temp0
621
        cpi     0ffH
622
        cnz     cpuer   ;test "lda" and "sta"
623
        lhld    tempp
624
        shld    temp0
625
        lda     tempp
626
        mov     b,a
627
        lda     temp0
628
        cmp     b
629
        cnz     cpuer   ;test "lhld" and "shld"
630
        lda     tempp+1
631
        mov     b,a
632
        lda     temp0+1
633
        cmp     b
634
        cnz     cpuer   ;test "lhld" and "shld"
635
        mvi     a,0aaH
636
        sta     temp0
637
        mov     b,h
638
        mov     c,l
639
        xra     a
640
        ldax    b
641
        cpi     0aaH
642
        cnz     cpuer   ;test "ldax" b
643
        inr     a
644
        stax    b
645
        lda     temp0
646
        cpi     0abH
647
        cnz     cpuer   ;test "stax" b
648
        mvi     a,077H
649
        sta     temp0
650
        lhld    tempp
651
        lxi     d,00000H
652
        xchg
653
        xra     a
654
        ldax    d
655
        cpi     077H
656
        cnz     cpuer   ;test "ldax" d and "xchg"
657
        xra     a
658
        add     h
659
        add     l
660
        cnz     cpuer   ;test "xchg"
661
        mvi     a,0ccH
662
        stax    d
663
        lda     temp0
664
        cpi     0ccH
665
        stax    d
666
        lda     temp0
667
        cpi     0ccH
668
        cnz     cpuer   ;test "stax" d
669
        lxi     h,07777H
670
        dad     h
671
        mvi     a,0eeH
672
        cmp     h
673
        cnz     cpuer   ;test "dad" h
674
        cmp     l
675
        cnz     cpuer   ;test "dad" h
676
        lxi     h,05555H
677
        lxi     b,0ffffH
678
        dad     b
679
        mvi     a,055H
680
        cnc     cpuer   ;test "dad" b
681
        cmp     h
682
        cnz     cpuer   ;test "dad" b
683
        mvi     a,054H
684
        cmp     l
685
        cnz     cpuer   ;test "dad" b
686
        lxi     h,0aaaaH
687
        lxi     d,03333H
688
        dad     d
689
        mvi     a,0ddH
690
        cmp     h
691
        cnz     cpuer   ;test "dad" d
692
        cmp     l
693
        cnz     cpuer   ;test "dad" b
694
        stc
695
        cnc     cpuer   ;test "stc"
696
        cmc
697
        cc      cpuer   ;test "cmc
698
        mvi     a,0aaH
699
        cma
700
        cpi     055H
701
        cnz     cpuer   ;test "cma"
702
        ora     a       ;re-set auxiliary carry
703
        daa
704
        cpi     055H
705
        cnz     cpuer   ;test "daa"
706
        mvi     a,088H
707
        add     a
708
        daa
709
        cpi     076H
710
        cnz     cpuer   ;test "daa"
711
        xra     a
712
        mvi     a,0aaH
713
        daa
714
        cnc     cpuer   ;test "daa"
715
        cpi     010H
716
        cnz     cpuer   ;test "daa"
717
        xra     a
718
        mvi     a,09aH
719
        daa
720
        cnc     cpuer   ;test "daa"
721
        cnz     cpuer   ;test "daa"
722
        stc
723
        mvi     a,042H
724
        rlc
725
        cc      cpuer   ;test "rlc" for re-set carry
726
        rlc
727
        cnc     cpuer   ;test "rlc" for set carry
728
        cpi     009H
729
        cnz     cpuer   ;test "rlc" for rotation
730
        rrc
731
        cnc     cpuer   ;test "rrc" for set carry
732
        rrc
733
        cpi     042H
734
        cnz     cpuer   ;test "rrc" for rotation
735
        ral
736
        ral
737
        cnc     cpuer   ;test "ral" for set carry
738
        cpi     008H
739
        cnz     cpuer   ;test "ral" for rotation
740
        rar
741
        rar
742
        cc      cpuer   ;test "rar" for re-set carry
743
        cpi     002H
744
        cnz     cpuer   ;test "rar" for rotation
745
        lxi     b,01234H
746
        lxi     d,0aaaaH
747
        lxi     h,05555H
748
        xra     a
749
        push    b
750
        push    d
751
        push    h
752
        push    psw
753
        lxi     b,00000H
754
        lxi     d,00000H
755
        lxi     h,00000H
756
        mvi     a,0c0H
757
        adi     0f0H
758
        pop     psw
759
        pop     h
760
        pop     d
761
        pop     b
762
        cc      cpuer   ;test "push psw" and "pop psw"
763
        cnz     cpuer   ;test "push psw" and "pop psw"
764
        cpo     cpuer   ;test "push psw" and "pop psw"
765
        cm      cpuer   ;test "push psw" and "pop psw"
766
        mvi     a,012H
767
        cmp     b
768
        cnz     cpuer   ;test "push b" and "pop b"
769
        mvi     a,034H
770
        cmp     c
771
        cnz     cpuer   ;test "push b" and "pop b"
772
        mvi     a,0aaH
773
        cmp     d
774
        cnz     cpuer   ;test "push d" and "pop d"
775
        cmp     e
776
        cnz     cpuer   ;test "push d" and "pop d"
777
        mvi     a,055H
778
        cmp     h
779
        cnz     cpuer   ;test "push h" and "pop h"
780
        cmp     l
781
        cnz     cpuer   ;test "push h" and "pop h"
782
        lxi     h,00000H
783
        dad     sp
784
        shld    savstk  ;save the "old" stack-pointer;
785
        lxi     sp,temp4
786
        dcx     sp
787
        dcx     sp
788
        inx     sp
789
        dcx     sp
790
        mvi     a,055H
791
        sta     temp2
792
        cma
793
        sta     temp3
794
        pop     b
795
        cmp     b
796
        cnz     cpuer   ;test "lxi","dad","inx",and "dcx" sp
797
        cma
798
        cmp     c
799
        cnz     cpuer   ;test "lxi","dad","inx", and "dcx" sp
800
        lxi     h,temp4
801
        sphl
802
        lxi     h,07733H
803
        dcx     sp
804
        dcx     sp
805
        xthl
806
        lda     temp3
807
        cpi     077H
808
        cnz     cpuer   ;test "sphl" and "xthl"
809
        lda     temp2
810
        cpi     033H
811
        cnz     cpuer   ;test "sphl" and "xthl"
812
        mvi     a,055H
813
        cmp     l
814
        cnz     cpuer   ;test "sphl" and "xthl"
815
        cma
816
        cmp     h
817
        cnz     cpuer   ;test "sphl" and "xthl"
818
        lhld    savstk  ;restore the "old" stack-pointer
819
        sphl
820
        lxi     h,cpuok
821
        pchl            ;test "pchl"
822
 
823
cpuer:  mvi     a, 0aaH ; set exit code (failure)
824
        out     20h
825
        hlt             ; stop here
826
 
827
cpuok:  mvi     a, 55H  ;
828
        out     20h
829
        hlt             ; stop here - no trap
830
 
831
 
832
;
833
; Data area in program space
834
;
835
tempp:  .dw    temp0   ;pointer used to test "lhld","shld",
836
                        ; and "ldax" instructions
837
;
838
; Data area in variable space
839
;
840
temp0:  ds(1)       ;temporary storage for cpu test memory locations
841
temp1:  ds(1)       ;temporary storage for cpu test memory locations
842
temp2:  ds(1)       ;temporary storage for cpu test memory locations
843
temp3:  ds(1)       ;temporary storage for cpu test memory locations
844
temp4:  ds(1)       ;temporary storage for cpu test memory locations
845
savstk: ds(2)       ;temporary stack-pointer storage location
846
 
847
        ds(256)     ;de-bug stack pointer storage area
848
stack:  .dw 0
849
 
850
        .end
851
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.