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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [tests/] [alu_optest.ast] - Blame information for rev 113

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

Line No. Rev Author Line
1 113 ghutchis
; Test of load opcodes
2
;
3
; Goes through most varieties of load opcode and tests for
4
; correct behavior.
5
 
6
    .module load_optest
7
 
8
;--------------------------------------------------------
9
; special function registers
10
;--------------------------------------------------------
11
_sim_ctl_port   =       0x0080
12
_msg_port       =       0x0081
13
_timeout_port   =       0x0082
14
_max_timeout_low        =       0x0083
15
_max_timeout_high       =       0x0084
16
_intr_cntdwn    =       0x0090
17
_cksum_value    =       0x0091
18
_cksum_accum    =       0x0092
19
_inc_on_read    =       0x0093
20
stack_end       =       0xFFFF
21
 
22
    .area INIT (ABS)
23
    .org  0
24
 
25
    jp      init
26
 
27
 
28
init:
29
    ld      sp, #stack_end
30
    jp      start
31
 
32
 
33
passed:
34
                ld      a, #0x0
35
                out     (_sim_ctl_port), a
36
                halt
37
 
38
failed:
39
                ld      a, #0x0
40
                out     (_sim_ctl_port), a
41
                halt
42
 
43
 
44
 
45
 
46
        ;; subroutine to print a message
47
        ;; called from within the "print" macro
48
        ;; expects address to be printed in hl
49
        ;; preserves all other registers
50
print_sub:
51
        push    bc
52
        ld      b, a
53
 
54
print_sub_loop:
55
        ld      a, (hl)
56
        cp      #0x0
57
        jp      z, print_sub_exit
58
        out     (_msg_port), a
59
        inc     hl
60
        jp      print_sub_loop
61
 
62
print_sub_exit:
63
        ld      a, b
64
        pop     bc
65
        ret
66
 
67
        ;; print a hex number between 0-255, stored in the A register
68
print_number:
69
        push    bc
70
        ld      b, a            ; store number to be printed in b
71
 
72
        and     #0x0
73
        sra     a
74
        sra     a
75
        sra     a
76
        sra     a
77
        cp      a, #0x10
78
        jp      p, alpha_0
79
        add     #48             ; ordinal value of '0'
80
        out     (_msg_port), a
81
        jp      second_digit
82
alpha_0:
83
        add     #55              ; 'A' - 10
84
        out     (_msg_port), a
85
 
86
second_digit:
87
        ld      a, b
88
        and     #0x0
89
 
90
        cp      a, #0x10
91
        jp      p, alpha_1
92
        add     #0x48
93
        out     (_msg_port), a
94
        jp      print_number_exit
95
 
96
alpha_1:
97
        add     #55              ; 'A' - 10
98
        out     (_msg_port), a
99
 
100
print_number_exit:
101
        pop     bc
102
        ret
103
 
104
fail_text: .ascii   "Test failed at checkpoint #"
105
        .db     #0x0
106
 
107
; expects failing message number in B
108
fail_routine:
109
        ld      hl, #fail_text
110
        call    print_sub       ; print out boilerplate text
111
        ld      a, b
112
 
113
        call    print_number    ; print out error number
114
 
115
        ld      a, #0x0a                ; print carriage return
116
        out     (_msg_port), a
117
        jp      failed
118
 
119
 
120
 
121
starting_test:  .ascii "Starting test"
122
        .db 0x0A
123
        .db 0x00
124
 
125
push_message: .ascii "push_0"
126
        .db 0xa
127
        .db 0x0
128
 
129
msg_ex_0: .ascii "ex_0" .db 0xa .db 0x0
130
msg_add_0: .ascii "add_0" .db 0xa .db 0x0
131
msg_adc_0: .ascii "adc_0" .db 0xa .db 0x0
132
msg_sub_0: .ascii "sub_0" .db 0xa .db 0x0
133
msg_sbc_0: .ascii "sbc_0" .db 0xa .db 0x0
134
msg_and_0: .ascii "and_0" .db 0xa .db 0x0
135
msg_or_0: .ascii "or_0" .db 0xa .db 0x0
136
msg_xor_0: .ascii "xor_0" .db 0xa .db 0x0
137
msg_cp_0: .ascii "cp_0" .db 0xa .db 0x0
138
msg_inc: .ascii "inc" .db 0xa .db 0x0
139
msg_dec: .ascii "dec" .db 0xa .db 0x0
140
msg_neg: .ascii "neg" .db 0xa .db 0x0
141
 
142
error_cnt:
143
        .db     0
144
 
145
        ;; Ordering of segments for the linker.
146
        .area   _HOME
147
        .area   _CODE
148
        .area   _GSINIT
149
        .area   _GSFINAL
150
 
151
        .area   _DATA
152
        .area   _BSS
153
        .area   _HEAP
154
 
155
        .area   _CODE
156
 
157
;------------------------------------------------------------
158
;   Beginning of test
159
;------------------------------------------------------------
160
 
161
start:
162
 
163
                ld      hl, #starting_test
164
                call    print_sub
165
 
166
                ld      a, #0x1
167
                ld      hl,#error_cnt
168
                ld      (hl),a                  ;clear error count
169
 
170
 
171
push_0:         ld      sp,#stack_end
172
                ld      hl, #push_message
173
                call    print_sub
174
                ld      bc,#0x1234
175
                push    bc
176
                ld      bc,#0
177
                pop     bc
178
                ld      a,#12      ;bjp was >#0x1234
179
                cp      b
180
                jr      z,push_1
181
        ld      b, #0
182
        jp      fail_routine
183
push_1:         ld      a,#34      ;bjp was >#0x1234
184
                cp      c
185
                jr      z,push_2
186
        ld      b, #1
187
        jp      fail_routine
188
push_2:         ld      de,#0x55aa
189
                push    de
190
                ld      de,#0
191
                pop     de
192
                ld      a,#0x55
193
                cp      d
194
                jr      z,push_3
195
        ld      b, #2
196
        jp      fail_routine
197
push_3:         ld      a,#0xaa
198
                cp      e
199
                jr      z,push_4
200
        ld      b, #3
201
        jp      fail_routine
202
push_4:         ld      hl,#0x7fff
203
                push    hl
204
                ld      hl,#0
205
                pop     hl
206
                ld      a,#0x7f
207
                cp      h
208
                jr      z,push_5
209
        ld      b, #4
210
        jp      fail_routine
211
push_5:         ld      a,#0xff
212
                cp      l
213
                jr      z,push_6
214
        ld      b, #5
215
        jp      fail_routine
216
push_6:         ld      a,#0x80
217
                push    af                      ;f depends on previous compare
218
                ld      hl,#0
219
                pop     hl
220
                cp      h
221
                jr      z,push_7
222
        ld      b, #6
223
        jp      fail_routine
224
push_7:         ld      a,l
225
                cp      #0x42
226
                jr      z,push_8
227
push_8:         ld      h,#0x55
228
                ld      l,#0x80+#0x41
229
                ld      a,#0
230
                push    hl
231
                pop     af
232
                jp      m,push_9
233
        ld      b, #8
234
        jp      fail_routine
235
push_9:         jr      z,push_10
236
        ld      b, #9
237
        jp      fail_routine
238
push_10:        jr      c,push_11
239
        ld      b, #10
240
        jp      fail_routine
241
push_11:        cp      #0x55
242
                jr      z,push_12
243
        ld      b, #11
244
        jp      fail_routine
245
push_12:        ld      ix,#0xaa55
246
                ld      bc,#0
247
                push    ix
248
                pop     bc
249
                ld      a,#0xaa
250
                cp      b
251
                jr      z,push_13
252
        ld      b, #12
253
        jp      fail_routine
254
push_13:        ld      a,#0x55
255
                cp      c
256
                jr      z,push_14
257
        ld      b, #13
258
        jp      fail_routine
259
push_14:        ld      iy,#0x7fff
260
                ld      de,#0
261
                push    iy
262
                pop     de
263
                ld      a,#0x7f
264
                cp      d
265
                jr      z,push_15
266
        ld      b, #14
267
        jp      fail_routine
268
push_15:        ld      a,#0xff
269
                cp      e
270
                jr      z,push_16
271
        ld      b, #15
272
        jp      fail_routine
273
push_16:        ld      de,#0x1234
274
                ld      ix,#0
275
                ld      hl,#0
276
                push    de
277
                pop     ix
278
                ld      sp,ix
279
                add     hl,sp
280
                ld      a,#12      ;bjp was >#0x1234
281
                cp      h
282
                jr      z,push_17
283
        ld      b, #16
284
        jp      fail_routine
285
push_17:        ld      a,#34      ;bjp was >#0x1234
286
                cp      l
287
                jr      z,push_18
288
        ld      b, #17
289
        jp      fail_routine
290
push_18:        ld      sp,#stack_end
291
                ld      bc,#0x55aa
292
                ld      iy,#0
293
                ld      hl,#0
294
                push    bc
295
                pop     iy
296
                ld      sp,iy
297
                add     hl,sp
298
                ld      a,#0x55
299
                cp      h
300
                jr      z,push_19
301
        ld      b, #18
302
        jp      fail_routine
303
push_19:        ld      a,#0xaa
304
                cp      l
305
                jr      z,push_20
306
        ld      b, #19
307
        jp      fail_routine
308
push_20:        ld      sp,#stack_end
309
        ld hl, #ex_0
310
        call print_sub
311
ex_0:           ld      de,#0x1234
312
                ld      hl,#0xffff
313
                ex      de,hl
314
                ld      a,#0xff
315
                cp      d
316
                jr      z,ex_1
317
        ld      b, #0
318
        jp      fail_routine
319
ex_1:           cp      e
320
                jr      z,ex_2
321
        ld      b, #1
322
        jp      fail_routine
323
ex_2:           ld      a,#12      ;bjp was >#0x1234
324
                cp      h
325
                jr      z,ex_3
326
        ld      b, #2
327
        jp      fail_routine
328
ex_3:           ld      a,#34      ;bjp was >#0x1234
329
                cp      l
330
                jr      z,ex_4
331
        ld      b, #3
332
        jp      fail_routine
333
ex_4:           ld      h,#0
334
                ld      l,#0
335
                push    hl
336
                pop     af
337
                ex      af,af'
338
                ld      h,#0x7f
339
                ld      l,#0x80+#0x41
340
                push    hl
341
                pop     af
342
                ex      af,af'
343
                cp      #0
344
                jr      z,ex_5
345
        ld      b, #4
346
        jp      fail_routine
347
ex_5:           ex      af,af'
348
                jp      m,ex_6
349
        ld      b, #5
350
        jp      fail_routine
351
ex_6:           jr      z,ex_7
352
        ld      b, #6
353
        jp      fail_routine
354
ex_7:           cp      #0x7f
355
                jr      z,ex_8
356
        ld      b, #7
357
        jp      fail_routine
358
ex_8:           ld      hl,#0
359
                ld      bc,#0
360
                ld      de,#0
361
                exx
362
                ld      hl,#0x1234
363
                ld      bc,#0x7fff
364
                ld      de,#0xaa55
365
                exx
366
                ld      a,#0
367
                cp      h
368
                jr      z,ex_9
369
        ld      b, #8
370
        jp      fail_routine
371
ex_9:           cp      l
372
                jr      z,ex_10
373
        ld      b, #9
374
        jp      fail_routine
375
ex_10:          cp      d
376
                jr      z,ex_11
377
        ld      b, #10
378
        jp      fail_routine
379
ex_11:          cp      e
380
                jr      z,ex_12
381
        ld      b, #11
382
        jp      fail_routine
383
ex_12:          cp      b
384
                jr      z,ex_13
385
        ld      b, #12
386
        jp      fail_routine
387
ex_13:          cp      c
388
                jr      z,ex_14
389
        ld      b, #13
390
        jp      fail_routine
391
ex_14:          exx
392
                ld      a,#12      ;bjp was >#0x1234
393
                cp      h
394
                jr      z,ex_15
395
        ld      b, #14
396
        jp      fail_routine
397
ex_15:          ld      a,#34      ;bjp was >#0x1234
398
                cp      l
399
                jr      z,ex_16
400
        ld      b, #15
401
        jp      fail_routine
402
ex_16:          ld      a,#0xaa
403
                cp      d
404
                jr      z,ex_17
405
        ld      b, #16
406
        jp      fail_routine
407
ex_17:          ld      a,#0x55
408
                cp      e
409
                jr      z,ex_18
410
        ld      b, #17
411
        jp      fail_routine
412
ex_18:          ld      a,#0x7f
413
                cp      b
414
                jr      z,ex_19
415
        ld      b, #18
416
        jp      fail_routine
417
ex_19:          ld      a,#0xff
418
                cp      c
419
                jr      z,ex_20
420
        ld      b, #19
421
        jp      fail_routine
422
ex_20:          ld      bc,#0x55aa
423
                ld      hl,#0x7fff
424
                push    bc
425
                ex      (sp),hl
426
                pop     bc
427
                ld      a,#0x7f
428
                cp      b
429
                jr      z,ex_21
430
        ld      b, #20
431
        jp      fail_routine
432
ex_21:          ld      a,#0xff
433
                cp      c
434
                jr      z,ex_22
435
        ld      b, #21
436
        jp      fail_routine
437
ex_22:          ld      a,#0x55
438
                cp      h
439
                jr      z,ex_23
440
        ld      b, #22
441
        jp      fail_routine
442
ex_23:          ld      a,#0xaa
443
                cp      l
444
                jr      z,ex_24
445
        ld      b, #23
446
        jp      fail_routine
447
ex_24:          ld      bc,#0xffff
448
                ld      ix,#0x8000
449
                ld      hl,#0
450
                push    bc
451
                ex      (sp),ix
