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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [tests/] [tvs80/] [tvs80tst.asm] - Blame information for rev 103

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

Line No. Rev Author Line
1 27 ghutchis
; bjp   modified to assemble on as80.
2
; minor mods to account for changes in interrupt structure  and I/O
3
; all such are flagged with my initials.....
4
;
5
; The origional code used operators <   and  >  on symbols to extract the
6
; lower and higher bytes respectively.   It appears that as80 has no equivaltent.
7
; I have hand coded such ---- hopefully correctly.
8
; This is only a significant issue with such constructs as 
9
; My solution forces the stack to remain in its present location.
10
;
11
; WARNING   If you must move the stack  --   check comments and fix code for my kludges
12
;
13
;z80 simulator test routine
14
;total error count is left in a at end of test routine
15
 
16
; gth  modified to work in tv80 simulation environment
17
;      moved data segment from 7000 to 8000
18
;      replaced constants with stack_end_hi and stack_end_lo
19
 
20
                code
21
                org     #0000
22
;
23
rst_0000:       jp      rst_0000_1
24
;
25
                org     #0008
26
;
27
rst_0008:       ld      a,2
28
                ret
29
;
30
                org     #0010
31
;
32
rst_0010:       ld      a,3
33
                ret
34
;
35
                org     #0018
36
;
37
rst_0018:       ld      a,4
38
                ret
39
;
40
                org     #0020
41
;
42
rst_0020:       ld      a,5
43
                ret
44
;
45
                org     #0028
46
;
47
rst_0028:       ld      a,6
48
                ret
49
;
50
                org     #0030
51
;
52
rst_0030:       ld      a,7
53
                ret
54
;
55
                org     #0038
56
;
57
rst_0038:       ld      a,8
58
                ret
59
;
60
                code
61
;
62
 
63
fail:           db      'failed'
64
pass:           db      'passed'
65
message_addr:   equ     #be58
66
in_port:        equ     #ff
67
out_port:       equ     #10
68
;
69
data_55:        equ     #55
70
data_7f:        equ     #7f
71
data_80:        equ     #80
72
data_aa:        equ     #aa
73
data_ff:        equ     #ff
74
;
75
data_1234:      equ     #1234
76
data_55aa:      equ     #55aa
77
data_7fff:      equ     #7fff
78
data_8000:      equ     #8000
79
data_aa55:      equ     #aa55
80
data_ffff:      equ     #ffff
81
 
82
stack:          equ     #8100
83
stack_end:      equ     #8180
84
 
85
stack_end_hi:   equ     #81
86
stack_end_lo:   equ     #80
87
 
88
ctl_port:       equ     #80
89
print_port:     equ     #81
90
;
91
;inc_error_cnt  macro        ;bjp   change for initial test to halt on error
92
;               ld      hl,error_cnt
93
;               inc     (hl)
94
;               endm
95
;inc_error_cnt  macro        ; gth  replaced with fail_msg ###
96
;                ld      a, 2
97
;                out     (ctl_port), a
98
;               halt
99
;               endm
100
 
101
 
102
passed          macro
103
                ld      a, 1
104
                out     (ctl_port), a
105
                halt
106
                ;push   bc
107
                ;ld     bc,(pass)
108
                ;ld     (message_addr),bc
109
                ;ld     bc,(pass+2)
110
                ;ld     (message_addr+2),bc
111
                ;ld     bc,(pass+4)
112
                ;ld     (message_addr+4),bc
113
                ;pop    bc
114
                endm
115
;
116
failed          macro
117
                ld      a, 2
118
                out     (ctl_port), a
119
                halt
120
                ;push   bc
121
                ;ld     bc,(fail)
122
                ;ld     (message_addr),bc
123
                ;ld     bc,(fail+2)
124
                ;ld     (message_addr+2),bc
125
                ;ld     bc,(fail+4)
126
                ;ld     (message_addr+4),bc
127
                ;pop    bc
128
                endm
129
;
130
;
131
 
132
        ;; subroutine to print a message
133
        ;; called from within the "print" macro
134
        ;; expects address to be printed in hl
135
        ;; preserves all other registers
136
print_sub:
137
        push    bc
138
        ld      b, a
139
 
140
print_sub_loop:
141
        ld      a, (hl)
142
        cp      #0
143
        jp      z, print_sub_exit
144
        out     (print_port), a
145
        inc     hl
146
        jp      print_sub_loop
147
 
148
print_sub_exit:
149
        ld      a, b
150
        pop     bc
151
        ret
152
 
153
        ;; macro to print out a message
154
        ;; calls print_sub to do grunt work and minimize code impact of
155
        ;; strings
156
print   macro   message
157
 
158
        push    hl              ; preserve existing regs
159
        ld      hl, msg\?
160
        call    print_sub
161
        pop     hl
162
        jp      exit\?
163
 
164
msg\?   db      message
165
        db      #0a
166
        db      #00
167
 
168
exit\?:
169
 
170
        endm
171
 
172
        ;; print a hex number between 0-255, stored in the A register
173
print_number:
174
        push    bc
175
        ld      b, a            ; store number to be printed in b
176
 
177
        and     #f0
178
        sra     a
179
        sra     a
180
        sra     a
181
        sra     a
182
        cp      a, 10
183
        jp      p, alpha_0
184
        add     48              ; ordinal value of '0'
185
        out     (print_port), a
186
        jp      second_digit
187
alpha_0:
188
        add     55              ; 'A' - 10
189
        out     (print_port), a
190
 
191
second_digit:
192
        ld      a, b
193
        and     #0f
194
 
195
        cp      a, 10
196
        jp      p, alpha_1
197
        add     48
198
        out     (print_port), a
199
        jp      print_number_exit
200
 
201
alpha_1:
202
        add     55              ; 'A' - 10
203
        out     (print_port), a
204
 
205
print_number_exit:
206
        pop     bc
207
        ret
208
 
209
fail_text db   "Test failed at checkpoint #"
210
        db      #00
211
 
212
fail_routine:
213
        ld      hl, fail_text
214
        call    print_sub       ; print out boilerplate text
215
        ld      a, b
216
 
217
        call    print_number    ; print out error number
218
 
219
        ld      a, #0a          ; print carriage return
220
        out     (print_port), a
221
        failed
222
 
223
        ;; macro to print out failure checkpoint number
224
fail_msg macro number           ; fail with checkpoint number
225
        ld      b, number
226
        jp      fail_routine
227
        endm
228
 
229
print_ns macro message          ; print w/o using subroutine
230
 
231
        push    hl              ; preserve existing regs
232
        ld      hl, msg\?
233
 
234
        push    bc
235
        ld      b, a
236
loop\?:
237
        ld      a, (hl)
238
        cp      #0
239
        jp      z, exit\?
240
        out     (print_port), a
241
        inc     hl
242
        jp      loop\?
243
 
244
        pop     hl
245
        jp      exit\?
246
 
247
msg\?   db      message
248
        db      #0a
249
        db      #00
250
 
251
exit\?:
252
        ld      a, b
253
        pop     bc
254
        pop     hl
255
 
256
        endm
257
 
258
start:
259
                print "Starting test"
260
                ld      a, 1
261
                ld      (pass_count),a
262
                ld      hl,error_cnt
263
                ld      (hl),a                  ;clear error count
264
        call    mem_init
265
nop_1:          nop
266
                nop
267
                print "Starting ld tests"
268
ld_167:         ld      a,data_55
269
                cp      data_55
270
                jr      z,ld_1
271
                fail_msg 167
272
 
273
ld_1:           ld      b,data_7f
274
                ld      a,data_7f
275
                cp      b
276
                jr      z,ld_2
277
                fail_msg 1
278
ld_2:           ld      c,data_80
279
                ld      a,data_80
280
                cp      c
281
                jr      z,ld_3
282
                fail_msg 2
283
ld_3:           ld      d,data_aa
284
                ld      a,data_aa
285
                cp      d
286
                jr      z,ld_4
287
                fail_msg 3
288
ld_4:           ld      e,data_55
289
                ld      a,data_55
290
                cp      e
291
                jr      z,ld_5
292
                fail_msg 4
293
ld_5:           ld      h,data_7f
294
                ld      a,data_7f
295
                cp      h
296
                jr      z,ld_6
297
                fail_msg 5
298
ld_6:           ld      l,data_80
299
                ld      a,data_80
300
                cp      l
301
                jr      z,ld_7
302
                fail_msg 6
303
ld_7:           ld      a,data_55
304
                ld      b,a
305
                cp      b
306
                jr      z,ld_8
307
                fail_msg 7
308
ld_8:           ld      c,b
309
                cp      c
310
                jr      z,ld_9
311
                fail_msg 8
312
ld_9:           ld      d,c
313
                cp      d
314
                jr      z,ld_10
315
                fail_msg 9
316
ld_10:          ld      e,d
317
                cp      e
318
                jr      z,ld_11
319
                fail_msg 10
320
ld_11:          ld      h,e
321
                cp      h
322
                jr      z,ld_12
323
                fail_msg 11
324
ld_12:          ld      l,h
325
                cp      l
326
                jr      z,ld_13
327
                fail_msg 12
328
ld_13:          ld      l,data_80
329
                ld      a,l
330
                cp      l
331
                jr      z,ld_14
332
                fail_msg 13
333
ld_14:          ld      h,l
334
                cp      h
335
                jr      z,ld_15
336
                fail_msg 14
337
ld_15:          ld      e,h
338
                cp      e
339
                jr      z,ld_16
340
                fail_msg 15
341
ld_16:          ld      d,e
342
                cp      d
343
                jr      z,ld_17
344
                fail_msg 16
345
ld_17:          ld      c,d
346
                cp      c
347
                jr      z,ld_18
348
                fail_msg 17
349
ld_18:          ld      b,c
350
                cp      b
351
                jr      z,ld_19
352
                fail_msg 18
353
ld_19:          ld      hl,var1
354
                ld      a,(hl)
355
                cp      data_ff
356
                jr      z,ld_20
357
                fail_msg 19
358
ld_20:          ld      hl,var2
359
                ld      a,data_55
360
                ld      b,(hl)
361
                cp      b
362
                jr      z,ld_21
363
                fail_msg 20
364
ld_21:          ld      hl,var1
365
                ld      c,(hl)
366
                ld      a,(hl)
367
                cp      c
368
                jr      z,ld_22
369
                fail_msg 21
370
ld_22:          ld      hl,var2
371
                ld      d,(hl)
372
                ld      a,(hl)
373
                cp      d
374
                jr      z,ld_23
375
                fail_msg 22
376
ld_23:          ld      hl,var1
377
                ld      e,(hl)
378
                ld      a,(hl)
379
                cp      e
380
                jr      z,ld_24
381
                fail_msg 23
382
ld_24:          ld      hl,var2
383
                ld      a,(hl)
384
                ld      h,(hl)
385
                cp      h
386
                jr      z,ld_25
387
                fail_msg 24
388
ld_25:          ld      hl,var1
389
                ld      a,(hl)
390
                ld      l,(hl)
391
                cp      l
392
                jr      z,ld_26
393
                fail_msg 25
394
ld_26:          ld      ix,var3
395
                ld      a,(ix-2)
396
                cp      data_ff
397
                jr      z,ld_27
398
                fail_msg 26
399
ld_27:          ld      a,(ix+2)
400
                cp      data_7f
401
                jr      z,ld_28
402
                fail_msg 27
403
ld_28:          ld      a,(ix-1)
404
                ld      b,(ix-1)
405
                cp      b
406
                jr      z,ld_29
407
                fail_msg 28
408
ld_29:          cp      data_55
409
                jr      z,ld_30
410
                fail_msg 29
411
ld_30:          ld      a,(ix+1)
412
                ld      c,(ix+1)
413
                cp      c
414
                jr      z,ld_31
415
                fail_msg 30
416
ld_31:          cp      data_aa
417
                jr      z,ld_32
418
                fail_msg 31
419
ld_32:          ld      d,(ix-2)
420
                ld      a,(ix-2)
421
                cp      d
422
                jr      z,ld_33
423
                fail_msg 32
424
ld_33:          cp      data_ff
425
                jr      z,ld_34
426
                fail_msg 33
427
ld_34:          ld      e,(ix+2)
428
                ld      a,(ix+2)
429
                cp      e
430
                jr      z,ld_35
431
                fail_msg 34
432
ld_35:          cp      data_7f
433
                jr      z,ld_36
434
                fail_msg 35
435
ld_36:          ld      h,(ix+0)
436
                ld      a,(ix+0)
437
                cp      h
438
                jr      z,ld_37
439
                fail_msg 36
440
ld_37:          cp      data_80
441
                jr      z,ld_38
442
                fail_msg 37
443
ld_38:          ld      l,(ix-1)
444
                ld      a,(ix-1)
445
                cp      l
446
                jr      z,ld_39
447
                fail_msg 38
448
ld_39:          cp      data_55
449
                jr      z,ld_40
450
                fail_msg 39
451
ld_40:          ld      iy,var3
452
                ld      a,(iy-2)
453
                cp      data_ff
454
                jr      z,ld_41
455
                fail_msg 40
456
ld_41:          ld      a,(iy+2)
457
                cp      data_7f
458
                jr      z,ld_42
459
                fail_msg 41
460
ld_42:          ld      b,(iy-1)
461
                ld      a,(iy-1)
462
                cp      b
463
                jr      z,ld_43
464
                fail_msg 42
465
ld_43:          cp      data_55
466
                jr      z,ld_44
467
                fail_msg 43
468
ld_44:          ld      c,(iy+1)
469
                ld      a,(iy+1)
470
                cp      c
471
                jr      z,ld_45
472
                fail_msg 44
473
ld_45:          cp      data_aa
474
                jr      z,ld_46
475
                fail_msg 45
476
ld_46:          ld      d,(iy-2)
477
                ld      a,(iy-2)
478
                cp      d
479
                jr      z,ld_47
480
                fail_msg 46
481
ld_47:          cp      data_ff
482
                jr      z,ld_48
483
                fail_msg 47
484
ld_48:          ld      e,(iy+2)
485
                ld      a,(iy+2)
486
                cp      e
487
                jr      z,ld_49
488
                fail_msg 48
489
ld_49:          cp      data_7f
490
                jr      z,ld_50
491
                fail_msg 49
492
ld_50:
493
                ld      h,(iy+0)
494
                ld      a,(iy+0)
495
                cp      h
496
                jr      z,ld_51
497
                fail_msg 50
498
ld_51:          cp      data_80
499
                jr      z,ld_52
500
                fail_msg 51
501
ld_52:          ld      l,(iy-2)
502
                ld      a,(iy-2)
503
                cp      l
504
                jr      z,ld_53
505
                fail_msg 52
506
ld_53:          cp      data_ff
507
                jr      z,ld_54
508
                fail_msg 53
509
ld_54:          ld      hl,t_var1
510
                ld      a,data_aa+1
511
                ld      (hl),a
512
                ld      b,(hl)
513
                cp      b
514
                jr      z,ld_55
515
                fail_msg 54
516
ld_55:          cp      data_aa+1
517
                jr      z,ld_56
518
                fail_msg 55
519
ld_56:          ld      b,data_80+1
520
                ld      (hl),b
521
                ld      a,(hl)
522
                cp      b
523
                jr      z,ld_57
524
                fail_msg 56
525
ld_57:          cp      data_80+1
526
                jr      z,ld_58
527
                fail_msg 57
528
ld_58:          ld      c,data_55-1
529
                ld      (hl),c
530
                ld      a,(hl)
531
                cp      c
532
                jr      z,ld_59
533
                fail_msg 58
534
ld_59:          cp      data_55-1
535
                jr      z,ld_60
536
                fail_msg 59
537
ld_60:          ld      d,data_ff-1
538
                ld      (hl),d
539
                ld      a,(hl)
540
                cp      d
541
                jr      z,ld_61
542
                fail_msg 60
543
ld_61:          cp      data_ff-1
544
                jr      z,ld_62
545
                fail_msg 61
546
ld_62:          ld      e,data_55+1
547
                ld      (hl),e
548
                ld      a,(hl)
549
                cp      e
550
                jr      z,ld_63
551
                fail_msg 62
552
ld_63:          cp      data_55+1
553
                jr      z,ld_64
554
                fail_msg 63
555
ld_64:          ld      (hl),h
556
                ld      a,(hl)
557
                cp      h
558
                jr      z,ld_65
559
                fail_msg 64
560
ld_65:          cp      #80             ;bjp  guess  >t_var1
561
                jr      z,ld_66
562
                fail_msg 65
563
ld_66:          ld      (hl),l
564
                ld      a,(hl)
565
                cp      l
566
                jr      z,ld_67
567
                fail_msg 66
568
ld_67:          cp      a, #00          ;bjp  guess 
569
                jr      z,ld_68
570
                fail_msg 67
571
ld_68:          ld      ix,t_var3
572
                ld      a,data_55
573
                ld      (ix-2),a
574
                ld      a,0
575
                ld      a,(ix-2)
576
                cp      data_55
577
                jr      z,ld_69
578
                fail_msg 68
579
ld_69:          ld      a,data_80
580
                ld      (ix+2),a
581
                ld      a,0
582
                ld      a,(ix+2)
583
                cp      data_80
584
                jr      z,ld_70
585
                fail_msg 69
586
ld_70:          ld      b,data_7f
587
                ld      (ix-1),b
588
                ld      a,(ix-1)
589
                cp      b
590
                jr      z,ld_71
591
                fail_msg 70
592
ld_71:          cp      data_7f
593
                jr      z,ld_72
594
                fail_msg 71
595
ld_72:          ld      c,data_aa
596
                ld      (ix+1),c
597
                ld      a,(ix+1)
598
                cp      c
599
                jr      z,ld_73
600
                fail_msg 72
601
ld_73:          cp      data_aa
602
                jr      z,ld_74
603
                fail_msg 73
604
ld_74:          ld      d,data_80
605
                ld      (ix+0),d
606
                ld      a,(ix+0)
607
                cp      d
608
                jr      z,ld_75
609
                fail_msg 74
610
ld_75:          cp      data_80
611
                jr      z,ld_76
612
                fail_msg 75
613
ld_76:          ld      e,data_55+2
614
                ld      (ix-2),e
615
                ld      a,(ix-2)
616
                cp      e
617
                jr      z,ld_77
618
                fail_msg 76
619
ld_77:          cp      data_55+2
620
                jr      z,ld_78
621
                fail_msg 77
622
ld_78:          ld      h,data_aa-2
623
                ld      (ix+2),h
624
                ld      a,(ix+2)
625
                cp      h
626
                jr      z,ld_79
627
                fail_msg 78
628
ld_79:          cp      data_aa-2
629
                jr      z,ld_80
630
                fail_msg 79
631
ld_80:          ld      l,data_aa+2
632
                ld      (ix-1),l
633
                ld      a,(ix-1)
634
                cp      l
635
                jr      z,ld_81
636
                fail_msg 80
637
ld_81:          cp      data_aa+2
638
                jr      z,ld_82
639
                fail_msg 81
640
ld_82:          ld      iy,t_var3
641
                ld      a,data_ff
642
                ld      (iy-2),a
643
                ld      a,0
644
                ld      a,(iy-2)
645
                cp      data_ff
646
                jr      z,ld_83
647
                fail_msg 82
648
ld_83:          ld      a,data_7f
649
                ld      (iy+2),a
650
                ld      a,0
651
                ld      a,(iy+2)
652
                cp      data_7f
653
                jr      z,ld_84
654
                fail_msg 83
655
ld_84:          ld      b,data_55
656
                ld      (iy-1),b
657
                ld      a,(iy-1)
658
                cp      b
659
                jr      z,ld_85
660
                fail_msg 84
661
ld_85:          cp      data_55
662
                jr      z,ld_86
663
                fail_msg 85
664
ld_86:          ld      c,data_aa
665
                ld      (iy+1),c
666
                ld      a,(iy+1)
667
                cp      c
668
                jr      z,ld_87
669
                fail_msg 86
670
ld_87:          cp      data_aa
671
                jr      z,ld_88
672
                fail_msg 87
673
ld_88:          ld      d,data_80
674
                ld      (iy+0),d
675
                ld      a,(iy+0)
676
                cp      d
677
                jr      z,ld_89
678
                fail_msg 88
679
ld_89:          cp      data_80
680
                jr      z,ld_90
681
                fail_msg 89
682
ld_90:          ld      e,data_ff-2
683
                ld      (iy-2),e
684
                ld      a,(iy-2)
685
                cp      e
686
                jr      z,ld_91
687
                fail_msg 90
688
ld_91:          cp      data_ff-2
689
                jr      z,ld_92
690
                fail_msg 91
691
ld_92:          ld      h,data_7f-3
692
                ld      (iy+2),h
693
                ld      a,(iy+2)
694
                cp      h
695
                jr      z,ld_93
696
                fail_msg 92
697
ld_93:          cp      data_7f-3
698
                jr      z,ld_94
699
                fail_msg 93
700
ld_94:          ld      l,data_55-5
701
                ld      (iy-1),l
702
                ld      a,(iy-1)
703
                cp      l
704
                jr      z,ld_95
705
                fail_msg 94
706
ld_95:          cp      data_55-5
707
                jr      z,ld_96
708
                fail_msg 95
709
ld_96:          ld      hl,t_var1
710
                ld      (hl),data_80+10
711
                ld      a,(hl)
712
                cp      data_80+10
713
                jr      z,ld_97
714
                fail_msg 96
715
ld_97:          ld      ix,t_var3
716
                ld      (ix-2),data_55-10
717
                ld      a,(ix-2)
718
                cp      data_55-10
719
                jr      z,ld_98
720
                fail_msg 97
721
ld_98:          ld      (ix+2),data_55+10
722
                ld      a,(ix+2)
723
                cp      data_55+10
724
                jr      z,ld_99
725
                fail_msg 98
726
ld_99:          ld      iy,t_var2
727
                ld      (iy-1),data_80+17
728
                ld      a,(iy-1)
729
                cp      data_80+17
730
                jr      z,ld_100
731
                fail_msg 99
732
ld_100:
733
                ld      (iy+1),data_80-17
734
                ld      a,(iy+1)
735
                cp      data_80-17
736
                jr      z,ld_101
737
                fail_msg 100
738
ld_101:         ld      hl,t_var5
739
                ld      bc,t_var5
740
                ld      (hl),data_aa-10
741
                ld      a,(bc)
742
                cp      data_aa-10
743
                jr      z,ld_102
744
                fail_msg 101
745
ld_102:         ld      hl,t_var3
746
                ld      de,t_var3
747
                ld      (hl),data_aa+10
748
                ld      a,(de)
749
                cp      data_aa+10
750
                jr      z,ld_103
751
                fail_msg 102
752
ld_103:         ld      hl,t_var2
753
                ld      (hl),data_7f-25
754
                ld      a,(t_var2)
755
                cp      data_7f-25
756
                jr      z,ld_104
757
                fail_msg 103
758
ld_104:         ld      hl,t_var4
759
                ld      bc,t_var4
760
                ld      a,data_55-20
761
                ld      (bc),a
762
                ld      b,(hl)
763
                cp      b
764
                jr      z,ld_105
765
                fail_msg 104
766
ld_105:         ld      a,b
767
                cp      data_55-20
768
                jr      z,ld_106
769
                fail_msg 105
770
ld_106:         ld      hl,t_var5
771
                ld      de,t_var5
772
                ld      a,data_55+20
773
                ld      (de),a
774
                ld      c,(hl)
775
                cp      c
776
                jr      z,ld_107
777
                fail_msg 106
778
ld_107:         ld      a,c
779
                cp      data_55+20
780
                jr      z,ld_108
781
                fail_msg 107
782
ld_108:         ld      hl,t_var4
783
                ld      a,data_ff-24
784
                ld      (t_var4),a
785
                ld      e,(hl)
786
                cp      e
787
                jr      z,ld_109
788
                fail_msg 108
789
ld_109:         ld      a,e
790
                cp      data_ff-24
791
                jr      z,ld_110
792
                fail_msg 109
793
 
794
; commented out ld_110 so test can continue
795
; may depend on side-effect in original Z80
796
ld_110:         ld      a, data_55
797
                jp      ld_125
798
;ld_110:                ld      a,data_55
799
;               ld      i,a
800
;               ld      a,0
801
;               ld      a,i
802
;               jr      nz,ld_111
803
;               fail_msg 110
804
;ld_111:                jp      p,ld_112
805
;               fail_msg 111
806
;ld_112:                cp      data_55
807
;               jr      z,ld_113
808
;               fail_msg 112
809
;ld_113:                ld      a,data_80
810
;               ld      i,a
811
;               ld      a,0
812
;               ld      a,i
813
;               jr      nz,ld_114
814
;               fail_msg 113
815
;ld_114:                jp      m,ld_115
816
;               fail_msg 114
817
;ld_115:                cp      data_80
818
;               jr      z,ld_116
819
;               fail_msg 115
820
;ld_116:                ld      a,0
821
;               ld      i,a
822
;               ld      a,data_55
823
;               ld      a,i
824
;               jr      z,ld_125
825
;               fail_msg 116
826
;   refresh register not implemented
827
;   test for ie ?
828
;ld_117:                ld      a,data_55
829
;               ld      r,a
830
;               ld      a,0
831
;               ld      a,r
832
;               jp      p,ld_118
833
;               inc_error_cnt
834
;ld_118:                jr      nz,ld_119
835
;               inc_error_cnt
836
;ld_119:                ld      a,data_ff
837
;               ld      r,a
838
;               ld      a,0
839
;               ld      a,r
840
;               jp      m,ld_120
841
;               inc_error_cnt
842
;ld_120:                ld      a,4                     ;totally sequence dependent
843
;               ld      r,a
844
;               ld      a,data_55
845
;               ld      a,r
846
;               jr      z,ld_121
847
;               inc_error_cnt
848
;ld_121:                ei                              ;set iff2
849
;               ld      a,i
850
;               jp      pe,ld_122               ;iff2 was set
851
;               inc_error_cnt
852
;ld_122:                di                              ;clear iff2
853
;               ld      a,i
854
;               jp      po,ld_123               ;iff2 was cleared
855
;               inc_error_cnt
856
;ld_123:                ei                              ;set iff2
857
;               ld      a,r
858
;               jp      pe,ld_124               ;iff2 was set
859
;               inc_error_cnt
860
;ld_124:                di                              ;clear iff2
861
;               ld      a,r
862
;               jp      po,ld_125               ;iff2 was cleared
863
;               inc_error_cnt
864
;
865
ld_125:         ld      bc,data_1234
866
                ld      a, #12                  ;bjp  guess >data_1234
867
                cp      b
868
                jr      z,ld_126
869
                fail_msg 125
870
ld_126:         ld      a, #34                  ;bjp  guess  
871
                cp      c
872
                jr      z,ld_127
873
                fail_msg 126
874
ld_127:         ld      de,data_55aa
875
                ld      a,data_55
876
                cp      d
877
                jr      z,ld_128
878
                fail_msg 127
879
ld_128:         ld      a,data_aa
880
                cp      e
881
                jr      z,ld_129
882
                fail_msg 128
883
ld_129:         ld      hl,data_7fff
884
                ld      a,data_7f
885
                cp      h
886
                jr      z,ld_130
887
                fail_msg 129
888
ld_130:         ld      a,data_ff
889
                cp      l
890
                jr      z,ld_131
891
                fail_msg 130
892
ld_131:         ld      sp,data_aa55
893
                ld      hl,0
894
                add     hl,sp
895
                ld      a,data_aa
896
                cp      h
897
                jr      z,ld_132
898
                fail_msg 131
899
ld_132:         ld      a,data_55
900
                cp      l
901
                jr      z,ld_133
902
                fail_msg 132
903
ld_133:         ld      ix,data_ffff
904
                ld      hl,0
905
                ld      sp,ix
906
                add     hl,sp
907
                ld      a,data_ff
908
                cp      h
909
                jr      z,ld_134
910
                fail_msg 133
911
ld_134:         cp      l
912
                jr      z,ld_135
