URL
https://opencores.org/ocsvn/wb_z80/wb_z80/trunk
Subversion Repositories wb_z80
[/] [wb_z80/] [trunk/] [asm/] [BJS80TST.ASM] - Rev 39
Compare with Previous | Blame | View Log
; bjp modified to assemble on as80 assembler (needs different syntax).
; minor mods to account for changes in interrupt structure and I/O
; all such are flagged with my initials.....
;
; The origional code used operators < and > on symbols to extract the
; lower and higher bytes respectively. It appears that as80 has no equivalent.
; I have hand coded such ---- hopefully correctly.
; This is only a significant issue with such constructs as <stack_end.
; My solution forces the stack to remain in its present location.
;
; WARNING If you must move the stack -- check comments and fix code for my kludges
;
; Origional Code also had a pretty strange "passed" macro. Removed it and
; output a more useful message. along with the bist controls
;
;z80 simulator test routine
;total error count is left in a at end of test routine
;
code
org #0000
;
rst_0000: jp rst_0000_1
;
org #0008
;
rst_0008: ld a,2
ret
;
org #0010
;
rst_0010: ld a,3
ret
;
org #0018
;
rst_0018: ld a,4
ret
;
org #0020
;
rst_0020: ld a,5
ret
;
org #0028
;
rst_0028: ld a,6
ret
;
org #0030
;
rst_0030: ld a,7
ret
;
org #0038
;
rst_0038: ld a,8
ret
;
code
;
in_port: equ #20
out_port: equ #20
bist_adr: equ #ffff ;last memory address for bist controll register
bist_ack: equ #01
bist_err: equ #02
bist_ei: equ #04 ;interrupt enable register for bist
;
data_55: equ #55
data_7f: equ #7f
data_80: equ #80
data_aa: equ #aa
data_ff: equ #ff
;
data_1234: equ #1234
data_55aa: equ #55aa
data_7fff: equ #7fff
data_8000: equ #8000
data_aa55: equ #aa55
data_ffff: equ #ffff
cr: equ #0d
lf: equ #0a
bell: equ #07
;
;inc_error_cnt macro ;bjp change for initial test to halt on error
; ld hl,error_cnt
; inc (hl)
; endm
inc_error_cnt macro
halt
endm
;
;passed macro
; push bc
; ld bc,(pass)
; ld (message_addr),bc
; ld bc,(pass+2)
; ld (message_addr+2),bc
; ld bc,(pass+4)
; ld (message_addr+4),bc
; pop bc
; endm
;
;failed macro
; push bc
; ld bc,(fail)
; ld (message_addr),bc
; ld bc,(fail+2)
; ld (message_addr+2),bc
; ld bc,(fail+4)
; ld (message_addr+4),bc
; pop bc
; endm
;
;
start: xor a
ld (pass_count),a
ld hl,error_cnt
ld (hl),a ;clear error count
nop_1: nop
nop
ld_167: ld a,data_55
cp data_55
jr z,ld_1
inc_error_cnt
ld_1: ld b,data_7f
ld a,data_7f
cp b
jr z,ld_2
inc_error_cnt
ld_2: ld c,data_80
ld a,data_80
cp c
jr z,ld_3
inc_error_cnt
ld_3: ld d,data_aa
ld a,data_aa
cp d
jr z,ld_4
inc_error_cnt
ld_4: ld e,data_55
ld a,data_55
cp e
jr z,ld_5
inc_error_cnt
ld_5: ld h,data_7f
ld a,data_7f
cp h
jr z,ld_6
inc_error_cnt
ld_6: ld l,data_80
ld a,data_80
cp l
jr z,ld_7
inc_error_cnt
ld_7: ld a,data_55
ld b,a
cp b
jr z,ld_8
inc_error_cnt
ld_8: ld c,b
cp c
jr z,ld_9
inc_error_cnt
ld_9: ld d,c
cp d
jr z,ld_10
inc_error_cnt
ld_10: ld e,d
cp e
jr z,ld_11
inc_error_cnt
ld_11: ld h,e
cp h
jr z,ld_12
inc_error_cnt
ld_12: ld l,h
cp l
jr z,ld_13
inc_error_cnt
ld_13: ld l,data_80
ld a,l
cp l
jr z,ld_14
inc_error_cnt
ld_14: ld h,l
cp h
jr z,ld_15
inc_error_cnt
ld_15: ld e,h
cp e
jr z,ld_16
inc_error_cnt
ld_16: ld d,e
cp d
jr z,ld_17
inc_error_cnt
ld_17: ld c,d
cp c
jr z,ld_18
inc_error_cnt
ld_18: ld b,c
cp b
jr z,ld_19
inc_error_cnt
ld_19: ld hl,var1
ld a,(hl)
cp data_ff
jr z,ld_20
inc_error_cnt
ld_20: ld hl,var2
ld a,data_55
ld b,(hl)
cp b
jr z,ld_21
inc_error_cnt
ld_21: ld hl,var1
ld c,(hl)
ld a,(hl)
cp c
jr z,ld_22
inc_error_cnt
ld_22: ld hl,var2
ld d,(hl)
ld a,(hl)
cp d
jr z,ld_23
inc_error_cnt
ld_23: ld hl,var1
ld e,(hl)
ld a,(hl)
cp e
jr z,ld_24
inc_error_cnt
ld_24: ld hl,var2
ld a,(hl)
ld h,(hl)
cp h
jr z,ld_25
inc_error_cnt
ld_25: ld hl,var1
ld a,(hl)
ld l,(hl)
cp l
jr z,ld_26
inc_error_cnt
ld_26: ld ix,var3
ld a,(ix-2)
cp data_ff
jr z,ld_27
inc_error_cnt
ld_27: ld a,(ix+2)
cp data_7f
jr z,ld_28
inc_error_cnt
ld_28: ld a,(ix-1)
ld b,(ix-1)
cp b
jr z,ld_29
inc_error_cnt
ld_29: cp data_55
jr z,ld_30
inc_error_cnt
ld_30: ld a,(ix+1)
ld c,(ix+1)
cp c
jr z,ld_31
inc_error_cnt
ld_31: cp data_aa
jr z,ld_32
inc_error_cnt
ld_32: ld d,(ix-2)
ld a,(ix-2)
cp d
jr z,ld_33
inc_error_cnt
ld_33: cp data_ff
jr z,ld_34
inc_error_cnt
ld_34: ld e,(ix+2)
ld a,(ix+2)
cp e
jr z,ld_35
inc_error_cnt
ld_35: cp data_7f
jr z,ld_36
inc_error_cnt
ld_36: ld h,(ix+0)
ld a,(ix+0)
cp h
jr z,ld_37
inc_error_cnt
ld_37: cp data_80
jr z,ld_38
inc_error_cnt
ld_38: ld l,(ix-1)
ld a,(ix-1)
cp l
jr z,ld_39
inc_error_cnt
ld_39: cp data_55
jr z,ld_40
inc_error_cnt
ld_40: ld iy,var3
ld a,(iy-2)
cp data_ff
jr z,ld_41
inc_error_cnt
ld_41: ld a,(iy+2)
cp data_7f
jr z,ld_42
inc_error_cnt
ld_42: ld b,(iy-1)
ld a,(iy-1)
cp b
jr z,ld_43
inc_error_cnt
ld_43: cp data_55
jr z,ld_44
inc_error_cnt
ld_44: ld c,(iy+1)
ld a,(iy+1)
cp c
jr z,ld_45
inc_error_cnt
ld_45: cp data_aa
jr z,ld_46
inc_error_cnt
ld_46: ld d,(iy-2)
ld a,(iy-2)
cp d
jr z,ld_47
inc_error_cnt
ld_47: cp data_ff
jr z,ld_48
inc_error_cnt
ld_48: ld e,(iy+2)
ld a,(iy+2)
cp e
jr z,ld_49
inc_error_cnt
ld_49: cp data_7f
jr z,ld_50
inc_error_cnt
ld_50: ld h,(iy+0)
ld a,(iy+0)
cp h
jr z,ld_51
inc_error_cnt
ld_51: cp data_80
jr z,ld_52
inc_error_cnt
ld_52: ld l,(iy-2)
ld a,(iy-2)
cp l
jr z,ld_53
inc_error_cnt
ld_53: cp data_ff
jr z,ld_54
inc_error_cnt
ld_54: ld hl,t_var1
ld a,data_aa+1
ld (hl),a
ld b,(hl)
cp b
jr z,ld_55
inc_error_cnt
ld_55: cp data_aa+1
jr z,ld_56
inc_error_cnt
ld_56: ld b,data_80+1
ld (hl),b
ld a,(hl)
cp b
jr z,ld_57
inc_error_cnt
ld_57: cp data_80+1
jr z,ld_58
inc_error_cnt
ld_58: ld c,data_55-1
ld (hl),c
ld a,(hl)
cp c
jr z,ld_59
inc_error_cnt
ld_59: cp data_55-1
jr z,ld_60
inc_error_cnt
ld_60: ld d,data_ff-1
ld (hl),d
ld a,(hl)
cp d
jr z,ld_61
inc_error_cnt
ld_61: cp data_ff-1
jr z,ld_62
inc_error_cnt
ld_62: ld e,data_55+1
ld (hl),e
ld a,(hl)
cp e
jr z,ld_63
inc_error_cnt
ld_63: cp data_55+1
jr z,ld_64
inc_error_cnt
ld_64: ld (hl),h
ld a,(hl)
cp h
jr z,ld_65
inc_error_cnt
ld_65: cp #70 ;bjp guess >t_var1
jr z,ld_66
inc_error_cnt
ld_66: ld (hl),l
ld a,(hl)
cp l
jr z,ld_67
inc_error_cnt
ld_67: cp a, #00 ;bjp guess <t_var1
jr z,ld_68
inc_error_cnt
ld_68: ld ix,t_var3
ld a,data_55
ld (ix-2),a
ld a,0
ld a,(ix-2)
cp data_55
jr z,ld_69
inc_error_cnt
ld_69: ld a,data_80
ld (ix+2),a
ld a,0
ld a,(ix+2)
cp data_80
jr z,ld_70
inc_error_cnt
ld_70: ld b,data_7f
ld (ix-1),b
ld a,(ix-1)
cp b
jr z,ld_71
inc_error_cnt
ld_71: cp data_7f
jr z,ld_72
inc_error_cnt
ld_72: ld c,data_aa
ld (ix+1),c
ld a,(ix+1)
cp c
jr z,ld_73
inc_error_cnt
ld_73: cp data_aa
jr z,ld_74
inc_error_cnt
ld_74: ld d,data_80
ld (ix+0),d
ld a,(ix+0)
cp d
jr z,ld_75
inc_error_cnt
ld_75: cp data_80
jr z,ld_76
inc_error_cnt
ld_76: ld e,data_55+2
ld (ix-2),e
ld a,(ix-2)
cp e
jr z,ld_77
inc_error_cnt
ld_77: cp data_55+2
jr z,ld_78
inc_error_cnt
ld_78: ld h,data_aa-2
ld (ix+2),h
ld a,(ix+2)
cp h
jr z,ld_79
inc_error_cnt
ld_79: cp data_aa-2
jr z,ld_80
inc_error_cnt
ld_80: ld l,data_aa+2
ld (ix-1),l
ld a,(ix-1)
cp l
jr z,ld_81
inc_error_cnt
ld_81: cp data_aa+2
jr z,ld_82
inc_error_cnt
ld_82: ld iy,t_var3
ld a,data_ff
ld (iy-2),a
ld a,0
ld a,(iy-2)
cp data_ff
jr z,ld_83
inc_error_cnt
ld_83: ld a,data_7f
ld (iy+2),a
ld a,0
ld a,(iy+2)
cp data_7f
jr z,ld_84
inc_error_cnt
ld_84: ld b,data_55
ld (iy-1),b
ld a,(iy-1)
cp b
jr z,ld_85
inc_error_cnt
ld_85: cp data_55
jr z,ld_86
inc_error_cnt
ld_86: ld c,data_aa
ld (iy+1),c
ld a,(iy+1)
cp c
jr z,ld_87
inc_error_cnt
ld_87: cp data_aa
jr z,ld_88
inc_error_cnt
ld_88: ld d,data_80
ld (iy+0),d
ld a,(iy+0)
cp d
jr z,ld_89
inc_error_cnt
ld_89: cp data_80
jr z,ld_90
inc_error_cnt
ld_90: ld e,data_ff-2
ld (iy-2),e
ld a,(iy-2)
cp e
jr z,ld_91
inc_error_cnt
ld_91: cp data_ff-2
jr z,ld_92
inc_error_cnt
ld_92: ld h,data_7f-3
ld (iy+2),h
ld a,(iy+2)
cp h
jr z,ld_93
inc_error_cnt
ld_93: cp data_7f-3
jr z,ld_94
inc_error_cnt
ld_94: ld l,data_55-5
ld (iy-1),l
ld a,(iy-1)
cp l
jr z,ld_95
inc_error_cnt
ld_95: cp data_55-5
jr z,ld_96
inc_error_cnt
ld_96: ld hl,t_var1
ld (hl),data_80+10
ld a,(hl)
cp data_80+10
jr z,ld_97
inc_error_cnt
ld_97: ld ix,t_var3
ld (ix-2),data_55-10
ld a,(ix-2)
cp data_55-10
jr z,ld_98
inc_error_cnt
ld_98: ld (ix+2),data_55+10
ld a,(ix+2)
cp data_55+10
jr z,ld_99
inc_error_cnt
ld_99: ld iy,t_var2
ld (iy-1),data_80+17
ld a,(iy-1)
cp data_80+17
jr z,ld_100
inc_error_cnt
ld_100: ld (iy+1),data_80-17
ld a,(iy+1)
cp data_80-17
jr z,ld_101
inc_error_cnt
ld_101: ld hl,t_var5
ld bc,t_var5
ld (hl),data_aa-10
ld a,(bc)
cp data_aa-10
jr z,ld_102
inc_error_cnt
ld_102: ld hl,t_var3
ld de,t_var3
ld (hl),data_aa+10
ld a,(de)
cp data_aa+10
jr z,ld_103
inc_error_cnt
ld_103: ld hl,t_var2
ld (hl),data_7f-25
ld a,(t_var2)
cp data_7f-25
jr z,ld_104
inc_error_cnt
ld_104: ld hl,t_var4
ld bc,t_var4
ld a,data_55-20
ld (bc),a
ld b,(hl)
cp b
jr z,ld_105
inc_error_cnt
ld_105: ld a,b
cp data_55-20
jr z,ld_106
inc_error_cnt
ld_106: ld hl,t_var5
ld de,t_var5
ld a,data_55+20
ld (de),a
ld c,(hl)
cp c
jr z,ld_107
inc_error_cnt
ld_107: ld a,c
cp data_55+20
jr z,ld_108
inc_error_cnt
ld_108: ld hl,t_var4
ld a,data_ff-24
ld (t_var4),a
ld e,(hl)
cp e
jr z,ld_109
inc_error_cnt
ld_109: ld a,e
cp data_ff-24
jr z,ld_110
inc_error_cnt
ld_110: ld a,data_55
ld i,a
ld a,0
ld a,i
jr nz,ld_111
inc_error_cnt
ld_111: jp p,ld_112
inc_error_cnt
ld_112: cp data_55
jr z,ld_113
inc_error_cnt
ld_113: ld a,data_80
ld i,a
ld a,0
ld a,i
jr nz,ld_114
inc_error_cnt
ld_114: jp m,ld_115
inc_error_cnt
ld_115: cp data_80
jr z,ld_116
inc_error_cnt
ld_116: ld a,0
ld i,a
ld a,data_55
ld a,i
jr z,ld_125
inc_error_cnt
; refresh register not implemented
; test for ie ?
;ld_117: ld a,data_55
; ld r,a
; ld a,0
; ld a,r
; jp p,ld_118
; inc_error_cnt
;ld_118: jr nz,ld_119
; inc_error_cnt
;ld_119: ld a,data_ff
; ld r,a
; ld a,0
; ld a,r
; jp m,ld_120
; inc_error_cnt
;ld_120: ld a,4 ;totally sequence dependent
; ld r,a
; ld a,data_55
; ld a,r
; jr z,ld_121
; inc_error_cnt
;ld_121: ei ;set iff2
; ld a,i
; jp pe,ld_122 ;iff2 was set
; inc_error_cnt
;ld_122: di ;clear iff2
; ld a,i
; jp po,ld_123 ;iff2 was cleared
; inc_error_cnt
;ld_123: ei ;set iff2
; ld a,r
; jp pe,ld_124 ;iff2 was set
; inc_error_cnt
;ld_124: di ;clear iff2
; ld a,r
; jp po,ld_125 ;iff2 was cleared
; inc_error_cnt
;
ld_125: ld bc,data_1234
ld a, #12 ;bjp guess >data_1234
cp b
jr z,ld_126
inc_error_cnt
ld_126: ld a, #34 ;bjp guess <data_1234
cp c
jr z,ld_127
inc_error_cnt
ld_127: ld de,data_55aa
ld a,data_55
cp d
jr z,ld_128
inc_error_cnt
ld_128: ld a,data_aa
cp e
jr z,ld_129
inc_error_cnt
ld_129: ld hl,data_7fff
ld a,data_7f
cp h
jr z,ld_130
inc_error_cnt
ld_130: ld a,data_ff
cp l
jr z,ld_131
inc_error_cnt
ld_131: ld sp,data_aa55
ld hl,0
add hl,sp
ld a,data_aa
cp h
jr z,ld_132
inc_error_cnt
ld_132: ld a,data_55
cp l
jr z,ld_133
inc_error_cnt
ld_133: ld ix,data_ffff
ld hl,0
ld sp,ix
add hl,sp
ld a,data_ff
cp h
jr z,ld_134
inc_error_cnt
ld_134: cp l
jr z,ld_135
inc_error_cnt
ld_135: ld iy,data_1234
ld hl,0
ld sp,iy
add hl,sp
ld a,#12 ;bjp was >data_1234
cp h
jr z,ld_136
inc_error_cnt
ld_136: ld a,#34 ;bjp was >data_1234
cp l
jr z,ld_137
inc_error_cnt
ld_137: ld hl,(w_var2)
ld a,data_55
cp h
jr z,ld_138
inc_error_cnt
ld_138: ld a,data_aa
cp l
jr z,ld_139
inc_error_cnt
ld_139: ld bc,(w_var1)
ld a,#12 ;bjp was >data_1234
cp b
jr z,ld_140
inc_error_cnt
ld_140: ld a,#34 ;bjp was >data_1234
cp c
jr z,ld_141
inc_error_cnt
ld_141: ld de,(w_var3)
ld a,data_7f
cp d
jr z,ld_142
inc_error_cnt
ld_142: ld a,data_ff
cp e
jr z,ld_143
inc_error_cnt
ld_143: ld hl,(w_var4)
ld a,data_80
cp h
jr z,ld_144
inc_error_cnt
ld_144: ld a,0
cp l
jr z,ld_145
inc_error_cnt
ld_145: ld sp,(w_var5)
ld hl,0
add hl,sp
ld a,data_aa
cp h
jr z,ld_146
inc_error_cnt
ld_146: ld a,data_55
cp l
jr z,ld_147
inc_error_cnt
ld_147: ld ix,(w_var6)
ld hl,0
ld sp,ix
add hl,sp
ld a,data_ff
cp h
jr z,ld_148
inc_error_cnt
ld_148: cp l
jr z,ld_149
inc_error_cnt
ld_149: ld iy,(w_var1)
ld hl,0
ld sp,iy
add hl,sp
ld a,#12 ;bjp was >data_1234
cp h
jr z,ld_150
inc_error_cnt
ld_150: ld a,#34 ;bjp was >data_1234
cp l
jr z,ld_151
inc_error_cnt
ld_151: ld hl,data_1234
ld (tw_var1),hl
ld bc,(tw_var1)
ld a,#12 ;bjp was >data_1234
cp b
jr z,ld_152
inc_error_cnt
ld_152: ld a,#34 ;bjp was >data_1234
cp c
jr z,ld_153
inc_error_cnt
ld_153: ld bc,data_55aa
ld (tw_var2),bc
ld hl,(tw_var2)
ld a,data_55
cp h
jr z,ld_154
inc_error_cnt
ld_154: ld a,data_aa
cp l
jr z,ld_155
inc_error_cnt
ld_155: ld de,data_7fff
ld (tw_var3),de
ld hl,(tw_var3)
ld a,data_7f
cp h
jr z,ld_156
inc_error_cnt
ld_156: ld a,data_ff
cp l
jr z,ld_157
inc_error_cnt
ld_157: ld hl,data_8000
ld (tw_var4),hl
ld bc,(tw_var4)
ld a,data_80
cp b
jr z,ld_158
inc_error_cnt
ld_158: ld a,0
cp c
jr z,ld_159
inc_error_cnt
ld_159: ld sp,data_aa55
ld (tw_var5),sp
ld hl,(tw_var5)
ld a,data_aa
cp h
jr z,ld_160
inc_error_cnt
ld_160: ld a,data_55
cp l
jr z,ld_161
inc_error_cnt
ld_161: ld ix,data_ffff
ld (tw_var6),ix
ld hl,(tw_var6)
ld a,data_ff
cp h
jr z,ld_162
inc_error_cnt
ld_162: cp l
jr z,ld_163
inc_error_cnt
ld_163: ld iy,data_1234
ld (tw_var7),iy
ld hl,(tw_var7)
ld a,#12 ;bjp was >data_1234
cp h
jr z,ld_164
inc_error_cnt
ld_164: ld a,#34 ;bjp was >data_1234
cp l
jr z,ld_165
inc_error_cnt
ld_165: ld hl,data_55aa
ld sp,hl
ld hl,0
add hl,sp
ld a,data_55
cp h
jr z,ld_166
inc_error_cnt
ld_166: ld a,data_aa
cp l
jr z,push_0
inc_error_cnt
push_0: ld sp,stack_end
ld bc,data_1234
push bc
ld bc,0
pop bc
ld a,#12 ;bjp was >data_1234
cp b
jr z,push_1
inc_error_cnt
push_1: ld a,#34 ;bjp was >data_1234
cp c
jr z,push_2
inc_error_cnt
push_2: ld de,data_55aa
push de
ld de,0
pop de
ld a,data_55
cp d
jr z,push_3
inc_error_cnt
push_3: ld a,data_aa
cp e
jr z,push_4
inc_error_cnt
push_4: ld hl,data_7fff
push hl
ld hl,0
pop hl
ld a,data_7f
cp h
jr z,push_5
inc_error_cnt
push_5: ld a,data_ff
cp l
jr z,push_6
inc_error_cnt
push_6: ld a,data_80
push af ;f depends on previous compare
ld hl,0
pop hl
cp h
jr z,push_7
inc_error_cnt
push_7: ld a,l
cp #42
jr z,push_8
push_8: ld h,data_55
ld l,data_80+#41
ld a,0
push hl
pop af
jp m,push_9
inc_error_cnt
push_9: jr z,push_10
inc_error_cnt
push_10: jr c,push_11
inc_error_cnt
push_11: cp data_55
jr z,push_12
inc_error_cnt
push_12: ld ix,data_aa55
ld bc,0
push ix
pop bc
ld a,data_aa
cp b
jr z,push_13
inc_error_cnt
push_13: ld a,data_55
cp c
jr z,push_14
inc_error_cnt
push_14: ld iy,data_7fff
ld de,0
push iy
pop de
ld a,data_7f
cp d
jr z,push_15
inc_error_cnt
push_15: ld a,data_ff
cp e
jr z,push_16
inc_error_cnt
push_16: ld de,data_1234
ld ix,0
ld hl,0
push de
pop ix
ld sp,ix
add hl,sp
ld a,#12 ;bjp was >data_1234
cp h
jr z,push_17
inc_error_cnt
push_17: ld a,#34 ;bjp was >data_1234
cp l
jr z,push_18
inc_error_cnt
push_18: ld sp,stack_end
ld bc,data_55aa
ld iy,0
ld hl,0
push bc
pop iy
ld sp,iy
add hl,sp
ld a,data_55
cp h
jr z,push_19
inc_error_cnt
push_19: ld a,data_aa
cp l
jr z,push_20
inc_error_cnt
push_20: ld sp,stack_end
ex_0: ld de,data_1234
ld hl,data_55aa ; 10/2/2007 was ffff need to check all bytes (missed a bug)
ex de,hl
ld a,data_55
cp d
jr z,ex_1
inc_error_cnt
ex_1: ld a,data_aa
cp e
jr z,ex_2
inc_error_cnt
ex_2: ld a,#12 ;bjp was >data_1234
cp h
jr z,ex_3
inc_error_cnt
ex_3: ld a,#34 ;bjp was >data_1234
cp l
jr z,ex_4
inc_error_cnt
ex_4: ld h,0
ld l,0
push hl
pop af
ex af,af'
ld h,data_7f
ld l,data_80+#41
push hl
pop af
ex af,af'
cp 0
jr z,ex_5
inc_error_cnt
ex_5: ex af,af'
jp m,ex_6
inc_error_cnt
ex_6: jr z,ex_7
inc_error_cnt
ex_7: cp data_7f
jr z,ex_8
inc_error_cnt
ex_8: ld hl,0
ld bc,0
ld de,0
exx
ld hl,data_1234
ld bc,data_7fff
ld de,data_aa55
exx
ld a,0
cp h
jr z,ex_9
inc_error_cnt
ex_9: cp l
jr z,ex_10
inc_error_cnt
ex_10: cp d
jr z,ex_11
inc_error_cnt
ex_11: cp e
jr z,ex_12
inc_error_cnt
ex_12: cp b
jr z,ex_13
inc_error_cnt
ex_13: cp c
jr z,ex_14
inc_error_cnt
ex_14: exx
ld a,#12 ;bjp was >data_1234
cp h
jr z,ex_15
inc_error_cnt
ex_15: ld a,#34 ;bjp was >data_1234
cp l
jr z,ex_16
inc_error_cnt
ex_16: ld a,data_aa
cp d
jr z,ex_17
inc_error_cnt
ex_17: ld a,data_55
cp e
jr z,ex_18
inc_error_cnt
ex_18: ld a,data_7f
cp b
jr z,ex_19
inc_error_cnt
ex_19: ld a,data_ff
cp c
jr z,ex_20
inc_error_cnt
ex_20: ld bc,data_55aa
ld hl,data_7fff
push bc
ex (sp),hl
pop bc
ld a,data_7f
cp b
jr z,ex_21
inc_error_cnt
ex_21: ld a,data_ff
cp c
jr z,ex_22
inc_error_cnt
ex_22: ld a,data_55
cp h
jr z,ex_23
inc_error_cnt
ex_23: ld a,data_aa
cp l
jr z,ex_24
inc_error_cnt
ex_24: ld bc,data_ffff
ld ix,data_8000
ld hl,0
push bc
ex (sp),ix
pop bc
ld sp,ix
add hl,sp
ld a,data_80
cp b
jr z,ex_25
inc_error_cnt
ex_25: ld a,0
cp c
jr z,ex_26
inc_error_cnt
ex_26: ld a,data_ff
cp h
jr z,ex_27
inc_error_cnt
ex_27: cp l
jr z,ex_28
inc_error_cnt
ex_28: ld sp,stack_end
ld bc,data_1234
ld iy,data_7fff
ld hl,0
push bc
ex (sp),iy
pop bc
ld sp,iy
add hl,sp
ld a,data_7f
cp b
jr z,ex_29
inc_error_cnt
ex_29: ld a,data_ff
cp c
jr z,ex_30
inc_error_cnt
ex_30: ld a,#12 ;bjp was >data_1234
cp h
jr z,ex_31
inc_error_cnt
ex_31: ld a,#34 ;bjp was >data_1234
cp l
jr z,add_0
inc_error_cnt
add_0: ld a,0
ld b,data_7f
add a,b
cp data_7f
jr z,add_1
inc_error_cnt
add_1: ld a,0
ld b,0
add a,b
jr z,add_2
inc_error_cnt
add_2: ld b,data_55
add a,b
jr nz,add_3
inc_error_cnt
add_3: cp data_55
jr z,add_4
inc_error_cnt
add_4: ld a,data_ff
ld b,1
add a,b
jr c,add_5
inc_error_cnt
add_5: add a,b
jr nc,add_6
inc_error_cnt
add_6: ld a,data_ff
ld b,0
add a,b
jp m,add_7
inc_error_cnt
add_7: ld b,1
add a,b
jp p,add_8
inc_error_cnt
add_8: ld a,data_7f
ld b,1
add a,b
jp pe,add_9
inc_error_cnt
add_9: add a,b
jp po,add_10
inc_error_cnt
add_10: ld a,data_55
ld c,2
add a,c
cp data_55+2
jr z,add_11
inc_error_cnt
add_11: ld a,data_80
add a,c
cp data_80+2
jr z,add_12
inc_error_cnt
add_12: ld a,data_aa
ld d,data_55
add a,d
cp data_aa+data_55
jr z,add_13
inc_error_cnt
add_13: ld a,data_aa
ld e,2
add a,e
cp data_aa+2
jr z,add_14
inc_error_cnt
add_14: ld a,data_55
ld h,24
add a,h
cp data_55+24
jr z,add_15
inc_error_cnt
add_15: ld a,data_7f-10
ld l,10
add a,l
cp data_7f
jr z,add_16
inc_error_cnt
add_16: ld a,1
add a,data_7f
jp pe,add_17
inc_error_cnt
add_17: jp m,add_18
inc_error_cnt
add_18: jr nz,add_19
inc_error_cnt
add_19: cp data_80
jr z,add_20
inc_error_cnt
add_20: ld a,data_55
add a,1
jp po,add_21
inc_error_cnt
add_21: jp p,add_22
inc_error_cnt
add_22: jr nc,add_23
inc_error_cnt
add_23: cp data_55+1
jr z,add_24
inc_error_cnt
add_24: ld a,data_ff
add a,1
jr c,add_25
inc_error_cnt
add_25: jr z,add_26
inc_error_cnt
add_26: add a,1
jr nc,add_27
inc_error_cnt
add_27: jr nz,add_28
inc_error_cnt
add_28: cp 1
jr z,add_29
inc_error_cnt
add_29: ld hl,var2
ld a,2
add a,(hl)
jp po,add_30
inc_error_cnt
add_30: jp p,add_31
inc_error_cnt
add_31: jr nz,add_32
inc_error_cnt
add_32: jr nc,add_33
inc_error_cnt
add_33: cp data_55+2
jr z,add_34
inc_error_cnt
add_34: ld hl,var1
ld a,1
add a,(hl)
jr c,add_35
inc_error_cnt
add_35: jr z,add_36
inc_error_cnt
add_36: ld hl,var5
ld a,1
add a,(hl)
jp m,add_37
inc_error_cnt
add_37: jp pe,add_38
inc_error_cnt
add_38: cp data_80
jr z,add_39
inc_error_cnt
add_39: ld ix,var3
ld a,1
add a,(ix-1)
jp po,add_40
inc_error_cnt
add_40: jp p,add_41
inc_error_cnt
add_41: jr nz,add_42
inc_error_cnt
add_42: jr nc,add_43
inc_error_cnt
add_43: cp data_55+1
jr z,add_44
inc_error_cnt
add_44: ld a,1
add a,(ix+2)
jp pe,add_45
inc_error_cnt
add_45: jp m,add_46
inc_error_cnt
add_46: cp data_80
jr z,add_47
inc_error_cnt
add_47: ld a,1
add a,(ix-2)
jr c,add_48
inc_error_cnt
add_48: jr z,add_49
inc_error_cnt
add_49: add a,1
jr nc,add_50
inc_error_cnt
add_50: jr nz,add_51
inc_error_cnt
add_51: cp 1
jr z,add_52
inc_error_cnt
add_52: ld iy,var3
ld a,10
add a,(iy-1)
jp po,add_53
inc_error_cnt
add_53: jp p,add_54
inc_error_cnt
add_54: jr nz,add_55
inc_error_cnt
add_55: jr nc,add_56
inc_error_cnt
add_56: cp data_55+10
jr z,add_57
inc_error_cnt
add_57: ld a,1
add a,(iy+2)
jp pe,add_58
inc_error_cnt
add_58: jp m,add_59
inc_error_cnt
add_59: add a,1
jp po,add_60
inc_error_cnt
add_60: cp data_80+1
jr z,add_61
inc_error_cnt
add_61: ld a,1
add a,(iy-2)
jr z,add_62
inc_error_cnt
add_62: jr c,add_63
inc_error_cnt
add_63: add a,1
jr nc,add_64
inc_error_cnt
add_64: jr nz,add_65
inc_error_cnt
add_65: cp 1
jr z,add_66
inc_error_cnt
add_66: ld a,data_ff
add a,data_80
jp p,add_67
inc_error_cnt
add_67: jp pe,add_68
inc_error_cnt
add_68: jr c,add_69
inc_error_cnt
add_69: add a,1
jp pe,add_70
inc_error_cnt
add_70: jp m,add_71
inc_error_cnt
add_71: jr nc,add_72
inc_error_cnt
add_72: add a,1
jp po,add_73
inc_error_cnt
add_73: cp data_80+1
jr z,adc_0
inc_error_cnt
adc_0: ld a,0 ;clear cry
add a,0
ld b,data_7f
adc a,b ;a=7f cry=0
jp p,adc_1
inc_error_cnt
adc_1: jp po,adc_2
inc_error_cnt
adc_2: jr nc,adc_3
inc_error_cnt
adc_3: jr nz,adc_4
inc_error_cnt
adc_4: ld b,1
adc a,b ;a=80 cry=0
jp pe,adc_5 ;jp ofl
inc_error_cnt
adc_5: jp m,adc_6
inc_error_cnt
adc_6: cp data_80
jr z,adc_7 ;z=0 ofl=0 cry=0 (borrow)
inc_error_cnt
adc_7: ld a,data_ff
ld b,1
adc a,b ;ff+1+0
jr c,adc_8
inc_error_cnt
adc_8: jr z,adc_9
inc_error_cnt
adc_9: adc a,b
jr nc,adc_10
inc_error_cnt
adc_10: jr nz,adc_11
inc_error_cnt
adc_11: cp 2
jr z,adc_12
inc_error_cnt
adc_12: ld a,data_ff
ld c,0
adc a,c
jp m,adc_13
inc_error_cnt
adc_13: jr nc,adc_14
inc_error_cnt
adc_14: ld c,2
adc a,c
jp p,adc_15
inc_error_cnt
adc_15: jr c,adc_16
inc_error_cnt
adc_16: ld c,0
adc a,c
cp 2
jr z,adc_17
inc_error_cnt
adc_17: ld a,data_ff
ld d,1
adc a,d
jr c,adc_18
inc_error_cnt
adc_18: ld d,0
adc a,d
jr nc,adc_19
inc_error_cnt
adc_19: cp 1
jr z,adc_20
inc_error_cnt
adc_20: ld a,data_aa
ld e,data_7f
adc a,e
jr c,adc_21
inc_error_cnt
adc_21: ld e,#2b
adc a,e
cp data_55
jr z,adc_22
inc_error_cnt
adc_22: ld a,data_ff
ld h,1
adc a,h
jr c,adc_23
inc_error_cnt
adc_23: adc a,h
cp 2
jr z,adc_24
inc_error_cnt
adc_24: ld a,data_ff
ld l,1
adc a,l
jr c,adc_25
inc_error_cnt
adc_25: adc a,l
cp 2
jr z,adc_26
inc_error_cnt
adc_26: ld a,0
adc a,data_7f
jp po,adc_27
inc_error_cnt
adc_27: jp p,adc_28
inc_error_cnt
adc_28: jr nc,adc_29
inc_error_cnt
adc_29: jr nz,adc_30
inc_error_cnt
adc_30: adc a,1
jp pe,adc_31
inc_error_cnt
adc_31: jp m,adc_32
inc_error_cnt
adc_32: cp data_80
jr z,adc_33
inc_error_cnt
adc_33: ld a,data_ff
adc a,1
jr c,adc_34
inc_error_cnt
adc_34: jr z,adc_35
inc_error_cnt
adc_35: adc a,1
jr nc,adc_36
inc_error_cnt
adc_36: jr nz,adc_37
inc_error_cnt
adc_37: cp 2
jr z,adc_38
inc_error_cnt
adc_38: ld hl,var5
ld a,0
adc a,(hl)
jp p,adc_39
inc_error_cnt
adc_39: jp po,adc_40
inc_error_cnt
adc_40: jr nz,adc_41
inc_error_cnt
adc_41: jr nc,adc_42
inc_error_cnt
adc_42: ld a,1
adc a,(hl)
jp m,adc_43
inc_error_cnt
adc_43: jp pe,adc_44
inc_error_cnt
adc_44: cp data_80
jr z,adc_45
inc_error_cnt
adc_45: ld hl,var1
ld a,1
adc a,(hl)
jr z,adc_46
inc_error_cnt
adc_46: jr c,adc_47
inc_error_cnt
adc_47: ld hl,var2
adc a,(hl)
jr nc,adc_48
inc_error_cnt
adc_48: jr nz,adc_49
inc_error_cnt
adc_49: cp data_55+1
jr z,adc_50
inc_error_cnt
adc_50: ld ix,var3
ld a,0
adc a,(ix+2)
jp p,adc_51
inc_error_cnt
adc_51: jp po,adc_52
inc_error_cnt
adc_52: jr nc,adc_53
inc_error_cnt
adc_53: jr nz,adc_54
inc_error_cnt
adc_54: ld a,1
adc a,(ix+2)
jp m,adc_55
inc_error_cnt
adc_55: jp pe,adc_56
inc_error_cnt
adc_56: cp data_80
jr z,adc_57
inc_error_cnt
adc_57: ld a,1
adc a,(ix-2)
jr c,adc_58
inc_error_cnt
adc_58: jr z,adc_59
inc_error_cnt
adc_59: adc a,(ix-1)
jr nc,adc_60
inc_error_cnt
adc_60: jr nz,adc_61
inc_error_cnt
adc_61: cp data_55+1
jr z,adc_62
inc_error_cnt
adc_62: ld iy,var3
ld a,0
adc a,(ix+2)
jp p,adc_63
inc_error_cnt
adc_63: jp po,adc_64
inc_error_cnt
adc_64: jr nc,adc_65
inc_error_cnt
adc_65: jr nz,adc_66
inc_error_cnt
adc_66: ld a,1
adc a,(iy+2)
jp m,adc_67
inc_error_cnt
adc_67: jp pe,adc_68
inc_error_cnt
adc_68: cp data_80
jr z,adc_69
inc_error_cnt
adc_69: ld a,1
adc a,(iy-2)
jr c,adc_70
inc_error_cnt
adc_70: jr z,adc_71
inc_error_cnt
adc_71: adc a,(iy-1)
jr nc,adc_72
inc_error_cnt
adc_72: jr nz,adc_73
inc_error_cnt
adc_73: cp data_55+1
jr z,adc_74
inc_error_cnt
adc_74: ld a,data_ff
add a,0
adc a,data_80
jp p,adc_75
inc_error_cnt
adc_75: jp pe,adc_76
inc_error_cnt
adc_76: jr nz,adc_77
inc_error_cnt
adc_77: adc a,0
jp m,adc_78
inc_error_cnt
adc_78: jp pe,adc_79
inc_error_cnt
adc_79: adc a,1
jp po,adc_80
inc_error_cnt
adc_80: cp data_80+1
jr z,sub_0
inc_error_cnt
sub_0: ld a,0
ld b,1
sub a,b
jp m,sub_1
inc_error_cnt
sub_1: jp po,sub_2
inc_error_cnt
sub_2: jr c,sub_3
inc_error_cnt
sub_3: jr nz,sub_4
inc_error_cnt
sub_4: sub a,b
jr nc,sub_5
inc_error_cnt
sub_5: cp data_ff-1
jr z,sub_6
inc_error_cnt
sub_6: ld a,1
ld b,0
sub a,b
jr nz,sub_7
inc_error_cnt
sub_7: jp p,sub_8
inc_error_cnt
sub_8: ld b,1
sub a,b
jr z,sub_9
inc_error_cnt
sub_9: sub a,b
jp m,sub_10
inc_error_cnt
sub_10: cp data_ff
jr z,sub_11
inc_error_cnt
sub_11: ld a,data_80
ld b,data_7f
sub a,b
jp pe,sub_12
inc_error_cnt
sub_12: sub a,b
jp po,sub_13
inc_error_cnt
sub_13: cp data_80+2
jr z,sub_14
inc_error_cnt
sub_14: ld a,data_55
ld c,data_55
sub a,c
jr z,sub_15
inc_error_cnt
sub_15: ld c,1
sub a,c
jp m,sub_16
inc_error_cnt
sub_16: jr c,sub_17
inc_error_cnt
sub_17: cp data_ff
jr z,sub_18
inc_error_cnt
sub_18: ld a,data_55
ld d,data_7f
sub a,d
jr c,sub_19
inc_error_cnt
sub_19: cp data_55-data_7f
jr z,sub_20
inc_error_cnt
sub_20: ld a,0
ld e,data_ff
sub a,e
jr c,sub_21
inc_error_cnt
sub_21: cp 1
jr z,sub_22
inc_error_cnt
sub_22: ld a,data_ff
ld h,data_80
sub a,h
jp p,sub_23
inc_error_cnt
sub_23: cp data_7f
jr z,sub_24
inc_error_cnt
sub_24: ld a,data_aa
ld l,data_ff
sub a,l
jr c,sub_25
inc_error_cnt
sub_25: cp data_aa+1
jr z,sub_26
inc_error_cnt
sub_26: ld a,data_7f
sub a,data_ff
jp pe,sub_27
inc_error_cnt
sub_27: jp m,sub_28
inc_error_cnt
sub_28: sub a,1
jp p,sub_29
inc_error_cnt
sub_29: sub a,1
jp po,sub_30
inc_error_cnt
sub_30: jr nz,sub_31
inc_error_cnt
sub_31: sub a,data_7f-1
jr z,sub_32
inc_error_cnt
sub_32: ld a,0
sub a,data_ff
jr c,sub_33
inc_error_cnt
sub_33: sub a,1
jr z,sub_34
inc_error_cnt
sub_34: jr nc,sub_35
inc_error_cnt
sub_35: ld hl,var1
ld a,data_7f
sub a,(hl)
jp m,sub_36
inc_error_cnt
sub_36: jp pe,sub_37
inc_error_cnt
sub_37: jr c,sub_38
inc_error_cnt
sub_38: ld hl,var3
sub a,(hl)
jp p,sub_39
inc_error_cnt
sub_39: jp po,sub_40
inc_error_cnt
sub_40: jr nc,sub_41
inc_error_cnt
sub_41 jr z,sub_42
inc_error_cnt
sub_42: ld hl,var2
sub a,(hl)
jr nz,sub_43
inc_error_cnt
sub_43: cp data_aa+1
jr z,sub_44
inc_error_cnt
sub_44: ld ix,var3
ld a,data_7f
sub a,(ix-2)
jp m,sub_45
inc_error_cnt
sub_45: jp pe,sub_46
inc_error_cnt
sub_46: jr c,sub_47
inc_error_cnt
sub_47: sub a,(ix+0)
jp p,sub_48
inc_error_cnt
sub_48: jp po,sub_49
inc_error_cnt
sub_49: jr nc,sub_50
inc_error_cnt
sub_50: jr z,sub_51
inc_error_cnt
sub_51: sub a,(ix+2)
jr nz,sub_52
inc_error_cnt
sub_52: cp data_80+1
jr z,sub_53
inc_error_cnt
sub_53: ld iy,var3
ld a,data_7f
sub a,(iy-2)
jp m,sub_54
inc_error_cnt
sub_54: jp pe,sub_55
inc_error_cnt
sub_55: jr c,sub_56
inc_error_cnt
sub_56: jr nz,sub_57
inc_error_cnt
sub_57: sub a,(iy+0)
jp p,sub_58
inc_error_cnt
sub_58: jp po,sub_59
inc_error_cnt
sub_59: jr nc,sub_60
inc_error_cnt
sub_60: jr z,sub_61
inc_error_cnt
sub_61: sub a,(iy+2)
jr nz,sub_62
inc_error_cnt
sub_62: cp data_80+1
jr z,sbc_0
inc_error_cnt
sbc_0: ld a,data_7f
ld b,0
sub a,b ;clear carry flag
ld b,data_ff
sbc a,b
jp m,sbc_1
inc_error_cnt
sbc_1: jp pe,sbc_2
inc_error_cnt
sbc_2: jr c,sbc_3
inc_error_cnt
sbc_3: jr nz,sbc_4
inc_error_cnt
sbc_4: ld b,data_7f
sbc a,b
jp p,sbc_5
inc_error_cnt
sbc_5: jp pe,sbc_6
inc_error_cnt
sbc_6: jr nc,sbc_7
inc_error_cnt
sbc_7: jr z,sbc_8
inc_error_cnt
sbc_8: ld b,data_ff
sbc a,b
jp po,sbc_9
inc_error_cnt
sbc_9: jr nz,sbc_10
inc_error_cnt
sbc_10: ld b,0
sbc a,b
jr z,sbc_11
inc_error_cnt
sbc_11: ld a,data_aa
ld c,data_ff
sbc a,c
jr c,sbc_12
inc_error_cnt
sbc_12: ld c,0
sbc a,c
jr nc,sbc_13
inc_error_cnt
sbc_13: cp data_aa
jr z,sbc_14
inc_error_cnt
sbc_14: ld a,data_55
ld d,data_ff
sbc a,d
jr c,sbc_15
inc_error_cnt
sbc_15: ld d,0
sbc a,d
jr nc,sbc_16
inc_error_cnt
sbc_16: cp data_55
jr z,sbc_17
inc_error_cnt
sbc_17: ld a,data_aa
ld e,data_ff
sbc a,e
jr c,sbc_18
inc_error_cnt
sbc_18: ld e,0
sbc a,e
jr nc,sbc_19
inc_error_cnt
sbc_19: cp data_aa
jr z,sbc_20
inc_error_cnt
sbc_20: ld a,data_55
ld h,data_ff
sbc a,h
jr c,sbc_21
inc_error_cnt
sbc_21: ld h,0
sbc a,h
jr nc,sbc_22
inc_error_cnt
sbc_22: cp data_55
jr z,sbc_23
inc_error_cnt
sbc_23: ld a,data_aa
ld l,data_ff
sbc a,l
jr c,sbc_24
inc_error_cnt
sbc_24: ld l,0
sbc a,l
jr nc,sbc_25
inc_error_cnt
sbc_25: cp data_aa
jr z,sbc_26
inc_error_cnt
sbc_26: ld a,data_7f
sbc a,data_ff
jp m,sbc_27
inc_error_cnt
sbc_27: jp pe,sbc_28
inc_error_cnt
sbc_28: jr c,sbc_29
inc_error_cnt
sbc_29: jr nz,sbc_30
inc_error_cnt
sbc_30: sbc a,data_7f
jp p,sbc_31
inc_error_cnt
sbc_31: jp pe,sbc_32
inc_error_cnt
sbc_32: jr nc,sbc_33
inc_error_cnt
sbc_33: jr z,sbc_34
inc_error_cnt
sbc_34: sbc a,data_ff
jr nz,sbc_35
inc_error_cnt
sbc_35: cp 1
jr z,sbc_36
inc_error_cnt
sbc_36: ld hl,var1
ld a,data_7f
sbc a,(hl)
jp m,sbc_37
inc_error_cnt
sbc_37: jp pe,sbc_38
inc_error_cnt
sbc_38: jr c,sbc_39
inc_error_cnt
sbc_39: jr nz,sbc_40
inc_error_cnt
sbc_40: ld hl,var5
sbc a,(hl)
jp p,sbc_41
inc_error_cnt
sbc_41: jp pe,sbc_42
inc_error_cnt
sbc_42: jr nc,sbc_43
inc_error_cnt
sbc_43: jr z,sbc_44
inc_error_cnt <