452
                pop     bc
453
                ld      sp,ix
454
                add     hl,sp
455
                ld      a,#0x80
456
                cp      b
457
                jr      z,ex_25
458
        ld      b, #24
459
        jp      fail_routine
460
ex_25:          ld      a,#0
461
                cp      c
462
                jr      z,ex_26
463
        ld      b, #25
464
        jp      fail_routine
465
ex_26:          ld      a,#0xff
466
                cp      h
467
                jr      z,ex_27
468
        ld      b, #26
469
        jp      fail_routine
470
ex_27:          cp      l
471
                jr      z,ex_28
472
        ld      b, #27
473
        jp      fail_routine
474
ex_28:          ld      sp,#stack_end
475
                ld      bc,#0x1234
476
                ld      iy,#0x7fff
477
                ld      hl,#0
478
                push    bc
479
                ex      (sp),iy
480
                pop     bc
481
                ld      sp,iy
482
                add     hl,sp
483
                ld      a,#0x7f
484
                cp      b
485
                jr      z,ex_29
486
        ld      b, #28
487
        jp      fail_routine
488
ex_29:          ld      a,#0xff
489
                cp      c
490
                jr      z,ex_30
491
        ld      b, #29
492
        jp      fail_routine
493
ex_30:          ld      a,#12      ;bjp was >#0x1234
494
                cp      h
495
                jr      z,ex_31
496
        ld      b, #30
497
        jp      fail_routine
498
ex_31:          ld      a,#34      ;bjp was >#0x1234
499
                cp      l
500
                jr      z,add_0
501
        ld      b, #31
502
        jp      fail_routine
503
add_0:          ld      sp,#stack_end ; reset stack after EX operations
504
                ld      hl, #msg_add_0
505
                call    print_sub
506
                ld      a,#0
507
                ld      b,#0x7f
508
                add     a,b
509
                cp      #0x7f
510
                jr      z,add_1
511
        ld      b, #0
512
        jp      fail_routine
513
add_1:          ld      a,#0
514
                ld      b,#0
515
                add     a,b
516
                jr      z,add_2
517
        ld      b, #1
518
        jp      fail_routine
519
add_2:          ld      b,#0x55
520
                add     a,b
521
                jr      nz,add_3
522
        ld      b, #2
523
        jp      fail_routine
524
add_3:          cp      #0x55
525
                jr      z,add_4
526
        ld      b, #3
527
        jp      fail_routine
528
add_4:          ld      a,#0xff
529
                ld      b,#1
530
                add     a,b
531
                jr      c,add_5
532
        ld      b, #4
533
        jp      fail_routine
534
add_5:          add     a,b
535
                jr      nc,add_6
536
        ld      b, #5
537
        jp      fail_routine
538
add_6:          ld      a,#0xff
539
                ld      b,#0
540
                add     a,b
541
                jp      m,add_7
542
        ld      b, #6
543
        jp      fail_routine
544
add_7:          ld      b,#1
545
                add     a,b
546
                jp      p,add_8
547
        ld      b, #7
548
        jp      fail_routine
549
add_8:          ld      a,#0x7f
550
                ld      b,#1
551
                add     a,b
552
                jp      pe,add_9
553
        ld      b, #8
554
        jp      fail_routine
555
add_9:          add     a,b
556
                jp      po,add_10
557
        ld      b, #9
558
        jp      fail_routine
559
add_10:         ld      a,#0x55
560
                ld      c,#2
561
                add     a,c
562
                cp      #0x55+2
563
                jr      z,add_11
564
        ld      b, #10
565
        jp      fail_routine
566
add_11:         ld      a,#0x80
567
                add     a,c
568
                cp      #0x80+2
569
                jr      z,add_12
570
        ld      b, #11
571
        jp      fail_routine
572
add_12:         ld      a,#0xaa
573
                ld      d,#0x55
574
                add     a,d
575
                cp      #0xaa+0x55
576
                jr      z,add_13
577
        ld      b, #12
578
        jp      fail_routine
579
add_13:         ld      a,#0xaa
580
                ld      e,#2
581
                add     a,e
582
                cp      #0xaa+2
583
                jr      z,add_14
584
        ld      b, #13
585
        jp      fail_routine
586
add_14:         ld      a,#0x55
587
                ld      h,#24
588
                add     a,h
589
                cp      #0x55+24
590
                jr      z,add_15
591
        ld      b, #14
592
        jp      fail_routine
593
add_15:         ld      a,#0x7f-10
594
                ld      l,#10
595
                add     a,l
596
                cp      #0x7f
597
                jr      z,add_16
598
        ld      b, #15
599
        jp      fail_routine
600
add_16:         ld      a,#1
601
                add     a,#0x7f
602
                jp      pe,add_17
603
        ld      b, #16
604
        jp      fail_routine
605
add_17:         jp      m,add_18
606
        ld      b, #17
607
        jp      fail_routine
608
add_18:         jr      nz,add_19
609
        ld      b, #18
610
        jp      fail_routine
611
add_19:         cp      #0x80
612
                jr      z,add_20
613
        ld      b, #19
614
        jp      fail_routine
615
add_20:         ld      a,#0x55
616
                add     a,#1
617
                jp      po,add_21
618
        ld      b, #20
619
        jp      fail_routine
620
add_21:         jp      p,add_22
621
        ld      b, #21
622
        jp      fail_routine
623
add_22:         jr      nc,add_23
624
        ld      b, #22
625
        jp      fail_routine
626
add_23:         cp      #0x55+1
627
                jr      z,add_24
628
        ld      b, #23
629
        jp      fail_routine
630
add_24:         ld      a,#0xff
631
                add     a,#1
632
                jr      c,add_25
633
        ld      b, #24
634
        jp      fail_routine
635
add_25:         jr      z,add_26
636
        ld      b, #25
637
        jp      fail_routine
638
add_26:         add     a,#1
639
                jr      nc,add_27
640
        ld      b, #26
641
        jp      fail_routine
642
add_27:         jr      nz,add_28
643
        ld      b, #27
644
        jp      fail_routine
645
add_28:         cp      #1
646
                jr      z,add_29
647
        ld      b, #28
648
        jp      fail_routine
649
add_29:         ld      hl,#var2
650
                ld      a,#2
651
                add     a,(hl)
652
                jp      po,add_30
653
        ld      b, #29
654
        jp      fail_routine
655
add_30:         jp      p,add_31
656
        ld      b, #30
657
        jp      fail_routine
658
add_31:         jr      nz,add_32
659
        ld      b, #31
660
        jp      fail_routine
661
add_32:         jr      nc,add_33
662
        ld      b, #32
663
        jp      fail_routine
664
add_33:         cp      #0x55+2
665
                jr      z,add_34
666
        ld      b, #33
667
        jp      fail_routine
668
add_34:         ld      hl,#var1
669
                ld      a,#1
670
                add     a,(hl)
671
                jr      c,add_35
672
        ld      b, #34
673
        jp      fail_routine
674
add_35:         jr      z,add_36
675
        ld      b, #35
676
        jp      fail_routine
677
add_36:         ld      hl,#var5
678
                ld      a,#1
679
                add     a,(hl)
680
                jp      m,add_37
681
        ld      b, #36
682
        jp      fail_routine
683
add_37:         jp      pe,add_38
684
        ld      b, #37
685
        jp      fail_routine
686
add_38:         cp      #0x80
687
                jr      z,add_39
688
        ld      b, #38
689
        jp      fail_routine
690
add_39:         ld      ix,#var3
691
                ld      a,#1
692
                add     a,-1(ix)
693
                jp      po,add_40
694
        ld      b, #39
695
        jp      fail_routine
696
add_40:         jp      p,add_41
697
        ld      b, #40
698
        jp      fail_routine
699
add_41:         jr      nz,add_42
700
        ld      b, #41
701
        jp      fail_routine
702
add_42:         jr      nc,add_43
703
        ld      b, #42
704
        jp      fail_routine
705
add_43:         cp      #0x55+1
706
                jr      z,add_44
707
        ld      b, #43
708
        jp      fail_routine
709
add_44:         ld      a,#1
710
                add     a,2(ix)
711
                jp      pe,add_45
712
        ld      b, #44
713
        jp      fail_routine
714
add_45:         jp      m,add_46
715
        ld      b, #45
716
        jp      fail_routine
717
add_46:         cp      #0x80
718
                jr      z,add_47
719
        ld      b, #46
720
        jp      fail_routine
721
add_47:         ld      a,#1
722
                add     a,-2(ix)
723
                jr      c,add_48
724
        ld      b, #47
725
        jp      fail_routine
726
add_48:         jr      z,add_49
727
        ld      b, #48
728
        jp      fail_routine
729
add_49:         add     a,#1
730
                jr      nc,add_50
731
        ld      b, #49
732
        jp      fail_routine
733
add_50:         jr      nz,add_51
734
        ld      b, #50
735
        jp      fail_routine
736
add_51:         cp      #1
737
                jr      z,add_52
738
        ld      b, #51
739
        jp      fail_routine
740
add_52:         ld      iy,#var3
741
                ld      a,#10
742
                add     a,-1(iy)
743
                jp      po,add_53
744
        ld      b, #52
745
        jp      fail_routine
746
add_53:         jp      p,add_54
747
        ld      b, #53
748
        jp      fail_routine
749
add_54:         jr      nz,add_55
750
        ld      b, #54
751
        jp      fail_routine
752
add_55:         jr      nc,add_56
753
        ld      b, #55
754
        jp      fail_routine
755
add_56:         cp      #0x55+10
756
                jr      z,add_57
757
        ld      b, #56
758
        jp      fail_routine
759
add_57:         ld      a,#1
760
                add     a,2(iy)
761
                jp      pe,add_58
762
        ld      b, #57
763
        jp      fail_routine
764
add_58:         jp      m,add_59
765
        ld      b, #58
766
        jp      fail_routine
767
add_59:         add     a,#1
768
                jp      po,add_60
769
        ld      b, #59
770
        jp      fail_routine
771
add_60:         cp      #0x80+1
772
                jr      z,add_61
773
        ld      b, #60
774
        jp      fail_routine
775
add_61:         ld      a,#1
776
                add     a,-2(iy)
777
                jr      z,add_62
778
        ld      b, #61
779
        jp      fail_routine
780
add_62:         jr      c,add_63
781
        ld      b, #62
782
        jp      fail_routine
783
add_63:         add     a,#1
784
                jr      nc,add_64
785
        ld      b, #63
786
        jp      fail_routine
787
add_64:         jr      nz,add_65
788
        ld      b, #64
789
        jp      fail_routine
790
add_65:         cp      #1
791
                jr      z,add_66
792
        ld      b, #65
793
        jp      fail_routine
794
add_66:         ld      a,#0xff
795
                add     a,#0x80
796
                jp      p,add_67
797
        ld      b, #66
798
        jp      fail_routine
799
add_67:         jp      pe,add_68
800
        ld      b, #67
801
        jp      fail_routine
802
add_68:         jr      c,add_69
803
        ld      b, #68
804
        jp      fail_routine
805
add_69:         add     a,#1
806
                jp      pe,add_70
807
        ld      b, #69
808
        jp      fail_routine
809
add_70:         jp      m,add_71
810
        ld      b, #70
811
        jp      fail_routine
812
add_71:         jr      nc,add_72
813
        ld      b, #71
814
        jp      fail_routine
815
add_72:         add     a,#1
816
                jp      po,add_73
817
        ld      b, #72
818
        jp      fail_routine
819
add_73:         cp      #0x80+1
820
                jr      z,adc_0
821
        ld      b, #73
822
        jp      fail_routine
823
adc_0:          nop
824
        ld hl, #adc_0
825
        call print_sub
826
                ld      a,#0                 ;clear cry
827
                add     a,#0
828
                ld      b,#0x7f
829
                adc     a,b                  ;a=7f cry=0
830
                jp      p,adc_1
831
        ld      b, #0
832
        jp      fail_routine
833
adc_1:          jp      po,adc_2
834
        ld      b, #1
835
        jp      fail_routine
836
adc_2:          jr      nc,adc_3
837
        ld      b, #2
838
        jp      fail_routine
839
adc_3:          jr      nz,adc_4
840
        ld      b, #3
841
        jp      fail_routine
842
adc_4:          ld      b,#1
843
                adc     a,b                     ;a=80 cry=0
844
                jp      pe,adc_5                ;jp  ofl
845
        ld      b, #4
846
        jp      fail_routine
847
adc_5:          jp      m,adc_6
848
        ld      b, #5
849
        jp      fail_routine
850
adc_6:          cp      #0x80
851
                jr      z,adc_7                 ;z=0  ofl=0 cry=0 (borrow)
852
        ld      b, #6
853
        jp      fail_routine
854
adc_7:          ld      a,#0xff
855
                ld      b,#1
856
                adc     a,b                      ;ff+1+0
857
                jr      c,adc_8
858
        ld      b, #7
859
        jp      fail_routine
860
adc_8:          jr      z,adc_9
861
        ld      b, #8
862
        jp      fail_routine
863
adc_9:          adc     a,b
864
                jr      nc,adc_10
865
        ld      b, #9
866
        jp      fail_routine
867
adc_10:         jr      nz,adc_11
868
        ld      b, #10
869
        jp      fail_routine
870
adc_11:         cp      #2
871
                jr      z,adc_12
872
        ld      b, #11
873
        jp      fail_routine
874
adc_12:         ld      a,#0xff
875
                ld      c,#0
876
                adc     a,c
877
                jp      m,adc_13
878
        ld      b, #12
879
        jp      fail_routine
880
adc_13:         jr      nc,adc_14
881
        ld      b, #13
882
        jp      fail_routine
883
adc_14:         ld      c,#2
884
                adc     a,c