913
                fail_msg 134
914
ld_135:         ld      iy,data_1234
915
                ld      hl,0
916
                ld      sp,iy
917
                add     hl,sp
918
                ld      a,#12      ;bjp was >data_1234
919
                cp      h
920
                jr      z,ld_136
921
                fail_msg 135
922
ld_136:         ld      a,#34      ;bjp was >data_1234
923
                cp      l
924
                jr      z,ld_137
925
                fail_msg 136
926
ld_137:         ld      hl,(w_var2)
927
                ld      a,data_55
928
                cp      h
929
                jr      z,ld_138
930
                fail_msg 137
931
ld_138:         ld      a,data_aa
932
                cp      l
933
                jr      z,ld_139
934
                fail_msg 138
935
ld_139:         ld      bc,(w_var1)
936
                ld      a,#12      ;bjp was >data_1234
937
                cp      b
938
                jr      z,ld_140
939
                fail_msg 139
940
ld_140:         ld      a,#34      ;bjp was >data_1234
941
                cp      c
942
                jr      z,ld_141
943
                fail_msg 140
944
ld_141:         ld      de,(w_var3)
945
                ld      a,data_7f
946
                cp      d
947
                jr      z,ld_142
948
                fail_msg 141
949
ld_142:         ld      a,data_ff
950
                cp      e
951
                jr      z,ld_143
952
                fail_msg 142
953
ld_143:         ld      hl,(w_var4)
954
                ld      a,data_80
955
                cp      h
956
                jr      z,ld_144
957
                fail_msg 143
958
ld_144:         ld      a,0
959
                cp      l
960
                jr      z,ld_145
961
                fail_msg 144
962
ld_145:         ld      sp,(w_var5)
963
                ld      hl,0
964
                add     hl,sp
965
                ld      a,data_aa
966
                cp      h
967
                jr      z,ld_146
968
                fail_msg 145
969
ld_146:         ld      a,data_55
970
                cp      l
971
                jr      z,ld_147
972
                fail_msg 146
973
ld_147:         ld      ix,(w_var6)
974
                ld      hl,0
975
                ld      sp,ix
976
                add     hl,sp
977
                ld      a,data_ff
978
                cp      h
979
                jr      z,ld_148
980
                fail_msg 147
981
ld_148:         cp      l
982
                jr      z,ld_149
983
                fail_msg 148
984
ld_149:         ld      iy,(w_var1)
985
                ld      hl,0
986
                ld      sp,iy
987
                add     hl,sp
988
                ld      a,#12      ;bjp was >data_1234
989
                cp      h
990
                jr      z,ld_150
991
                fail_msg 149
992
ld_150:
993
                ld      sp, stack_end ; reset stack pointer to EOM
994
                ld      a,#34      ;bjp was >data_1234
995
                cp      l
996
                jr      z,ld_151
997
                fail_msg 150
998
ld_151:         ld      hl,data_1234
999
                ld      (tw_var1),hl
1000
                ld      bc,(tw_var1)
1001
                ld      a,#12      ;bjp was >data_1234
1002
                cp      b
1003
                jr      z,ld_152
1004
                fail_msg 151
1005
ld_152:         ld      a,#34      ;bjp was >data_1234
1006
                cp      c
1007
                jr      z,ld_153
1008
                fail_msg 152
1009
ld_153:         ld      bc,data_55aa
1010
                ld      (tw_var2),bc
1011
                ld      hl,(tw_var2)
1012
                ld      a,data_55
1013
                cp      h
1014
                jr      z,ld_154
1015
                fail_msg 153
1016
ld_154:         ld      a,data_aa
1017
                cp      l
1018
                jr      z,ld_155
1019
                fail_msg 154
1020
ld_155:         ld      de,data_7fff
1021
                ld      (tw_var3),de
1022
                ld      hl,(tw_var3)
1023
                ld      a,data_7f
1024
                cp      h
1025
                jr      z,ld_156
1026
                fail_msg 155
1027
ld_156:         ld      a,data_ff
1028
                cp      l
1029
                jr      z,ld_157
1030
                fail_msg 156
1031
ld_157:         ld      hl,data_8000
1032
                ld      (tw_var4),hl
1033
                ld      bc,(tw_var4)
1034
                ld      a,data_80
1035
                cp      b
1036
                jr      z,ld_158
1037
                fail_msg 157
1038
ld_158:         ld      a,0
1039
                cp      c
1040
                jr      z,ld_159
1041
                fail_msg 158
1042
ld_159:         ld      sp,data_aa55
1043
                ld      (tw_var5),sp
1044
                ld      hl,(tw_var5)
1045
                ld      a,data_aa
1046
                cp      h
1047
                jr      z,ld_160
1048
                fail_msg 159
1049
ld_160:         ld      a,data_55
1050
                cp      l
1051
                jr      z,ld_161
1052
                fail_msg 160
1053
ld_161:         ld      ix,data_ffff
1054
                ld      (tw_var6),ix
1055
                ld      hl,(tw_var6)
1056
                ld      a,data_ff
1057
                cp      h
1058
                jr      z,ld_162
1059
                fail_msg 161
1060
ld_162:         cp      l
1061
                jr      z,ld_163
1062
                fail_msg 162
1063
ld_163:         ld      iy,data_1234
1064
                ld      (tw_var7),iy
1065
                ld      hl,(tw_var7)
1066
                ld      a,#12      ;bjp was >data_1234
1067
                cp      h
1068
                jr      z,ld_164
1069
                fail_msg 163
1070
ld_164:         ld      a,#34      ;bjp was >data_1234
1071
                cp      l
1072
                jr      z,ld_165
1073
                fail_msg 164
1074
ld_165:         ld      hl,data_55aa
1075
                ld      sp,hl
1076
                ld      hl,0
1077
                add     hl,sp
1078
                ld      a,data_55
1079
                cp      h
1080
                jr      z,ld_166
1081
                fail_msg 165
1082
ld_166:         ld      a,data_aa
1083
                cp      l
1084
                jr      z,push_0
1085
                fail_msg 166
1086
push_0:         ld      sp,stack_end
1087
                print   "push_0"
1088
                ld      bc,data_1234
1089
                push    bc
1090
                ld      bc,0
1091
                pop     bc
1092
                ld      a,#12      ;bjp was >data_1234
1093
                cp      b
1094
                jr      z,push_1
1095
                fail_msg 0
1096
push_1:         ld      a,#34      ;bjp was >data_1234
1097
                cp      c
1098
                jr      z,push_2
1099
                fail_msg 1
1100
push_2:         ld      de,data_55aa
1101
                push    de
1102
                ld      de,0
1103
                pop     de
1104
                ld      a,data_55
1105
                cp      d
1106
                jr      z,push_3
1107
                fail_msg 2
1108
push_3:         ld      a,data_aa
1109
                cp      e
1110
                jr      z,push_4
1111
                fail_msg 3
1112
push_4:         ld      hl,data_7fff
1113
                push    hl
1114
                ld      hl,0
1115
                pop     hl
1116
                ld      a,data_7f
1117
                cp      h
1118
                jr      z,push_5
1119
                fail_msg 4
1120
push_5:         ld      a,data_ff
1121
                cp      l
1122
                jr      z,push_6
1123
                fail_msg 5
1124
push_6:         ld      a,data_80
1125
                push    af                      ;f depends on previous compare
1126
                ld      hl,0
1127
                pop     hl
1128
                cp      h
1129
                jr      z,push_7
1130
                fail_msg 6
1131
push_7:         ld      a,l
1132
                cp      #42
1133
                jr      z,push_8
1134
push_8:         ld      h,data_55
1135
                ld      l,data_80+#41
1136
                ld      a,0
1137
                push    hl
1138
                pop     af
1139
                jp      m,push_9
1140
                fail_msg 8
1141
push_9:         jr      z,push_10
1142
                fail_msg 9
1143
push_10:        jr      c,push_11
1144
                fail_msg 10
1145
push_11:        cp      data_55
1146
                jr      z,push_12
1147
                fail_msg 11
1148
push_12:        ld      ix,data_aa55
1149
                ld      bc,0
1150
                push    ix
1151
                pop     bc
1152
                ld      a,data_aa
1153
                cp      b
1154
                jr      z,push_13
1155
                fail_msg 12
1156
push_13:        ld      a,data_55
1157
                cp      c
1158
                jr      z,push_14
1159
                fail_msg 13
1160
push_14:        ld      iy,data_7fff
1161
                ld      de,0
1162
                push    iy
1163
                pop     de
1164
                ld      a,data_7f
1165
                cp      d
1166
                jr      z,push_15
1167
                fail_msg 14
1168
push_15:        ld      a,data_ff
1169
                cp      e
1170
                jr      z,push_16
1171
                fail_msg 15
1172
push_16:        ld      de,data_1234
1173
                ld      ix,0
1174
                ld      hl,0
1175
                push    de
1176
                pop     ix
1177
                ld      sp,ix
1178
                add     hl,sp
1179
                ld      a,#12      ;bjp was >data_1234
1180
                cp      h
1181
                jr      z,push_17
1182
                fail_msg 16
1183
push_17:        ld      a,#34      ;bjp was >data_1234
1184
                cp      l
1185
                jr      z,push_18
1186
                fail_msg 17
1187
push_18:        ld      sp,stack_end
1188
                ld      bc,data_55aa
1189
                ld      iy,0
1190
                ld      hl,0
1191
                push    bc
1192
                pop     iy
1193
                ld      sp,iy
1194
                add     hl,sp
1195
                ld      a,data_55
1196
                cp      h
1197
                jr      z,push_19
1198
                fail_msg 18
1199
push_19:        ld      a,data_aa
1200
                cp      l
1201
                jr      z,push_20
1202
                fail_msg 19
1203
push_20:        ld      sp,stack_end
1204
                print   "ex_0"
1205
ex_0:           ld      de,data_1234
1206
                ld      hl,data_ffff
1207
                ex      de,hl
1208
                ld      a,data_ff
1209
                cp      d
1210
                jr      z,ex_1
1211
                fail_msg 0
1212
ex_1:           cp      e
1213
                jr      z,ex_2
1214
                fail_msg 1
1215
ex_2:           ld      a,#12      ;bjp was >data_1234
1216
                cp      h
1217
                jr      z,ex_3
1218
                fail_msg 2
1219
ex_3:           ld      a,#34      ;bjp was >data_1234
1220
                cp      l
1221
                jr      z,ex_4
1222
                fail_msg 3
1223
ex_4:           ld      h,0
1224
                ld      l,0
1225
                push    hl
1226
                pop     af
1227
                ex      af,af'
1228
                ld      h,data_7f
1229
                ld      l,data_80+#41
1230
                push    hl
1231
                pop     af
1232
                ex      af,af'
1233
                cp      0
1234
                jr      z,ex_5
1235
                fail_msg 4
1236
ex_5:           ex      af,af'
1237
                jp      m,ex_6
1238
                fail_msg 5
1239
ex_6:           jr      z,ex_7
1240
                fail_msg 6
1241
ex_7:           cp      data_7f
1242
                jr      z,ex_8
1243
                fail_msg 7
1244
ex_8:           ld      hl,0
1245
                ld      bc,0
1246
                ld      de,0
1247
                exx
1248
                ld      hl,data_1234
1249
                ld      bc,data_7fff
1250
                ld      de,data_aa55
1251
                exx
1252
                ld      a,0
1253
                cp      h
1254
                jr      z,ex_9
1255
                fail_msg 8
1256
ex_9:           cp      l
1257
                jr      z,ex_10
1258
                fail_msg 9
1259
ex_10:          cp      d
1260
                jr      z,ex_11
1261
                fail_msg 10
1262
ex_11:          cp      e
1263
                jr      z,ex_12
1264
                fail_msg 11
1265
ex_12:          cp      b
1266
                jr      z,ex_13
1267
                fail_msg 12
1268
ex_13:          cp      c
1269
                jr      z,ex_14
1270
                fail_msg 13
1271
ex_14:          exx
1272
                ld      a,#12      ;bjp was >data_1234
1273
                cp      h
1274
                jr      z,ex_15
1275
                fail_msg 14
1276
ex_15:          ld      a,#34      ;bjp was >data_1234
1277
                cp      l
1278
                jr      z,ex_16
1279
                fail_msg 15
1280
ex_16:          ld      a,data_aa
1281
                cp      d
1282
                jr      z,ex_17
1283
                fail_msg 16
1284
ex_17:          ld      a,data_55
1285
                cp      e
1286
                jr      z,ex_18
1287
                fail_msg 17
1288
ex_18:          ld      a,data_7f
1289
                cp      b
1290
                jr      z,ex_19
1291
                fail_msg 18
1292
ex_19:          ld      a,data_ff
1293
                cp      c
1294
                jr      z,ex_20
1295
                fail_msg 19
1296
ex_20:          ld      bc,data_55aa
1297
                ld      hl,data_7fff
1298
                push    bc
1299
                ex      (sp),hl
1300
                pop     bc
1301
                ld      a,data_7f
1302
                cp      b
1303
                jr      z,ex_21
1304
                fail_msg 20
1305
ex_21:          ld      a,data_ff
1306
                cp      c
1307
                jr      z,ex_22
1308
                fail_msg 21
1309
ex_22:          ld      a,data_55
1310
                cp      h
1311
                jr      z,ex_23
1312
                fail_msg 22
1313
ex_23:          ld      a,data_aa
1314
                cp      l
1315
                jr      z,ex_24
1316
                fail_msg 23
1317
ex_24:          ld      bc,data_ffff
1318
                ld      ix,data_8000
1319
                ld      hl,0
1320
                push    bc
1321
                ex      (sp),ix
1322
                pop     bc
1323
                ld      sp,ix
1324
                add     hl,sp
1325
                ld      a,data_80
1326
                cp      b
1327
                jr      z,ex_25
1328
                fail_msg 24
1329
ex_25:          ld      a,0
1330
                cp      c
1331
                jr      z,ex_26
1332
                fail_msg 25
1333
ex_26:          ld      a,data_ff
1334
                cp      h
1335
                jr      z,ex_27
1336
                fail_msg 26
1337
ex_27:          cp      l
1338
                jr      z,ex_28
1339
                fail_msg 27
1340
ex_28:          ld      sp,stack_end
1341
                ld      bc,data_1234
1342
                ld      iy,data_7fff
1343
                ld      hl,0
1344
                push    bc
1345
                ex      (sp),iy
1346
                pop     bc
1347
                ld      sp,iy
1348
                add     hl,sp
1349
                ld      a,data_7f
1350
                cp      b
1351
                jr      z,ex_29
1352
                fail_msg 28
1353
ex_29:          ld      a,data_ff
1354
                cp      c
1355
                jr      z,ex_30
1356
                fail_msg 29
1357
ex_30:          ld      a,#12      ;bjp was >data_1234
1358
                cp      h
1359
                jr      z,ex_31
1360
                fail_msg 30
1361
ex_31:          ld      a,#34      ;bjp was >data_1234
1362
                cp      l
1363
                jr      z,add_0
1364
                fail_msg 31
1365
add_0:          ld      sp,stack_end ; reset stack after EX operations
1366
                print   "add_0"
1367
                ld      a,0
1368
                ld      b,data_7f
1369
                add     a,b
1370
                cp      data_7f
1371
                jr      z,add_1
1372
                fail_msg 0
1373
add_1:          ld      a,0
1374
                ld      b,0
1375
                add     a,b
1376
                jr      z,add_2
1377
                fail_msg 1
1378
add_2:          ld      b,data_55
1379
                add     a,b
1380
                jr      nz,add_3
1381
                fail_msg 2
1382
add_3:          cp      data_55
1383
                jr      z,add_4
1384
                fail_msg 3
1385
add_4:          ld      a,data_ff
1386
                ld      b,1
1387
                add     a,b
1388
                jr      c,add_5
1389
                fail_msg 4
1390
add_5:          add     a,b
1391
                jr      nc,add_6
1392
                fail_msg 5
1393
add_6:          ld      a,data_ff
1394
                ld      b,0
1395
                add     a,b
1396
                jp      m,add_7
1397
                fail_msg 6
1398
add_7:          ld      b,1
1399
                add     a,b
1400
                jp      p,add_8
1401
                fail_msg 7
1402
add_8:          ld      a,data_7f
1403
                ld      b,1
1404
                add     a,b
1405
                jp      pe,add_9
1406
                fail_msg 8
1407
add_9:          add     a,b
1408
                jp      po,add_10
1409
                fail_msg 9
1410
add_10:         ld      a,data_55
1411
                ld      c,2
1412
                add     a,c
1413
                cp      data_55+2
1414
                jr      z,add_11
1415
                fail_msg 10
1416
add_11:         ld      a,data_80
1417
                add     a,c
1418
                cp      data_80+2
1419
                jr      z,add_12
1420
                fail_msg 11
1421
add_12:         ld      a,data_aa
1422
                ld      d,data_55
1423
                add     a,d
1424
                cp      data_aa+data_55
1425
                jr      z,add_13
1426
                fail_msg 12
1427
add_13:         ld      a,data_aa
1428
                ld      e,2
1429
                add     a,e
1430
                cp      data_aa+2
1431
                jr      z,add_14
1432
                fail_msg 13
1433
add_14:         ld      a,data_55
1434
                ld      h,24
1435
                add     a,h
1436
                cp      data_55+24
1437
                jr      z,add_15
1438
                fail_msg 14
1439
add_15:         ld      a,data_7f-10
1440
                ld      l,10
1441
                add     a,l
1442
                cp      data_7f
1443
                jr      z,add_16
1444
                fail_msg 15
1445
add_16:         ld      a,1
1446
                add     a,data_7f
1447
                jp      pe,add_17
1448
                fail_msg 16
1449
add_17:         jp      m,add_18
1450
                fail_msg 17
1451
add_18:         jr      nz,add_19
1452
                fail_msg 18
1453
add_19:         cp      data_80
1454
                jr      z,add_20
1455
                fail_msg 19
1456
add_20:         ld      a,data_55
1457
                add     a,1
1458
                jp      po,add_21
1459
                fail_msg 20
1460
add_21:         jp      p,add_22
1461
                fail_msg 21
1462
add_22:         jr      nc,add_23
1463
                fail_msg 22
1464
add_23:         cp      data_55+1
1465
                jr      z,add_24
1466
                fail_msg 23
1467
add_24:         ld      a,data_ff
1468
                add     a,1
1469
                jr      c,add_25
1470
                fail_msg 24
1471
add_25:         jr      z,add_26
1472
                fail_msg 25
1473
add_26:         add     a,1
1474
                jr      nc,add_27
1475
                fail_msg 26
1476
add_27:         jr      nz,add_28
1477
                fail_msg 27
1478
add_28:         cp      1
1479
                jr      z,add_29
1480
                fail_msg 28
1481
add_29:         ld      hl,var2
1482
                ld      a,2
1483
                add     a,(hl)
1484
                jp      po,add_30
1485
                fail_msg 29
1486
add_30:         jp      p,add_31
1487
                fail_msg 30
1488
add_31:         jr      nz,add_32
1489
                fail_msg 31
1490
add_32:         jr      nc,add_33
1491
                fail_msg 32
1492
add_33:         cp      data_55+2
1493
                jr      z,add_34
1494
                fail_msg 33
1495
add_34:         ld      hl,var1
1496
                ld      a,1
1497
                add     a,(hl)
1498
                jr      c,add_35
1499
                fail_msg 34
1500
add_35:         jr      z,add_36
1501
                fail_msg 35
1502
add_36:         ld      hl,var5
1503
                ld      a,1
1504
                add     a,(hl)
1505
                jp      m,add_37
1506
                fail_msg 36
1507
add_37:         jp      pe,add_38
1508
                fail_msg 37
1509
add_38:         cp      data_80
1510
                jr      z,add_39
1511
                fail_msg 38
1512
add_39:         ld      ix,var3
1513
                ld      a,1
1514
                add     a,(ix-1)
1515
                jp      po,add_40
1516
                fail_msg 39
1517
add_40:         jp      p,add_41
1518
                fail_msg 40
1519
add_41:         jr      nz,add_42
1520
                fail_msg 41
1521
add_42:         jr      nc,add_43
1522
                fail_msg 42
1523
add_43:         cp      data_55+1
1524
                jr      z,add_44
1525
                fail_msg 43
1526
add_44:         ld      a,1
1527
                add     a,(ix+2)
1528
                jp      pe,add_45
1529
                fail_msg 44
1530
add_45:         jp      m,add_46
1531
                fail_msg 45
1532
add_46:         cp      data_80
1533
                jr      z,add_47
1534
                fail_msg 46
1535
add_47:         ld      a,1
1536
                add     a,(ix-2)
1537
                jr      c,add_48
1538
                fail_msg 47
1539
add_48:         jr      z,add_49
1540
                fail_msg 48
1541
add_49:         add     a,1
1542
                jr      nc,add_50
1543
                fail_msg 49
1544
add_50:         jr      nz,add_51
1545
                fail_msg 50
1546
add_51:         cp      1
1547
                jr      z,add_52
1548
                fail_msg 51
1549
add_52:         ld      iy,var3
1550
                ld      a,10
1551
                add     a,(iy-1)
1552
                jp      po,add_53
1553
                fail_msg 52
1554
add_53:         jp      p,add_54
1555
                fail_msg 53
1556
add_54:         jr      nz,add_55
1557
                fail_msg 54
1558
add_55:         jr      nc,add_56
1559
                fail_msg 55
1560
add_56:         cp      data_55+10
1561
                jr      z,add_57
1562
                fail_msg 56
1563
add_57:         ld      a,1
1564
                add     a,(iy+2)
1565
                jp      pe,add_58
1566
                fail_msg 57
1567
add_58:         jp      m,add_59
1568
                fail_msg 58
1569
add_59:         add     a,1
1570
                jp      po,add_60
1571
                fail_msg 59
1572
add_60:         cp      data_80+1
1573
                jr      z,add_61
1574
                fail_msg 60
1575
add_61:         ld      a,1
1576
                add     a,(iy-2)
1577
                jr      z,add_62
1578
                fail_msg 61
1579
add_62:         jr      c,add_63
1580
                fail_msg 62
1581
add_63:         add     a,1
1582
                jr      nc,add_64
1583
                fail_msg 63
1584
add_64:         jr      nz,add_65
1585
                fail_msg 64
1586
add_65:         cp      1
1587
                jr      z,add_66
1588
                fail_msg 65
1589
add_66:         ld      a,data_ff
1590
                add     a,data_80
1591
                jp      p,add_67
1592
                fail_msg 66
1593
add_67:         jp      pe,add_68
1594
                fail_msg 67
1595
add_68:         jr      c,add_69
1596
                fail_msg 68
1597
add_69:         add     a,1
1598
                jp      pe,add_70
1599
                fail_msg 69
1600
add_70:         jp      m,add_71
1601
                fail_msg 70
1602
add_71:         jr      nc,add_72
1603
                fail_msg 71
1604
add_72:         add     a,1
1605
                jp      po,add_73
1606
                fail_msg 72
1607
add_73:         cp      data_80+1
1608
                jr      z,adc_0
1609
                fail_msg 73
1610
adc_0:          nop
1611
                print   "adc_0"
1612
                ld      a,0                 ;clear cry
1613
                add     a,0
1614
                ld      b,data_7f
1615
                adc     a,b                  ;a=7f cry=0
1616
                jp      p,adc_1
1617
                fail_msg 0
1618
adc_1:          jp      po,adc_2
1619
                fail_msg 1
1620
adc_2:          jr      nc,adc_3
1621
                fail_msg 2
1622
adc_3:          jr      nz,adc_4
1623
                fail_msg 3
1624
adc_4:          ld      b,1
1625
                adc     a,b                     ;a=80 cry=0
1626
                jp      pe,adc_5                ;jp  ofl
1627
                fail_msg 4
1628
adc_5:          jp      m,adc_6
1629
                fail_msg 5
1630
adc_6:          cp      data_80
1631
                jr      z,adc_7                 ;z=0  ofl=0 cry=0 (borrow)
1632
                fail_msg 6
1633
adc_7:          ld      a,data_ff
1634
                ld      b,1
1635
                adc     a,b                      ;ff+1+0
1636
                jr      c,adc_8
1637
                fail_msg 7
1638
adc_8:          jr      z,adc_9
1639
                fail_msg 8
1640
adc_9:          adc     a,b
1641
                jr      nc,adc_10
1642
                fail_msg 9
1643
adc_10:         jr      nz,adc_11
1644
                fail_msg 10
1645
adc_11:         cp      2
1646
                jr      z,adc_12
1647
                fail_msg 11
1648
adc_12:         ld      a,data_ff
1649
                ld      c,0
1650
                adc     a,c
1651
                jp      m,adc_13
1652
                fail_msg 12
1653
adc_13:         jr      nc,adc_14
1654
                fail_msg 13
1655
adc_14:         ld      c,2
1656
                adc     a,c
1657
                jp      p,adc_15
1658
                fail_msg 14
1659
adc_15:         jr      c,adc_16
1660
                fail_msg 15
1661
adc_16:         ld      c,0
1662
                adc     a,c
1663
                cp      2
1664
                jr      z,adc_17
1665
                fail_msg 16
1666
adc_17:         ld      a,data_ff
1667
                ld      d,1
1668
                adc     a,d
1669
                jr      c,adc_18
1670
                fail_msg 17
1671
adc_18:         ld      d,0
1672
                adc     a,d
1673
                jr      nc,adc_19
1674
                fail_msg 18
1675
adc_19:         cp      1
1676
                jr      z,adc_20
1677
                fail_msg 19
1678
adc_20:         ld      a,data_aa
1679
                ld      e,data_7f
1680
                adc     a,e
1681
                jr      c,adc_21
1682
                fail_msg 20
1683
adc_21:         ld      e,#2b
1684
                adc     a,e
1685
                cp      data_55
1686
                jr      z,adc_22
1687
                fail_msg 21
1688
adc_22:         ld      a,data_ff
1689
                ld      h,1
1690
                adc     a,h
1691
                jr      c,adc_23
1692
                fail_msg 22
1693
adc_23:         adc     a,h
1694
                cp      2
1695
                jr      z,adc_24
1696
                fail_msg 23
1697
adc_24:         ld      a,data_ff
1698
                ld      l,1
1699
                adc     a,l
1700
                jr      c,adc_25
1701
                fail_msg 24
1702
adc_25:         adc     a,l
1703
                cp      2
1704
                jr      z,adc_26
1705
                fail_msg 25
1706
adc_26:         ld      a,0
1707
                adc     a,data_7f
1708
                jp      po,adc_27
1709
                fail_msg 26
1710
adc_27:         jp      p,adc_28
1711
                fail_msg 27
1712
adc_28:         jr      nc,adc_29
1713
                fail_msg 28
1714
adc_29:         jr      nz,adc_30
1715
                fail_msg 29
1716
adc_30:         adc     a,1
1717
                jp      pe,adc_31
1718
                fail_msg 30
1719
adc_31:         jp      m,adc_32
1720
                fail_msg 31
1721
adc_32:         cp      data_80
1722
                jr      z,adc_33
1723
                fail_msg 32
1724
adc_33:         ld      a,data_ff
1725
                adc     a,1
1726
                jr      c,adc_34
1727
                fail_msg 33
1728
adc_34:         jr      z,adc_35
1729
                fail_msg 34
1730
adc_35:         adc     a,1
1731
                jr      nc,adc_36
1732
                fail_msg 35
1733
adc_36:         jr      nz,adc_37
1734
                fail_msg 36
1735
adc_37:         cp      2
1736
                jr      z,adc_38
1737
                fail_msg 37
1738
adc_38:         ld      hl,var5
1739
                ld      a,0
1740
                adc     a,(hl)
1741
                jp      p,adc_39
1742
                fail_msg 38
1743
adc_39:         jp      po,adc_40
1744
                fail_msg 39
1745
adc_40:         jr      nz,adc_41
1746
                fail_msg 40
1747
adc_41:         jr      nc,adc_42
1748
                fail_msg 41
