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

Subversion Repositories cpu8080

[/] [cpu8080/] [trunk/] [project/] [test.asm] - Blame information for rev 24

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

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

powered by: WebSVN 2.1.0

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