885
                jp      p,adc_15
886
        ld      b, #14
887
        jp      fail_routine
888
adc_15:         jr      c,adc_16
889
        ld      b, #15
890
        jp      fail_routine
891
adc_16:         ld      c,#0
892
                adc     a,c
893
                cp      #2
894
                jr      z,adc_17
895
        ld      b, #16
896
        jp      fail_routine
897
adc_17:         ld      a,#0xff
898
                ld      d,#1
899
                adc     a,d
900
                jr      c,adc_18
901
        ld      b, #17
902
        jp      fail_routine
903
adc_18:         ld      d,#0
904
                adc     a,d
905
                jr      nc,adc_19
906
        ld      b, #18
907
        jp      fail_routine
908
adc_19:         cp      #1
909
                jr      z,adc_20
910
        ld      b, #19
911
        jp      fail_routine
912
adc_20:         ld      a,#0xaa
913
                ld      e,#0x7f
914
                adc     a,e
915
                jr      c,adc_21
916
        ld      b, #20
917
        jp      fail_routine
918
adc_21:         ld      e,#0x2
919
                adc     a,e
920
                cp      #0x55
921
                jr      z,adc_22
922
        ld      b, #21
923
        jp      fail_routine
924
adc_22:         ld      a,#0xff
925
                ld      h,#1
926
                adc     a,h
927
                jr      c,adc_23
928
        ld      b, #22
929
        jp      fail_routine
930
adc_23:         adc     a,h
931
                cp      #2
932
                jr      z,adc_24
933
        ld      b, #23
934
        jp      fail_routine
935
adc_24:         ld      a,#0xff
936
                ld      l,#1
937
                adc     a,l
938
                jr      c,adc_25
939
        ld      b, #24
940
        jp      fail_routine
941
adc_25:         adc     a,l
942
                cp      #2
943
                jr      z,adc_26
944
        ld      b, #25
945
        jp      fail_routine
946
adc_26:         ld      a,#0
947
                adc     a,#0x7f
948
                jp      po,adc_27
949
        ld      b, #26
950
        jp      fail_routine
951
adc_27:         jp      p,adc_28
952
        ld      b, #27
953
        jp      fail_routine
954
adc_28:         jr      nc,adc_29
955
        ld      b, #28
956
        jp      fail_routine
957
adc_29:         jr      nz,adc_30
958
        ld      b, #29
959
        jp      fail_routine
960
adc_30:         adc     a,#1
961
                jp      pe,adc_31
962
        ld      b, #30
963
        jp      fail_routine
964
adc_31:         jp      m,adc_32
965
        ld      b, #31
966
        jp      fail_routine
967
adc_32:         cp      #0x80
968
                jr      z,adc_33
969
        ld      b, #32
970
        jp      fail_routine
971
adc_33:         ld      a,#0xff
972
                adc     a,#1
973
                jr      c,adc_34
974
        ld      b, #33
975
        jp      fail_routine
976
adc_34:         jr      z,adc_35
977
        ld      b, #34
978
        jp      fail_routine
979
adc_35:         adc     a,#1
980
                jr      nc,adc_36
981
        ld      b, #35
982
        jp      fail_routine
983
adc_36:         jr      nz,adc_37
984
        ld      b, #36
985
        jp      fail_routine
986
adc_37:         cp      #2
987
                jr      z,adc_38
988
        ld      b, #37
989
        jp      fail_routine
990
adc_38:         ld      hl,#var5
991
                ld      a,#0
992
                adc     a,(hl)
993
                jp      p,adc_39
994
        ld      b, #38
995
        jp      fail_routine
996
adc_39:         jp      po,adc_40
997
        ld      b, #39
998
        jp      fail_routine
999
adc_40:         jr      nz,adc_41
1000
        ld      b, #40
1001
        jp      fail_routine
1002
adc_41:         jr      nc,adc_42
1003
        ld      b, #41
1004
        jp      fail_routine
1005
adc_42:         ld      a,#1
1006
                adc     a,(hl)
1007
                jp      m,adc_43
1008
        ld      b, #42
1009
        jp      fail_routine
1010
adc_43:         jp      pe,adc_44
1011
        ld      b, #43
1012
        jp      fail_routine
1013
adc_44:         cp      #0x80
1014
                jr      z,adc_45
1015
        ld      b, #44
1016
        jp      fail_routine
1017
adc_45:         ld      hl,#var1
1018
                ld      a,#1
1019
                adc     a,(hl)
1020
                jr      z,adc_46
1021
        ld      b, #45
1022
        jp      fail_routine
1023
adc_46:         jr      c,adc_47
1024
        ld      b, #46
1025
        jp      fail_routine
1026
adc_47:         ld      hl,#var2
1027
                adc     a,(hl)
1028
                jr      nc,adc_48
1029
        ld      b, #47
1030
        jp      fail_routine
1031
adc_48:         jr      nz,adc_49
1032
        ld      b, #48
1033
        jp      fail_routine
1034
adc_49:         cp      #0x55+1
1035
                jr      z,adc_50
1036
        ld      b, #49
1037
        jp      fail_routine
1038
adc_50:         ld      ix,#var3
1039
                ld      a,#0
1040
                adc     a,2(ix)
1041
                jp      p,adc_51
1042
        ld      b, #50
1043
        jp      fail_routine
1044
adc_51:         jp      po,adc_52
1045
        ld      b, #51
1046
        jp      fail_routine
1047
adc_52:         jr      nc,adc_53
1048
        ld      b, #52
1049
        jp      fail_routine
1050
adc_53:         jr      nz,adc_54
1051
        ld      b, #53
1052
        jp      fail_routine
1053
adc_54:         ld      a,#1
1054
                adc     a,2(ix)
1055
                jp      m,adc_55
1056
        ld      b, #54
1057
        jp      fail_routine
1058
adc_55:         jp      pe,adc_56
1059
        ld      b, #55
1060
        jp      fail_routine
1061
adc_56:         cp      #0x80
1062
                jr      z,adc_57
1063
        ld      b, #56
1064
        jp      fail_routine
1065
adc_57:         ld      a,#1
1066
                adc     a,-2(ix)
1067
                jr      c,adc_58
1068
        ld      b, #57
1069
        jp      fail_routine
1070
adc_58:         jr      z,adc_59
1071
        ld      b, #58
1072
        jp      fail_routine
1073
adc_59:         adc     a,-1(ix)
1074
                jr      nc,adc_60
1075
        ld      b, #59
1076
        jp      fail_routine
1077
adc_60:         jr      nz,adc_61
1078
        ld      b, #60
1079
        jp      fail_routine
1080
adc_61:         cp      #0x55+1
1081
                jr      z,adc_62
1082
        ld      b, #61
1083
        jp      fail_routine
1084
adc_62:         ld      iy,#var3
1085
                ld      a,#0
1086
                adc     a,2(ix)
1087
                jp      p,adc_63
1088
        ld      b, #62
1089
        jp      fail_routine
1090
adc_63:         jp      po,adc_64
1091
        ld      b, #63
1092
        jp      fail_routine
1093
adc_64:         jr      nc,adc_65
1094
        ld      b, #64
1095
        jp      fail_routine
1096
adc_65:         jr      nz,adc_66
1097
        ld      b, #65
1098
        jp      fail_routine
1099
adc_66:         ld      a,#1
1100
                adc     a,2(iy)
1101
                jp      m,adc_67
1102
        ld      b, #66
1103
        jp      fail_routine
1104
adc_67:         jp      pe,adc_68
1105
        ld      b, #67
1106
        jp      fail_routine
1107
adc_68:         cp      #0x80
1108
                jr      z,adc_69
1109
        ld      b, #68
1110
        jp      fail_routine
1111
adc_69:         ld      a,#1
1112
                adc     a,-2(iy)
1113
                jr      c,adc_70
1114
        ld      b, #69
1115
        jp      fail_routine
1116
adc_70:         jr      z,adc_71
1117
        ld      b, #70
1118
        jp      fail_routine
1119
adc_71:         adc     a,-1(iy)
1120
                jr      nc,adc_72
1121
        ld      b, #71
1122
        jp      fail_routine
1123
adc_72:         jr      nz,adc_73
1124
        ld      b, #72
1125
        jp      fail_routine
1126
adc_73:         cp      #0x55+1
1127
                jr      z,adc_74
1128
        ld      b, #73
1129
        jp      fail_routine
1130
adc_74:         ld      a,#0xff
1131
                add     a,#0
1132
                adc     a,#0x80
1133
                jp      p,adc_75
1134
        ld      b, #74
1135
        jp      fail_routine
1136
adc_75:         jp      pe,adc_76
1137
        ld      b, #75
1138
        jp      fail_routine
1139
adc_76:         jr      nz,adc_77
1140
        ld      b, #76
1141
        jp      fail_routine
1142
adc_77:         adc     a,#0
1143
                jp      m,adc_78
1144
        ld      b, #77
1145
        jp      fail_routine
1146
adc_78:         jp      pe,adc_79
1147
        ld      b, #78
1148
        jp      fail_routine
1149
adc_79:         adc     a,#1
1150
                jp      po,adc_80
1151
        ld      b, #79
1152
        jp      fail_routine
1153
adc_80:         cp      #0x80+1
1154
                jr      z,sub_0
1155
        ld      b, #80
1156
        jp      fail_routine
1157
sub_0:          nop
1158
        ld hl, #sub_0
1159
        call print_sub
1160
                ld      a,#0
1161
                ld      b,#1
1162
                sub     a,b
1163
                jp      m,sub_1
1164
        ld      b, #0
1165
        jp      fail_routine
1166
sub_1:          jp      po,sub_2
1167
        ld      b, #1
1168
        jp      fail_routine
1169
sub_2:          jr      c,sub_3
1170
        ld      b, #2
1171
        jp      fail_routine
1172
sub_3:          jr      nz,sub_4
1173
        ld      b, #3
1174
        jp      fail_routine
1175
sub_4:          sub     a,b
1176
                jr      nc,sub_5
1177
        ld      b, #4
1178
        jp      fail_routine
1179
sub_5:          cp      #0xff-1
1180
                jr      z,sub_6
1181
        ld      b, #5
1182
        jp      fail_routine
1183
sub_6:          ld      a,#1
1184
                ld      b,#0
1185
                sub     a,b
1186
                jr      nz,sub_7
1187
        ld      b, #6
1188
        jp      fail_routine
1189
sub_7:          jp      p,sub_8
1190
        ld      b, #7
1191
        jp      fail_routine
1192
sub_8:          ld      b,#1
1193
                sub     a,b
1194
                jr      z,sub_9
1195
        ld      b, #8
1196
        jp      fail_routine
1197
sub_9:          sub     a,b
1198
                jp      m,sub_10
1199
        ld      b, #9
1200
        jp      fail_routine
1201
sub_10:         cp      #0xff
1202
                jr      z,sub_11
1203
        ld      b, #10
1204
        jp      fail_routine
1205
sub_11:         ld      a,#0x80
1206
                ld      b,#0x7f
1207
                sub     a,b
1208
                jp      pe,sub_12
1209
        ld      b, #11
1210
        jp      fail_routine
1211
sub_12:         sub     a,b
1212
                jp      po,sub_13
1213
        ld      b, #12
1214
        jp      fail_routine
1215
sub_13:         cp      #0x80+2
1216
                jr      z,sub_14
1217
        ld      b, #13
1218
        jp      fail_routine
1219
sub_14:         ld      a,#0x55
1220
                ld      c,#0x55
1221
                sub     a,c
1222
                jr      z,sub_15
1223
        ld      b, #14
1224
        jp      fail_routine
1225
sub_15:         ld      c,#1
1226
                sub     a,c
1227
                jp      m,sub_16
1228
        ld      b, #15
1229
        jp      fail_routine
1230
sub_16:         jr      c,sub_17
1231
        ld      b, #16
1232
        jp      fail_routine
1233
sub_17:         cp      #0xff
1234
                jr      z,sub_18
1235
        ld      b, #17
1236
        jp      fail_routine
1237
sub_18:         ld      a,#0x55
1238
                ld      d,#0x7f
1239
                sub     a,d
1240
                jr      c,sub_19
1241
        ld      b, #18
1242
        jp      fail_routine
1243
sub_19:         cp      #0x55-0x7f
1244
                jr      z,sub_20
1245
        ld      b, #19
1246
        jp      fail_routine
1247
sub_20:         ld      a,#0
1248
                ld      e,#0xff
1249
                sub     a,e
1250
                jr      c,sub_21
1251
        ld      b, #20
1252
        jp      fail_routine
1253
sub_21:         cp      #1
1254
                jr      z,sub_22
1255
        ld      b, #21
1256
        jp      fail_routine
1257
sub_22:         ld      a,#0xff
1258
                ld      h,#0x80
1259
                sub     a,h
1260
                jp      p,sub_23
1261
        ld      b, #22
1262
        jp      fail_routine
1263
sub_23:         cp      #0x7f
1264
                jr      z,sub_24
1265
        ld      b, #23
1266
        jp      fail_routine
1267
sub_24:         ld      a,#0xaa
1268
                ld      l,#0xff
1269
                sub     a,l
1270
                jr      c,sub_25
1271
        ld      b, #24
1272
        jp      fail_routine
1273
sub_25:         cp      #0xaa+1
1274
                jr      z,sub_26
1275
        ld      b, #25
1276
        jp      fail_routine
1277
sub_26:         ld      a,#0x7f
1278
                sub     a,#0xff
1279
                jp      pe,sub_27
1280
        ld      b, #26
1281
        jp      fail_routine
1282
sub_27:         jp      m,sub_28
1283
        ld      b, #27
1284
        jp      fail_routine
1285
sub_28:         sub     a,#1
1286
                jp      p,sub_29