1749
adc_42:         ld      a,1
1750
                adc     a,(hl)
1751
                jp      m,adc_43
1752
                fail_msg 42
1753
adc_43:         jp      pe,adc_44
1754
                fail_msg 43
1755
adc_44:         cp      data_80
1756
                jr      z,adc_45
1757
                fail_msg 44
1758
adc_45:         ld      hl,var1
1759
                ld      a,1
1760
                adc     a,(hl)
1761
                jr      z,adc_46
1762
                fail_msg 45
1763
adc_46:         jr      c,adc_47
1764
                fail_msg 46
1765
adc_47:         ld      hl,var2
1766
                adc     a,(hl)
1767
                jr      nc,adc_48
1768
                fail_msg 47
1769
adc_48:         jr      nz,adc_49
1770
                fail_msg 48
1771
adc_49:         cp      data_55+1
1772
                jr      z,adc_50
1773
                fail_msg 49
1774
adc_50:         ld      ix,var3
1775
                ld      a,0
1776
                adc     a,(ix+2)
1777
                jp      p,adc_51
1778
                fail_msg 50
1779
adc_51:         jp      po,adc_52
1780
                fail_msg 51
1781
adc_52:         jr      nc,adc_53
1782
                fail_msg 52
1783
adc_53:         jr      nz,adc_54
1784
                fail_msg 53
1785
adc_54:         ld      a,1
1786
                adc     a,(ix+2)
1787
                jp      m,adc_55
1788
                fail_msg 54
1789
adc_55:         jp      pe,adc_56
1790
                fail_msg 55
1791
adc_56:         cp      data_80
1792
                jr      z,adc_57
1793
                fail_msg 56
1794
adc_57:         ld      a,1
1795
                adc     a,(ix-2)
1796
                jr      c,adc_58
1797
                fail_msg 57
1798
adc_58:         jr      z,adc_59
1799
                fail_msg 58
1800
adc_59:         adc     a,(ix-1)
1801
                jr      nc,adc_60
1802
                fail_msg 59
1803
adc_60:         jr      nz,adc_61
1804
                fail_msg 60
1805
adc_61:         cp      data_55+1
1806
                jr      z,adc_62
1807
                fail_msg 61
1808
adc_62:         ld      iy,var3
1809
                ld      a,0
1810
                adc     a,(ix+2)
1811
                jp      p,adc_63
1812
                fail_msg 62
1813
adc_63:         jp      po,adc_64
1814
                fail_msg 63
1815
adc_64:         jr      nc,adc_65
1816
                fail_msg 64
1817
adc_65:         jr      nz,adc_66
1818
                fail_msg 65
1819
adc_66:         ld      a,1
1820
                adc     a,(iy+2)
1821
                jp      m,adc_67
1822
                fail_msg 66
1823
adc_67:         jp      pe,adc_68
1824
                fail_msg 67
1825
adc_68:         cp      data_80
1826
                jr      z,adc_69
1827
                fail_msg 68
1828
adc_69:         ld      a,1
1829
                adc     a,(iy-2)
1830
                jr      c,adc_70
1831
                fail_msg 69
1832
adc_70:         jr      z,adc_71
1833
                fail_msg 70
1834
adc_71:         adc     a,(iy-1)
1835
                jr      nc,adc_72
1836
                fail_msg 71
1837
adc_72:         jr      nz,adc_73
1838
                fail_msg 72
1839
adc_73:         cp      data_55+1
1840
                jr      z,adc_74
1841
                fail_msg 73
1842
adc_74:         ld      a,data_ff
1843
                add     a,0
1844
                adc     a,data_80
1845
                jp      p,adc_75
1846
                fail_msg 74
1847
adc_75:         jp      pe,adc_76
1848
                fail_msg 75
1849
adc_76:         jr      nz,adc_77
1850
                fail_msg 76
1851
adc_77:         adc     a,0
1852
                jp      m,adc_78
1853
                fail_msg 77
1854
adc_78:         jp      pe,adc_79
1855
                fail_msg 78
1856
adc_79:         adc     a,1
1857
                jp      po,adc_80
1858
                fail_msg 79
1859
adc_80:         cp      data_80+1
1860
                jr      z,sub_0
1861
                fail_msg 80
1862
sub_0:          nop
1863
                print   "sub_0"
1864
                ld      a,0
1865
                ld      b,1
1866
                sub     a,b
1867
                jp      m,sub_1
1868
                fail_msg 0
1869
sub_1:          jp      po,sub_2
1870
                fail_msg 1
1871
sub_2:          jr      c,sub_3
1872
                fail_msg 2
1873
sub_3:          jr      nz,sub_4
1874
                fail_msg 3
1875
sub_4:          sub     a,b
1876
                jr      nc,sub_5
1877
                fail_msg 4
1878
sub_5:          cp      data_ff-1
1879
                jr      z,sub_6
1880
                fail_msg 5
1881
sub_6:          ld      a,1
1882
                ld      b,0
1883
                sub     a,b
1884
                jr      nz,sub_7
1885
                fail_msg 6
1886
sub_7:          jp      p,sub_8
1887
                fail_msg 7
1888
sub_8:          ld      b,1
1889
                sub     a,b
1890
                jr      z,sub_9
1891
                fail_msg 8
1892
sub_9:          sub     a,b
1893
                jp      m,sub_10
1894
                fail_msg 9
1895
sub_10:         cp      data_ff
1896
                jr      z,sub_11
1897
                fail_msg 10
1898
sub_11:         ld      a,data_80
1899
                ld      b,data_7f
1900
                sub     a,b
1901
                jp      pe,sub_12
1902
                fail_msg 11
1903
sub_12:         sub     a,b
1904
                jp      po,sub_13
1905
                fail_msg 12
1906
sub_13:         cp      data_80+2
1907
                jr      z,sub_14
1908
                fail_msg 13
1909
sub_14:         ld      a,data_55
1910
                ld      c,data_55
1911
                sub     a,c
1912
                jr      z,sub_15
1913
                fail_msg 14
1914
sub_15:         ld      c,1
1915
                sub     a,c
1916
                jp      m,sub_16
1917
                fail_msg 15
1918
sub_16:         jr      c,sub_17
1919
                fail_msg 16
1920
sub_17:         cp      data_ff
1921
                jr      z,sub_18
1922
                fail_msg 17
1923
sub_18:         ld      a,data_55
1924
                ld      d,data_7f
1925
                sub     a,d
1926
                jr      c,sub_19
1927
                fail_msg 18
1928
sub_19:         cp      data_55-data_7f
1929
                jr      z,sub_20
1930
                fail_msg 19
1931
sub_20:         ld      a,0
1932
                ld      e,data_ff
1933
                sub     a,e
1934
                jr      c,sub_21
1935
                fail_msg 20
1936
sub_21:         cp      1
1937
                jr      z,sub_22
1938
                fail_msg 21
1939
sub_22:         ld      a,data_ff
1940
                ld      h,data_80
1941
                sub     a,h
1942
                jp      p,sub_23
1943
                fail_msg 22
1944
sub_23:         cp      data_7f
1945
                jr      z,sub_24
1946
                fail_msg 23
1947
sub_24:         ld      a,data_aa
1948
                ld      l,data_ff
1949
                sub     a,l
1950
                jr      c,sub_25
1951
                fail_msg 24
1952
sub_25:         cp      data_aa+1
1953
                jr      z,sub_26
1954
                fail_msg 25
1955
sub_26:         ld      a,data_7f
1956
                sub     a,data_ff
1957
                jp      pe,sub_27
1958
                fail_msg 26
1959
sub_27:         jp      m,sub_28
1960
                fail_msg 27
1961
sub_28:         sub     a,1
1962
                jp      p,sub_29
1963
                fail_msg 28
1964
sub_29:         sub     a,1
1965
                jp      po,sub_30
1966
                fail_msg 29
1967
sub_30:         jr      nz,sub_31
1968
                fail_msg 30
1969
sub_31:         sub     a,data_7f-1
1970
                jr      z,sub_32
1971
                fail_msg 31
1972
sub_32:         ld      a,0
1973
                sub     a,data_ff
1974
                jr      c,sub_33
1975
                fail_msg 32
1976
sub_33:         sub     a,1
1977
                jr      z,sub_34
1978
                fail_msg 33
1979
sub_34:         jr      nc,sub_35
1980
                fail_msg 34
1981
sub_35:         ld      hl,var1
1982
                ld      a,data_7f
1983
                sub     a,(hl)
1984
                jp      m,sub_36
1985
                fail_msg 35
1986
sub_36:         jp      pe,sub_37
1987
                fail_msg 36
1988
sub_37:         jr      c,sub_38
1989
                fail_msg 37
1990
sub_38:         ld      hl,var3
1991
                sub     a,(hl)
1992
                jp      p,sub_39
1993
                fail_msg 38
1994
sub_39:         jp      po,sub_40
1995
                fail_msg 39
1996
sub_40:         jr      nc,sub_41
1997
                fail_msg 40
1998
sub_41          jr      z,sub_42
1999
                fail_msg 40
2000
sub_42:         ld      hl,var2
2001
                sub     a,(hl)
2002
                jr      nz,sub_43
2003
                fail_msg 42
2004
sub_43:         cp      data_aa+1
2005
                jr      z,sub_44
2006
                fail_msg 43
2007
sub_44:         ld      ix,var3
2008
                ld      a,data_7f
2009
                sub     a,(ix-2)
2010
                jp      m,sub_45
2011
                fail_msg 44
2012
sub_45:         jp      pe,sub_46
2013
                fail_msg 45
2014
sub_46:         jr      c,sub_47
2015
                fail_msg 46
2016
sub_47:         sub     a,(ix+0)
2017
                jp      p,sub_48
2018
                fail_msg 47
2019
sub_48:         jp      po,sub_49
2020
                fail_msg 48
2021
sub_49:         jr      nc,sub_50
2022
                fail_msg 49
2023
sub_50:         jr      z,sub_51
2024
                fail_msg 50
2025
sub_51:         sub     a,(ix+2)
2026
                jr      nz,sub_52
2027
                fail_msg 51
2028
sub_52:         cp      data_80+1
2029
                jr      z,sub_53
2030
                fail_msg 52
2031
sub_53:         ld      iy,var3
2032
                ld      a,data_7f
2033
                sub     a,(iy-2)
2034
                jp      m,sub_54
2035
                fail_msg 53
2036
sub_54:         jp      pe,sub_55
2037
                fail_msg 54
2038
sub_55:         jr      c,sub_56
2039
                fail_msg 55
2040
sub_56:         jr      nz,sub_57
2041
                fail_msg 56
2042
sub_57:         sub     a,(iy+0)
2043
                jp      p,sub_58
2044
                fail_msg 57
2045
sub_58:         jp      po,sub_59
2046
                fail_msg 58
2047
sub_59:         jr      nc,sub_60
2048
                fail_msg 59
2049
sub_60:         jr      z,sub_61
2050
                fail_msg 60
2051
sub_61:         sub     a,(iy+2)
2052
                jr      nz,sub_62
2053
                fail_msg 61
2054
sub_62:         cp      data_80+1
2055
                jr      z,sbc_0
2056
                fail_msg 62
2057
sbc_0:          nop
2058
                print   "sbc_0"
2059
                ld      a,data_7f
2060
                ld      b,0
2061
                sub     a,b                     ;clear carry flag
2062
                ld      b,data_ff
2063
                sbc     a,b
2064
                jp      m,sbc_1
2065
                fail_msg 0
2066
sbc_1:          jp      pe,sbc_2
2067
                fail_msg 1
2068
sbc_2:          jr      c,sbc_3
2069
                fail_msg 2
2070
sbc_3:          jr      nz,sbc_4
2071
                fail_msg 3
2072
sbc_4:          ld      b,data_7f
2073
                sbc     a,b
2074
                jp      p,sbc_5
2075
                fail_msg 4
2076
sbc_5:          jp      pe,sbc_6
2077
                fail_msg 5
2078
sbc_6:          jr      nc,sbc_7
2079
                fail_msg 6
2080
sbc_7:          jr      z,sbc_8
2081
                fail_msg 7
2082
sbc_8:          ld      b,data_ff
2083
                sbc     a,b
2084
                jp      po,sbc_9
2085
                fail_msg 8
2086
sbc_9:          jr      nz,sbc_10
2087
                fail_msg 9
2088
sbc_10:         ld      b,0
2089
                sbc     a,b
2090
                jr      z,sbc_11
2091
                fail_msg 10
2092
sbc_11:         ld      a,data_aa
2093
                ld      c,data_ff
2094
                sbc     a,c
2095
                jr      c,sbc_12
2096
                fail_msg 11
2097
sbc_12:         ld      c,0
2098
                sbc     a,c
2099
                jr      nc,sbc_13
2100
                fail_msg 12
2101
sbc_13:         cp      data_aa
2102
                jr      z,sbc_14
2103
                fail_msg 13
2104
sbc_14:         ld      a,data_55
2105
                ld      d,data_ff
2106
                sbc     a,d
2107
                jr      c,sbc_15
2108
                fail_msg 14
2109
sbc_15:         ld      d,0
2110
                sbc     a,d
2111
                jr      nc,sbc_16
2112
                fail_msg 15
2113
sbc_16:         cp      data_55
2114
                jr      z,sbc_17
2115
                fail_msg 16
2116
sbc_17:         ld      a,data_aa
2117
                ld      e,data_ff
2118
                sbc     a,e
2119
                jr      c,sbc_18
2120
                fail_msg 17
2121
sbc_18:         ld      e,0
2122
                sbc     a,e
2123
                jr      nc,sbc_19
2124
                fail_msg 18
2125
sbc_19:         cp      data_aa
2126
                jr      z,sbc_20
2127
                fail_msg 19
2128
sbc_20:         ld      a,data_55
2129
                ld      h,data_ff
2130
                sbc     a,h
2131
                jr      c,sbc_21
2132
                fail_msg 20
2133
sbc_21:         ld      h,0
2134
                sbc     a,h
2135
                jr      nc,sbc_22
2136
                fail_msg 21
2137
sbc_22:         cp      data_55
2138
                jr      z,sbc_23
2139
                fail_msg 22
2140
sbc_23:         ld      a,data_aa
2141
                ld      l,data_ff
2142
                sbc     a,l
2143
                jr      c,sbc_24
2144
                fail_msg 23
2145
sbc_24:         ld      l,0
2146
                sbc     a,l
2147
                jr      nc,sbc_25
2148
                fail_msg 24
2149
sbc_25:         cp      data_aa
2150
                jr      z,sbc_26
2151
                fail_msg 25
2152
sbc_26:         ld      a,data_7f
2153
                sbc     a,data_ff
2154
                jp      m,sbc_27
2155
                fail_msg 26
2156
sbc_27:         jp      pe,sbc_28
2157
                fail_msg 27
2158
sbc_28:         jr      c,sbc_29
2159
                fail_msg 28
2160
sbc_29:         jr      nz,sbc_30
2161
                fail_msg 29
2162
sbc_30:         sbc     a,data_7f
2163
                jp      p,sbc_31
2164
                fail_msg 30
2165
sbc_31:         jp      pe,sbc_32
2166
                fail_msg 31
2167
sbc_32:         jr      nc,sbc_33
2168
                fail_msg 32
2169
sbc_33:         jr      z,sbc_34
2170
                fail_msg 33
2171
sbc_34:         sbc     a,data_ff
2172
                jr      nz,sbc_35
2173
                fail_msg 34
2174
sbc_35:         cp      1
2175
                jr      z,sbc_36
2176
                fail_msg 35
2177
sbc_36:         ld      hl,var1
2178
                ld      a,data_7f
2179
                sbc     a,(hl)
2180
                jp      m,sbc_37
2181
                fail_msg 36
2182
sbc_37:         jp      pe,sbc_38
2183
                fail_msg 37
2184
sbc_38:         jr      c,sbc_39
2185
                fail_msg 38
2186
sbc_39:         jr      nz,sbc_40
2187
                fail_msg 39
2188
sbc_40:         ld      hl,var5
2189
                sbc     a,(hl)
2190
                jp      p,sbc_41
2191
                fail_msg 40
2192
sbc_41:         jp      pe,sbc_42
2193
                fail_msg 41
2194
sbc_42:         jr      nc,sbc_43
2195
                fail_msg 42
2196
sbc_43:         jr      z,sbc_44
2197
                fail_msg 43
2198
sbc_44:         ld      hl,var2
2199
                sbc     a,(hl)
2200
                jr      nz,sbc_45
2201
                fail_msg 44
2202
sbc_45:         cp      data_aa+1
2203
                jr      z,sbc_46
2204
                fail_msg 45
2205
sbc_46:         ld      ix,var3
2206
                ld      a,data_7f
2207
                sbc     a,(ix-2)
2208
                jp      m,sbc_47
2209
                fail_msg 46
2210
sbc_47:         jp      pe,sbc_48
2211
                fail_msg 47
2212
sbc_48:         jr      c,sbc_49
2213
                fail_msg 48
2214
sbc_49:         jr      nz,sbc_50
2215
                fail_msg 49
2216
sbc_50:         sbc     a,(ix+2)
2217
                jp      p,sbc_51
2218
                fail_msg 50
2219
sbc_51:         jp      pe,sbc_52
2220
                fail_msg 51
2221
sbc_52:         jr      nc,sbc_53
2222
                fail_msg 52
2223
sbc_53:         jr      z,sbc_54
2224
                fail_msg 53
2225
sbc_54:         sbc     a,(ix-1)
2226
                jr      nz,sbc_55
2227
                fail_msg 54
2228
sbc_55:         cp      data_aa+1
2229
                jr      z,sbc_56
2230
                fail_msg 55
2231
sbc_56:         ld      iy,var3
2232
                ld      a,data_7f
2233
                sbc     a,(ix-2)
2234
                jp      m,sbc_57
2235
                fail_msg 56
2236
sbc_57:         jp      pe,sbc_58
2237
                fail_msg 57
2238
sbc_58:         jr      c,sbc_59
2239
                fail_msg 58
2240
sbc_59:         jr      nz,sbc_60
2241
                fail_msg 59
2242
sbc_60:         sbc     a,(ix+2)
2243
                jp      p,sbc_61
2244
                fail_msg 60
2245
sbc_61:         jp      pe,sbc_62
2246
                fail_msg 61
2247
sbc_62:         jr      nc,sbc_63
2248
                fail_msg 62
2249
sbc_63:         jr      z,sbc_64
2250
                fail_msg 63
2251
sbc_64:         sbc     a,(ix+1)
2252
                jr      nz,sbc_65
2253
                fail_msg 64
2254
sbc_65:         cp      data_55+1
2255
                jr      z,and_0
2256
                fail_msg 65
2257
and_0:          nop
2258
                print   "and_0"
2259
                ld      a,data_ff
2260
                add     a,1                     ;set carry
2261
                ld      a,data_ff
2262
                ld      b,data_aa
2263
                and     a,b
2264
                jr      nc,and_1
2265
                fail_msg 0
2266
and_1:          jp      m,and_2
2267
                fail_msg 1
2268
and_2:          jp      pe,and_3
2269
                fail_msg 2
2270
and_3:          jr      nz,and_4
2271
                fail_msg 3
2272
and_4:          ld      b,data_55
2273
                and     a,b
2274
                jp      p,and_5
2275
                fail_msg 4
2276
and_5:          jr      z,and_6
2277
                fail_msg 5
2278
and_6:          ld      a,data_ff
2279
                ld      b,data_7f
2280
                and     a,b
2281
                jp      po,and_7
2282
                fail_msg 6
2283
and_7:          ld      b,data_55
2284
                and     a,b
2285
                jp      pe,and_8
2286
                fail_msg 7
2287
and_8:          ld      a,data_ff
2288
                ld      c,data_80
2289
                and     a,c
2290
                jp      m,and_9
2291
                fail_msg 8
2292
and_9:          cp      data_80
2293
                jr      z,and_10
2294
                fail_msg 9
2295
and_10:         ld      a,data_ff
2296
                ld      d,data_7f
2297
                and     a,d
2298
                jp      p,and_11
2299
                fail_msg 10
2300
and_11:         cp      data_7f
2301
                jr      z,and_12
2302
                fail_msg 11
2303
and_12:         ld      a,data_ff
2304
                ld      e,data_aa
2305
                and     a,e
2306
                jp      m,and_13
2307
                fail_msg 12
2308
and_13:         cp      data_aa
2309
                jr      z,and_14
2310
                fail_msg 13
2311
and_14:         ld      a,data_ff
2312
                ld      h,data_55
2313
                and     a,h
2314
                jp      p,and_15
2315
                fail_msg 14
2316
and_15:         cp      data_55
2317
                jr      z,and_16
2318
                fail_msg 15
2319
and_16:         ld      a,data_ff
2320
                ld      l,data_aa
2321
                and     a,l
2322
                jp      m,and_17
2323
                fail_msg 16
2324
and_17:         cp      data_aa
2325
                jr      z,and_18
2326
                fail_msg 17
2327
and_18:         ld      a,data_ff
2328
                and     a,data_aa
2329
                jp      m,and_19
2330
                fail_msg 18
2331
and_19:         jr      nz,and_20
2332
                fail_msg 19
2333
and_20:         and     a,data_55
2334
                jp      p,and_21
2335
                fail_msg 20
2336
and_21:         jr      z,and_22
2337
                fail_msg 21
2338
and_22:         ld      a,data_ff
2339
                and     a,data_7f
2340
                jp      po,and_23
2341
                fail_msg 22
2342
and_23:         and     a,data_55
2343
                jp      pe,and_24
2344
                fail_msg 23
2345
and_24:         jr      nz,and_25
2346
                fail_msg 24
2347
and_25:         and     a,data_aa
2348
                jr      z,and_26
2349
                fail_msg 25
2350
and_26:         ld      a,data_ff
2351
                and     a,data_aa
2352
                cp      data_aa
2353
                jr      z,and_27
2354
                fail_msg 26
2355
and_27:         ld      hl,var4
2356
                ld      a,data_ff
2357
                and     a,(hl)
2358
                jp      m,and_28
2359
                fail_msg 27
2360
and_28:         jr      nz,and_29
2361
                fail_msg 28
2362
and_29:         ld      hl,var2
2363
                and     a,(hl)
2364
                jp      p,and_30
2365
                fail_msg 29
2366
and_30:         jr      z,and_31
2367
                fail_msg 30
2368
and_31:         ld      a,data_ff
2369
                ld      hl,var5
2370
                and     a,(hl)
2371
                jp      po,and_32
2372
                fail_msg 31
2373
and_32:         ld      hl,var2
2374
                and     a,(hl)
2375
                jp      pe,and_33
2376
                fail_msg 32
2377
and_33:         cp      data_55
2378
                jr      z,and_34
2379
                fail_msg 33
2380
and_34:         ld      ix,var3
2381
                ld      a,data_ff
2382
                and     a,(ix+1)
2383
                jp      m,and_35
2384
                fail_msg 34
2385
and_35:         jr      nz,and_36
2386
                fail_msg 35
2387
and_36:         and     a,(ix-1)
2388
                jp      p,and_37
2389
                fail_msg 36
2390
and_37:         jr      z,and_38
2391
                fail_msg 37
2392
and_38:         ld      a,data_ff
2393
                and     a,(ix+2)
2394
                jp      po,and_39
2395
                fail_msg 38
2396
and_39:         and     a,(ix-1)
2397
                jp      pe,and_40
2398
                fail_msg 39
2399
and_40:         cp      data_55
2400
                jr      z,and_41
2401
                fail_msg 40
2402
and_41:         ld      iy,var3
2403
                ld      a,data_ff
2404
                and     a,(iy+1)
2405
                jp      m,and_42
2406
                fail_msg 41
2407
and_42:         jr      nz,and_43
2408
                fail_msg 42
2409
and_43:         and     a,(iy-1)
2410
                jp      p,and_44
2411
                fail_msg 43
2412
and_44:         jr      z,and_45
2413
                fail_msg 44
2414
and_45:         ld      a,data_ff
2415
                and     a,(iy+2)
2416
                jp      po,and_46
2417
                fail_msg 45
2418
and_46:         and     a,(iy-1)
2419
                jp      pe,and_47
2420
                fail_msg 46
2421
and_47:         cp      data_55
2422
                jr      z,or_0
2423
                fail_msg 47
2424
or_0:           nop
2425
                print   "or_0"
2426
                ld      a,0
2427
                ld      b,data_7f
2428
                or      a,b
2429
                jp      p,or_1
2430
                fail_msg 0
2431
or_1:           jp      po,or_2
2432
                fail_msg 1
2433
or_2:           ld      b,data_80
2434
                or      a,b
2435
                jp      m,or_3
2436
                fail_msg 2
2437
or_3:           jp      pe,or_4
2438
                fail_msg 3
2439
or_4:           cp      data_ff
2440
                jr      z,or_5
2441
                fail_msg 4
2442
or_5:           ld      a,0
2443
                ld      b,0
2444
                or      a,b
2445
                jr      z,or_6
2446
                fail_msg 5
2447
or_6:           ld      b,data_55
2448
                or      a,b
2449
                jr      nz,or_7
2450
                fail_msg 6
2451
or_7:           cp      data_55
2452
                jr      z,or_8
2453
                fail_msg 7
2454
or_8:           ld      a,data_ff
2455
                add     a,1
2456
                jr      c,or_9
2457
                fail_msg 8
2458
or_9:           ld      b,data_7f
2459
                or      a,b
2460
                jr      nc,or_10
2461
                fail_msg 9
2462
or_10:          cp      data_7f
2463
                jr      z,or_11
2464
                fail_msg 10
2465
or_11:          ld      a,0
2466
                ld      c,data_55
2467
                or      a,c
2468
                cp      data_55
2469
                jr      z,or_12
2470
                fail_msg 11
2471
or_12:          ld      c,data_aa
2472
                or      a,c
2473
                cp      data_ff
2474
                jr      z,or_13
2475
                fail_msg 12
2476
or_13:          ld      a,0
2477
                ld      d,data_aa
2478
                or      a,d
2479
                cp      data_aa
2480
                jr      z,or_14
2481
                fail_msg 13
2482
or_14:          ld      e,data_55
2483
                or      a,e
2484
                cp      data_ff
2485
                jr      z,or_15
2486
                fail_msg 14
2487
or_15:          ld      a,0
2488
                ld      h,data_80
2489
                or      a,h
2490
                cp      data_80
2491
                jr      z,or_16
2492
                fail_msg 15
2493
or_16:          ld      l,data_7f
2494
                or      a,l
2495
                cp      data_ff
2496
                jr      z,or_17
2497
                fail_msg 16
2498
or_17:          ld      a,0
2499
                or      a,data_7f
2500
                jp      p,or_18
2501
                fail_msg 17
2502
or_18:          jp      po,or_19
2503
                fail_msg 18
2504
or_19:          or      a,data_80
2505
                jp      m,or_20
2506
                fail_msg 19
2507
or_20:          jp      pe,or_21
2508
                fail_msg 20
2509
or_21:          cp      data_ff
2510
                jr      z,or_22
2511
                fail_msg 21
2512
or_22:          ld      a,0
2513
                or      a,0
2514
                jr      z,or_23
2515
                fail_msg 22
2516
or_23:          or      a,data_7f
2517
                jr      nz,or_24
2518
                fail_msg 23
2519
or_24:          ld      a,data_ff
2520
                add     a,1
2521
                jr      c,or_25
2522
                fail_msg 24
2523
or_25:          or      a,data_55
2524
                jr      nc,or_26
2525
                fail_msg 25
2526
or_26:          cp      data_55
2527
                jr      z,or_27
2528
                fail_msg 26
2529
or_27:          ld      hl,var5
2530
                ld      a,0
2531
                or      a,(hl)
2532
                jp      p,or_28
2533
                fail_msg 27
2534
or_28:          jp      po,or_29
2535
                fail_msg 28
2536
or_29:          ld      hl,var3
2537
                or      a,(hl)
2538
                jp      m,or_30
2539
                fail_msg 29
2540
or_30:          jp      pe,or_31
2541
                fail_msg 30
2542
or_31:          cp      data_ff
2543
                jr      z,or_32
2544
                fail_msg 31
2545
or_32:          ld      hl,t_var1
2546
                ld      a,0
2547
                ld      (hl),a
2548
                or      a,(hl)
2549
                jr      z,or_33
2550
                fail_msg 32
2551
or_33:          ld      hl,var2
2552
                or      a,(hl)
2553
                jr      nz,or_34
2554
                fail_msg 33
2555
or_34:          cp      data_55
2556
                jr      z,or_35
2557
                fail_msg 34
2558
or_35:          ld      ix,var3
2559
                ld      a,0
2560
                or      a,(ix+2)
2561
                jp      p,or_36
2562
                fail_msg 35
2563
or_36:          jp      po,or_37
2564
                fail_msg 36
2565
or_37:          or      a,(ix+0)
2566
                jp      m,or_38
2567
                fail_msg 37
2568
or_38:          jp      pe,or_39
2569
                fail_msg 38
2570
or_39:          cp      data_ff
2571
                jr      z,or_40
2572
                fail_msg 39
2573
or_40:          ld      ix,t_var3
2574
                ld      a,0
2575
                ld      (ix-2),a
2576
                or      a,(ix-2)
2577
                jr      z,or_41
2578
                fail_msg 40
2579
or_41:          ld      (ix+2),data_aa
2580
                or      a,(ix+2)
2581
                jr      nz,or_42
2582
                fail_msg 41
2583
or_42:          cp      data_aa
2584
                jr      z,or_43
2585
                fail_msg 42
2586
or_43:          ld      iy,var3
2587
                ld      a,0
2588
                or      a,(iy+2)
2589
                jp      p,or_44
2590
                fail_msg 43
2591
or_44:          jp      po,or_45
2592
                fail_msg 44
2593
or_45:          or      a,(iy+0)
2594
                jp      m,or_46
2595
                fail_msg 45
2596
or_46:          jp      pe,or_47
2597
                fail_msg 46
2598
or_47:          cp      data_ff
2599
                jr      z,or_48
2600
                fail_msg 47
2601
or_48:          ld      iy,t_var3
2602
                ld      a,0
2603
                ld      (iy-2),a
2604
                or      a,(iy-2)
2605
                jr      z,or_49
2606
                fail_msg 48
2607
or_49:          ld      (iy+2),data_55
2608
                or      a,(iy+2)
2609
                jr      nz,or_50
2610
                fail_msg 49
2611
or_50:          cp      data_55
2612
                jr      z,xor_0
2613
                fail_msg 50
2614
xor_0:          nop
2615
                print   "xor_0"
2616
                ld      a,data_ff
2617
                ld      b,data_55
2618
                xor     a,b
2619
                jp      m,xor_1
2620
                fail_msg 0
2621
xor_1:          jp      pe,xor_2
2622
                fail_msg 1
2623
xor_2:          ld      b,data_80
2624
                xor     a,b
2625
                jp      p,xor_3
2626
                fail_msg 2
2627
xor_3:          jp      po,xor_4
2628
                fail_msg 3
2629
xor_4:          cp      #2a
2630
                jr      z,xor_5
2631
                fail_msg 4
2632
xor_5:          ld      a,data_ff
2633
                ld      b,data_ff
2634
                xor     a,b
2635
                jr      z,xor_6
2636
                fail_msg 5
2637
xor_6:          ld      b,data_55
2638
                xor     a,b
2639
                jr      nz,xor_7
2640
                fail_msg 6
2641
xor_7:          cp      data_55
2642
                jr      z,xor_8
2643
                fail_msg 7
2644
xor_8:          ld      a,data_ff
2645
                add     a,1
2646
                jr      c,xor_9
2647
                fail_msg 8
2648
xor_9:          ld      b,data_aa
2649
                xor     a,b
2650
                jr      nc,xor_10
2651
                fail_msg 9
2652
xor_10:         cp      data_aa
2653
                jr      z,xor_11
2654
                fail_msg 10
2655
xor_11:         ld      a,data_ff
2656
                ld      c,data_7f
2657
                xor     a,c
2658
                jp      m,xor_12
2659
                fail_msg 11
2660
xor_12:         cp      data_80
2661
                jr      z,xor_13
2662
                fail_msg 12
2663
xor_13:         ld      a,data_ff
2664
                ld      d,data_55
2665
                xor     a,d
2666
                jp      m,xor_14
2667
                fail_msg 13
2668
xor_14:         cp      data_aa
2669
                jr      z,xor_15
2670
                fail_msg 14
2671
xor_15:         ld      e,data_55
2672
                xor     a,e
2673
                jp      m,xor_16
2674
                fail_msg 15
2675
xor_16:         cp      data_ff
2676
                jr      z,xor_17
2677
                fail_msg 16
2678
xor_17:         ld      a,data_ff
2679
                ld      h,data_7f
2680
                xor     a,h
2681
                jp      po,xor_18
2682
                fail_msg 17
2683
xor_18:         ld      l,data_7f
2684
                xor     a,l
2685
                jp      pe,xor_19
2686
                fail_msg 18
2687
xor_19:         cp      data_ff
2688
                jr      z,xor_20
2689
                fail_msg 19
2690
xor_20:         ld      a,data_ff
2691
                add     a,1
2692
                jr      c,xor_21
2693
                fail_msg 20
2694
xor_21:         ld      b,data_7f
2695
                xor     a,b
2696
                jr      nc,xor_22
2697
                fail_msg 21
2698
xor_22:         cp      data_7f
2699
                jr      z,xor_23
2700
                fail_msg 22
2701
xor_23:         ld      a,data_ff
2702
                xor     a,data_7f
2703
                jp      po,xor_24
2704
                fail_msg 23
2705
xor_24:         jp      m,xor_25
2706
                fail_msg 24
2707
xor_25:         xor     a,data_7f
2708
                jp      pe,xor_26
2709
                fail_msg 25
2710
xor_26:         jp      m,xor_27
2711
                fail_msg 26
2712
xor_27:         xor     a,data_aa
2713
                jp      p,xor_28
2714
                fail_msg 27
2715
xor_28:         cp      data_55
2716
                jr      z,xor_29
2717
                fail_msg 28
2718
xor_29:         ld      a,data_ff
2719
                xor     a,data_ff
2720
                jr      z,xor_30
2721
                fail_msg 29
2722
xor_30:         xor     a,data_80
2723
                jr      nz,xor_31
2724
                fail_msg 30
2725
xor_31:         cp      data_80
2726
                jr      z,xor_32
2727
                fail_msg 31
2728
xor_32:         ld      hl,var5
2729
                ld      a,data_ff
2730
                xor     a,(hl)
2731
                jp      m,xor_33
2732
                fail_msg 32
2733
xor_33:         jp      po,xor_34
2734
                fail_msg 33
2735
xor_34:         xor     a,(hl)
2736
                jp      m,xor_35
2737
                fail_msg 34
2738
xor_35:         jp      pe,xor_36
2739
                fail_msg 35
2740
xor_36:         ld      hl,var3
2741
                xor     a,(hl)
2742
                jp      p,xor_37
2743
                fail_msg 36
2744
xor_37:         cp      data_7f
2745
                jr      z,xor_38
2746
                fail_msg 37
2747
xor_38:         ld      hl,var1
2748
                ld      a,data_ff
2749
                xor     a,(hl)
2750
                jr      z,xor_39
2751
                fail_msg 38
2752
xor_39:         ld      hl,var2
2753
                xor     a,(hl)
2754
                jr      nz,xor_40
2755
                fail_msg 39
2756
xor_40:         cp      data_55
2757
                jr      z,xor_41
2758
                fail_msg 40
2759
xor_41:         ld      ix,var3
2760
                ld      a,data_ff
2761
                xor     a,(ix+2)
2762
                jp      m,xor_42
2763
                fail_msg 41
2764
xor_42:         jp      po,xor_43
2765
                fail_msg 42
2766
xor_43:         xor     a,(ix+2)
2767
                jp      m,xor_44
2768
                fail_msg 43
2769
xor_44:         jp      pe,xor_45
2770
                fail_msg 44
2771
xor_45:         xor     a,(ix+1)
2772
                jp      p,xor_46
2773
                fail_msg 45
2774
xor_46:         cp      data_55
2775
                jr      z,xor_47
2776
                fail_msg 46
2777
xor_47:         ld      a,data_ff
2778
                xor     a,(ix-2)
2779
                jr      z,xor_48
2780
                fail_msg 47
2781
xor_48:         xor     a,(ix+1)
2782
                jr      nz,xor_49
2783
                fail_msg 48
2784
xor_49:         cp      data_aa
2785
                jr      z,xor_50
2786
                fail_msg 49
2787
xor_50:         ld      iy,var3
2788
                ld      a,data_ff
2789
                xor     a,(iy+2)
2790
                jp      m,xor_51
2791
                fail_msg 50
2792
xor_51:         jp      po,xor_52
2793
                fail_msg 51
2794
xor_52:         xor     a,(iy+2)
2795
                jp      m,xor_53
2796
                fail_msg 52
2797
xor_53:         jp      pe,xor_54
2798
                fail_msg 53
2799
xor_54:         xor     a,(iy+1)
2800
                jp      p,xor_55
2801
                fail_msg 54
2802
xor_55:         cp      data_55
2803
                jr      z,xor_56
2804
                fail_msg 55
2805
xor_56:         ld      a,data_ff
2806
                xor     a,(iy-2)
2807
                jr      z,xor_57
2808
                fail_msg 56
2809
xor_57:         xor     a,(iy-1)
2810
                jr      nz,xor_58
2811
                fail_msg 57
2812
xor_58:         cp      data_55
2813
                jr      z,cp_0
2814
                fail_msg 58
2815
cp_0:           nop
2816
                print   "cp_0"
2817
                ld      a,0
2818
                ld      b,0
2819
                cp      a,b
2820
                jr      z,cp_1
2821
                fail_msg 0
2822
cp_1:           jp      p,cp_2
2823
                fail_msg 1
2824
cp_2:           jr      nc,cp_3
2825
                fail_msg 2
2826
cp_3:           ld      b,data_55
2827
                cp      a,b
2828
                jr      nz,cp_4
2829
                fail_msg 3
2830
cp_4:           jp      m,cp_5
2831
                fail_msg 4
2832
cp_5:           jr      c,cp_6
2833
                fail_msg 5
2834
cp_6:           ld      a,data_80
2835
                ld      b,data_7f
2836
                cp      a,b
2837
                jp      pe,cp_7
2838
                fail_msg 6
2839
cp_7:           jr      nc,cp_8
2840
                fail_msg 7
2841
cp_8:           ld      a,data_7f
2842
                ld      b,data_80
2843
                cp      a,b
2844
                jp      pe,cp_9
2845
                fail_msg 8
2846
cp_9:           jr      c,cp_10
2847
                fail_msg 9
2848
cp_10:          ld      b,0
2849
                cp      a,b
2850
                jp      po,cp_11
2851
                fail_msg 10
2852
cp_11:          jr      nc,cp_12
2853
                fail_msg 11
2854
cp_12:          ld      a,data_80
2855
                ld      c,0
2856
                cp      a,c
2857
                jp      m,cp_13
2858
                fail_msg 12
2859
cp_13:          ld      c,data_80
2860
                cp      a,c
2861
                jr      z,cp_14
2862
                fail_msg 13
2863
cp_14:          ld      a,data_7f
2864
                ld      d,data_55
2865
                cp      a,d
2866
                jp      p,cp_15
2867
                fail_msg 14
2868
cp_15:          jr      nz,cp_16
2869
                fail_msg 15
2870
cp_16:          ld      e,data_7f
2871
                cp      a,e
2872
                jr      z,cp_17
2873
                fail_msg 16
2874
cp_17:          ld      a,data_80
2875
                ld      h,data_ff
2876
                cp      a,h
2877
                jp      m,cp_18
2878
                fail_msg 17
2879
cp_18:          jr      c,cp_19
2880
                fail_msg 18
2881
cp_19:          ld      l,data_80
2882
                cp      a,l
2883
                jr      z,cp_20
2884
                fail_msg 19
2885
cp_20:          ld      a,data_80
2886
                cp      a,data_7f
2887
                jp      p,cp_21
2888
                fail_msg 20
2889
cp_21:          jp      pe,cp_22
2890
                fail_msg 21
2891
cp_22:          jr      nz,cp_23
2892
                fail_msg 22
2893
cp_23:          cp      a,data_80
2894
                jp      p,cp_24
2895
                fail_msg 23
2896
cp_24:          jp      po,cp_25
2897
                fail_msg 24
2898
cp_25:          jr      z,cp_26
2899
                fail_msg 25
2900
cp_26:          ld      a,data_55
2901
                cp      a,data_7f
2902
                jr      c,cp_27
2903
                fail_msg 26
2904
cp_27:          jp      m,cp_28
2905
                fail_msg 27
2906
cp_28:          cp      a,data_55
2907
                jr      nc,cp_29
2908
                fail_msg 28
2909
cp_29:          jr      z,cp_30
2910
                fail_msg 29
2911
cp_30:          ld      a,data_80
2912
                ld      hl,var5
2913
                cp      a,(hl)
2914
                jp      p,cp_31
2915
                fail_msg 30
2916
cp_31:          jp      pe,cp_32
2917
                fail_msg 31
2918
cp_32:          jr      nz,cp_33
2919
                fail_msg 32
2920
cp_33:          ld      hl,var3
2921
                cp      a,(hl)
2922
                jp      p,cp_34
2923
                fail_msg 33
2924
cp_34:          jp      po,cp_35
2925
                fail_msg 34
2926
cp_35:          jr      z,cp_36
2927
                fail_msg 35
2928
cp_36:          ld      a,data_55
2929
                ld      hl,var5
2930
                cp      a,(hl)
2931
                jr      c,cp_37
2932
                fail_msg 36
2933
cp_37:          jp      m,cp_38
2934
                fail_msg 37
2935
cp_38:          ld      hl,var2
2936
                cp      a,(hl)
2937
                jr      nc,cp_39
2938
                fail_msg 38
2939
cp_39:          jp      p,cp_40
2940
                fail_msg 39
2941
cp_40:          jr      z,cp_41
2942
                fail_msg 40
2943
cp_41:          ld      a,data_80
2944
                ld      ix,var3
2945
                cp      a,(ix+2)
2946
                jp      p,cp_42
2947
                fail_msg 41
2948
cp_42:          jp      pe,cp_43
2949
                fail_msg 42
2950
cp_43:          jr      nz,cp_44
2951
                fail_msg 43
2952
cp_44:          cp      a,(ix+0)
2953
                jp      p,cp_45
2954
                fail_msg 44
2955
cp_45:          jp      po,cp_46
2956
                fail_msg 45
2957
cp_46:          jr      z,cp_47
2958
                fail_msg 46
2959
cp_47:          ld      a,data_55
2960
                cp      a,(ix-2)
2961
                jr      nz,cp_48
2962
                fail_msg 47
2963
cp_48:          jr      c,cp_49
2964
                fail_msg 48
2965
cp_49:          cp      a,(ix-1)
2966
                jr      z,cp_50
2967
                fail_msg 49
2968
cp_50:          jr      nc,cp_51
2969
                fail_msg 50
2970
cp_51:          ld      iy,var3
2971
                ld      a,data_80
2972
                cp      a,(iy+2)
2973
                jp      p,cp_52
2974
                fail_msg 51
2975
cp_52:          jp      pe,cp_53
2976
                fail_msg 52
2977
cp_53:          jr      nz,cp_54
2978
                fail_msg 53
2979
cp_54:          cp      a,(iy+0)
2980
                jp      p,cp_55
2981
                fail_msg 54
2982
cp_55:          jp      po,cp_56
2983
                fail_msg 55
2984
cp_56:          jr      z,cp_57
2985
                fail_msg 56
2986
cp_57:          ld      a,data_55
2987
                cp      a,(iy-2)
2988
                jr      nz,cp_58
2989
                fail_msg 57
2990
cp_58:          jr      c,cp_59
2991
                fail_msg 58
2992
cp_59:          cp      a,(iy-1)
2993
                jr      z,cp_60
2994
                fail_msg 59
2995
cp_60:          jr      nc,inc_0
2996
                fail_msg 60
2997
inc_0:          nop
2998
                print "inc"
2999
                ld      a,data_7f
3000
                cp      a,data_7f
3001
                jr      z,inc_1
3002
                fail_msg 0
3003
inc_1:          inc     a
3004
                jp      pe,inc_2
3005
                fail_msg 1
3006
inc_2:          jp      m,inc_3
3007
                fail_msg 2
3008
inc_3:          jr      nz,inc_4
3009
                fail_msg 3
3010
inc_4:          ld      a,data_55
3011
                inc     a
3012
                jp      po,inc_5
3013
                fail_msg 4
3014
inc_5:          jp      p,inc_6
3015
                fail_msg 5
3016
inc_6:          cp      a,data_55+1
3017
                jr      z,inc_7
3018
                fail_msg 6
3019
inc_7:          ld      a,data_ff-1
3020
                inc     a
3021
                jr      nz,inc_8
3022
                fail_msg 7
3023
inc_8:          jp      m,inc_9
3024
                fail_msg 8
3025
inc_9:          inc     a
3026
                jr      z,inc_10
3027
                fail_msg 9
3028
inc_10:         ld      b,data_aa
3029
                inc     b
3030
                jp      m,inc_11
3031
                fail_msg 10
3032
inc_11:         ld      a,b
3033
                cp      a,data_aa+1
3034
                jr      z,inc_12
3035
                fail_msg 11
3036
inc_12:         ld      c,data_80
3037
                inc     c
3038
                jp      m,inc_13
3039
                fail_msg 12
3040
inc_13:         ld      a,c
3041
                cp      a,data_80+1
3042
                jr      z,inc_14
3043
                fail_msg 13
3044
inc_14:         ld      d,data_ff
3045
                inc     d
3046
                jr      z,inc_15
3047
                fail_msg 14
3048
inc_15:         ld      e,data_55
3049
                inc     e
3050
                jp      p,inc_16
3051
                fail_msg 15
3052
inc_16:         ld      a,e
3053
                cp      a,data_55+1
3054
                jr      z,inc_17
3055
                fail_msg 16
3056
inc_17:         ld      h,data_7f
3057
                inc     h
3058
                jp      pe,inc_18
3059
                fail_msg 17
3060
inc_18:         ld      a,h
3061
                cp      a,data_80
3062
                jr      z,inc_19
3063
                fail_msg 18
3064
inc_19:         ld      l,data_aa
3065
                inc     l
3066
                jp      m,inc_20
3067
                fail_msg 19
3068
inc_20:         ld      a,l
3069
                cp      a,data_aa+1
3070
                jr      z,inc_21
3071
                fail_msg 20
3072
inc_21:         ld      hl,t_var1
3073
                ld      a,data_7f
3074
                ld      (hl),a
3075
                cp      a,(hl)
3076
                jr      z,inc_22
3077
                fail_msg 21
3078
inc_22:         inc     (hl)
3079
                jp      m,inc_23
3080
                fail_msg 22
3081
inc_23:         jp      pe,inc_24
3082
                fail_msg 23
3083
inc_24:         ld      a,data_55
3084
                ld      (hl),a
3085
                inc     (hl)
3086
                jp      p,inc_25
3087
                fail_msg 24
3088
inc_25:         jp      po,inc_26
3089
                fail_msg 25
3090
inc_26:         ld      a,(hl)
3091
                cp      a,data_55+1
3092
                jr      z,inc_27
3093
                fail_msg 26
3094
inc_27:         ld      a,data_ff
3095
                ld      (hl),a
3096
                inc     (hl)
3097
                jr      z,inc_28
3098
                fail_msg 27
3099
inc_28:         inc     (hl)
3100
                jr      nz,inc_29
3101
                fail_msg 28
3102
inc_29:         ld      a,(hl)
3103
                cp      a,1
3104
                jr      z,inc_30
3105
                fail_msg 29
3106
inc_30:         ld      a,data_aa
3107
                ld      (hl),a
3108
                inc     (hl)
3109
                jp      m,inc_31
3110
                fail_msg 30
3111
inc_31:         ld      a,(hl)
3112
                cp      a,data_aa+1
3113
                jr      z,inc_32
3114
                fail_msg 31
3115
inc_32:         ld      ix,t_var3
3116
                ld      a,data_7f
3117
                ld      (ix-2),a
3118
                cp      a,data_7f
3119
                jr      z,inc_33
3120
                fail_msg 32
3121
inc_33:         inc     (ix-2)
3122
                jp      m,inc_34
3123
                fail_msg 33
3124
inc_34:         jp      pe,inc_35
3125
                fail_msg 34
3126
inc_35:         ld      a,data_55
3127
                ld      (ix+2),a
3128
                inc     (ix+2)
3129
                jp      p,inc_36
3130
                fail_msg 35
3131
inc_36:         jp      po,inc_37
3132
                fail_msg 36
3133
inc_37:         ld      a,(ix+2)
3134
                cp      a,data_55+1
3135
                jr      z,inc_38
3136
                fail_msg 37
3137
inc_38:         ld      a,data_ff
3138
                ld      (ix-1),a
3139
                inc     (ix-1)
3140
                jr      z,inc_39
3141
                fail_msg 38
3142
inc_39:         inc     (ix-1)
3143
                jr      nz,inc_40
3144
                fail_msg 39
3145
inc_40:         ld      a,(ix-1)
3146
                cp      a,1
3147
                jr      z,inc_41
3148
                fail_msg 40
3149
inc_41:         ld      a,data_aa
3150
                ld      (ix+1),a
3151
                inc     (ix+1)
3152
                jp      m,inc_42
3153
                fail_msg 41
3154
inc_42:         ld      a,(ix+1)
3155
                cp      a,data_aa+1
3156
                jr      z,inc_43
3157
                fail_msg 42
3158
inc_43:         ld      iy,t_var3
3159
                ld      a,data_7f
3160
                ld      (iy+2),a
3161
                cp      a,data_7f
3162
                jr      z,inc_44
3163
                fail_msg 43
3164
inc_44:         inc     (iy+2)
3165
                jp      m,inc_45
3166
                fail_msg 44
3167
inc_45:         jp      pe,inc_46
3168
                fail_msg 45
3169
inc_46:         ld      a,data_55
3170
                ld      (iy-2),a
3171
                inc     (iy-2)
3172
                jp      p,inc_47
3173
                fail_msg 46
3174
inc_47:         jp      po,inc_48
3175
                fail_msg 47
3176
inc_48:         ld      a,(iy-2)
3177
                cp      a,data_55+1
3178
                jr      z,inc_49
3179
                fail_msg 48
3180
inc_49:         ld      a,data_ff
3181
                ld      (iy+1),a
3182
                inc     (iy+1)
3183
                jr      z,inc_50
3184
                fail_msg 49
3185
inc_50:         inc     (iy+1)
3186
                jr      nz,inc_51
3187
                fail_msg 50
3188
inc_51:         ld      a,(iy+1)
3189
                cp      a,1
3190
                jr      z,inc_52
3191
                fail_msg 51
3192
inc_52:         ld      a,data_80
3193
                ld      (iy-1),a
3194
                inc     (iy-1)
3195
                jp      m,inc_53
3196
                fail_msg 52
3197
inc_53:         ld      a,(iy-1)
3198
                cp      a,data_80+1
3199
                jr      z,dec_0
3200
                fail_msg 53
3201
dec_0:          nop
3202
                print "dec"
3203
                ld      a,data_80
3204
                cp      a,data_80
3205
                jr      z,dec_1
3206
                fail_msg 0
3207
dec_1:          dec     a
3208
                jp      p,dec_2
3209
                fail_msg 1
3210
dec_2:          jp      pe,dec_3
3211
                fail_msg 2
3212
dec_3:          ld      a,0
3213
                dec     a
3214
                jp      m,dec_4
3215
                fail_msg 3
3216
dec_4:          jp      po,dec_5
3217
                fail_msg 4
3218
dec_5:          cp      a,data_ff
3219
                jr      z,dec_6
3220
                fail_msg 5
3221
dec_6:          ld      a,1
3222
                dec     a
3223
                jr      z,dec_7
3224
                fail_msg 6
3225
dec_7:          dec     a
3226
                jr      nz,dec_8
3227
                fail_msg 7
3228
dec_8:          cp      a,data_ff
3229
                jr      z,dec_9
3230
                fail_msg 8
3231
dec_9:          ld      a,data_aa
3232
                dec     a
3233
                cp      a,data_aa-1
3234
                jr      z,dec_10
3235
                fail_msg 9
3236
dec_10:         ld      b,data_7f
3237
                dec     b
3238
                ld      a,b
3239
                cp      a,data_7f-1
3240
                jr      z,dec_11
3241
                fail_msg 10
3242
dec_11:         ld      c,data_55
3243
                dec     c
3244
                ld      a,c
3245
                cp      a,data_55-1
3246
                jr      z,dec_12
3247
                fail_msg 11
3248
dec_12:         ld      d,data_aa
3249
                dec     d
3250
                ld      a,d
3251
                cp      a,data_aa-1
3252
                jr      z,dec_13
3253
                fail_msg 12
3254
dec_13:         ld      e,data_80
3255
                dec     e
3256
                ld      a,e
3257
                cp      a,data_80-1
3258
                jr      z,dec_14
3259
                fail_msg 13
3260
dec_14:         ld      h,data_ff
3261
                dec     h
3262
                ld      a,h
3263
                cp      a,data_ff-1
3264
                jr      z,dec_15
3265
                fail_msg 14
3266
dec_15:         ld      l,data_55
3267
                dec     l
3268
                ld      a,l
3269
                cp      a,data_55-1
3270
                jr      z,dec_16
3271
                fail_msg 15
3272
dec_16:         ld      hl,t_var5
3273
                ld      a,data_80
3274
                ld      (hl),a
3275
                cp      a,(hl)
3276
                jr      z,dec_17
3277
                fail_msg 16
3278
dec_17:         dec     (hl)
3279
                jp      p,dec_18
3280
                fail_msg 17
3281
dec_18:         jp      pe,dec_19
3282
                fail_msg 18
3283
dec_19:         ld      a,0
3284
                ld      (hl),a
3285
                dec     (hl)
3286
                jp      m,dec_20
3287
                fail_msg 19
3288
dec_20:         jp      po,dec_21
3289
                fail_msg 20
3290
dec_21:         ld      a,(hl)
3291
                cp      a,data_ff
3292
                jr      z,dec_22
3293
                fail_msg 21
3294
dec_22:         ld      a,1
3295
                ld      (hl),a
3296
                dec     (hl)
3297
                jr      z,dec_23
3298
                fail_msg 22
3299
dec_23:         dec     (hl)
3300
                jr      nz,dec_24
3301
                fail_msg 23
3302
dec_24:         ld      a,(hl)
3303
                cp      a,data_ff
3304
                jr      z,dec_25
3305
                fail_msg 24
3306
dec_25:         ld      a,data_aa
3307
                ld      (hl),a
3308
                dec     (hl)
3309
                ld      a,(hl)
3310
                cp      a,data_aa-1
3311
                jr      z,dec_26
3312
                fail_msg 25
3313
dec_26:         ld      ix,t_var3
3314
                ld      a,data_80
3315
                ld      (ix-2),a
3316
                cp      a,(ix-2)
3317
                jr      z,dec_27
3318
                fail_msg 26
3319
dec_27:         dec     (ix-2)
3320
                jp      p,dec_28
3321
                fail_msg 27
3322
dec_28:         jp      pe,dec_29
3323
                fail_msg 28
3324
dec_29:         ld      a,0
3325
                ld      (ix+2),a
3326
                dec     (ix+2)
3327
                jp      m,dec_30
3328
                fail_msg 29
3329
dec_30:         jp      po,dec_31
3330
                fail_msg 30
3331
dec_31:         ld      a,(ix+2)
3332
                cp      a,data_ff
3333
                jr      z,dec_32