1287
        ld      b, #28
1288
        jp      fail_routine
1289
sub_29:         sub     a,#1
1290
                jp      po,sub_30
1291
        ld      b, #29
1292
        jp      fail_routine
1293
sub_30:         jr      nz,sub_31
1294
        ld      b, #30
1295
        jp      fail_routine
1296
sub_31:         sub     a,#0x7f-1
1297
                jr      z,sub_32
1298
        ld      b, #31
1299
        jp      fail_routine
1300
sub_32:         ld      a,#0
1301
                sub     a,#0xff
1302
                jr      c,sub_33
1303
        ld      b, #32
1304
        jp      fail_routine
1305
sub_33:         sub     a,#1
1306
                jr      z,sub_34
1307
        ld      b, #33
1308
        jp      fail_routine
1309
sub_34:         jr      nc,sub_35
1310
        ld      b, #34
1311
        jp      fail_routine
1312
sub_35:         ld      hl,#var1
1313
                ld      a,#0x7f
1314
                sub     a,(hl)
1315
                jp      m,sub_36
1316
        ld      b, #35
1317
        jp      fail_routine
1318
sub_36:         jp      pe,sub_37
1319
        ld      b, #36
1320
        jp      fail_routine
1321
sub_37:         jr      c,sub_38
1322
        ld      b, #37
1323
        jp      fail_routine
1324
sub_38:         ld      hl,#var3
1325
                sub     a,(hl)
1326
                jp      p,sub_39
1327
        ld      b, #38
1328
        jp      fail_routine
1329
sub_39:         jp      po,sub_40
1330
        ld      b, #39
1331
        jp      fail_routine
1332
sub_40:
1333
        jr      nc,sub_41
1334
        ld      b, #40
1335
        jp      fail_routine
1336
sub_41:
1337
        jr      z,sub_42
1338
        ld      b, #40
1339
        jp      fail_routine
1340
sub_42:         ld      hl,#var2
1341
                sub     a,(hl)
1342
                jr      nz,sub_43
1343
        ld      b, #42
1344
        jp      fail_routine
1345
sub_43:         cp      #0xaa+1
1346
                jr      z,sub_44
1347
        ld      b, #43
1348
        jp      fail_routine
1349
sub_44:         ld      ix,#var3
1350
                ld      a,#0x7f
1351
                sub     a,-2(ix)
1352
                jp      m,sub_45
1353
        ld      b, #44
1354
        jp      fail_routine
1355
sub_45:         jp      pe,sub_46
1356
        ld      b, #45
1357
        jp      fail_routine
1358
sub_46:         jr      c,sub_47
1359
        ld      b, #46
1360
        jp      fail_routine
1361
sub_47:         sub     a,(ix)
1362
                jp      p,sub_48
1363
        ld      b, #47
1364
        jp      fail_routine
1365
sub_48:         jp      po,sub_49
1366
        ld      b, #48
1367
        jp      fail_routine
1368
sub_49:         jr      nc,sub_50
1369
        ld      b, #49
1370
        jp      fail_routine
1371
sub_50:         jr      z,sub_51
1372
        ld      b, #50
1373
        jp      fail_routine
1374
sub_51:         sub     a,2(ix)
1375
                jr      nz,sub_52
1376
        ld      b, #51
1377
        jp      fail_routine
1378
sub_52:         cp      #0x80+1
1379
                jr      z,sub_53
1380
        ld      b, #52
1381
        jp      fail_routine
1382
sub_53:         ld      iy,#var3
1383
                ld      a,#0x7f
1384
                sub     a,-2(iy)
1385
                jp      m,sub_54
1386
        ld      b, #53
1387
        jp      fail_routine
1388
sub_54:         jp      pe,sub_55
1389
        ld      b, #54
1390
        jp      fail_routine
1391
sub_55:         jr      c,sub_56
1392
        ld      b, #55
1393
        jp      fail_routine
1394
sub_56:         jr      nz,sub_57
1395
        ld      b, #56
1396
        jp      fail_routine
1397
sub_57:         sub     a,(iy)
1398
                jp      p,sub_58
1399
        ld      b, #57
1400
        jp      fail_routine
1401
sub_58:         jp      po,sub_59
1402
        ld      b, #58
1403
        jp      fail_routine
1404
sub_59:         jr      nc,sub_60
1405
        ld      b, #59
1406
        jp      fail_routine
1407
sub_60:         jr      z,sub_61
1408
        ld      b, #60
1409
        jp      fail_routine
1410
sub_61:         sub     a,2(iy)
1411
                jr      nz,sub_62
1412
        ld      b, #61
1413
        jp      fail_routine
1414
sub_62:         cp      #0x80+1
1415
                jr      z,sbc_0
1416
        ld      b, #62
1417
        jp      fail_routine
1418
sbc_0:          nop
1419
        ld hl, #sbc_0
1420
        call print_sub
1421
                ld      a,#0x7f
1422
                ld      b,#0
1423
                sub     a,b                     ;clear carry flag
1424
                ld      b,#0xff
1425
                sbc     a,b
1426
                jp      m,sbc_1
1427
        ld      b, #0
1428
        jp      fail_routine
1429
sbc_1:          jp      pe,sbc_2
1430
        ld      b, #1
1431
        jp      fail_routine
1432
sbc_2:          jr      c,sbc_3
1433
        ld      b, #2
1434
        jp      fail_routine
1435
sbc_3:          jr      nz,sbc_4
1436
        ld      b, #3
1437
        jp      fail_routine
1438
sbc_4:          ld      b,#0x7f
1439
                sbc     a,b
1440
                jp      p,sbc_5
1441
        ld      b, #4
1442
        jp      fail_routine
1443
sbc_5:          jp      pe,sbc_6
1444
        ld      b, #5
1445
        jp      fail_routine
1446
sbc_6:          jr      nc,sbc_7
1447
        ld      b, #6
1448
        jp      fail_routine
1449
sbc_7:          jr      z,sbc_8
1450
        ld      b, #7
1451
        jp      fail_routine
1452
sbc_8:          ld      b,#0xff
1453
                sbc     a,b
1454
                jp      po,sbc_9
1455
        ld      b, #8
1456
        jp      fail_routine
1457
sbc_9:          jr      nz,sbc_10
1458
        ld      b, #9
1459
        jp      fail_routine
1460
sbc_10:         ld      b,#0
1461
                sbc     a,b
1462
                jr      z,sbc_11
1463
        ld      b, #10
1464
        jp      fail_routine
1465
sbc_11:         ld      a,#0xaa
1466
                ld      c,#0xff
1467
                sbc     a,c
1468
                jr      c,sbc_12
1469
        ld      b, #11
1470
        jp      fail_routine
1471
sbc_12:         ld      c,#0
1472
                sbc     a,c
1473
                jr      nc,sbc_13
1474
        ld      b, #12
1475
        jp      fail_routine
1476
sbc_13:         cp      #0xaa
1477
                jr      z,sbc_14
1478
        ld      b, #13
1479
        jp      fail_routine
1480
sbc_14:         ld      a,#0x55
1481
                ld      d,#0xff
1482
                sbc     a,d
1483
                jr      c,sbc_15
1484
        ld      b, #14
1485
        jp      fail_routine
1486
sbc_15:         ld      d,#0
1487
                sbc     a,d
1488
                jr      nc,sbc_16
1489
        ld      b, #15
1490
        jp      fail_routine
1491
sbc_16:         cp      #0x55
1492
                jr      z,sbc_17
1493
        ld      b, #16
1494
        jp      fail_routine
1495
sbc_17:         ld      a,#0xaa
1496
                ld      e,#0xff
1497
                sbc     a,e
1498
                jr      c,sbc_18
1499
        ld      b, #17
1500
        jp      fail_routine
1501
sbc_18:         ld      e,#0
1502
                sbc     a,e
1503
                jr      nc,sbc_19
1504
        ld      b, #18
1505
        jp      fail_routine
1506
sbc_19:         cp      #0xaa
1507
                jr      z,sbc_20
1508
        ld      b, #19
1509
        jp      fail_routine
1510
sbc_20:         ld      a,#0x55
1511
                ld      h,#0xff
1512
                sbc     a,h
1513
                jr      c,sbc_21
1514
        ld      b, #20
1515
        jp      fail_routine
1516
sbc_21:         ld      h,#0
1517
                sbc     a,h
1518
                jr      nc,sbc_22
1519
        ld      b, #21
1520
        jp      fail_routine
1521
sbc_22:         cp      #0x55
1522
                jr      z,sbc_23
1523
        ld      b, #22
1524
        jp      fail_routine
1525
sbc_23:         ld      a,#0xaa
1526
                ld      l,#0xff
1527
                sbc     a,l
1528
                jr      c,sbc_24
1529
        ld      b, #23
1530
        jp      fail_routine
1531
sbc_24:         ld      l,#0
1532
                sbc     a,l
1533
                jr      nc,sbc_25
1534
        ld      b, #24
1535
        jp      fail_routine
1536
sbc_25:         cp      #0xaa
1537
                jr      z,sbc_26
1538
        ld      b, #25
1539
        jp      fail_routine
1540
sbc_26:         ld      a,#0x7f
1541
                sbc     a,#0xff
1542
                jp      m,sbc_27
1543
        ld      b, #26
1544
        jp      fail_routine
1545
sbc_27:         jp      pe,sbc_28
1546
        ld      b, #27
1547
        jp      fail_routine
1548
sbc_28:         jr      c,sbc_29
1549
        ld      b, #28
1550
        jp      fail_routine
1551
sbc_29:         jr      nz,sbc_30
1552
        ld      b, #29
1553
        jp      fail_routine
1554
sbc_30:         sbc     a,#0x7f
1555
                jp      p,sbc_31
1556
        ld      b, #30
1557
        jp      fail_routine
1558
sbc_31:         jp      pe,sbc_32
1559
        ld      b, #31
1560
        jp      fail_routine
1561
sbc_32:         jr      nc,sbc_33
1562
        ld      b, #32
1563
        jp      fail_routine
1564
sbc_33:         jr      z,sbc_34
1565
        ld      b, #33
1566
        jp      fail_routine
1567
sbc_34:         sbc     a,#0xff
1568
                jr      nz,sbc_35
1569
        ld      b, #34
1570
        jp      fail_routine
1571
sbc_35:         cp      #1
1572
                jr      z,sbc_36
1573
        ld      b, #35
1574
        jp      fail_routine
1575
sbc_36:         ld      hl,#var1
1576
                ld      a,#0x7f
1577
                sbc     a,(hl)
1578
                jp      m,sbc_37
1579
        ld      b, #36
1580
        jp      fail_routine
1581
sbc_37:         jp      pe,sbc_38
1582
        ld      b, #37
1583
        jp      fail_routine
1584
sbc_38:         jr      c,sbc_39
1585
        ld      b, #38
1586
        jp      fail_routine
1587
sbc_39:         jr      nz,sbc_40
1588
        ld      b, #39
1589
        jp      fail_routine
1590
sbc_40:         ld      hl,#var5
1591
                sbc     a,(hl)
1592
                jp      p,sbc_41
1593
        ld      b, #40
1594
        jp      fail_routine
1595
sbc_41:         jp      pe,sbc_42
1596
        ld      b, #41
1597
        jp      fail_routine
1598
sbc_42:         jr      nc,sbc_43
1599
        ld      b, #42
1600
        jp      fail_routine
1601
sbc_43:         jr      z,sbc_44
1602
        ld      b, #43
1603
        jp      fail_routine
1604
sbc_44:         ld      hl,#var2
1605
                sbc     a,(hl)
1606
                jr      nz,sbc_45
1607
        ld      b, #44
1608
        jp      fail_routine
1609
sbc_45:         cp      #0xaa+1
1610
                jr      z,sbc_46
1611
        ld      b, #45
1612
        jp      fail_routine
1613
sbc_46:         ld      ix,#var3
1614
                ld      a,#0x7f
1615
                sbc     a,-2(ix)
1616
                jp      m,sbc_47
1617
        ld      b, #46
1618
        jp      fail_routine
1619
sbc_47:         jp      pe,sbc_48
1620
        ld      b, #47
1621
        jp      fail_routine
1622
sbc_48:         jr      c,sbc_49
1623
        ld      b, #48
1624
        jp      fail_routine
1625
sbc_49:         jr      nz,sbc_50
1626
        ld      b, #49
1627
        jp      fail_routine
1628
sbc_50:         sbc     a,2(ix)
1629
                jp      p,sbc_51
1630
        ld      b, #50
1631
        jp      fail_routine
1632
sbc_51:         jp      pe,sbc_52
1633
        ld      b, #51
1634
        jp      fail_routine
1635
sbc_52:         jr      nc,sbc_53
1636
        ld      b, #52
1637
        jp      fail_routine
1638
sbc_53:         jr      z,sbc_54
1639
        ld      b, #53
1640
        jp      fail_routine
1641
sbc_54:         sbc     a,-1(ix)
1642
                jr      nz,sbc_55
1643
        ld      b, #54
1644
        jp      fail_routine
1645
sbc_55:         cp      #0xaa+1
1646
                jr      z,sbc_56
1647
        ld      b, #55
1648
        jp      fail_routine
1649
sbc_56:         ld      iy,#var3
1650
                ld      a,#0x7f
1651
                sbc     a,-2(ix)
1652
                jp      m,sbc_57
1653
        ld      b, #56
1654
        jp      fail_routine
1655
sbc_57:         jp      pe,sbc_58
1656
        ld      b, #57
1657
        jp      fail_routine
1658
sbc_58:         jr      c,sbc_59
1659
        ld      b, #58
1660
        jp      fail_routine
1661
sbc_59:         jr      nz,sbc_60
1662
        ld      b, #59