3334
                fail_msg 31
3335
dec_32:         ld      a,1
3336
                ld      (ix-1),a
3337
                dec     (ix-1)
3338
                jr      z,dec_33
3339
                fail_msg 32
3340
dec_33:         dec     (ix-1)
3341
                jr      nz,dec_34
3342
                fail_msg 33
3343
dec_34:         ld      a,(ix-1)
3344
                cp      a,data_ff
3345
                jr      z,dec_35
3346
                fail_msg 34
3347
dec_35:         ld      a,data_7f
3348
                ld      (ix+1),a
3349
                dec     (ix+1)
3350
                ld      a,(ix+1)
3351
                cp      a,data_7f-1
3352
                jr      z,dec_36
3353
                fail_msg 35
3354
dec_36:         ld      iy,t_var3
3355
                ld      a,data_80
3356
                ld      (iy-2),a
3357
                cp      a,(iy-2)
3358
                jr      z,dec_37
3359
                fail_msg 36
3360
dec_37:         dec     (iy-2)
3361
                jp      p,dec_38
3362
                fail_msg 37
3363
dec_38:         jp      pe,dec_39
3364
                fail_msg 38
3365
dec_39:         ld      a,0
3366
                ld      (iy+2),a
3367
                dec     (iy+2)
3368
                jp      m,dec_40
3369
                fail_msg 39
3370
dec_40:         jp      po,dec_41
3371
                fail_msg 40
3372
dec_41:         ld      a,(iy+2)
3373
                cp      a,data_ff
3374
                jr      z,dec_42
3375
                fail_msg 41
3376
dec_42:         ld      a,1
3377
                ld      (iy+1),a
3378
                dec     (iy+1)
3379
                jr      z,dec_43
3380
                fail_msg 42
3381
dec_43:         dec     (iy+1)
3382
                jr      nz,dec_44
3383
                fail_msg 43
3384
dec_44:         ld      a,(iy+1)
3385
                cp      a,data_ff
3386
                jr      z,dec_45
3387
                fail_msg 44
3388
dec_45:         ld      a,data_aa
3389
                ld      (iy-1),a
3390
                dec     (iy-1)
3391
                ld      a,(iy-1)
3392
                cp      a,data_aa-1
3393
                jr      z,cpl_0
3394
                fail_msg 45
3395
cpl_0:          ld      a,data_ff
3396
                cpl
3397
                cp      a,0
3398
                jr      z,cpl_1
3399
                fail_msg 0
3400
cpl_1:          ld      a,data_aa
3401
                cpl
3402
                cp      a,data_55
3403
                jr      z,cpl_2
3404
                fail_msg 1
3405
cpl_2:          cpl
3406
                cp      a,data_aa
3407
                jr      z,neg_0
3408
                fail_msg 2
3409
neg_0:          nop
3410
                print "neg"
3411
                ld      a,data_80
3412
                cp      a,data_80
3413
                jp      po,neg_1
3414
                fail_msg 0
3415
neg_1:          neg
3416
                jp      pe,neg_2
3417
                fail_msg 1
3418
neg_2:          jr      nz,neg_3
3419
                fail_msg 2
3420
neg_3:          jr      c,neg_4
3421
                fail_msg 3
3422
neg_4:          ld      a,0
3423
                neg
3424
                jp      po,neg_5
3425
                fail_msg 4
3426
neg_5:          jr      z,neg_6
3427
                fail_msg 5
3428
neg_6:          jr      nc,neg_7
3429
                fail_msg 6
3430
neg_7:          ld      a,data_55
3431
                cp      a,data_55
3432
                jp      p,neg_8
3433
                fail_msg 7
3434
neg_8:          neg
3435
                jp      m,neg_9
3436
                fail_msg 8
3437
neg_9:          neg
3438
                jp      p,neg_10
3439
                fail_msg 9
3440
neg_10:         cp      a,data_55
3441
                jr      z,ccf_0
3442
                fail_msg 10
3443
ccf_0:          nop
3444
                print "ccf/im"
3445
                scf
3446
                jr      c,ccf_1
3447
                fail_msg 0
3448
ccf_1:          ccf
3449
                jr      nc,ccf_2
3450
                fail_msg 1
3451
ccf_2:          ccf
3452
                jr      c,im_0
3453
                fail_msg 2
3454
im_0:           im      0
3455
                im      1
3456
                im      2
3457
daa_0:          nop
3458
                print "daa"
3459
                ld      a,#99
3460
                ld      b,#1
3461
                add     a,b
3462
                daa
3463
                jr      c,daa_1
3464
                fail_msg 0
3465
daa_1:          jr      z,daa_2
3466
                fail_msg 1
3467
daa_2:          add     a,b
3468
                jr      nc,daa_3
3469
                fail_msg 2
3470
daa_3:          jr      nz,daa_4
3471
                fail_msg 3
3472
daa_4:          cp      a,1
3473
                jr      z,daa_5
3474
                fail_msg 4
3475
daa_5:          ld      a,#98
3476
                ld      b,1
3477
                add     a,b
3478
                daa
3479
                jp      m,daa_6
3480
                fail_msg 5
3481
daa_6:          add     a,b
3482
                daa
3483
                jp      p,daa_7
3484
                fail_msg 6
3485
daa_7:          ld      a,1
3486
                ld      b,1
3487
                add     a,b
3488
                daa
3489
                jp      po,daa_8
3490
                fail_msg 7
3491
daa_8:          add     a,b
3492
                daa
3493
                jp      pe,daa_9
3494
                fail_msg 8
3495
daa_9:          cp      a,3
3496
                jr      z,add_74
3497
                fail_msg 9
3498
add_74:         nop
3499
                print "add"
3500
                ld      hl,data_1234
3501
                add     hl,hl
3502
                jr      nc,add_75
3503
                fail_msg 74
3504
add_75:         ld      a,h
3505
                cp      a,#24
3506
                jr      z,add_76
3507
                fail_msg 75
3508
add_76:         ld      a,l
3509
                cp      a,#68
3510
                jr      z,add_77
3511
                fail_msg 76
3512
add_77:         ld      hl,data_7fff
3513
                ld      bc,data_8000
3514
                add     hl,bc
3515
                jr      nc,add_78
3516
                fail_msg 77
3517
add_78:         ld      bc,1
3518
                add     hl,bc
3519
                jr      c,add_79
3520
                fail_msg 78
3521
add_79:         ld      a,h
3522
                cp      a,0
3523
                jr      z,add_80
3524
                fail_msg 79
3525
add_80:         ld      a,l
3526
                cp      a,0
3527
                jr      z,add_81
3528
                fail_msg 80
3529
add_81:         ld      hl,data_aa55
3530
                ld      de,data_ffff
3531
                add     hl,de
3532
                jr      c,add_82
3533
                fail_msg 81
3534
add_82:         ld      a,h
3535
                cp      a,data_aa
3536
                jr      z,add_83
3537
                fail_msg 82
3538
add_83:         ld      a,l
3539
                cp      a,data_55-1
3540
                jr      z,add_84
3541
                fail_msg 83
3542
add_84:         ld      hl,data_aa55
3543
                ld      sp,data_8000
3544
                add     hl,sp
3545
                jr      c,add_85
3546
                fail_msg 84
3547
add_85:         ld      a,h
3548
                cp      a,#2a
3549
                jr      z,add_86
3550
                fail_msg 85
3551
add_86:         ld      a,l
3552
                cp      a,data_55
3553
                jr      z,add_87
3554
                fail_msg 86
3555
add_87:         ld      sp,stack_end
3556
                ld      hl,data_1234
3557
                scf
3558
                ccf
3559
                adc     hl,hl
3560
                jr      nz,add_88
3561
                fail_msg 87
3562
add_88:         jr      nc,add_89
3563
                fail_msg 88
3564
add_89:         jp      p,add_90
3565
                fail_msg 89
3566
add_90:         jp      po,add_91
3567
                fail_msg 90
3568
add_91:         ld      bc,data_8000
3569
                adc     hl,bc
3570
                jp      m,add_92
3571
                fail_msg 91
3572
add_92:         jr      nc,add_93
3573
                fail_msg 92
3574
add_93:         jp      po,add_94
3575
                fail_msg 93
3576
add_94:         jp      nz,add_95
3577
                fail_msg 94
3578
add_95:         adc     hl,bc
3579
                jp      p,add_96
3580
                fail_msg 95
3581
add_96:         jp      pe,add_97
3582
                fail_msg 96
3583
add_97:         jr      c,add_98
3584
                fail_msg 97
3585
add_98:         jr      nz,add_99
3586
                fail_msg 98
3587
add_99:         ld      de,#db97
3588
                adc     hl,de
3589
                jr      z,add_100
3590
                fail_msg 99
3591
add_100:        jr      c,add_101
3592
                fail_msg 100
3593
add_101:        jp      po,add_102
3594
                fail_msg 101
3595
add_102:        ld      de,0
3596
                adc     hl,de
3597
                jr      nc,add_103
3598
                fail_msg 102
3599
add_103:        jr      nz,add_104
3600
                fail_msg 103
3601
add_104:        ld      a,h
3602
                cp      a,0
3603
                jr      z,add_105
3604
                fail_msg 104
3605
add_105:        ld      a,l
3606
                cp      a,1
3607
                jr      z,add_106
3608
                fail_msg 105
3609
add_106:        ld      hl,data_1234
3610
                ld      sp,data_ffff
3611
                adc     hl,sp
3612
                jr      c,add_107
3613
                fail_msg 106
3614
add_107:        ld      a,h
3615
                cp      a,#12
3616
                jr      z,add_108
3617
                fail_msg 107
3618
add_108:        ld      a,l
3619
                cp      a,#33
3620
                jr      z,sbc_66
3621
                fail_msg 108
3622
sbc_66:         ld      sp,stack_end
3623
                print   "sbc"
3624
                scf
3625
                ccf
3626
                ld      hl,data_1234
3627
                sbc     hl,hl
3628
                jr      z,sbc_67
3629
                fail_msg 66
3630
sbc_67:         jp      p,sbc_68
3631
                fail_msg 67
3632
sbc_68:         jp      po,sbc_69
3633
                fail_msg 68
3634
sbc_69:         jr      nc,sbc_70
3635
                fail_msg 69
3636
sbc_70:         ld      bc,data_1234
3637
                sbc     hl,bc
3638
                jr      nz,sbc_71
3639
                fail_msg 70
3640
sbc_71:         jr      c,sbc_72
3641
                fail_msg 71
3642
sbc_72:         jp      m,sbc_73
3643
                fail_msg 72
3644
sbc_73:         jp      po,sbc_74
3645
                fail_msg 73
3646
sbc_74:         ld      de,data_7fff
3647
                sbc     hl,de
3648
                jr      nz,sbc_75
3649
                fail_msg 74
3650
sbc_75:         jr      nc,sbc_76
3651
                fail_msg 75
3652
sbc_76:         jp      p,sbc_77
3653
                fail_msg 76
3654
sbc_77:         jp      pe,sbc_78
3655
                fail_msg 77
3656
sbc_78:         ld      sp,data_1234
3657
                sbc     hl,sp
3658
                jr      nz,sbc_79
3659
                fail_msg 78
3660
sbc_79:         ld      a,h
3661
                cp      a,#5b
3662
                jr      z,sbc_80
3663
                fail_msg 79
3664
sbc_80:         ld      a,l
3665
                cp      a,#98
3666
                jr      z,add_109
3667
                fail_msg 80
3668
add_109:        ld      sp,stack_end
3669
                print   "add"
3670
                ld      ix,0
3671
                add     ix,sp
3672
                jr      nc,add_110
3673
                fail_msg 109
3674
add_110:        push    ix
3675
                pop     hl
3676
                ld      a,h
3677
                cp      a,stack_end_hi          ; >stack_end
3678
                jr      z,add_111
3679
                fail_msg 110
3680
add_111:        ld      a,l
3681
                cp      a,stack_end_lo          ; 
3682
                jr      z,add_112
3683
                fail_msg 111
3684
add_112:        ld      ix,data_7fff
3685
                ld      bc,data_aa55
3686
                add     ix,bc
3687
                jr      c,add_113
3688
                fail_msg 112
3689
add_113:        add     ix,bc
3690
                jr      nc,add_114
3691
                fail_msg 113
3692
add_114:        push    ix
3693
                pop     hl
3694
                ld      a,h
3695
                cp      a,#d4
3696
                jr      z,add_115
3697
                fail_msg 114
3698
add_115:        ld      a,l
3699
                cp      a,#a9
3700
                jr      z,add_116
3701
                fail_msg 115
3702
add_116:        ld      ix,data_1234
3703
                ld      de,data_1234
3704
                add     ix,de
3705
                push    ix
3706
                pop     hl
3707
                ld      a,h
3708
                cp      a,#24           ;>(data_1234+data_1234)
3709
                jr      z,add_117
3710
                fail_msg 116
3711
add_117:        ld      a,l
3712
                cp      a,#68           ;<(data_1234+data_1234)
3713
                jr      z,add_118
3714
                fail_msg 117
3715
add_118:        ld      ix,data_1234
3716
                add     ix,ix
3717
                push    ix
3718
                pop     bc
3719
                ld      a,b
3720
                cp      a,#24           ;>(data_1234+data_1234)
3721
                jr      z,add_119
3722
                fail_msg 118
3723
add_119:        ld      a,c
3724
                cp      a,#68           ;<(data_1234+data_1234)
3725
                jr      z,add_120
3726
                fail_msg 119
3727
add_120:        ld      sp,stack_end
3728
                ld      iy,0
3729
                add     iy,sp
3730
                jr      nc,add_121
3731
                fail_msg 120
3732
add_121:        push    iy
3733
                pop     hl
3734
                ld      a,h
3735
                cp      a,stack_end_hi          ;>stack_end
3736
                jr      z,add_122
3737
                fail_msg 121
3738
add_122:        ld      a,l
3739
                cp      a,stack_end_lo          ;
3740
                jr      z,add_123
3741
                fail_msg 122
3742
add_123:        ld      iy,data_7fff
3743
                ld      bc,data_aa55
3744
                add     iy,bc
3745
                jr      c,add_124
3746
                fail_msg 123
3747
add_124:        add     iy,bc
3748
                jr      nc,add_125
3749
                fail_msg 124
3750
add_125:        push    iy
3751
                pop     hl
3752
                ld      a,h
3753
                cp      a,#d4
3754
                jr      z,add_126
3755
                fail_msg 125
3756
add_126:        ld      a,l
3757
                cp      a,#a9
3758
                jr      z,add_127
3759
                fail_msg 126
3760
add_127:        ld      iy,data_1234
3761
                ld      de,data_1234
3762
                add     iy,de
3763
                push    iy
3764
                pop     hl
3765
                ld      a,h
3766
                cp      a,#24           ;>(data_1234+data_1234)
3767
                jr      z,add_128
3768
                fail_msg 127
3769
add_128:        ld      a,l
3770
                cp      a,#68           ;<(data_1234+data_1234)
3771
                jr      z,add_129
3772
                fail_msg 128
3773
add_129:        ld      iy,data_1234
3774
                add     iy,iy
3775
                push    iy
3776
                pop     bc
3777
                ld      a,b
3778
                cp      a,#24           ;>(data_1234+data_1234)
3779
                jr      z,add_130
3780
                fail_msg 129
3781
add_130:        ld      a,c
3782
                cp      a,#68           ;<(data_1234+data_1234)
3783
                jr      z,inc_54
3784
                fail_msg 130
3785
inc_54:         ld      sp,stack_end
3786
                print "inc"
3787
                ld      bc,data_1234
3788
                inc     bc
3789
                ld      a,b
3790
                cp      a,#12      ;bjp was >data_1234
3791
                jr      z,inc_55
3792
                fail_msg 54
3793
inc_55:         ld      a,c
3794
                cp      a,#34+1      ;bjp was >data_1234+1
3795
                jr      z,inc_56
3796
                fail_msg 55
3797
inc_56:         ld      de,data_55aa
3798
                inc     de
3799
                ld      a,d
3800
                cp      a,#55           ;>data_55aa
3801
                jr      z,inc_57
3802
                fail_msg 56
3803
inc_57:         ld      a,e
3804
                cp      a,#ab           ;
3805
                jr      z,inc_58
3806
                fail_msg 57
3807
inc_58:         ld      hl,data_7fff
3808
                inc     hl
3809
                ld      a,h
3810
                cp      a,#80           ;>data_7fff+1
3811
                jr      z,inc_59
3812
                fail_msg 58
3813
inc_59:         ld      a,l
3814
                cp      a,#00           ;
3815
                jr      z,inc_60
3816
                fail_msg 59
3817
        ;; this test doesn't make any sense to me.  it looks
3818
        ;; like it increments SP, and then looks for *both*
3819
        ;; SPhigh and SPlow to have been incremented by 1.  The
3820
        ;; only way this works is if SP started as stack_end + 100
3821
        ;; added new statement accordingly. (gth)
3822
inc_60:         ld      sp,stack_end+#100 ; added new initial val (gth)
3823
                ld      hl,0
3824
                inc     sp
3825
                add     hl,sp
3826
                ld      sp,stack_end
3827
                ld      a,h
3828
                cp      a,stack_end_hi+1                ;>stack_end+1
3829
                jr      z,inc_61
3830
                fail_msg 60
3831
inc_61:         ld      a,l
3832
                cp      a,stack_end_lo+1                ;
3833
                jr      z,inc_62
3834
                fail_msg 61
3835
inc_62:         ld      ix,data_8000
3836
                inc     ix
3837
                push    ix
3838
                pop     de
3839
                ld      a,d
3840
                cp      a,#80           ;>data_8000
3841
                jr      z,inc_63
3842
                fail_msg 62
3843
inc_63:         ld      a,e
3844
                cp      a,#01           ;
3845
                jr      z,inc_64
3846
                fail_msg 63
3847
inc_64:         ld      iy,data_7fff
3848
                inc     iy
3849
                push    iy
3850
                pop     bc
3851
                ld      a,b
3852
                cp      a,#80           ;>data_7fff+1
3853
                jr      z,inc_65
3854
                fail_msg 64
3855
inc_65:         ld      a,c
3856
                cp      a,#00           ;
3857
                jr      z,dec_46
3858
                fail_msg 65
3859
dec_46:         nop
3860
                print   "dec"
3861
                ld      bc,data_1234
3862
                dec     bc
3863
                ld      a,b
3864
                cp      a,#12      ;bjp was >data_1234
3865
                jr      z,dec_47
3866
                fail_msg 46
3867
dec_47:         ld      a,c
3868
                cp      a,#34-1      ;bjp was >data_1234-1
3869
                jr      z,dec_48
3870
                fail_msg 47
3871
dec_48:         ld      de,data_8000
3872
                dec     de
3873
                ld      a,d
3874
                cp      a,#7f           ;>data_7fff
3875
                jr      z,dec_49
3876
                fail_msg 48
3877
dec_49:         ld      a,e
3878
                cp      a,#ff           ;
3879
                jr      z,dec_50
3880
                fail_msg 49
3881
dec_50:         ld      hl,data_aa55
3882
                dec     hl
3883
                ld      a,h
3884
                cp      a,#aa           ;>data_aa55
3885
                jr      z,dec_51
3886
                fail_msg 50
3887
dec_51:         ld      a,l
3888
                cp      a,#54           ;
3889
                jr      z,dec_52
3890
                fail_msg 51
3891
        ;; similar mysterious test to inc_60, expecting both halves
3892
        ;; of SP to be decremented.  Fix by setting sp stack_end-100 (gth)
3893
dec_52:         ld      sp, stack_end-#100 ; new starting SP (gth)
3894
                ld      hl,0
3895
                dec     sp
3896
                add     hl,sp
3897
                ld      a,h
3898
                cp      a,stack_end_hi-1                ;>stack_end-1
3899
                jr      z,dec_53
3900
                fail_msg 52
3901
dec_53:         ld      a,l
3902
                cp      a,stack_end_lo-1                ;
3903
                jr      z,dec_54
3904
                fail_msg 53
3905
dec_54:         ld      sp,stack_end
3906
                ld      ix,data_ffff
3907
                dec     ix
3908
                push    ix
3909
                pop     bc
3910
                ld      a,b
3911
                cp      a,#ff           ;>data_ffff
3912
                jr      z,dec_55
3913
                fail_msg 54
3914
dec_55:         ld      a,c
3915
                cp      a,#fe           ;
3916
                jr      z,dec_56
3917
                fail_msg 55
3918
dec_56:         ld      iy,data_aa55
3919
                dec     iy
3920
                push    iy
3921
                pop     de
3922
                ld      a,d
3923
                cp      a,#aa           ;>data_aa55
3924
                jr      z,dec_57
3925
                fail_msg 56
3926
dec_57:         ld      a,e
3927
                cp      a,#54           ;
3928
                jr      z,rlca_0
3929
                fail_msg 57
3930
rlca_0:         nop
3931
                print   "rlca/rla"
3932
                ld      a,data_80
3933
                rlca
3934
                jr      c,rlca_1
3935
                fail_msg 0
3936
rlca_1:         rlca
3937
                jr      nc,rlca_2
3938
                fail_msg 1
3939
rlca_2:         cp      a,2
3940
                jr      z,rlca_3
3941
                fail_msg 2
3942
rlca_3:         ld      a,data_55
3943
                rlca
3944
                cp      a,data_aa
3945
                jr      z,rla_0
3946
                fail_msg 3
3947
rla_0:
3948
                scf
3949
                ccf
3950
                ld      a,data_80
3951
                rla
3952
                jr      c,rla_1
3953
                fail_msg 0
3954
rla_1:          rla
3955
                jr      nc,rla_2
3956
                fail_msg 1
3957
rla_2:          cp      a,1
3958
                jr      z,rla_3
3959
                fail_msg 2
3960
rla_3:          ld      a,data_7f
3961
                rla
3962
                cp      a,data_ff-1
3963
                jr      z,rrca_0
3964
                fail_msg 3
3965
rrca_0:         nop
3966
                print "rrca/rra"
3967
                scf
3968
                ccf
3969
                ld      a,1
3970
                rrca
3971
                jr      c,rrca_1
3972
                fail_msg 0
3973
rrca_1:         rrca
3974
                jr      nc,rrca_2
3975
                fail_msg 1
3976
rrca_2:         cp      a,data_7f-#3f
3977
                jr      z,rrca_3
3978
                fail_msg 2
3979
rrca_3:         ld      a,data_aa
3980
                rrca
3981
                cp      a,data_55
3982
                jr      z,rra_0
3983
                fail_msg 3
3984
rra_0:          scf
3985
                ccf
3986
                ld      a,1
3987
                rra
3988
                jr      c,rra_1
3989
                fail_msg 0
3990
rra_1:          rra
3991
                jr      nc,rra_2
3992
                fail_msg 1
3993
rra_2:          cp      a,data_80
3994
                jr      z,rra_3
3995
                fail_msg 2
3996
rra_3:          ld      a,data_aa
3997
                rra
3998
                cp      a,data_55
3999
                jr      z,rlc_0
4000
                fail_msg 3
4001
rlc_0:          nop
4002
                print   "rlc"
4003
                ld      a,data_80
4004
                rlc     a
4005
                jr      c,rlc_1
4006
                fail_msg 0
4007
rlc_1:          jp      p,rlc_2
4008
                fail_msg 1
4009
rlc_2:          jr      nz,rlc_3
4010
                fail_msg 2
4011
rlc_3:          jp      po,rlc_4
4012
                fail_msg 3
4013
rlc_4:          rlc     a
4014
                jr      nc,rlc_5
4015
                fail_msg 4
4016
rlc_5:          rlc     a
4017
                rlc     a
4018
                rlc     a
4019
                rlc     a
4020
                rlc     a
4021
                rlc     a
4022
                jp      m,rlc_6
4023
                fail_msg 5
4024
rlc_6:          ld      a,data_55
4025
                rlc     a
4026
                jp      m,rlc_7
4027
                fail_msg 6
4028
rlc_7:          jp      pe,rlc_8
4029
                fail_msg 7
4030
rlc_8:          cp      a,data_aa
4031
                jr      z,rlc_9
4032
                fail_msg 8
4033
rlc_9:          ld      a,0
4034
                rlc     a
4035
                jr      z,rlc_10
4036
                fail_msg 9
4037
rlc_10:         ld      b,data_7f
4038
                rlc     b
4039
                ld      a,b
4040
                cp      a,data_ff-1
4041
                jr      z,rlc_11
4042
                fail_msg 10
4043
rlc_11:         ld      c,data_aa
4044
                rlc     c
4045
                jr      c,rlc_12
4046
                fail_msg 11
4047
rlc_12:         ld      a,c
4048
                cp      a,data_55
4049
                jr      z,rlc_13
4050
                fail_msg 12
4051
rlc_13:         ld      d,data_80
4052
                rlc     d
4053
                jr      c,rlc_14
4054
                fail_msg 13
4055
rlc_14:         ld      a,d
4056
                cp      a,1
4057
                jr      z,rlc_15
4058
                fail_msg 14
4059
rlc_15:         ld      e,data_ff
4060
                rlc     e
4061
                jr      c,rlc_16
4062
                fail_msg 15
4063
rlc_16:         ld      a,e
4064
                cp      a,data_ff
4065
                jr      z,rlc_17
4066
                fail_msg 16
4067
rlc_17:         ld      h,data_55
4068
                rlc     h
4069
                jp      m,rlc_18
4070
                fail_msg 17
4071
rlc_18:         ld      a,h
4072
                cp      a,data_aa
4073
                jr      z,rlc_19
4074
                fail_msg 18
4075
rlc_19:         ld      l,data_80
4076
                rlc     l
4077
                jp      p,rlc_20
4078
                fail_msg 19
4079
rlc_20:         ld      a,l
4080
                cp      a,1
4081
                jr      z,rlc_21
4082
                fail_msg 20
4083
rlc_21:         ld      hl,t_var1
4084
                ld      a,data_55
4085
                ld      (hl),a
4086
                rlc     (hl)
4087
                jp      m,rlc_22
4088
                fail_msg 21
4089
rlc_22:         jp      pe,rlc_23
4090
                fail_msg 22
4091
rlc_23:         jr      nc,rlc_24
4092
                fail_msg 23
4093
rlc_24:         jr      nz,rlc_25
4094
                fail_msg 24
4095
rlc_25:         rlc     (hl)
4096
                jp      p,rlc_26
4097
                fail_msg 25
4098
rlc_26:         jr      c,rlc_27
4099
                fail_msg 26
4100
rlc_27:         ld      a,(hl)
4101
                cp      a,data_55
4102
                jr      z,rlc_28
4103
                fail_msg 27
4104
rlc_28:         ld      a,data_7f
4105
                ld      (hl),a
4106
                rlc     (hl)
4107
                jp      po,rlc_29
4108
                fail_msg 28
4109
rlc_29:         ld      a,(hl)
4110
                cp      a,data_ff-1
4111
                jr      z,rlc_30
4112
                fail_msg 29
4113
rlc_30:         ld      a,0
4114
                ld      (hl),a
4115
                rlc     (hl)
4116
                jr      z,rlc_31
4117
                fail_msg 30
4118
rlc_31:         ld      ix,t_var3
4119
                ld      a,data_55
4120
                ld      (ix-2),a
4121
                rlc     (ix-2)
4122
                jp      m,rlc_32
4123
                fail_msg 31
4124
rlc_32:         jp      pe,rlc_33
4125
                fail_msg 32
4126
rlc_33:         jr      nz,rlc_34
4127
                fail_msg 33
4128
rlc_34:         jr      nc,rlc_35
4129
                fail_msg 34
4130
rlc_35:         rlc     (ix-2)
4131
                jp      p,rlc_36
4132
                fail_msg 35
4133
rlc_36:         jr      c,rlc_37
4134
                fail_msg 36
4135
rlc_37:         ld      a,(ix-2)
4136
                cp      a,data_55
4137
                jr      z,rlc_38
4138
                fail_msg 37
4139
rlc_38:         ld      a,data_7f
4140
                ld      (ix+2),a
4141
                rlc     (ix+2)
4142
                jp      po,rlc_39
4143
                fail_msg 38
4144
rlc_39:         ld      a,(ix+2)
4145
                cp      a,data_ff-1
4146
                jr      z,rlc_40
4147
                fail_msg 39
4148
rlc_40:         ld      a,0
4149
                ld      (ix-1),a
4150
                rlc     (ix-1)
4151
                jr      z,rlc_41
4152
                fail_msg 40
4153
rlc_41:         ld      iy,t_var3
4154
                ld      a,data_55
4155
                ld      (iy+2),a
4156
                rlc     (iy+2)
4157
                jp      m,rlc_42
4158
                fail_msg 41
4159
rlc_42:         jp      pe,rlc_43
4160
                fail_msg 42
4161
rlc_43:         jr      nc,rlc_44
4162
                fail_msg 43
4163
rlc_44:         jr      nz,rlc_45
4164
                fail_msg 44
4165
rlc_45:         rlc     (iy+2)
4166
                jp      p,rlc_46
4167
                fail_msg 45
4168
rlc_46:         jr      c,rlc_47
4169
                fail_msg 46
4170
rlc_47:         ld      a,(iy+2)
4171
                cp      a,data_55
4172
                jr      z,rlc_48
4173
                fail_msg 47
4174
rlc_48:         ld      a,data_7f
4175
                ld      (iy-2),a
4176
                rlc     (iy-2)
4177
                jp      po,rlc_49
4178
                fail_msg 48
4179
rlc_49:         ld      a,(iy-2)
4180
                cp      a,data_ff-1
4181
                jr      z,rlc_50
4182
                fail_msg 49
4183
rlc_50:         ld      a,0
4184
                ld      (iy+1),a
4185
                rlc     (iy+1)
4186
                jr      z,rl_0
4187
                fail_msg 50
4188
rl_0:           nop
4189
                print   "rl"
4190
                scf
4191
                ccf
4192
                ld      a,data_55
4193
                rl      a
4194
                jp      m,rl_1
4195
                fail_msg 0
4196
rl_1:           jp      pe,rl_2
4197
                fail_msg 1
4198
rl_2:           jr      nc,rl_3
4199
                fail_msg 2
4200
rl_3:           jr      nz,rl_4
4201
                fail_msg 3
4202
rl_4:           rl      a
4203
                jp      p,rl_5
4204
                fail_msg 4
4205
rl_5:           jp      po,rl_6
4206
                fail_msg 5
4207
rl_6:           jr      c,rl_7
4208
                fail_msg 6
4209
rl_7:           rl      a
4210
                cp      a,data_aa-1
4211
                jr      z,rl_8
4212
                fail_msg 7
4213
rl_8:           ld      a,0
4214
                rl      a
4215
                jr      z,rl_9
4216
                fail_msg 8
4217
rl_9:           ld      b,data_aa
4218
                ld      c,data_7f
4219
                rl      b
4220
                jr      c,rl_10
4221
                fail_msg 9
4222
rl_10:          rl      c
4223
                jr      nc,rl_11
4224
                fail_msg 10
4225
rl_11:          ld      a,b
4226
                cp      a,data_55-1
4227
                jr      z,rl_12
4228
                fail_msg 11
4229
rl_12:          ld      a,c
4230
                cp      a,data_ff
4231
                jr      z,rl_13
4232
                fail_msg 12
4233
rl_13:          ld      d,data_ff
4234
                ld      e,data_80
4235
                rl      e
4236
                jr      c,rl_14
4237
                fail_msg 13
4238
rl_14:          rl      d
4239
                jr      c,rl_15
4240
                fail_msg 14
4241
rl_15:          ld      a,d
4242
                cp      a,data_ff
4243
                jr      z,rl_16
4244
                fail_msg 15
4245
rl_16:          ld      a,e
4246
                cp      a,0
4247
                jr      z,rl_17
4248
                fail_msg 16
4249
rl_17:          ld      h,data_7f
4250
                ld      l,data_55
4251
                rl      h
4252
                jp      m,rl_18
4253
                fail_msg 17
4254
rl_18:          rl      l
4255
                jp      m,rl_19
4256
                fail_msg 18
4257
rl_19:          ld      a,h
4258
                cp      a,data_ff-1
4259
                jr      z,rl_20
4260
                fail_msg 19
4261
rl_20:          ld      a,l
4262
                cp      a,data_aa
4263
                jr      z,rl_21
4264
                fail_msg 20
4265
rl_21:          ld      hl,t_var5
4266
                ld      a,data_55
4267
                ld      (hl),a
4268
                rl      (hl)
4269
                jp      m,rl_22
4270
                fail_msg 21
4271
rl_22:          jp      pe,rl_23
4272
                fail_msg 22
4273
rl_23:          jr      nc,rl_24
4274
                fail_msg 23
4275
rl_24:          jr      nz,rl_25
4276
                fail_msg 24
4277
rl_25:          rl      (hl)
4278
                jp      p,rl_26
4279
                fail_msg 25
4280
rl_26:          jp      po,rl_27
4281
                fail_msg 26
4282
rl_27:          jr      c,rl_28
4283
                fail_msg 27
4284
rl_28:          ld      a,(hl)
4285
                cp      a,data_55-1
4286
                jr      z,rl_29
4287
                fail_msg 28
4288
rl_29:          ld      a,0
4289
                ld      (hl),a
4290
                rl      (hl)
4291
                jr      z,rl_30
4292
                fail_msg 29
4293
rl_30:          ld      ix,t_var3
4294
                ld      a,data_55
4295
                ld      (ix-2),a
4296
                rl      (ix-2)
4297
                jp      m,rl_31
4298
                fail_msg 30
4299
rl_31:          jp      pe,rl_32
4300
                fail_msg 31
4301
rl_32:          jr      nc,rl_33
4302
                fail_msg 32
4303
rl_33:          jr      nz,rl_34
4304
                fail_msg 33
4305
rl_34:          rl      (ix-2)
4306
                jp      p,rl_35
4307
                fail_msg 34
4308
rl_35:          jp      po,rl_36
4309
                fail_msg 35
4310
rl_36:          jr      c,rl_37
4311
                fail_msg 36
4312
rl_37:          ld      a,(ix-2)
4313
                cp      a,data_55-1
4314
                jr      z,rl_38
4315
                fail_msg 37
4316
rl_38:          ld      a,0
4317
                ld      (ix+2),a
4318
                rl      (ix+2)
4319
                jr      z,rl_39
4320
rl_39:          ld      iy,t_var3
4321
                ld      a,data_55
4322
                ld      (iy-1),a
4323
                rl      (iy-1)
4324
                jp      m,rl_40
4325
                fail_msg 39
4326
rl_40:          jp      pe,rl_41
4327
                fail_msg 40
4328
rl_41:          jr      nc,rl_42
4329
                fail_msg 41
4330
rl_42:          jr      nz,rl_43
4331
                fail_msg 42
4332
rl_43:          rl      (iy-1)
4333
                jp      p,rl_44
4334
                fail_msg 43
4335
rl_44:          jp      po,rl_45
4336
                fail_msg 44
4337
rl_45:          jr      c,rl_46
4338
                fail_msg 45
4339
rl_46:          ld      a,(iy-1)
4340
                cp      a,data_55-1
4341
                jr      z,rl_47
4342
                fail_msg 46
4343
rl_47:          ld      a,0
4344
                ld      (iy+1),a
4345
                rl      (iy+1)
4346
                jr      z,rrc_0
4347
                fail_msg 47
4348
rrc_0:          nop
4349
                print   "rrc"
4350
                ld      a,data_aa
4351
                rrc     a
4352
                jp      p,rrc_1
4353
                fail_msg 0
4354
rrc_1:          jp      pe,rrc_2
4355
                fail_msg 1
4356
rrc_2:          jr      nz,rrc_3
4357
                fail_msg 2
4358
rrc_3:          jr      nc,rrc_4
4359
                fail_msg 3
4360
rrc_4:          rrc     a
4361
                jp      m,rrc_5
4362
                fail_msg 4
4363
rrc_5:          jr      c,rrc_6
4364
                fail_msg 5
4365
rrc_6:          cp      a,data_aa
4366
                jr      z,rrc_7
4367
                fail_msg 6
4368
rrc_7:          ld      a,1
4369
                rrc     a
4370
                jr      c,rrc_8
4371
                fail_msg 7
4372
rrc_8:          cp      a,data_80
4373
                jr      z,rrc_9
4374
                fail_msg 8
4375
rrc_9:          ld      a,data_7f
4376
                rrc     a
4377
                jp      po,rrc_10
4378
                fail_msg 9
4379
rrc_10:         cp      a,#bf
4380
                jr      z,rrc_11
4381
                fail_msg 10
4382
rrc_11:         ld      b,data_80
4383
                ld      c,data_55
4384
                rrc     b
4385
                jr      nc,rrc_12
4386
                fail_msg 11
4387
rrc_12:         rrc     c
4388
                jr      c,rrc_13
4389
                fail_msg 12
4390
rrc_13:         ld      a,b
4391
                cp      a,#40
4392
                jr      z,rrc_14
4393
                fail_msg 13
4394
rrc_14:         ld      a,c
4395
                cp      a,data_aa
4396
                jr      z,rrc_15
4397
                fail_msg 14
4398
rrc_15:         ld      d,data_aa
4399
                ld      e,1
4400
                rrc     d
4401
                jp      p,rrc_16
4402
                fail_msg 15
4403
rrc_16:         rrc     e
4404
                jp      m,rrc_17
4405
                fail_msg 16
4406
rrc_17:         ld      a,d
4407
                cp      a,data_55
4408
                jr      z,rrc_18
4409
                fail_msg 17
4410
rrc_18:         ld      a,e
4411
                cp      a,data_80
4412
                jr      z,rrc_19
4413
                fail_msg 18
4414
rrc_19:         ld      h,data_55
4415
                ld      l,data_ff
4416
                rrc     h
4417
                jr      c,rrc_20
4418
                fail_msg 19
4419
rrc_20:         rrc     l
4420
                jr      c,rrc_21
4421
                fail_msg 20
4422
rrc_21:         ld      a,h
4423
                cp      a,data_aa
4424
                jr      z,rrc_22
4425
                fail_msg 21
4426
rrc_22:         ld      a,l
4427
                cp      a,data_ff
4428
                jr      z,rrc_23
4429
                fail_msg 22
4430
rrc_23:         ld      hl,t_var4
4431
                ld      (hl),data_aa
4432
                rrc      (hl)
4433
                jp      p,rrc_24
4434
                fail_msg 23
4435
rrc_24:         jp      pe,rrc_25
4436
                fail_msg 24
4437
rrc_25:         jr      nz,rrc_26
4438
                fail_msg 25
4439
rrc_26:         jr      nc,rrc_27
4440
                fail_msg 26
4441
rrc_27:         rrc     (hl)
4442
                jp      m,rrc_28
4443
                fail_msg 27
4444
rrc_28:         jr      c,rrc_29
4445
                fail_msg 28
4446
rrc_29:         ld      a,(hl)
4447
                cp      a,data_aa
4448
                jr      z,rrc_30
4449
                fail_msg 29
4450
rrc_30:         ld      (hl),data_7f
4451
                rrc     (hl)
4452
                jp      po,rrc_31
4453
                fail_msg 30
4454
rrc_31:         ld      a,(hl)
4455
                cp      a,#bf
4456
                jr      z,rrc_32
4457
                fail_msg 31
4458
rrc_32:         ld      (hl),0
4459
                rrc     (hl)
4460
                jr      z,rrc_33
4461
                fail_msg 32
4462
rrc_33:         ld      ix,t_var3
4463
                ld      a,data_aa
4464
                ld      (ix+2),a
4465
                rrc     (ix+2)
4466
                jp      p,rrc_34
4467
                fail_msg 33
4468
rrc_34:         jp      pe,rrc_35
4469
                fail_msg 34
4470
rrc_35:         jr      nc,rrc_36
4471
                fail_msg 35
4472
rrc_36:         jr      nz,rrc_37
4473
                fail_msg 36
4474
rrc_37:         rrc     (ix+2)
4475
                jp      m,rrc_38
4476
                fail_msg 37
4477
rrc_38:         jr      c,rrc_39
4478
                fail_msg 38
4479
rrc_39:         ld      a,(ix+2)
4480
                cp      a,data_aa
4481
                jr      z,rrc_40
4482
                fail_msg 39
4483
rrc_40:         ld      a,1
4484
                ld      (ix-2),a
4485
                rrc     (ix-2)
4486
                jp      po,rrc_41
4487
                fail_msg 40
4488
rrc_41:         ld      a,(ix-2)
4489
                cp      a,data_80
4490
                jr      z,rrc_42
4491
                fail_msg 41
4492
rrc_42:         ld      a,0
4493
                ld      (ix+1),a
4494
                rrc     (ix+1)
4495
                jr      z,rrc_43
4496
                fail_msg 42
4497
rrc_43:         ld      iy,t_var3
4498
                ld      a,data_aa
4499
                ld      (iy+2),a
4500
                rrc     (iy+2)
4501
                jp      p,rrc_44
4502
                fail_msg 43
4503
rrc_44:         jp      pe,rrc_45
4504
                fail_msg 44
4505
rrc_45:         jr      nc,rrc_46
4506
                fail_msg 45
4507
rrc_46:         jr      nz,rrc_47
4508
                fail_msg 46
4509
rrc_47:         rrc     (iy+2)
4510
                jp      m,rrc_48
4511
                fail_msg 47
4512
rrc_48:         jr      c,rrc_49
4513
                fail_msg 48
4514
rrc_49:         ld      a,(iy+2)
4515
                cp      a,data_aa
4516
                jr      z,rrc_50
4517
                fail_msg 49
4518
rrc_50:         ld      a,1
4519
                ld      (iy-2),a
4520
                rrc     (iy-2)
4521
                jp      po,rrc_51
4522
                fail_msg 50
4523
rrc_51:         ld      a,(iy-2)
4524
                cp      a,data_80
4525
                jr      z,rrc_52
4526
                fail_msg 51
4527
rrc_52:         ld      a,0
4528
                ld      (iy+1),a
4529
                rrc     (iy+1)
4530
                jr      z,rr_0
4531
                fail_msg 52
4532
rr_0:           nop
4533
                print   "rr"
4534
                scf
4535
                ccf
4536
                ld      a,data_aa
4537
                rr      a
4538
                jp      p,rr_1
4539
                fail_msg 0
4540
rr_1:           jp      pe,rr_2
4541
                fail_msg 1
4542
rr_2:           jr      nc,rr_3
4543
                fail_msg 2
4544
rr_3:           jr      nz,rr_4
4545
                fail_msg 3
4546
rr_4:           rr      a
4547
                jr      c,rr_5
4548
                fail_msg 4
4549
rr_5:           jp      po,rr_6
4550
                fail_msg 5
4551
rr_6:           cp      a,#2a
4552
                jr      z,rr_7
4553
                fail_msg 6
4554
rr_7:           scf
4555
                ld      a,0
4556
                rr      a
4557
                jp      m,rr_8
4558
                fail_msg 7
4559
rr_8:           cp      a,data_80
4560
                jr      z,rr_9
4561
                fail_msg 8
4562
rr_9:           ld      a,0
4563
                rr      a
4564
                jr      z,rr_10
4565
                fail_msg 9
4566
rr_10:          ld      b,data_55
4567
                ld      c,data_aa
4568
                rr      b
4569
                jr      c,rr_11
4570
                fail_msg 10
4571
rr_11:          rr      c
4572
                jr      nc,rr_12
4573
                fail_msg 11
4574
rr_12:          ld      a,b
4575
                cp      a,#2a
4576
                jr      z,rr_13
4577
                fail_msg 12
4578
rr_13:          ld      a,c
4579
                cp      a,#d5
4580
                jr      z,rr_14
4581
                fail_msg 13
4582
rr_14:          ld      d,data_7f
4583
                ld      e,data_80
4584
                rr      d
4585
                jr      c,rr_15
4586
                fail_msg 14
4587
rr_15:          rr      e
4588
                jr      nc,rr_16
4589
                fail_msg 15
4590
rr_16:          ld      a,d
4591
                cp      a,#3f
4592
                jr      z,rr_17
4593
                fail_msg 16
4594
rr_17:          ld      a,e
4595
                cp      a,#c0
4596
                jr      z,rr_18
4597
                fail_msg 17
4598
rr_18:          ld      hl,t_var2
4599
                ld      (hl),data_55
4600
                rr      (hl)
4601
                jp      p,rr_19
4602
                fail_msg 18
4603
rr_19:          jp      po,rr_20
4604
                fail_msg 19
4605
rr_20:          jr      c,rr_21
4606
                fail_msg 20
4607
rr_21:          jr      nz,rr_22
4608
                fail_msg 21
4609
rr_22:          rr      (hl)
4610
                jp      m,rr_23
4611
                fail_msg 22
4612
rr_23:          jp      pe,rr_24
4613
                fail_msg 23
4614
rr_24:          jr      nc,rr_25
4615
                fail_msg 24
4616
rr_25:          ld      a,(hl)
4617
                cp      a,#95
4618
                jr      z,rr_26
4619
                fail_msg 25
4620
rr_26:          ld      (hl),0
4621
                rr      (hl)
4622
                jr      z,rr_27
4623
                fail_msg 26
4624
rr_27:          ld      ix,t_var3
4625
                ld      a,data_55
4626
                ld      (ix-2),a
4627
                rr      (ix-2)
4628
                jp      p,rr_28
4629
                fail_msg 27
4630
rr_28:          jp      po,rr_29
4631
                fail_msg 28
4632
rr_29:          jr      c,rr_30
4633
                fail_msg 29
4634
rr_30:          jr      nz,rr_31
4635
                fail_msg 30
4636
rr_31:          rr      (ix-2)
4637
                jp      m,rr_32
4638
                fail_msg 31
4639
rr_32:          jp      pe,rr_33
4640
                fail_msg 32
4641
rr_33:          jr      nc,rr_34
4642
                fail_msg 33
4643
rr_34:          ld      a,(ix-2)
4644
                cp      a,#95
4645
                jr      z,rr_35
4646
                fail_msg 34
4647
rr_35:          ld      a,0
4648
                ld      (ix+2),a
4649
                rr      (ix+2)
4650
                jr      z,rr_36
4651
                fail_msg 35
4652
rr_36:          ld      iy,t_var3
4653
                ld      a,data_55
4654
                ld      (iy+2),a
4655
                rr      (iy+2)
4656
                jp      p,rr_37
4657
                fail_msg 36
4658
rr_37:          jp      po,rr_38
4659
                fail_msg 37
4660
rr_38:          jr      c,rr_39
4661
                fail_msg 38
4662
rr_39:          jr      nz,rr_40
4663
                fail_msg 39
4664
rr_40:          rr      (iy+2)
4665
                jp      m,rr_41
4666
                fail_msg 40
4667
rr_41:          jp      pe,rr_42
4668
                fail_msg 41
4669
rr_42:          jr      nc,rr_43
4670
                fail_msg 42
4671
rr_43:          ld      a,(iy+2)
4672
                cp      a,#95
4673
                jr      z,rr_44
4674
                fail_msg 43
4675
rr_44:          ld      a,0
4676
                ld      (iy-1),a
4677
                rr      (iy-1)
4678
                jr      z,sla_0
4679
                fail_msg 44
4680
sla_0:          nop
4681
                print   "sla"
4682
                ld      a,data_55
4683
                sla     a
4684
                jp      m,sla_1
4685
                fail_msg 0
4686
sla_1:          jp      pe,sla_2
4687
                fail_msg 1
4688
sla_2:          jr      nc,sla_3
4689
                fail_msg 2
4690
sla_3:          jr      nz,sla_4
4691
                fail_msg 3
4692
sla_4:          sla     a
4693
                jp      p,sla_5
4694
                fail_msg 4
4695
sla_5:          jp      po,sla_6
4696
                fail_msg 5
4697
sla_6:          jr      c,sla_7
4698
                fail_msg 6
4699
sla_7:          cp      a,data_55-1
4700
                jr      z,sla_8
4701
                fail_msg 7
4702
sla_8:          ld      a,0
4703
                sla     a
4704
                jr      z,sla_9
4705
                fail_msg 8
4706
sla_9:          ld      b,data_80
4707
                ld      c,data_7f
4708
                sla     b
4709
                jr      c,sla_10
4710
                fail_msg 9
4711
sla_10:         ld      a,b
4712
                cp      a,0
4713
                jr      z,sla_11
4714
                fail_msg 10
4715
sla_11:         sla     c
4716
                jp      m,sla_12
4717
                fail_msg 11
4718
sla_12:         ld      a,c
4719
                cp      a,data_ff-1
4720
                jr      z,sla_13
4721
                fail_msg 12
4722
sla_13:         ld      d,data_aa
4723
                ld      e,data_55
4724
                sla     d
4725
                jr      c,sla_14
4726
                fail_msg 13
4727
sla_14:         ld      a,d
4728
                cp      a,data_55-1
4729
                jr      z,sla_15
4730
                fail_msg 14
4731
sla_15:         sla     e
4732
                jp      m,sla_16
4733
                fail_msg 15
4734
sla_16:         ld      a,e
4735
                cp      a,data_aa
4736
                jr      z,sla_17
4737
                fail_msg 16
4738
sla_17:         ld      h,#12      ;bjp was >data_1234
4739
                ld      l,#34      ;bjp was >data_1234
4740
                sla     h
4741
                jp      p,sla_18
4742
                fail_msg 17
4743
sla_18:         ld      a,h
4744
                cp      a,#24
4745
                jr      z,sla_19
4746
                fail_msg 18
4747
sla_19:         sla     l
4748
                jp      p,sla_20
4749
                fail_msg 19
4750
sla_20:         ld      a,l
4751
                cp      a,#68
4752
                jr      z,sla_21
4753
                fail_msg 20
4754
sla_21:         ld      hl,t_var3
4755
                ld      (hl),data_55
4756
                sla     (hl)
4757
                jp      m,sla_22
4758
                fail_msg 21
4759
sla_22:         jp      pe,sla_23
4760
                fail_msg 22
4761
sla_23:         jr      nc,sla_24
4762
                fail_msg 23
4763
sla_24:         jr      nz,sla_25
4764
                fail_msg 24
4765
sla_25:         sla     (hl)
4766
                jp      p,sla_26
4767
                fail_msg 25
4768
sla_26:         jp      po,sla_27
4769
                fail_msg 26
4770
sla_27:         jr      c,sla_28
4771
                fail_msg 27
4772
sla_28:         ld      a,(hl)
4773
                cp      a,data_55-1
4774
                jr      z,sla_29
4775
                fail_msg 28
4776
sla_29:         ld      (hl),0
4777
                sla     (hl)
4778
                jr      z,sla_30
4779
                fail_msg 29
4780
sla_30:         ld      ix,t_var3
4781
                ld      a,data_55
4782
                ld      (ix-2),a
4783
                sla     (ix-2)
4784
                jp      m,sla_31
4785
                fail_msg 30
4786
sla_31:         jp      pe,sla_32
4787
                fail_msg 31
4788
sla_32:         jr      nc,sla_33
4789
                fail_msg 32
4790
sla_33:         jr      nz,sla_34
4791
                fail_msg 33
4792
sla_34:         sla     (ix-2)
4793
                jp      p,sla_35
4794
                fail_msg 34
4795
sla_35:         jp      po,sla_36
4796
                fail_msg 35
4797
sla_36:         jr      c,sla_37
4798
                fail_msg 36
4799
sla_37:         ld      a,(ix-2)
4800
                cp      a,data_55-1
4801
                jr      z,sla_38
4802
                fail_msg 37
4803
sla_38:         ld      a,data_80
4804
                ld      (ix+2),a
4805
                sla     (ix+2)
4806
                jr      z,sla_39
4807
                fail_msg 38
4808
sla_39:         jr      c,sla_40
4809
                fail_msg 39
4810
sla_40:         ld      iy,t_var3
4811
                ld      a,data_55
4812
                ld      (iy+2),a
4813
                sla     (iy+2)
4814
                jp      m,sla_41
4815
                fail_msg 40
4816
sla_41:         jp      pe,sla_42
4817
                fail_msg 41
4818
sla_42:         jr      nc,sla_43
4819
                fail_msg 42
4820
sla_43:         jr      nz,sla_44
4821
                fail_msg 43
4822
sla_44:         sla     (iy+2)
4823
                jp      p,sla_45
4824
                fail_msg 44
4825
sla_45:         jp      po,sla_46
4826
                fail_msg 45
4827
sla_46:         jr      c,sla_47
4828
                fail_msg 46
4829
sla_47:         ld      a,(iy+2)
4830
                cp      a,data_55-1
4831
                jr      z,sla_48
4832
                fail_msg 47
4833
sla_48:         ld      a,data_80
4834
                ld      (iy-2),a
4835
                sla     (iy-2)
4836
                jr      z,sla_49
4837
                fail_msg 48
4838
sla_49:         jr      c,sra_0
4839
                fail_msg 49
4840
sra_0:          nop
4841
                print   "sra"
4842
                ld      a,data_55
4843
                sra     a
4844
                jp      p,sra_1
4845
                fail_msg 0
4846
sra_1:          jp      po,sra_2
4847
                fail_msg 1
4848
sra_2:          jr      c,sra_3
4849
                fail_msg 2
4850
sra_3:          jr      nz,sra_4
4851
                fail_msg 3
4852
sra_4:          sra     a
4853
                jp      po,sra_5
4854
                fail_msg 4
4855
sra_5:          jr      nc,sra_6
4856
                fail_msg 5
4857
sra_6:          sra     a
4858
                jp      pe,sra_7
4859
                fail_msg 6
4860
sra_7:          cp      a,#0a                   ;data_aa.and.#0f
4861
                jr      z,sra_8
4862
                fail_msg 7
4863
sra_8:          ld      a,1
4864
                sra     a
4865
                jr      c,sra_9
4866
                fail_msg 8
4867
sra_9:          jr      z,sra_10
4868
                fail_msg 9
4869
sra_10:         ld      a,data_80
4870
                sra     a
4871
                jp      m,sra_11
4872
                fail_msg 10
4873
sra_11:         cp      a,#c0
4874
                jr      z,sra_12
4875
                fail_msg 11
4876
sra_12:         ld      b,data_7f
4877
                ld      c,data_aa
4878
                sra     b
4879
                jr      c,sra_13
4880
                fail_msg 12
4881
sra_13:         ld      a,b
4882
                cp      a,#3f
4883
                jr      z,sra_14
4884
                fail_msg 13
4885
sra_14:         sra     c
4886
                jr      nc,sra_15
4887
                fail_msg 14
4888
sra_15:         ld      a,c
4889
                cp      a,#d5
4890
                jr      z,sra_16
4891
                fail_msg 15
4892
sra_16:         ld      d,data_55
4893
                ld      e,data_ff
4894
                sra     d
4895
                jr      c,sra_17
4896
                fail_msg 16
4897
sra_17:         ld      a,d
4898
                cp      a,#2a
4899
                jr      z,sra_18
4900
                fail_msg 17
4901
sra_18:         sra     e
4902
                jp      m,sra_19
4903
                fail_msg 18
4904
sra_19:         ld      a,e
4905
                cp      a,data_ff
4906
                jr      z,sra_20
4907
                fail_msg 19
4908
sra_20:         ld      h,data_aa
4909
                ld      l,data_7f
4910
                sra     h
4911
                jp      m,sra_21
4912
                fail_msg 20
4913
sra_21:         ld      a,h
4914
                cp      a,#d5
4915
                jr      z,sra_22
4916
                fail_msg 21
4917
sra_22:         sra     l
4918
                jr      c,sra_23
4919
                fail_msg 22
4920
sra_23:         ld      a,l
4921
                cp      a,#3f
4922
                jr      z,sra_24
4923
                fail_msg 23
4924
sra_24:         ld      hl,t_var1
4925
                ld      (hl),data_55