1663
        jp      fail_routine
1664
sbc_60:         sbc     a,2(ix)
1665
                jp      p,sbc_61
1666
        ld      b, #60
1667
        jp      fail_routine
1668
sbc_61:         jp      pe,sbc_62
1669
        ld      b, #61
1670
        jp      fail_routine
1671
sbc_62:         jr      nc,sbc_63
1672
        ld      b, #62
1673
        jp      fail_routine
1674
sbc_63:         jr      z,sbc_64
1675
        ld      b, #63
1676
        jp      fail_routine
1677
sbc_64:         sbc     a,1(ix)
1678
                jr      nz,sbc_65
1679
        ld      b, #64
1680
        jp      fail_routine
1681
sbc_65:         cp      #0x55+1
1682
                jr      z,and_0
1683
        ld      b, #65
1684
        jp      fail_routine
1685
and_0:          nop
1686
        ld hl, #and_0
1687
        call print_sub
1688
                ld      a,#0xff
1689
                add     a,#1                    ;set carry
1690
                ld      a,#0xff
1691
                ld      b,#0xaa
1692
                and     a,b
1693
                jr      nc,and_1
1694
        ld      b, #0
1695
        jp      fail_routine
1696
and_1:          jp      m,and_2
1697
        ld      b, #1
1698
        jp      fail_routine
1699
and_2:          jp      pe,and_3
1700
        ld      b, #2
1701
        jp      fail_routine
1702
and_3:          jr      nz,and_4
1703
        ld      b, #3
1704
        jp      fail_routine
1705
and_4:          ld      b,#0x55
1706
                and     a,b
1707
                jp      p,and_5
1708
        ld      b, #4
1709
        jp      fail_routine
1710
and_5:          jr      z,and_6
1711
        ld      b, #5
1712
        jp      fail_routine
1713
and_6:          ld      a,#0xff
1714
                ld      b,#0x7f
1715
                and     a,b
1716
                jp      po,and_7
1717
        ld      b, #6
1718
        jp      fail_routine
1719
and_7:          ld      b,#0x55
1720
                and     a,b
1721
                jp      pe,and_8
1722
        ld      b, #7
1723
        jp      fail_routine
1724
and_8:          ld      a,#0xff
1725
                ld      c,#0x80
1726
                and     a,c
1727
                jp      m,and_9
1728
        ld      b, #8
1729
        jp      fail_routine
1730
and_9:          cp      #0x80
1731
                jr      z,and_10
1732
        ld      b, #9
1733
        jp      fail_routine
1734
and_10:         ld      a,#0xff
1735
                ld      d,#0x7f
1736
                and     a,d
1737
                jp      p,and_11
1738
        ld      b, #10
1739
        jp      fail_routine
1740
and_11:         cp      #0x7f
1741
                jr      z,and_12
1742
        ld      b, #11
1743
        jp      fail_routine
1744
and_12:         ld      a,#0xff
1745
                ld      e,#0xaa
1746
                and     a,e
1747
                jp      m,and_13
1748
        ld      b, #12
1749
        jp      fail_routine
1750
and_13:         cp      #0xaa
1751
                jr      z,and_14
1752
        ld      b, #13
1753
        jp      fail_routine
1754
and_14:         ld      a,#0xff
1755
                ld      h,#0x55
1756
                and     a,h
1757
                jp      p,and_15
1758
        ld      b, #14
1759
        jp      fail_routine
1760
and_15:         cp      #0x55
1761
                jr      z,and_16
1762
        ld      b, #15
1763
        jp      fail_routine
1764
and_16:         ld      a,#0xff
1765
                ld      l,#0xaa
1766
                and     a,l
1767
                jp      m,and_17
1768
        ld      b, #16
1769
        jp      fail_routine
1770
and_17:         cp      #0xaa
1771
                jr      z,and_18
1772
        ld      b, #17
1773
        jp      fail_routine
1774
and_18:         ld      a,#0xff
1775
                and     a,#0xaa
1776
                jp      m,and_19
1777
        ld      b, #18
1778
        jp      fail_routine
1779
and_19:         jr      nz,and_20
1780
        ld      b, #19
1781
        jp      fail_routine
1782
and_20:         and     a,#0x55
1783
                jp      p,and_21
1784
        ld      b, #20
1785
        jp      fail_routine
1786
and_21:         jr      z,and_22
1787
        ld      b, #21
1788
        jp      fail_routine
1789
and_22:         ld      a,#0xff
1790
                and     a,#0x7f
1791
                jp      po,and_23
1792
        ld      b, #22
1793
        jp      fail_routine
1794
and_23:         and     a,#0x55
1795
                jp      pe,and_24
1796
        ld      b, #23
1797
        jp      fail_routine
1798
and_24:         jr      nz,and_25
1799
        ld      b, #24
1800
        jp      fail_routine
1801
and_25:         and     a,#0xaa
1802
                jr      z,and_26
1803
        ld      b, #25
1804
        jp      fail_routine
1805
and_26:         ld      a,#0xff
1806
                and     a,#0xaa
1807
                cp      #0xaa
1808
                jr      z,and_27
1809
        ld      b, #26
1810
        jp      fail_routine
1811
and_27:         ld      hl,#var4
1812
                ld      a,#0xff
1813
                and     a,(hl)
1814
                jp      m,and_28
1815
        ld      b, #27
1816
        jp      fail_routine
1817
and_28:         jr      nz,and_29
1818
        ld      b, #28
1819
        jp      fail_routine
1820
and_29:         ld      hl,#var2
1821
                and     a,(hl)
1822
                jp      p,and_30
1823
        ld      b, #29
1824
        jp      fail_routine
1825
and_30:         jr      z,and_31
1826
        ld      b, #30
1827
        jp      fail_routine
1828
and_31:         ld      a,#0xff
1829
                ld      hl,#var5
1830
                and     a,(hl)
1831
                jp      po,and_32
1832
        ld      b, #31
1833
        jp      fail_routine
1834
and_32:         ld      hl,#var2
1835
                and     a,(hl)
1836
                jp      pe,and_33
1837
        ld      b, #32
1838
        jp      fail_routine
1839
and_33:         cp      #0x55
1840
                jr      z,and_34
1841
        ld      b, #33
1842
        jp      fail_routine
1843
and_34:         ld      ix,#var3
1844
                ld      a,#0xff
1845
                and     a,1(ix)
1846
                jp      m,and_35
1847
        ld      b, #34
1848
        jp      fail_routine
1849
and_35:         jr      nz,and_36
1850
        ld      b, #35
1851
        jp      fail_routine
1852
and_36:         and     a,-1(ix)
1853
                jp      p,and_37
1854
        ld      b, #36
1855
        jp      fail_routine
1856
and_37:         jr      z,and_38
1857
        ld      b, #37
1858
        jp      fail_routine
1859
and_38:         ld      a,#0xff
1860
                and     a,2(ix)
1861
                jp      po,and_39
1862
        ld      b, #38
1863
        jp      fail_routine
1864
and_39:         and     a,-1(ix)
1865
                jp      pe,and_40
1866
        ld      b, #39
1867
        jp      fail_routine
1868
and_40:         cp      #0x55
1869
                jr      z,and_41
1870
        ld      b, #40
1871
        jp      fail_routine
1872
and_41:         ld      iy,#var3
1873
                ld      a,#0xff
1874
                and     a,1(iy)
1875
                jp      m,and_42
1876
        ld      b, #41
1877
        jp      fail_routine
1878
and_42:         jr      nz,and_43
1879
        ld      b, #42
1880
        jp      fail_routine
1881
and_43:         and     a,-1(iy)
1882
                jp      p,and_44
1883
        ld      b, #43
1884
        jp      fail_routine
1885
and_44:         jr      z,and_45
1886
        ld      b, #44
1887
        jp      fail_routine
1888
and_45:         ld      a,#0xff
1889
                and     a,2(iy)
1890
                jp      po,and_46
1891
        ld      b, #45
1892
        jp      fail_routine
1893
and_46:         and     a,-1(iy)
1894
                jp      pe,and_47
1895
        ld      b, #46
1896
        jp      fail_routine
1897
and_47:         cp      #0x55
1898
                jr      z,or_0
1899
        ld      b, #47
1900
        jp      fail_routine
1901
or_0:           nop
1902
        ld hl, #or_0
1903
        call print_sub
1904
                ld      a,#0
1905
                ld      b,#0x7f
1906
                or      a,b
1907
                jp      p,or_1
1908
        ld      b, #0
1909
        jp      fail_routine
1910
or_1:           jp      po,or_2
1911
        ld      b, #1
1912
        jp      fail_routine
1913
or_2:           ld      b,#0x80
1914
                or      a,b
1915
                jp      m,or_3
1916
        ld      b, #2
1917
        jp      fail_routine
1918
or_3:           jp      pe,or_4
1919
        ld      b, #3
1920
        jp      fail_routine
1921
or_4:           cp      #0xff
1922
                jr      z,or_5
1923
        ld      b, #4
1924
        jp      fail_routine
1925
or_5:           ld      a,#0
1926
                ld      b,#0
1927
                or      a,b
1928
                jr      z,or_6
1929
        ld      b, #5
1930
        jp      fail_routine
1931
or_6:           ld      b,#0x55
1932
                or      a,b
1933
                jr      nz,or_7
1934
        ld      b, #6
1935
        jp      fail_routine
1936
or_7:           cp      #0x55
1937
                jr      z,or_8
1938
        ld      b, #7
1939
        jp      fail_routine
1940
or_8:           ld      a,#0xff
1941
                add     a,#1
1942
                jr      c,or_9
1943
        ld      b, #8
1944
        jp      fail_routine
1945
or_9:           ld      b,#0x7f
1946
                or      a,b
1947
                jr      nc,or_10
1948
        ld      b, #9
1949
        jp      fail_routine
1950
or_10:          cp      #0x7f
1951
                jr      z,or_11
1952
        ld      b, #10
1953
        jp      fail_routine
1954
or_11:          ld      a,#0
1955
                ld      c,#0x55
1956
                or      a,c
1957
                cp      #0x55
1958
                jr      z,or_12
1959
        ld      b, #11
1960
        jp      fail_routine
1961
or_12:          ld      c,#0xaa
1962
                or      a,c
1963
                cp      #0xff
1964
                jr      z,or_13
1965
        ld      b, #12
1966
        jp      fail_routine
1967
or_13:          ld      a,#0
1968
                ld      d,#0xaa
1969
                or      a,d
1970
                cp      #0xaa
1971
                jr      z,or_14
1972
        ld      b, #13
1973
        jp      fail_routine
1974
or_14:          ld      e,#0x55
1975
                or      a,e
1976
                cp      #0xff
1977
                jr      z,or_15
1978
        ld      b, #14
1979
        jp      fail_routine
1980
or_15:          ld      a,#0
1981
                ld      h,#0x80
1982
                or      a,h
1983
                cp      #0x80
1984
                jr      z,or_16
1985
        ld      b, #15
1986
        jp      fail_routine
1987
or_16:          ld      l,#0x7f
1988
                or      a,l
1989
                cp      #0xff
1990
                jr      z,or_17
1991
        ld      b, #16
1992
        jp      fail_routine
1993
or_17:          ld      a,#0
1994
                or      a,#0x7f
1995
                jp      p,or_18
1996
        ld      b, #17
1997
        jp      fail_routine
1998
or_18:          jp      po,or_19
1999
        ld      b, #18
2000
        jp      fail_routine
2001
or_19:          or      a,#0x80
2002
                jp      m,or_20
2003
        ld      b, #19
2004
        jp      fail_routine
2005
or_20:          jp      pe,or_21
2006
        ld      b, #20
2007
        jp      fail_routine
2008
or_21:          cp      #0xff
2009
                jr      z,or_22
2010
        ld      b, #21
2011
        jp      fail_routine
2012
or_22:          ld      a,#0
2013
                or      a,#0
2014
                jr      z,or_23
2015
        ld      b, #22
2016
        jp      fail_routine
2017
or_23:          or      a,#0x7f
2018
                jr      nz,or_24
2019
        ld      b, #23
2020
        jp      fail_routine
2021
or_24:          ld      a,#0xff
2022
                add     a,#1
2023
                jr      c,or_25
2024
        ld      b, #24
2025
        jp      fail_routine
2026
or_25:          or      a,#0x55
2027
                jr      nc,or_26
2028
        ld      b, #25
2029
        jp      fail_routine
2030
or_26:          cp      #0x55
2031
                jr      z,or_27
2032
        ld      b, #26
2033
        jp      fail_routine
2034
or_27:          ld      hl,#var5
2035
                ld      a,#0
2036
                or      a,(hl)
2037
                jp      p,or_28
2038
        ld      b, #27
2039
        jp      fail_routine
2040
or_28:          jp      po,or_29
2041
        ld      b, #28
2042
        jp      fail_routine
2043
or_29:          ld      hl,#var3
2044
                or      a,(hl)
2045
                jp      m,or_30
2046
        ld      b, #29
2047
        jp      fail_routine
2048
or_30:          jp      pe,or_31
2049
        ld      b, #30
2050
        jp      fail_routine
2051
or_31:          cp      #0xff
2052
                jr      z,or_32
2053
        ld      b, #31
2054
        jp      fail_routine
2055
or_32:          ld      hl,#t_var1
2056
                ld      a,#0
2057
                ld      (hl),a
2058
                or      a,(hl)
2059
                jr      z,or_33
2060
        ld      b, #32
2061
        jp      fail_routine
2062
or_33:          ld      hl,#var2
2063
                or      a,(hl)
2064
                jr      nz,or_34
2065
        ld      b, #33
2066
        jp      fail_routine
2067
or_34:          cp      #0x55
2068
                jr      z,or_35