4926
                sra     (hl)
4927
                jp      p,sra_25
4928
                fail_msg 24
4929
sra_25:         jp      po,sra_26
4930
                fail_msg 25
4931
sra_26:         jr      c,sra_27
4932
                fail_msg 26
4933
sra_27:         jr      nz,sra_28
4934
                fail_msg 27
4935
sra_28:         sra     (hl)
4936
                jr      nc,sra_29
4937
                fail_msg 28
4938
sra_29:         sra     (hl)
4939
                jp      pe,sra_30
4940
                fail_msg 29
4941
sra_30:         ld      a,(hl)
4942
                cp      a,#0a                   ;data_aa.and.#0f
4943
                jr      z,sra_31
4944
                fail_msg 30
4945
sra_31:         ld      (hl),data_80
4946
                sra     (hl)
4947
                jp      m,sra_32
4948
                fail_msg 31
4949
sra_32:         ld      a,(hl)
4950
                cp      a,#c0
4951
                jr      z,sra_33
4952
                fail_msg 32
4953
sra_33:         ld      (hl),1
4954
                sra     (hl)
4955
                jr      c,sra_34
4956
                fail_msg 33
4957
sra_34:         jr      z,sra_35
4958
                fail_msg 34
4959
sra_35:         ld      ix,t_var3
4960
                ld      a,data_55
4961
                ld      (ix-2),a
4962
                sra     (ix-2)
4963
                jp      p,sra_36
4964
                fail_msg 35
4965
sra_36:         jp      po,sra_37
4966
                fail_msg 36
4967
sra_37:         jr      c,sra_38
4968
                fail_msg 37
4969
sra_38:         jr      nz,sra_39
4970
                fail_msg 38
4971
sra_39:         sra     (ix-2)
4972
                jr      nc,sra_40
4973
                fail_msg 39
4974
sra_40:         sra     (ix-2)
4975
                jp      pe,sra_41
4976
                fail_msg 40
4977
sra_41:         ld      a,(ix-2)
4978
                cp      a,#0a           ;data_aa.and.#0f
4979
                jr      z,sra_42
4980
                fail_msg 41
4981
sra_42:         ld      a,data_80
4982
                ld      (ix+2),a
4983
                sra     (ix+2)
4984
                jp      m,sra_43
4985
                fail_msg 42
4986
sra_43:         ld      a,(ix+2)
4987
                cp      a,#c0
4988
                jr      z,sra_44
4989
                fail_msg 43
4990
sra_44:         ld      a,1
4991
                ld      (ix-1),a
4992
                sra     (ix-1)
4993
                jr      c,sra_45
4994
                fail_msg 44
4995
sra_45:         jr      z,sra_46
4996
                fail_msg 45
4997
sra_46:         ld      iy,t_var3
4998
                ld      a,data_55
4999
                ld      (iy-2),a
5000
                sra     (iy-2)
5001
                jp      p,sra_47
5002
                fail_msg 46
5003
sra_47:         jp      po,sra_48
5004
                fail_msg 47
5005
sra_48:         jr      c,sra_49
5006
                fail_msg 48
5007
sra_49:         jr      nz,sra_50
5008
                fail_msg 49
5009
sra_50:         sra     (iy-2)
5010
                jr      nc,sra_51
5011
                fail_msg 50
5012
sra_51:         sra     (iy-2)
5013
                jp      pe,sra_52
5014
                fail_msg 51
5015
sra_52:         ld      a,(iy-2)
5016
                cp      a,#0a           ;data_aa.and.#0f
5017
                jr      z,sra_53
5018
                fail_msg 52
5019
sra_53:         ld      a,data_80
5020
                ld      (iy+2),a
5021
                sra     (iy+2)
5022
                jp      m,sra_54
5023
                fail_msg 53
5024
sra_54:         ld      a,(iy+2)
5025
                cp      a,#c0
5026
                jr      z,sra_55
5027
                fail_msg 54
5028
sra_55:         ld      a,1
5029
                ld      (iy-1),a
5030
                sra     (iy-1)
5031
                jr      c,sra_56
5032
                fail_msg 55
5033
sra_56:         jr      z,srl_0
5034
                fail_msg 56
5035
srl_0:          nop
5036
                print   "srl"
5037
                ld      a,data_55
5038
                srl     a
5039
                jr      c,srl_1
5040
                fail_msg 0
5041
srl_1:          jp      po,srl_2
5042
                fail_msg 1
5043
srl_2:          srl     a
5044
                jr      nc,srl_3
5045
                fail_msg 2
5046
srl_3:          srl     a
5047
                jp      pe,srl_4
5048
                fail_msg 3
5049
srl_4:          cp      a,#0a                   ;data_aa.and.#0f
5050
                jr      z,srl_5
5051
                fail_msg 4
5052
srl_5:          ld      a,data_80
5053
                and     a
5054
                jp      m,srl_6
5055
                fail_msg 5
5056
srl_6:          srl     a
5057
                jp      p,srl_7
5058
                fail_msg 6
5059
srl_7:          ld      a,2
5060
                srl     a
5061
                jr      nz,srl_8
5062
                fail_msg 7
5063
srl_8:          srl     a
5064
                jr      z,srl_9
5065
                fail_msg 8
5066
srl_9:          jr      c,srl_10
5067
                fail_msg 9
5068
srl_10:         ld      b,data_aa
5069
                srl     b
5070
                jp      p,srl_11
5071
                fail_msg 10
5072
srl_11:         ld      a,b
5073
                cp      a,data_55
5074
                jr      z,srl_12
5075
                fail_msg 11
5076
srl_12:         ld      c,data_7f
5077
                srl     c
5078
                jr      c,srl_13
5079
                fail_msg 12
5080
srl_13:         ld      a,c
5081
                cp      a,#3f
5082
                jr      z,srl_14
5083
                fail_msg 13
5084
srl_14:         ld      d,data_55
5085
                srl     d
5086
                jr      c,srl_15
5087
                fail_msg 14
5088
srl_15:         ld      a,d
5089
                cp      a,#2a
5090
                jr      z,srl_16
5091
                fail_msg 15
5092
srl_16:         ld      e,data_ff
5093
                srl     e
5094
                jr      c,srl_17
5095
                fail_msg 16
5096
srl_17:         ld      a,e
5097
                cp      a,data_7f
5098
                jr      z,srl_18
5099
                fail_msg 17
5100
srl_18:         ld      h,#12      ;bjp was >data_1234
5101
                srl     h
5102
                jr      nc,srl_19
5103
                fail_msg 18
5104
srl_19:         ld      a,h
5105
                cp      a,9
5106
                jr      z,srl_20
5107
                fail_msg 19
5108
srl_20:         ld      l,#34      ;bjp was >data_1234
5109
                srl     l
5110
                jr      nc,srl_21
5111
                fail_msg 20
5112
srl_21:         ld      a,l
5113
                cp      a,#1a
5114
                jr      z,srl_22
5115
                fail_msg 21
5116
srl_22:         ld      hl,t_var1
5117
                ld      (hl),data_55
5118
                srl     (hl)
5119
                jr      c,srl_23
5120
                fail_msg 22
5121
srl_23:         jp      po,srl_24
5122
                fail_msg 23
5123
srl_24:         srl     (hl)
5124
                jr      nc,srl_25
5125
                fail_msg 24
5126
srl_25:         srl     (hl)
5127
                jp      pe,srl_26
5128
                fail_msg 25
5129
srl_26:         ld      a,(hl)
5130
                cp      a,#0a                   ;data_aa.and.#0f
5131
                jr      z,srl_27
5132
                fail_msg 26
5133
srl_27:         ld      (hl),data_80
5134
                and     (hl)
5135
                jp      z,srl_28
5136
                fail_msg 27
5137
srl_28:         srl     (hl)
5138
                jp      p,srl_29
5139
                fail_msg 28
5140
srl_29:         ld      a,(hl)
5141
                cp      a,#40
5142
                jr      z,srl_30
5143
                fail_msg 29
5144
srl_30:         ld      (hl),2
5145
                srl     (hl)
5146
                jr      nz,srl_31
5147
                fail_msg 30
5148
srl_31:         srl     (hl)
5149
                jr      z,srl_32
5150
                fail_msg 31
5151
srl_32:         jr      c,srl_33
5152
                fail_msg 32
5153
srl_33:         ld      ix,t_var3
5154
                ld      a,data_55
5155
                ld      (ix+2),a
5156
                srl     (ix+2)
5157
                jr      c,srl_34
5158
                fail_msg 33
5159
srl_34:         jp      po,srl_35
5160
                fail_msg 34
5161
srl_35:         srl     (ix+2)
5162
                jr      nc,srl_36
5163
                fail_msg 35
5164
srl_36:         srl     (ix+2)
5165
                jp      pe,srl_37
5166
                fail_msg 36
5167
srl_37:         ld      a,(ix+2)
5168
                cp      a,#0a                   ;data_aa.and.#0f
5169
                jr      z,srl_38
5170
                fail_msg 37
5171
srl_38:         ld      a,data_80
5172
                ld      (ix-2),a
5173
                and     (ix-2)
5174
                jp      m,srl_39
5175
                fail_msg 38
5176
srl_39:         srl     (ix-2)
5177
                jp      p,srl_40
5178
                fail_msg 39
5179
srl_40:         ld      a,(ix-2)
5180
                cp      a,#40
5181
                jr      z,srl_41
5182
                fail_msg 40
5183
srl_41:         ld      a,2
5184
                ld      (ix+1),a
5185
                srl     (ix+1)
5186
                jr      nz,srl_42
5187
                fail_msg 41
5188
srl_42:         srl     (ix+1)
5189
                jr      z,srl_43
5190
                fail_msg 42
5191
srl_43:         jr      c,srl_44
5192
                fail_msg 43
5193
srl_44:         ld      iy,t_var3
5194
                ld      a,data_55
5195
                ld      (iy+2),a
5196
                srl     (iy+2)
5197
                jr      c,srl_45
5198
                fail_msg 44
5199
srl_45:         jp      po,srl_46
5200
                fail_msg 45
5201
srl_46:         srl     (iy+2)
5202
                jr      nc,srl_47
5203
                fail_msg 46
5204
srl_47:         srl     (iy+2)
5205
                jp      pe,srl_48
5206
                fail_msg 47
5207
srl_48:         ld      a,(iy+2)
5208
                cp      a,#0a                   ;data_aa.and.#0f
5209
                jr      z,srl_49
5210
                fail_msg 48
5211
srl_49:         ld      a,data_80
5212
                ld      (iy-2),a
5213
                and     (iy-2)
5214
                jp      m,srl_50
5215
                fail_msg 49
5216
srl_50:         srl     (iy-2)
5217
                jp      p,srl_51
5218
                fail_msg 50
5219
srl_51:         ld      a,(iy-2)
5220
                cp      a,#40
5221
                jr      z,srl_52
5222
                fail_msg 51
5223
srl_52:         ld      a,2
5224
                ld      (iy+1),a
5225
                srl     (iy+1)
5226
                jr      nz,srl_53
5227
                fail_msg 52
5228
srl_53:         srl     (iy+1)
5229
                jr      z,srl_54
5230
                fail_msg 53
5231
srl_54:         jr      c,rld_0
5232
                fail_msg 54
5233
rld_0:          nop
5234
                print   "rld/rrd"
5235
                ld      hl,t_var5
5236
                ld      a,data_55
5237
                ld      (hl),data_aa
5238
                rld
5239
                jp      p,rld_1
5240
                fail_msg 0
5241
rld_1:          cp      a,data_55+5
5242
                jr      z,rld_2
5243
                fail_msg 1
5244
rld_2:          ld      a,(hl)
5245
                cp      a,data_aa-5
5246
                jr      z,rld_3
5247
                fail_msg 2
5248
rld_3:          ld      (hl),data_7f
5249
                ld      a,data_80
5250
                rld
5251
                jp      m,rld_4
5252
                fail_msg 3
5253
rld_4:          jp      pe,rld_5
5254
                fail_msg 4
5255
rld_5:          rld
5256
                jp      po,rld_6
5257
                fail_msg 5
5258
rld_6:          cp      a,data_80+15
5259
                jr      z,rld_7
5260
                fail_msg 6
5261
rld_7:          ld      a,(hl)
5262
                cp      a,7
5263
                jr      z,rld_8
5264
                fail_msg 7
5265
rld_8:          ld      a,#05                   ;data_55.and.#0f
5266
                ld      (hl),#0a                        ;data_aa.and.#0f
5267
                rld
5268
                jr      z,rld_9
5269
                fail_msg 8
5270
rld_9:          ld      a,(hl)
5271
                cp      a,#a5
5272
                jr      z,rrd_0
5273
                fail_msg 9
5274
rrd_0:          ld      hl,t_var3
5275
                ld      a,data_55
5276
                ld      (hl),data_aa
5277
                rrd
5278
                jp      p,rrd_1
5279
                fail_msg 0
5280
rrd_1:          jp      pe,rrd_2
5281
                fail_msg 1
5282
rrd_2:          jr      nz,rrd_3
5283
                fail_msg 2
5284
rrd_3:          cp      a,data_55+5
5285
                jr      z,rrd_4
5286
                fail_msg 3
5287
rrd_4:          ld      a,(hl)
5288
                cp      a,data_55+5
5289
                jr      z,rrd_5
5290
                fail_msg 4
5291
rrd_5:          ld      (hl),data_7f
5292
                ld      a,data_80
5293
                rrd
5294
                jp      m,rrd_6
5295
                fail_msg 5
5296
rrd_6:          jp      po,rrd_7
5297
                fail_msg 6
5298
rrd_7:          cp      a,data_80+15
5299
                jr      z,rrd_8
5300
                fail_msg 7
5301
rrd_8:          ld      a,(hl)
5302
                cp      a,7
5303
                jr      z,rrd_9
5304
                fail_msg 8
5305
rrd_9:          ld      a,8
5306
                ld      (hl),0
5307
                rrd
5308
                jr      z,rrd_10
5309
                fail_msg 9
5310
rrd_10:         ld      a,(hl)
5311
                cp      a,data_80
5312
                jr      z,bit_0
5313
                fail_msg 10
5314
bit_0:          nop
5315
                print   "bit"
5316
                ld      a,data_ff
5317
                bit     0,a
5318
                jr      nz,bit_1
5319
                fail_msg 0
5320
bit_1:          bit     1,a
5321
                jr      nz,bit_2
5322
                fail_msg 1
5323
bit_2:          bit     2,a
5324
                jr      nz,bit_3
5325
                fail_msg 2
5326
bit_3:          bit     3,a
5327
                jr      nz,bit_4
5328
                fail_msg 3
5329
bit_4:          bit     4,a
5330
                jr      nz,bit_5
5331
                fail_msg 4
5332
bit_5:          bit     5,a
5333
                jr      nz,bit_6
5334
                fail_msg 5
5335
bit_6:          bit     6,a
5336
                jr      nz,bit_7
5337
                fail_msg 6
5338
bit_7:          bit     7,a
5339
                jr      nz,bit_8
5340
                fail_msg 7
5341
bit_8:          ld      a,0
5342
                bit     0,a
5343
                jr      z,bit_9
5344
                fail_msg 8
5345
bit_9:          bit     1,a
5346
                jr      z,bit_10
5347
                fail_msg 9
5348
bit_10:         bit     2,a
5349
                jr      z,bit_11
5350
                fail_msg 10
5351
bit_11:         bit     3,a
5352
                jr      z,bit_12
5353
                fail_msg 11
5354
bit_12:         bit     4,a
5355
                jr      z,bit_13
5356
                fail_msg 12
5357
bit_13:         bit     5,a
5358
                jr      z,bit_14
5359
                fail_msg 13
5360
bit_14:         bit     6,a
5361
                jr      z,bit_15
5362
                fail_msg 14
5363
bit_15:         bit     7,a
5364
                jr      z,bit_16
5365
                fail_msg 15
5366
bit_16:         ld      b,data_80
5367
                bit     2,b
5368
                jr      z,bit_17
5369
                fail_msg 16
5370
bit_17:         bit     7,b
5371
                jr      nz,bit_18
5372
                fail_msg 17
5373
bit_18:         ld      c,data_55
5374
                bit     7,c
5375
                jr      z,bit_19
5376
                fail_msg 18
5377
bit_19:         bit     0,c
5378
                jr      nz,bit_20
5379
                fail_msg 19
5380
bit_20:         ld      d,data_aa
5381
                bit     7,d
5382
                jr      nz,bit_21
5383
                fail_msg 20
5384
bit_21:         bit     4,d
5385
                jr      z,bit_22
5386
                fail_msg 21
5387
bit_22:         ld      e,data_7f
5388
                bit     7,e
5389
                jr      z,bit_23
5390
                fail_msg 22
5391
bit_23:         bit     3,e
5392
                jr      nz,bit_24
5393
                fail_msg 23
5394
bit_24:         ld      h,#12      ;bjp was >data_1234
5395
                bit     4,h
5396
                jr      nz,bit_25
5397
                fail_msg 24
5398
bit_25:         bit     2,h
5399
                jr      z,bit_26
5400
                fail_msg 25
5401
bit_26:         ld      l,#34      ;bjp was >data_1234
5402
                bit     3,l
5403
                jr      z,bit_27
5404
                fail_msg 26
5405
bit_27:         bit     2,l
5406
                jr      nz,bit_28
5407
                fail_msg 27
5408
bit_28:         ld      hl,t_var4
5409
                ld      (hl),data_55
5410
                bit     0,(hl)
5411
                jr      nz,bit_29
5412
                fail_msg 28
5413
bit_29:         bit     1,(hl)
5414
                jr      z,bit_30
5415
                fail_msg 29
5416
bit_30:         bit     2,(hl)
5417
                jr      nz,bit_31
5418
                fail_msg 30
5419
bit_31:         bit     3,(hl)
5420
                jr      z,bit_32
5421
                fail_msg 31
5422
bit_32:         bit     4,(hl)
5423
                jr      nz,bit_33
5424
                fail_msg 32
5425
bit_33:         bit     5,(hl)
5426
                jr      z,bit_34
5427
                fail_msg 33
5428
bit_34:         bit     6,(hl)
5429
                jr      nz,bit_35
5430
                fail_msg 34
5431
bit_35:         bit     7,(hl)
5432
                jr      z,bit_36
5433
                fail_msg 35
5434
bit_36:         ld      ix,t_var3
5435
                ld      a,data_aa
5436
                ld      (ix-2),a
5437
                bit     0,(ix-2)
5438
                jr      z,bit_37
5439
                fail_msg 36
5440
bit_37:         bit     1,(ix-2)
5441
                jr      nz,bit_38
5442
                fail_msg 37
5443
bit_38:         bit     2,(ix-2)
5444
                jr      z,bit_39
5445
                fail_msg 38
5446
bit_39:         bit     3,(ix-2)
5447
                jr      nz,bit_40
5448
                fail_msg 39
5449
bit_40:         bit     4,(ix-2)
5450
                jr      z,bit_41
5451
                fail_msg 40
5452
bit_41:         bit     5,(ix-2)
5453
                jr      nz,bit_42
5454
                fail_msg 41
5455
bit_42:         bit     6,(ix-2)
5456
                jr      z,bit_43
5457
                fail_msg 42
5458
bit_43:         bit     7,(ix-2)
5459
                jr      nz,bit_44
5460
                fail_msg 43
5461
bit_44:         ld      iy,t_var3
5462
                ld      a,data_55
5463
                ld      (iy+2),a
5464
                bit     0,(iy+2)
5465
                jr      nz,bit_45
5466
                fail_msg 44
5467
bit_45:         bit     1,(iy+2)
5468
                jr      z,bit_46
5469
                fail_msg 45
5470
bit_46:         bit     2,(iy+2)
5471
                jr      nz,bit_47
5472
                fail_msg 46
5473
bit_47:         bit     3,(iy+2)
5474
                jr      z,bit_48
5475
                fail_msg 47
5476
bit_48:         bit     4,(iy+2)
5477
                jr      nz,bit_49
5478
                fail_msg 48
5479
bit_49:         bit     5,(iy+2)
5480
                jr      z,bit_50
5481
                fail_msg 49
5482
bit_50:         bit     6,(iy+2)
5483
                jr      nz,bit_51
5484
                fail_msg 50
5485
bit_51:         bit     7,(iy+2)
5486
                jr      z,set_0
5487
                fail_msg 51
5488
set_0:          nop
5489
                print   "set"
5490
                ld      a,0
5491
                set     0,a
5492
                set     2,a
5493
                set     4,a
5494
                set     6,a
5495
                cp      a,data_55
5496
                jr      z,set_1
5497
                fail_msg 0
5498
set_1:          set     1,a
5499
                set     3,a
5500
                set     5,a
5501
                set     7,a
5502
                cp      a,data_ff
5503
                jr      z,set_2
5504
                fail_msg 1
5505
set_2:          ld      b,0
5506
                set     1,b
5507
                set     3,b
5508
                ld      a,b
5509
                cp      a,#0a                   ;data_aa.and.#0f
5510
                jr      z,set_3
5511
                fail_msg 2
5512
set_3:          ld      c,0
5513
                set     1,c
5514
                set     4,c
5515
                ld      a,c
5516
                cp      a,#12      ;bjp was >data_1234
5517
                jr      z,set_4
5518
                fail_msg 3
5519
set_4:          ld      d,0
5520
                set     2,d
5521
                set     4,d
5522
                set     5,d
5523
                ld      a,d
5524
                cp      a,#34      ;bjp was >data_1234
5525
                jr      z,set_5
5526
                fail_msg 4
5527
set_5:          ld      e,0
5528
                set     7,e
5529
                ld      a,e
5530
                cp      a,data_80
5531
                jr      z,set_6
5532
                fail_msg 5
5533
set_6:          ld      h,0
5534
                set     0,h
5535
                set     2,h
5536
                set     4,h
5537
                set     6,h
5538
                ld      a,h
5539
                cp      a,data_55
5540
                jr      z,set_7
5541
                fail_msg 6
5542
set_7:          ld      l,0
5543
                set     1,l
5544
                set     3,l
5545
                set     5,l
5546
                set     7,l
5547
                ld      a,l
5548
                cp      a,data_aa
5549
                jr      z,set_8
5550
                fail_msg 7
5551
set_8:          ld      hl,t_var5
5552
                ld      (hl),0
5553
                set     0,(hl)
5554
                set     2,(hl)
5555
                set     4,(hl)
5556
                set     6,(hl)
5557
                ld      a,(hl)
5558
                cp      a,data_55
5559
                jr      z,set_9
5560
                fail_msg 8
5561
set_9:          ld      (hl),0
5562
                set     1,(hl)
5563
                set     3,(hl)
5564
                set     5,(hl)
5565
                set     7,(hl)
5566
                ld      a,(hl)
5567
                cp      a,data_aa
5568
                jr      z,set_10
5569
                fail_msg 9
5570
set_10:         ld      ix,t_var3
5571
                ld      a,0
5572
                ld      (ix-2),a
5573
                ld      (ix+2),a
5574
                set     0,(ix-2)
5575
                set     2,(ix-2)
5576
                set     4,(ix-2)
5577
                set     6,(ix-2)
5578
                ld      a,(ix-2)
5579
                cp      a,data_55
5580
                jr      z,set_11
5581
                fail_msg 10
5582
set_11:         set     1,(ix+2)
5583
                set     3,(ix+2)
5584
                set     5,(ix+2)
5585
                set     7,(ix+2)
5586
                ld      a,(ix+2)
5587
                cp      a,data_aa
5588
                jr      z,set_12
5589
                fail_msg 11
5590
set_12:         ld      iy,t_var3
5591
                ld      a,0
5592
                ld      (iy-1),a
5593
                ld      (iy+1),a
5594
                set     0,(iy-1)
5595
                set     2,(iy-1)
5596
                set     4,(iy-1)
5597
                set     6,(iy-1)
5598
                ld      a,(iy-1)
5599
                cp      a,data_55
5600
                jr      z,set_13
5601
                fail_msg 12
5602
set_13:         set     1,(iy+1)
5603
                set     3,(iy+1)
5604
                set     5,(iy+1)
5605
                set     7,(iy+1)
5606
                ld      a,(iy+1)
5607
                cp      a,data_aa
5608
                jr      z,res_0
5609
                fail_msg 13
5610
res_0:          nop
5611
                print   "res"
5612
                ld      a,data_ff
5613
                res     7,a
5614
                cp      a,data_7f
5615
                jr      z,res_1
5616
                fail_msg 0
5617
res_1:          res     5,a
5618
                res     3,a
5619
                res     1,a
5620
                cp      a,data_55
5621
                jr      z,res_2
5622
                fail_msg 1
5623
res_2:          ld      a,data_ff
5624
                res     0,a
5625
                res     2,a
5626
                res     4,a
5627
                res     6,a
5628
                cp      a,data_aa
5629
                jr      z,res_3
5630
                fail_msg 2
5631
res_3:          ld      b,data_ff
5632
                res     7,b
5633
                ld      a,b
5634
                cp      a,data_7f
5635
                jr      z,res_4
5636
                fail_msg 3
5637
res_4:          ld      c,data_ff
5638
                res     0,c
5639
                res     1,c
5640
                res     2,c
5641
                res     3,c
5642
                res     4,c
5643
                res     5,c
5644
                res     6,c
5645
                ld      a,c
5646
                cp      a,data_80
5647
                jr      z,res_5
5648
                fail_msg 4
5649
res_5:          ld      d,data_ff
5650
                res     0,d
5651
                res     2,d
5652
                res     4,d
5653
                res     6,d
5654
                ld      a,d
5655
                cp      a,data_aa
5656
                jr      z,res_6
5657
                fail_msg 5
5658
res_6:          ld      e,data_ff
5659
                res     1,e
5660
                res     3,e
5661
                res     5,e
5662
                res     7,e
5663
                ld      a,e
5664
                cp      a,data_55
5665
                jr      z,res_7
5666
                fail_msg 6
5667
res_7:          ld      h,data_ff
5668
                res     0,h
5669
                res     2,h
5670
                res     3,h
5671
                res     5,h
5672
                res     6,h
5673
                res     7,h
5674
                ld      a,h
5675
                cp      a,#12      ;bjp was >data_1234
5676
                jr      z,res_8
5677
                fail_msg 7
5678
res_8:          ld      l,data_ff
5679
                res     0,l
5680
                res     1,l
5681
                res     3,l
5682
                res     6,l
5683
                res     7,l
5684
                ld      a,l
5685
                cp      a,#34      ;bjp was >data_1234
5686
                jr      z,res_9
5687
                fail_msg 8
5688
res_9:          ld      hl,t_var3
5689
                ld      (hl),data_ff
5690
                res     0,(hl)
5691
                res     2,(hl)
5692
                res     4,(hl)
5693
                res     6,(hl)
5694
                ld      a,(hl)
5695
                cp      a,data_aa
5696
                jr      z,res_10
5697
                fail_msg 9
5698
res_10:         res     1,(hl)
5699
                res     3,(hl)
5700
                res     5,(hl)
5701
                res     7,(hl)
5702
                ld      a,(hl)
5703
                cp      a,0
5704
                jr      z,res_11
5705
                fail_msg 10
5706
res_11:         ld      ix,t_var3
5707
                ld      a,data_ff
5708
                ld      (ix-2),a
5709
                ld      (ix+2),a
5710
                res     1,(ix-2)
5711
                res     3,(ix-2)
5712
                res     5,(ix-2)
5713
                res     7,(ix-2)
5714
                ld      a,(ix-2)
5715
                cp      a,data_55
5716
                jr      z,res_12
5717
                fail_msg 11
5718
res_12:         res     0,(ix+2)
5719
                res     2,(ix+2)
5720
                res     4,(ix+2)
5721
                res     6,(ix+2)
5722
                ld      a,(ix+2)
5723
                cp      a,data_aa
5724
                jr      z,res_13
5725
                fail_msg 12
5726
res_13:         ld      iy,t_var3
5727
                ld      a,data_ff
5728
                ld      (iy-1),a
5729
                ld      (iy+1),a
5730
                res     1,(iy-1)
5731
                res     3,(iy-1)
5732
                res     5,(iy-1)
5733
                res     7,(iy-1)
5734
                ld      a,(iy-1)
5735
                cp      a,data_55
5736
                jr      z,res_14
5737
                fail_msg 13
5738
res_14:         res     0,(iy+1)
5739
                res     2,(iy+1)
5740
                res     4,(iy+1)
5741
                res     6,(iy+1)
5742
                ld      a,(iy+1)
5743
                cp      a,data_aa
5744
                jr      z,jp_0
5745
                fail_msg 14
5746
jp_0:           nop
5747
                print   "jp"
5748
                jp      jp_1
5749
                nop
5750
                nop
5751
                fail_msg 0
5752
jp_1:           ld      a,0
5753
                and     a
5754
                jp      z,jp_2
5755
                fail_msg 1
5756
jp_2:           jp      nc,jp_3
5757
                fail_msg 2
5758
jp_3:           ld      b,1
5759
                sub     a,b
5760
                jp      nz,jp_4
5761
                fail_msg 3
5762
jp_4:           jp      c,jp_5
5763
                fail_msg 4
5764
jp_5:           jp      jp_7
5765
                fail_msg 5
5766
jp_6:           jp      jr_0
5767
                fail_msg 6
5768
jp_7:           jp      jp_6
5769
                fail_msg 7
5770
jr_0:           jr      jr_2
5771
                fail_msg 0
5772
jr_1:           jr      jr_3
5773
                fail_msg 1
5774
jr_2:           jr      jr_1
5775
                fail_msg 2
5776
jr_3:           ld      hl,jp_9
5777
                jp      (hl)
5778
                fail_msg 3
5779
jp_8:           ld      ix,jp_10
5780
                jp      (ix)
5781
                fail_msg 8
5782
jp_9:           jp      jp_8
5783
                fail_msg 9
5784
jp_10:          ld      iy,djnz_0
5785
                jp      (iy)
5786
                fail_msg 10
5787
djnz_0:         ld      b,5
5788
                ld      a,0
5789
djnz_1:         inc     a
5790
                djnz    djnz_1
5791
                cp      a,5
5792
                jr      z,call_0
5793
                fail_msg 1
5794
call_0:         nop
5795
                print   "call"
5796
                ld      a,0
5797
                call    sub1
5798
                cp      a,data_7f
5799
                jr      z,call_1
5800
                fail_msg 0
5801
call_1:         ld      a,0
5802
                and     a
5803
                call    z,sub2
5804
                cp      a,data_55
5805
                jr      z,call_2
5806
                fail_msg 1
5807
call_2:         ld      a,data_aa
5808
                and     a
5809
                call    nz,sub3
5810
                cp      a,data_aa+1
5811
                jr      z,call_3
5812
                fail_msg 2
5813
call_3:         ld      a,0
5814
                cp      a,0
5815
                call    nc,sub4
5816
                cp      a,data_ff
5817
                jr      z,call_4
5818
                fail_msg 3
5819
call_4:         ld      a,0
5820
                sub     a,1
5821
                call    c,sub5
5822
                cp      a,data_ff-1
5823
                jr      z,call_5
5824
                fail_msg 4
5825
call_5:         ld      a,data_7f
5826
                sla     a
5827
                call    po,sub6
5828
                cp      a,data_7f
5829
                jr      z,call_6
5830
                fail_msg 5
5831
call_6:         ld      a,data_aa
5832
                srl     a
5833
                call    pe,sub7
5834
                cp      a,data_aa
5835
                jr      z,call_7
5836
                fail_msg 6
5837
call_7:         ld      a,data_80
5838
                sra     a
5839
                call    m,sub8
5840
                cp      a,data_80
5841
                jr      z,call_8
5842
                fail_msg 7
5843
call_8:         ld      a,data_7f
5844
                sra     a
5845
                call    p,sub9
5846
                cp      a,data_7f
5847
                jr      z,rst_0
5848
                fail_msg 8
5849
rst_0:          ld      a, 1
5850
                ld      (rst_state),a
5851
                print   "rst"
5852
                rst     #00
5853
                cp      a,1
5854
                jr      z,rst_1
5855
                fail_msg 0
5856
rst_1:          rst     #08
5857
                cp      a,2
5858
                jr      z,rst_2
5859
                fail_msg 1
5860
rst_2:          rst     #10
5861
                cp      a,3
5862
                jr      z,rst_3
5863
                fail_msg 2
5864
rst_3:          rst     #18
5865
                cp      a,4
5866
                jr      z,rst_4
5867
                fail_msg 3
5868
rst_4:          rst     #20
5869
                cp      a,5
5870
                jr      z,rst_5
5871
                fail_msg 4
5872
rst_5:          rst     #28
5873
                cp      a,6
5874
                jr      z,rst_6
5875
                fail_msg 5
5876
rst_6:          rst     #30
5877
                cp      a,7
5878
                jr      z,rst_7
5879
                fail_msg 6
5880
rst_7:          rst     #38
5881
                cp      a,8
5882
                jp      z,ldi_ops
5883
                fail_msg 7
5884
 
5885
        ;; skip the in instructions, as they need to be reworked
5886
        ;; for TV80 environment. (gth)
5887
in_0:           in      a,(in_port)
5888
                cp      a,data_7f
5889
                jr      z,in_1
5890
                fail_msg 0
5891
in_1:           ld      c,in_port
5892
                in      a,(c)
5893
                jr      nz,in_2
5894
                fail_msg 1
5895
in_2:           jp      p,in_3
5896
                fail_msg 2
5897
in_3:           jp      pe,in_4
5898
                fail_msg 3
5899
in_4:           cp      a,data_55
5900
                jr      z,in_5
5901
                fail_msg 4
5902
in_5:           in      a,(c)
5903
                jp      m,in_6
5904
                fail_msg 5
5905
in_6:           jp      po,in_7
5906
                fail_msg 6
5907
in_7:           jr      nz,in_8
5908
                fail_msg 7
5909
in_8:           cp      a,data_80
5910
                jr      z,in_9
5911
                fail_msg 8
5912
in_9:           in      a,(c)
5913
                jr      z,in_10
5914
                fail_msg 9
5915
in_10:          in      b,(c)
5916
                jp      m,in_11
5917
                fail_msg 10
5918
in_11:          ld      a,b
5919
                cp      a,data_ff
5920
                jr      z,in_12
5921
                fail_msg 11
5922
in_12:          in      d,(c)
5923
                jp      pe,in_13
5924
                fail_msg 12
5925
in_13:          ld      a,d
5926
                cp      a,data_aa
5927
                jr      z,in_14
5928
                fail_msg 13
5929
in_14:          in      e,(c)
5930
                jp      p,in_15
5931
                fail_msg 14
5932
in_15:          ld      a,e
5933
                cp      a,data_7f
5934
                jr      z,in_16
5935
                fail_msg 15
5936
in_16:          in      h,(c)
5937
                jp      pe,in_17
5938
                fail_msg 16
5939
in_17:          ld      a,h
5940
                cp      a,data_55
5941
                jr      z,in_18
5942
                fail_msg 17
5943
in_18:          in      l,(c)
5944
                jp      m,in_19
5945
                fail_msg 18
5946
in_19:          ld      a,l
5947
                cp      a,data_80
5948
                jr      z,in_20
5949
                fail_msg 19
5950
in_20:          in      c,(c)
5951
                jr      z,in_21
5952
                fail_msg 20
5953
in_21:          ld      c,in_port
5954
                ld      b,2
5955
                ld      hl,t_var1
5956
                ini
5957
                jr      nz,in_22
5958
                fail_msg 21
5959
in_22:          ini
5960
                jr      z,in_23
5961
                fail_msg 22
5962
in_23:          ld      hl,t_var1
5963
                ld      a,(hl)
5964
                cp      a,data_ff
5965
                jr      z,in_24
5966
                fail_msg 23
5967
in_24:          inc     hl
5968
                ld      a,(hl)
5969
                cp      a,data_aa
5970
                jr      z,in_25
5971
                fail_msg 24
5972
in_25:          ld      b,5
5973
                ld      c,in_port
5974
                ld      hl,t_var1
5975
                inir
5976
                jr      z,in_26
5977
                fail_msg 25
5978
in_26:          ld      hl,t_var1
5979
                ld      a,(hl)
5980
                cp      a,data_7f
5981
                jr      z,in_27
5982
                fail_msg 26
5983
in_27:          inc     hl
5984
                ld      a,(hl)
5985
                cp      a,data_55
5986
                jr      z,in_28
5987
                fail_msg 27
5988
in_28:          inc     hl
5989
                ld      a,(hl)
5990
                cp      a,data_80
5991
                jr      z,in_29
5992
                fail_msg 28
5993
in_29:          inc     hl
5994
                ld      a,(hl)
5995
                cp      a,0
5996
                jr      z,in_30
5997
                fail_msg 29
5998
in_30:          inc     hl
5999
                ld      a,(hl)
6000
                cp      a,data_ff
6001
                jr      z,in_31
6002
                fail_msg 30
6003
in_31:          ld      b,2
6004
                ld      c,in_port
6005
                ld      hl,t_var5
6006
                ind
6007
                jr      nz,in_32
6008
                fail_msg 31
6009
in_32:          ind
6010
                jr      z,in_33
6011
                fail_msg 32
6012
in_33:          ld      hl,t_var5
6013
                ld      a,(hl)
6014
                cp      a,data_aa
6015
                jr      z,in_34
6016
                fail_msg 33
6017
in_34:          dec     hl
6018
                ld      a,(hl)
6019
                cp      a,data_7f
6020
                jr      z,in_35
6021
                fail_msg 34
6022
in_35:          ld      b,5
6023
                ld      c,in_port
6024
                ld      hl,t_var5
6025
                indr
6026
                jr      z,in_36
6027
                fail_msg 35
6028
in_36:          ld      hl,t_var5
6029
                ld      a,(hl)
6030
                cp      a,data_55
6031
                jr      z,in_37
6032
                fail_msg 36
6033
in_37:          dec     hl
6034
                ld      a,(hl)
6035
                cp      a,data_80
6036
                jr      z,in_38
6037
                fail_msg 37
6038
in_38:          dec     hl
6039
                ld      a,(hl)
6040
                cp      a,0
6041
                jr      z,in_39
6042
                fail_msg 38
6043
in_39:          dec     hl
6044
                ld      a,(hl)
6045
                cp      a,data_ff
6046
                jr      z,in_40
6047
                fail_msg 39
6048
in_40:          dec     hl
6049
                ld      a,(hl)
6050
                cp      a,data_aa
6051
                jr      z,ldi_0
6052
                fail_msg 40
6053
 
6054
ldi_ops:        nop
6055
                print   "ldi"
6056
ldi_0:          ld      hl,t_var1
6057
                ld      a,#12      ;bjp was >data_1234
6058
                ld      (hl),a
6059
                inc     hl
6060
                ld      a,#34      ;bjp was >data_1234
6061
                ld      (hl),a
6062
                dec     hl
6063
                ld      de,t_var3
6064
                ld      bc,2
6065
                ldi
6066
                jp      pe,ldi_1
6067
                fail_msg 0
6068
ldi_1:          ldi
6069
                jp      po,ldi_2
6070
                fail_msg 1
6071
ldi_2:          ld      hl,t_var3
6072
                ld      a,(hl)
6073
                cp      a,#12      ;bjp was >data_1234
6074
                jr      z,ldi_3
6075
                fail_msg 2
6076
ldi_3:          inc     hl
6077
                ld      a,(hl)
6078
                cp      a,#34      ;bjp was >data_1234
6079
                jr      z,ldir_0
6080
                fail_msg 3
6081
ldir_0:         ld      hl,var1
6082
                ld      de,t_var1
6083
                ld      bc,5
6084
                ldir
6085
                jp      po,ldir_1
6086
                fail_msg 0
6087
ldir_1:         ld      hl,t_var1
6088
                ld      a,(hl)
6089
                cp      a,data_ff
6090
                jr      z,ldir_2
6091
                fail_msg 1
6092
ldir_2:         inc     hl
6093
                ld      a,(hl)
6094
                cp      a,data_55
6095
                jr      z,ldir_3
6096
                fail_msg 2
6097
ldir_3:         inc     hl
6098
                ld      a,(hl)
6099
                cp      a,data_80
6100
                jr      z,ldir_4
6101
                fail_msg 3
6102
ldir_4:         inc     hl
6103
                ld      a,(hl)
6104
                cp      a,data_aa
6105
                jr      z,ldir_5
6106
                fail_msg 4
6107
ldir_5:         inc     hl
6108
                ld      a,(hl)
6109
                cp      a,data_7f
6110
                jr      z,ldd_0
6111
                fail_msg 5
6112
ldd_0:          ld      hl,t_var5
6113
                ld      a,#12      ;bjp was >data_1234
6114
                ld      (hl),a
6115
                dec     hl
6116
                ld      a,#34      ;bjp was >data_1234
6117
                ld      (hl),a
6118
                inc     hl
6119
                ld      bc,2
6120
                ld      de,t_var3
6121
                ldd
6122
                jp      pe,ldd_1
6123
                fail_msg 0
6124
ldd_1:          ldd
6125
                jp      po,ldd_2
6126
                fail_msg 1
6127
ldd_2:          ld      hl,t_var3
6128
                ld      a,(hl)
6129
                cp      a,#12      ;bjp was >data_1234
6130
                jr      z,ldd_3
6131
                fail_msg 2
6132
ldd_3:          dec     hl
6133
                ld      a,(hl)
6134
                cp      a,#34      ;bjp was >data_1234
6135
                jr      z,lddr_0
6136
                fail_msg 3
6137
lddr_0:         ld      bc,5
6138
                ld      hl,var5
6139
                ld      de,t_var5
6140
                lddr
6141
                jp      po,lddr_1
6142
                fail_msg 0
6143
lddr_1:         ld      hl,t_var1
6144
                ld      a,(hl)
6145
                cp      a,data_ff
6146
                jr      z,lddr_2
6147
                fail_msg 1
6148
lddr_2:         inc     hl
6149
                ld      a,(hl)
6150
                cp      a,data_55
6151
                jr      z,lddr_3
6152
                fail_msg 2
6153
lddr_3:         inc     hl
6154
                ld      a,(hl)
6155
                cp      a,data_80
6156
                jr      z,lddr_4
6157
                fail_msg 3
6158
lddr_4:         inc     hl
6159
                ld      a,(hl)
6160
                cp      a,data_aa
6161
                jr      z,lddr_5
6162
                fail_msg 4
6163
lddr_5:         inc     hl
6164
                ld      a,(hl)
6165
                cp      a,data_7f
6166
                jr      z,cpi_0
6167
                fail_msg 5
6168
cpi_0:          ld      hl,t_var1
6169
                ld      bc,5
6170
                ld      a,data_7f
6171
                cpi
6172
                jp      pe,cpi_1
6173
                fail_msg 0
6174
cpi_1:          jp      m,cpi_2
6175
                fail_msg 1
6176
cpi_2:          jr      nz,cpi_3
6177
                fail_msg 2
6178
cpi_3:          cpi
6179
                jp      pe,cpi_4
6180
                fail_msg 3
6181
cpi_4:          jp      p,cpi_5
6182
                fail_msg 4
6183
cpi_5:          jr      nz,cpi_6
6184
                fail_msg 5
6185
cpi_6:          cpi
6186
                jp      pe,cpi_7
6187
                fail_msg 6
6188
cpi_7:          jp      m,cpi_8
6189
                fail_msg 7
6190
cpi_8:          jr      nz,cpi_9
6191
                fail_msg 8
6192
cpi_9:          cpi
6193
                jp      pe,cpi_10
6194
                fail_msg 9
6195
cpi_10:         jp      m,cpi_11
6196
                fail_msg 10
6197
cpi_11:         jr      nz,cpi_12
6198
                fail_msg 11
6199
cpi_12:         cpi
6200
                jp      po,cpi_13
6201
                fail_msg 12
6202
cpi_13:         jp      p,cpi_14
6203
                fail_msg 13
6204
cpi_14:         jr      z,cpir_0
6205
                fail_msg 14
6206
cpir_0:         ld      a,data_aa
6207
                ld      hl,var1
6208
                ld      bc,5
6209
                cpir
6210
                jr      z,cpir_1
6211
                fail_msg 0
6212
cpir_1:         jp      pe,cpir_2
6213
                fail_msg 1
6214
cpir_2:         ld      a,b
6215
                cp      a,0
6216
                jr      z,cpir_3
6217
                fail_msg 2
6218
cpir_3:         ld      a,c
6219
                cp      a,1
6220
                jr      z,cpir_4
6221
                fail_msg 3
6222
cpir_4:         ld      a,data_7f
6223
                ld      hl,var1
6224
                ld      bc,5
6225
                cpir
6226
                jp      po,cpir_5
6227
                fail_msg 4
6228
cpir_5:         jr      z,cpir_6
6229
                fail_msg 5
6230
cpir_6:         ld      a,#34      ;bjp was >data_1234
6231
                ld      hl,var1
6232
                ld      bc,5
6233
                cpir
6234
                jp      po,cpir_7
6235
                fail_msg 6
6236
cpir_7:         jr      nz,cpir_8
6237
                fail_msg 7
6238
cpir_8:         jp      m,cpir_9
6239
                fail_msg 8
6240
cpir_9:         ld      a,data_aa
6241
                ld      hl,var1
6242
                ld      bc,3
6243
                cpir
6244
                jp      po,cpir_10
6245
                fail_msg 9
6246
cpir_10:        jp      p,cpir_11
6247
                fail_msg 10
6248
cpir_11:        jr      nz,cpd_0
6249
                fail_msg 11
6250
cpd_0:          ld      a,data_ff
6251
                ld      hl,var5
6252
                ld      bc,5
6253
                cpd
6254
                jp      m,cpd_1
6255
                fail_msg 0
6256
cpd_1:          jp      pe,cpd_2
6257
                fail_msg 1
6258
cpd_2:          jr      nz,cpd_3
6259
                fail_msg 2
6260
cpd_3:          cpd
6261
                jp      p,cpd_4
6262
                fail_msg 3
6263
cpd_4:          jp      pe,cpd_5
6264
                fail_msg 4
6265
cpd_5:          jr      nz,cpd_6
6266
                fail_msg 5
6267
cpd_6:          cpd
6268
                jp      p,cpd_7
6269
                fail_msg 6
6270
cpd_7:          jp      pe,cpd_8
6271
                fail_msg 7
6272
cpd_8:          jr      nz,cpd_9
6273
                fail_msg 8
6274
cpd_9:          cpd
6275
                jp      m,cpd_10
6276
                fail_msg 9
6277
cpd_10:         jp      pe,cpd_11
6278
                fail_msg 10
6279
cpd_11:         jr      nz,cpd_12
6280
                fail_msg 11
6281
cpd_12:         cpd
6282
                jp      p,cpd_13
6283
                fail_msg 12
6284
cpd_13:         jp      po,cpd_14
6285
                fail_msg 13
6286
cpd_14:         jr      z,cpdr_0
6287
                fail_msg 14
6288
cpdr_0:         ld      a,data_80
6289
                ld      hl,var5
6290
                ld      bc,5
6291
                cpdr
6292
                jp      pe,cpdr_1
6293
                fail_msg 0
6294
cpdr_1:         jp      p,cpdr_2
6295
                fail_msg 1
6296
cpdr_2:         jr      z,cpdr_3
6297
                fail_msg 2
6298
cpdr_3:         ld      a,b
6299
                cp      a,0
6300
                jr      z,cpdr_4
6301
                fail_msg 3
6302
cpdr_4:         ld      a,c
6303
                cp      a,2
6304
                jr      z,cpdr_5
6305
                fail_msg 4
6306
cpdr_5:         ld      a,#34      ;bjp was >data_1234
6307
                ld      hl,var5
6308
                ld      bc,5
6309
                cpdr
6310
                jp      po,cpdr_6
6311
                fail_msg 5
6312
cpdr_6:         jr      nz,cpdr_7
6313
                fail_msg 6
6314
cpdr_7:         jp      p,cpdr_8
6315
                fail_msg 7
6316
cpdr_8:         ld      a,#34      ;bjp was >data_1234
6317
                ld      hl,var5
6318
                ld      bc,3
6319
                cpdr
6320
                jp      po,cpdr_9
6321
                fail_msg 8
6322
cpdr_9:         jr      nz,cpdr_10
6323
                fail_msg 9
6324
cpdr_10:        jp      m,test_exit
6325
                fail_msg 10
6326
 
6327
        ;; this section needs to be reworked for the TV80 environment.
6328
        ;; Since env uses ports for all its test control, this gets
6329
        ;; partially covered by normal operation. (gth)
6330
;
6331
;the file portfe.xxx must be examined to see if the proper output is generated
6332
;
6333
out_0:          ld      a,#30
6334
                out     (out_port),a
6335
                ld      c,out_port
6336
                ld      a,#31
6337
                out     (c),a
6338
                ld      b,#32
6339
                out     (c),b
6340
                ld      d,#33
6341
                out     (c),d
6342
                ld      e,#34
6343
                out     (c),e
6344
                ld      h,#35
6345
                out     (c),h
6346
                ld      l,#36
6347
                out     (c),l
6348
                out     (c),c                   ;output value divider
6349
outi_0:         ld      a,#31                   ;set up output values
6350
                ld      b,5
6351
                ld      hl,t_var1
6352
outi_1:         ld      (hl),a
6353
                inc     a
6354
                inc     hl
6355
                djnz    outi_1
6356
outi_2:         ld      c,out_port
6357
                ld      b,5
6358
                ld      hl,t_var1
6359
outi_3:         outi
6360
                jr      nz,outi_3
6361
otir_0:         out     (c),c                   ;output value divider
6362
                ld      hl,t_var1
6363
                ld      b,5
6364
                otir
6365
                jr      z,outd_0
6366
                fail_msg 0
6367
outd_0:         out     (c),c
6368
                ld      hl,t_var5
6369
                ld      b,5
6370
outd_1:         outd
6371
                jr      nz,outd_1
6372
otdr_0:         out     (c),c
6373
                ld      b,5
6374
                ld      hl,t_var5
6375
                otdr
6376
                jr      z,otdr_1
6377
                fail_msg 0
6378
otdr_1:         out     (c),c
6379
                ld      a,#0d
6380
                out     (c),a
6381
                ld      a,#0a
6382
                out     (c),a
6383
 
6384
test_exit:
6385
        ;; complicated pass/fail computation no longer necessary
6386
        ;; if we got here, we passed
6387
        passed
6388
 
6389
;
6390
;subroutine 1, must load a with #7f
6391
;
6392
sub1:           ld      a,data_7f
6393
                ret
6394
;
6395
;
6396
;subroutine 2, must load a with #55
6397
;
6398
sub2:           ld      a,data_55
6399
                cp      a,data_55
6400
                ret     z
6401
;
6402
;subroutine 3, increments a
6403
;
6404
sub3:           inc     a
6405
                and     a
6406
                ret     nz
6407
;
6408
;subroutine 4, subtracts 1 from a
6409
;
6410
sub4:           sub     a,1
6411
                ret     c
6412
;
6413
;subroutine 5, subtracts 1 from a
6414
;
6415
sub5:           sub     a,1
6416
                ret     nc
6417
;
6418
;subroutine 6, shifts a right logically
6419
;
6420
sub6:           srl     a
6421
                ret     po
6422
;
6423
;subroutine 7, shifts a left arithmetically
6424
;
6425
sub7:           sla     a
6426
                ret     pe
6427
;
6428
;subroutine 8, shifts a left arithmetically
6429
;
6430
sub8:           sla     a
6431
                ret     m
6432
;
6433
;subroutine 9, rotates a left
6434
;
6435
sub9:           rl      a
6436
                ret     p
6437
;
6438
;restart 0 routine
6439
;
6440
rst_0000_1:
6441
                ld      a, (rst_state)
6442
                cp      1
6443
                jp      z,rst_test_ret
6444
 
6445
                ld      a, 0
6446
                out     (#82), a        ; disable timeout count
6447
 
6448
                ld      a,(pass_count)
6449
                or      a
6450
                jp      z,start
6451
                ld      a,1
6452
                ret
6453
 
6454
rst_test_ret:   ret
6455
;
6456
;               data
6457
;
6458
var1:           db      data_ff
6459
var2:           db      data_55
6460
var3:           db      data_80
6461
var4:           db      data_aa
6462
var5:           db      data_7f
6463
;
6464
 
6465
mem_init_vals:
6466
                dw      data_1234
6467
                dw      data_55aa
6468
                dw      data_7fff
6469
                dw      data_8000
6470
                dw      data_aa55
6471
                dw      data_ffff
6472
 
6473
mem_init:
6474
    push    bc
6475
    push    de
6476
    push    hl
6477
 
6478
    ;; initialize region from 8000 to 80FF
6479
    ld  hl, #8000
6480
    ld  b, #ff
6481
 
6482
mem_init_loop_1:
6483
    ld      (hl), 0
6484
    inc     hl
6485
    djnz    mem_init_loop_1
6486
 
6487
    ;; initialize region from 8100 to 81FF
6488
    ld      hl, #8100
6489
    ld      b, #ff
6490
 
6491
mem_init_loop_2:
6492
    ld      (hl), 0
6493
    inc     hl
6494
    djnz    mem_init_loop_2
6495
 
6496
    ;; populate special values from 8005
6497
    ld      de, #8005
6498
    ld      hl, mem_init_vals
6499
    ld      b, 12
6500
 
6501
mem_init_loop_3:
6502
    ld      a, (hl)
6503
    inc     hl
6504
    ex      de, hl
6505
    ld      (hl), a
6506
    inc     hl
6507
    ex      de, hl
6508
    djnz    mem_init_loop_3
6509
 
6510
    ;; exit
6511
    pop     hl
6512
    pop     de
6513
    pop     bc
6514
    ret
6515
 
6516
t_var1:         equ     #8000
6517
t_var2:         equ     #8001
6518
t_var3:         equ     #8002
6519
t_var4:         equ     #8003
6520
t_var5:         equ     #8004
6521
 
6522
w_var1:         equ #8005
6523
w_var2:         equ #8007
6524
w_var3:         equ #8009
6525
w_var4:         equ #800B
6526
w_var5:         equ #800D
6527
w_var6:         equ #800F
6528
 
6529
tw_var1:        equ #8011
6530
tw_var2:        equ #8013
6531
tw_var3:        equ #8015
6532
tw_var4:        equ #8017
6533
tw_var5:        equ #8019
6534
tw_var6:        equ #801B
6535
tw_var7:        equ #801D
6536
 
6537
error_cnt:      equ #801E
6538
pass_count:     equ #801F
6539
fail_num:   equ #8020
6540
rst_state:      equ #8021
6541
 
6542
;               org     #8000
6543
;t_var1:                db      0
6544
;t_var2:                db      0
6545
;t_var3:                db      0
6546
;t_var4:                db      0
6547
;t_var5:                db      0
6548
;;
6549
;w_var1:                dw      data_1234
6550
;w_var2:                dw      data_55aa
6551
;w_var3:                dw      data_7fff
6552
;w_var4:                dw      data_8000
6553
;w_var5:                dw      data_aa55
6554
;w_var6:                dw      data_ffff
6555
;;
6556
;tw_var1:       dw      0
6557
;tw_var2:       dw      0
6558
;tw_var3:       dw      0
6559
;tw_var4:       dw      0
6560
;tw_var5:       dw      0
6561
;tw_var6:       dw      0
6562
;tw_var7:       dw      0
6563
;;
6564
;error_cnt:     db      0
6565
;pass_count:    db      0
6566
;fail_num        db      0
6567
;rst_state      db      0
6568
;
6569
;               org     #8100
6570
;stack:         ds      128
6571
;stack_end:     equ     $
6572
;
6573
                end start

powered by: WebSVN 2.1.0

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