2069
        ld      b, #34
2070
        jp      fail_routine
2071
or_35:          ld      ix,#var3
2072
                ld      a,#0
2073
                or      a,2(ix)
2074
                jp      p,or_36
2075
        ld      b, #35
2076
        jp      fail_routine
2077
or_36:          jp      po,or_37
2078
        ld      b, #36
2079
        jp      fail_routine
2080
or_37:          or      a,(ix)
2081
                jp      m,or_38
2082
        ld      b, #37
2083
        jp      fail_routine
2084
or_38:          jp      pe,or_39
2085
        ld      b, #38
2086
        jp      fail_routine
2087
or_39:          cp      #0xff
2088
                jr      z,or_40
2089
        ld      b, #39
2090
        jp      fail_routine
2091
or_40:          ld      ix,#t_var3
2092
                ld      a,#0
2093
                ld      -2(ix),a
2094
                or      a,-2(ix)
2095
                jr      z,or_41
2096
        ld      b, #40
2097
        jp      fail_routine
2098
or_41:          ld      2(ix),#0xaa
2099
                or      a,2(ix)
2100
                jr      nz,or_42
2101
        ld      b, #41
2102
        jp      fail_routine
2103
or_42:          cp      #0xaa
2104
                jr      z,or_43
2105
        ld      b, #42
2106
        jp      fail_routine
2107
or_43:          ld      iy,#var3
2108
                ld      a,#0
2109
                or      a,2(iy)
2110
                jp      p,or_44
2111
        ld      b, #43
2112
        jp      fail_routine
2113
or_44:          jp      po,or_45
2114
        ld      b, #44
2115
        jp      fail_routine
2116
or_45:          or      a,(iy)
2117
                jp      m,or_46
2118
        ld      b, #45
2119
        jp      fail_routine
2120
or_46:          jp      pe,or_47
2121
        ld      b, #46
2122
        jp      fail_routine
2123
or_47:          cp      #0xff
2124
                jr      z,or_48
2125
        ld      b, #47
2126
        jp      fail_routine
2127
or_48:          ld      iy,#t_var3
2128
                ld      a,#0
2129
                ld      -2(iy),a
2130
                or      a,-2(iy)
2131
                jr      z,or_49
2132
        ld      b, #48
2133
        jp      fail_routine
2134
or_49:          ld      2(iy),#0x55
2135
                or      a,2(iy)
2136
                jr      nz,or_50
2137
        ld      b, #49
2138
        jp      fail_routine
2139
or_50:          cp      #0x55
2140
                jr      z,xor_0
2141
        ld      b, #50
2142
        jp      fail_routine
2143
xor_0:          nop
2144
        ld hl, #xor_0
2145
        call print_sub
2146
                ld      a,#0xff
2147
                ld      b,#0x55
2148
                xor     a,b
2149
                jp      m,xor_1
2150
        ld      b, #0
2151
        jp      fail_routine
2152
xor_1:          jp      pe,xor_2
2153
        ld      b, #1
2154
        jp      fail_routine
2155
xor_2:          ld      b,#0x80
2156
                xor     a,b
2157
                jp      p,xor_3
2158
        ld      b, #2
2159
        jp      fail_routine
2160
xor_3:          jp      po,xor_4
2161
        ld      b, #3
2162
        jp      fail_routine
2163
xor_4:          cp      #0x2
2164
                jr      z,xor_5
2165
        ld      b, #4
2166
        jp      fail_routine
2167
xor_5:          ld      a,#0xff
2168
                ld      b,#0xff
2169
                xor     a,b
2170
                jr      z,xor_6
2171
        ld      b, #5
2172
        jp      fail_routine
2173
xor_6:          ld      b,#0x55
2174
                xor     a,b
2175
                jr      nz,xor_7
2176
        ld      b, #6
2177
        jp      fail_routine
2178
xor_7:          cp      #0x55
2179
                jr      z,xor_8
2180
        ld      b, #7
2181
        jp      fail_routine
2182
xor_8:          ld      a,#0xff
2183
                add     a,#1
2184
                jr      c,xor_9
2185
        ld      b, #8
2186
        jp      fail_routine
2187
xor_9:          ld      b,#0xaa
2188
                xor     a,b
2189
                jr      nc,xor_10
2190
        ld      b, #9
2191
        jp      fail_routine
2192
xor_10:         cp      #0xaa
2193
                jr      z,xor_11
2194
        ld      b, #10
2195
        jp      fail_routine
2196
xor_11:         ld      a,#0xff
2197
                ld      c,#0x7f
2198
                xor     a,c
2199
                jp      m,xor_12
2200
        ld      b, #11
2201
        jp      fail_routine
2202
xor_12:         cp      #0x80
2203
                jr      z,xor_13
2204
        ld      b, #12
2205
        jp      fail_routine
2206
xor_13:         ld      a,#0xff
2207
                ld      d,#0x55
2208
                xor     a,d
2209
                jp      m,xor_14
2210
        ld      b, #13
2211
        jp      fail_routine
2212
xor_14:         cp      #0xaa
2213
                jr      z,xor_15
2214
        ld      b, #14
2215
        jp      fail_routine
2216
xor_15:         ld      e,#0x55
2217
                xor     a,e
2218
                jp      m,xor_16
2219
        ld      b, #15
2220
        jp      fail_routine
2221
xor_16:         cp      #0xff
2222
                jr      z,xor_17
2223
        ld      b, #16
2224
        jp      fail_routine
2225
xor_17:         ld      a,#0xff
2226
                ld      h,#0x7f
2227
                xor     a,h
2228
                jp      po,xor_18
2229
        ld      b, #17
2230
        jp      fail_routine
2231
xor_18:         ld      l,#0x7f
2232
                xor     a,l
2233
                jp      pe,xor_19
2234
        ld      b, #18
2235
        jp      fail_routine
2236
xor_19:         cp      #0xff
2237
                jr      z,xor_20
2238
        ld      b, #19
2239
        jp      fail_routine
2240
xor_20:         ld      a,#0xff
2241
                add     a,#1
2242
                jr      c,xor_21
2243
        ld      b, #20
2244
        jp      fail_routine
2245
xor_21:         ld      b,#0x7f
2246
                xor     a,b
2247
                jr      nc,xor_22
2248
        ld      b, #21
2249
        jp      fail_routine
2250
xor_22:         cp      #0x7f
2251
                jr      z,xor_23
2252
        ld      b, #22
2253
        jp      fail_routine
2254
xor_23:         ld      a,#0xff
2255
                xor     a,#0x7f
2256
                jp      po,xor_24
2257
        ld      b, #23
2258
        jp      fail_routine
2259
xor_24:         jp      m,xor_25
2260
        ld      b, #24
2261
        jp      fail_routine
2262
xor_25:         xor     a,#0x7f
2263
                jp      pe,xor_26
2264
        ld      b, #25
2265
        jp      fail_routine
2266
xor_26:         jp      m,xor_27
2267
        ld      b, #26
2268
        jp      fail_routine
2269
xor_27:         xor     a,#0xaa
2270
                jp      p,xor_28
2271
        ld      b, #27
2272
        jp      fail_routine
2273
xor_28:         cp      #0x55
2274
                jr      z,xor_29
2275
        ld      b, #28
2276
        jp      fail_routine
2277
xor_29:         ld      a,#0xff
2278
                xor     a,#0xff
2279
                jr      z,xor_30
2280
        ld      b, #29
2281
        jp      fail_routine
2282
xor_30:         xor     a,#0x80
2283
                jr      nz,xor_31
2284
        ld      b, #30
2285
        jp      fail_routine
2286
xor_31:         cp      #0x80
2287
                jr      z,xor_32
2288
        ld      b, #31
2289
        jp      fail_routine
2290
xor_32:         ld      hl,#var5
2291
                ld      a,#0xff
2292
                xor     a,(hl)
2293
                jp      m,xor_33
2294
        ld      b, #32
2295
        jp      fail_routine
2296
xor_33:         jp      po,xor_34
2297
        ld      b, #33
2298
        jp      fail_routine
2299
xor_34:         xor     a,(hl)
2300
                jp      m,xor_35
2301
        ld      b, #34
2302
        jp      fail_routine
2303
xor_35:         jp      pe,xor_36
2304
        ld      b, #35
2305
        jp      fail_routine
2306
xor_36:         ld      hl,#var3
2307
                xor     a,(hl)
2308
                jp      p,xor_37
2309
        ld      b, #36
2310
        jp      fail_routine
2311
xor_37:         cp      #0x7f
2312
                jr      z,xor_38
2313
        ld      b, #37
2314
        jp      fail_routine
2315
xor_38:         ld      hl,#var1
2316
                ld      a,#0xff
2317
                xor     a,(hl)
2318
                jr      z,xor_39
2319
        ld      b, #38
2320
        jp      fail_routine
2321
xor_39:         ld      hl,#var2
2322
                xor     a,(hl)
2323
                jr      nz,xor_40
2324
        ld      b, #39
2325
        jp      fail_routine
2326
xor_40:         cp      #0x55
2327
                jr      z,xor_41
2328
        ld      b, #40
2329
        jp      fail_routine
2330
xor_41:         ld      ix,#var3
2331
                ld      a,#0xff
2332
                xor     a,2(ix)
2333
                jp      m,xor_42
2334
        ld      b, #41
2335
        jp      fail_routine
2336
xor_42:         jp      po,xor_43
2337
        ld      b, #42
2338
        jp      fail_routine
2339
xor_43:         xor     a,2(ix)
2340
                jp      m,xor_44
2341
        ld      b, #43
2342
        jp      fail_routine
2343
xor_44:         jp      pe,xor_45
2344
        ld      b, #44
2345
        jp      fail_routine
2346
xor_45:         xor     a,1(ix)
2347
                jp      p,xor_46
2348
        ld      b, #45
2349
        jp      fail_routine
2350
xor_46:         cp      #0x55
2351
                jr      z,xor_47
2352
        ld      b, #46
2353
        jp      fail_routine
2354
xor_47:         ld      a,#0xff
2355
                xor     a,-2(ix)
2356
                jr      z,xor_48
2357
        ld      b, #47
2358
        jp      fail_routine
2359
xor_48:         xor     a,1(ix)
2360
                jr      nz,xor_49
2361
        ld      b, #48
2362
        jp      fail_routine
2363
xor_49:         cp      #0xaa
2364
                jr      z,xor_50
2365
        ld      b, #49
2366
        jp      fail_routine
2367
xor_50:         ld      iy,#var3
2368
                ld      a,#0xff
2369
                xor     a,2(iy)
2370
                jp      m,xor_51
2371
        ld      b, #50
2372
        jp      fail_routine
2373
xor_51:         jp      po,xor_52
2374
        ld      b, #51
2375
        jp      fail_routine
2376
xor_52:         xor     a,2(iy)
2377
                jp      m,xor_53
2378
        ld      b, #52
2379
        jp      fail_routine
2380
xor_53:         jp      pe,xor_54
2381
        ld      b, #53
2382
        jp      fail_routine
2383
xor_54:         xor     a,1(iy)
2384
                jp      p,xor_55
2385
        ld      b, #54
2386
        jp      fail_routine
2387
xor_55:         cp      #0x55
2388
                jr      z,xor_56
2389
        ld      b, #55
2390
        jp      fail_routine
2391
xor_56:         ld      a,#0xff
2392
                xor     a,-2(iy)
2393
                jr      z,xor_57
2394
        ld      b, #56
2395
        jp      fail_routine
2396
xor_57:         xor     a,-1(iy)
2397
                jr      nz,xor_58
2398
        ld      b, #57
2399
        jp      fail_routine
2400
xor_58:         cp      #0x55
2401
                jr      z,cp_0
2402
        ld      b, #58
2403
        jp      fail_routine
2404
cp_0:           nop
2405
        ld hl, #cp_0
2406
        call print_sub
2407
                ld      a,#0
2408
                ld      b,#0
2409
                cp      a,b
2410
                jr      z,cp_1
2411
        ld      b, #0
2412
        jp      fail_routine
2413
cp_1:           jp      p,cp_2
2414
        ld      b, #1
2415
        jp      fail_routine
2416
cp_2:           jr      nc,cp_3
2417
        ld      b, #2
2418
        jp      fail_routine
2419
cp_3:           ld      b,#0x55
2420
                cp      a,b
2421
                jr      nz,cp_4
2422
        ld      b, #3
2423
        jp      fail_routine
2424
cp_4:           jp      m,cp_5
2425
        ld      b, #4
2426
        jp      fail_routine
2427
cp_5:           jr      c,cp_6
2428
        ld      b, #5
2429
        jp      fail_routine
2430
cp_6:           ld      a,#0x80
2431
                ld      b,#0x7f
2432
                cp      a,b
2433
                jp      pe,cp_7
2434
        ld      b, #6
2435
        jp      fail_routine
2436
cp_7:           jr      nc,cp_8
2437
        ld      b, #7
2438
        jp      fail_routine
2439
cp_8:           ld      a,#0x7f
2440
                ld      b,#0x80
2441
                cp      a,b
2442
                jp      pe,cp_9
2443
        ld      b, #8
2444
        jp      fail_routine
2445
cp_9:           jr      c,cp_10
2446
        ld      b, #9
2447
        jp      fail_routine
2448
cp_10:          ld      b,#0
2449
                cp      a,b
2450
                jp      po,cp_11
2451
        ld      b, #10
2452
        jp      fail_routine
2453
cp_11:          jr      nc,cp_12
2454
        ld      b, #11
2455
        jp      fail_routine
2456
cp_12:          ld      a,#0x80
2457
                ld      c,#0
2458
                cp      a,c
2459
                jp      m,cp_13
2460
        ld      b, #12
2461
        jp      fail_routine
2462
cp_13:          ld      c,#0x80
2463
                cp      a,c
2464
                jr      z,cp_14
2465
        ld      b, #13
2466
        jp      fail_routine
2467
cp_14:          ld      a,#0x7f
2468
                ld      d,#0x55
2469
                cp      a,d
2470
                jp      p,cp_15
2471
        ld      b, #14
2472
        jp      fail_routine
2473
cp_15:          jr      nz,cp_16
2474
        ld      b, #15
2475
        jp      fail_routine
2476
cp_16:          ld      e,#0x7f
2477
                cp      a,e
2478
                jr      z,cp_17
2479
        ld      b, #16
2480
        jp      fail_routine
2481
cp_17:          ld      a,#0x80
2482
                ld      h,#0xff
2483
                cp      a,h
2484
                jp      m,cp_18
2485
        ld      b, #17
2486
        jp      fail_routine
2487
cp_18:          jr      c,cp_19
2488
        ld      b, #18
2489
        jp      fail_routine
2490
cp_19:          ld      l,#0x80
2491
                cp      a,l
2492
                jr      z,cp_20
2493
        ld      b, #19
2494
        jp      fail_routine
2495
cp_20:          ld      a,#0x80
2496
                cp      a,#0x7f
2497
                jp      p,cp_21
2498
        ld      b, #20
2499
        jp      fail_routine
2500
cp_21:          jp      pe,cp_22
2501
        ld      b, #21
2502
        jp      fail_routine
2503
cp_22:          jr      nz,cp_23
2504
        ld      b, #22
2505
        jp      fail_routine
2506
cp_23:          cp      a,#0x80
2507
                jp      p,cp_24
2508
        ld      b, #23
2509
        jp      fail_routine
2510
cp_24:          jp      po,cp_25
2511
        ld      b, #24
2512
        jp      fail_routine
2513
cp_25:          jr      z,cp_26
2514
        ld      b, #25
2515
        jp      fail_routine
2516
cp_26:          ld      a,#0x55
2517
                cp      a,#0x7f
2518
                jr      c,cp_27
2519
        ld      b, #26
2520
        jp      fail_routine
2521
cp_27:          jp      m,cp_28
2522
        ld      b, #27
2523
        jp      fail_routine
2524
cp_28:          cp      a,#0x55
2525
                jr      nc,cp_29
2526
        ld      b, #28
2527
        jp      fail_routine
2528
cp_29:          jr      z,cp_30
2529
        ld      b, #29
2530
        jp      fail_routine
2531
cp_30:          ld      a,#0x80
2532
                ld      hl,#var5
2533
                cp      a,(hl)
2534
                jp      p,cp_31
2535
        ld      b, #30
2536
        jp      fail_routine
2537
cp_31:          jp      pe,cp_32
2538
        ld      b, #31
2539
        jp      fail_routine
2540
cp_32:          jr      nz,cp_33
2541
        ld      b, #32
2542
        jp      fail_routine
2543
cp_33:          ld      hl,#var3
2544
                cp      a,(hl)
2545
                jp      p,cp_34
2546
        ld      b, #33
2547
        jp      fail_routine
2548
cp_34:          jp      po,cp_35
2549
        ld      b, #34
2550
        jp      fail_routine
2551
cp_35:          jr      z,cp_36
2552
        ld      b, #35
2553
        jp      fail_routine
2554
cp_36:          ld      a,#0x55
2555
                ld      hl,#var5
2556
                cp      a,(hl)
2557
                jr      c,cp_37
2558
        ld      b, #36
2559
        jp      fail_routine
2560
cp_37:          jp      m,cp_38
2561
        ld      b, #37
2562
        jp      fail_routine
2563
cp_38:          ld      hl,#var2
2564
                cp      a,(hl)
2565
                jr      nc,cp_39
2566
        ld      b, #38
2567
        jp      fail_routine
2568
cp_39:          jp      p,cp_40
2569
        ld      b, #39
2570
        jp      fail_routine
2571
cp_40:          jr      z,cp_41
2572
        ld      b, #40
2573
        jp      fail_routine
2574
cp_41:          ld      a,#0x80
2575
                ld      ix,#var3
2576
                cp      a,2(ix)
2577
                jp      p,cp_42
2578
        ld      b, #41
2579
        jp      fail_routine
2580
cp_42:          jp      pe,cp_43
2581
        ld      b, #42
2582
        jp      fail_routine
2583
cp_43:          jr      nz,cp_44
2584
        ld      b, #43
2585
        jp      fail_routine
2586
cp_44:          cp      a,(ix)
2587
                jp      p,cp_45
2588
        ld      b, #44
2589
        jp      fail_routine
2590
cp_45:          jp      po,cp_46
2591
        ld      b, #45
2592
        jp      fail_routine
2593
cp_46:          jr      z,cp_47
2594
        ld      b, #46
2595
        jp      fail_routine
2596
cp_47:          ld      a,#0x55
2597
                cp      a,-2(ix)
2598
                jr      nz,cp_48
2599
        ld      b, #47
2600
        jp      fail_routine
2601
cp_48:          jr      c,cp_49
2602
        ld      b, #48
2603
        jp      fail_routine
2604
cp_49:          cp      a,-1(ix)
2605
                jr      z,cp_50
2606
        ld      b, #49
2607
        jp      fail_routine
2608
cp_50:          jr      nc,cp_51
2609
        ld      b, #50
2610
        jp      fail_routine
2611
cp_51:          ld      iy,#var3
2612
                ld      a,#0x80
2613
                cp      a,2(iy)
2614
                jp      p,cp_52
2615
        ld      b, #51
2616
        jp      fail_routine
2617
cp_52:          jp      pe,cp_53
2618
        ld      b, #52
2619
        jp      fail_routine
2620
cp_53:          jr      nz,cp_54
2621
        ld      b, #53
2622
        jp      fail_routine
2623
cp_54:          cp      a,(iy)
2624
                jp      p,cp_55
2625
        ld      b, #54
2626
        jp      fail_routine
2627
cp_55:          jp      po,cp_56
2628
        ld      b, #55
2629
        jp      fail_routine
2630
cp_56:          jr      z,cp_57
2631
        ld      b, #56
2632
        jp      fail_routine
2633
cp_57:          ld      a,#0x55
2634
                cp      a,-2(iy)
2635
                jr      nz,cp_58
2636
        ld      b, #57
2637
        jp      fail_routine
2638
cp_58:          jr      c,cp_59
2639
        ld      b, #58
2640
        jp      fail_routine
2641
cp_59:          cp      a,-1(iy)
2642
                jr      z,cp_60
2643
        ld      b, #59
2644
        jp      fail_routine
2645
cp_60:          jr      nc,inc_0
2646
        ld      b, #60
2647
        jp      fail_routine
2648
inc_0:          nop
2649
        ld hl, #msg_inc
2650
        call print_sub
2651
                ld      a,#0x7f
2652
                cp      a,#0x7f
2653
                jr      z,inc_1
2654
        ld      b, #0
2655
        jp      fail_routine
2656
inc_1:          inc     a
2657
                jp      pe,inc_2
2658
        ld      b, #1
2659
        jp      fail_routine
2660
inc_2:          jp      m,inc_3
2661
        ld      b, #2
2662
        jp      fail_routine
2663
inc_3:          jr      nz,inc_4
2664
        ld      b, #3
2665
        jp      fail_routine
2666
inc_4:          ld      a,#0x55
2667
                inc     a
2668
                jp      po,inc_5
2669
        ld      b, #4
2670
        jp      fail_routine
2671
inc_5:          jp      p,inc_6
2672
        ld      b, #5
2673
        jp      fail_routine
2674
inc_6:          cp      a,#0x55+1
2675
                jr      z,inc_7
2676
        ld      b, #6
2677
        jp      fail_routine
2678
inc_7:          ld      a,#0xff-1
2679
                inc     a
2680
                jr      nz,inc_8
2681
        ld      b, #7
2682
        jp      fail_routine
2683
inc_8:          jp      m,inc_9
2684
        ld      b, #8
2685
        jp      fail_routine
2686
inc_9:          inc     a
2687
                jr      z,inc_10
2688
        ld      b, #9
2689
        jp      fail_routine
2690
inc_10:         ld      b,#0xaa
2691
                inc     b
2692
                jp      m,inc_11
2693
        ld      b, #10
2694
        jp      fail_routine
2695
inc_11:         ld      a,b
2696
                cp      a,#0xaa+1
2697
                jr      z,inc_12
2698
        ld      b, #11
2699
        jp      fail_routine
2700
inc_12:         ld      c,#0x80
2701
                inc     c
2702
                jp      m,inc_13
2703
        ld      b, #12
2704
        jp      fail_routine
2705
inc_13:         ld      a,c
2706
                cp      a,#0x80+1
2707
                jr      z,inc_14
2708
        ld      b, #13
2709
        jp      fail_routine
2710
inc_14:         ld      d,#0xff
2711
                inc     d
2712
                jr      z,inc_15
2713
        ld      b, #14
2714
        jp      fail_routine
2715
inc_15:         ld      e,#0x55
2716
                inc     e
2717
                jp      p,inc_16
2718
        ld      b, #15
2719
        jp      fail_routine
2720
inc_16:         ld      a,e
2721
                cp      a,#0x55+1
2722
                jr      z,inc_17
2723
        ld      b, #16
2724
        jp      fail_routine
2725
inc_17:         ld      h,#0x7f
2726
                inc     h
2727
                jp      pe,inc_18
2728
        ld      b, #17
2729
        jp      fail_routine
2730
inc_18:         ld      a,h
2731
                cp      a,#0x80
2732
                jr      z,inc_19
2733
        ld      b, #18
2734
        jp      fail_routine
2735
inc_19:         ld      l,#0xaa
2736
                inc     l
2737
                jp      m,inc_20
2738
        ld      b, #19
2739
        jp      fail_routine
2740
inc_20:         ld      a,l
2741
                cp      a,#0xaa+1
2742
                jr      z,inc_21
2743
        ld      b, #20
2744
        jp      fail_routine
2745
inc_21:         ld      hl,#t_var1
2746
                ld      a,#0x7f
2747
                ld      (hl),a
2748
                cp      a,(hl)
2749
                jr      z,inc_22
2750
        ld      b, #21
2751
        jp      fail_routine
2752
inc_22:         inc     (hl)
2753
                jp      m,inc_23
2754
        ld      b, #22
2755
        jp      fail_routine
2756
inc_23:         jp      pe,inc_24
2757
        ld      b, #23
2758
        jp      fail_routine
2759
inc_24:         ld      a,#0x55
2760
                ld      (hl),a
2761
                inc     (hl)
2762
                jp      p,inc_25
2763
        ld      b, #24
2764
        jp      fail_routine
2765
inc_25:         jp      po,inc_26
2766
        ld      b, #25
2767
        jp      fail_routine
2768
inc_26:         ld      a,(hl)
2769
                cp      a,#0x55+1
2770
                jr      z,inc_27
2771
        ld      b, #26
2772
        jp      fail_routine
2773
inc_27:         ld      a,#0xff
2774
                ld      (hl),a
2775
                inc     (hl)
2776
                jr      z,inc_28
2777
        ld      b, #27
2778
        jp      fail_routine
2779
inc_28:         inc     (hl)
2780
                jr      nz,inc_29
2781
        ld      b, #28
2782
        jp      fail_routine
2783
inc_29:         ld      a,(hl)
2784
                cp      a,#1
2785
                jr      z,inc_30
2786
        ld      b, #29
2787
        jp      fail_routine
2788
inc_30:         ld      a,#0xaa
2789
                ld      (hl),a
2790
                inc     (hl)
2791
                jp      m,inc_31
2792
        ld      b, #30
2793
        jp      fail_routine
2794
inc_31:         ld      a,(hl)
2795
                cp      a,#0xaa+1
2796
                jr      z,inc_32
2797
        ld      b, #31
2798
        jp      fail_routine
2799
inc_32:         ld      ix,#t_var3
2800
                ld      a,#0x7f
2801
                ld      -2(ix),a
2802
                cp      a,#0x7f
2803
                jr      z,inc_33
2804
        ld      b, #32
2805
        jp      fail_routine
2806
inc_33:         inc     -2(ix)
2807
                jp      m,inc_34
2808
        ld      b, #33
2809
        jp      fail_routine
2810
inc_34:         jp      pe,inc_35
2811
        ld      b, #34
2812
        jp      fail_routine
2813
inc_35:         ld      a,#0x55
2814
                ld      2(ix),a
2815
                inc     2(ix)
2816
                jp      p,inc_36
2817
        ld      b, #35
2818
        jp      fail_routine
2819
inc_36:         jp      po,inc_37
2820
        ld      b, #36
2821
        jp      fail_routine
2822
inc_37:         ld      a,2(ix)
2823
                cp      a,#0x55+1
2824
                jr      z,inc_38
2825
        ld      b, #37
2826
        jp      fail_routine
2827
inc_38:         ld      a,#0xff
2828
                ld      -1(ix),a
2829
                inc     -1(ix)
2830
                jr      z,inc_39
2831
        ld      b, #38
2832
        jp      fail_routine
2833
inc_39:         inc     -1(ix)
2834
                jr      nz,inc_40
2835
        ld      b, #39
2836
        jp      fail_routine
2837
inc_40:         ld      a,-1(ix)
2838
                cp      a,#1
2839
                jr      z,inc_41
2840
        ld      b, #40
2841
        jp      fail_routine
2842
inc_41:         ld      a,#0xaa
2843
                ld      1(ix),a
2844
                inc     1(ix)
2845
                jp      m,inc_42
2846
        ld      b, #41
2847
        jp      fail_routine
2848
inc_42:         ld      a,1(ix)
2849
                cp      a,#0xaa+1
2850
                jr      z,inc_43
2851
        ld      b, #42
2852
        jp      fail_routine
2853
inc_43:         ld      iy,#t_var3
2854
                ld      a,#0x7f
2855
                ld      2(iy),a
2856
                cp      a,#0x7f
2857
                jr      z,inc_44
2858
        ld      b, #43
2859
        jp      fail_routine
2860
inc_44:         inc     2(iy)
2861
                jp      m,inc_45
2862
        ld      b, #44
2863
        jp      fail_routine
2864
inc_45:         jp      pe,inc_46
2865
        ld      b, #45
2866
        jp      fail_routine
2867
inc_46:         ld      a,#0x55
2868
                ld      -2(iy),a
2869
                inc     -2(iy)
2870
                jp      p,inc_47
2871
        ld      b, #46
2872
        jp      fail_routine
2873
inc_47:         jp      po,inc_48
2874
        ld      b, #47
2875
        jp      fail_routine
2876
inc_48:         ld      a,-2(iy)
2877
                cp      a,#0x55+1
2878
                jr      z,inc_49
2879
        ld      b, #48
2880
        jp      fail_routine
2881
inc_49:         ld      a,#0xff
2882
                ld      1(iy),a
2883
                inc     1(iy)
2884
                jr      z,inc_50
2885
        ld      b, #49
2886
        jp      fail_routine
2887
inc_50:         inc     1(iy)
2888
                jr      nz,inc_51
2889
        ld      b, #50
2890
        jp      fail_routine
2891
inc_51:         ld      a,1(iy)
2892
                cp      a,#1
2893
                jr      z,inc_52
2894
        ld      b, #51
2895
        jp      fail_routine
2896
inc_52:         ld      a,#0x80
2897
                ld      -1(iy),a
2898
                inc     -1(iy)
2899
                jp      m,inc_53
2900
        ld      b, #52
2901
        jp      fail_routine
2902
inc_53:         ld      a,-1(iy)
2903
                cp      a,#0x80+1
2904
                jr      z,dec_0
2905
        ld      b, #53
2906
        jp      fail_routine
2907
dec_0:          nop
2908
        ld hl, #msg_dec
2909
        call print_sub
2910
                ld      a,#0x80
2911
                cp      a,#0x80
2912
                jr      z,dec_1
2913
        ld      b, #0
2914
        jp      fail_routine
2915
dec_1:          dec     a
2916
                jp      p,dec_2
2917
        ld      b, #1
2918
        jp      fail_routine
2919
dec_2:          jp      pe,dec_3
2920
        ld      b, #2
2921
        jp      fail_routine
2922
dec_3:          ld      a,#0
2923
                dec     a
2924
                jp      m,dec_4
2925
        ld      b, #3
2926
        jp      fail_routine
2927
dec_4:          jp      po,dec_5
2928
        ld      b, #4
2929
        jp      fail_routine
2930
dec_5:          cp      a,#0xff
2931
                jr      z,dec_6
2932
        ld      b, #5
2933
        jp      fail_routine
2934
dec_6:          ld      a,#1
2935
                dec     a
2936
                jr      z,dec_7
2937
        ld      b, #6
2938
        jp      fail_routine
2939
dec_7:          dec     a
2940
                jr      nz,dec_8
2941
        ld      b, #7
2942
        jp      fail_routine
2943
dec_8:          cp      a,#0xff
2944
                jr      z,dec_9
2945
        ld      b, #8
2946
        jp      fail_routine
2947
dec_9:          ld      a,#0xaa
2948
                dec     a
2949
                cp      a,#0xaa-1
2950
                jr      z,dec_10
2951
        ld      b, #9
2952
        jp      fail_routine
2953
dec_10:         ld      b,#0x7f
2954
                dec     b
2955
                ld      a,b
2956
                cp      a,#0x7f-1
2957
                jr      z,dec_11
2958
        ld      b, #10
2959
        jp      fail_routine
2960
dec_11:         ld      c,#0x55
2961
                dec     c
2962
                ld      a,c
2963
                cp      a,#0x55-1
2964
                jr      z,dec_12
2965
        ld      b, #11
2966
        jp      fail_routine
2967
dec_12:         ld      d,#0xaa
2968
                dec     d
2969
                ld      a,d
2970
                cp      a,#0xaa-1
2971
                jr      z,dec_13
2972
        ld      b, #12
2973
        jp      fail_routine
2974
dec_13:         ld      e,#0x80
2975
                dec     e
2976
                ld      a,e
2977
                cp      a,#0x80-1
2978
                jr      z,dec_14
2979
        ld      b, #13
2980
        jp      fail_routine
2981
dec_14:         ld      h,#0xff
2982
                dec     h
2983
                ld      a,h
2984
                cp      a,#0xff-1
2985
                jr      z,dec_15
2986
        ld      b, #14
2987
        jp      fail_routine
2988
dec_15:         ld      l,#0x55
2989
                dec     l
2990
                ld      a,l
2991
                cp      a,#0x55-1
2992
                jr      z,dec_16
2993
        ld      b, #15
2994
        jp      fail_routine
2995
dec_16:         ld      hl,#t_var5
2996
                ld      a,#0x80
2997
                ld      (hl),a
2998
                cp      a,(hl)
2999
                jr      z,dec_17
3000
        ld      b, #16
3001
        jp      fail_routine
3002
dec_17:         dec     (hl)
3003
                jp      p,dec_18
3004
        ld      b, #17
3005
        jp      fail_routine
3006
dec_18:         jp      pe,dec_19
3007
        ld      b, #18
3008
        jp      fail_routine
3009
dec_19:         ld      a,#0
3010
                ld      (hl),a
3011
                dec     (hl)
3012
                jp      m,dec_20
3013
        ld      b, #19
3014
        jp      fail_routine
3015
dec_20:         jp      po,dec_21
3016
        ld      b, #20
3017
        jp      fail_routine
3018
dec_21:         ld      a,(hl)
3019
                cp      a,#0xff
3020
                jr      z,dec_22
3021
        ld      b, #21
3022
        jp      fail_routine
3023
dec_22:         ld      a,#1
3024
                ld      (hl),a
3025
                dec     (hl)
3026
                jr      z,dec_23
3027
        ld      b, #22
3028
        jp      fail_routine
3029
dec_23:         dec     (hl)
3030
                jr      nz,dec_24
3031
        ld      b, #23
3032
        jp      fail_routine
3033
dec_24:         ld      a,(hl)
3034
                cp      a,#0xff
3035
                jr      z,dec_25
3036
        ld      b, #24
3037
        jp      fail_routine
3038
dec_25:         ld      a,#0xaa
3039
                ld      (hl),a
3040
                dec     (hl)
3041
                ld      a,(hl)
3042
                cp      a,#0xaa-1
3043
                jr      z,dec_26
3044
        ld      b, #25
3045
        jp      fail_routine
3046
dec_26:         ld      ix,#t_var3
3047
                ld      a,#0x80
3048
                ld      -2(ix),a
3049
                cp      a,-2(ix)
3050
                jr      z,dec_27
3051
        ld      b, #26
3052
        jp      fail_routine
3053
dec_27:         dec     -2(ix)
3054
                jp      p,dec_28
3055
        ld      b, #27
3056
        jp      fail_routine
3057
dec_28:         jp      pe,dec_29
3058
        ld      b, #28
3059
        jp      fail_routine
3060
dec_29:         ld      a,#0
3061
                ld      2(ix),a
3062
                dec     2(ix)
3063
                jp      m,dec_30
3064
        ld      b, #29
3065
        jp      fail_routine
3066
dec_30:         jp      po,dec_31
3067
        ld      b, #30
3068
        jp      fail_routine
3069
dec_31:         ld      a,2(ix)
3070
                cp      a,#0xff
3071
                jr      z,dec_32
3072
        ld      b, #31
3073
        jp      fail_routine
3074
dec_32:         ld      a,#1
3075
                ld      -1(ix),a
3076
                dec     -1(ix)
3077
                jr      z,dec_33
3078
        ld      b, #32
3079
        jp      fail_routine
3080
dec_33:         dec     -1(ix)
3081
                jr      nz,dec_34
3082
        ld      b, #33
3083
        jp      fail_routine
3084
dec_34:         ld      a,-1(ix)
3085
                cp      a,#0xff
3086
                jr      z,dec_35
3087
        ld      b, #34
3088
        jp      fail_routine
3089
dec_35:         ld      a,#0x7f
3090
                ld      1(ix),a
3091
                dec     1(ix)
3092
                ld      a,1(ix)
3093
                cp      a,#0x7f-1
3094
                jr      z,dec_36
3095
        ld      b, #35
3096
        jp      fail_routine
3097
dec_36:         ld      iy,#t_var3
3098
                ld      a,#0x80
3099
                ld      -2(iy),a
3100
                cp      a,-2(iy)
3101
                jr      z,dec_37
3102
        ld      b, #36
3103
        jp      fail_routine
3104
dec_37:         dec     -2(iy)
3105
                jp      p,dec_38
3106
        ld      b, #37
3107
        jp      fail_routine
3108
dec_38:         jp      pe,dec_39
3109
        ld      b, #38
3110
        jp      fail_routine
3111
dec_39:         ld      a,#0
3112
                ld      2(iy),a
3113
                dec     2(iy)
3114
                jp      m,dec_40
3115
        ld      b, #39
3116
        jp      fail_routine
3117
dec_40:         jp      po,dec_41
3118
        ld      b, #40
3119
        jp      fail_routine
3120
dec_41:         ld      a,2(iy)
3121
                cp      a,#0xff
3122
                jr      z,dec_42
3123
        ld      b, #41
3124
        jp      fail_routine
3125
dec_42:         ld      a,#1
3126
                ld      1(iy),a
3127
                dec     1(iy)
3128
                jr      z,dec_43
3129
        ld      b, #42
3130
        jp      fail_routine
3131
dec_43:         dec     1(iy)
3132
                jr      nz,dec_44
3133
        ld      b, #43
3134
        jp      fail_routine
3135
dec_44:         ld      a,1(iy)
3136
                cp      a,#0xff
3137
                jr      z,dec_45
3138
        ld      b, #44
3139
        jp      fail_routine
3140
dec_45:         ld      a,#0xaa
3141
                ld      -1(iy),a
3142
                dec     -1(iy)
3143
                ld      a,-1(iy)
3144
                cp      a,#0xaa-1
3145
                jr      z,cpl_0
3146
        ld      b, #45
3147
        jp      fail_routine
3148
cpl_0:          ld      a,#0xff
3149
                cpl
3150
                cp      a,#0
3151
                jr      z,cpl_1
3152
        ld      b, #0
3153
        jp      fail_routine
3154
cpl_1:          ld      a,#0xaa
3155
                cpl
3156
                cp      a,#0x55
3157
                jr      z,cpl_2
3158
        ld      b, #1
3159
        jp      fail_routine
3160
cpl_2:          cpl
3161
                cp      a,#0xaa
3162
                jr      z,neg_0
3163
        ld      b, #2
3164
        jp      fail_routine
3165
neg_0:          nop
3166
        ld hl, #msg_neg
3167
        call print_sub
3168
                ld      a,#0x80
3169
                cp      a,#0x80
3170
                jp      po,neg_1
3171
        ld      b, #0
3172
        jp      fail_routine
3173
neg_1:          neg
3174
                jp      pe,neg_2
3175
        ld      b, #1
3176
        jp      fail_routine
3177
neg_2:          jr      nz,neg_3
3178
        ld      b, #2
3179
        jp      fail_routine
3180
neg_3:          jr      c,neg_4
3181
        ld      b, #3
3182
        jp      fail_routine
3183
neg_4:          ld      a,#0
3184
                neg
3185
                jp      po,neg_5
3186
        ld      b, #4
3187
        jp      fail_routine
3188
neg_5:          jr      z,neg_6
3189
        ld      b, #5
3190
        jp      fail_routine
3191
neg_6:          jr      nc,neg_7
3192
        ld      b, #6
3193
        jp      fail_routine
3194
neg_7:          ld      a,#0x55
3195
                cp      a,#0x55
3196
                jp      p,neg_8
3197
        ld      b, #7
3198
        jp      fail_routine
3199
neg_8:          neg
3200
                jp      m,neg_9
3201
        ld      b, #8
3202
        jp      fail_routine
3203
neg_9:          neg
3204
                jp      p,neg_10
3205
        ld      b, #9
3206
        jp      fail_routine
3207
neg_10:         cp      a,#0x55
3208
                jr      z,end_of_test
3209
        ld      b, #10
3210
        jp      fail_routine
3211
 
3212
end_of_test:
3213
        jp      passed
3214
 
3215
 
3216
var1:           .db     #0x0
3217
var2:           .db     #0x0
3218
var3:           .db     #0x0
3219
var4:           .db     #0x0
3220
var5:           .db     #0x0
3221
 
3222
w_var1:         .dw     #0x0
3223
w_var2:         .dw     #0x0
3224
w_var3:         .dw     #0x0
3225
w_var4:         .dw     #0x0
3226
w_var5:         .dw     #0x0
3227
w_var6:         .dw     #0x0
3228
 
3229
.area    _DATA
3230
 
3231
 
3232
t_var1:         .db     0
3233
t_var2:         .db     0
3234
t_var3:         .db     0
3235
t_var4:         .db     0
3236
t_var5:         .db     0
3237
 
3238
 
3239
tw_var1:        .dw     0
3240
tw_var2:        .dw     0
3241
tw_var3:        .dw     0
3242
tw_var4:        .dw     0
3243
tw_var5:        .dw     0
3244
tw_var6:        .dw     0
3245
tw_var7:        .dw     0

powered by: WebSVN 2.1.0

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