Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
9837 turbocat 1
; For assembly by NASM only
2
bits 32
3
 
4
; Theory of operation
5
 
6
; EDI=General purpose
7
; ESI=Program counter + base address
8
; EBP=z80Base
9
; AX=AF
10
; BX=HL
11
; CX=BC
12
; DX=General purpose
13
 
14
; Using stack calling conventions
15
; Extended input/output instructions treat (C) as I/O address
16
 
17
IFF1		equ	01h
18
IFF2		equ	02h
19
CPUREG_PC		equ	00h
20
CPUREG_SP		equ	01h
21
CPUREG_AF		equ	02h
22
CPUREG_BC		equ	03h
23
CPUREG_DE		equ	04h
24
CPUREG_HL		equ	05h
25
CPUREG_AFPRIME		equ	06h
26
CPUREG_BCPRIME		equ	07h
27
CPUREG_DEPRIME		equ	08h
28
CPUREG_HLPRIME		equ	09h
29
CPUREG_IX		equ	0ah
30
CPUREG_IY		equ	0bh
31
CPUREG_I		equ	0ch
32
CPUREG_A		equ	0dh
33
CPUREG_F		equ	0eh
34
CPUREG_B		equ	0fh
35
CPUREG_C		equ	10h
36
CPUREG_D		equ	11h
37
CPUREG_E		equ	12h
38
CPUREG_H		equ	13h
39
CPUREG_L		equ	14h
40
CPUREG_IFF1		equ	15h
41
CPUREG_IFF2		equ	16h
42
CPUREG_CARRY		equ	17h
43
CPUREG_NEGATIVE		equ	18h
44
CPUREG_PARITY		equ	19h
45
CPUREG_OVERFLOW		equ	1ah
46
CPUREG_HALFCARRY		equ	1bh
47
CPUREG_ZERO		equ	1ch
48
CPUREG_SIGN		equ	1dh
49
CPUREG_MAXINDEX		equ	1eh
50
 
51
 
52
 
53
		section	.data	use32 flat class=data
54
 
55
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
56
 
57
		global	_mz80contextBegin
58
_mz80contextBegin:
59
		global	_z80pc
60
		global	z80pc_
61
		global	z80pc
62
		global	_z80nmiAddr
63
		global	_z80intAddr
64
		global	z80intAddr
65
 
66
; DO NOT CHANGE THE ORDER OF AF, BC, DE, HL and THE PRIME REGISTERS!
67
 
68
_z80Base	dd	0	; Base address for Z80 stuff
69
_z80MemRead	dd	0	; Offset of memory read structure array
70
_z80MemWrite	dd	0	; Offset of memory write structure array
71
_z80IoRead	dd	0	; Base address for I/O reads list
72
_z80IoWrite	dd	0	; Base address for I/O write list
73
_z80clockticks	dd	0	; # Of clock tips that have elapsed
74
_z80iff	dd	0	; Non-zero if we're in an interrupt
75
_z80interruptMode dd	0	; Interrupt mode
76
_z80halted	dd	0	; 0=Not halted, 1=Halted
77
_z80af		dd	0	; A Flag & Flags
78
_z80bc		dd	0	; BC
79
_z80de		dd	0	; DE
80
_z80hl		dd	0	; HL
81
_z80afprime	dd	0	; A Flag & Flags prime
82
_z80bcprime	dd	0	; BC prime
83
_z80deprime	dd	0	; DE prime
84
_z80hlprime	dd	0	; HL prime
85
 
86
; The order of the following registers can be changed without adverse
87
; effect. Keep the WORD and DWORDs on boundaries of two for faster access
88
 
89
_z80ix		dd	0	; IX
90
_z80iy		dd	0	; IY
91
_z80sp		dd	0	; Stack pointer
92
z80pc:
93
z80pc_:
94
_z80pc		dd	0	; PC
95
_z80nmiAddr	dd	0	; Address to jump to for NMI
96
z80intAddr:
97
_z80intAddr	dd	0	; Address to jump to for INT
98
_z80rCounter	dd	0	; R Register counter
99
_z80i		db	0	; I register
100
_z80r		db	0	; R register
101
_z80intPending	db	0	; Non-zero if an interrupt is pending
102
 
103
_mz80contextEnd:
104
 
105
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
106
 
107
dwElapsedTicks	dd	0	; # Of ticks elapsed
108
cyclesRemaining	dd	0	; # Of cycles remaining
109
dwOriginalExec	dd	0	; # Of cycles originally executing
110
dwLastRSample	dd	0	; Last sample for R computation
111
dwEITiming	dd	0	; Used when we cause an interrupt
112
_orgval	dw	0	; Scratch area
113
_orgval2	dw	0	; Scratch area
114
_wordval	dw	0	; Scratch area
115
_intData	db	0	; Interrupt data when an interrupt is pending
116
bEIExit	db	0	; Are we exiting because of an EI instruction?
117
 
118
RegTextPC	db	'PC',0
119
RegTextAF	db	'AF',0
120
RegTextBC	db	'BC',0
121
RegTextDE	db	'DE',0
122
RegTextHL	db	'HL',0
123
RegTextAFP	db	'AF',27h,0
124
RegTextBCP	db	'BC',27h,0
125
RegTextDEP	db	'DE',27h,0
126
RegTextHLP	db	'HL',27h,0
127
RegTextIX	db	'IX',0
128
RegTextIY	db	'IY',0
129
RegTextSP	db	'SP',0
130
RegTextI	db	'I',0
131
RegTextR	db	'R',0
132
RegTextA	db	'A',0
133
RegTextB	db	'B',0
134
RegTextC	db	'C',0
135
RegTextD	db	'D',0
136
RegTextE	db	'E',0
137
RegTextH	db	'H',0
138
RegTextL	db	'L',0
139
RegTextF	db	'F',0
140
RegTextCarry	db	'Carry',0
141
RegTextNegative	db	'Negative',0
142
RegTextParity	db	'Parity',0
143
RegTextOverflow	db	'Overflow',0
144
RegTextHalfCarry	db	'HalfCarry',0
145
RegTextZero	db	'Zero',0
146
RegTextSign	db	'Sign',0
147
RegTextIFF1	db	'IFF1',0
148
RegTextIFF2	db	'IFF2',0
149
 
150
intModeTStates:
151
		db	13	; IM 0 - 13 T-States
152
		db	11	; IM 1 - 11 T-States
153
		db	11	; IM 2 - 11 T-States
154
 
155
 
156
;
157
; Info is in: pointer to text, address, shift value, mask value, size of data chunk
158
;
159
 
160
RegTable:
161
		dd	RegTextPC, _z80pc - _mz80contextBegin, 0, 0ffffh
162
		dd	RegTextSP, _z80sp - _mz80contextBegin, 0, 0ffffh
163
		dd	RegTextAF, _z80af - _mz80contextBegin, 0, 0ffffh
164
		dd	RegTextBC, _z80bc - _mz80contextBegin, 0, 0ffffh
165
		dd	RegTextDE, _z80de - _mz80contextBegin, 0, 0ffffh
166
		dd	RegTextHL, _z80hl - _mz80contextBegin, 0, 0ffffh
167
		dd	RegTextAFP, _z80af - _mz80contextBegin, 0, 0ffffh
168
		dd	RegTextBCP, _z80bc - _mz80contextBegin, 0, 0ffffh
169
		dd	RegTextDEP, _z80de - _mz80contextBegin, 0, 0ffffh
170
		dd	RegTextHLP, _z80hl - _mz80contextBegin, 0, 0ffffh
171
		dd	RegTextIX, _z80ix - _mz80contextBegin, 0, 0ffffh
172
		dd	RegTextIY, _z80iy - _mz80contextBegin, 0, 0ffffh
173
		dd	RegTextI, _z80i - _mz80contextBegin, 0, 0ffh
174
		dd	RegTextR, _z80r - _mz80contextBegin, 0, 0ffh
175
		dd	RegTextA, (_z80af + 1) - _mz80contextBegin, 0, 0ffh
176
		dd	RegTextF, _z80af - _mz80contextBegin, 0, 0ffh
177
		dd	RegTextB, (_z80bc + 1) - _mz80contextBegin, 0, 0ffh
178
		dd	RegTextC, _z80bc - _mz80contextBegin, 0, 0ffh
179
		dd	RegTextD, (_z80de + 1) - _mz80contextBegin, 0, 0ffh
180
		dd	RegTextE, _z80de - _mz80contextBegin, 0, 0ffh
181
		dd	RegTextH, (_z80hl + 1) - _mz80contextBegin, 0, 0ffh
182
		dd	RegTextL, _z80hl - _mz80contextBegin, 0, 0ffh
183
		dd	RegTextIFF1, _z80iff - _mz80contextBegin, 0, 01h
184
		dd	RegTextIFF2, _z80iff - _mz80contextBegin, 1, 01h
185
		dd	RegTextCarry, _z80af - _mz80contextBegin, 0, 01h
186
		dd	RegTextNegative, _z80af - _mz80contextBegin, 1, 01h
187
		dd	RegTextParity, _z80af - _mz80contextBegin, 2, 01h
188
		dd	RegTextOverflow, _z80af - _mz80contextBegin, 2, 01h
189
		dd	RegTextHalfCarry, _z80af - _mz80contextBegin, 4, 01h
190
		dd	RegTextZero, _z80af - _mz80contextBegin, 6, 01h
191
		dd	RegTextSign, _z80af - _mz80contextBegin, 7, 01h
192
 
193
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
194
 
195
z80regular:
196
		dd	RegInst00
197
		dd	RegInst01
198
		dd	RegInst02
199
		dd	RegInst03
200
		dd	RegInst04
201
		dd	RegInst05
202
		dd	RegInst06
203
		dd	RegInst07
204
		dd	RegInst08
205
		dd	RegInst09
206
		dd	RegInst0a
207
		dd	RegInst0b
208
		dd	RegInst0c
209
		dd	RegInst0d
210
		dd	RegInst0e
211
		dd	RegInst0f
212
		dd	RegInst10
213
		dd	RegInst11
214
		dd	RegInst12
215
		dd	RegInst13
216
		dd	RegInst14
217
		dd	RegInst15
218
		dd	RegInst16
219
		dd	RegInst17
220
		dd	RegInst18
221
		dd	RegInst19
222
		dd	RegInst1a
223
		dd	RegInst1b
224
		dd	RegInst1c
225
		dd	RegInst1d
226
		dd	RegInst1e
227
		dd	RegInst1f
228
		dd	RegInst20
229
		dd	RegInst21
230
		dd	RegInst22
231
		dd	RegInst23
232
		dd	RegInst24
233
		dd	RegInst25
234
		dd	RegInst26
235
		dd	RegInst27
236
		dd	RegInst28
237
		dd	RegInst29
238
		dd	RegInst2a
239
		dd	RegInst2b
240
		dd	RegInst2c
241
		dd	RegInst2d
242
		dd	RegInst2e
243
		dd	RegInst2f
244
		dd	RegInst30
245
		dd	RegInst31
246
		dd	RegInst32
247
		dd	RegInst33
248
		dd	RegInst34
249
		dd	RegInst35
250
		dd	RegInst36
251
		dd	RegInst37
252
		dd	RegInst38
253
		dd	RegInst39
254
		dd	RegInst3a
255
		dd	RegInst3b
256
		dd	RegInst3c
257
		dd	RegInst3d
258
		dd	RegInst3e
259
		dd	RegInst3f
260
		dd	RegInst40
261
		dd	RegInst41
262
		dd	RegInst42
263
		dd	RegInst43
264
		dd	RegInst44
265
		dd	RegInst45
266
		dd	RegInst46
267
		dd	RegInst47
268
		dd	RegInst48
269
		dd	RegInst49
270
		dd	RegInst4a
271
		dd	RegInst4b
272
		dd	RegInst4c
273
		dd	RegInst4d
274
		dd	RegInst4e
275
		dd	RegInst4f
276
		dd	RegInst50
277
		dd	RegInst51
278
		dd	RegInst52
279
		dd	RegInst53
280
		dd	RegInst54
281
		dd	RegInst55
282
		dd	RegInst56
283
		dd	RegInst57
284
		dd	RegInst58
285
		dd	RegInst59
286
		dd	RegInst5a
287
		dd	RegInst5b
288
		dd	RegInst5c
289
		dd	RegInst5d
290
		dd	RegInst5e
291
		dd	RegInst5f
292
		dd	RegInst60
293
		dd	RegInst61
294
		dd	RegInst62
295
		dd	RegInst63
296
		dd	RegInst64
297
		dd	RegInst65
298
		dd	RegInst66
299
		dd	RegInst67
300
		dd	RegInst68
301
		dd	RegInst69
302
		dd	RegInst6a
303
		dd	RegInst6b
304
		dd	RegInst6c
305
		dd	RegInst6d
306
		dd	RegInst6e
307
		dd	RegInst6f
308
		dd	RegInst70
309
		dd	RegInst71
310
		dd	RegInst72
311
		dd	RegInst73
312
		dd	RegInst74
313
		dd	RegInst75
314
		dd	RegInst76
315
		dd	RegInst77
316
		dd	RegInst78
317
		dd	RegInst79
318
		dd	RegInst7a
319
		dd	RegInst7b
320
		dd	RegInst7c
321
		dd	RegInst7d
322
		dd	RegInst7e
323
		dd	RegInst7f
324
		dd	RegInst80
325
		dd	RegInst81
326
		dd	RegInst82
327
		dd	RegInst83
328
		dd	RegInst84
329
		dd	RegInst85
330
		dd	RegInst86
331
		dd	RegInst87
332
		dd	RegInst88
333
		dd	RegInst89
334
		dd	RegInst8a
335
		dd	RegInst8b
336
		dd	RegInst8c
337
		dd	RegInst8d
338
		dd	RegInst8e
339
		dd	RegInst8f
340
		dd	RegInst90
341
		dd	RegInst91
342
		dd	RegInst92
343
		dd	RegInst93
344
		dd	RegInst94
345
		dd	RegInst95
346
		dd	RegInst96
347
		dd	RegInst97
348
		dd	RegInst98
349
		dd	RegInst99
350
		dd	RegInst9a
351
		dd	RegInst9b
352
		dd	RegInst9c
353
		dd	RegInst9d
354
		dd	RegInst9e
355
		dd	RegInst9f
356
		dd	RegInsta0
357
		dd	RegInsta1
358
		dd	RegInsta2
359
		dd	RegInsta3
360
		dd	RegInsta4
361
		dd	RegInsta5
362
		dd	RegInsta6
363
		dd	RegInsta7
364
		dd	RegInsta8
365
		dd	RegInsta9
366
		dd	RegInstaa
367
		dd	RegInstab
368
		dd	RegInstac
369
		dd	RegInstad
370
		dd	RegInstae
371
		dd	RegInstaf
372
		dd	RegInstb0
373
		dd	RegInstb1
374
		dd	RegInstb2
375
		dd	RegInstb3
376
		dd	RegInstb4
377
		dd	RegInstb5
378
		dd	RegInstb6
379
		dd	RegInstb7
380
		dd	RegInstb8
381
		dd	RegInstb9
382
		dd	RegInstba
383
		dd	RegInstbb
384
		dd	RegInstbc
385
		dd	RegInstbd
386
		dd	RegInstbe
387
		dd	RegInstbf
388
		dd	RegInstc0
389
		dd	RegInstc1
390
		dd	RegInstc2
391
		dd	RegInstc3
392
		dd	RegInstc4
393
		dd	RegInstc5
394
		dd	RegInstc6
395
		dd	RegInstc7
396
		dd	RegInstc8
397
		dd	RegInstc9
398
		dd	RegInstca
399
		dd	RegInstcb
400
		dd	RegInstcc
401
		dd	RegInstcd
402
		dd	RegInstce
403
		dd	RegInstcf
404
		dd	RegInstd0
405
		dd	RegInstd1
406
		dd	RegInstd2
407
		dd	RegInstd3
408
		dd	RegInstd4
409
		dd	RegInstd5
410
		dd	RegInstd6
411
		dd	RegInstd7
412
		dd	RegInstd8
413
		dd	RegInstd9
414
		dd	RegInstda
415
		dd	RegInstdb
416
		dd	RegInstdc
417
		dd	RegInstdd
418
		dd	RegInstde
419
		dd	RegInstdf
420
		dd	RegInste0
421
		dd	RegInste1
422
		dd	RegInste2
423
		dd	RegInste3
424
		dd	RegInste4
425
		dd	RegInste5
426
		dd	RegInste6
427
		dd	RegInste7
428
		dd	RegInste8
429
		dd	RegInste9
430
		dd	RegInstea
431
		dd	RegInsteb
432
		dd	RegInstec
433
		dd	RegInsted
434
		dd	RegInstee
435
		dd	RegInstef
436
		dd	RegInstf0
437
		dd	RegInstf1
438
		dd	RegInstf2
439
		dd	RegInstf3
440
		dd	RegInstf4
441
		dd	RegInstf5
442
		dd	RegInstf6
443
		dd	RegInstf7
444
		dd	RegInstf8
445
		dd	RegInstf9
446
		dd	RegInstfa
447
		dd	RegInstfb
448
		dd	RegInstfc
449
		dd	RegInstfd
450
		dd	RegInstfe
451
		dd	RegInstff
452
 
453
z80PrefixCB:
454
		dd	CBInst00
455
		dd	CBInst01
456
		dd	CBInst02
457
		dd	CBInst03
458
		dd	CBInst04
459
		dd	CBInst05
460
		dd	CBInst06
461
		dd	CBInst07
462
		dd	CBInst08
463
		dd	CBInst09
464
		dd	CBInst0a
465
		dd	CBInst0b
466
		dd	CBInst0c
467
		dd	CBInst0d
468
		dd	CBInst0e
469
		dd	CBInst0f
470
		dd	CBInst10
471
		dd	CBInst11
472
		dd	CBInst12
473
		dd	CBInst13
474
		dd	CBInst14
475
		dd	CBInst15
476
		dd	CBInst16
477
		dd	CBInst17
478
		dd	CBInst18
479
		dd	CBInst19
480
		dd	CBInst1a
481
		dd	CBInst1b
482
		dd	CBInst1c
483
		dd	CBInst1d
484
		dd	CBInst1e
485
		dd	CBInst1f
486
		dd	CBInst20
487
		dd	CBInst21
488
		dd	CBInst22
489
		dd	CBInst23
490
		dd	CBInst24
491
		dd	CBInst25
492
		dd	CBInst26
493
		dd	CBInst27
494
		dd	CBInst28
495
		dd	CBInst29
496
		dd	CBInst2a
497
		dd	CBInst2b
498
		dd	CBInst2c
499
		dd	CBInst2d
500
		dd	CBInst2e
501
		dd	CBInst2f
502
		dd	CBInst30
503
		dd	CBInst31
504
		dd	CBInst32
505
		dd	CBInst33
506
		dd	CBInst34
507
		dd	CBInst35
508
		dd	CBInst36
509
		dd	CBInst37
510
		dd	CBInst38
511
		dd	CBInst39
512
		dd	CBInst3a
513
		dd	CBInst3b
514
		dd	CBInst3c
515
		dd	CBInst3d
516
		dd	CBInst3e
517
		dd	CBInst3f
518
		dd	CBInst40
519
		dd	CBInst41
520
		dd	CBInst42
521
		dd	CBInst43
522
		dd	CBInst44
523
		dd	CBInst45
524
		dd	CBInst46
525
		dd	CBInst47
526
		dd	CBInst48
527
		dd	CBInst49
528
		dd	CBInst4a
529
		dd	CBInst4b
530
		dd	CBInst4c
531
		dd	CBInst4d
532
		dd	CBInst4e
533
		dd	CBInst4f
534
		dd	CBInst50
535
		dd	CBInst51
536
		dd	CBInst52
537
		dd	CBInst53
538
		dd	CBInst54
539
		dd	CBInst55
540
		dd	CBInst56
541
		dd	CBInst57
542
		dd	CBInst58
543
		dd	CBInst59
544
		dd	CBInst5a
545
		dd	CBInst5b
546
		dd	CBInst5c
547
		dd	CBInst5d
548
		dd	CBInst5e
549
		dd	CBInst5f
550
		dd	CBInst60
551
		dd	CBInst61
552
		dd	CBInst62
553
		dd	CBInst63
554
		dd	CBInst64
555
		dd	CBInst65
556
		dd	CBInst66
557
		dd	CBInst67
558
		dd	CBInst68
559
		dd	CBInst69
560
		dd	CBInst6a
561
		dd	CBInst6b
562
		dd	CBInst6c
563
		dd	CBInst6d
564
		dd	CBInst6e
565
		dd	CBInst6f
566
		dd	CBInst70
567
		dd	CBInst71
568
		dd	CBInst72
569
		dd	CBInst73
570
		dd	CBInst74
571
		dd	CBInst75
572
		dd	CBInst76
573
		dd	CBInst77
574
		dd	CBInst78
575
		dd	CBInst79
576
		dd	CBInst7a
577
		dd	CBInst7b
578
		dd	CBInst7c
579
		dd	CBInst7d
580
		dd	CBInst7e
581
		dd	CBInst7f
582
		dd	CBInst80
583
		dd	CBInst81
584
		dd	CBInst82
585
		dd	CBInst83
586
		dd	CBInst84
587
		dd	CBInst85
588
		dd	CBInst86
589
		dd	CBInst87
590
		dd	CBInst88
591
		dd	CBInst89
592
		dd	CBInst8a
593
		dd	CBInst8b
594
		dd	CBInst8c
595
		dd	CBInst8d
596
		dd	CBInst8e
597
		dd	CBInst8f
598
		dd	CBInst90
599
		dd	CBInst91
600
		dd	CBInst92
601
		dd	CBInst93
602
		dd	CBInst94
603
		dd	CBInst95
604
		dd	CBInst96
605
		dd	CBInst97
606
		dd	CBInst98
607
		dd	CBInst99
608
		dd	CBInst9a
609
		dd	CBInst9b
610
		dd	CBInst9c
611
		dd	CBInst9d
612
		dd	CBInst9e
613
		dd	CBInst9f
614
		dd	CBInsta0
615
		dd	CBInsta1
616
		dd	CBInsta2
617
		dd	CBInsta3
618
		dd	CBInsta4
619
		dd	CBInsta5
620
		dd	CBInsta6
621
		dd	CBInsta7
622
		dd	CBInsta8
623
		dd	CBInsta9
624
		dd	CBInstaa
625
		dd	CBInstab
626
		dd	CBInstac
627
		dd	CBInstad
628
		dd	CBInstae
629
		dd	CBInstaf
630
		dd	CBInstb0
631
		dd	CBInstb1
632
		dd	CBInstb2
633
		dd	CBInstb3
634
		dd	CBInstb4
635
		dd	CBInstb5
636
		dd	CBInstb6
637
		dd	CBInstb7
638
		dd	CBInstb8
639
		dd	CBInstb9
640
		dd	CBInstba
641
		dd	CBInstbb
642
		dd	CBInstbc
643
		dd	CBInstbd
644
		dd	CBInstbe
645
		dd	CBInstbf
646
		dd	CBInstc0
647
		dd	CBInstc1
648
		dd	CBInstc2
649
		dd	CBInstc3
650
		dd	CBInstc4
651
		dd	CBInstc5
652
		dd	CBInstc6
653
		dd	CBInstc7
654
		dd	CBInstc8
655
		dd	CBInstc9
656
		dd	CBInstca
657
		dd	CBInstcb
658
		dd	CBInstcc
659
		dd	CBInstcd
660
		dd	CBInstce
661
		dd	CBInstcf
662
		dd	CBInstd0
663
		dd	CBInstd1
664
		dd	CBInstd2
665
		dd	CBInstd3
666
		dd	CBInstd4
667
		dd	CBInstd5
668
		dd	CBInstd6
669
		dd	CBInstd7
670
		dd	CBInstd8
671
		dd	CBInstd9
672
		dd	CBInstda
673
		dd	CBInstdb
674
		dd	CBInstdc
675
		dd	CBInstdd
676
		dd	CBInstde
677
		dd	CBInstdf
678
		dd	CBInste0
679
		dd	CBInste1
680
		dd	CBInste2
681
		dd	CBInste3
682
		dd	CBInste4
683
		dd	CBInste5
684
		dd	CBInste6
685
		dd	CBInste7
686
		dd	CBInste8
687
		dd	CBInste9
688
		dd	CBInstea
689
		dd	CBInsteb
690
		dd	CBInstec
691
		dd	CBInsted
692
		dd	CBInstee
693
		dd	CBInstef
694
		dd	CBInstf0
695
		dd	CBInstf1
696
		dd	CBInstf2
697
		dd	CBInstf3
698
		dd	CBInstf4
699
		dd	CBInstf5
700
		dd	CBInstf6
701
		dd	CBInstf7
702
		dd	CBInstf8
703
		dd	CBInstf9
704
		dd	CBInstfa
705
		dd	CBInstfb
706
		dd	CBInstfc
707
		dd	CBInstfd
708
		dd	CBInstfe
709
		dd	CBInstff
710
 
711
z80PrefixED:
712
		dd	invalidInsWord
713
		dd	invalidInsWord
714
		dd	invalidInsWord
715
		dd	invalidInsWord
716
		dd	invalidInsWord
717
		dd	invalidInsWord
718
		dd	invalidInsWord
719
		dd	invalidInsWord
720
		dd	invalidInsWord
721
		dd	invalidInsWord
722
		dd	invalidInsWord
723
		dd	invalidInsWord
724
		dd	invalidInsWord
725
		dd	invalidInsWord
726
		dd	invalidInsWord
727
		dd	invalidInsWord
728
		dd	invalidInsWord
729
		dd	invalidInsWord
730
		dd	invalidInsWord
731
		dd	invalidInsWord
732
		dd	invalidInsWord
733
		dd	invalidInsWord
734
		dd	invalidInsWord
735
		dd	invalidInsWord
736
		dd	invalidInsWord
737
		dd	invalidInsWord
738
		dd	invalidInsWord
739
		dd	invalidInsWord
740
		dd	invalidInsWord
741
		dd	invalidInsWord
742
		dd	invalidInsWord
743
		dd	invalidInsWord
744
		dd	invalidInsWord
745
		dd	invalidInsWord
746
		dd	invalidInsWord
747
		dd	invalidInsWord
748
		dd	invalidInsWord
749
		dd	invalidInsWord
750
		dd	invalidInsWord
751
		dd	invalidInsWord
752
		dd	invalidInsWord
753
		dd	invalidInsWord
754
		dd	invalidInsWord
755
		dd	invalidInsWord
756
		dd	invalidInsWord
757
		dd	invalidInsWord
758
		dd	invalidInsWord
759
		dd	invalidInsWord
760
		dd	invalidInsWord
761
		dd	invalidInsWord
762
		dd	invalidInsWord
763
		dd	invalidInsWord
764
		dd	invalidInsWord
765
		dd	invalidInsWord
766
		dd	invalidInsWord
767
		dd	invalidInsWord
768
		dd	invalidInsWord
769
		dd	invalidInsWord
770
		dd	invalidInsWord
771
		dd	invalidInsWord
772
		dd	invalidInsWord
773
		dd	invalidInsWord
774
		dd	invalidInsWord
775
		dd	invalidInsWord
776
		dd	EDInst40
777
		dd	EDInst41
778
		dd	EDInst42
779
		dd	EDInst43
780
		dd	EDInst44
781
		dd	EDInst45
782
		dd	EDInst46
783
		dd	EDInst47
784
		dd	EDInst48
785
		dd	EDInst49
786
		dd	EDInst4a
787
		dd	EDInst4b
788
		dd	invalidInsWord
789
		dd	EDInst4d
790
		dd	invalidInsWord
791
		dd	EDInst4f
792
		dd	EDInst50
793
		dd	EDInst51
794
		dd	EDInst52
795
		dd	EDInst53
796
		dd	invalidInsWord
797
		dd	invalidInsWord
798
		dd	EDInst56
799
		dd	EDInst57
800
		dd	EDInst58
801
		dd	EDInst59
802
		dd	EDInst5a
803
		dd	EDInst5b
804
		dd	invalidInsWord
805
		dd	invalidInsWord
806
		dd	EDInst5e
807
		dd	EDInst5f
808
		dd	EDInst60
809
		dd	EDInst61
810
		dd	EDInst62
811
		dd	EDInst63
812
		dd	invalidInsWord
813
		dd	invalidInsWord
814
		dd	invalidInsWord
815
		dd	EDInst67
816
		dd	EDInst68
817
		dd	EDInst69
818
		dd	EDInst6a
819
		dd	invalidInsWord
820
		dd	invalidInsWord
821
		dd	invalidInsWord
822
		dd	invalidInsWord
823
		dd	EDInst6f
824
		dd	invalidInsWord
825
		dd	invalidInsWord
826
		dd	EDInst72
827
		dd	EDInst73
828
		dd	invalidInsWord
829
		dd	invalidInsWord
830
		dd	invalidInsWord
831
		dd	invalidInsWord
832
		dd	EDInst78
833
		dd	EDInst79
834
		dd	EDInst7a
835
		dd	EDInst7b
836
		dd	invalidInsWord
837
		dd	invalidInsWord
838
		dd	invalidInsWord
839
		dd	invalidInsWord
840
		dd	invalidInsWord
841
		dd	invalidInsWord
842
		dd	invalidInsWord
843
		dd	invalidInsWord
844
		dd	invalidInsWord
845
		dd	invalidInsWord
846
		dd	invalidInsWord
847
		dd	invalidInsWord
848
		dd	invalidInsWord
849
		dd	invalidInsWord
850
		dd	invalidInsWord
851
		dd	invalidInsWord
852
		dd	invalidInsWord
853
		dd	invalidInsWord
854
		dd	invalidInsWord
855
		dd	invalidInsWord
856
		dd	invalidInsWord
857
		dd	invalidInsWord
858
		dd	invalidInsWord
859
		dd	invalidInsWord
860
		dd	invalidInsWord
861
		dd	invalidInsWord
862
		dd	invalidInsWord
863
		dd	invalidInsWord
864
		dd	invalidInsWord
865
		dd	invalidInsWord
866
		dd	invalidInsWord
867
		dd	invalidInsWord
868
		dd	invalidInsWord
869
		dd	invalidInsWord
870
		dd	invalidInsWord
871
		dd	invalidInsWord
872
		dd	EDInsta0
873
		dd	EDInsta1
874
		dd	EDInsta2
875
		dd	EDInsta3
876
		dd	invalidInsWord
877
		dd	invalidInsWord
878
		dd	invalidInsWord
879
		dd	invalidInsWord
880
		dd	EDInsta8
881
		dd	EDInsta9
882
		dd	EDInstaa
883
		dd	EDInstab
884
		dd	invalidInsWord
885
		dd	invalidInsWord
886
		dd	invalidInsWord
887
		dd	invalidInsWord
888
		dd	EDInstb0
889
		dd	EDInstb1
890
		dd	EDInstb2
891
		dd	EDInstb3
892
		dd	invalidInsWord
893
		dd	invalidInsWord
894
		dd	invalidInsWord
895
		dd	invalidInsWord
896
		dd	EDInstb8
897
		dd	EDInstb9
898
		dd	EDInstba
899
		dd	EDInstbb
900
		dd	invalidInsWord
901
		dd	invalidInsWord
902
		dd	invalidInsWord
903
		dd	invalidInsWord
904
		dd	invalidInsWord
905
		dd	invalidInsWord
906
		dd	invalidInsWord
907
		dd	invalidInsWord
908
		dd	invalidInsWord
909
		dd	invalidInsWord
910
		dd	invalidInsWord
911
		dd	invalidInsWord
912
		dd	invalidInsWord
913
		dd	invalidInsWord
914
		dd	invalidInsWord
915
		dd	invalidInsWord
916
		dd	invalidInsWord
917
		dd	invalidInsWord
918
		dd	invalidInsWord
919
		dd	invalidInsWord
920
		dd	invalidInsWord
921
		dd	invalidInsWord
922
		dd	invalidInsWord
923
		dd	invalidInsWord
924
		dd	invalidInsWord
925
		dd	invalidInsWord
926
		dd	invalidInsWord
927
		dd	invalidInsWord
928
		dd	invalidInsWord
929
		dd	invalidInsWord
930
		dd	invalidInsWord
931
		dd	invalidInsWord
932
		dd	invalidInsWord
933
		dd	invalidInsWord
934
		dd	invalidInsWord
935
		dd	invalidInsWord
936
		dd	invalidInsWord
937
		dd	invalidInsWord
938
		dd	invalidInsWord
939
		dd	invalidInsWord
940
		dd	invalidInsWord
941
		dd	invalidInsWord
942
		dd	invalidInsWord
943
		dd	invalidInsWord
944
		dd	invalidInsWord
945
		dd	invalidInsWord
946
		dd	invalidInsWord
947
		dd	invalidInsWord
948
		dd	invalidInsWord
949
		dd	invalidInsWord
950
		dd	invalidInsWord
951
		dd	invalidInsWord
952
		dd	invalidInsWord
953
		dd	invalidInsWord
954
		dd	invalidInsWord
955
		dd	invalidInsWord
956
		dd	invalidInsWord
957
		dd	invalidInsWord
958
		dd	invalidInsWord
959
		dd	invalidInsWord
960
		dd	invalidInsWord
961
		dd	invalidInsWord
962
		dd	invalidInsWord
963
		dd	invalidInsWord
964
		dd	invalidInsWord
965
		dd	invalidInsWord
966
		dd	invalidInsWord
967
		dd	invalidInsWord
968
 
969
z80PrefixDD:
970
		dd	invalidInsWord
971
		dd	invalidInsWord
972
		dd	invalidInsWord
973
		dd	invalidInsWord
974
		dd	invalidInsWord
975
		dd	invalidInsWord
976
		dd	invalidInsWord
977
		dd	invalidInsWord
978
		dd	invalidInsWord
979
		dd	DDInst09
980
		dd	invalidInsWord
981
		dd	invalidInsWord
982
		dd	invalidInsWord
983
		dd	invalidInsWord
984
		dd	invalidInsWord
985
		dd	invalidInsWord
986
		dd	invalidInsWord
987
		dd	invalidInsWord
988
		dd	invalidInsWord
989
		dd	invalidInsWord
990
		dd	invalidInsWord
991
		dd	invalidInsWord
992
		dd	invalidInsWord
993
		dd	invalidInsWord
994
		dd	invalidInsWord
995
		dd	DDInst19
996
		dd	invalidInsWord
997
		dd	invalidInsWord
998
		dd	invalidInsWord
999
		dd	invalidInsWord
1000
		dd	invalidInsWord
1001
		dd	invalidInsWord
1002
		dd	invalidInsWord
1003
		dd	DDInst21
1004
		dd	DDInst22
1005
		dd	DDInst23
1006
		dd	DDInst24
1007
		dd	DDInst25
1008
		dd	DDInst26
1009
		dd	invalidInsWord
1010
		dd	invalidInsWord
1011
		dd	DDInst29
1012
		dd	DDInst2a
1013
		dd	DDInst2b
1014
		dd	DDInst2c
1015
		dd	DDInst2d
1016
		dd	DDInst2e
1017
		dd	invalidInsWord
1018
		dd	invalidInsWord
1019
		dd	invalidInsWord
1020
		dd	invalidInsWord
1021
		dd	invalidInsWord
1022
		dd	DDInst34
1023
		dd	DDInst35
1024
		dd	DDInst36
1025
		dd	invalidInsWord
1026
		dd	invalidInsWord
1027
		dd	DDInst39
1028
		dd	invalidInsWord
1029
		dd	invalidInsWord
1030
		dd	invalidInsWord
1031
		dd	invalidInsWord
1032
		dd	invalidInsWord
1033
		dd	invalidInsWord
1034
		dd	invalidInsWord
1035
		dd	invalidInsWord
1036
		dd	invalidInsWord
1037
		dd	invalidInsWord
1038
		dd	DDInst44
1039
		dd	DDInst45
1040
		dd	DDInst46
1041
		dd	invalidInsWord
1042
		dd	invalidInsWord
1043
		dd	invalidInsWord
1044
		dd	invalidInsWord
1045
		dd	invalidInsWord
1046
		dd	DDInst4c
1047
		dd	DDInst4d
1048
		dd	DDInst4e
1049
		dd	invalidInsWord
1050
		dd	invalidInsWord
1051
		dd	invalidInsWord
1052
		dd	invalidInsWord
1053
		dd	invalidInsWord
1054
		dd	DDInst54
1055
		dd	DDInst55
1056
		dd	DDInst56
1057
		dd	invalidInsWord
1058
		dd	invalidInsWord
1059
		dd	invalidInsWord
1060
		dd	invalidInsWord
1061
		dd	invalidInsWord
1062
		dd	DDInst5c
1063
		dd	DDInst5d
1064
		dd	DDInst5e
1065
		dd	invalidInsWord
1066
		dd	DDInst60
1067
		dd	DDInst61
1068
		dd	DDInst62
1069
		dd	DDInst63
1070
		dd	DDInst64
1071
		dd	DDInst65
1072
		dd	DDInst66
1073
		dd	DDInst67
1074
		dd	DDInst68
1075
		dd	DDInst69
1076
		dd	DDInst6a
1077
		dd	DDInst6b
1078
		dd	DDInst6c
1079
		dd	DDInst6d
1080
		dd	DDInst6e
1081
		dd	DDInst6f
1082
		dd	DDInst70
1083
		dd	DDInst71
1084
		dd	DDInst72
1085
		dd	DDInst73
1086
		dd	DDInst74
1087
		dd	DDInst75
1088
		dd	invalidInsWord
1089
		dd	DDInst77
1090
		dd	invalidInsWord
1091
		dd	invalidInsWord
1092
		dd	invalidInsWord
1093
		dd	invalidInsWord
1094
		dd	DDInst7c
1095
		dd	DDInst7d
1096
		dd	DDInst7e
1097
		dd	invalidInsWord
1098
		dd	invalidInsWord
1099
		dd	invalidInsWord
1100
		dd	invalidInsWord
1101
		dd	invalidInsWord
1102
		dd	DDInst84
1103
		dd	DDInst85
1104
		dd	DDInst86
1105
		dd	invalidInsWord
1106
		dd	invalidInsWord
1107
		dd	invalidInsWord
1108
		dd	invalidInsWord
1109
		dd	invalidInsWord
1110
		dd	DDInst8c
1111
		dd	DDInst8d
1112
		dd	DDInst8e
1113
		dd	invalidInsWord
1114
		dd	invalidInsWord
1115
		dd	invalidInsWord
1116
		dd	invalidInsWord
1117
		dd	invalidInsWord
1118
		dd	DDInst94
1119
		dd	DDInst95
1120
		dd	DDInst96
1121
		dd	invalidInsWord
1122
		dd	invalidInsWord
1123
		dd	invalidInsWord
1124
		dd	invalidInsWord
1125
		dd	invalidInsWord
1126
		dd	DDInst9c
1127
		dd	DDInst9d
1128
		dd	DDInst9e
1129
		dd	invalidInsWord
1130
		dd	invalidInsWord
1131
		dd	invalidInsWord
1132
		dd	invalidInsWord
1133
		dd	invalidInsWord
1134
		dd	DDInsta4
1135
		dd	DDInsta5
1136
		dd	DDInsta6
1137
		dd	invalidInsWord
1138
		dd	invalidInsWord
1139
		dd	invalidInsWord
1140
		dd	invalidInsWord
1141
		dd	invalidInsWord
1142
		dd	DDInstac
1143
		dd	DDInstad
1144
		dd	DDInstae
1145
		dd	invalidInsWord
1146
		dd	invalidInsWord
1147
		dd	invalidInsWord
1148
		dd	invalidInsWord
1149
		dd	invalidInsWord
1150
		dd	DDInstb4
1151
		dd	DDInstb5
1152
		dd	DDInstb6
1153
		dd	invalidInsWord
1154
		dd	invalidInsWord
1155
		dd	invalidInsWord
1156
		dd	invalidInsWord
1157
		dd	invalidInsWord
1158
		dd	DDInstbc
1159
		dd	DDInstbd
1160
		dd	DDInstbe
1161
		dd	invalidInsWord
1162
		dd	invalidInsWord
1163
		dd	invalidInsWord
1164
		dd	invalidInsWord
1165
		dd	invalidInsWord
1166
		dd	invalidInsWord
1167
		dd	invalidInsWord
1168
		dd	invalidInsWord
1169
		dd	invalidInsWord
1170
		dd	invalidInsWord
1171
		dd	invalidInsWord
1172
		dd	invalidInsWord
1173
		dd	DDInstcb
1174
		dd	invalidInsWord
1175
		dd	invalidInsWord
1176
		dd	invalidInsWord
1177
		dd	invalidInsWord
1178
		dd	invalidInsWord
1179
		dd	invalidInsWord
1180
		dd	invalidInsWord
1181
		dd	invalidInsWord
1182
		dd	invalidInsWord
1183
		dd	invalidInsWord
1184
		dd	invalidInsWord
1185
		dd	invalidInsWord
1186
		dd	invalidInsWord
1187
		dd	invalidInsWord
1188
		dd	invalidInsWord
1189
		dd	invalidInsWord
1190
		dd	invalidInsWord
1191
		dd	invalidInsWord
1192
		dd	invalidInsWord
1193
		dd	invalidInsWord
1194
		dd	invalidInsWord
1195
		dd	DDInste1
1196
		dd	invalidInsWord
1197
		dd	DDInste3
1198
		dd	invalidInsWord
1199
		dd	DDInste5
1200
		dd	invalidInsWord
1201
		dd	invalidInsWord
1202
		dd	invalidInsWord
1203
		dd	DDInste9
1204
		dd	invalidInsWord
1205
		dd	invalidInsWord
1206
		dd	invalidInsWord
1207
		dd	invalidInsWord
1208
		dd	invalidInsWord
1209
		dd	invalidInsWord
1210
		dd	invalidInsWord
1211
		dd	invalidInsWord
1212
		dd	invalidInsWord
1213
		dd	invalidInsWord
1214
		dd	invalidInsWord
1215
		dd	invalidInsWord
1216
		dd	invalidInsWord
1217
		dd	invalidInsWord
1218
		dd	invalidInsWord
1219
		dd	DDInstf9
1220
		dd	invalidInsWord
1221
		dd	invalidInsWord
1222
		dd	invalidInsWord
1223
		dd	invalidInsWord
1224
		dd	invalidInsWord
1225
		dd	invalidInsWord
1226
 
1227
z80PrefixFD:
1228
		dd	invalidInsWord
1229
		dd	invalidInsWord
1230
		dd	invalidInsWord
1231
		dd	invalidInsWord
1232
		dd	invalidInsWord
1233
		dd	invalidInsWord
1234
		dd	invalidInsWord
1235
		dd	invalidInsWord
1236
		dd	invalidInsWord
1237
		dd	FDInst09
1238
		dd	invalidInsWord
1239
		dd	invalidInsWord
1240
		dd	invalidInsWord
1241
		dd	invalidInsWord
1242
		dd	invalidInsWord
1243
		dd	invalidInsWord
1244
		dd	invalidInsWord
1245
		dd	invalidInsWord
1246
		dd	invalidInsWord
1247
		dd	invalidInsWord
1248
		dd	invalidInsWord
1249
		dd	invalidInsWord
1250
		dd	invalidInsWord
1251
		dd	invalidInsWord
1252
		dd	invalidInsWord
1253
		dd	FDInst19
1254
		dd	invalidInsWord
1255
		dd	invalidInsWord
1256
		dd	invalidInsWord
1257
		dd	invalidInsWord
1258
		dd	invalidInsWord
1259
		dd	invalidInsWord
1260
		dd	invalidInsWord
1261
		dd	FDInst21
1262
		dd	FDInst22
1263
		dd	FDInst23
1264
		dd	FDInst24
1265
		dd	FDInst25
1266
		dd	FDInst26
1267
		dd	invalidInsWord
1268
		dd	invalidInsWord
1269
		dd	FDInst29
1270
		dd	FDInst2a
1271
		dd	FDInst2b
1272
		dd	FDInst2c
1273
		dd	FDInst2d
1274
		dd	FDInst2e
1275
		dd	invalidInsWord
1276
		dd	invalidInsWord
1277
		dd	invalidInsWord
1278
		dd	invalidInsWord
1279
		dd	invalidInsWord
1280
		dd	FDInst34
1281
		dd	FDInst35
1282
		dd	FDInst36
1283
		dd	invalidInsWord
1284
		dd	invalidInsWord
1285
		dd	FDInst39
1286
		dd	invalidInsWord
1287
		dd	invalidInsWord
1288
		dd	invalidInsWord
1289
		dd	invalidInsWord
1290
		dd	invalidInsWord
1291
		dd	invalidInsWord
1292
		dd	invalidInsWord
1293
		dd	invalidInsWord
1294
		dd	invalidInsWord
1295
		dd	invalidInsWord
1296
		dd	FDInst44
1297
		dd	FDInst45
1298
		dd	FDInst46
1299
		dd	invalidInsWord
1300
		dd	invalidInsWord
1301
		dd	invalidInsWord
1302
		dd	invalidInsWord
1303
		dd	invalidInsWord
1304
		dd	FDInst4c
1305
		dd	FDInst4d
1306
		dd	FDInst4e
1307
		dd	invalidInsWord
1308
		dd	invalidInsWord
1309
		dd	invalidInsWord
1310
		dd	invalidInsWord
1311
		dd	invalidInsWord
1312
		dd	FDInst54
1313
		dd	FDInst55
1314
		dd	FDInst56
1315
		dd	invalidInsWord
1316
		dd	invalidInsWord
1317
		dd	invalidInsWord
1318
		dd	invalidInsWord
1319
		dd	invalidInsWord
1320
		dd	FDInst5c
1321
		dd	FDInst5d
1322
		dd	FDInst5e
1323
		dd	invalidInsWord
1324
		dd	FDInst60
1325
		dd	FDInst61
1326
		dd	FDInst62
1327
		dd	FDInst63
1328
		dd	FDInst64
1329
		dd	FDInst65
1330
		dd	FDInst66
1331
		dd	FDInst67
1332
		dd	FDInst68
1333
		dd	FDInst69
1334
		dd	FDInst6a
1335
		dd	FDInst6b
1336
		dd	FDInst6c
1337
		dd	FDInst6d
1338
		dd	FDInst6e
1339
		dd	FDInst6f
1340
		dd	FDInst70
1341
		dd	FDInst71
1342
		dd	FDInst72
1343
		dd	FDInst73
1344
		dd	FDInst74
1345
		dd	FDInst75
1346
		dd	invalidInsWord
1347
		dd	FDInst77
1348
		dd	invalidInsWord
1349
		dd	invalidInsWord
1350
		dd	invalidInsWord
1351
		dd	invalidInsWord
1352
		dd	FDInst7c
1353
		dd	FDInst7d
1354
		dd	FDInst7e
1355
		dd	invalidInsWord
1356
		dd	invalidInsWord
1357
		dd	invalidInsWord
1358
		dd	invalidInsWord
1359
		dd	invalidInsWord
1360
		dd	FDInst84
1361
		dd	FDInst85
1362
		dd	FDInst86
1363
		dd	invalidInsWord
1364
		dd	invalidInsWord
1365
		dd	invalidInsWord
1366
		dd	invalidInsWord
1367
		dd	invalidInsWord
1368
		dd	FDInst8c
1369
		dd	FDInst8d
1370
		dd	FDInst8e
1371
		dd	invalidInsWord
1372
		dd	invalidInsWord
1373
		dd	invalidInsWord
1374
		dd	invalidInsWord
1375
		dd	invalidInsWord
1376
		dd	FDInst94
1377
		dd	FDInst95
1378
		dd	FDInst96
1379
		dd	invalidInsWord
1380
		dd	invalidInsWord
1381
		dd	invalidInsWord
1382
		dd	invalidInsWord
1383
		dd	invalidInsWord
1384
		dd	FDInst9c
1385
		dd	FDInst9d
1386
		dd	FDInst9e
1387
		dd	invalidInsWord
1388
		dd	invalidInsWord
1389
		dd	invalidInsWord
1390
		dd	invalidInsWord
1391
		dd	invalidInsWord
1392
		dd	FDInsta4
1393
		dd	FDInsta5
1394
		dd	FDInsta6
1395
		dd	invalidInsWord
1396
		dd	invalidInsWord
1397
		dd	invalidInsWord
1398
		dd	invalidInsWord
1399
		dd	invalidInsWord
1400
		dd	FDInstac
1401
		dd	FDInstad
1402
		dd	FDInstae
1403
		dd	invalidInsWord
1404
		dd	invalidInsWord
1405
		dd	invalidInsWord
1406
		dd	invalidInsWord
1407
		dd	invalidInsWord
1408
		dd	FDInstb4
1409
		dd	FDInstb5
1410
		dd	FDInstb6
1411
		dd	invalidInsWord
1412
		dd	invalidInsWord
1413
		dd	invalidInsWord
1414
		dd	invalidInsWord
1415
		dd	invalidInsWord
1416
		dd	FDInstbc
1417
		dd	FDInstbd
1418
		dd	FDInstbe
1419
		dd	invalidInsWord
1420
		dd	invalidInsWord
1421
		dd	invalidInsWord
1422
		dd	invalidInsWord
1423
		dd	invalidInsWord
1424
		dd	invalidInsWord
1425
		dd	invalidInsWord
1426
		dd	invalidInsWord
1427
		dd	invalidInsWord
1428
		dd	invalidInsWord
1429
		dd	invalidInsWord
1430
		dd	invalidInsWord
1431
		dd	FDInstcb
1432
		dd	invalidInsWord
1433
		dd	invalidInsWord
1434
		dd	invalidInsWord
1435
		dd	invalidInsWord
1436
		dd	invalidInsWord
1437
		dd	invalidInsWord
1438
		dd	invalidInsWord
1439
		dd	invalidInsWord
1440
		dd	invalidInsWord
1441
		dd	invalidInsWord
1442
		dd	invalidInsWord
1443
		dd	invalidInsWord
1444
		dd	invalidInsWord
1445
		dd	invalidInsWord
1446
		dd	invalidInsWord
1447
		dd	invalidInsWord
1448
		dd	invalidInsWord
1449
		dd	invalidInsWord
1450
		dd	invalidInsWord
1451
		dd	invalidInsWord
1452
		dd	invalidInsWord
1453
		dd	FDInste1
1454
		dd	invalidInsWord
1455
		dd	FDInste3
1456
		dd	invalidInsWord
1457
		dd	FDInste5
1458
		dd	invalidInsWord
1459
		dd	invalidInsWord
1460
		dd	invalidInsWord
1461
		dd	FDInste9
1462
		dd	invalidInsWord
1463
		dd	invalidInsWord
1464
		dd	invalidInsWord
1465
		dd	invalidInsWord
1466
		dd	invalidInsWord
1467
		dd	invalidInsWord
1468
		dd	invalidInsWord
1469
		dd	invalidInsWord
1470
		dd	invalidInsWord
1471
		dd	invalidInsWord
1472
		dd	invalidInsWord
1473
		dd	invalidInsWord
1474
		dd	invalidInsWord
1475
		dd	invalidInsWord
1476
		dd	invalidInsWord
1477
		dd	FDInstf9
1478
		dd	invalidInsWord
1479
		dd	invalidInsWord
1480
		dd	invalidInsWord
1481
		dd	invalidInsWord
1482
		dd	invalidInsWord
1483
		dd	invalidInsWord
1484
z80ddfdcbInstructions:
1485
		dd	invalidInsWord
1486
		dd	invalidInsWord
1487
		dd	invalidInsWord
1488
		dd	invalidInsWord
1489
		dd	invalidInsWord
1490
		dd	invalidInsWord
1491
		dd	DDFDCBInst06
1492
		dd	invalidInsWord
1493
		dd	invalidInsWord
1494
		dd	invalidInsWord
1495
		dd	invalidInsWord
1496
		dd	invalidInsWord
1497
		dd	invalidInsWord
1498
		dd	invalidInsWord
1499
		dd	DDFDCBInst0e
1500
		dd	invalidInsWord
1501
		dd	invalidInsWord
1502
		dd	invalidInsWord
1503
		dd	invalidInsWord
1504
		dd	invalidInsWord
1505
		dd	invalidInsWord
1506
		dd	invalidInsWord
1507
		dd	DDFDCBInst16
1508
		dd	invalidInsWord
1509
		dd	invalidInsWord
1510
		dd	invalidInsWord
1511
		dd	invalidInsWord
1512
		dd	invalidInsWord
1513
		dd	invalidInsWord
1514
		dd	invalidInsWord
1515
		dd	DDFDCBInst1e
1516
		dd	invalidInsWord
1517
		dd	invalidInsWord
1518
		dd	invalidInsWord
1519
		dd	invalidInsWord
1520
		dd	invalidInsWord
1521
		dd	invalidInsWord
1522
		dd	invalidInsWord
1523
		dd	DDFDCBInst26
1524
		dd	invalidInsWord
1525
		dd	invalidInsWord
1526
		dd	invalidInsWord
1527
		dd	invalidInsWord
1528
		dd	invalidInsWord
1529
		dd	invalidInsWord
1530
		dd	invalidInsWord
1531
		dd	DDFDCBInst2e
1532
		dd	invalidInsWord
1533
		dd	invalidInsWord
1534
		dd	invalidInsWord
1535
		dd	invalidInsWord
1536
		dd	invalidInsWord
1537
		dd	invalidInsWord
1538
		dd	invalidInsWord
1539
		dd	invalidInsWord
1540
		dd	invalidInsWord
1541
		dd	invalidInsWord
1542
		dd	invalidInsWord
1543
		dd	invalidInsWord
1544
		dd	invalidInsWord
1545
		dd	invalidInsWord
1546
		dd	invalidInsWord
1547
		dd	DDFDCBInst3e
1548
		dd	invalidInsWord
1549
		dd	invalidInsWord
1550
		dd	invalidInsWord
1551
		dd	invalidInsWord
1552
		dd	invalidInsWord
1553
		dd	invalidInsWord
1554
		dd	invalidInsWord
1555
		dd	DDFDCBInst46
1556
		dd	invalidInsWord
1557
		dd	invalidInsWord
1558
		dd	invalidInsWord
1559
		dd	invalidInsWord
1560
		dd	invalidInsWord
1561
		dd	invalidInsWord
1562
		dd	invalidInsWord
1563
		dd	DDFDCBInst4e
1564
		dd	invalidInsWord
1565
		dd	invalidInsWord
1566
		dd	invalidInsWord
1567
		dd	invalidInsWord
1568
		dd	invalidInsWord
1569
		dd	invalidInsWord
1570
		dd	invalidInsWord
1571
		dd	DDFDCBInst56
1572
		dd	invalidInsWord
1573
		dd	invalidInsWord
1574
		dd	invalidInsWord
1575
		dd	invalidInsWord
1576
		dd	invalidInsWord
1577
		dd	invalidInsWord
1578
		dd	invalidInsWord
1579
		dd	DDFDCBInst5e
1580
		dd	invalidInsWord
1581
		dd	invalidInsWord
1582
		dd	invalidInsWord
1583
		dd	invalidInsWord
1584
		dd	invalidInsWord
1585
		dd	invalidInsWord
1586
		dd	invalidInsWord
1587
		dd	DDFDCBInst66
1588
		dd	invalidInsWord
1589
		dd	invalidInsWord
1590
		dd	invalidInsWord
1591
		dd	invalidInsWord
1592
		dd	invalidInsWord
1593
		dd	invalidInsWord
1594
		dd	invalidInsWord
1595
		dd	DDFDCBInst6e
1596
		dd	invalidInsWord
1597
		dd	invalidInsWord
1598
		dd	invalidInsWord
1599
		dd	invalidInsWord
1600
		dd	invalidInsWord
1601
		dd	invalidInsWord
1602
		dd	invalidInsWord
1603
		dd	DDFDCBInst76
1604
		dd	invalidInsWord
1605
		dd	invalidInsWord
1606
		dd	invalidInsWord
1607
		dd	invalidInsWord
1608
		dd	invalidInsWord
1609
		dd	invalidInsWord
1610
		dd	invalidInsWord
1611
		dd	DDFDCBInst7e
1612
		dd	invalidInsWord
1613
		dd	invalidInsWord
1614
		dd	invalidInsWord
1615
		dd	invalidInsWord
1616
		dd	invalidInsWord
1617
		dd	invalidInsWord
1618
		dd	invalidInsWord
1619
		dd	DDFDCBInst86
1620
		dd	invalidInsWord
1621
		dd	invalidInsWord
1622
		dd	invalidInsWord
1623
		dd	invalidInsWord
1624
		dd	invalidInsWord
1625
		dd	invalidInsWord
1626
		dd	invalidInsWord
1627
		dd	DDFDCBInst8e
1628
		dd	invalidInsWord
1629
		dd	invalidInsWord
1630
		dd	invalidInsWord
1631
		dd	invalidInsWord
1632
		dd	invalidInsWord
1633
		dd	invalidInsWord
1634
		dd	invalidInsWord
1635
		dd	DDFDCBInst96
1636
		dd	invalidInsWord
1637
		dd	invalidInsWord
1638
		dd	invalidInsWord
1639
		dd	invalidInsWord
1640
		dd	invalidInsWord
1641
		dd	invalidInsWord
1642
		dd	invalidInsWord
1643
		dd	DDFDCBInst9e
1644
		dd	invalidInsWord
1645
		dd	invalidInsWord
1646
		dd	invalidInsWord
1647
		dd	invalidInsWord
1648
		dd	invalidInsWord
1649
		dd	invalidInsWord
1650
		dd	invalidInsWord
1651
		dd	DDFDCBInsta6
1652
		dd	invalidInsWord
1653
		dd	invalidInsWord
1654
		dd	invalidInsWord
1655
		dd	invalidInsWord
1656
		dd	invalidInsWord
1657
		dd	invalidInsWord
1658
		dd	invalidInsWord
1659
		dd	DDFDCBInstae
1660
		dd	invalidInsWord
1661
		dd	invalidInsWord
1662
		dd	invalidInsWord
1663
		dd	invalidInsWord
1664
		dd	invalidInsWord
1665
		dd	invalidInsWord
1666
		dd	invalidInsWord
1667
		dd	DDFDCBInstb6
1668
		dd	invalidInsWord
1669
		dd	invalidInsWord
1670
		dd	invalidInsWord
1671
		dd	invalidInsWord
1672
		dd	invalidInsWord
1673
		dd	invalidInsWord
1674
		dd	invalidInsWord
1675
		dd	DDFDCBInstbe
1676
		dd	invalidInsWord
1677
		dd	invalidInsWord
1678
		dd	invalidInsWord
1679
		dd	invalidInsWord
1680
		dd	invalidInsWord
1681
		dd	invalidInsWord
1682
		dd	invalidInsWord
1683
		dd	DDFDCBInstc6
1684
		dd	invalidInsWord
1685
		dd	invalidInsWord
1686
		dd	invalidInsWord
1687
		dd	invalidInsWord
1688
		dd	invalidInsWord
1689
		dd	invalidInsWord
1690
		dd	invalidInsWord
1691
		dd	DDFDCBInstce
1692
		dd	invalidInsWord
1693
		dd	invalidInsWord
1694
		dd	invalidInsWord
1695
		dd	invalidInsWord
1696
		dd	invalidInsWord
1697
		dd	invalidInsWord
1698
		dd	invalidInsWord
1699
		dd	DDFDCBInstd6
1700
		dd	invalidInsWord
1701
		dd	invalidInsWord
1702
		dd	invalidInsWord
1703
		dd	invalidInsWord
1704
		dd	invalidInsWord
1705
		dd	invalidInsWord
1706
		dd	invalidInsWord
1707
		dd	DDFDCBInstde
1708
		dd	invalidInsWord
1709
		dd	invalidInsWord
1710
		dd	invalidInsWord
1711
		dd	invalidInsWord
1712
		dd	invalidInsWord
1713
		dd	invalidInsWord
1714
		dd	invalidInsWord
1715
		dd	DDFDCBInste6
1716
		dd	invalidInsWord
1717
		dd	invalidInsWord
1718
		dd	invalidInsWord
1719
		dd	invalidInsWord
1720
		dd	invalidInsWord
1721
		dd	invalidInsWord
1722
		dd	invalidInsWord
1723
		dd	DDFDCBInstee
1724
		dd	invalidInsWord
1725
		dd	invalidInsWord
1726
		dd	invalidInsWord
1727
		dd	invalidInsWord
1728
		dd	invalidInsWord
1729
		dd	invalidInsWord
1730
		dd	invalidInsWord
1731
		dd	DDFDCBInstf6
1732
		dd	invalidInsWord
1733
		dd	invalidInsWord
1734
		dd	invalidInsWord
1735
		dd	invalidInsWord
1736
		dd	invalidInsWord
1737
		dd	invalidInsWord
1738
		dd	invalidInsWord
1739
		dd	DDFDCBInstfe
1740
		dd	invalidInsWord
1741
 
1742
		section	.text use32 flat class=code
1743
 
1744
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1745
 
1746
CBInst00:
1747
		sahf
1748
		rol	ch, 1
1749
		lahf
1750
		and	ah, 029h	; Clear H and N
1751
		mov	byte [_z80af], ah
1752
		or	ch, ch
1753
		lahf
1754
		and	ah, 0c4h	; Sign, zero, and parity
1755
		or	ah, byte [_z80af]
1756
		sub	edi, byte 8
1757
		js	near noMoreExec
1758
		mov	dl, byte [esi]	; Get our next instruction
1759
		inc	esi		; Increment PC
1760
		jmp	dword [z80regular+edx*4]
1761
 
1762
 
1763
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1764
 
1765
CBInst01:
1766
		sahf
1767
		rol	cl, 1
1768
		lahf
1769
		and	ah, 029h	; Clear H and N
1770
		mov	byte [_z80af], ah
1771
		or	cl, cl
1772
		lahf
1773
		and	ah, 0c4h	; Sign, zero, and parity
1774
		or	ah, byte [_z80af]
1775
		sub	edi, byte 8
1776
		js	near noMoreExec
1777
		mov	dl, byte [esi]	; Get our next instruction
1778
		inc	esi		; Increment PC
1779
		jmp	dword [z80regular+edx*4]
1780
 
1781
 
1782
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1783
 
1784
CBInst02:
1785
		mov	dx, [_z80de]	; Move DE into something half usable
1786
		sahf
1787
		rol	dh, 1
1788
		lahf
1789
		and	ah, 029h	; Clear H and N
1790
		mov	byte [_z80af], ah
1791
		or	dh, dh
1792
		lahf
1793
		and	ah, 0c4h	; Sign, zero, and parity
1794
		or	ah, byte [_z80af]
1795
		mov	[_z80de], dx	; Once modified, put it back
1796
		xor	edx, edx
1797
		sub	edi, byte 8
1798
		js	near noMoreExec
1799
		mov	dl, byte [esi]	; Get our next instruction
1800
		inc	esi		; Increment PC
1801
		jmp	dword [z80regular+edx*4]
1802
 
1803
 
1804
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1805
 
1806
CBInst03:
1807
		mov	dx, [_z80de]	; Move DE into something half usable
1808
		sahf
1809
		rol	dl, 1
1810
		lahf
1811
		and	ah, 029h	; Clear H and N
1812
		mov	byte [_z80af], ah
1813
		or	dl, dl
1814
		lahf
1815
		and	ah, 0c4h	; Sign, zero, and parity
1816
		or	ah, byte [_z80af]
1817
		mov	[_z80de], dx	; Once modified, put it back
1818
		xor	edx, edx
1819
		sub	edi, byte 8
1820
		js	near noMoreExec
1821
		mov	dl, byte [esi]	; Get our next instruction
1822
		inc	esi		; Increment PC
1823
		jmp	dword [z80regular+edx*4]
1824
 
1825
 
1826
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1827
 
1828
CBInst04:
1829
		sahf
1830
		rol	bh, 1
1831
		lahf
1832
		and	ah, 029h	; Clear H and N
1833
		mov	byte [_z80af], ah
1834
		or	bh, bh
1835
		lahf
1836
		and	ah, 0c4h	; Sign, zero, and parity
1837
		or	ah, byte [_z80af]
1838
		sub	edi, byte 8
1839
		js	near noMoreExec
1840
		mov	dl, byte [esi]	; Get our next instruction
1841
		inc	esi		; Increment PC
1842
		jmp	dword [z80regular+edx*4]
1843
 
1844
 
1845
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1846
 
1847
CBInst05:
1848
		sahf
1849
		rol	bl, 1
1850
		lahf
1851
		and	ah, 029h	; Clear H and N
1852
		mov	byte [_z80af], ah
1853
		or	bl, bl
1854
		lahf
1855
		and	ah, 0c4h	; Sign, zero, and parity
1856
		or	ah, byte [_z80af]
1857
		sub	edi, byte 8
1858
		js	near noMoreExec
1859
		mov	dl, byte [esi]	; Get our next instruction
1860
		inc	esi		; Increment PC
1861
		jmp	dword [z80regular+edx*4]
1862
 
1863
 
1864
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1865
 
1866
CBInst06:
1867
		mov	[cyclesRemaining], edi
1868
		mov	edi, [_z80MemRead]	; Point to the read array
1869
 
1870
checkLoop0:
1871
		cmp	[edi], word 0ffffh ; End of the list?
1872
		je		memoryRead0
1873
		cmp	ebx, [edi]	; Are we smaller?
1874
		jb		nextAddr0		; Yes, go to the next address
1875
		cmp	ebx, [edi+4]	; Are we bigger?
1876
		jbe	callRoutine0
1877
 
1878
nextAddr0:
1879
		add	edi, 10h		; Next structure!
1880
		jmp	short checkLoop0
1881
 
1882
callRoutine0:
1883
		mov	dx, bx	; Get our address
1884
		call	ReadMemoryByte	; Standard read routine
1885
		mov	dl, al	; Put our returned value here
1886
		mov	ax, [_z80af]	; Get our AF back
1887
		jmp	short readExit0
1888
 
1889
memoryRead0:
1890
		mov	dl, [ebp + ebx]	; Get our data
1891
 
1892
readExit0:
1893
		mov	edi, [cyclesRemaining]
1894
		sahf
1895
		rol	dl, 1
1896
		lahf
1897
		and	ah, 029h	; Clear H and N
1898
		mov	byte [_z80af], ah
1899
		or	dl, dl
1900
		lahf
1901
		and	ah, 0c4h	; Sign, zero, and parity
1902
		or	ah, byte [_z80af]
1903
		mov	[cyclesRemaining], edi
1904
		mov	[_z80af], ax	; Store AF
1905
		mov	al, dl	; And our data to write
1906
		mov	edi, [_z80MemWrite]	; Point to the write array
1907
 
1908
checkLoop1:
1909
		cmp	[edi], word 0ffffh ; End of our list?
1910
		je	memoryWrite1	; Yes - go write it!
1911
		cmp	bx, [edi]	; Are we smaller?
1912
		jb	nextAddr1	; Yes... go to the next addr
1913
		cmp	bx, [edi+4]	; Are we smaller?
1914
		jbe	callRoutine1	; If not, go call it!
1915
 
1916
nextAddr1:
1917
		add	edi, 10h		; Next structure, please
1918
		jmp	short checkLoop1
1919
 
1920
callRoutine1:
1921
		mov	dx, bx	; Get our address to target
1922
		call	WriteMemoryByte	; Go write the data!
1923
		jmp	short WriteMacroExit1
1924
memoryWrite1:
1925
		mov	[ebp + ebx], dl
1926
		mov	ax, [_z80af] ; Get our accumulator and flags
1927
WriteMacroExit1:
1928
		mov	edi, [cyclesRemaining]
1929
		xor	edx, edx
1930
		sub	edi, byte 15
1931
		js	near noMoreExec
1932
		mov	dl, byte [esi]	; Get our next instruction
1933
		inc	esi		; Increment PC
1934
		jmp	dword [z80regular+edx*4]
1935
 
1936
 
1937
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1938
 
1939
CBInst07:
1940
		sahf
1941
		rol	al, 1
1942
		lahf
1943
		and	ah, 029h	; Clear H and N
1944
		mov	byte [_z80af], ah
1945
		or	al, al
1946
		lahf
1947
		and	ah, 0c4h	; Sign, zero, and parity
1948
		or	ah, byte [_z80af]
1949
		sub	edi, byte 8
1950
		js	near noMoreExec
1951
		mov	dl, byte [esi]	; Get our next instruction
1952
		inc	esi		; Increment PC
1953
		jmp	dword [z80regular+edx*4]
1954
 
1955
 
1956
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1957
 
1958
CBInst08:
1959
		sahf
1960
		ror	ch, 1
1961
		lahf
1962
		and	ah, 029h	; Clear H and N
1963
		mov	byte [_z80af], ah
1964
		or	ch, ch
1965
		lahf
1966
		and	ah, 0c4h	; Sign, zero, and parity
1967
		or	ah, byte [_z80af]
1968
		sub	edi, byte 8
1969
		js	near noMoreExec
1970
		mov	dl, byte [esi]	; Get our next instruction
1971
		inc	esi		; Increment PC
1972
		jmp	dword [z80regular+edx*4]
1973
 
1974
 
1975
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1976
 
1977
CBInst09:
1978
		sahf
1979
		ror	cl, 1
1980
		lahf
1981
		and	ah, 029h	; Clear H and N
1982
		mov	byte [_z80af], ah
1983
		or	cl, cl
1984
		lahf
1985
		and	ah, 0c4h	; Sign, zero, and parity
1986
		or	ah, byte [_z80af]
1987
		sub	edi, byte 8
1988
		js	near noMoreExec
1989
		mov	dl, byte [esi]	; Get our next instruction
1990
		inc	esi		; Increment PC
1991
		jmp	dword [z80regular+edx*4]
1992
 
1993
 
1994
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
1995
 
1996
CBInst0a:
1997
		mov	dx, [_z80de]	; Move DE into something half usable
1998
		sahf
1999
		ror	dh, 1
2000
		lahf
2001
		and	ah, 029h	; Clear H and N
2002
		mov	byte [_z80af], ah
2003
		or	dh, dh
2004
		lahf
2005
		and	ah, 0c4h	; Sign, zero, and parity
2006
		or	ah, byte [_z80af]
2007
		mov	[_z80de], dx	; Once modified, put it back
2008
		xor	edx, edx
2009
		sub	edi, byte 8
2010
		js	near noMoreExec
2011
		mov	dl, byte [esi]	; Get our next instruction
2012
		inc	esi		; Increment PC
2013
		jmp	dword [z80regular+edx*4]
2014
 
2015
 
2016
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2017
 
2018
CBInst0b:
2019
		mov	dx, [_z80de]	; Move DE into something half usable
2020
		sahf
2021
		ror	dl, 1
2022
		lahf
2023
		and	ah, 029h	; Clear H and N
2024
		mov	byte [_z80af], ah
2025
		or	dl, dl
2026
		lahf
2027
		and	ah, 0c4h	; Sign, zero, and parity
2028
		or	ah, byte [_z80af]
2029
		mov	[_z80de], dx	; Once modified, put it back
2030
		xor	edx, edx
2031
		sub	edi, byte 8
2032
		js	near noMoreExec
2033
		mov	dl, byte [esi]	; Get our next instruction
2034
		inc	esi		; Increment PC
2035
		jmp	dword [z80regular+edx*4]
2036
 
2037
 
2038
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2039
 
2040
CBInst0c:
2041
		sahf
2042
		ror	bh, 1
2043
		lahf
2044
		and	ah, 029h	; Clear H and N
2045
		mov	byte [_z80af], ah
2046
		or	bh, bh
2047
		lahf
2048
		and	ah, 0c4h	; Sign, zero, and parity
2049
		or	ah, byte [_z80af]
2050
		sub	edi, byte 8
2051
		js	near noMoreExec
2052
		mov	dl, byte [esi]	; Get our next instruction
2053
		inc	esi		; Increment PC
2054
		jmp	dword [z80regular+edx*4]
2055
 
2056
 
2057
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2058
 
2059
CBInst0d:
2060
		sahf
2061
		ror	bl, 1
2062
		lahf
2063
		and	ah, 029h	; Clear H and N
2064
		mov	byte [_z80af], ah
2065
		or	bl, bl
2066
		lahf
2067
		and	ah, 0c4h	; Sign, zero, and parity
2068
		or	ah, byte [_z80af]
2069
		sub	edi, byte 8
2070
		js	near noMoreExec
2071
		mov	dl, byte [esi]	; Get our next instruction
2072
		inc	esi		; Increment PC
2073
		jmp	dword [z80regular+edx*4]
2074
 
2075
 
2076
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2077
 
2078
CBInst0e:
2079
		mov	[cyclesRemaining], edi
2080
		mov	edi, [_z80MemRead]	; Point to the read array
2081
 
2082
checkLoop2:
2083
		cmp	[edi], word 0ffffh ; End of the list?
2084
		je		memoryRead2
2085
		cmp	ebx, [edi]	; Are we smaller?
2086
		jb		nextAddr2		; Yes, go to the next address
2087
		cmp	ebx, [edi+4]	; Are we bigger?
2088
		jbe	callRoutine2
2089
 
2090
nextAddr2:
2091
		add	edi, 10h		; Next structure!
2092
		jmp	short checkLoop2
2093
 
2094
callRoutine2:
2095
		mov	dx, bx	; Get our address
2096
		call	ReadMemoryByte	; Standard read routine
2097
		mov	dl, al	; Put our returned value here
2098
		mov	ax, [_z80af]	; Get our AF back
2099
		jmp	short readExit2
2100
 
2101
memoryRead2:
2102
		mov	dl, [ebp + ebx]	; Get our data
2103
 
2104
readExit2:
2105
		mov	edi, [cyclesRemaining]
2106
		sahf
2107
		ror	dl, 1
2108
		lahf
2109
		and	ah, 029h	; Clear H and N
2110
		mov	byte [_z80af], ah
2111
		or	dl, dl
2112
		lahf
2113
		and	ah, 0c4h	; Sign, zero, and parity
2114
		or	ah, byte [_z80af]
2115
		mov	[cyclesRemaining], edi
2116
		mov	[_z80af], ax	; Store AF
2117
		mov	al, dl	; And our data to write
2118
		mov	edi, [_z80MemWrite]	; Point to the write array
2119
 
2120
checkLoop3:
2121
		cmp	[edi], word 0ffffh ; End of our list?
2122
		je	memoryWrite3	; Yes - go write it!
2123
		cmp	bx, [edi]	; Are we smaller?
2124
		jb	nextAddr3	; Yes... go to the next addr
2125
		cmp	bx, [edi+4]	; Are we smaller?
2126
		jbe	callRoutine3	; If not, go call it!
2127
 
2128
nextAddr3:
2129
		add	edi, 10h		; Next structure, please
2130
		jmp	short checkLoop3
2131
 
2132
callRoutine3:
2133
		mov	dx, bx	; Get our address to target
2134
		call	WriteMemoryByte	; Go write the data!
2135
		jmp	short WriteMacroExit3
2136
memoryWrite3:
2137
		mov	[ebp + ebx], dl
2138
		mov	ax, [_z80af] ; Get our accumulator and flags
2139
WriteMacroExit3:
2140
		mov	edi, [cyclesRemaining]
2141
		xor	edx, edx
2142
		sub	edi, byte 15
2143
		js	near noMoreExec
2144
		mov	dl, byte [esi]	; Get our next instruction
2145
		inc	esi		; Increment PC
2146
		jmp	dword [z80regular+edx*4]
2147
 
2148
 
2149
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2150
 
2151
CBInst0f:
2152
		sahf
2153
		ror	al, 1
2154
		lahf
2155
		and	ah, 029h	; Clear H and N
2156
		mov	byte [_z80af], ah
2157
		or	al, al
2158
		lahf
2159
		and	ah, 0c4h	; Sign, zero, and parity
2160
		or	ah, byte [_z80af]
2161
		sub	edi, byte 8
2162
		js	near noMoreExec
2163
		mov	dl, byte [esi]	; Get our next instruction
2164
		inc	esi		; Increment PC
2165
		jmp	dword [z80regular+edx*4]
2166
 
2167
 
2168
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2169
 
2170
CBInst10:
2171
		sahf
2172
		rcl	ch, 1
2173
		lahf
2174
		and	ah, 029h	; Clear H and N
2175
		mov	byte [_z80af], ah
2176
		or	ch, ch
2177
		lahf
2178
		and	ah, 0c4h	; Sign, zero, and parity
2179
		or	ah, byte [_z80af]
2180
		sub	edi, byte 8
2181
		js	near noMoreExec
2182
		mov	dl, byte [esi]	; Get our next instruction
2183
		inc	esi		; Increment PC
2184
		jmp	dword [z80regular+edx*4]
2185
 
2186
 
2187
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2188
 
2189
CBInst11:
2190
		sahf
2191
		rcl	cl, 1
2192
		lahf
2193
		and	ah, 029h	; Clear H and N
2194
		mov	byte [_z80af], ah
2195
		or	cl, cl
2196
		lahf
2197
		and	ah, 0c4h	; Sign, zero, and parity
2198
		or	ah, byte [_z80af]
2199
		sub	edi, byte 8
2200
		js	near noMoreExec
2201
		mov	dl, byte [esi]	; Get our next instruction
2202
		inc	esi		; Increment PC
2203
		jmp	dword [z80regular+edx*4]
2204
 
2205
 
2206
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2207
 
2208
CBInst12:
2209
		mov	dx, [_z80de]	; Move DE into something half usable
2210
		sahf
2211
		rcl	dh, 1
2212
		lahf
2213
		and	ah, 029h	; Clear H and N
2214
		mov	byte [_z80af], ah
2215
		or	dh, dh
2216
		lahf
2217
		and	ah, 0c4h	; Sign, zero, and parity
2218
		or	ah, byte [_z80af]
2219
		mov	[_z80de], dx	; Once modified, put it back
2220
		xor	edx, edx
2221
		sub	edi, byte 8
2222
		js	near noMoreExec
2223
		mov	dl, byte [esi]	; Get our next instruction
2224
		inc	esi		; Increment PC
2225
		jmp	dword [z80regular+edx*4]
2226
 
2227
 
2228
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2229
 
2230
CBInst13:
2231
		mov	dx, [_z80de]	; Move DE into something half usable
2232
		sahf
2233
		rcl	dl, 1
2234
		lahf
2235
		and	ah, 029h	; Clear H and N
2236
		mov	byte [_z80af], ah
2237
		or	dl, dl
2238
		lahf
2239
		and	ah, 0c4h	; Sign, zero, and parity
2240
		or	ah, byte [_z80af]
2241
		mov	[_z80de], dx	; Once modified, put it back
2242
		xor	edx, edx
2243
		sub	edi, byte 8
2244
		js	near noMoreExec
2245
		mov	dl, byte [esi]	; Get our next instruction
2246
		inc	esi		; Increment PC
2247
		jmp	dword [z80regular+edx*4]
2248
 
2249
 
2250
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2251
 
2252
CBInst14:
2253
		sahf
2254
		rcl	bh, 1
2255
		lahf
2256
		and	ah, 029h	; Clear H and N
2257
		mov	byte [_z80af], ah
2258
		or	bh, bh
2259
		lahf
2260
		and	ah, 0c4h	; Sign, zero, and parity
2261
		or	ah, byte [_z80af]
2262
		sub	edi, byte 8
2263
		js	near noMoreExec
2264
		mov	dl, byte [esi]	; Get our next instruction
2265
		inc	esi		; Increment PC
2266
		jmp	dword [z80regular+edx*4]
2267
 
2268
 
2269
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2270
 
2271
CBInst15:
2272
		sahf
2273
		rcl	bl, 1
2274
		lahf
2275
		and	ah, 029h	; Clear H and N
2276
		mov	byte [_z80af], ah
2277
		or	bl, bl
2278
		lahf
2279
		and	ah, 0c4h	; Sign, zero, and parity
2280
		or	ah, byte [_z80af]
2281
		sub	edi, byte 8
2282
		js	near noMoreExec
2283
		mov	dl, byte [esi]	; Get our next instruction
2284
		inc	esi		; Increment PC
2285
		jmp	dword [z80regular+edx*4]
2286
 
2287
 
2288
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2289
 
2290
CBInst16:
2291
		mov	[cyclesRemaining], edi
2292
		mov	edi, [_z80MemRead]	; Point to the read array
2293
 
2294
checkLoop4:
2295
		cmp	[edi], word 0ffffh ; End of the list?
2296
		je		memoryRead4
2297
		cmp	ebx, [edi]	; Are we smaller?
2298
		jb		nextAddr4		; Yes, go to the next address
2299
		cmp	ebx, [edi+4]	; Are we bigger?
2300
		jbe	callRoutine4
2301
 
2302
nextAddr4:
2303
		add	edi, 10h		; Next structure!
2304
		jmp	short checkLoop4
2305
 
2306
callRoutine4:
2307
		mov	dx, bx	; Get our address
2308
		call	ReadMemoryByte	; Standard read routine
2309
		mov	dl, al	; Put our returned value here
2310
		mov	ax, [_z80af]	; Get our AF back
2311
		jmp	short readExit4
2312
 
2313
memoryRead4:
2314
		mov	dl, [ebp + ebx]	; Get our data
2315
 
2316
readExit4:
2317
		mov	edi, [cyclesRemaining]
2318
		sahf
2319
		rcl	dl, 1
2320
		lahf
2321
		and	ah, 029h	; Clear H and N
2322
		mov	byte [_z80af], ah
2323
		or	dl, dl
2324
		lahf
2325
		and	ah, 0c4h	; Sign, zero, and parity
2326
		or	ah, byte [_z80af]
2327
		mov	[cyclesRemaining], edi
2328
		mov	[_z80af], ax	; Store AF
2329
		mov	al, dl	; And our data to write
2330
		mov	edi, [_z80MemWrite]	; Point to the write array
2331
 
2332
checkLoop5:
2333
		cmp	[edi], word 0ffffh ; End of our list?
2334
		je	memoryWrite5	; Yes - go write it!
2335
		cmp	bx, [edi]	; Are we smaller?
2336
		jb	nextAddr5	; Yes... go to the next addr
2337
		cmp	bx, [edi+4]	; Are we smaller?
2338
		jbe	callRoutine5	; If not, go call it!
2339
 
2340
nextAddr5:
2341
		add	edi, 10h		; Next structure, please
2342
		jmp	short checkLoop5
2343
 
2344
callRoutine5:
2345
		mov	dx, bx	; Get our address to target
2346
		call	WriteMemoryByte	; Go write the data!
2347
		jmp	short WriteMacroExit5
2348
memoryWrite5:
2349
		mov	[ebp + ebx], dl
2350
		mov	ax, [_z80af] ; Get our accumulator and flags
2351
WriteMacroExit5:
2352
		mov	edi, [cyclesRemaining]
2353
		xor	edx, edx
2354
		sub	edi, byte 15
2355
		js	near noMoreExec
2356
		mov	dl, byte [esi]	; Get our next instruction
2357
		inc	esi		; Increment PC
2358
		jmp	dword [z80regular+edx*4]
2359
 
2360
 
2361
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2362
 
2363
CBInst17:
2364
		sahf
2365
		rcl	al, 1
2366
		lahf
2367
		and	ah, 029h	; Clear H and N
2368
		mov	byte [_z80af], ah
2369
		or	al, al
2370
		lahf
2371
		and	ah, 0c4h	; Sign, zero, and parity
2372
		or	ah, byte [_z80af]
2373
		sub	edi, byte 8
2374
		js	near noMoreExec
2375
		mov	dl, byte [esi]	; Get our next instruction
2376
		inc	esi		; Increment PC
2377
		jmp	dword [z80regular+edx*4]
2378
 
2379
 
2380
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2381
 
2382
CBInst18:
2383
		sahf
2384
		rcr	ch, 1
2385
		lahf
2386
		and	ah, 029h	; Clear H and N
2387
		mov	byte [_z80af], ah
2388
		or	ch, ch
2389
		lahf
2390
		and	ah, 0c4h	; Sign, zero, and parity
2391
		or	ah, byte [_z80af]
2392
		sub	edi, byte 8
2393
		js	near noMoreExec
2394
		mov	dl, byte [esi]	; Get our next instruction
2395
		inc	esi		; Increment PC
2396
		jmp	dword [z80regular+edx*4]
2397
 
2398
 
2399
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2400
 
2401
CBInst19:
2402
		sahf
2403
		rcr	cl, 1
2404
		lahf
2405
		and	ah, 029h	; Clear H and N
2406
		mov	byte [_z80af], ah
2407
		or	cl, cl
2408
		lahf
2409
		and	ah, 0c4h	; Sign, zero, and parity
2410
		or	ah, byte [_z80af]
2411
		sub	edi, byte 8
2412
		js	near noMoreExec
2413
		mov	dl, byte [esi]	; Get our next instruction
2414
		inc	esi		; Increment PC
2415
		jmp	dword [z80regular+edx*4]
2416
 
2417
 
2418
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2419
 
2420
CBInst1a:
2421
		mov	dx, [_z80de]	; Move DE into something half usable
2422
		sahf
2423
		rcr	dh, 1
2424
		lahf
2425
		and	ah, 029h	; Clear H and N
2426
		mov	byte [_z80af], ah
2427
		or	dh, dh
2428
		lahf
2429
		and	ah, 0c4h	; Sign, zero, and parity
2430
		or	ah, byte [_z80af]
2431
		mov	[_z80de], dx	; Once modified, put it back
2432
		xor	edx, edx
2433
		sub	edi, byte 8
2434
		js	near noMoreExec
2435
		mov	dl, byte [esi]	; Get our next instruction
2436
		inc	esi		; Increment PC
2437
		jmp	dword [z80regular+edx*4]
2438
 
2439
 
2440
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2441
 
2442
CBInst1b:
2443
		mov	dx, [_z80de]	; Move DE into something half usable
2444
		sahf
2445
		rcr	dl, 1
2446
		lahf
2447
		and	ah, 029h	; Clear H and N
2448
		mov	byte [_z80af], ah
2449
		or	dl, dl
2450
		lahf
2451
		and	ah, 0c4h	; Sign, zero, and parity
2452
		or	ah, byte [_z80af]
2453
		mov	[_z80de], dx	; Once modified, put it back
2454
		xor	edx, edx
2455
		sub	edi, byte 8
2456
		js	near noMoreExec
2457
		mov	dl, byte [esi]	; Get our next instruction
2458
		inc	esi		; Increment PC
2459
		jmp	dword [z80regular+edx*4]
2460
 
2461
 
2462
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2463
 
2464
CBInst1c:
2465
		sahf
2466
		rcr	bh, 1
2467
		lahf
2468
		and	ah, 029h	; Clear H and N
2469
		mov	byte [_z80af], ah
2470
		or	bh, bh
2471
		lahf
2472
		and	ah, 0c4h	; Sign, zero, and parity
2473
		or	ah, byte [_z80af]
2474
		sub	edi, byte 8
2475
		js	near noMoreExec
2476
		mov	dl, byte [esi]	; Get our next instruction
2477
		inc	esi		; Increment PC
2478
		jmp	dword [z80regular+edx*4]
2479
 
2480
 
2481
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2482
 
2483
CBInst1d:
2484
		sahf
2485
		rcr	bl, 1
2486
		lahf
2487
		and	ah, 029h	; Clear H and N
2488
		mov	byte [_z80af], ah
2489
		or	bl, bl
2490
		lahf
2491
		and	ah, 0c4h	; Sign, zero, and parity
2492
		or	ah, byte [_z80af]
2493
		sub	edi, byte 8
2494
		js	near noMoreExec
2495
		mov	dl, byte [esi]	; Get our next instruction
2496
		inc	esi		; Increment PC
2497
		jmp	dword [z80regular+edx*4]
2498
 
2499
 
2500
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2501
 
2502
CBInst1e:
2503
		mov	[cyclesRemaining], edi
2504
		mov	edi, [_z80MemRead]	; Point to the read array
2505
 
2506
checkLoop6:
2507
		cmp	[edi], word 0ffffh ; End of the list?
2508
		je		memoryRead6
2509
		cmp	ebx, [edi]	; Are we smaller?
2510
		jb		nextAddr6		; Yes, go to the next address
2511
		cmp	ebx, [edi+4]	; Are we bigger?
2512
		jbe	callRoutine6
2513
 
2514
nextAddr6:
2515
		add	edi, 10h		; Next structure!
2516
		jmp	short checkLoop6
2517
 
2518
callRoutine6:
2519
		mov	dx, bx	; Get our address
2520
		call	ReadMemoryByte	; Standard read routine
2521
		mov	dl, al	; Put our returned value here
2522
		mov	ax, [_z80af]	; Get our AF back
2523
		jmp	short readExit6
2524
 
2525
memoryRead6:
2526
		mov	dl, [ebp + ebx]	; Get our data
2527
 
2528
readExit6:
2529
		mov	edi, [cyclesRemaining]
2530
		sahf
2531
		rcr	dl, 1
2532
		lahf
2533
		and	ah, 029h	; Clear H and N
2534
		mov	byte [_z80af], ah
2535
		or	dl, dl
2536
		lahf
2537
		and	ah, 0c4h	; Sign, zero, and parity
2538
		or	ah, byte [_z80af]
2539
		mov	[cyclesRemaining], edi
2540
		mov	[_z80af], ax	; Store AF
2541
		mov	al, dl	; And our data to write
2542
		mov	edi, [_z80MemWrite]	; Point to the write array
2543
 
2544
checkLoop7:
2545
		cmp	[edi], word 0ffffh ; End of our list?
2546
		je	memoryWrite7	; Yes - go write it!
2547
		cmp	bx, [edi]	; Are we smaller?
2548
		jb	nextAddr7	; Yes... go to the next addr
2549
		cmp	bx, [edi+4]	; Are we smaller?
2550
		jbe	callRoutine7	; If not, go call it!
2551
 
2552
nextAddr7:
2553
		add	edi, 10h		; Next structure, please
2554
		jmp	short checkLoop7
2555
 
2556
callRoutine7:
2557
		mov	dx, bx	; Get our address to target
2558
		call	WriteMemoryByte	; Go write the data!
2559
		jmp	short WriteMacroExit7
2560
memoryWrite7:
2561
		mov	[ebp + ebx], dl
2562
		mov	ax, [_z80af] ; Get our accumulator and flags
2563
WriteMacroExit7:
2564
		mov	edi, [cyclesRemaining]
2565
		xor	edx, edx
2566
		sub	edi, byte 15
2567
		js	near noMoreExec
2568
		mov	dl, byte [esi]	; Get our next instruction
2569
		inc	esi		; Increment PC
2570
		jmp	dword [z80regular+edx*4]
2571
 
2572
 
2573
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2574
 
2575
CBInst1f:
2576
		sahf
2577
		rcr	al, 1
2578
		lahf
2579
		and	ah, 029h	; Clear H and N
2580
		mov	byte [_z80af], ah
2581
		or	al, al
2582
		lahf
2583
		and	ah, 0c4h	; Sign, zero, and parity
2584
		or	ah, byte [_z80af]
2585
		sub	edi, byte 8
2586
		js	near noMoreExec
2587
		mov	dl, byte [esi]	; Get our next instruction
2588
		inc	esi		; Increment PC
2589
		jmp	dword [z80regular+edx*4]
2590
 
2591
 
2592
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2593
 
2594
CBInst20:
2595
		sahf
2596
		shl	ch, 1
2597
		lahf
2598
		and	ah, 0edh	; Clear H and N
2599
		sub	edi, byte 8
2600
		js	near noMoreExec
2601
		mov	dl, byte [esi]	; Get our next instruction
2602
		inc	esi		; Increment PC
2603
		jmp	dword [z80regular+edx*4]
2604
 
2605
 
2606
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2607
 
2608
CBInst21:
2609
		sahf
2610
		shl	cl, 1
2611
		lahf
2612
		and	ah, 0edh	; Clear H and N
2613
		sub	edi, byte 8
2614
		js	near noMoreExec
2615
		mov	dl, byte [esi]	; Get our next instruction
2616
		inc	esi		; Increment PC
2617
		jmp	dword [z80regular+edx*4]
2618
 
2619
 
2620
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2621
 
2622
CBInst22:
2623
		mov	dx, [_z80de]	; Move DE into something half usable
2624
		sahf
2625
		shl	dh, 1
2626
		lahf
2627
		and	ah, 0edh	; Clear H and N
2628
		mov	[_z80de], dx	; Once modified, put it back
2629
		xor	edx, edx
2630
		sub	edi, byte 8
2631
		js	near noMoreExec
2632
		mov	dl, byte [esi]	; Get our next instruction
2633
		inc	esi		; Increment PC
2634
		jmp	dword [z80regular+edx*4]
2635
 
2636
 
2637
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2638
 
2639
CBInst23:
2640
		mov	dx, [_z80de]	; Move DE into something half usable
2641
		sahf
2642
		shl	dl, 1
2643
		lahf
2644
		and	ah, 0edh	; Clear H and N
2645
		mov	[_z80de], dx	; Once modified, put it back
2646
		xor	edx, edx
2647
		sub	edi, byte 8
2648
		js	near noMoreExec
2649
		mov	dl, byte [esi]	; Get our next instruction
2650
		inc	esi		; Increment PC
2651
		jmp	dword [z80regular+edx*4]
2652
 
2653
 
2654
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2655
 
2656
CBInst24:
2657
		sahf
2658
		shl	bh, 1
2659
		lahf
2660
		and	ah, 0edh	; Clear H and N
2661
		sub	edi, byte 8
2662
		js	near noMoreExec
2663
		mov	dl, byte [esi]	; Get our next instruction
2664
		inc	esi		; Increment PC
2665
		jmp	dword [z80regular+edx*4]
2666
 
2667
 
2668
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2669
 
2670
CBInst25:
2671
		sahf
2672
		shl	bl, 1
2673
		lahf
2674
		and	ah, 0edh	; Clear H and N
2675
		sub	edi, byte 8
2676
		js	near noMoreExec
2677
		mov	dl, byte [esi]	; Get our next instruction
2678
		inc	esi		; Increment PC
2679
		jmp	dword [z80regular+edx*4]
2680
 
2681
 
2682
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2683
 
2684
CBInst26:
2685
		mov	[cyclesRemaining], edi
2686
		mov	edi, [_z80MemRead]	; Point to the read array
2687
 
2688
checkLoop8:
2689
		cmp	[edi], word 0ffffh ; End of the list?
2690
		je		memoryRead8
2691
		cmp	ebx, [edi]	; Are we smaller?
2692
		jb		nextAddr8		; Yes, go to the next address
2693
		cmp	ebx, [edi+4]	; Are we bigger?
2694
		jbe	callRoutine8
2695
 
2696
nextAddr8:
2697
		add	edi, 10h		; Next structure!
2698
		jmp	short checkLoop8
2699
 
2700
callRoutine8:
2701
		mov	dx, bx	; Get our address
2702
		call	ReadMemoryByte	; Standard read routine
2703
		mov	dl, al	; Put our returned value here
2704
		mov	ax, [_z80af]	; Get our AF back
2705
		jmp	short readExit8
2706
 
2707
memoryRead8:
2708
		mov	dl, [ebp + ebx]	; Get our data
2709
 
2710
readExit8:
2711
		mov	edi, [cyclesRemaining]
2712
		sahf
2713
		shl	dl, 1
2714
		lahf
2715
		and	ah, 0edh	; Clear H and N
2716
		mov	[cyclesRemaining], edi
2717
		mov	[_z80af], ax	; Store AF
2718
		mov	al, dl	; And our data to write
2719
		mov	edi, [_z80MemWrite]	; Point to the write array
2720
 
2721
checkLoop9:
2722
		cmp	[edi], word 0ffffh ; End of our list?
2723
		je	memoryWrite9	; Yes - go write it!
2724
		cmp	bx, [edi]	; Are we smaller?
2725
		jb	nextAddr9	; Yes... go to the next addr
2726
		cmp	bx, [edi+4]	; Are we smaller?
2727
		jbe	callRoutine9	; If not, go call it!
2728
 
2729
nextAddr9:
2730
		add	edi, 10h		; Next structure, please
2731
		jmp	short checkLoop9
2732
 
2733
callRoutine9:
2734
		mov	dx, bx	; Get our address to target
2735
		call	WriteMemoryByte	; Go write the data!
2736
		jmp	short WriteMacroExit9
2737
memoryWrite9:
2738
		mov	[ebp + ebx], dl
2739
		mov	ax, [_z80af] ; Get our accumulator and flags
2740
WriteMacroExit9:
2741
		mov	edi, [cyclesRemaining]
2742
		xor	edx, edx
2743
		sub	edi, byte 15
2744
		js	near noMoreExec
2745
		mov	dl, byte [esi]	; Get our next instruction
2746
		inc	esi		; Increment PC
2747
		jmp	dword [z80regular+edx*4]
2748
 
2749
 
2750
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2751
 
2752
CBInst27:
2753
		sahf
2754
		shl	al, 1
2755
		lahf
2756
		and	ah, 0edh	; Clear H and N
2757
		sub	edi, byte 8
2758
		js	near noMoreExec
2759
		mov	dl, byte [esi]	; Get our next instruction
2760
		inc	esi		; Increment PC
2761
		jmp	dword [z80regular+edx*4]
2762
 
2763
 
2764
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2765
 
2766
CBInst28:
2767
		sahf
2768
		sar	ch, 1
2769
		lahf
2770
		and	ah, 0edh	; Clear H and N
2771
		sub	edi, byte 8
2772
		js	near noMoreExec
2773
		mov	dl, byte [esi]	; Get our next instruction
2774
		inc	esi		; Increment PC
2775
		jmp	dword [z80regular+edx*4]
2776
 
2777
 
2778
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2779
 
2780
CBInst29:
2781
		sahf
2782
		sar	cl, 1
2783
		lahf
2784
		and	ah, 0edh	; Clear H and N
2785
		sub	edi, byte 8
2786
		js	near noMoreExec
2787
		mov	dl, byte [esi]	; Get our next instruction
2788
		inc	esi		; Increment PC
2789
		jmp	dword [z80regular+edx*4]
2790
 
2791
 
2792
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2793
 
2794
CBInst2a:
2795
		mov	dx, [_z80de]	; Move DE into something half usable
2796
		sahf
2797
		sar	dh, 1
2798
		lahf
2799
		and	ah, 0edh	; Clear H and N
2800
		mov	[_z80de], dx	; Once modified, put it back
2801
		xor	edx, edx
2802
		sub	edi, byte 8
2803
		js	near noMoreExec
2804
		mov	dl, byte [esi]	; Get our next instruction
2805
		inc	esi		; Increment PC
2806
		jmp	dword [z80regular+edx*4]
2807
 
2808
 
2809
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2810
 
2811
CBInst2b:
2812
		mov	dx, [_z80de]	; Move DE into something half usable
2813
		sahf
2814
		sar	dl, 1
2815
		lahf
2816
		and	ah, 0edh	; Clear H and N
2817
		mov	[_z80de], dx	; Once modified, put it back
2818
		xor	edx, edx
2819
		sub	edi, byte 8
2820
		js	near noMoreExec
2821
		mov	dl, byte [esi]	; Get our next instruction
2822
		inc	esi		; Increment PC
2823
		jmp	dword [z80regular+edx*4]
2824
 
2825
 
2826
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2827
 
2828
CBInst2c:
2829
		sahf
2830
		sar	bh, 1
2831
		lahf
2832
		and	ah, 0edh	; Clear H and N
2833
		sub	edi, byte 8
2834
		js	near noMoreExec
2835
		mov	dl, byte [esi]	; Get our next instruction
2836
		inc	esi		; Increment PC
2837
		jmp	dword [z80regular+edx*4]
2838
 
2839
 
2840
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2841
 
2842
CBInst2d:
2843
		sahf
2844
		sar	bl, 1
2845
		lahf
2846
		and	ah, 0edh	; Clear H and N
2847
		sub	edi, byte 8
2848
		js	near noMoreExec
2849
		mov	dl, byte [esi]	; Get our next instruction
2850
		inc	esi		; Increment PC
2851
		jmp	dword [z80regular+edx*4]
2852
 
2853
 
2854
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2855
 
2856
CBInst2e:
2857
		mov	[cyclesRemaining], edi
2858
		mov	edi, [_z80MemRead]	; Point to the read array
2859
 
2860
checkLoop10:
2861
		cmp	[edi], word 0ffffh ; End of the list?
2862
		je		memoryRead10
2863
		cmp	ebx, [edi]	; Are we smaller?
2864
		jb		nextAddr10		; Yes, go to the next address
2865
		cmp	ebx, [edi+4]	; Are we bigger?
2866
		jbe	callRoutine10
2867
 
2868
nextAddr10:
2869
		add	edi, 10h		; Next structure!
2870
		jmp	short checkLoop10
2871
 
2872
callRoutine10:
2873
		mov	dx, bx	; Get our address
2874
		call	ReadMemoryByte	; Standard read routine
2875
		mov	dl, al	; Put our returned value here
2876
		mov	ax, [_z80af]	; Get our AF back
2877
		jmp	short readExit10
2878
 
2879
memoryRead10:
2880
		mov	dl, [ebp + ebx]	; Get our data
2881
 
2882
readExit10:
2883
		mov	edi, [cyclesRemaining]
2884
		sahf
2885
		sar	dl, 1
2886
		lahf
2887
		and	ah, 0edh	; Clear H and N
2888
		mov	[cyclesRemaining], edi
2889
		mov	[_z80af], ax	; Store AF
2890
		mov	al, dl	; And our data to write
2891
		mov	edi, [_z80MemWrite]	; Point to the write array
2892
 
2893
checkLoop11:
2894
		cmp	[edi], word 0ffffh ; End of our list?
2895
		je	memoryWrite11	; Yes - go write it!
2896
		cmp	bx, [edi]	; Are we smaller?
2897
		jb	nextAddr11	; Yes... go to the next addr
2898
		cmp	bx, [edi+4]	; Are we smaller?
2899
		jbe	callRoutine11	; If not, go call it!
2900
 
2901
nextAddr11:
2902
		add	edi, 10h		; Next structure, please
2903
		jmp	short checkLoop11
2904
 
2905
callRoutine11:
2906
		mov	dx, bx	; Get our address to target
2907
		call	WriteMemoryByte	; Go write the data!
2908
		jmp	short WriteMacroExit11
2909
memoryWrite11:
2910
		mov	[ebp + ebx], dl
2911
		mov	ax, [_z80af] ; Get our accumulator and flags
2912
WriteMacroExit11:
2913
		mov	edi, [cyclesRemaining]
2914
		xor	edx, edx
2915
		sub	edi, byte 15
2916
		js	near noMoreExec
2917
		mov	dl, byte [esi]	; Get our next instruction
2918
		inc	esi		; Increment PC
2919
		jmp	dword [z80regular+edx*4]
2920
 
2921
 
2922
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2923
 
2924
CBInst2f:
2925
		sahf
2926
		sar	al, 1
2927
		lahf
2928
		and	ah, 0edh	; Clear H and N
2929
		sub	edi, byte 8
2930
		js	near noMoreExec
2931
		mov	dl, byte [esi]	; Get our next instruction
2932
		inc	esi		; Increment PC
2933
		jmp	dword [z80regular+edx*4]
2934
 
2935
 
2936
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2937
 
2938
CBInst30:
2939
		sahf
2940
		shl	ch, 1
2941
		lahf
2942
		or	ch, 1	; Slide in a 1 bit (SLIA)
2943
		and	ah, 0edh	; Clear H and N
2944
		sub	edi, byte 8
2945
		js	near noMoreExec
2946
		mov	dl, byte [esi]	; Get our next instruction
2947
		inc	esi		; Increment PC
2948
		jmp	dword [z80regular+edx*4]
2949
 
2950
 
2951
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2952
 
2953
CBInst31:
2954
		sahf
2955
		shl	cl, 1
2956
		lahf
2957
		or	cl, 1	; Slide in a 1 bit (SLIA)
2958
		and	ah, 0edh	; Clear H and N
2959
		sub	edi, byte 8
2960
		js	near noMoreExec
2961
		mov	dl, byte [esi]	; Get our next instruction
2962
		inc	esi		; Increment PC
2963
		jmp	dword [z80regular+edx*4]
2964
 
2965
 
2966
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2967
 
2968
CBInst32:
2969
		mov	dx, [_z80de]	; Move DE into something half usable
2970
		sahf
2971
		shl	dh, 1
2972
		lahf
2973
		or	dh, 1	; Slide in a 1 bit (SLIA)
2974
		and	ah, 0edh	; Clear H and N
2975
		mov	[_z80de], dx	; Once modified, put it back
2976
		xor	edx, edx
2977
		sub	edi, byte 8
2978
		js	near noMoreExec
2979
		mov	dl, byte [esi]	; Get our next instruction
2980
		inc	esi		; Increment PC
2981
		jmp	dword [z80regular+edx*4]
2982
 
2983
 
2984
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
2985
 
2986
CBInst33:
2987
		mov	dx, [_z80de]	; Move DE into something half usable
2988
		sahf
2989
		shl	dl, 1
2990
		lahf
2991
		or	dl, 1	; Slide in a 1 bit (SLIA)
2992
		and	ah, 0edh	; Clear H and N
2993
		mov	[_z80de], dx	; Once modified, put it back
2994
		xor	edx, edx
2995
		sub	edi, byte 8
2996
		js	near noMoreExec
2997
		mov	dl, byte [esi]	; Get our next instruction
2998
		inc	esi		; Increment PC
2999
		jmp	dword [z80regular+edx*4]
3000
 
3001
 
3002
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3003
 
3004
CBInst34:
3005
		sahf
3006
		shl	bh, 1
3007
		lahf
3008
		or	bh, 1	; Slide in a 1 bit (SLIA)
3009
		and	ah, 0edh	; Clear H and N
3010
		sub	edi, byte 8
3011
		js	near noMoreExec
3012
		mov	dl, byte [esi]	; Get our next instruction
3013
		inc	esi		; Increment PC
3014
		jmp	dword [z80regular+edx*4]
3015
 
3016
 
3017
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3018
 
3019
CBInst35:
3020
		sahf
3021
		shl	bl, 1
3022
		lahf
3023
		or	bl, 1	; Slide in a 1 bit (SLIA)
3024
		and	ah, 0edh	; Clear H and N
3025
		sub	edi, byte 8
3026
		js	near noMoreExec
3027
		mov	dl, byte [esi]	; Get our next instruction
3028
		inc	esi		; Increment PC
3029
		jmp	dword [z80regular+edx*4]
3030
 
3031
 
3032
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3033
 
3034
CBInst36:
3035
		mov	[cyclesRemaining], edi
3036
		mov	edi, [_z80MemRead]	; Point to the read array
3037
 
3038
checkLoop12:
3039
		cmp	[edi], word 0ffffh ; End of the list?
3040
		je		memoryRead12
3041
		cmp	ebx, [edi]	; Are we smaller?
3042
		jb		nextAddr12		; Yes, go to the next address
3043
		cmp	ebx, [edi+4]	; Are we bigger?
3044
		jbe	callRoutine12
3045
 
3046
nextAddr12:
3047
		add	edi, 10h		; Next structure!
3048
		jmp	short checkLoop12
3049
 
3050
callRoutine12:
3051
		mov	dx, bx	; Get our address
3052
		call	ReadMemoryByte	; Standard read routine
3053
		mov	dl, al	; Put our returned value here
3054
		mov	ax, [_z80af]	; Get our AF back
3055
		jmp	short readExit12
3056
 
3057
memoryRead12:
3058
		mov	dl, [ebp + ebx]	; Get our data
3059
 
3060
readExit12:
3061
		mov	edi, [cyclesRemaining]
3062
		sahf
3063
		shl	dl, 1
3064
		lahf
3065
		or	dl, 1	; Slide in a 1 bit (SLIA)
3066
		and	ah, 0edh	; Clear H and N
3067
		mov	[cyclesRemaining], edi
3068
		mov	[_z80af], ax	; Store AF
3069
		mov	al, dl	; And our data to write
3070
		mov	edi, [_z80MemWrite]	; Point to the write array
3071
 
3072
checkLoop13:
3073
		cmp	[edi], word 0ffffh ; End of our list?
3074
		je	memoryWrite13	; Yes - go write it!
3075
		cmp	bx, [edi]	; Are we smaller?
3076
		jb	nextAddr13	; Yes... go to the next addr
3077
		cmp	bx, [edi+4]	; Are we smaller?
3078
		jbe	callRoutine13	; If not, go call it!
3079
 
3080
nextAddr13:
3081
		add	edi, 10h		; Next structure, please
3082
		jmp	short checkLoop13
3083
 
3084
callRoutine13:
3085
		mov	dx, bx	; Get our address to target
3086
		call	WriteMemoryByte	; Go write the data!
3087
		jmp	short WriteMacroExit13
3088
memoryWrite13:
3089
		mov	[ebp + ebx], dl
3090
		mov	ax, [_z80af] ; Get our accumulator and flags
3091
WriteMacroExit13:
3092
		mov	edi, [cyclesRemaining]
3093
		xor	edx, edx
3094
		sub	edi, byte 15
3095
		js	near noMoreExec
3096
		mov	dl, byte [esi]	; Get our next instruction
3097
		inc	esi		; Increment PC
3098
		jmp	dword [z80regular+edx*4]
3099
 
3100
 
3101
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3102
 
3103
CBInst37:
3104
		sahf
3105
		shl	al, 1
3106
		lahf
3107
		or	al, 1	; Slide in a 1 bit (SLIA)
3108
		and	ah, 0edh	; Clear H and N
3109
		sub	edi, byte 8
3110
		js	near noMoreExec
3111
		mov	dl, byte [esi]	; Get our next instruction
3112
		inc	esi		; Increment PC
3113
		jmp	dword [z80regular+edx*4]
3114
 
3115
 
3116
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3117
 
3118
CBInst38:
3119
		sahf
3120
		shr	ch, 1
3121
		lahf
3122
		and	ah, 0edh	; Clear H and N
3123
		sub	edi, byte 8
3124
		js	near noMoreExec
3125
		mov	dl, byte [esi]	; Get our next instruction
3126
		inc	esi		; Increment PC
3127
		jmp	dword [z80regular+edx*4]
3128
 
3129
 
3130
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3131
 
3132
CBInst39:
3133
		sahf
3134
		shr	cl, 1
3135
		lahf
3136
		and	ah, 0edh	; Clear H and N
3137
		sub	edi, byte 8
3138
		js	near noMoreExec
3139
		mov	dl, byte [esi]	; Get our next instruction
3140
		inc	esi		; Increment PC
3141
		jmp	dword [z80regular+edx*4]
3142
 
3143
 
3144
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3145
 
3146
CBInst3a:
3147
		mov	dx, [_z80de]	; Move DE into something half usable
3148
		sahf
3149
		shr	dh, 1
3150
		lahf
3151
		and	ah, 0edh	; Clear H and N
3152
		mov	[_z80de], dx	; Once modified, put it back
3153
		xor	edx, edx
3154
		sub	edi, byte 8
3155
		js	near noMoreExec
3156
		mov	dl, byte [esi]	; Get our next instruction
3157
		inc	esi		; Increment PC
3158
		jmp	dword [z80regular+edx*4]
3159
 
3160
 
3161
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3162
 
3163
CBInst3b:
3164
		mov	dx, [_z80de]	; Move DE into something half usable
3165
		sahf
3166
		shr	dl, 1
3167
		lahf
3168
		and	ah, 0edh	; Clear H and N
3169
		mov	[_z80de], dx	; Once modified, put it back
3170
		xor	edx, edx
3171
		sub	edi, byte 8
3172
		js	near noMoreExec
3173
		mov	dl, byte [esi]	; Get our next instruction
3174
		inc	esi		; Increment PC
3175
		jmp	dword [z80regular+edx*4]
3176
 
3177
 
3178
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3179
 
3180
CBInst3c:
3181
		sahf
3182
		shr	bh, 1
3183
		lahf
3184
		and	ah, 0edh	; Clear H and N
3185
		sub	edi, byte 8
3186
		js	near noMoreExec
3187
		mov	dl, byte [esi]	; Get our next instruction
3188
		inc	esi		; Increment PC
3189
		jmp	dword [z80regular+edx*4]
3190
 
3191
 
3192
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3193
 
3194
CBInst3d:
3195
		sahf
3196
		shr	bl, 1
3197
		lahf
3198
		and	ah, 0edh	; Clear H and N
3199
		sub	edi, byte 8
3200
		js	near noMoreExec
3201
		mov	dl, byte [esi]	; Get our next instruction
3202
		inc	esi		; Increment PC
3203
		jmp	dword [z80regular+edx*4]
3204
 
3205
 
3206
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3207
 
3208
CBInst3e:
3209
		mov	[cyclesRemaining], edi
3210
		mov	edi, [_z80MemRead]	; Point to the read array
3211
 
3212
checkLoop14:
3213
		cmp	[edi], word 0ffffh ; End of the list?
3214
		je		memoryRead14
3215
		cmp	ebx, [edi]	; Are we smaller?
3216
		jb		nextAddr14		; Yes, go to the next address
3217
		cmp	ebx, [edi+4]	; Are we bigger?
3218
		jbe	callRoutine14
3219
 
3220
nextAddr14:
3221
		add	edi, 10h		; Next structure!
3222
		jmp	short checkLoop14
3223
 
3224
callRoutine14:
3225
		mov	dx, bx	; Get our address
3226
		call	ReadMemoryByte	; Standard read routine
3227
		mov	dl, al	; Put our returned value here
3228
		mov	ax, [_z80af]	; Get our AF back
3229
		jmp	short readExit14
3230
 
3231
memoryRead14:
3232
		mov	dl, [ebp + ebx]	; Get our data
3233
 
3234
readExit14:
3235
		mov	edi, [cyclesRemaining]
3236
		sahf
3237
		shr	dl, 1
3238
		lahf
3239
		and	ah, 0edh	; Clear H and N
3240
		mov	[cyclesRemaining], edi
3241
		mov	[_z80af], ax	; Store AF
3242
		mov	al, dl	; And our data to write
3243
		mov	edi, [_z80MemWrite]	; Point to the write array
3244
 
3245
checkLoop15:
3246
		cmp	[edi], word 0ffffh ; End of our list?
3247
		je	memoryWrite15	; Yes - go write it!
3248
		cmp	bx, [edi]	; Are we smaller?
3249
		jb	nextAddr15	; Yes... go to the next addr
3250
		cmp	bx, [edi+4]	; Are we smaller?
3251
		jbe	callRoutine15	; If not, go call it!
3252
 
3253
nextAddr15:
3254
		add	edi, 10h		; Next structure, please
3255
		jmp	short checkLoop15
3256
 
3257
callRoutine15:
3258
		mov	dx, bx	; Get our address to target
3259
		call	WriteMemoryByte	; Go write the data!
3260
		jmp	short WriteMacroExit15
3261
memoryWrite15:
3262
		mov	[ebp + ebx], dl
3263
		mov	ax, [_z80af] ; Get our accumulator and flags
3264
WriteMacroExit15:
3265
		mov	edi, [cyclesRemaining]
3266
		xor	edx, edx
3267
		sub	edi, byte 15
3268
		js	near noMoreExec
3269
		mov	dl, byte [esi]	; Get our next instruction
3270
		inc	esi		; Increment PC
3271
		jmp	dword [z80regular+edx*4]
3272
 
3273
 
3274
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3275
 
3276
CBInst3f:
3277
		sahf
3278
		shr	al, 1
3279
		lahf
3280
		and	ah, 0edh	; Clear H and N
3281
		sub	edi, byte 8
3282
		js	near noMoreExec
3283
		mov	dl, byte [esi]	; Get our next instruction
3284
		inc	esi		; Increment PC
3285
		jmp	dword [z80regular+edx*4]
3286
 
3287
 
3288
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3289
 
3290
CBInst40:
3291
		mov	byte [_z80af], ah ; Store F
3292
		sahf
3293
		test ch, 001h	; Do a bitwise check
3294
		lahf
3295
		and	ah, 0c0h	; Only care about Z and S
3296
		or	ah, 10h	; Set half carry to 1
3297
		and	byte [_z80af], 029h		; Only zero/non-zero!
3298
		or	ah, byte [_z80af]	; Put it in with the real flags
3299
		sub	edi, byte 8
3300
		js	near noMoreExec
3301
		mov	dl, byte [esi]	; Get our next instruction
3302
		inc	esi		; Increment PC
3303
		jmp	dword [z80regular+edx*4]
3304
 
3305
 
3306
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3307
 
3308
CBInst41:
3309
		mov	byte [_z80af], ah ; Store F
3310
		sahf
3311
		test cl, 001h	; Do a bitwise check
3312
		lahf
3313
		and	ah, 0c0h	; Only care about Z and S
3314
		or	ah, 10h	; Set half carry to 1
3315
		and	byte [_z80af], 029h		; Only zero/non-zero!
3316
		or	ah, byte [_z80af]	; Put it in with the real flags
3317
		sub	edi, byte 8
3318
		js	near noMoreExec
3319
		mov	dl, byte [esi]	; Get our next instruction
3320
		inc	esi		; Increment PC
3321
		jmp	dword [z80regular+edx*4]
3322
 
3323
 
3324
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3325
 
3326
CBInst42:
3327
		mov	byte [_z80af], ah ; Store F
3328
		sahf
3329
		test byte [_z80de + 1], 001h	; Do a bitwise check
3330
		lahf
3331
		and	ah, 0c0h	; Only care about Z and S
3332
		or	ah, 10h	; Set half carry to 1
3333
		and	byte [_z80af], 029h		; Only zero/non-zero!
3334
		or	ah, byte [_z80af]	; Put it in with the real flags
3335
		sub	edi, byte 8
3336
		js	near noMoreExec
3337
		mov	dl, byte [esi]	; Get our next instruction
3338
		inc	esi		; Increment PC
3339
		jmp	dword [z80regular+edx*4]
3340
 
3341
 
3342
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3343
 
3344
CBInst43:
3345
		mov	byte [_z80af], ah ; Store F
3346
		sahf
3347
		test byte [_z80de], 001h	; Do a bitwise check
3348
		lahf
3349
		and	ah, 0c0h	; Only care about Z and S
3350
		or	ah, 10h	; Set half carry to 1
3351
		and	byte [_z80af], 029h		; Only zero/non-zero!
3352
		or	ah, byte [_z80af]	; Put it in with the real flags
3353
		sub	edi, byte 8
3354
		js	near noMoreExec
3355
		mov	dl, byte [esi]	; Get our next instruction
3356
		inc	esi		; Increment PC
3357
		jmp	dword [z80regular+edx*4]
3358
 
3359
 
3360
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3361
 
3362
CBInst44:
3363
		mov	byte [_z80af], ah ; Store F
3364
		sahf
3365
		test bh, 001h	; Do a bitwise check
3366
		lahf
3367
		and	ah, 0c0h	; Only care about Z and S
3368
		or	ah, 10h	; Set half carry to 1
3369
		and	byte [_z80af], 029h		; Only zero/non-zero!
3370
		or	ah, byte [_z80af]	; Put it in with the real flags
3371
		sub	edi, byte 8
3372
		js	near noMoreExec
3373
		mov	dl, byte [esi]	; Get our next instruction
3374
		inc	esi		; Increment PC
3375
		jmp	dword [z80regular+edx*4]
3376
 
3377
 
3378
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3379
 
3380
CBInst45:
3381
		mov	byte [_z80af], ah ; Store F
3382
		sahf
3383
		test bl, 001h	; Do a bitwise check
3384
		lahf
3385
		and	ah, 0c0h	; Only care about Z and S
3386
		or	ah, 10h	; Set half carry to 1
3387
		and	byte [_z80af], 029h		; Only zero/non-zero!
3388
		or	ah, byte [_z80af]	; Put it in with the real flags
3389
		sub	edi, byte 8
3390
		js	near noMoreExec
3391
		mov	dl, byte [esi]	; Get our next instruction
3392
		inc	esi		; Increment PC
3393
		jmp	dword [z80regular+edx*4]
3394
 
3395
 
3396
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3397
 
3398
CBInst46:
3399
		mov	[cyclesRemaining], edi
3400
		mov	edi, [_z80MemRead]	; Point to the read array
3401
 
3402
checkLoop16:
3403
		cmp	[edi], word 0ffffh ; End of the list?
3404
		je		memoryRead16
3405
		cmp	ebx, [edi]	; Are we smaller?
3406
		jb		nextAddr16		; Yes, go to the next address
3407
		cmp	ebx, [edi+4]	; Are we bigger?
3408
		jbe	callRoutine16
3409
 
3410
nextAddr16:
3411
		add	edi, 10h		; Next structure!
3412
		jmp	short checkLoop16
3413
 
3414
callRoutine16:
3415
		mov	dx, bx	; Get our address
3416
		call	ReadMemoryByte	; Standard read routine
3417
		mov	dl, al	; Put our returned value here
3418
		mov	ax, [_z80af]	; Get our AF back
3419
		jmp	short readExit16
3420
 
3421
memoryRead16:
3422
		mov	dl, [ebp + ebx]	; Get our data
3423
 
3424
readExit16:
3425
		mov	edi, [cyclesRemaining]
3426
		mov	byte [_z80af], ah ; Store F
3427
		sahf
3428
		test	dl, 001h	; Do a bitwise check
3429
		lahf
3430
		and	ah, 0c0h	; Only care about Z and S
3431
		or	ah, 10h	; Set half carry to 1
3432
		and	byte [_z80af], 029h		; Only zero/non-zero!
3433
		or	ah, byte [_z80af]	; Put it in with the real flags
3434
		xor	edx, edx
3435
		sub	edi, byte 12
3436
		js	near noMoreExec
3437
		mov	dl, byte [esi]	; Get our next instruction
3438
		inc	esi		; Increment PC
3439
		jmp	dword [z80regular+edx*4]
3440
 
3441
 
3442
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3443
 
3444
CBInst47:
3445
		mov	byte [_z80af], ah ; Store F
3446
		sahf
3447
		test al, 001h	; Do a bitwise check
3448
		lahf
3449
		and	ah, 0c0h	; Only care about Z and S
3450
		or	ah, 10h	; Set half carry to 1
3451
		and	byte [_z80af], 029h		; Only zero/non-zero!
3452
		or	ah, byte [_z80af]	; Put it in with the real flags
3453
		sub	edi, byte 8
3454
		js	near noMoreExec
3455
		mov	dl, byte [esi]	; Get our next instruction
3456
		inc	esi		; Increment PC
3457
		jmp	dword [z80regular+edx*4]
3458
 
3459
 
3460
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3461
 
3462
CBInst48:
3463
		mov	byte [_z80af], ah ; Store F
3464
		sahf
3465
		test ch, 002h	; Do a bitwise check
3466
		lahf
3467
		and	ah, 0c0h	; Only care about Z and S
3468
		or	ah, 10h	; Set half carry to 1
3469
		and	byte [_z80af], 029h		; Only zero/non-zero!
3470
		or	ah, byte [_z80af]	; Put it in with the real flags
3471
		sub	edi, byte 8
3472
		js	near noMoreExec
3473
		mov	dl, byte [esi]	; Get our next instruction
3474
		inc	esi		; Increment PC
3475
		jmp	dword [z80regular+edx*4]
3476
 
3477
 
3478
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3479
 
3480
CBInst49:
3481
		mov	byte [_z80af], ah ; Store F
3482
		sahf
3483
		test cl, 002h	; Do a bitwise check
3484
		lahf
3485
		and	ah, 0c0h	; Only care about Z and S
3486
		or	ah, 10h	; Set half carry to 1
3487
		and	byte [_z80af], 029h		; Only zero/non-zero!
3488
		or	ah, byte [_z80af]	; Put it in with the real flags
3489
		sub	edi, byte 8
3490
		js	near noMoreExec
3491
		mov	dl, byte [esi]	; Get our next instruction
3492
		inc	esi		; Increment PC
3493
		jmp	dword [z80regular+edx*4]
3494
 
3495
 
3496
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3497
 
3498
CBInst4a:
3499
		mov	byte [_z80af], ah ; Store F
3500
		sahf
3501
		test byte [_z80de + 1], 002h	; Do a bitwise check
3502
		lahf
3503
		and	ah, 0c0h	; Only care about Z and S
3504
		or	ah, 10h	; Set half carry to 1
3505
		and	byte [_z80af], 029h		; Only zero/non-zero!
3506
		or	ah, byte [_z80af]	; Put it in with the real flags
3507
		sub	edi, byte 8
3508
		js	near noMoreExec
3509
		mov	dl, byte [esi]	; Get our next instruction
3510
		inc	esi		; Increment PC
3511
		jmp	dword [z80regular+edx*4]
3512
 
3513
 
3514
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3515
 
3516
CBInst4b:
3517
		mov	byte [_z80af], ah ; Store F
3518
		sahf
3519
		test byte [_z80de], 002h	; Do a bitwise check
3520
		lahf
3521
		and	ah, 0c0h	; Only care about Z and S
3522
		or	ah, 10h	; Set half carry to 1
3523
		and	byte [_z80af], 029h		; Only zero/non-zero!
3524
		or	ah, byte [_z80af]	; Put it in with the real flags
3525
		sub	edi, byte 8
3526
		js	near noMoreExec
3527
		mov	dl, byte [esi]	; Get our next instruction
3528
		inc	esi		; Increment PC
3529
		jmp	dword [z80regular+edx*4]
3530
 
3531
 
3532
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3533
 
3534
CBInst4c:
3535
		mov	byte [_z80af], ah ; Store F
3536
		sahf
3537
		test bh, 002h	; Do a bitwise check
3538
		lahf
3539
		and	ah, 0c0h	; Only care about Z and S
3540
		or	ah, 10h	; Set half carry to 1
3541
		and	byte [_z80af], 029h		; Only zero/non-zero!
3542
		or	ah, byte [_z80af]	; Put it in with the real flags
3543
		sub	edi, byte 8
3544
		js	near noMoreExec
3545
		mov	dl, byte [esi]	; Get our next instruction
3546
		inc	esi		; Increment PC
3547
		jmp	dword [z80regular+edx*4]
3548
 
3549
 
3550
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3551
 
3552
CBInst4d:
3553
		mov	byte [_z80af], ah ; Store F
3554
		sahf
3555
		test bl, 002h	; Do a bitwise check
3556
		lahf
3557
		and	ah, 0c0h	; Only care about Z and S
3558
		or	ah, 10h	; Set half carry to 1
3559
		and	byte [_z80af], 029h		; Only zero/non-zero!
3560
		or	ah, byte [_z80af]	; Put it in with the real flags
3561
		sub	edi, byte 8
3562
		js	near noMoreExec
3563
		mov	dl, byte [esi]	; Get our next instruction
3564
		inc	esi		; Increment PC
3565
		jmp	dword [z80regular+edx*4]
3566
 
3567
 
3568
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3569
 
3570
CBInst4e:
3571
		mov	[cyclesRemaining], edi
3572
		mov	edi, [_z80MemRead]	; Point to the read array
3573
 
3574
checkLoop17:
3575
		cmp	[edi], word 0ffffh ; End of the list?
3576
		je		memoryRead17
3577
		cmp	ebx, [edi]	; Are we smaller?
3578
		jb		nextAddr17		; Yes, go to the next address
3579
		cmp	ebx, [edi+4]	; Are we bigger?
3580
		jbe	callRoutine17
3581
 
3582
nextAddr17:
3583
		add	edi, 10h		; Next structure!
3584
		jmp	short checkLoop17
3585
 
3586
callRoutine17:
3587
		mov	dx, bx	; Get our address
3588
		call	ReadMemoryByte	; Standard read routine
3589
		mov	dl, al	; Put our returned value here
3590
		mov	ax, [_z80af]	; Get our AF back
3591
		jmp	short readExit17
3592
 
3593
memoryRead17:
3594
		mov	dl, [ebp + ebx]	; Get our data
3595
 
3596
readExit17:
3597
		mov	edi, [cyclesRemaining]
3598
		mov	byte [_z80af], ah ; Store F
3599
		sahf
3600
		test	dl, 002h	; Do a bitwise check
3601
		lahf
3602
		and	ah, 0c0h	; Only care about Z and S
3603
		or	ah, 10h	; Set half carry to 1
3604
		and	byte [_z80af], 029h		; Only zero/non-zero!
3605
		or	ah, byte [_z80af]	; Put it in with the real flags
3606
		xor	edx, edx
3607
		sub	edi, byte 12
3608
		js	near noMoreExec
3609
		mov	dl, byte [esi]	; Get our next instruction
3610
		inc	esi		; Increment PC
3611
		jmp	dword [z80regular+edx*4]
3612
 
3613
 
3614
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3615
 
3616
CBInst4f:
3617
		mov	byte [_z80af], ah ; Store F
3618
		sahf
3619
		test al, 002h	; Do a bitwise check
3620
		lahf
3621
		and	ah, 0c0h	; Only care about Z and S
3622
		or	ah, 10h	; Set half carry to 1
3623
		and	byte [_z80af], 029h		; Only zero/non-zero!
3624
		or	ah, byte [_z80af]	; Put it in with the real flags
3625
		sub	edi, byte 8
3626
		js	near noMoreExec
3627
		mov	dl, byte [esi]	; Get our next instruction
3628
		inc	esi		; Increment PC
3629
		jmp	dword [z80regular+edx*4]
3630
 
3631
 
3632
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3633
 
3634
CBInst50:
3635
		mov	byte [_z80af], ah ; Store F
3636
		sahf
3637
		test ch, 004h	; Do a bitwise check
3638
		lahf
3639
		and	ah, 0c0h	; Only care about Z and S
3640
		or	ah, 10h	; Set half carry to 1
3641
		and	byte [_z80af], 029h		; Only zero/non-zero!
3642
		or	ah, byte [_z80af]	; Put it in with the real flags
3643
		sub	edi, byte 8
3644
		js	near noMoreExec
3645
		mov	dl, byte [esi]	; Get our next instruction
3646
		inc	esi		; Increment PC
3647
		jmp	dword [z80regular+edx*4]
3648
 
3649
 
3650
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3651
 
3652
CBInst51:
3653
		mov	byte [_z80af], ah ; Store F
3654
		sahf
3655
		test cl, 004h	; Do a bitwise check
3656
		lahf
3657
		and	ah, 0c0h	; Only care about Z and S
3658
		or	ah, 10h	; Set half carry to 1
3659
		and	byte [_z80af], 029h		; Only zero/non-zero!
3660
		or	ah, byte [_z80af]	; Put it in with the real flags
3661
		sub	edi, byte 8
3662
		js	near noMoreExec
3663
		mov	dl, byte [esi]	; Get our next instruction
3664
		inc	esi		; Increment PC
3665
		jmp	dword [z80regular+edx*4]
3666
 
3667
 
3668
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3669
 
3670
CBInst52:
3671
		mov	byte [_z80af], ah ; Store F
3672
		sahf
3673
		test byte [_z80de + 1], 004h	; Do a bitwise check
3674
		lahf
3675
		and	ah, 0c0h	; Only care about Z and S
3676
		or	ah, 10h	; Set half carry to 1
3677
		and	byte [_z80af], 029h		; Only zero/non-zero!
3678
		or	ah, byte [_z80af]	; Put it in with the real flags
3679
		sub	edi, byte 8
3680
		js	near noMoreExec
3681
		mov	dl, byte [esi]	; Get our next instruction
3682
		inc	esi		; Increment PC
3683
		jmp	dword [z80regular+edx*4]
3684
 
3685
 
3686
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3687
 
3688
CBInst53:
3689
		mov	byte [_z80af], ah ; Store F
3690
		sahf
3691
		test byte [_z80de], 004h	; Do a bitwise check
3692
		lahf
3693
		and	ah, 0c0h	; Only care about Z and S
3694
		or	ah, 10h	; Set half carry to 1
3695
		and	byte [_z80af], 029h		; Only zero/non-zero!
3696
		or	ah, byte [_z80af]	; Put it in with the real flags
3697
		sub	edi, byte 8
3698
		js	near noMoreExec
3699
		mov	dl, byte [esi]	; Get our next instruction
3700
		inc	esi		; Increment PC
3701
		jmp	dword [z80regular+edx*4]
3702
 
3703
 
3704
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3705
 
3706
CBInst54:
3707
		mov	byte [_z80af], ah ; Store F
3708
		sahf
3709
		test bh, 004h	; Do a bitwise check
3710
		lahf
3711
		and	ah, 0c0h	; Only care about Z and S
3712
		or	ah, 10h	; Set half carry to 1
3713
		and	byte [_z80af], 029h		; Only zero/non-zero!
3714
		or	ah, byte [_z80af]	; Put it in with the real flags
3715
		sub	edi, byte 8
3716
		js	near noMoreExec
3717
		mov	dl, byte [esi]	; Get our next instruction
3718
		inc	esi		; Increment PC
3719
		jmp	dword [z80regular+edx*4]
3720
 
3721
 
3722
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3723
 
3724
CBInst55:
3725
		mov	byte [_z80af], ah ; Store F
3726
		sahf
3727
		test bl, 004h	; Do a bitwise check
3728
		lahf
3729
		and	ah, 0c0h	; Only care about Z and S
3730
		or	ah, 10h	; Set half carry to 1
3731
		and	byte [_z80af], 029h		; Only zero/non-zero!
3732
		or	ah, byte [_z80af]	; Put it in with the real flags
3733
		sub	edi, byte 8
3734
		js	near noMoreExec
3735
		mov	dl, byte [esi]	; Get our next instruction
3736
		inc	esi		; Increment PC
3737
		jmp	dword [z80regular+edx*4]
3738
 
3739
 
3740
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3741
 
3742
CBInst56:
3743
		mov	[cyclesRemaining], edi
3744
		mov	edi, [_z80MemRead]	; Point to the read array
3745
 
3746
checkLoop18:
3747
		cmp	[edi], word 0ffffh ; End of the list?
3748
		je		memoryRead18
3749
		cmp	ebx, [edi]	; Are we smaller?
3750
		jb		nextAddr18		; Yes, go to the next address
3751
		cmp	ebx, [edi+4]	; Are we bigger?
3752
		jbe	callRoutine18
3753
 
3754
nextAddr18:
3755
		add	edi, 10h		; Next structure!
3756
		jmp	short checkLoop18
3757
 
3758
callRoutine18:
3759
		mov	dx, bx	; Get our address
3760
		call	ReadMemoryByte	; Standard read routine
3761
		mov	dl, al	; Put our returned value here
3762
		mov	ax, [_z80af]	; Get our AF back
3763
		jmp	short readExit18
3764
 
3765
memoryRead18:
3766
		mov	dl, [ebp + ebx]	; Get our data
3767
 
3768
readExit18:
3769
		mov	edi, [cyclesRemaining]
3770
		mov	byte [_z80af], ah ; Store F
3771
		sahf
3772
		test	dl, 004h	; Do a bitwise check
3773
		lahf
3774
		and	ah, 0c0h	; Only care about Z and S
3775
		or	ah, 10h	; Set half carry to 1
3776
		and	byte [_z80af], 029h		; Only zero/non-zero!
3777
		or	ah, byte [_z80af]	; Put it in with the real flags
3778
		xor	edx, edx
3779
		sub	edi, byte 12
3780
		js	near noMoreExec
3781
		mov	dl, byte [esi]	; Get our next instruction
3782
		inc	esi		; Increment PC
3783
		jmp	dword [z80regular+edx*4]
3784
 
3785
 
3786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3787
 
3788
CBInst57:
3789
		mov	byte [_z80af], ah ; Store F
3790
		sahf
3791
		test al, 004h	; Do a bitwise check
3792
		lahf
3793
		and	ah, 0c0h	; Only care about Z and S
3794
		or	ah, 10h	; Set half carry to 1
3795
		and	byte [_z80af], 029h		; Only zero/non-zero!
3796
		or	ah, byte [_z80af]	; Put it in with the real flags
3797
		sub	edi, byte 8
3798
		js	near noMoreExec
3799
		mov	dl, byte [esi]	; Get our next instruction
3800
		inc	esi		; Increment PC
3801
		jmp	dword [z80regular+edx*4]
3802
 
3803
 
3804
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3805
 
3806
CBInst58:
3807
		mov	byte [_z80af], ah ; Store F
3808
		sahf
3809
		test ch, 008h	; Do a bitwise check
3810
		lahf
3811
		and	ah, 0c0h	; Only care about Z and S
3812
		or	ah, 10h	; Set half carry to 1
3813
		and	byte [_z80af], 029h		; Only zero/non-zero!
3814
		or	ah, byte [_z80af]	; Put it in with the real flags
3815
		sub	edi, byte 8
3816
		js	near noMoreExec
3817
		mov	dl, byte [esi]	; Get our next instruction
3818
		inc	esi		; Increment PC
3819
		jmp	dword [z80regular+edx*4]
3820
 
3821
 
3822
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3823
 
3824
CBInst59:
3825
		mov	byte [_z80af], ah ; Store F
3826
		sahf
3827
		test cl, 008h	; Do a bitwise check
3828
		lahf
3829
		and	ah, 0c0h	; Only care about Z and S
3830
		or	ah, 10h	; Set half carry to 1
3831
		and	byte [_z80af], 029h		; Only zero/non-zero!
3832
		or	ah, byte [_z80af]	; Put it in with the real flags
3833
		sub	edi, byte 8
3834
		js	near noMoreExec
3835
		mov	dl, byte [esi]	; Get our next instruction
3836
		inc	esi		; Increment PC
3837
		jmp	dword [z80regular+edx*4]
3838
 
3839
 
3840
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3841
 
3842
CBInst5a:
3843
		mov	byte [_z80af], ah ; Store F
3844
		sahf
3845
		test byte [_z80de + 1], 008h	; Do a bitwise check
3846
		lahf
3847
		and	ah, 0c0h	; Only care about Z and S
3848
		or	ah, 10h	; Set half carry to 1
3849
		and	byte [_z80af], 029h		; Only zero/non-zero!
3850
		or	ah, byte [_z80af]	; Put it in with the real flags
3851
		sub	edi, byte 8
3852
		js	near noMoreExec
3853
		mov	dl, byte [esi]	; Get our next instruction
3854
		inc	esi		; Increment PC
3855
		jmp	dword [z80regular+edx*4]
3856
 
3857
 
3858
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3859
 
3860
CBInst5b:
3861
		mov	byte [_z80af], ah ; Store F
3862
		sahf
3863
		test byte [_z80de], 008h	; Do a bitwise check
3864
		lahf
3865
		and	ah, 0c0h	; Only care about Z and S
3866
		or	ah, 10h	; Set half carry to 1
3867
		and	byte [_z80af], 029h		; Only zero/non-zero!
3868
		or	ah, byte [_z80af]	; Put it in with the real flags
3869
		sub	edi, byte 8
3870
		js	near noMoreExec
3871
		mov	dl, byte [esi]	; Get our next instruction
3872
		inc	esi		; Increment PC
3873
		jmp	dword [z80regular+edx*4]
3874
 
3875
 
3876
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3877
 
3878
CBInst5c:
3879
		mov	byte [_z80af], ah ; Store F
3880
		sahf
3881
		test bh, 008h	; Do a bitwise check
3882
		lahf
3883
		and	ah, 0c0h	; Only care about Z and S
3884
		or	ah, 10h	; Set half carry to 1
3885
		and	byte [_z80af], 029h		; Only zero/non-zero!
3886
		or	ah, byte [_z80af]	; Put it in with the real flags
3887
		sub	edi, byte 8
3888
		js	near noMoreExec
3889
		mov	dl, byte [esi]	; Get our next instruction
3890
		inc	esi		; Increment PC
3891
		jmp	dword [z80regular+edx*4]
3892
 
3893
 
3894
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3895
 
3896
CBInst5d:
3897
		mov	byte [_z80af], ah ; Store F
3898
		sahf
3899
		test bl, 008h	; Do a bitwise check
3900
		lahf
3901
		and	ah, 0c0h	; Only care about Z and S
3902
		or	ah, 10h	; Set half carry to 1
3903
		and	byte [_z80af], 029h		; Only zero/non-zero!
3904
		or	ah, byte [_z80af]	; Put it in with the real flags
3905
		sub	edi, byte 8
3906
		js	near noMoreExec
3907
		mov	dl, byte [esi]	; Get our next instruction
3908
		inc	esi		; Increment PC
3909
		jmp	dword [z80regular+edx*4]
3910
 
3911
 
3912
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3913
 
3914
CBInst5e:
3915
		mov	[cyclesRemaining], edi
3916
		mov	edi, [_z80MemRead]	; Point to the read array
3917
 
3918
checkLoop19:
3919
		cmp	[edi], word 0ffffh ; End of the list?
3920
		je		memoryRead19
3921
		cmp	ebx, [edi]	; Are we smaller?
3922
		jb		nextAddr19		; Yes, go to the next address
3923
		cmp	ebx, [edi+4]	; Are we bigger?
3924
		jbe	callRoutine19
3925
 
3926
nextAddr19:
3927
		add	edi, 10h		; Next structure!
3928
		jmp	short checkLoop19
3929
 
3930
callRoutine19:
3931
		mov	dx, bx	; Get our address
3932
		call	ReadMemoryByte	; Standard read routine
3933
		mov	dl, al	; Put our returned value here
3934
		mov	ax, [_z80af]	; Get our AF back
3935
		jmp	short readExit19
3936
 
3937
memoryRead19:
3938
		mov	dl, [ebp + ebx]	; Get our data
3939
 
3940
readExit19:
3941
		mov	edi, [cyclesRemaining]
3942
		mov	byte [_z80af], ah ; Store F
3943
		sahf
3944
		test	dl, 008h	; Do a bitwise check
3945
		lahf
3946
		and	ah, 0c0h	; Only care about Z and S
3947
		or	ah, 10h	; Set half carry to 1
3948
		and	byte [_z80af], 029h		; Only zero/non-zero!
3949
		or	ah, byte [_z80af]	; Put it in with the real flags
3950
		xor	edx, edx
3951
		sub	edi, byte 12
3952
		js	near noMoreExec
3953
		mov	dl, byte [esi]	; Get our next instruction
3954
		inc	esi		; Increment PC
3955
		jmp	dword [z80regular+edx*4]
3956
 
3957
 
3958
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3959
 
3960
CBInst5f:
3961
		mov	byte [_z80af], ah ; Store F
3962
		sahf
3963
		test al, 008h	; Do a bitwise check
3964
		lahf
3965
		and	ah, 0c0h	; Only care about Z and S
3966
		or	ah, 10h	; Set half carry to 1
3967
		and	byte [_z80af], 029h		; Only zero/non-zero!
3968
		or	ah, byte [_z80af]	; Put it in with the real flags
3969
		sub	edi, byte 8
3970
		js	near noMoreExec
3971
		mov	dl, byte [esi]	; Get our next instruction
3972
		inc	esi		; Increment PC
3973
		jmp	dword [z80regular+edx*4]
3974
 
3975
 
3976
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3977
 
3978
CBInst60:
3979
		mov	byte [_z80af], ah ; Store F
3980
		sahf
3981
		test ch, 010h	; Do a bitwise check
3982
		lahf
3983
		and	ah, 0c0h	; Only care about Z and S
3984
		or	ah, 10h	; Set half carry to 1
3985
		and	byte [_z80af], 029h		; Only zero/non-zero!
3986
		or	ah, byte [_z80af]	; Put it in with the real flags
3987
		sub	edi, byte 8
3988
		js	near noMoreExec
3989
		mov	dl, byte [esi]	; Get our next instruction
3990
		inc	esi		; Increment PC
3991
		jmp	dword [z80regular+edx*4]
3992
 
3993
 
3994
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
3995
 
3996
CBInst61:
3997
		mov	byte [_z80af], ah ; Store F
3998
		sahf
3999
		test cl, 010h	; Do a bitwise check
4000
		lahf
4001
		and	ah, 0c0h	; Only care about Z and S
4002
		or	ah, 10h	; Set half carry to 1
4003
		and	byte [_z80af], 029h		; Only zero/non-zero!
4004
		or	ah, byte [_z80af]	; Put it in with the real flags
4005
		sub	edi, byte 8
4006
		js	near noMoreExec
4007
		mov	dl, byte [esi]	; Get our next instruction
4008
		inc	esi		; Increment PC
4009
		jmp	dword [z80regular+edx*4]
4010
 
4011
 
4012
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4013
 
4014
CBInst62:
4015
		mov	byte [_z80af], ah ; Store F
4016
		sahf
4017
		test byte [_z80de + 1], 010h	; Do a bitwise check
4018
		lahf
4019
		and	ah, 0c0h	; Only care about Z and S
4020
		or	ah, 10h	; Set half carry to 1
4021
		and	byte [_z80af], 029h		; Only zero/non-zero!
4022
		or	ah, byte [_z80af]	; Put it in with the real flags
4023
		sub	edi, byte 8
4024
		js	near noMoreExec
4025
		mov	dl, byte [esi]	; Get our next instruction
4026
		inc	esi		; Increment PC
4027
		jmp	dword [z80regular+edx*4]
4028
 
4029
 
4030
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4031
 
4032
CBInst63:
4033
		mov	byte [_z80af], ah ; Store F
4034
		sahf
4035
		test byte [_z80de], 010h	; Do a bitwise check
4036
		lahf
4037
		and	ah, 0c0h	; Only care about Z and S
4038
		or	ah, 10h	; Set half carry to 1
4039
		and	byte [_z80af], 029h		; Only zero/non-zero!
4040
		or	ah, byte [_z80af]	; Put it in with the real flags
4041
		sub	edi, byte 8
4042
		js	near noMoreExec
4043
		mov	dl, byte [esi]	; Get our next instruction
4044
		inc	esi		; Increment PC
4045
		jmp	dword [z80regular+edx*4]
4046
 
4047
 
4048
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4049
 
4050
CBInst64:
4051
		mov	byte [_z80af], ah ; Store F
4052
		sahf
4053
		test bh, 010h	; Do a bitwise check
4054
		lahf
4055
		and	ah, 0c0h	; Only care about Z and S
4056
		or	ah, 10h	; Set half carry to 1
4057
		and	byte [_z80af], 029h		; Only zero/non-zero!
4058
		or	ah, byte [_z80af]	; Put it in with the real flags
4059
		sub	edi, byte 8
4060
		js	near noMoreExec
4061
		mov	dl, byte [esi]	; Get our next instruction
4062
		inc	esi		; Increment PC
4063
		jmp	dword [z80regular+edx*4]
4064
 
4065
 
4066
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4067
 
4068
CBInst65:
4069
		mov	byte [_z80af], ah ; Store F
4070
		sahf
4071
		test bl, 010h	; Do a bitwise check
4072
		lahf
4073
		and	ah, 0c0h	; Only care about Z and S
4074
		or	ah, 10h	; Set half carry to 1
4075
		and	byte [_z80af], 029h		; Only zero/non-zero!
4076
		or	ah, byte [_z80af]	; Put it in with the real flags
4077
		sub	edi, byte 8
4078
		js	near noMoreExec
4079
		mov	dl, byte [esi]	; Get our next instruction
4080
		inc	esi		; Increment PC
4081
		jmp	dword [z80regular+edx*4]
4082
 
4083
 
4084
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4085
 
4086
CBInst66:
4087
		mov	[cyclesRemaining], edi
4088
		mov	edi, [_z80MemRead]	; Point to the read array
4089
 
4090
checkLoop20:
4091
		cmp	[edi], word 0ffffh ; End of the list?
4092
		je		memoryRead20
4093
		cmp	ebx, [edi]	; Are we smaller?
4094
		jb		nextAddr20		; Yes, go to the next address
4095
		cmp	ebx, [edi+4]	; Are we bigger?
4096
		jbe	callRoutine20
4097
 
4098
nextAddr20:
4099
		add	edi, 10h		; Next structure!
4100
		jmp	short checkLoop20
4101
 
4102
callRoutine20:
4103
		mov	dx, bx	; Get our address
4104
		call	ReadMemoryByte	; Standard read routine
4105
		mov	dl, al	; Put our returned value here
4106
		mov	ax, [_z80af]	; Get our AF back
4107
		jmp	short readExit20
4108
 
4109
memoryRead20:
4110
		mov	dl, [ebp + ebx]	; Get our data
4111
 
4112
readExit20:
4113
		mov	edi, [cyclesRemaining]
4114
		mov	byte [_z80af], ah ; Store F
4115
		sahf
4116
		test	dl, 010h	; Do a bitwise check
4117
		lahf
4118
		and	ah, 0c0h	; Only care about Z and S
4119
		or	ah, 10h	; Set half carry to 1
4120
		and	byte [_z80af], 029h		; Only zero/non-zero!
4121
		or	ah, byte [_z80af]	; Put it in with the real flags
4122
		xor	edx, edx
4123
		sub	edi, byte 12
4124
		js	near noMoreExec
4125
		mov	dl, byte [esi]	; Get our next instruction
4126
		inc	esi		; Increment PC
4127
		jmp	dword [z80regular+edx*4]
4128
 
4129
 
4130
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4131
 
4132
CBInst67:
4133
		mov	byte [_z80af], ah ; Store F
4134
		sahf
4135
		test al, 010h	; Do a bitwise check
4136
		lahf
4137
		and	ah, 0c0h	; Only care about Z and S
4138
		or	ah, 10h	; Set half carry to 1
4139
		and	byte [_z80af], 029h		; Only zero/non-zero!
4140
		or	ah, byte [_z80af]	; Put it in with the real flags
4141
		sub	edi, byte 8
4142
		js	near noMoreExec
4143
		mov	dl, byte [esi]	; Get our next instruction
4144
		inc	esi		; Increment PC
4145
		jmp	dword [z80regular+edx*4]
4146
 
4147
 
4148
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4149
 
4150
CBInst68:
4151
		mov	byte [_z80af], ah ; Store F
4152
		sahf
4153
		test ch, 020h	; Do a bitwise check
4154
		lahf
4155
		and	ah, 0c0h	; Only care about Z and S
4156
		or	ah, 10h	; Set half carry to 1
4157
		and	byte [_z80af], 029h		; Only zero/non-zero!
4158
		or	ah, byte [_z80af]	; Put it in with the real flags
4159
		sub	edi, byte 8
4160
		js	near noMoreExec
4161
		mov	dl, byte [esi]	; Get our next instruction
4162
		inc	esi		; Increment PC
4163
		jmp	dword [z80regular+edx*4]
4164
 
4165
 
4166
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4167
 
4168
CBInst69:
4169
		mov	byte [_z80af], ah ; Store F
4170
		sahf
4171
		test cl, 020h	; Do a bitwise check
4172
		lahf
4173
		and	ah, 0c0h	; Only care about Z and S
4174
		or	ah, 10h	; Set half carry to 1
4175
		and	byte [_z80af], 029h		; Only zero/non-zero!
4176
		or	ah, byte [_z80af]	; Put it in with the real flags
4177
		sub	edi, byte 8
4178
		js	near noMoreExec
4179
		mov	dl, byte [esi]	; Get our next instruction
4180
		inc	esi		; Increment PC
4181
		jmp	dword [z80regular+edx*4]
4182
 
4183
 
4184
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4185
 
4186
CBInst6a:
4187
		mov	byte [_z80af], ah ; Store F
4188
		sahf
4189
		test byte [_z80de + 1], 020h	; Do a bitwise check
4190
		lahf
4191
		and	ah, 0c0h	; Only care about Z and S
4192
		or	ah, 10h	; Set half carry to 1
4193
		and	byte [_z80af], 029h		; Only zero/non-zero!
4194
		or	ah, byte [_z80af]	; Put it in with the real flags
4195
		sub	edi, byte 8
4196
		js	near noMoreExec
4197
		mov	dl, byte [esi]	; Get our next instruction
4198
		inc	esi		; Increment PC
4199
		jmp	dword [z80regular+edx*4]
4200
 
4201
 
4202
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4203
 
4204
CBInst6b:
4205
		mov	byte [_z80af], ah ; Store F
4206
		sahf
4207
		test byte [_z80de], 020h	; Do a bitwise check
4208
		lahf
4209
		and	ah, 0c0h	; Only care about Z and S
4210
		or	ah, 10h	; Set half carry to 1
4211
		and	byte [_z80af], 029h		; Only zero/non-zero!
4212
		or	ah, byte [_z80af]	; Put it in with the real flags
4213
		sub	edi, byte 8
4214
		js	near noMoreExec
4215
		mov	dl, byte [esi]	; Get our next instruction
4216
		inc	esi		; Increment PC
4217
		jmp	dword [z80regular+edx*4]
4218
 
4219
 
4220
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4221
 
4222
CBInst6c:
4223
		mov	byte [_z80af], ah ; Store F
4224
		sahf
4225
		test bh, 020h	; Do a bitwise check
4226
		lahf
4227
		and	ah, 0c0h	; Only care about Z and S
4228
		or	ah, 10h	; Set half carry to 1
4229
		and	byte [_z80af], 029h		; Only zero/non-zero!
4230
		or	ah, byte [_z80af]	; Put it in with the real flags
4231
		sub	edi, byte 8
4232
		js	near noMoreExec
4233
		mov	dl, byte [esi]	; Get our next instruction
4234
		inc	esi		; Increment PC
4235
		jmp	dword [z80regular+edx*4]
4236
 
4237
 
4238
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4239
 
4240
CBInst6d:
4241
		mov	byte [_z80af], ah ; Store F
4242
		sahf
4243
		test bl, 020h	; Do a bitwise check
4244
		lahf
4245
		and	ah, 0c0h	; Only care about Z and S
4246
		or	ah, 10h	; Set half carry to 1
4247
		and	byte [_z80af], 029h		; Only zero/non-zero!
4248
		or	ah, byte [_z80af]	; Put it in with the real flags
4249
		sub	edi, byte 8
4250
		js	near noMoreExec
4251
		mov	dl, byte [esi]	; Get our next instruction
4252
		inc	esi		; Increment PC
4253
		jmp	dword [z80regular+edx*4]
4254
 
4255
 
4256
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4257
 
4258
CBInst6e:
4259
		mov	[cyclesRemaining], edi
4260
		mov	edi, [_z80MemRead]	; Point to the read array
4261
 
4262
checkLoop21:
4263
		cmp	[edi], word 0ffffh ; End of the list?
4264
		je		memoryRead21
4265
		cmp	ebx, [edi]	; Are we smaller?
4266
		jb		nextAddr21		; Yes, go to the next address
4267
		cmp	ebx, [edi+4]	; Are we bigger?
4268
		jbe	callRoutine21
4269
 
4270
nextAddr21:
4271
		add	edi, 10h		; Next structure!
4272
		jmp	short checkLoop21
4273
 
4274
callRoutine21:
4275
		mov	dx, bx	; Get our address
4276
		call	ReadMemoryByte	; Standard read routine
4277
		mov	dl, al	; Put our returned value here
4278
		mov	ax, [_z80af]	; Get our AF back
4279
		jmp	short readExit21
4280
 
4281
memoryRead21:
4282
		mov	dl, [ebp + ebx]	; Get our data
4283
 
4284
readExit21:
4285
		mov	edi, [cyclesRemaining]
4286
		mov	byte [_z80af], ah ; Store F
4287
		sahf
4288
		test	dl, 020h	; Do a bitwise check
4289
		lahf
4290
		and	ah, 0c0h	; Only care about Z and S
4291
		or	ah, 10h	; Set half carry to 1
4292
		and	byte [_z80af], 029h		; Only zero/non-zero!
4293
		or	ah, byte [_z80af]	; Put it in with the real flags
4294
		xor	edx, edx
4295
		sub	edi, byte 12
4296
		js	near noMoreExec
4297
		mov	dl, byte [esi]	; Get our next instruction
4298
		inc	esi		; Increment PC
4299
		jmp	dword [z80regular+edx*4]
4300
 
4301
 
4302
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4303
 
4304
CBInst6f:
4305
		mov	byte [_z80af], ah ; Store F
4306
		sahf
4307
		test al, 020h	; Do a bitwise check
4308
		lahf
4309
		and	ah, 0c0h	; Only care about Z and S
4310
		or	ah, 10h	; Set half carry to 1
4311
		and	byte [_z80af], 029h		; Only zero/non-zero!
4312
		or	ah, byte [_z80af]	; Put it in with the real flags
4313
		sub	edi, byte 8
4314
		js	near noMoreExec
4315
		mov	dl, byte [esi]	; Get our next instruction
4316
		inc	esi		; Increment PC
4317
		jmp	dword [z80regular+edx*4]
4318
 
4319
 
4320
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4321
 
4322
CBInst70:
4323
		mov	byte [_z80af], ah ; Store F
4324
		sahf
4325
		test ch, 040h	; Do a bitwise check
4326
		lahf
4327
		and	ah, 0c0h	; Only care about Z and S
4328
		or	ah, 10h	; Set half carry to 1
4329
		and	byte [_z80af], 029h		; Only zero/non-zero!
4330
		or	ah, byte [_z80af]	; Put it in with the real flags
4331
		sub	edi, byte 8
4332
		js	near noMoreExec
4333
		mov	dl, byte [esi]	; Get our next instruction
4334
		inc	esi		; Increment PC
4335
		jmp	dword [z80regular+edx*4]
4336
 
4337
 
4338
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4339
 
4340
CBInst71:
4341
		mov	byte [_z80af], ah ; Store F
4342
		sahf
4343
		test cl, 040h	; Do a bitwise check
4344
		lahf
4345
		and	ah, 0c0h	; Only care about Z and S
4346
		or	ah, 10h	; Set half carry to 1
4347
		and	byte [_z80af], 029h		; Only zero/non-zero!
4348
		or	ah, byte [_z80af]	; Put it in with the real flags
4349
		sub	edi, byte 8
4350
		js	near noMoreExec
4351
		mov	dl, byte [esi]	; Get our next instruction
4352
		inc	esi		; Increment PC
4353
		jmp	dword [z80regular+edx*4]
4354
 
4355
 
4356
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4357
 
4358
CBInst72:
4359
		mov	byte [_z80af], ah ; Store F
4360
		sahf
4361
		test byte [_z80de + 1], 040h	; Do a bitwise check
4362
		lahf
4363
		and	ah, 0c0h	; Only care about Z and S
4364
		or	ah, 10h	; Set half carry to 1
4365
		and	byte [_z80af], 029h		; Only zero/non-zero!
4366
		or	ah, byte [_z80af]	; Put it in with the real flags
4367
		sub	edi, byte 8
4368
		js	near noMoreExec
4369
		mov	dl, byte [esi]	; Get our next instruction
4370
		inc	esi		; Increment PC
4371
		jmp	dword [z80regular+edx*4]
4372
 
4373
 
4374
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4375
 
4376
CBInst73:
4377
		mov	byte [_z80af], ah ; Store F
4378
		sahf
4379
		test byte [_z80de], 040h	; Do a bitwise check
4380
		lahf
4381
		and	ah, 0c0h	; Only care about Z and S
4382
		or	ah, 10h	; Set half carry to 1
4383
		and	byte [_z80af], 029h		; Only zero/non-zero!
4384
		or	ah, byte [_z80af]	; Put it in with the real flags
4385
		sub	edi, byte 8
4386
		js	near noMoreExec
4387
		mov	dl, byte [esi]	; Get our next instruction
4388
		inc	esi		; Increment PC
4389
		jmp	dword [z80regular+edx*4]
4390
 
4391
 
4392
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4393
 
4394
CBInst74:
4395
		mov	byte [_z80af], ah ; Store F
4396
		sahf
4397
		test bh, 040h	; Do a bitwise check
4398
		lahf
4399
		and	ah, 0c0h	; Only care about Z and S
4400
		or	ah, 10h	; Set half carry to 1
4401
		and	byte [_z80af], 029h		; Only zero/non-zero!
4402
		or	ah, byte [_z80af]	; Put it in with the real flags
4403
		sub	edi, byte 8
4404
		js	near noMoreExec
4405
		mov	dl, byte [esi]	; Get our next instruction
4406
		inc	esi		; Increment PC
4407
		jmp	dword [z80regular+edx*4]
4408
 
4409
 
4410
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4411
 
4412
CBInst75:
4413
		mov	byte [_z80af], ah ; Store F
4414
		sahf
4415
		test bl, 040h	; Do a bitwise check
4416
		lahf
4417
		and	ah, 0c0h	; Only care about Z and S
4418
		or	ah, 10h	; Set half carry to 1
4419
		and	byte [_z80af], 029h		; Only zero/non-zero!
4420
		or	ah, byte [_z80af]	; Put it in with the real flags
4421
		sub	edi, byte 8
4422
		js	near noMoreExec
4423
		mov	dl, byte [esi]	; Get our next instruction
4424
		inc	esi		; Increment PC
4425
		jmp	dword [z80regular+edx*4]
4426
 
4427
 
4428
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4429
 
4430
CBInst76:
4431
		mov	[cyclesRemaining], edi
4432
		mov	edi, [_z80MemRead]	; Point to the read array
4433
 
4434
checkLoop22:
4435
		cmp	[edi], word 0ffffh ; End of the list?
4436
		je		memoryRead22
4437
		cmp	ebx, [edi]	; Are we smaller?
4438
		jb		nextAddr22		; Yes, go to the next address
4439
		cmp	ebx, [edi+4]	; Are we bigger?
4440
		jbe	callRoutine22
4441
 
4442
nextAddr22:
4443
		add	edi, 10h		; Next structure!
4444
		jmp	short checkLoop22
4445
 
4446
callRoutine22:
4447
		mov	dx, bx	; Get our address
4448
		call	ReadMemoryByte	; Standard read routine
4449
		mov	dl, al	; Put our returned value here
4450
		mov	ax, [_z80af]	; Get our AF back
4451
		jmp	short readExit22
4452
 
4453
memoryRead22:
4454
		mov	dl, [ebp + ebx]	; Get our data
4455
 
4456
readExit22:
4457
		mov	edi, [cyclesRemaining]
4458
		mov	byte [_z80af], ah ; Store F
4459
		sahf
4460
		test	dl, 040h	; Do a bitwise check
4461
		lahf
4462
		and	ah, 0c0h	; Only care about Z and S
4463
		or	ah, 10h	; Set half carry to 1
4464
		and	byte [_z80af], 029h		; Only zero/non-zero!
4465
		or	ah, byte [_z80af]	; Put it in with the real flags
4466
		xor	edx, edx
4467
		sub	edi, byte 12
4468
		js	near noMoreExec
4469
		mov	dl, byte [esi]	; Get our next instruction
4470
		inc	esi		; Increment PC
4471
		jmp	dword [z80regular+edx*4]
4472
 
4473
 
4474
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4475
 
4476
CBInst77:
4477
		mov	byte [_z80af], ah ; Store F
4478
		sahf
4479
		test al, 040h	; Do a bitwise check
4480
		lahf
4481
		and	ah, 0c0h	; Only care about Z and S
4482
		or	ah, 10h	; Set half carry to 1
4483
		and	byte [_z80af], 029h		; Only zero/non-zero!
4484
		or	ah, byte [_z80af]	; Put it in with the real flags
4485
		sub	edi, byte 8
4486
		js	near noMoreExec
4487
		mov	dl, byte [esi]	; Get our next instruction
4488
		inc	esi		; Increment PC
4489
		jmp	dword [z80regular+edx*4]
4490
 
4491
 
4492
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4493
 
4494
CBInst78:
4495
		mov	byte [_z80af], ah ; Store F
4496
		sahf
4497
		test ch, 080h	; Do a bitwise check
4498
		lahf
4499
		and	ah, 0c0h	; Only care about Z and S
4500
		or	ah, 10h	; Set half carry to 1
4501
		and	byte [_z80af], 029h		; Only zero/non-zero!
4502
		or	ah, byte [_z80af]	; Put it in with the real flags
4503
		sub	edi, byte 8
4504
		js	near noMoreExec
4505
		mov	dl, byte [esi]	; Get our next instruction
4506
		inc	esi		; Increment PC
4507
		jmp	dword [z80regular+edx*4]
4508
 
4509
 
4510
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4511
 
4512
CBInst79:
4513
		mov	byte [_z80af], ah ; Store F
4514
		sahf
4515
		test cl, 080h	; Do a bitwise check
4516
		lahf
4517
		and	ah, 0c0h	; Only care about Z and S
4518
		or	ah, 10h	; Set half carry to 1
4519
		and	byte [_z80af], 029h		; Only zero/non-zero!
4520
		or	ah, byte [_z80af]	; Put it in with the real flags
4521
		sub	edi, byte 8
4522
		js	near noMoreExec
4523
		mov	dl, byte [esi]	; Get our next instruction
4524
		inc	esi		; Increment PC
4525
		jmp	dword [z80regular+edx*4]
4526
 
4527
 
4528
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4529
 
4530
CBInst7a:
4531
		mov	byte [_z80af], ah ; Store F
4532
		sahf
4533
		test byte [_z80de + 1], 080h	; Do a bitwise check
4534
		lahf
4535
		and	ah, 0c0h	; Only care about Z and S
4536
		or	ah, 10h	; Set half carry to 1
4537
		and	byte [_z80af], 029h		; Only zero/non-zero!
4538
		or	ah, byte [_z80af]	; Put it in with the real flags
4539
		sub	edi, byte 8
4540
		js	near noMoreExec
4541
		mov	dl, byte [esi]	; Get our next instruction
4542
		inc	esi		; Increment PC
4543
		jmp	dword [z80regular+edx*4]
4544
 
4545
 
4546
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4547
 
4548
CBInst7b:
4549
		mov	byte [_z80af], ah ; Store F
4550
		sahf
4551
		test byte [_z80de], 080h	; Do a bitwise check
4552
		lahf
4553
		and	ah, 0c0h	; Only care about Z and S
4554
		or	ah, 10h	; Set half carry to 1
4555
		and	byte [_z80af], 029h		; Only zero/non-zero!
4556
		or	ah, byte [_z80af]	; Put it in with the real flags
4557
		sub	edi, byte 8
4558
		js	near noMoreExec
4559
		mov	dl, byte [esi]	; Get our next instruction
4560
		inc	esi		; Increment PC
4561
		jmp	dword [z80regular+edx*4]
4562
 
4563
 
4564
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4565
 
4566
CBInst7c:
4567
		mov	byte [_z80af], ah ; Store F
4568
		sahf
4569
		test bh, 080h	; Do a bitwise check
4570
		lahf
4571
		and	ah, 0c0h	; Only care about Z and S
4572
		or	ah, 10h	; Set half carry to 1
4573
		and	byte [_z80af], 029h		; Only zero/non-zero!
4574
		or	ah, byte [_z80af]	; Put it in with the real flags
4575
		sub	edi, byte 8
4576
		js	near noMoreExec
4577
		mov	dl, byte [esi]	; Get our next instruction
4578
		inc	esi		; Increment PC
4579
		jmp	dword [z80regular+edx*4]
4580
 
4581
 
4582
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4583
 
4584
CBInst7d:
4585
		mov	byte [_z80af], ah ; Store F
4586
		sahf
4587
		test bl, 080h	; Do a bitwise check
4588
		lahf
4589
		and	ah, 0c0h	; Only care about Z and S
4590
		or	ah, 10h	; Set half carry to 1
4591
		and	byte [_z80af], 029h		; Only zero/non-zero!
4592
		or	ah, byte [_z80af]	; Put it in with the real flags
4593
		sub	edi, byte 8
4594
		js	near noMoreExec
4595
		mov	dl, byte [esi]	; Get our next instruction
4596
		inc	esi		; Increment PC
4597
		jmp	dword [z80regular+edx*4]
4598
 
4599
 
4600
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4601
 
4602
CBInst7e:
4603
		mov	[cyclesRemaining], edi
4604
		mov	edi, [_z80MemRead]	; Point to the read array
4605
 
4606
checkLoop23:
4607
		cmp	[edi], word 0ffffh ; End of the list?
4608
		je		memoryRead23
4609
		cmp	ebx, [edi]	; Are we smaller?
4610
		jb		nextAddr23		; Yes, go to the next address
4611
		cmp	ebx, [edi+4]	; Are we bigger?
4612
		jbe	callRoutine23
4613
 
4614
nextAddr23:
4615
		add	edi, 10h		; Next structure!
4616
		jmp	short checkLoop23
4617
 
4618
callRoutine23:
4619
		mov	dx, bx	; Get our address
4620
		call	ReadMemoryByte	; Standard read routine
4621
		mov	dl, al	; Put our returned value here
4622
		mov	ax, [_z80af]	; Get our AF back
4623
		jmp	short readExit23
4624
 
4625
memoryRead23:
4626
		mov	dl, [ebp + ebx]	; Get our data
4627
 
4628
readExit23:
4629
		mov	edi, [cyclesRemaining]
4630
		mov	byte [_z80af], ah ; Store F
4631
		sahf
4632
		test	dl, 080h	; Do a bitwise check
4633
		lahf
4634
		and	ah, 0c0h	; Only care about Z and S
4635
		or	ah, 10h	; Set half carry to 1
4636
		and	byte [_z80af], 029h		; Only zero/non-zero!
4637
		or	ah, byte [_z80af]	; Put it in with the real flags
4638
		xor	edx, edx
4639
		sub	edi, byte 12
4640
		js	near noMoreExec
4641
		mov	dl, byte [esi]	; Get our next instruction
4642
		inc	esi		; Increment PC
4643
		jmp	dword [z80regular+edx*4]
4644
 
4645
 
4646
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4647
 
4648
CBInst7f:
4649
		mov	byte [_z80af], ah ; Store F
4650
		sahf
4651
		test al, 080h	; Do a bitwise check
4652
		lahf
4653
		and	ah, 0c0h	; Only care about Z and S
4654
		or	ah, 10h	; Set half carry to 1
4655
		and	byte [_z80af], 029h		; Only zero/non-zero!
4656
		or	ah, byte [_z80af]	; Put it in with the real flags
4657
		sub	edi, byte 8
4658
		js	near noMoreExec
4659
		mov	dl, byte [esi]	; Get our next instruction
4660
		inc	esi		; Increment PC
4661
		jmp	dword [z80regular+edx*4]
4662
 
4663
 
4664
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4665
 
4666
CBInst80:
4667
		and ch, 0feh	; Reset a bit
4668
		sub	edi, byte 8
4669
		js	near noMoreExec
4670
		mov	dl, byte [esi]	; Get our next instruction
4671
		inc	esi		; Increment PC
4672
		jmp	dword [z80regular+edx*4]
4673
 
4674
 
4675
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4676
 
4677
CBInst81:
4678
		and cl, 0feh	; Reset a bit
4679
		sub	edi, byte 8
4680
		js	near noMoreExec
4681
		mov	dl, byte [esi]	; Get our next instruction
4682
		inc	esi		; Increment PC
4683
		jmp	dword [z80regular+edx*4]
4684
 
4685
 
4686
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4687
 
4688
CBInst82:
4689
		mov	dx, [_z80de]	; Move DE into something half usable
4690
		and dh, 0feh	; Reset a bit
4691
		mov	[_z80de], dx	; Once modified, put it back
4692
		xor	edx, edx
4693
		sub	edi, byte 8
4694
		js	near noMoreExec
4695
		mov	dl, byte [esi]	; Get our next instruction
4696
		inc	esi		; Increment PC
4697
		jmp	dword [z80regular+edx*4]
4698
 
4699
 
4700
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4701
 
4702
CBInst83:
4703
		mov	dx, [_z80de]	; Move DE into something half usable
4704
		and dl, 0feh	; Reset a bit
4705
		mov	[_z80de], dx	; Once modified, put it back
4706
		xor	edx, edx
4707
		sub	edi, byte 8
4708
		js	near noMoreExec
4709
		mov	dl, byte [esi]	; Get our next instruction
4710
		inc	esi		; Increment PC
4711
		jmp	dword [z80regular+edx*4]
4712
 
4713
 
4714
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4715
 
4716
CBInst84:
4717
		and bh, 0feh	; Reset a bit
4718
		sub	edi, byte 8
4719
		js	near noMoreExec
4720
		mov	dl, byte [esi]	; Get our next instruction
4721
		inc	esi		; Increment PC
4722
		jmp	dword [z80regular+edx*4]
4723
 
4724
 
4725
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4726
 
4727
CBInst85:
4728
		and bl, 0feh	; Reset a bit
4729
		sub	edi, byte 8
4730
		js	near noMoreExec
4731
		mov	dl, byte [esi]	; Get our next instruction
4732
		inc	esi		; Increment PC
4733
		jmp	dword [z80regular+edx*4]
4734
 
4735
 
4736
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4737
 
4738
CBInst86:
4739
		mov	[cyclesRemaining], edi
4740
		mov	edi, [_z80MemRead]	; Point to the read array
4741
 
4742
checkLoop24:
4743
		cmp	[edi], word 0ffffh ; End of the list?
4744
		je		memoryRead24
4745
		cmp	ebx, [edi]	; Are we smaller?
4746
		jb		nextAddr24		; Yes, go to the next address
4747
		cmp	ebx, [edi+4]	; Are we bigger?
4748
		jbe	callRoutine24
4749
 
4750
nextAddr24:
4751
		add	edi, 10h		; Next structure!
4752
		jmp	short checkLoop24
4753
 
4754
callRoutine24:
4755
		mov	dx, bx	; Get our address
4756
		call	ReadMemoryByte	; Standard read routine
4757
		mov	dl, al	; Put our returned value here
4758
		mov	ax, [_z80af]	; Get our AF back
4759
		jmp	short readExit24
4760
 
4761
memoryRead24:
4762
		mov	dl, [ebp + ebx]	; Get our data
4763
 
4764
readExit24:
4765
		mov	edi, [cyclesRemaining]
4766
		and dl, 0feh	; Reset a bit
4767
		mov	[cyclesRemaining], edi
4768
		mov	[_z80af], ax	; Store AF
4769
		mov	al, dl	; And our data to write
4770
		mov	edi, [_z80MemWrite]	; Point to the write array
4771
 
4772
checkLoop25:
4773
		cmp	[edi], word 0ffffh ; End of our list?
4774
		je	memoryWrite25	; Yes - go write it!
4775
		cmp	bx, [edi]	; Are we smaller?
4776
		jb	nextAddr25	; Yes... go to the next addr
4777
		cmp	bx, [edi+4]	; Are we smaller?
4778
		jbe	callRoutine25	; If not, go call it!
4779
 
4780
nextAddr25:
4781
		add	edi, 10h		; Next structure, please
4782
		jmp	short checkLoop25
4783
 
4784
callRoutine25:
4785
		mov	dx, bx	; Get our address to target
4786
		call	WriteMemoryByte	; Go write the data!
4787
		jmp	short WriteMacroExit25
4788
memoryWrite25:
4789
		mov	[ebp + ebx], dl
4790
		mov	ax, [_z80af] ; Get our accumulator and flags
4791
WriteMacroExit25:
4792
		mov	edi, [cyclesRemaining]
4793
		xor	edx, edx
4794
		sub	edi, byte 15
4795
		js	near noMoreExec
4796
		mov	dl, byte [esi]	; Get our next instruction
4797
		inc	esi		; Increment PC
4798
		jmp	dword [z80regular+edx*4]
4799
 
4800
 
4801
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4802
 
4803
CBInst87:
4804
		and al, 0feh	; Reset a bit
4805
		sub	edi, byte 8
4806
		js	near noMoreExec
4807
		mov	dl, byte [esi]	; Get our next instruction
4808
		inc	esi		; Increment PC
4809
		jmp	dword [z80regular+edx*4]
4810
 
4811
 
4812
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4813
 
4814
CBInst88:
4815
		and ch, 0fdh	; Reset a bit
4816
		sub	edi, byte 8
4817
		js	near noMoreExec
4818
		mov	dl, byte [esi]	; Get our next instruction
4819
		inc	esi		; Increment PC
4820
		jmp	dword [z80regular+edx*4]
4821
 
4822
 
4823
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4824
 
4825
CBInst89:
4826
		and cl, 0fdh	; Reset a bit
4827
		sub	edi, byte 8
4828
		js	near noMoreExec
4829
		mov	dl, byte [esi]	; Get our next instruction
4830
		inc	esi		; Increment PC
4831
		jmp	dword [z80regular+edx*4]
4832
 
4833
 
4834
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4835
 
4836
CBInst8a:
4837
		mov	dx, [_z80de]	; Move DE into something half usable
4838
		and dh, 0fdh	; Reset a bit
4839
		mov	[_z80de], dx	; Once modified, put it back
4840
		xor	edx, edx
4841
		sub	edi, byte 8
4842
		js	near noMoreExec
4843
		mov	dl, byte [esi]	; Get our next instruction
4844
		inc	esi		; Increment PC
4845
		jmp	dword [z80regular+edx*4]
4846
 
4847
 
4848
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4849
 
4850
CBInst8b:
4851
		mov	dx, [_z80de]	; Move DE into something half usable
4852
		and dl, 0fdh	; Reset a bit
4853
		mov	[_z80de], dx	; Once modified, put it back
4854
		xor	edx, edx
4855
		sub	edi, byte 8
4856
		js	near noMoreExec
4857
		mov	dl, byte [esi]	; Get our next instruction
4858
		inc	esi		; Increment PC
4859
		jmp	dword [z80regular+edx*4]
4860
 
4861
 
4862
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4863
 
4864
CBInst8c:
4865
		and bh, 0fdh	; Reset a bit
4866
		sub	edi, byte 8
4867
		js	near noMoreExec
4868
		mov	dl, byte [esi]	; Get our next instruction
4869
		inc	esi		; Increment PC
4870
		jmp	dword [z80regular+edx*4]
4871
 
4872
 
4873
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4874
 
4875
CBInst8d:
4876
		and bl, 0fdh	; Reset a bit
4877
		sub	edi, byte 8
4878
		js	near noMoreExec
4879
		mov	dl, byte [esi]	; Get our next instruction
4880
		inc	esi		; Increment PC
4881
		jmp	dword [z80regular+edx*4]
4882
 
4883
 
4884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4885
 
4886
CBInst8e:
4887
		mov	[cyclesRemaining], edi
4888
		mov	edi, [_z80MemRead]	; Point to the read array
4889
 
4890
checkLoop26:
4891
		cmp	[edi], word 0ffffh ; End of the list?
4892
		je		memoryRead26
4893
		cmp	ebx, [edi]	; Are we smaller?
4894
		jb		nextAddr26		; Yes, go to the next address
4895
		cmp	ebx, [edi+4]	; Are we bigger?
4896
		jbe	callRoutine26
4897
 
4898
nextAddr26:
4899
		add	edi, 10h		; Next structure!
4900
		jmp	short checkLoop26
4901
 
4902
callRoutine26:
4903
		mov	dx, bx	; Get our address
4904
		call	ReadMemoryByte	; Standard read routine
4905
		mov	dl, al	; Put our returned value here
4906
		mov	ax, [_z80af]	; Get our AF back
4907
		jmp	short readExit26
4908
 
4909
memoryRead26:
4910
		mov	dl, [ebp + ebx]	; Get our data
4911
 
4912
readExit26:
4913
		mov	edi, [cyclesRemaining]
4914
		and dl, 0fdh	; Reset a bit
4915
		mov	[cyclesRemaining], edi
4916
		mov	[_z80af], ax	; Store AF
4917
		mov	al, dl	; And our data to write
4918
		mov	edi, [_z80MemWrite]	; Point to the write array
4919
 
4920
checkLoop27:
4921
		cmp	[edi], word 0ffffh ; End of our list?
4922
		je	memoryWrite27	; Yes - go write it!
4923
		cmp	bx, [edi]	; Are we smaller?
4924
		jb	nextAddr27	; Yes... go to the next addr
4925
		cmp	bx, [edi+4]	; Are we smaller?
4926
		jbe	callRoutine27	; If not, go call it!
4927
 
4928
nextAddr27:
4929
		add	edi, 10h		; Next structure, please
4930
		jmp	short checkLoop27
4931
 
4932
callRoutine27:
4933
		mov	dx, bx	; Get our address to target
4934
		call	WriteMemoryByte	; Go write the data!
4935
		jmp	short WriteMacroExit27
4936
memoryWrite27:
4937
		mov	[ebp + ebx], dl
4938
		mov	ax, [_z80af] ; Get our accumulator and flags
4939
WriteMacroExit27:
4940
		mov	edi, [cyclesRemaining]
4941
		xor	edx, edx
4942
		sub	edi, byte 15
4943
		js	near noMoreExec
4944
		mov	dl, byte [esi]	; Get our next instruction
4945
		inc	esi		; Increment PC
4946
		jmp	dword [z80regular+edx*4]
4947
 
4948
 
4949
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4950
 
4951
CBInst8f:
4952
		and al, 0fdh	; Reset a bit
4953
		sub	edi, byte 8
4954
		js	near noMoreExec
4955
		mov	dl, byte [esi]	; Get our next instruction
4956
		inc	esi		; Increment PC
4957
		jmp	dword [z80regular+edx*4]
4958
 
4959
 
4960
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4961
 
4962
CBInst90:
4963
		and ch, 0fbh	; Reset a bit
4964
		sub	edi, byte 8
4965
		js	near noMoreExec
4966
		mov	dl, byte [esi]	; Get our next instruction
4967
		inc	esi		; Increment PC
4968
		jmp	dword [z80regular+edx*4]
4969
 
4970
 
4971
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4972
 
4973
CBInst91:
4974
		and cl, 0fbh	; Reset a bit
4975
		sub	edi, byte 8
4976
		js	near noMoreExec
4977
		mov	dl, byte [esi]	; Get our next instruction
4978
		inc	esi		; Increment PC
4979
		jmp	dword [z80regular+edx*4]
4980
 
4981
 
4982
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4983
 
4984
CBInst92:
4985
		mov	dx, [_z80de]	; Move DE into something half usable
4986
		and dh, 0fbh	; Reset a bit
4987
		mov	[_z80de], dx	; Once modified, put it back
4988
		xor	edx, edx
4989
		sub	edi, byte 8
4990
		js	near noMoreExec
4991
		mov	dl, byte [esi]	; Get our next instruction
4992
		inc	esi		; Increment PC
4993
		jmp	dword [z80regular+edx*4]
4994
 
4995
 
4996
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
4997
 
4998
CBInst93:
4999
		mov	dx, [_z80de]	; Move DE into something half usable
5000
		and dl, 0fbh	; Reset a bit
5001
		mov	[_z80de], dx	; Once modified, put it back
5002
		xor	edx, edx
5003
		sub	edi, byte 8
5004
		js	near noMoreExec
5005
		mov	dl, byte [esi]	; Get our next instruction
5006
		inc	esi		; Increment PC
5007
		jmp	dword [z80regular+edx*4]
5008
 
5009
 
5010
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5011
 
5012
CBInst94:
5013
		and bh, 0fbh	; Reset a bit
5014
		sub	edi, byte 8
5015
		js	near noMoreExec
5016
		mov	dl, byte [esi]	; Get our next instruction
5017
		inc	esi		; Increment PC
5018
		jmp	dword [z80regular+edx*4]
5019
 
5020
 
5021
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5022
 
5023
CBInst95:
5024
		and bl, 0fbh	; Reset a bit
5025
		sub	edi, byte 8
5026
		js	near noMoreExec
5027
		mov	dl, byte [esi]	; Get our next instruction
5028
		inc	esi		; Increment PC
5029
		jmp	dword [z80regular+edx*4]
5030
 
5031
 
5032
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5033
 
5034
CBInst96:
5035
		mov	[cyclesRemaining], edi
5036
		mov	edi, [_z80MemRead]	; Point to the read array
5037
 
5038
checkLoop28:
5039
		cmp	[edi], word 0ffffh ; End of the list?
5040
		je		memoryRead28
5041
		cmp	ebx, [edi]	; Are we smaller?
5042
		jb		nextAddr28		; Yes, go to the next address
5043
		cmp	ebx, [edi+4]	; Are we bigger?
5044
		jbe	callRoutine28
5045
 
5046
nextAddr28:
5047
		add	edi, 10h		; Next structure!
5048
		jmp	short checkLoop28
5049
 
5050
callRoutine28:
5051
		mov	dx, bx	; Get our address
5052
		call	ReadMemoryByte	; Standard read routine
5053
		mov	dl, al	; Put our returned value here
5054
		mov	ax, [_z80af]	; Get our AF back
5055
		jmp	short readExit28
5056
 
5057
memoryRead28:
5058
		mov	dl, [ebp + ebx]	; Get our data
5059
 
5060
readExit28:
5061
		mov	edi, [cyclesRemaining]
5062
		and dl, 0fbh	; Reset a bit
5063
		mov	[cyclesRemaining], edi
5064
		mov	[_z80af], ax	; Store AF
5065
		mov	al, dl	; And our data to write
5066
		mov	edi, [_z80MemWrite]	; Point to the write array
5067
 
5068
checkLoop29:
5069
		cmp	[edi], word 0ffffh ; End of our list?
5070
		je	memoryWrite29	; Yes - go write it!
5071
		cmp	bx, [edi]	; Are we smaller?
5072
		jb	nextAddr29	; Yes... go to the next addr
5073
		cmp	bx, [edi+4]	; Are we smaller?
5074
		jbe	callRoutine29	; If not, go call it!
5075
 
5076
nextAddr29:
5077
		add	edi, 10h		; Next structure, please
5078
		jmp	short checkLoop29
5079
 
5080
callRoutine29:
5081
		mov	dx, bx	; Get our address to target
5082
		call	WriteMemoryByte	; Go write the data!
5083
		jmp	short WriteMacroExit29
5084
memoryWrite29:
5085
		mov	[ebp + ebx], dl
5086
		mov	ax, [_z80af] ; Get our accumulator and flags
5087
WriteMacroExit29:
5088
		mov	edi, [cyclesRemaining]
5089
		xor	edx, edx
5090
		sub	edi, byte 15
5091
		js	near noMoreExec
5092
		mov	dl, byte [esi]	; Get our next instruction
5093
		inc	esi		; Increment PC
5094
		jmp	dword [z80regular+edx*4]
5095
 
5096
 
5097
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5098
 
5099
CBInst97:
5100
		and al, 0fbh	; Reset a bit
5101
		sub	edi, byte 8
5102
		js	near noMoreExec
5103
		mov	dl, byte [esi]	; Get our next instruction
5104
		inc	esi		; Increment PC
5105
		jmp	dword [z80regular+edx*4]
5106
 
5107
 
5108
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5109
 
5110
CBInst98:
5111
		and ch, 0f7h	; Reset a bit
5112
		sub	edi, byte 8
5113
		js	near noMoreExec
5114
		mov	dl, byte [esi]	; Get our next instruction
5115
		inc	esi		; Increment PC
5116
		jmp	dword [z80regular+edx*4]
5117
 
5118
 
5119
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5120
 
5121
CBInst99:
5122
		and cl, 0f7h	; Reset a bit
5123
		sub	edi, byte 8
5124
		js	near noMoreExec
5125
		mov	dl, byte [esi]	; Get our next instruction
5126
		inc	esi		; Increment PC
5127
		jmp	dword [z80regular+edx*4]
5128
 
5129
 
5130
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5131
 
5132
CBInst9a:
5133
		mov	dx, [_z80de]	; Move DE into something half usable
5134
		and dh, 0f7h	; Reset a bit
5135
		mov	[_z80de], dx	; Once modified, put it back
5136
		xor	edx, edx
5137
		sub	edi, byte 8
5138
		js	near noMoreExec
5139
		mov	dl, byte [esi]	; Get our next instruction
5140
		inc	esi		; Increment PC
5141
		jmp	dword [z80regular+edx*4]
5142
 
5143
 
5144
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5145
 
5146
CBInst9b:
5147
		mov	dx, [_z80de]	; Move DE into something half usable
5148
		and dl, 0f7h	; Reset a bit
5149
		mov	[_z80de], dx	; Once modified, put it back
5150
		xor	edx, edx
5151
		sub	edi, byte 8
5152
		js	near noMoreExec
5153
		mov	dl, byte [esi]	; Get our next instruction
5154
		inc	esi		; Increment PC
5155
		jmp	dword [z80regular+edx*4]
5156
 
5157
 
5158
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5159
 
5160
CBInst9c:
5161
		and bh, 0f7h	; Reset a bit
5162
		sub	edi, byte 8
5163
		js	near noMoreExec
5164
		mov	dl, byte [esi]	; Get our next instruction
5165
		inc	esi		; Increment PC
5166
		jmp	dword [z80regular+edx*4]
5167
 
5168
 
5169
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5170
 
5171
CBInst9d:
5172
		and bl, 0f7h	; Reset a bit
5173
		sub	edi, byte 8
5174
		js	near noMoreExec
5175
		mov	dl, byte [esi]	; Get our next instruction
5176
		inc	esi		; Increment PC
5177
		jmp	dword [z80regular+edx*4]
5178
 
5179
 
5180
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5181
 
5182
CBInst9e:
5183
		mov	[cyclesRemaining], edi
5184
		mov	edi, [_z80MemRead]	; Point to the read array
5185
 
5186
checkLoop30:
5187
		cmp	[edi], word 0ffffh ; End of the list?
5188
		je		memoryRead30
5189
		cmp	ebx, [edi]	; Are we smaller?
5190
		jb		nextAddr30		; Yes, go to the next address
5191
		cmp	ebx, [edi+4]	; Are we bigger?
5192
		jbe	callRoutine30
5193
 
5194
nextAddr30:
5195
		add	edi, 10h		; Next structure!
5196
		jmp	short checkLoop30
5197
 
5198
callRoutine30:
5199
		mov	dx, bx	; Get our address
5200
		call	ReadMemoryByte	; Standard read routine
5201
		mov	dl, al	; Put our returned value here
5202
		mov	ax, [_z80af]	; Get our AF back
5203
		jmp	short readExit30
5204
 
5205
memoryRead30:
5206
		mov	dl, [ebp + ebx]	; Get our data
5207
 
5208
readExit30:
5209
		mov	edi, [cyclesRemaining]
5210
		and dl, 0f7h	; Reset a bit
5211
		mov	[cyclesRemaining], edi
5212
		mov	[_z80af], ax	; Store AF
5213
		mov	al, dl	; And our data to write
5214
		mov	edi, [_z80MemWrite]	; Point to the write array
5215
 
5216
checkLoop31:
5217
		cmp	[edi], word 0ffffh ; End of our list?
5218
		je	memoryWrite31	; Yes - go write it!
5219
		cmp	bx, [edi]	; Are we smaller?
5220
		jb	nextAddr31	; Yes... go to the next addr
5221
		cmp	bx, [edi+4]	; Are we smaller?
5222
		jbe	callRoutine31	; If not, go call it!
5223
 
5224
nextAddr31:
5225
		add	edi, 10h		; Next structure, please
5226
		jmp	short checkLoop31
5227
 
5228
callRoutine31:
5229
		mov	dx, bx	; Get our address to target
5230
		call	WriteMemoryByte	; Go write the data!
5231
		jmp	short WriteMacroExit31
5232
memoryWrite31:
5233
		mov	[ebp + ebx], dl
5234
		mov	ax, [_z80af] ; Get our accumulator and flags
5235
WriteMacroExit31:
5236
		mov	edi, [cyclesRemaining]
5237
		xor	edx, edx
5238
		sub	edi, byte 15
5239
		js	near noMoreExec
5240
		mov	dl, byte [esi]	; Get our next instruction
5241
		inc	esi		; Increment PC
5242
		jmp	dword [z80regular+edx*4]
5243
 
5244
 
5245
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5246
 
5247
CBInst9f:
5248
		and al, 0f7h	; Reset a bit
5249
		sub	edi, byte 8
5250
		js	near noMoreExec
5251
		mov	dl, byte [esi]	; Get our next instruction
5252
		inc	esi		; Increment PC
5253
		jmp	dword [z80regular+edx*4]
5254
 
5255
 
5256
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5257
 
5258
CBInsta0:
5259
		and ch, 0efh	; Reset a bit
5260
		sub	edi, byte 8
5261
		js	near noMoreExec
5262
		mov	dl, byte [esi]	; Get our next instruction
5263
		inc	esi		; Increment PC
5264
		jmp	dword [z80regular+edx*4]
5265
 
5266
 
5267
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5268
 
5269
CBInsta1:
5270
		and cl, 0efh	; Reset a bit
5271
		sub	edi, byte 8
5272
		js	near noMoreExec
5273
		mov	dl, byte [esi]	; Get our next instruction
5274
		inc	esi		; Increment PC
5275
		jmp	dword [z80regular+edx*4]
5276
 
5277
 
5278
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5279
 
5280
CBInsta2:
5281
		mov	dx, [_z80de]	; Move DE into something half usable
5282
		and dh, 0efh	; Reset a bit
5283
		mov	[_z80de], dx	; Once modified, put it back
5284
		xor	edx, edx
5285
		sub	edi, byte 8
5286
		js	near noMoreExec
5287
		mov	dl, byte [esi]	; Get our next instruction
5288
		inc	esi		; Increment PC
5289
		jmp	dword [z80regular+edx*4]
5290
 
5291
 
5292
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5293
 
5294
CBInsta3:
5295
		mov	dx, [_z80de]	; Move DE into something half usable
5296
		and dl, 0efh	; Reset a bit
5297
		mov	[_z80de], dx	; Once modified, put it back
5298
		xor	edx, edx
5299
		sub	edi, byte 8
5300
		js	near noMoreExec
5301
		mov	dl, byte [esi]	; Get our next instruction
5302
		inc	esi		; Increment PC
5303
		jmp	dword [z80regular+edx*4]
5304
 
5305
 
5306
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5307
 
5308
CBInsta4:
5309
		and bh, 0efh	; Reset a bit
5310
		sub	edi, byte 8
5311
		js	near noMoreExec
5312
		mov	dl, byte [esi]	; Get our next instruction
5313
		inc	esi		; Increment PC
5314
		jmp	dword [z80regular+edx*4]
5315
 
5316
 
5317
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5318
 
5319
CBInsta5:
5320
		and bl, 0efh	; Reset a bit
5321
		sub	edi, byte 8
5322
		js	near noMoreExec
5323
		mov	dl, byte [esi]	; Get our next instruction
5324
		inc	esi		; Increment PC
5325
		jmp	dword [z80regular+edx*4]
5326
 
5327
 
5328
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5329
 
5330
CBInsta6:
5331
		mov	[cyclesRemaining], edi
5332
		mov	edi, [_z80MemRead]	; Point to the read array
5333
 
5334
checkLoop32:
5335
		cmp	[edi], word 0ffffh ; End of the list?
5336
		je		memoryRead32
5337
		cmp	ebx, [edi]	; Are we smaller?
5338
		jb		nextAddr32		; Yes, go to the next address
5339
		cmp	ebx, [edi+4]	; Are we bigger?
5340
		jbe	callRoutine32
5341
 
5342
nextAddr32:
5343
		add	edi, 10h		; Next structure!
5344
		jmp	short checkLoop32
5345
 
5346
callRoutine32:
5347
		mov	dx, bx	; Get our address
5348
		call	ReadMemoryByte	; Standard read routine
5349
		mov	dl, al	; Put our returned value here
5350
		mov	ax, [_z80af]	; Get our AF back
5351
		jmp	short readExit32
5352
 
5353
memoryRead32:
5354
		mov	dl, [ebp + ebx]	; Get our data
5355
 
5356
readExit32:
5357
		mov	edi, [cyclesRemaining]
5358
		and dl, 0efh	; Reset a bit
5359
		mov	[cyclesRemaining], edi
5360
		mov	[_z80af], ax	; Store AF
5361
		mov	al, dl	; And our data to write
5362
		mov	edi, [_z80MemWrite]	; Point to the write array
5363
 
5364
checkLoop33:
5365
		cmp	[edi], word 0ffffh ; End of our list?
5366
		je	memoryWrite33	; Yes - go write it!
5367
		cmp	bx, [edi]	; Are we smaller?
5368
		jb	nextAddr33	; Yes... go to the next addr
5369
		cmp	bx, [edi+4]	; Are we smaller?
5370
		jbe	callRoutine33	; If not, go call it!
5371
 
5372
nextAddr33:
5373
		add	edi, 10h		; Next structure, please
5374
		jmp	short checkLoop33
5375
 
5376
callRoutine33:
5377
		mov	dx, bx	; Get our address to target
5378
		call	WriteMemoryByte	; Go write the data!
5379
		jmp	short WriteMacroExit33
5380
memoryWrite33:
5381
		mov	[ebp + ebx], dl
5382
		mov	ax, [_z80af] ; Get our accumulator and flags
5383
WriteMacroExit33:
5384
		mov	edi, [cyclesRemaining]
5385
		xor	edx, edx
5386
		sub	edi, byte 15
5387
		js	near noMoreExec
5388
		mov	dl, byte [esi]	; Get our next instruction
5389
		inc	esi		; Increment PC
5390
		jmp	dword [z80regular+edx*4]
5391
 
5392
 
5393
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5394
 
5395
CBInsta7:
5396
		and al, 0efh	; Reset a bit
5397
		sub	edi, byte 8
5398
		js	near noMoreExec
5399
		mov	dl, byte [esi]	; Get our next instruction
5400
		inc	esi		; Increment PC
5401
		jmp	dword [z80regular+edx*4]
5402
 
5403
 
5404
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5405
 
5406
CBInsta8:
5407
		and ch, 0dfh	; Reset a bit
5408
		sub	edi, byte 8
5409
		js	near noMoreExec
5410
		mov	dl, byte [esi]	; Get our next instruction
5411
		inc	esi		; Increment PC
5412
		jmp	dword [z80regular+edx*4]
5413
 
5414
 
5415
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5416
 
5417
CBInsta9:
5418
		and cl, 0dfh	; Reset a bit
5419
		sub	edi, byte 8
5420
		js	near noMoreExec
5421
		mov	dl, byte [esi]	; Get our next instruction
5422
		inc	esi		; Increment PC
5423
		jmp	dword [z80regular+edx*4]
5424
 
5425
 
5426
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5427
 
5428
CBInstaa:
5429
		mov	dx, [_z80de]	; Move DE into something half usable
5430
		and dh, 0dfh	; Reset a bit
5431
		mov	[_z80de], dx	; Once modified, put it back
5432
		xor	edx, edx
5433
		sub	edi, byte 8
5434
		js	near noMoreExec
5435
		mov	dl, byte [esi]	; Get our next instruction
5436
		inc	esi		; Increment PC
5437
		jmp	dword [z80regular+edx*4]
5438
 
5439
 
5440
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5441
 
5442
CBInstab:
5443
		mov	dx, [_z80de]	; Move DE into something half usable
5444
		and dl, 0dfh	; Reset a bit
5445
		mov	[_z80de], dx	; Once modified, put it back
5446
		xor	edx, edx
5447
		sub	edi, byte 8
5448
		js	near noMoreExec
5449
		mov	dl, byte [esi]	; Get our next instruction
5450
		inc	esi		; Increment PC
5451
		jmp	dword [z80regular+edx*4]
5452
 
5453
 
5454
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5455
 
5456
CBInstac:
5457
		and bh, 0dfh	; Reset a bit
5458
		sub	edi, byte 8
5459
		js	near noMoreExec
5460
		mov	dl, byte [esi]	; Get our next instruction
5461
		inc	esi		; Increment PC
5462
		jmp	dword [z80regular+edx*4]
5463
 
5464
 
5465
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5466
 
5467
CBInstad:
5468
		and bl, 0dfh	; Reset a bit
5469
		sub	edi, byte 8
5470
		js	near noMoreExec
5471
		mov	dl, byte [esi]	; Get our next instruction
5472
		inc	esi		; Increment PC
5473
		jmp	dword [z80regular+edx*4]
5474
 
5475
 
5476
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5477
 
5478
CBInstae:
5479
		mov	[cyclesRemaining], edi
5480
		mov	edi, [_z80MemRead]	; Point to the read array
5481
 
5482
checkLoop34:
5483
		cmp	[edi], word 0ffffh ; End of the list?
5484
		je		memoryRead34
5485
		cmp	ebx, [edi]	; Are we smaller?
5486
		jb		nextAddr34		; Yes, go to the next address
5487
		cmp	ebx, [edi+4]	; Are we bigger?
5488
		jbe	callRoutine34
5489
 
5490
nextAddr34:
5491
		add	edi, 10h		; Next structure!
5492
		jmp	short checkLoop34
5493
 
5494
callRoutine34:
5495
		mov	dx, bx	; Get our address
5496
		call	ReadMemoryByte	; Standard read routine
5497
		mov	dl, al	; Put our returned value here
5498
		mov	ax, [_z80af]	; Get our AF back
5499
		jmp	short readExit34
5500
 
5501
memoryRead34:
5502
		mov	dl, [ebp + ebx]	; Get our data
5503
 
5504
readExit34:
5505
		mov	edi, [cyclesRemaining]
5506
		and dl, 0dfh	; Reset a bit
5507
		mov	[cyclesRemaining], edi
5508
		mov	[_z80af], ax	; Store AF
5509
		mov	al, dl	; And our data to write
5510
		mov	edi, [_z80MemWrite]	; Point to the write array
5511
 
5512
checkLoop35:
5513
		cmp	[edi], word 0ffffh ; End of our list?
5514
		je	memoryWrite35	; Yes - go write it!
5515
		cmp	bx, [edi]	; Are we smaller?
5516
		jb	nextAddr35	; Yes... go to the next addr
5517
		cmp	bx, [edi+4]	; Are we smaller?
5518
		jbe	callRoutine35	; If not, go call it!
5519
 
5520
nextAddr35:
5521
		add	edi, 10h		; Next structure, please
5522
		jmp	short checkLoop35
5523
 
5524
callRoutine35:
5525
		mov	dx, bx	; Get our address to target
5526
		call	WriteMemoryByte	; Go write the data!
5527
		jmp	short WriteMacroExit35
5528
memoryWrite35:
5529
		mov	[ebp + ebx], dl
5530
		mov	ax, [_z80af] ; Get our accumulator and flags
5531
WriteMacroExit35:
5532
		mov	edi, [cyclesRemaining]
5533
		xor	edx, edx
5534
		sub	edi, byte 15
5535
		js	near noMoreExec
5536
		mov	dl, byte [esi]	; Get our next instruction
5537
		inc	esi		; Increment PC
5538
		jmp	dword [z80regular+edx*4]
5539
 
5540
 
5541
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5542
 
5543
CBInstaf:
5544
		and al, 0dfh	; Reset a bit
5545
		sub	edi, byte 8
5546
		js	near noMoreExec
5547
		mov	dl, byte [esi]	; Get our next instruction
5548
		inc	esi		; Increment PC
5549
		jmp	dword [z80regular+edx*4]
5550
 
5551
 
5552
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5553
 
5554
CBInstb0:
5555
		and ch, 0bfh	; Reset a bit
5556
		sub	edi, byte 8
5557
		js	near noMoreExec
5558
		mov	dl, byte [esi]	; Get our next instruction
5559
		inc	esi		; Increment PC
5560
		jmp	dword [z80regular+edx*4]
5561
 
5562
 
5563
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5564
 
5565
CBInstb1:
5566
		and cl, 0bfh	; Reset a bit
5567
		sub	edi, byte 8
5568
		js	near noMoreExec
5569
		mov	dl, byte [esi]	; Get our next instruction
5570
		inc	esi		; Increment PC
5571
		jmp	dword [z80regular+edx*4]
5572
 
5573
 
5574
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5575
 
5576
CBInstb2:
5577
		mov	dx, [_z80de]	; Move DE into something half usable
5578
		and dh, 0bfh	; Reset a bit
5579
		mov	[_z80de], dx	; Once modified, put it back
5580
		xor	edx, edx
5581
		sub	edi, byte 8
5582
		js	near noMoreExec
5583
		mov	dl, byte [esi]	; Get our next instruction
5584
		inc	esi		; Increment PC
5585
		jmp	dword [z80regular+edx*4]
5586
 
5587
 
5588
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5589
 
5590
CBInstb3:
5591
		mov	dx, [_z80de]	; Move DE into something half usable
5592
		and dl, 0bfh	; Reset a bit
5593
		mov	[_z80de], dx	; Once modified, put it back
5594
		xor	edx, edx
5595
		sub	edi, byte 8
5596
		js	near noMoreExec
5597
		mov	dl, byte [esi]	; Get our next instruction
5598
		inc	esi		; Increment PC
5599
		jmp	dword [z80regular+edx*4]
5600
 
5601
 
5602
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5603
 
5604
CBInstb4:
5605
		and bh, 0bfh	; Reset a bit
5606
		sub	edi, byte 8
5607
		js	near noMoreExec
5608
		mov	dl, byte [esi]	; Get our next instruction
5609
		inc	esi		; Increment PC
5610
		jmp	dword [z80regular+edx*4]
5611
 
5612
 
5613
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5614
 
5615
CBInstb5:
5616
		and bl, 0bfh	; Reset a bit
5617
		sub	edi, byte 8
5618
		js	near noMoreExec
5619
		mov	dl, byte [esi]	; Get our next instruction
5620
		inc	esi		; Increment PC
5621
		jmp	dword [z80regular+edx*4]
5622
 
5623
 
5624
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5625
 
5626
CBInstb6:
5627
		mov	[cyclesRemaining], edi
5628
		mov	edi, [_z80MemRead]	; Point to the read array
5629
 
5630
checkLoop36:
5631
		cmp	[edi], word 0ffffh ; End of the list?
5632
		je		memoryRead36
5633
		cmp	ebx, [edi]	; Are we smaller?
5634
		jb		nextAddr36		; Yes, go to the next address
5635
		cmp	ebx, [edi+4]	; Are we bigger?
5636
		jbe	callRoutine36
5637
 
5638
nextAddr36:
5639
		add	edi, 10h		; Next structure!
5640
		jmp	short checkLoop36
5641
 
5642
callRoutine36:
5643
		mov	dx, bx	; Get our address
5644
		call	ReadMemoryByte	; Standard read routine
5645
		mov	dl, al	; Put our returned value here
5646
		mov	ax, [_z80af]	; Get our AF back
5647
		jmp	short readExit36
5648
 
5649
memoryRead36:
5650
		mov	dl, [ebp + ebx]	; Get our data
5651
 
5652
readExit36:
5653
		mov	edi, [cyclesRemaining]
5654
		and dl, 0bfh	; Reset a bit
5655
		mov	[cyclesRemaining], edi
5656
		mov	[_z80af], ax	; Store AF
5657
		mov	al, dl	; And our data to write
5658
		mov	edi, [_z80MemWrite]	; Point to the write array
5659
 
5660
checkLoop37:
5661
		cmp	[edi], word 0ffffh ; End of our list?
5662
		je	memoryWrite37	; Yes - go write it!
5663
		cmp	bx, [edi]	; Are we smaller?
5664
		jb	nextAddr37	; Yes... go to the next addr
5665
		cmp	bx, [edi+4]	; Are we smaller?
5666
		jbe	callRoutine37	; If not, go call it!
5667
 
5668
nextAddr37:
5669
		add	edi, 10h		; Next structure, please
5670
		jmp	short checkLoop37
5671
 
5672
callRoutine37:
5673
		mov	dx, bx	; Get our address to target
5674
		call	WriteMemoryByte	; Go write the data!
5675
		jmp	short WriteMacroExit37
5676
memoryWrite37:
5677
		mov	[ebp + ebx], dl
5678
		mov	ax, [_z80af] ; Get our accumulator and flags
5679
WriteMacroExit37:
5680
		mov	edi, [cyclesRemaining]
5681
		xor	edx, edx
5682
		sub	edi, byte 15
5683
		js	near noMoreExec
5684
		mov	dl, byte [esi]	; Get our next instruction
5685
		inc	esi		; Increment PC
5686
		jmp	dword [z80regular+edx*4]
5687
 
5688
 
5689
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5690
 
5691
CBInstb7:
5692
		and al, 0bfh	; Reset a bit
5693
		sub	edi, byte 8
5694
		js	near noMoreExec
5695
		mov	dl, byte [esi]	; Get our next instruction
5696
		inc	esi		; Increment PC
5697
		jmp	dword [z80regular+edx*4]
5698
 
5699
 
5700
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5701
 
5702
CBInstb8:
5703
		and ch, 07fh	; Reset a bit
5704
		sub	edi, byte 8
5705
		js	near noMoreExec
5706
		mov	dl, byte [esi]	; Get our next instruction
5707
		inc	esi		; Increment PC
5708
		jmp	dword [z80regular+edx*4]
5709
 
5710
 
5711
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5712
 
5713
CBInstb9:
5714
		and cl, 07fh	; Reset a bit
5715
		sub	edi, byte 8
5716
		js	near noMoreExec
5717
		mov	dl, byte [esi]	; Get our next instruction
5718
		inc	esi		; Increment PC
5719
		jmp	dword [z80regular+edx*4]
5720
 
5721
 
5722
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5723
 
5724
CBInstba:
5725
		mov	dx, [_z80de]	; Move DE into something half usable
5726
		and dh, 07fh	; Reset a bit
5727
		mov	[_z80de], dx	; Once modified, put it back
5728
		xor	edx, edx
5729
		sub	edi, byte 8
5730
		js	near noMoreExec
5731
		mov	dl, byte [esi]	; Get our next instruction
5732
		inc	esi		; Increment PC
5733
		jmp	dword [z80regular+edx*4]
5734
 
5735
 
5736
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5737
 
5738
CBInstbb:
5739
		mov	dx, [_z80de]	; Move DE into something half usable
5740
		and dl, 07fh	; Reset a bit
5741
		mov	[_z80de], dx	; Once modified, put it back
5742
		xor	edx, edx
5743
		sub	edi, byte 8
5744
		js	near noMoreExec
5745
		mov	dl, byte [esi]	; Get our next instruction
5746
		inc	esi		; Increment PC
5747
		jmp	dword [z80regular+edx*4]
5748
 
5749
 
5750
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5751
 
5752
CBInstbc:
5753
		and bh, 07fh	; Reset a bit
5754
		sub	edi, byte 8
5755
		js	near noMoreExec
5756
		mov	dl, byte [esi]	; Get our next instruction
5757
		inc	esi		; Increment PC
5758
		jmp	dword [z80regular+edx*4]
5759
 
5760
 
5761
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5762
 
5763
CBInstbd:
5764
		and bl, 07fh	; Reset a bit
5765
		sub	edi, byte 8
5766
		js	near noMoreExec
5767
		mov	dl, byte [esi]	; Get our next instruction
5768
		inc	esi		; Increment PC
5769
		jmp	dword [z80regular+edx*4]
5770
 
5771
 
5772
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5773
 
5774
CBInstbe:
5775
		mov	[cyclesRemaining], edi
5776
		mov	edi, [_z80MemRead]	; Point to the read array
5777
 
5778
checkLoop38:
5779
		cmp	[edi], word 0ffffh ; End of the list?
5780
		je		memoryRead38
5781
		cmp	ebx, [edi]	; Are we smaller?
5782
		jb		nextAddr38		; Yes, go to the next address
5783
		cmp	ebx, [edi+4]	; Are we bigger?
5784
		jbe	callRoutine38
5785
 
5786
nextAddr38:
5787
		add	edi, 10h		; Next structure!
5788
		jmp	short checkLoop38
5789
 
5790
callRoutine38:
5791
		mov	dx, bx	; Get our address
5792
		call	ReadMemoryByte	; Standard read routine
5793
		mov	dl, al	; Put our returned value here
5794
		mov	ax, [_z80af]	; Get our AF back
5795
		jmp	short readExit38
5796
 
5797
memoryRead38:
5798
		mov	dl, [ebp + ebx]	; Get our data
5799
 
5800
readExit38:
5801
		mov	edi, [cyclesRemaining]
5802
		and dl, 07fh	; Reset a bit
5803
		mov	[cyclesRemaining], edi
5804
		mov	[_z80af], ax	; Store AF
5805
		mov	al, dl	; And our data to write
5806
		mov	edi, [_z80MemWrite]	; Point to the write array
5807
 
5808
checkLoop39:
5809
		cmp	[edi], word 0ffffh ; End of our list?
5810
		je	memoryWrite39	; Yes - go write it!
5811
		cmp	bx, [edi]	; Are we smaller?
5812
		jb	nextAddr39	; Yes... go to the next addr
5813
		cmp	bx, [edi+4]	; Are we smaller?
5814
		jbe	callRoutine39	; If not, go call it!
5815
 
5816
nextAddr39:
5817
		add	edi, 10h		; Next structure, please
5818
		jmp	short checkLoop39
5819
 
5820
callRoutine39:
5821
		mov	dx, bx	; Get our address to target
5822
		call	WriteMemoryByte	; Go write the data!
5823
		jmp	short WriteMacroExit39
5824
memoryWrite39:
5825
		mov	[ebp + ebx], dl
5826
		mov	ax, [_z80af] ; Get our accumulator and flags
5827
WriteMacroExit39:
5828
		mov	edi, [cyclesRemaining]
5829
		xor	edx, edx
5830
		sub	edi, byte 15
5831
		js	near noMoreExec
5832
		mov	dl, byte [esi]	; Get our next instruction
5833
		inc	esi		; Increment PC
5834
		jmp	dword [z80regular+edx*4]
5835
 
5836
 
5837
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5838
 
5839
CBInstbf:
5840
		and al, 07fh	; Reset a bit
5841
		sub	edi, byte 8
5842
		js	near noMoreExec
5843
		mov	dl, byte [esi]	; Get our next instruction
5844
		inc	esi		; Increment PC
5845
		jmp	dword [z80regular+edx*4]
5846
 
5847
 
5848
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5849
 
5850
CBInstc0:
5851
		or	ch, 001h	; Set a bit
5852
		sub	edi, byte 8
5853
		js	near noMoreExec
5854
		mov	dl, byte [esi]	; Get our next instruction
5855
		inc	esi		; Increment PC
5856
		jmp	dword [z80regular+edx*4]
5857
 
5858
 
5859
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5860
 
5861
CBInstc1:
5862
		or	cl, 001h	; Set a bit
5863
		sub	edi, byte 8
5864
		js	near noMoreExec
5865
		mov	dl, byte [esi]	; Get our next instruction
5866
		inc	esi		; Increment PC
5867
		jmp	dword [z80regular+edx*4]
5868
 
5869
 
5870
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5871
 
5872
CBInstc2:
5873
		mov	dx, [_z80de]	; Move DE into something half usable
5874
		or	dh, 001h	; Set a bit
5875
		mov	[_z80de], dx	; Once modified, put it back
5876
		xor	edx, edx
5877
		sub	edi, byte 8
5878
		js	near noMoreExec
5879
		mov	dl, byte [esi]	; Get our next instruction
5880
		inc	esi		; Increment PC
5881
		jmp	dword [z80regular+edx*4]
5882
 
5883
 
5884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5885
 
5886
CBInstc3:
5887
		mov	dx, [_z80de]	; Move DE into something half usable
5888
		or	dl, 001h	; Set a bit
5889
		mov	[_z80de], dx	; Once modified, put it back
5890
		xor	edx, edx
5891
		sub	edi, byte 8
5892
		js	near noMoreExec
5893
		mov	dl, byte [esi]	; Get our next instruction
5894
		inc	esi		; Increment PC
5895
		jmp	dword [z80regular+edx*4]
5896
 
5897
 
5898
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5899
 
5900
CBInstc4:
5901
		or	bh, 001h	; Set a bit
5902
		sub	edi, byte 8
5903
		js	near noMoreExec
5904
		mov	dl, byte [esi]	; Get our next instruction
5905
		inc	esi		; Increment PC
5906
		jmp	dword [z80regular+edx*4]
5907
 
5908
 
5909
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5910
 
5911
CBInstc5:
5912
		or	bl, 001h	; Set a bit
5913
		sub	edi, byte 8
5914
		js	near noMoreExec
5915
		mov	dl, byte [esi]	; Get our next instruction
5916
		inc	esi		; Increment PC
5917
		jmp	dword [z80regular+edx*4]
5918
 
5919
 
5920
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5921
 
5922
CBInstc6:
5923
		mov	[cyclesRemaining], edi
5924
		mov	edi, [_z80MemRead]	; Point to the read array
5925
 
5926
checkLoop40:
5927
		cmp	[edi], word 0ffffh ; End of the list?
5928
		je		memoryRead40
5929
		cmp	ebx, [edi]	; Are we smaller?
5930
		jb		nextAddr40		; Yes, go to the next address
5931
		cmp	ebx, [edi+4]	; Are we bigger?
5932
		jbe	callRoutine40
5933
 
5934
nextAddr40:
5935
		add	edi, 10h		; Next structure!
5936
		jmp	short checkLoop40
5937
 
5938
callRoutine40:
5939
		mov	dx, bx	; Get our address
5940
		call	ReadMemoryByte	; Standard read routine
5941
		mov	dl, al	; Put our returned value here
5942
		mov	ax, [_z80af]	; Get our AF back
5943
		jmp	short readExit40
5944
 
5945
memoryRead40:
5946
		mov	dl, [ebp + ebx]	; Get our data
5947
 
5948
readExit40:
5949
		mov	edi, [cyclesRemaining]
5950
		or	dl, 001h	; Set a bit
5951
		mov	[cyclesRemaining], edi
5952
		mov	[_z80af], ax	; Store AF
5953
		mov	al, dl	; And our data to write
5954
		mov	edi, [_z80MemWrite]	; Point to the write array
5955
 
5956
checkLoop41:
5957
		cmp	[edi], word 0ffffh ; End of our list?
5958
		je	memoryWrite41	; Yes - go write it!
5959
		cmp	bx, [edi]	; Are we smaller?
5960
		jb	nextAddr41	; Yes... go to the next addr
5961
		cmp	bx, [edi+4]	; Are we smaller?
5962
		jbe	callRoutine41	; If not, go call it!
5963
 
5964
nextAddr41:
5965
		add	edi, 10h		; Next structure, please
5966
		jmp	short checkLoop41
5967
 
5968
callRoutine41:
5969
		mov	dx, bx	; Get our address to target
5970
		call	WriteMemoryByte	; Go write the data!
5971
		jmp	short WriteMacroExit41
5972
memoryWrite41:
5973
		mov	[ebp + ebx], dl
5974
		mov	ax, [_z80af] ; Get our accumulator and flags
5975
WriteMacroExit41:
5976
		mov	edi, [cyclesRemaining]
5977
		xor	edx, edx
5978
		sub	edi, byte 15
5979
		js	near noMoreExec
5980
		mov	dl, byte [esi]	; Get our next instruction
5981
		inc	esi		; Increment PC
5982
		jmp	dword [z80regular+edx*4]
5983
 
5984
 
5985
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5986
 
5987
CBInstc7:
5988
		or	al, 001h	; Set a bit
5989
		sub	edi, byte 8
5990
		js	near noMoreExec
5991
		mov	dl, byte [esi]	; Get our next instruction
5992
		inc	esi		; Increment PC
5993
		jmp	dword [z80regular+edx*4]
5994
 
5995
 
5996
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
5997
 
5998
CBInstc8:
5999
		or	ch, 002h	; Set a bit
6000
		sub	edi, byte 8
6001
		js	near noMoreExec
6002
		mov	dl, byte [esi]	; Get our next instruction
6003
		inc	esi		; Increment PC
6004
		jmp	dword [z80regular+edx*4]
6005
 
6006
 
6007
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6008
 
6009
CBInstc9:
6010
		or	cl, 002h	; Set a bit
6011
		sub	edi, byte 8
6012
		js	near noMoreExec
6013
		mov	dl, byte [esi]	; Get our next instruction
6014
		inc	esi		; Increment PC
6015
		jmp	dword [z80regular+edx*4]
6016
 
6017
 
6018
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6019
 
6020
CBInstca:
6021
		mov	dx, [_z80de]	; Move DE into something half usable
6022
		or	dh, 002h	; Set a bit
6023
		mov	[_z80de], dx	; Once modified, put it back
6024
		xor	edx, edx
6025
		sub	edi, byte 8
6026
		js	near noMoreExec
6027
		mov	dl, byte [esi]	; Get our next instruction
6028
		inc	esi		; Increment PC
6029
		jmp	dword [z80regular+edx*4]
6030
 
6031
 
6032
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6033
 
6034
CBInstcb:
6035
		mov	dx, [_z80de]	; Move DE into something half usable
6036
		or	dl, 002h	; Set a bit
6037
		mov	[_z80de], dx	; Once modified, put it back
6038
		xor	edx, edx
6039
		sub	edi, byte 8
6040
		js	near noMoreExec
6041
		mov	dl, byte [esi]	; Get our next instruction
6042
		inc	esi		; Increment PC
6043
		jmp	dword [z80regular+edx*4]
6044
 
6045
 
6046
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6047
 
6048
CBInstcc:
6049
		or	bh, 002h	; Set a bit
6050
		sub	edi, byte 8
6051
		js	near noMoreExec
6052
		mov	dl, byte [esi]	; Get our next instruction
6053
		inc	esi		; Increment PC
6054
		jmp	dword [z80regular+edx*4]
6055
 
6056
 
6057
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6058
 
6059
CBInstcd:
6060
		or	bl, 002h	; Set a bit
6061
		sub	edi, byte 8
6062
		js	near noMoreExec
6063
		mov	dl, byte [esi]	; Get our next instruction
6064
		inc	esi		; Increment PC
6065
		jmp	dword [z80regular+edx*4]
6066
 
6067
 
6068
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6069
 
6070
CBInstce:
6071
		mov	[cyclesRemaining], edi
6072
		mov	edi, [_z80MemRead]	; Point to the read array
6073
 
6074
checkLoop42:
6075
		cmp	[edi], word 0ffffh ; End of the list?
6076
		je		memoryRead42
6077
		cmp	ebx, [edi]	; Are we smaller?
6078
		jb		nextAddr42		; Yes, go to the next address
6079
		cmp	ebx, [edi+4]	; Are we bigger?
6080
		jbe	callRoutine42
6081
 
6082
nextAddr42:
6083
		add	edi, 10h		; Next structure!
6084
		jmp	short checkLoop42
6085
 
6086
callRoutine42:
6087
		mov	dx, bx	; Get our address
6088
		call	ReadMemoryByte	; Standard read routine
6089
		mov	dl, al	; Put our returned value here
6090
		mov	ax, [_z80af]	; Get our AF back
6091
		jmp	short readExit42
6092
 
6093
memoryRead42:
6094
		mov	dl, [ebp + ebx]	; Get our data
6095
 
6096
readExit42:
6097
		mov	edi, [cyclesRemaining]
6098
		or	dl, 002h	; Set a bit
6099
		mov	[cyclesRemaining], edi
6100
		mov	[_z80af], ax	; Store AF
6101
		mov	al, dl	; And our data to write
6102
		mov	edi, [_z80MemWrite]	; Point to the write array
6103
 
6104
checkLoop43:
6105
		cmp	[edi], word 0ffffh ; End of our list?
6106
		je	memoryWrite43	; Yes - go write it!
6107
		cmp	bx, [edi]	; Are we smaller?
6108
		jb	nextAddr43	; Yes... go to the next addr
6109
		cmp	bx, [edi+4]	; Are we smaller?
6110
		jbe	callRoutine43	; If not, go call it!
6111
 
6112
nextAddr43:
6113
		add	edi, 10h		; Next structure, please
6114
		jmp	short checkLoop43
6115
 
6116
callRoutine43:
6117
		mov	dx, bx	; Get our address to target
6118
		call	WriteMemoryByte	; Go write the data!
6119
		jmp	short WriteMacroExit43
6120
memoryWrite43:
6121
		mov	[ebp + ebx], dl
6122
		mov	ax, [_z80af] ; Get our accumulator and flags
6123
WriteMacroExit43:
6124
		mov	edi, [cyclesRemaining]
6125
		xor	edx, edx
6126
		sub	edi, byte 15
6127
		js	near noMoreExec
6128
		mov	dl, byte [esi]	; Get our next instruction
6129
		inc	esi		; Increment PC
6130
		jmp	dword [z80regular+edx*4]
6131
 
6132
 
6133
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6134
 
6135
CBInstcf:
6136
		or	al, 002h	; Set a bit
6137
		sub	edi, byte 8
6138
		js	near noMoreExec
6139
		mov	dl, byte [esi]	; Get our next instruction
6140
		inc	esi		; Increment PC
6141
		jmp	dword [z80regular+edx*4]
6142
 
6143
 
6144
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6145
 
6146
CBInstd0:
6147
		or	ch, 004h	; Set a bit
6148
		sub	edi, byte 8
6149
		js	near noMoreExec
6150
		mov	dl, byte [esi]	; Get our next instruction
6151
		inc	esi		; Increment PC
6152
		jmp	dword [z80regular+edx*4]
6153
 
6154
 
6155
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6156
 
6157
CBInstd1:
6158
		or	cl, 004h	; Set a bit
6159
		sub	edi, byte 8
6160
		js	near noMoreExec
6161
		mov	dl, byte [esi]	; Get our next instruction
6162
		inc	esi		; Increment PC
6163
		jmp	dword [z80regular+edx*4]
6164
 
6165
 
6166
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6167
 
6168
CBInstd2:
6169
		mov	dx, [_z80de]	; Move DE into something half usable
6170
		or	dh, 004h	; Set a bit
6171
		mov	[_z80de], dx	; Once modified, put it back
6172
		xor	edx, edx
6173
		sub	edi, byte 8
6174
		js	near noMoreExec
6175
		mov	dl, byte [esi]	; Get our next instruction
6176
		inc	esi		; Increment PC
6177
		jmp	dword [z80regular+edx*4]
6178
 
6179
 
6180
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6181
 
6182
CBInstd3:
6183
		mov	dx, [_z80de]	; Move DE into something half usable
6184
		or	dl, 004h	; Set a bit
6185
		mov	[_z80de], dx	; Once modified, put it back
6186
		xor	edx, edx
6187
		sub	edi, byte 8
6188
		js	near noMoreExec
6189
		mov	dl, byte [esi]	; Get our next instruction
6190
		inc	esi		; Increment PC
6191
		jmp	dword [z80regular+edx*4]
6192
 
6193
 
6194
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6195
 
6196
CBInstd4:
6197
		or	bh, 004h	; Set a bit
6198
		sub	edi, byte 8
6199
		js	near noMoreExec
6200
		mov	dl, byte [esi]	; Get our next instruction
6201
		inc	esi		; Increment PC
6202
		jmp	dword [z80regular+edx*4]
6203
 
6204
 
6205
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6206
 
6207
CBInstd5:
6208
		or	bl, 004h	; Set a bit
6209
		sub	edi, byte 8
6210
		js	near noMoreExec
6211
		mov	dl, byte [esi]	; Get our next instruction
6212
		inc	esi		; Increment PC
6213
		jmp	dword [z80regular+edx*4]
6214
 
6215
 
6216
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6217
 
6218
CBInstd6:
6219
		mov	[cyclesRemaining], edi
6220
		mov	edi, [_z80MemRead]	; Point to the read array
6221
 
6222
checkLoop44:
6223
		cmp	[edi], word 0ffffh ; End of the list?
6224
		je		memoryRead44
6225
		cmp	ebx, [edi]	; Are we smaller?
6226
		jb		nextAddr44		; Yes, go to the next address
6227
		cmp	ebx, [edi+4]	; Are we bigger?
6228
		jbe	callRoutine44
6229
 
6230
nextAddr44:
6231
		add	edi, 10h		; Next structure!
6232
		jmp	short checkLoop44
6233
 
6234
callRoutine44:
6235
		mov	dx, bx	; Get our address
6236
		call	ReadMemoryByte	; Standard read routine
6237
		mov	dl, al	; Put our returned value here
6238
		mov	ax, [_z80af]	; Get our AF back
6239
		jmp	short readExit44
6240
 
6241
memoryRead44:
6242
		mov	dl, [ebp + ebx]	; Get our data
6243
 
6244
readExit44:
6245
		mov	edi, [cyclesRemaining]
6246
		or	dl, 004h	; Set a bit
6247
		mov	[cyclesRemaining], edi
6248
		mov	[_z80af], ax	; Store AF
6249
		mov	al, dl	; And our data to write
6250
		mov	edi, [_z80MemWrite]	; Point to the write array
6251
 
6252
checkLoop45:
6253
		cmp	[edi], word 0ffffh ; End of our list?
6254
		je	memoryWrite45	; Yes - go write it!
6255
		cmp	bx, [edi]	; Are we smaller?
6256
		jb	nextAddr45	; Yes... go to the next addr
6257
		cmp	bx, [edi+4]	; Are we smaller?
6258
		jbe	callRoutine45	; If not, go call it!
6259
 
6260
nextAddr45:
6261
		add	edi, 10h		; Next structure, please
6262
		jmp	short checkLoop45
6263
 
6264
callRoutine45:
6265
		mov	dx, bx	; Get our address to target
6266
		call	WriteMemoryByte	; Go write the data!
6267
		jmp	short WriteMacroExit45
6268
memoryWrite45:
6269
		mov	[ebp + ebx], dl
6270
		mov	ax, [_z80af] ; Get our accumulator and flags
6271
WriteMacroExit45:
6272
		mov	edi, [cyclesRemaining]
6273
		xor	edx, edx
6274
		sub	edi, byte 15
6275
		js	near noMoreExec
6276
		mov	dl, byte [esi]	; Get our next instruction
6277
		inc	esi		; Increment PC
6278
		jmp	dword [z80regular+edx*4]
6279
 
6280
 
6281
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6282
 
6283
CBInstd7:
6284
		or	al, 004h	; Set a bit
6285
		sub	edi, byte 8
6286
		js	near noMoreExec
6287
		mov	dl, byte [esi]	; Get our next instruction
6288
		inc	esi		; Increment PC
6289
		jmp	dword [z80regular+edx*4]
6290
 
6291
 
6292
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6293
 
6294
CBInstd8:
6295
		or	ch, 008h	; Set a bit
6296
		sub	edi, byte 8
6297
		js	near noMoreExec
6298
		mov	dl, byte [esi]	; Get our next instruction
6299
		inc	esi		; Increment PC
6300
		jmp	dword [z80regular+edx*4]
6301
 
6302
 
6303
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6304
 
6305
CBInstd9:
6306
		or	cl, 008h	; Set a bit
6307
		sub	edi, byte 8
6308
		js	near noMoreExec
6309
		mov	dl, byte [esi]	; Get our next instruction
6310
		inc	esi		; Increment PC
6311
		jmp	dword [z80regular+edx*4]
6312
 
6313
 
6314
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6315
 
6316
CBInstda:
6317
		mov	dx, [_z80de]	; Move DE into something half usable
6318
		or	dh, 008h	; Set a bit
6319
		mov	[_z80de], dx	; Once modified, put it back
6320
		xor	edx, edx
6321
		sub	edi, byte 8
6322
		js	near noMoreExec
6323
		mov	dl, byte [esi]	; Get our next instruction
6324
		inc	esi		; Increment PC
6325
		jmp	dword [z80regular+edx*4]
6326
 
6327
 
6328
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6329
 
6330
CBInstdb:
6331
		mov	dx, [_z80de]	; Move DE into something half usable
6332
		or	dl, 008h	; Set a bit
6333
		mov	[_z80de], dx	; Once modified, put it back
6334
		xor	edx, edx
6335
		sub	edi, byte 8
6336
		js	near noMoreExec
6337
		mov	dl, byte [esi]	; Get our next instruction
6338
		inc	esi		; Increment PC
6339
		jmp	dword [z80regular+edx*4]
6340
 
6341
 
6342
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6343
 
6344
CBInstdc:
6345
		or	bh, 008h	; Set a bit
6346
		sub	edi, byte 8
6347
		js	near noMoreExec
6348
		mov	dl, byte [esi]	; Get our next instruction
6349
		inc	esi		; Increment PC
6350
		jmp	dword [z80regular+edx*4]
6351
 
6352
 
6353
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6354
 
6355
CBInstdd:
6356
		or	bl, 008h	; Set a bit
6357
		sub	edi, byte 8
6358
		js	near noMoreExec
6359
		mov	dl, byte [esi]	; Get our next instruction
6360
		inc	esi		; Increment PC
6361
		jmp	dword [z80regular+edx*4]
6362
 
6363
 
6364
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6365
 
6366
CBInstde:
6367
		mov	[cyclesRemaining], edi
6368
		mov	edi, [_z80MemRead]	; Point to the read array
6369
 
6370
checkLoop46:
6371
		cmp	[edi], word 0ffffh ; End of the list?
6372
		je		memoryRead46
6373
		cmp	ebx, [edi]	; Are we smaller?
6374
		jb		nextAddr46		; Yes, go to the next address
6375
		cmp	ebx, [edi+4]	; Are we bigger?
6376
		jbe	callRoutine46
6377
 
6378
nextAddr46:
6379
		add	edi, 10h		; Next structure!
6380
		jmp	short checkLoop46
6381
 
6382
callRoutine46:
6383
		mov	dx, bx	; Get our address
6384
		call	ReadMemoryByte	; Standard read routine
6385
		mov	dl, al	; Put our returned value here
6386
		mov	ax, [_z80af]	; Get our AF back
6387
		jmp	short readExit46
6388
 
6389
memoryRead46:
6390
		mov	dl, [ebp + ebx]	; Get our data
6391
 
6392
readExit46:
6393
		mov	edi, [cyclesRemaining]
6394
		or	dl, 008h	; Set a bit
6395
		mov	[cyclesRemaining], edi
6396
		mov	[_z80af], ax	; Store AF
6397
		mov	al, dl	; And our data to write
6398
		mov	edi, [_z80MemWrite]	; Point to the write array
6399
 
6400
checkLoop47:
6401
		cmp	[edi], word 0ffffh ; End of our list?
6402
		je	memoryWrite47	; Yes - go write it!
6403
		cmp	bx, [edi]	; Are we smaller?
6404
		jb	nextAddr47	; Yes... go to the next addr
6405
		cmp	bx, [edi+4]	; Are we smaller?
6406
		jbe	callRoutine47	; If not, go call it!
6407
 
6408
nextAddr47:
6409
		add	edi, 10h		; Next structure, please
6410
		jmp	short checkLoop47
6411
 
6412
callRoutine47:
6413
		mov	dx, bx	; Get our address to target
6414
		call	WriteMemoryByte	; Go write the data!
6415
		jmp	short WriteMacroExit47
6416
memoryWrite47:
6417
		mov	[ebp + ebx], dl
6418
		mov	ax, [_z80af] ; Get our accumulator and flags
6419
WriteMacroExit47:
6420
		mov	edi, [cyclesRemaining]
6421
		xor	edx, edx
6422
		sub	edi, byte 15
6423
		js	near noMoreExec
6424
		mov	dl, byte [esi]	; Get our next instruction
6425
		inc	esi		; Increment PC
6426
		jmp	dword [z80regular+edx*4]
6427
 
6428
 
6429
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6430
 
6431
CBInstdf:
6432
		or	al, 008h	; Set a bit
6433
		sub	edi, byte 8
6434
		js	near noMoreExec
6435
		mov	dl, byte [esi]	; Get our next instruction
6436
		inc	esi		; Increment PC
6437
		jmp	dword [z80regular+edx*4]
6438
 
6439
 
6440
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6441
 
6442
CBInste0:
6443
		or	ch, 010h	; Set a bit
6444
		sub	edi, byte 8
6445
		js	near noMoreExec
6446
		mov	dl, byte [esi]	; Get our next instruction
6447
		inc	esi		; Increment PC
6448
		jmp	dword [z80regular+edx*4]
6449
 
6450
 
6451
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6452
 
6453
CBInste1:
6454
		or	cl, 010h	; Set a bit
6455
		sub	edi, byte 8
6456
		js	near noMoreExec
6457
		mov	dl, byte [esi]	; Get our next instruction
6458
		inc	esi		; Increment PC
6459
		jmp	dword [z80regular+edx*4]
6460
 
6461
 
6462
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6463
 
6464
CBInste2:
6465
		mov	dx, [_z80de]	; Move DE into something half usable
6466
		or	dh, 010h	; Set a bit
6467
		mov	[_z80de], dx	; Once modified, put it back
6468
		xor	edx, edx
6469
		sub	edi, byte 8
6470
		js	near noMoreExec
6471
		mov	dl, byte [esi]	; Get our next instruction
6472
		inc	esi		; Increment PC
6473
		jmp	dword [z80regular+edx*4]
6474
 
6475
 
6476
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6477
 
6478
CBInste3:
6479
		mov	dx, [_z80de]	; Move DE into something half usable
6480
		or	dl, 010h	; Set a bit
6481
		mov	[_z80de], dx	; Once modified, put it back
6482
		xor	edx, edx
6483
		sub	edi, byte 8
6484
		js	near noMoreExec
6485
		mov	dl, byte [esi]	; Get our next instruction
6486
		inc	esi		; Increment PC
6487
		jmp	dword [z80regular+edx*4]
6488
 
6489
 
6490
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6491
 
6492
CBInste4:
6493
		or	bh, 010h	; Set a bit
6494
		sub	edi, byte 8
6495
		js	near noMoreExec
6496
		mov	dl, byte [esi]	; Get our next instruction
6497
		inc	esi		; Increment PC
6498
		jmp	dword [z80regular+edx*4]
6499
 
6500
 
6501
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6502
 
6503
CBInste5:
6504
		or	bl, 010h	; Set a bit
6505
		sub	edi, byte 8
6506
		js	near noMoreExec
6507
		mov	dl, byte [esi]	; Get our next instruction
6508
		inc	esi		; Increment PC
6509
		jmp	dword [z80regular+edx*4]
6510
 
6511
 
6512
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6513
 
6514
CBInste6:
6515
		mov	[cyclesRemaining], edi
6516
		mov	edi, [_z80MemRead]	; Point to the read array
6517
 
6518
checkLoop48:
6519
		cmp	[edi], word 0ffffh ; End of the list?
6520
		je		memoryRead48
6521
		cmp	ebx, [edi]	; Are we smaller?
6522
		jb		nextAddr48		; Yes, go to the next address
6523
		cmp	ebx, [edi+4]	; Are we bigger?
6524
		jbe	callRoutine48
6525
 
6526
nextAddr48:
6527
		add	edi, 10h		; Next structure!
6528
		jmp	short checkLoop48
6529
 
6530
callRoutine48:
6531
		mov	dx, bx	; Get our address
6532
		call	ReadMemoryByte	; Standard read routine
6533
		mov	dl, al	; Put our returned value here
6534
		mov	ax, [_z80af]	; Get our AF back
6535
		jmp	short readExit48
6536
 
6537
memoryRead48:
6538
		mov	dl, [ebp + ebx]	; Get our data
6539
 
6540
readExit48:
6541
		mov	edi, [cyclesRemaining]
6542
		or	dl, 010h	; Set a bit
6543
		mov	[cyclesRemaining], edi
6544
		mov	[_z80af], ax	; Store AF
6545
		mov	al, dl	; And our data to write
6546
		mov	edi, [_z80MemWrite]	; Point to the write array
6547
 
6548
checkLoop49:
6549
		cmp	[edi], word 0ffffh ; End of our list?
6550
		je	memoryWrite49	; Yes - go write it!
6551
		cmp	bx, [edi]	; Are we smaller?
6552
		jb	nextAddr49	; Yes... go to the next addr
6553
		cmp	bx, [edi+4]	; Are we smaller?
6554
		jbe	callRoutine49	; If not, go call it!
6555
 
6556
nextAddr49:
6557
		add	edi, 10h		; Next structure, please
6558
		jmp	short checkLoop49
6559
 
6560
callRoutine49:
6561
		mov	dx, bx	; Get our address to target
6562
		call	WriteMemoryByte	; Go write the data!
6563
		jmp	short WriteMacroExit49
6564
memoryWrite49:
6565
		mov	[ebp + ebx], dl
6566
		mov	ax, [_z80af] ; Get our accumulator and flags
6567
WriteMacroExit49:
6568
		mov	edi, [cyclesRemaining]
6569
		xor	edx, edx
6570
		sub	edi, byte 15
6571
		js	near noMoreExec
6572
		mov	dl, byte [esi]	; Get our next instruction
6573
		inc	esi		; Increment PC
6574
		jmp	dword [z80regular+edx*4]
6575
 
6576
 
6577
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6578
 
6579
CBInste7:
6580
		or	al, 010h	; Set a bit
6581
		sub	edi, byte 8
6582
		js	near noMoreExec
6583
		mov	dl, byte [esi]	; Get our next instruction
6584
		inc	esi		; Increment PC
6585
		jmp	dword [z80regular+edx*4]
6586
 
6587
 
6588
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6589
 
6590
CBInste8:
6591
		or	ch, 020h	; Set a bit
6592
		sub	edi, byte 8
6593
		js	near noMoreExec
6594
		mov	dl, byte [esi]	; Get our next instruction
6595
		inc	esi		; Increment PC
6596
		jmp	dword [z80regular+edx*4]
6597
 
6598
 
6599
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6600
 
6601
CBInste9:
6602
		or	cl, 020h	; Set a bit
6603
		sub	edi, byte 8
6604
		js	near noMoreExec
6605
		mov	dl, byte [esi]	; Get our next instruction
6606
		inc	esi		; Increment PC
6607
		jmp	dword [z80regular+edx*4]
6608
 
6609
 
6610
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6611
 
6612
CBInstea:
6613
		mov	dx, [_z80de]	; Move DE into something half usable
6614
		or	dh, 020h	; Set a bit
6615
		mov	[_z80de], dx	; Once modified, put it back
6616
		xor	edx, edx
6617
		sub	edi, byte 8
6618
		js	near noMoreExec
6619
		mov	dl, byte [esi]	; Get our next instruction
6620
		inc	esi		; Increment PC
6621
		jmp	dword [z80regular+edx*4]
6622
 
6623
 
6624
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6625
 
6626
CBInsteb:
6627
		mov	dx, [_z80de]	; Move DE into something half usable
6628
		or	dl, 020h	; Set a bit
6629
		mov	[_z80de], dx	; Once modified, put it back
6630
		xor	edx, edx
6631
		sub	edi, byte 8
6632
		js	near noMoreExec
6633
		mov	dl, byte [esi]	; Get our next instruction
6634
		inc	esi		; Increment PC
6635
		jmp	dword [z80regular+edx*4]
6636
 
6637
 
6638
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6639
 
6640
CBInstec:
6641
		or	bh, 020h	; Set a bit
6642
		sub	edi, byte 8
6643
		js	near noMoreExec
6644
		mov	dl, byte [esi]	; Get our next instruction
6645
		inc	esi		; Increment PC
6646
		jmp	dword [z80regular+edx*4]
6647
 
6648
 
6649
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6650
 
6651
CBInsted:
6652
		or	bl, 020h	; Set a bit
6653
		sub	edi, byte 8
6654
		js	near noMoreExec
6655
		mov	dl, byte [esi]	; Get our next instruction
6656
		inc	esi		; Increment PC
6657
		jmp	dword [z80regular+edx*4]
6658
 
6659
 
6660
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6661
 
6662
CBInstee:
6663
		mov	[cyclesRemaining], edi
6664
		mov	edi, [_z80MemRead]	; Point to the read array
6665
 
6666
checkLoop50:
6667
		cmp	[edi], word 0ffffh ; End of the list?
6668
		je		memoryRead50
6669
		cmp	ebx, [edi]	; Are we smaller?
6670
		jb		nextAddr50		; Yes, go to the next address
6671
		cmp	ebx, [edi+4]	; Are we bigger?
6672
		jbe	callRoutine50
6673
 
6674
nextAddr50:
6675
		add	edi, 10h		; Next structure!
6676
		jmp	short checkLoop50
6677
 
6678
callRoutine50:
6679
		mov	dx, bx	; Get our address
6680
		call	ReadMemoryByte	; Standard read routine
6681
		mov	dl, al	; Put our returned value here
6682
		mov	ax, [_z80af]	; Get our AF back
6683
		jmp	short readExit50
6684
 
6685
memoryRead50:
6686
		mov	dl, [ebp + ebx]	; Get our data
6687
 
6688
readExit50:
6689
		mov	edi, [cyclesRemaining]
6690
		or	dl, 020h	; Set a bit
6691
		mov	[cyclesRemaining], edi
6692
		mov	[_z80af], ax	; Store AF
6693
		mov	al, dl	; And our data to write
6694
		mov	edi, [_z80MemWrite]	; Point to the write array
6695
 
6696
checkLoop51:
6697
		cmp	[edi], word 0ffffh ; End of our list?
6698
		je	memoryWrite51	; Yes - go write it!
6699
		cmp	bx, [edi]	; Are we smaller?
6700
		jb	nextAddr51	; Yes... go to the next addr
6701
		cmp	bx, [edi+4]	; Are we smaller?
6702
		jbe	callRoutine51	; If not, go call it!
6703
 
6704
nextAddr51:
6705
		add	edi, 10h		; Next structure, please
6706
		jmp	short checkLoop51
6707
 
6708
callRoutine51:
6709
		mov	dx, bx	; Get our address to target
6710
		call	WriteMemoryByte	; Go write the data!
6711
		jmp	short WriteMacroExit51
6712
memoryWrite51:
6713
		mov	[ebp + ebx], dl
6714
		mov	ax, [_z80af] ; Get our accumulator and flags
6715
WriteMacroExit51:
6716
		mov	edi, [cyclesRemaining]
6717
		xor	edx, edx
6718
		sub	edi, byte 15
6719
		js	near noMoreExec
6720
		mov	dl, byte [esi]	; Get our next instruction
6721
		inc	esi		; Increment PC
6722
		jmp	dword [z80regular+edx*4]
6723
 
6724
 
6725
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6726
 
6727
CBInstef:
6728
		or	al, 020h	; Set a bit
6729
		sub	edi, byte 8
6730
		js	near noMoreExec
6731
		mov	dl, byte [esi]	; Get our next instruction
6732
		inc	esi		; Increment PC
6733
		jmp	dword [z80regular+edx*4]
6734
 
6735
 
6736
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6737
 
6738
CBInstf0:
6739
		or	ch, 040h	; Set a bit
6740
		sub	edi, byte 8
6741
		js	near noMoreExec
6742
		mov	dl, byte [esi]	; Get our next instruction
6743
		inc	esi		; Increment PC
6744
		jmp	dword [z80regular+edx*4]
6745
 
6746
 
6747
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6748
 
6749
CBInstf1:
6750
		or	cl, 040h	; Set a bit
6751
		sub	edi, byte 8
6752
		js	near noMoreExec
6753
		mov	dl, byte [esi]	; Get our next instruction
6754
		inc	esi		; Increment PC
6755
		jmp	dword [z80regular+edx*4]
6756
 
6757
 
6758
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6759
 
6760
CBInstf2:
6761
		mov	dx, [_z80de]	; Move DE into something half usable
6762
		or	dh, 040h	; Set a bit
6763
		mov	[_z80de], dx	; Once modified, put it back
6764
		xor	edx, edx
6765
		sub	edi, byte 8
6766
		js	near noMoreExec
6767
		mov	dl, byte [esi]	; Get our next instruction
6768
		inc	esi		; Increment PC
6769
		jmp	dword [z80regular+edx*4]
6770
 
6771
 
6772
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6773
 
6774
CBInstf3:
6775
		mov	dx, [_z80de]	; Move DE into something half usable
6776
		or	dl, 040h	; Set a bit
6777
		mov	[_z80de], dx	; Once modified, put it back
6778
		xor	edx, edx
6779
		sub	edi, byte 8
6780
		js	near noMoreExec
6781
		mov	dl, byte [esi]	; Get our next instruction
6782
		inc	esi		; Increment PC
6783
		jmp	dword [z80regular+edx*4]
6784
 
6785
 
6786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6787
 
6788
CBInstf4:
6789
		or	bh, 040h	; Set a bit
6790
		sub	edi, byte 8
6791
		js	near noMoreExec
6792
		mov	dl, byte [esi]	; Get our next instruction
6793
		inc	esi		; Increment PC
6794
		jmp	dword [z80regular+edx*4]
6795
 
6796
 
6797
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6798
 
6799
CBInstf5:
6800
		or	bl, 040h	; Set a bit
6801
		sub	edi, byte 8
6802
		js	near noMoreExec
6803
		mov	dl, byte [esi]	; Get our next instruction
6804
		inc	esi		; Increment PC
6805
		jmp	dword [z80regular+edx*4]
6806
 
6807
 
6808
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6809
 
6810
CBInstf6:
6811
		mov	[cyclesRemaining], edi
6812
		mov	edi, [_z80MemRead]	; Point to the read array
6813
 
6814
checkLoop52:
6815
		cmp	[edi], word 0ffffh ; End of the list?
6816
		je		memoryRead52
6817
		cmp	ebx, [edi]	; Are we smaller?
6818
		jb		nextAddr52		; Yes, go to the next address
6819
		cmp	ebx, [edi+4]	; Are we bigger?
6820
		jbe	callRoutine52
6821
 
6822
nextAddr52:
6823
		add	edi, 10h		; Next structure!
6824
		jmp	short checkLoop52
6825
 
6826
callRoutine52:
6827
		mov	dx, bx	; Get our address
6828
		call	ReadMemoryByte	; Standard read routine
6829
		mov	dl, al	; Put our returned value here
6830
		mov	ax, [_z80af]	; Get our AF back
6831
		jmp	short readExit52
6832
 
6833
memoryRead52:
6834
		mov	dl, [ebp + ebx]	; Get our data
6835
 
6836
readExit52:
6837
		mov	edi, [cyclesRemaining]
6838
		or	dl, 040h	; Set a bit
6839
		mov	[cyclesRemaining], edi
6840
		mov	[_z80af], ax	; Store AF
6841
		mov	al, dl	; And our data to write
6842
		mov	edi, [_z80MemWrite]	; Point to the write array
6843
 
6844
checkLoop53:
6845
		cmp	[edi], word 0ffffh ; End of our list?
6846
		je	memoryWrite53	; Yes - go write it!
6847
		cmp	bx, [edi]	; Are we smaller?
6848
		jb	nextAddr53	; Yes... go to the next addr
6849
		cmp	bx, [edi+4]	; Are we smaller?
6850
		jbe	callRoutine53	; If not, go call it!
6851
 
6852
nextAddr53:
6853
		add	edi, 10h		; Next structure, please
6854
		jmp	short checkLoop53
6855
 
6856
callRoutine53:
6857
		mov	dx, bx	; Get our address to target
6858
		call	WriteMemoryByte	; Go write the data!
6859
		jmp	short WriteMacroExit53
6860
memoryWrite53:
6861
		mov	[ebp + ebx], dl
6862
		mov	ax, [_z80af] ; Get our accumulator and flags
6863
WriteMacroExit53:
6864
		mov	edi, [cyclesRemaining]
6865
		xor	edx, edx
6866
		sub	edi, byte 15
6867
		js	near noMoreExec
6868
		mov	dl, byte [esi]	; Get our next instruction
6869
		inc	esi		; Increment PC
6870
		jmp	dword [z80regular+edx*4]
6871
 
6872
 
6873
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6874
 
6875
CBInstf7:
6876
		or	al, 040h	; Set a bit
6877
		sub	edi, byte 8
6878
		js	near noMoreExec
6879
		mov	dl, byte [esi]	; Get our next instruction
6880
		inc	esi		; Increment PC
6881
		jmp	dword [z80regular+edx*4]
6882
 
6883
 
6884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6885
 
6886
CBInstf8:
6887
		or	ch, 080h	; Set a bit
6888
		sub	edi, byte 8
6889
		js	near noMoreExec
6890
		mov	dl, byte [esi]	; Get our next instruction
6891
		inc	esi		; Increment PC
6892
		jmp	dword [z80regular+edx*4]
6893
 
6894
 
6895
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6896
 
6897
CBInstf9:
6898
		or	cl, 080h	; Set a bit
6899
		sub	edi, byte 8
6900
		js	near noMoreExec
6901
		mov	dl, byte [esi]	; Get our next instruction
6902
		inc	esi		; Increment PC
6903
		jmp	dword [z80regular+edx*4]
6904
 
6905
 
6906
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6907
 
6908
CBInstfa:
6909
		mov	dx, [_z80de]	; Move DE into something half usable
6910
		or	dh, 080h	; Set a bit
6911
		mov	[_z80de], dx	; Once modified, put it back
6912
		xor	edx, edx
6913
		sub	edi, byte 8
6914
		js	near noMoreExec
6915
		mov	dl, byte [esi]	; Get our next instruction
6916
		inc	esi		; Increment PC
6917
		jmp	dword [z80regular+edx*4]
6918
 
6919
 
6920
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6921
 
6922
CBInstfb:
6923
		mov	dx, [_z80de]	; Move DE into something half usable
6924
		or	dl, 080h	; Set a bit
6925
		mov	[_z80de], dx	; Once modified, put it back
6926
		xor	edx, edx
6927
		sub	edi, byte 8
6928
		js	near noMoreExec
6929
		mov	dl, byte [esi]	; Get our next instruction
6930
		inc	esi		; Increment PC
6931
		jmp	dword [z80regular+edx*4]
6932
 
6933
 
6934
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6935
 
6936
CBInstfc:
6937
		or	bh, 080h	; Set a bit
6938
		sub	edi, byte 8
6939
		js	near noMoreExec
6940
		mov	dl, byte [esi]	; Get our next instruction
6941
		inc	esi		; Increment PC
6942
		jmp	dword [z80regular+edx*4]
6943
 
6944
 
6945
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6946
 
6947
CBInstfd:
6948
		or	bl, 080h	; Set a bit
6949
		sub	edi, byte 8
6950
		js	near noMoreExec
6951
		mov	dl, byte [esi]	; Get our next instruction
6952
		inc	esi		; Increment PC
6953
		jmp	dword [z80regular+edx*4]
6954
 
6955
 
6956
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
6957
 
6958
CBInstfe:
6959
		mov	[cyclesRemaining], edi
6960
		mov	edi, [_z80MemRead]	; Point to the read array
6961
 
6962
checkLoop54:
6963
		cmp	[edi], word 0ffffh ; End of the list?
6964
		je		memoryRead54
6965
		cmp	ebx, [edi]	; Are we smaller?
6966
		jb		nextAddr54		; Yes, go to the next address
6967
		cmp	ebx, [edi+4]	; Are we bigger?
6968
		jbe	callRoutine54
6969
 
6970
nextAddr54:
6971
		add	edi, 10h		; Next structure!
6972
		jmp	short checkLoop54
6973
 
6974
callRoutine54:
6975
		mov	dx, bx	; Get our address
6976
		call	ReadMemoryByte	; Standard read routine
6977
		mov	dl, al	; Put our returned value here
6978
		mov	ax, [_z80af]	; Get our AF back
6979
		jmp	short readExit54
6980
 
6981
memoryRead54:
6982
		mov	dl, [ebp + ebx]	; Get our data
6983
 
6984
readExit54:
6985
		mov	edi, [cyclesRemaining]
6986
		or	dl, 080h	; Set a bit
6987
		mov	[cyclesRemaining], edi
6988
		mov	[_z80af], ax	; Store AF
6989
		mov	al, dl	; And our data to write
6990
		mov	edi, [_z80MemWrite]	; Point to the write array
6991
 
6992
checkLoop55:
6993
		cmp	[edi], word 0ffffh ; End of our list?
6994
		je	memoryWrite55	; Yes - go write it!
6995
		cmp	bx, [edi]	; Are we smaller?
6996
		jb	nextAddr55	; Yes... go to the next addr
6997
		cmp	bx, [edi+4]	; Are we smaller?
6998
		jbe	callRoutine55	; If not, go call it!
6999
 
7000
nextAddr55:
7001
		add	edi, 10h		; Next structure, please
7002
		jmp	short checkLoop55
7003
 
7004
callRoutine55:
7005
		mov	dx, bx	; Get our address to target
7006
		call	WriteMemoryByte	; Go write the data!
7007
		jmp	short WriteMacroExit55
7008
memoryWrite55:
7009
		mov	[ebp + ebx], dl
7010
		mov	ax, [_z80af] ; Get our accumulator and flags
7011
WriteMacroExit55:
7012
		mov	edi, [cyclesRemaining]
7013
		xor	edx, edx
7014
		sub	edi, byte 15
7015
		js	near noMoreExec
7016
		mov	dl, byte [esi]	; Get our next instruction
7017
		inc	esi		; Increment PC
7018
		jmp	dword [z80regular+edx*4]
7019
 
7020
 
7021
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7022
 
7023
CBInstff:
7024
		or	al, 080h	; Set a bit
7025
		sub	edi, byte 8
7026
		js	near noMoreExec
7027
		mov	dl, byte [esi]	; Get our next instruction
7028
		inc	esi		; Increment PC
7029
		jmp	dword [z80regular+edx*4]
7030
 
7031
 
7032
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7033
 
7034
EDInst40:
7035
		mov	dl, cl	; Address in DX... (C)
7036
		mov	[cyclesRemaining], edi
7037
		mov	edi, [_z80IoRead]	; Point to the read array
7038
 
7039
checkLoop56:
7040
		cmp	[edi], word 0ffffh ; End of the list?
7041
		je		ioRead56
7042
		cmp	dx, [edi]	; Are we smaller?
7043
		jb		nextAddr56		; Yes, go to the next address
7044
		cmp	dx, [edi+2]	; Are we bigger?
7045
		jbe	callRoutine56
7046
 
7047
nextAddr56:
7048
		add	edi, 0ch		; Next structure!
7049
		jmp	short checkLoop56
7050
 
7051
callRoutine56:
7052
		call	ReadIOByte	; Standard read routine
7053
		mov	ch, al	; Put our returned value here
7054
		mov	ax, [_z80af]	; Get our AF back
7055
		jmp	short readExit56
7056
 
7057
ioRead56:
7058
		mov	ch, 0ffh	; An unreferenced read
7059
readExit56:
7060
		mov	edi, [cyclesRemaining]
7061
;
7062
; Remember, this variant of the IN instruction modifies the flags
7063
;
7064
 
7065
		sahf	; Restore our flags
7066
		mov	dh, ah	; Save flags for later
7067
		or	ch, ch;
7068
		lahf
7069
		and	dh, 029h	; Only keep carry and two unused flags
7070
		and	ah, 0d4h
7071
		or	ah, dh
7072
		xor	edx, edx
7073
		sub	edi, byte 12
7074
		js	near noMoreExec
7075
		mov	dl, byte [esi]	; Get our next instruction
7076
		inc	esi		; Increment PC
7077
		jmp	dword [z80regular+edx*4]
7078
 
7079
 
7080
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7081
 
7082
EDInst41:
7083
		mov	dl, cl	; Address in DX... (C)
7084
		mov	[cyclesRemaining], edi
7085
		mov	[_z80af], ax	; Store AF
7086
		mov	al, ch	; And our data to write
7087
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
7088
 
7089
checkLoop57:
7090
		cmp	[edi], word 0ffffh ; End of our list?
7091
		je	WriteMacroExit57	; Yes - ignore it!
7092
		cmp	dx, [edi]	; Are we smaller?
7093
		jb	nextAddr57	; Yes... go to the next addr
7094
		cmp	dx, [edi+2]	; Are we bigger?
7095
		jbe	callRoutine57	; If not, go call it!
7096
 
7097
nextAddr57:
7098
		add	edi, 0ch		; Next structure, please
7099
		jmp	short checkLoop57
7100
 
7101
callRoutine57:
7102
		call	WriteIOByte	; Go write the data!
7103
WriteMacroExit57:
7104
		mov	edi, [cyclesRemaining]
7105
		xor	edx, edx
7106
		sub	edi, byte 12
7107
		js	near noMoreExec
7108
		mov	dl, byte [esi]	; Get our next instruction
7109
		inc	esi		; Increment PC
7110
		jmp	dword [z80regular+edx*4]
7111
 
7112
 
7113
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7114
 
7115
EDInst42:
7116
		mov	dx, cx	; Get our original register
7117
		mov	[_orgval], dx	; Store this for later half carry computation
7118
		mov	[_orgval2], bx	; Store this, too
7119
		sahf		; Restore our flags
7120
		sbb	bx, dx	; Do the operation!
7121
		lahf		; Get our new flags
7122
		seto	dl
7123
		and	ah, 0fbh	; Knock out parity/overflow
7124
		shl	dl, 2
7125
		or		ah, dl
7126
		and	ah, 0edh	; Knock out negative & half carry flags
7127
		or	ah, 02h	; Negative!
7128
		mov	[_z80hl], bx
7129
		xor	bx, [_orgval]
7130
		xor	bx, [_orgval2]
7131
		and	bh, 10h	; Half carry?
7132
		or	ah, bh	; OR It in if so
7133
		mov	bx, [_z80hl]
7134
		xor	edx, edx	; Make sure we don't hose things
7135
		sub	edi, byte 15
7136
		js	near noMoreExec
7137
		mov	dl, byte [esi]	; Get our next instruction
7138
		inc	esi		; Increment PC
7139
		jmp	dword [z80regular+edx*4]
7140
 
7141
 
7142
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7143
 
7144
EDInst43:
7145
		mov	dx, [esi]	; Get our address to write to
7146
		add	esi, 2		; Next address, please...
7147
		mov	[cyclesRemaining], edi
7148
		mov	[_z80af], ax	; Store AF
7149
		mov	al, cl	; And our data to write
7150
		mov	edi, [_z80MemWrite]	; Point to the write array
7151
 
7152
checkLoop58:
7153
		cmp	[edi], word 0ffffh ; End of our list?
7154
		je	memoryWrite58	; Yes - go write it!
7155
		cmp	dx, [edi]	; Are we smaller?
7156
		jb	nextAddr58	; Yes... go to the next addr
7157
		cmp	dx, [edi+4]	; Are we smaller?
7158
		jbe	callRoutine58	; If not, go call it!
7159
 
7160
nextAddr58:
7161
		add	edi, 10h		; Next structure, please
7162
		jmp	short checkLoop58
7163
 
7164
callRoutine58:
7165
		call	WriteMemoryByte	; Go write the data!
7166
		jmp	short WriteMacroExit58
7167
memoryWrite58:
7168
		mov	[ebp + edx], cl
7169
		mov	ax, [_z80af] ; Get our accumulator and flags
7170
WriteMacroExit58:
7171
		mov	edi, [cyclesRemaining]
7172
		inc	dx
7173
		mov	[cyclesRemaining], edi
7174
		mov	[_z80af], ax	; Store AF
7175
		mov	al, ch	; And our data to write
7176
		mov	edi, [_z80MemWrite]	; Point to the write array
7177
 
7178
checkLoop59:
7179
		cmp	[edi], word 0ffffh ; End of our list?
7180
		je	memoryWrite59	; Yes - go write it!
7181
		cmp	dx, [edi]	; Are we smaller?
7182
		jb	nextAddr59	; Yes... go to the next addr
7183
		cmp	dx, [edi+4]	; Are we smaller?
7184
		jbe	callRoutine59	; If not, go call it!
7185
 
7186
nextAddr59:
7187
		add	edi, 10h		; Next structure, please
7188
		jmp	short checkLoop59
7189
 
7190
callRoutine59:
7191
		call	WriteMemoryByte	; Go write the data!
7192
		jmp	short WriteMacroExit59
7193
memoryWrite59:
7194
		mov	[ebp + edx], ch
7195
		mov	ax, [_z80af] ; Get our accumulator and flags
7196
WriteMacroExit59:
7197
		mov	edi, [cyclesRemaining]
7198
		xor	edx, edx	; Zero our upper word
7199
		sub	edi, byte 20
7200
		js	near noMoreExec
7201
		mov	dl, byte [esi]	; Get our next instruction
7202
		inc	esi		; Increment PC
7203
		jmp	dword [z80regular+edx*4]
7204
 
7205
 
7206
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7207
 
7208
EDInst44:
7209
		sahf
7210
		sub	dh, al
7211
		lahf
7212
		mov	al, dh
7213
		seto	dl
7214
		and	ah, 0fbh	; Knock out parity/overflow
7215
		shl	dl, 2
7216
		or		ah, dl
7217
		or	ah, 02h
7218
		xor	edx, edx
7219
		sub	edi, byte 8
7220
		js	near noMoreExec
7221
		mov	dl, byte [esi]	; Get our next instruction
7222
		inc	esi		; Increment PC
7223
		jmp	dword [z80regular+edx*4]
7224
 
7225
 
7226
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7227
 
7228
EDInst45:
7229
		mov	dx, word [_z80sp]	; Get our current stack pointer
7230
		mov	si, [edx+ebp]	; Get our return address
7231
		and	esi, 0ffffh		; Only within 64K!
7232
		add	esi, ebp			; Add in our base address
7233
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
7234
		xor	edx, edx
7235
		mov	dl, [_z80iff]	; Get interrupt flags
7236
		shr	dl, 1		; Move IFF2->IFF1
7237
		and	[_z80iff], dword (~IFF1)	; Get rid of IFF 1
7238
		and	dl, IFF1	; Just want the IFF 1 value now
7239
		or	dword [_z80iff], edx
7240
		xor	edx, edx	; Make sure we don't hose things
7241
		sub	edi, byte 14
7242
		js	near noMoreExec
7243
		mov	dl, byte [esi]	; Get our next instruction
7244
		inc	esi		; Increment PC
7245
		jmp	dword [z80regular+edx*4]
7246
 
7247
 
7248
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7249
 
7250
EDInst46:
7251
		mov	dword [_z80interruptMode], 0 ; IM 0
7252
		sub	edi, byte 8
7253
		js	near noMoreExec
7254
		mov	dl, byte [esi]	; Get our next instruction
7255
		inc	esi		; Increment PC
7256
		jmp	dword [z80regular+edx*4]
7257
 
7258
 
7259
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7260
 
7261
EDInst47:
7262
           mov     [_z80i], al
7263
		sub	edi, byte 9
7264
		js	near noMoreExec
7265
		mov	dl, byte [esi]	; Get our next instruction
7266
		inc	esi		; Increment PC
7267
		jmp	dword [z80regular+edx*4]
7268
 
7269
 
7270
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7271
 
7272
EDInst48:
7273
		mov	dl, cl	; Address in DX... (C)
7274
		mov	[cyclesRemaining], edi
7275
		mov	edi, [_z80IoRead]	; Point to the read array
7276
 
7277
checkLoop60:
7278
		cmp	[edi], word 0ffffh ; End of the list?
7279
		je		ioRead60
7280
		cmp	dx, [edi]	; Are we smaller?
7281
		jb		nextAddr60		; Yes, go to the next address
7282
		cmp	dx, [edi+2]	; Are we bigger?
7283
		jbe	callRoutine60
7284
 
7285
nextAddr60:
7286
		add	edi, 0ch		; Next structure!
7287
		jmp	short checkLoop60
7288
 
7289
callRoutine60:
7290
		call	ReadIOByte	; Standard read routine
7291
		mov	cl, al	; Put our returned value here
7292
		mov	ax, [_z80af]	; Get our AF back
7293
		jmp	short readExit60
7294
 
7295
ioRead60:
7296
		mov	cl, 0ffh	; An unreferenced read
7297
readExit60:
7298
		mov	edi, [cyclesRemaining]
7299
;
7300
; Remember, this variant of the IN instruction modifies the flags
7301
;
7302
 
7303
		sahf	; Restore our flags
7304
		mov	dh, ah	; Save flags for later
7305
		or	cl, cl;
7306
		lahf
7307
		and	dh, 029h	; Only keep carry and two unused flags
7308
		and	ah, 0d4h
7309
		or	ah, dh
7310
		xor	edx, edx
7311
		sub	edi, byte 12
7312
		js	near noMoreExec
7313
		mov	dl, byte [esi]	; Get our next instruction
7314
		inc	esi		; Increment PC
7315
		jmp	dword [z80regular+edx*4]
7316
 
7317
 
7318
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7319
 
7320
EDInst49:
7321
		mov	dl, cl	; Address in DX... (C)
7322
		mov	[cyclesRemaining], edi
7323
		mov	[_z80af], ax	; Store AF
7324
		mov	al, cl	; And our data to write
7325
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
7326
 
7327
checkLoop61:
7328
		cmp	[edi], word 0ffffh ; End of our list?
7329
		je	WriteMacroExit61	; Yes - ignore it!
7330
		cmp	dx, [edi]	; Are we smaller?
7331
		jb	nextAddr61	; Yes... go to the next addr
7332
		cmp	dx, [edi+2]	; Are we bigger?
7333
		jbe	callRoutine61	; If not, go call it!
7334
 
7335
nextAddr61:
7336
		add	edi, 0ch		; Next structure, please
7337
		jmp	short checkLoop61
7338
 
7339
callRoutine61:
7340
		call	WriteIOByte	; Go write the data!
7341
WriteMacroExit61:
7342
		mov	edi, [cyclesRemaining]
7343
		xor	edx, edx
7344
		sub	edi, byte 12
7345
		js	near noMoreExec
7346
		mov	dl, byte [esi]	; Get our next instruction
7347
		inc	esi		; Increment PC
7348
		jmp	dword [z80regular+edx*4]
7349
 
7350
 
7351
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7352
 
7353
EDInst4a:
7354
		mov	dx, cx	; Get our original register
7355
		mov	[_orgval], dx	; Store this for later half carry computation
7356
		mov	[_orgval2], bx	; Store this, too
7357
		sahf		; Restore our flags
7358
		adc	bx, dx	; Do the operation!
7359
		lahf		; Get our new flags
7360
		seto	dl
7361
		and	ah, 0fbh	; Knock out parity/overflow
7362
		shl	dl, 2
7363
		or		ah, dl
7364
		and	ah, 0edh	; Knock out negative & half carry flags
7365
		mov	[_z80hl], bx
7366
		xor	bx, [_orgval]
7367
		xor	bx, [_orgval2]
7368
		and	bh, 10h	; Half carry?
7369
		or	ah, bh	; OR It in if so
7370
		mov	bx, [_z80hl]
7371
		xor	edx, edx	; Make sure we don't hose things
7372
		sub	edi, byte 15
7373
		js	near noMoreExec
7374
		mov	dl, byte [esi]	; Get our next instruction
7375
		inc	esi		; Increment PC
7376
		jmp	dword [z80regular+edx*4]
7377
 
7378
 
7379
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7380
 
7381
EDInst4b:
7382
		mov	dx, [esi]	; Get address to load
7383
		add	esi, 2	; Skip over it so we don't execute it
7384
		mov	[cyclesRemaining], edi
7385
		mov	edi, [_z80MemRead]	; Point to the read array
7386
 
7387
checkLoop62:
7388
		cmp	[edi], word 0ffffh ; End of the list?
7389
		je		memoryRead62
7390
		cmp	edx, [edi]	; Are we smaller?
7391
		jb		nextAddr62		; Yes, go to the next address
7392
		cmp	edx, [edi+4]	; Are we bigger?
7393
		jbe	callRoutine62
7394
 
7395
nextAddr62:
7396
		add	edi, 10h		; Next structure!
7397
		jmp	short checkLoop62
7398
 
7399
callRoutine62:
7400
		call	ReadMemoryByte	; Standard read routine
7401
		mov	cl, al	; Put our returned value here
7402
		mov	ax, [_z80af]	; Get our AF back
7403
		jmp	short readExit62
7404
 
7405
memoryRead62:
7406
		mov	cl, [ebp + edx]	; Get our data
7407
 
7408
readExit62:
7409
		mov	edi, [cyclesRemaining]
7410
		inc	dx
7411
		mov	[cyclesRemaining], edi
7412
		mov	edi, [_z80MemRead]	; Point to the read array
7413
 
7414
checkLoop63:
7415
		cmp	[edi], word 0ffffh ; End of the list?
7416
		je		memoryRead63
7417
		cmp	edx, [edi]	; Are we smaller?
7418
		jb		nextAddr63		; Yes, go to the next address
7419
		cmp	edx, [edi+4]	; Are we bigger?
7420
		jbe	callRoutine63
7421
 
7422
nextAddr63:
7423
		add	edi, 10h		; Next structure!
7424
		jmp	short checkLoop63
7425
 
7426
callRoutine63:
7427
		call	ReadMemoryByte	; Standard read routine
7428
		mov	ch, al	; Put our returned value here
7429
		mov	ax, [_z80af]	; Get our AF back
7430
		jmp	short readExit63
7431
 
7432
memoryRead63:
7433
		mov	ch, [ebp + edx]	; Get our data
7434
 
7435
readExit63:
7436
		mov	edi, [cyclesRemaining]
7437
		xor	edx, edx
7438
		sub	edi, byte 20
7439
		js	near noMoreExec
7440
		mov	dl, byte [esi]	; Get our next instruction
7441
		inc	esi		; Increment PC
7442
		jmp	dword [z80regular+edx*4]
7443
 
7444
 
7445
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7446
 
7447
EDInst4d:
7448
		mov	dx, word [_z80sp]	; Get our current stack pointer
7449
		mov	si, [edx+ebp]	; Get our return address
7450
		and	esi, 0ffffh		; Only within 64K!
7451
		add	esi, ebp			; Add in our base address
7452
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
7453
		xor	edx, edx	; Make sure we don't hose things
7454
		sub	edi, byte 14
7455
		js	near noMoreExec
7456
		mov	dl, byte [esi]	; Get our next instruction
7457
		inc	esi		; Increment PC
7458
		jmp	dword [z80regular+edx*4]
7459
 
7460
 
7461
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7462
 
7463
EDInst4f:
7464
           mov     [_z80r], al
7465
		sub	edi, byte 9
7466
		js	near noMoreExec
7467
		mov	dl, byte [esi]	; Get our next instruction
7468
		inc	esi		; Increment PC
7469
		jmp	dword [z80regular+edx*4]
7470
 
7471
 
7472
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7473
 
7474
EDInst50:
7475
		mov	dl, cl	; Address in DX... (C)
7476
		mov	[cyclesRemaining], edi
7477
		mov	edi, [_z80IoRead]	; Point to the read array
7478
 
7479
checkLoop64:
7480
		cmp	[edi], word 0ffffh ; End of the list?
7481
		je		ioRead64
7482
		cmp	dx, [edi]	; Are we smaller?
7483
		jb		nextAddr64		; Yes, go to the next address
7484
		cmp	dx, [edi+2]	; Are we bigger?
7485
		jbe	callRoutine64
7486
 
7487
nextAddr64:
7488
		add	edi, 0ch		; Next structure!
7489
		jmp	short checkLoop64
7490
 
7491
callRoutine64:
7492
		call	ReadIOByte	; Standard read routine
7493
		mov	byte [_z80de + 1], al	; Put our returned value here
7494
		mov	ax, [_z80af]	; Get our AF back
7495
		jmp	short readExit64
7496
 
7497
ioRead64:
7498
		mov	byte [_z80de + 1], 0ffh	; An unreferenced read
7499
readExit64:
7500
		mov	edi, [cyclesRemaining]
7501
;
7502
; Remember, this variant of the IN instruction modifies the flags
7503
;
7504
 
7505
		sahf	; Restore our flags
7506
		mov	dh, ah	; Save flags for later
7507
		mov	dl, byte [_z80de + 1]
7508
		or	dl, dl
7509
		lahf
7510
		and	dh, 029h	; Only keep carry and two unused flags
7511
		and	ah, 0d4h
7512
		or	ah, dh
7513
		xor	edx, edx
7514
		sub	edi, byte 12
7515
		js	near noMoreExec
7516
		mov	dl, byte [esi]	; Get our next instruction
7517
		inc	esi		; Increment PC
7518
		jmp	dword [z80regular+edx*4]
7519
 
7520
 
7521
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7522
 
7523
EDInst51:
7524
		mov	dl, cl	; Address in DX... (C)
7525
		mov	[cyclesRemaining], edi
7526
		mov	[_z80af], ax	; Store AF
7527
		mov	al, byte [_z80de + 1]	; And our data to write
7528
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
7529
 
7530
checkLoop65:
7531
		cmp	[edi], word 0ffffh ; End of our list?
7532
		je	WriteMacroExit65	; Yes - ignore it!
7533
		cmp	dx, [edi]	; Are we smaller?
7534
		jb	nextAddr65	; Yes... go to the next addr
7535
		cmp	dx, [edi+2]	; Are we bigger?
7536
		jbe	callRoutine65	; If not, go call it!
7537
 
7538
nextAddr65:
7539
		add	edi, 0ch		; Next structure, please
7540
		jmp	short checkLoop65
7541
 
7542
callRoutine65:
7543
		call	WriteIOByte	; Go write the data!
7544
WriteMacroExit65:
7545
		mov	edi, [cyclesRemaining]
7546
		xor	edx, edx
7547
		sub	edi, byte 12
7548
		js	near noMoreExec
7549
		mov	dl, byte [esi]	; Get our next instruction
7550
		inc	esi		; Increment PC
7551
		jmp	dword [z80regular+edx*4]
7552
 
7553
 
7554
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7555
 
7556
EDInst52:
7557
		mov	dx, word [_z80de]	; Get our original register
7558
		mov	[_orgval], dx	; Store this for later half carry computation
7559
		mov	[_orgval2], bx	; Store this, too
7560
		sahf		; Restore our flags
7561
		sbb	bx, dx	; Do the operation!
7562
		lahf		; Get our new flags
7563
		seto	dl
7564
		and	ah, 0fbh	; Knock out parity/overflow
7565
		shl	dl, 2
7566
		or		ah, dl
7567
		and	ah, 0edh	; Knock out negative & half carry flags
7568
		or	ah, 02h	; Negative!
7569
		mov	[_z80hl], bx
7570
		xor	bx, [_orgval]
7571
		xor	bx, [_orgval2]
7572
		and	bh, 10h	; Half carry?
7573
		or	ah, bh	; OR It in if so
7574
		mov	bx, [_z80hl]
7575
		xor	edx, edx	; Make sure we don't hose things
7576
		sub	edi, byte 15
7577
		js	near noMoreExec
7578
		mov	dl, byte [esi]	; Get our next instruction
7579
		inc	esi		; Increment PC
7580
		jmp	dword [z80regular+edx*4]
7581
 
7582
 
7583
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7584
 
7585
EDInst53:
7586
		mov	dx, [esi]	; Get our address to write to
7587
		add	esi, 2		; Next address, please...
7588
		mov	[cyclesRemaining], edi
7589
		mov	[_z80af], ax	; Store AF
7590
		mov	al, byte [_z80de]	; And our data to write
7591
		mov	edi, [_z80MemWrite]	; Point to the write array
7592
 
7593
checkLoop66:
7594
		cmp	[edi], word 0ffffh ; End of our list?
7595
		je	memoryWrite66	; Yes - go write it!
7596
		cmp	dx, [edi]	; Are we smaller?
7597
		jb	nextAddr66	; Yes... go to the next addr
7598
		cmp	dx, [edi+4]	; Are we smaller?
7599
		jbe	callRoutine66	; If not, go call it!
7600
 
7601
nextAddr66:
7602
		add	edi, 10h		; Next structure, please
7603
		jmp	short checkLoop66
7604
 
7605
callRoutine66:
7606
		call	WriteMemoryByte	; Go write the data!
7607
		jmp	short WriteMacroExit66
7608
memoryWrite66:
7609
		mov	edi, edx
7610
		mov	dl, byte [_z80de]
7611
		mov	[ebp + edi], dl
7612
		mov	edx, edi
7613
		mov	ax, [_z80af] ; Get our accumulator and flags
7614
WriteMacroExit66:
7615
		mov	edi, [cyclesRemaining]
7616
		inc	dx
7617
		mov	[cyclesRemaining], edi
7618
		mov	[_z80af], ax	; Store AF
7619
		mov	al, byte [_z80de + 1]	; And our data to write
7620
		mov	edi, [_z80MemWrite]	; Point to the write array
7621
 
7622
checkLoop67:
7623
		cmp	[edi], word 0ffffh ; End of our list?
7624
		je	memoryWrite67	; Yes - go write it!
7625
		cmp	dx, [edi]	; Are we smaller?
7626
		jb	nextAddr67	; Yes... go to the next addr
7627
		cmp	dx, [edi+4]	; Are we smaller?
7628
		jbe	callRoutine67	; If not, go call it!
7629
 
7630
nextAddr67:
7631
		add	edi, 10h		; Next structure, please
7632
		jmp	short checkLoop67
7633
 
7634
callRoutine67:
7635
		call	WriteMemoryByte	; Go write the data!
7636
		jmp	short WriteMacroExit67
7637
memoryWrite67:
7638
		mov	edi, edx
7639
		mov	dl, byte [_z80de + 1]
7640
		mov	[ebp + edi], dl
7641
		mov	edx, edi
7642
		mov	ax, [_z80af] ; Get our accumulator and flags
7643
WriteMacroExit67:
7644
		mov	edi, [cyclesRemaining]
7645
		xor	edx, edx	; Zero our upper word
7646
		sub	edi, byte 20
7647
		js	near noMoreExec
7648
		mov	dl, byte [esi]	; Get our next instruction
7649
		inc	esi		; Increment PC
7650
		jmp	dword [z80regular+edx*4]
7651
 
7652
 
7653
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7654
 
7655
EDInst56:
7656
		mov	dword [_z80interruptMode], 1 ; Interrupt mode 1
7657
		mov	word [_z80intAddr], 038h	; Interrupt mode 1 cmd!
7658
		sub	edi, byte 8
7659
		js	near noMoreExec
7660
		mov	dl, byte [esi]	; Get our next instruction
7661
		inc	esi		; Increment PC
7662
		jmp	dword [z80regular+edx*4]
7663
 
7664
 
7665
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7666
 
7667
EDInst57:
7668
           mov     al, [_z80i]
7669
		sub	edi, byte 9
7670
		js	near noMoreExec
7671
		mov	dl, byte [esi]	; Get our next instruction
7672
		inc	esi		; Increment PC
7673
		jmp	dword [z80regular+edx*4]
7674
 
7675
 
7676
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7677
 
7678
EDInst58:
7679
		mov	dl, cl	; Address in DX... (C)
7680
		mov	[cyclesRemaining], edi
7681
		mov	edi, [_z80IoRead]	; Point to the read array
7682
 
7683
checkLoop68:
7684
		cmp	[edi], word 0ffffh ; End of the list?
7685
		je		ioRead68
7686
		cmp	dx, [edi]	; Are we smaller?
7687
		jb		nextAddr68		; Yes, go to the next address
7688
		cmp	dx, [edi+2]	; Are we bigger?
7689
		jbe	callRoutine68
7690
 
7691
nextAddr68:
7692
		add	edi, 0ch		; Next structure!
7693
		jmp	short checkLoop68
7694
 
7695
callRoutine68:
7696
		call	ReadIOByte	; Standard read routine
7697
		mov	byte [_z80de], al	; Put our returned value here
7698
		mov	ax, [_z80af]	; Get our AF back
7699
		jmp	short readExit68
7700
 
7701
ioRead68:
7702
		mov	byte [_z80de], 0ffh	; An unreferenced read
7703
readExit68:
7704
		mov	edi, [cyclesRemaining]
7705
;
7706
; Remember, this variant of the IN instruction modifies the flags
7707
;
7708
 
7709
		sahf	; Restore our flags
7710
		mov	dh, ah	; Save flags for later
7711
		mov	dl, byte [_z80de]
7712
		or	dl, dl
7713
		lahf
7714
		and	dh, 029h	; Only keep carry and two unused flags
7715
		and	ah, 0d4h
7716
		or	ah, dh
7717
		xor	edx, edx
7718
		sub	edi, byte 12
7719
		js	near noMoreExec
7720
		mov	dl, byte [esi]	; Get our next instruction
7721
		inc	esi		; Increment PC
7722
		jmp	dword [z80regular+edx*4]
7723
 
7724
 
7725
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7726
 
7727
EDInst59:
7728
		mov	dl, cl	; Address in DX... (C)
7729
		mov	[cyclesRemaining], edi
7730
		mov	[_z80af], ax	; Store AF
7731
		mov	al, byte [_z80de]	; And our data to write
7732
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
7733
 
7734
checkLoop69:
7735
		cmp	[edi], word 0ffffh ; End of our list?
7736
		je	WriteMacroExit69	; Yes - ignore it!
7737
		cmp	dx, [edi]	; Are we smaller?
7738
		jb	nextAddr69	; Yes... go to the next addr
7739
		cmp	dx, [edi+2]	; Are we bigger?
7740
		jbe	callRoutine69	; If not, go call it!
7741
 
7742
nextAddr69:
7743
		add	edi, 0ch		; Next structure, please
7744
		jmp	short checkLoop69
7745
 
7746
callRoutine69:
7747
		call	WriteIOByte	; Go write the data!
7748
WriteMacroExit69:
7749
		mov	edi, [cyclesRemaining]
7750
		xor	edx, edx
7751
		sub	edi, byte 12
7752
		js	near noMoreExec
7753
		mov	dl, byte [esi]	; Get our next instruction
7754
		inc	esi		; Increment PC
7755
		jmp	dword [z80regular+edx*4]
7756
 
7757
 
7758
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7759
 
7760
EDInst5a:
7761
		mov	dx, word [_z80de]	; Get our original register
7762
		mov	[_orgval], dx	; Store this for later half carry computation
7763
		mov	[_orgval2], bx	; Store this, too
7764
		sahf		; Restore our flags
7765
		adc	bx, dx	; Do the operation!
7766
		lahf		; Get our new flags
7767
		seto	dl
7768
		and	ah, 0fbh	; Knock out parity/overflow
7769
		shl	dl, 2
7770
		or		ah, dl
7771
		and	ah, 0edh	; Knock out negative & half carry flags
7772
		mov	[_z80hl], bx
7773
		xor	bx, [_orgval]
7774
		xor	bx, [_orgval2]
7775
		and	bh, 10h	; Half carry?
7776
		or	ah, bh	; OR It in if so
7777
		mov	bx, [_z80hl]
7778
		xor	edx, edx	; Make sure we don't hose things
7779
		sub	edi, byte 15
7780
		js	near noMoreExec
7781
		mov	dl, byte [esi]	; Get our next instruction
7782
		inc	esi		; Increment PC
7783
		jmp	dword [z80regular+edx*4]
7784
 
7785
 
7786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7787
 
7788
EDInst5b:
7789
		mov	dx, [esi]	; Get address to load
7790
		add	esi, 2	; Skip over it so we don't execute it
7791
		mov	[cyclesRemaining], edi
7792
		mov	edi, [_z80MemRead]	; Point to the read array
7793
 
7794
checkLoop70:
7795
		cmp	[edi], word 0ffffh ; End of the list?
7796
		je		memoryRead70
7797
		cmp	edx, [edi]	; Are we smaller?
7798
		jb		nextAddr70		; Yes, go to the next address
7799
		cmp	edx, [edi+4]	; Are we bigger?
7800
		jbe	callRoutine70
7801
 
7802
nextAddr70:
7803
		add	edi, 10h		; Next structure!
7804
		jmp	short checkLoop70
7805
 
7806
callRoutine70:
7807
		call	ReadMemoryByte	; Standard read routine
7808
		mov	byte [_z80de], al	; Put our returned value here
7809
		mov	ax, [_z80af]	; Get our AF back
7810
		jmp	short readExit70
7811
 
7812
memoryRead70:
7813
		mov	di, dx
7814
		mov	dl, [ebp + edx]
7815
		mov	byte [_z80de], dl
7816
		mov	dx, di
7817
readExit70:
7818
		mov	edi, [cyclesRemaining]
7819
		inc	dx
7820
		mov	[cyclesRemaining], edi
7821
		mov	edi, [_z80MemRead]	; Point to the read array
7822
 
7823
checkLoop71:
7824
		cmp	[edi], word 0ffffh ; End of the list?
7825
		je		memoryRead71
7826
		cmp	edx, [edi]	; Are we smaller?
7827
		jb		nextAddr71		; Yes, go to the next address
7828
		cmp	edx, [edi+4]	; Are we bigger?
7829
		jbe	callRoutine71
7830
 
7831
nextAddr71:
7832
		add	edi, 10h		; Next structure!
7833
		jmp	short checkLoop71
7834
 
7835
callRoutine71:
7836
		call	ReadMemoryByte	; Standard read routine
7837
		mov	byte [_z80de + 1], al	; Put our returned value here
7838
		mov	ax, [_z80af]	; Get our AF back
7839
		jmp	short readExit71
7840
 
7841
memoryRead71:
7842
		mov	di, dx
7843
		mov	dl, [ebp + edx]
7844
		mov	byte [_z80de + 1], dl
7845
		mov	dx, di
7846
readExit71:
7847
		mov	edi, [cyclesRemaining]
7848
		xor	edx, edx
7849
		sub	edi, byte 20
7850
		js	near noMoreExec
7851
		mov	dl, byte [esi]	; Get our next instruction
7852
		inc	esi		; Increment PC
7853
		jmp	dword [z80regular+edx*4]
7854
 
7855
 
7856
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7857
 
7858
EDInst5e:
7859
		mov	dword [_z80interruptMode], 2 ; IM 2
7860
		sub	edi, byte 8
7861
		js	near noMoreExec
7862
		mov	dl, byte [esi]	; Get our next instruction
7863
		inc	esi		; Increment PC
7864
		jmp	dword [z80regular+edx*4]
7865
 
7866
 
7867
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7868
 
7869
EDInst5f:
7870
           mov     al, [_z80r]
7871
		and	ah, 029h	; No N, H, Z, or S!
7872
		or	al,al	; Get appropriate flags
7873
		o16 pushf
7874
		pop	dx
7875
		and	dl, 0c0h
7876
		or	ah, dl	; OR In our S & Z flags
7877
		mov	dl, [_z80iff]
7878
		and	dl, IFF2
7879
		shl	dl, 1
7880
		or	ah, dl
7881
		mov	edx, [dwLastRSample]
7882
		sub	edx, edi
7883
		add	edx, [_z80rCounter]
7884
		shr	edx, 2
7885
		and	edx, 07fh
7886
		and	byte [_z80r], 80h
7887
		or		byte [_z80r], dl
7888
		xor	edx, edx
7889
		mov	[dwLastRSample], edi
7890
		sub	edi, byte 9
7891
		js	near noMoreExec
7892
		mov	dl, byte [esi]	; Get our next instruction
7893
		inc	esi		; Increment PC
7894
		jmp	dword [z80regular+edx*4]
7895
 
7896
 
7897
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7898
 
7899
EDInst60:
7900
		mov	dl, cl	; Address in DX... (C)
7901
		mov	[cyclesRemaining], edi
7902
		mov	edi, [_z80IoRead]	; Point to the read array
7903
 
7904
checkLoop72:
7905
		cmp	[edi], word 0ffffh ; End of the list?
7906
		je		ioRead72
7907
		cmp	dx, [edi]	; Are we smaller?
7908
		jb		nextAddr72		; Yes, go to the next address
7909
		cmp	dx, [edi+2]	; Are we bigger?
7910
		jbe	callRoutine72
7911
 
7912
nextAddr72:
7913
		add	edi, 0ch		; Next structure!
7914
		jmp	short checkLoop72
7915
 
7916
callRoutine72:
7917
		call	ReadIOByte	; Standard read routine
7918
		mov	bh, al	; Put our returned value here
7919
		mov	ax, [_z80af]	; Get our AF back
7920
		jmp	short readExit72
7921
 
7922
ioRead72:
7923
		mov	bh, 0ffh	; An unreferenced read
7924
readExit72:
7925
		mov	edi, [cyclesRemaining]
7926
;
7927
; Remember, this variant of the IN instruction modifies the flags
7928
;
7929
 
7930
		sahf	; Restore our flags
7931
		mov	dh, ah	; Save flags for later
7932
		or	bh, bh;
7933
		lahf
7934
		and	dh, 029h	; Only keep carry and two unused flags
7935
		and	ah, 0d4h
7936
		or	ah, dh
7937
		xor	edx, edx
7938
		sub	edi, byte 12
7939
		js	near noMoreExec
7940
		mov	dl, byte [esi]	; Get our next instruction
7941
		inc	esi		; Increment PC
7942
		jmp	dword [z80regular+edx*4]
7943
 
7944
 
7945
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7946
 
7947
EDInst61:
7948
		mov	dl, cl	; Address in DX... (C)
7949
		mov	[cyclesRemaining], edi
7950
		mov	[_z80af], ax	; Store AF
7951
		mov	al, bh	; And our data to write
7952
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
7953
 
7954
checkLoop73:
7955
		cmp	[edi], word 0ffffh ; End of our list?
7956
		je	WriteMacroExit73	; Yes - ignore it!
7957
		cmp	dx, [edi]	; Are we smaller?
7958
		jb	nextAddr73	; Yes... go to the next addr
7959
		cmp	dx, [edi+2]	; Are we bigger?
7960
		jbe	callRoutine73	; If not, go call it!
7961
 
7962
nextAddr73:
7963
		add	edi, 0ch		; Next structure, please
7964
		jmp	short checkLoop73
7965
 
7966
callRoutine73:
7967
		call	WriteIOByte	; Go write the data!
7968
WriteMacroExit73:
7969
		mov	edi, [cyclesRemaining]
7970
		xor	edx, edx
7971
		sub	edi, byte 12
7972
		js	near noMoreExec
7973
		mov	dl, byte [esi]	; Get our next instruction
7974
		inc	esi		; Increment PC
7975
		jmp	dword [z80regular+edx*4]
7976
 
7977
 
7978
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
7979
 
7980
EDInst62:
7981
		mov	dx, bx	; Get our original register
7982
		mov	[_orgval], dx	; Store this for later half carry computation
7983
		mov	[_orgval2], bx	; Store this, too
7984
		sahf		; Restore our flags
7985
		sbb	bx, dx	; Do the operation!
7986
		lahf		; Get our new flags
7987
		seto	dl
7988
		and	ah, 0fbh	; Knock out parity/overflow
7989
		shl	dl, 2
7990
		or		ah, dl
7991
		and	ah, 0edh	; Knock out negative & half carry flags
7992
		or	ah, 02h	; Negative!
7993
		mov	[_z80hl], bx
7994
		xor	bx, [_orgval]
7995
		xor	bx, [_orgval2]
7996
		and	bh, 10h	; Half carry?
7997
		or	ah, bh	; OR It in if so
7998
		mov	bx, [_z80hl]
7999
		xor	edx, edx	; Make sure we don't hose things
8000
		sub	edi, byte 15
8001
		js	near noMoreExec
8002
		mov	dl, byte [esi]	; Get our next instruction
8003
		inc	esi		; Increment PC
8004
		jmp	dword [z80regular+edx*4]
8005
 
8006
 
8007
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8008
 
8009
EDInst63:
8010
		mov	dx, [esi]	; Get our address to write to
8011
		add	esi, 2		; Next address, please...
8012
		mov	[cyclesRemaining], edi
8013
		mov	[_z80af], ax	; Store AF
8014
		mov	al, bl	; And our data to write
8015
		mov	edi, [_z80MemWrite]	; Point to the write array
8016
 
8017
checkLoop74:
8018
		cmp	[edi], word 0ffffh ; End of our list?
8019
		je	memoryWrite74	; Yes - go write it!
8020
		cmp	dx, [edi]	; Are we smaller?
8021
		jb	nextAddr74	; Yes... go to the next addr
8022
		cmp	dx, [edi+4]	; Are we smaller?
8023
		jbe	callRoutine74	; If not, go call it!
8024
 
8025
nextAddr74:
8026
		add	edi, 10h		; Next structure, please
8027
		jmp	short checkLoop74
8028
 
8029
callRoutine74:
8030
		call	WriteMemoryByte	; Go write the data!
8031
		jmp	short WriteMacroExit74
8032
memoryWrite74:
8033
		mov	[ebp + edx], bl
8034
		mov	ax, [_z80af] ; Get our accumulator and flags
8035
WriteMacroExit74:
8036
		mov	edi, [cyclesRemaining]
8037
		inc	dx
8038
		mov	[cyclesRemaining], edi
8039
		mov	[_z80af], ax	; Store AF
8040
		mov	al, bh	; And our data to write
8041
		mov	edi, [_z80MemWrite]	; Point to the write array
8042
 
8043
checkLoop75:
8044
		cmp	[edi], word 0ffffh ; End of our list?
8045
		je	memoryWrite75	; Yes - go write it!
8046
		cmp	dx, [edi]	; Are we smaller?
8047
		jb	nextAddr75	; Yes... go to the next addr
8048
		cmp	dx, [edi+4]	; Are we smaller?
8049
		jbe	callRoutine75	; If not, go call it!
8050
 
8051
nextAddr75:
8052
		add	edi, 10h		; Next structure, please
8053
		jmp	short checkLoop75
8054
 
8055
callRoutine75:
8056
		call	WriteMemoryByte	; Go write the data!
8057
		jmp	short WriteMacroExit75
8058
memoryWrite75:
8059
		mov	[ebp + edx], bh
8060
		mov	ax, [_z80af] ; Get our accumulator and flags
8061
WriteMacroExit75:
8062
		mov	edi, [cyclesRemaining]
8063
		xor	edx, edx	; Zero our upper word
8064
		sub	edi, byte 20
8065
		js	near noMoreExec
8066
		mov	dl, byte [esi]	; Get our next instruction
8067
		inc	esi		; Increment PC
8068
		jmp	dword [z80regular+edx*4]
8069
 
8070
 
8071
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8072
 
8073
EDInst67:
8074
		mov	[cyclesRemaining], edi
8075
		mov	edi, [_z80MemRead]	; Point to the read array
8076
 
8077
checkLoop76:
8078
		cmp	[edi], word 0ffffh ; End of the list?
8079
		je		memoryRead76
8080
		cmp	ebx, [edi]	; Are we smaller?
8081
		jb		nextAddr76		; Yes, go to the next address
8082
		cmp	ebx, [edi+4]	; Are we bigger?
8083
		jbe	callRoutine76
8084
 
8085
nextAddr76:
8086
		add	edi, 10h		; Next structure!
8087
		jmp	short checkLoop76
8088
 
8089
callRoutine76:
8090
		mov	dx, bx	; Get our address
8091
		call	ReadMemoryByte	; Standard read routine
8092
		mov	dl, al	; Put our returned value here
8093
		mov	ax, [_z80af]	; Get our AF back
8094
		jmp	short readExit76
8095
 
8096
memoryRead76:
8097
		mov	dl, [ebp + ebx]	; Get our data
8098
 
8099
readExit76:
8100
		mov	edi, [cyclesRemaining]
8101
		mov	dh, dl	; Put a copy in DH
8102
		shr	dl, 4	; Upper nibble to lower nibble
8103
		shl	ecx, 16	; Save this
8104
		mov	cl, al
8105
		shl	cl, 4
8106
		or	dl, cl	; OR In what was in A
8107
		and	al, 0f0h	; Knock out lower part
8108
		and	dh, 0fh	; Only the lower nibble
8109
		or	al, dh	; OR In our nibble
8110
		shr	ecx, 16	; Restore this
8111
		and	ah, 29h	; Retain carry & two undefined bits
8112
		mov	dh, ah	; Store our flags away for later
8113
		or	al, al	; Get our flags
8114
		lahf
8115
		and	ah,0c4h	; Only partiy, zero, and sign
8116
		or	ah, dh	; OR In our old flags
8117
		mov	[cyclesRemaining], edi
8118
		mov	[_z80af], ax	; Store AF
8119
		mov	al, dl	; And our data to write
8120
		mov	edi, [_z80MemWrite]	; Point to the write array
8121
 
8122
checkLoop77:
8123
		cmp	[edi], word 0ffffh ; End of our list?
8124
		je	memoryWrite77	; Yes - go write it!
8125
		cmp	bx, [edi]	; Are we smaller?
8126
		jb	nextAddr77	; Yes... go to the next addr
8127
		cmp	bx, [edi+4]	; Are we smaller?
8128
		jbe	callRoutine77	; If not, go call it!
8129
 
8130
nextAddr77:
8131
		add	edi, 10h		; Next structure, please
8132
		jmp	short checkLoop77
8133
 
8134
callRoutine77:
8135
		mov	dx, bx	; Get our address to target
8136
		call	WriteMemoryByte	; Go write the data!
8137
		jmp	short WriteMacroExit77
8138
memoryWrite77:
8139
		mov	[ebp + ebx], dl
8140
		mov	ax, [_z80af] ; Get our accumulator and flags
8141
WriteMacroExit77:
8142
		mov	edi, [cyclesRemaining]
8143
		xor	edx, edx	; Zero out this for later
8144
		sub	edi, byte 18
8145
		js	near noMoreExec
8146
		mov	dl, byte [esi]	; Get our next instruction
8147
		inc	esi		; Increment PC
8148
		jmp	dword [z80regular+edx*4]
8149
 
8150
 
8151
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8152
 
8153
EDInst68:
8154
		mov	dl, cl	; Address in DX... (C)
8155
		mov	[cyclesRemaining], edi
8156
		mov	edi, [_z80IoRead]	; Point to the read array
8157
 
8158
checkLoop78:
8159
		cmp	[edi], word 0ffffh ; End of the list?
8160
		je		ioRead78
8161
		cmp	dx, [edi]	; Are we smaller?
8162
		jb		nextAddr78		; Yes, go to the next address
8163
		cmp	dx, [edi+2]	; Are we bigger?
8164
		jbe	callRoutine78
8165
 
8166
nextAddr78:
8167
		add	edi, 0ch		; Next structure!
8168
		jmp	short checkLoop78
8169
 
8170
callRoutine78:
8171
		call	ReadIOByte	; Standard read routine
8172
		mov	bl, al	; Put our returned value here
8173
		mov	ax, [_z80af]	; Get our AF back
8174
		jmp	short readExit78
8175
 
8176
ioRead78:
8177
		mov	bl, 0ffh	; An unreferenced read
8178
readExit78:
8179
		mov	edi, [cyclesRemaining]
8180
;
8181
; Remember, this variant of the IN instruction modifies the flags
8182
;
8183
 
8184
		sahf	; Restore our flags
8185
		mov	dh, ah	; Save flags for later
8186
		or	bl, bl;
8187
		lahf
8188
		and	dh, 029h	; Only keep carry and two unused flags
8189
		and	ah, 0d4h
8190
		or	ah, dh
8191
		xor	edx, edx
8192
		sub	edi, byte 12
8193
		js	near noMoreExec
8194
		mov	dl, byte [esi]	; Get our next instruction
8195
		inc	esi		; Increment PC
8196
		jmp	dword [z80regular+edx*4]
8197
 
8198
 
8199
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8200
 
8201
EDInst69:
8202
		mov	dl, cl	; Address in DX... (C)
8203
		mov	[cyclesRemaining], edi
8204
		mov	[_z80af], ax	; Store AF
8205
		mov	al, bl	; And our data to write
8206
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
8207
 
8208
checkLoop79:
8209
		cmp	[edi], word 0ffffh ; End of our list?
8210
		je	WriteMacroExit79	; Yes - ignore it!
8211
		cmp	dx, [edi]	; Are we smaller?
8212
		jb	nextAddr79	; Yes... go to the next addr
8213
		cmp	dx, [edi+2]	; Are we bigger?
8214
		jbe	callRoutine79	; If not, go call it!
8215
 
8216
nextAddr79:
8217
		add	edi, 0ch		; Next structure, please
8218
		jmp	short checkLoop79
8219
 
8220
callRoutine79:
8221
		call	WriteIOByte	; Go write the data!
8222
WriteMacroExit79:
8223
		mov	edi, [cyclesRemaining]
8224
		xor	edx, edx
8225
		sub	edi, byte 12
8226
		js	near noMoreExec
8227
		mov	dl, byte [esi]	; Get our next instruction
8228
		inc	esi		; Increment PC
8229
		jmp	dword [z80regular+edx*4]
8230
 
8231
 
8232
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8233
 
8234
EDInst6a:
8235
		mov	dx, bx	; Get our original register
8236
		mov	[_orgval], dx	; Store this for later half carry computation
8237
		mov	[_orgval2], bx	; Store this, too
8238
		sahf		; Restore our flags
8239
		adc	bx, dx	; Do the operation!
8240
		lahf		; Get our new flags
8241
		seto	dl
8242
		and	ah, 0fbh	; Knock out parity/overflow
8243
		shl	dl, 2
8244
		or		ah, dl
8245
		and	ah, 0edh	; Knock out negative & half carry flags
8246
		mov	[_z80hl], bx
8247
		xor	bx, [_orgval]
8248
		xor	bx, [_orgval2]
8249
		and	bh, 10h	; Half carry?
8250
		or	ah, bh	; OR It in if so
8251
		mov	bx, [_z80hl]
8252
		xor	edx, edx	; Make sure we don't hose things
8253
		sub	edi, byte 15
8254
		js	near noMoreExec
8255
		mov	dl, byte [esi]	; Get our next instruction
8256
		inc	esi		; Increment PC
8257
		jmp	dword [z80regular+edx*4]
8258
 
8259
 
8260
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8261
 
8262
EDInst6f:
8263
		mov	[cyclesRemaining], edi
8264
		mov	edi, [_z80MemRead]	; Point to the read array
8265
 
8266
checkLoop80:
8267
		cmp	[edi], word 0ffffh ; End of the list?
8268
		je		memoryRead80
8269
		cmp	ebx, [edi]	; Are we smaller?
8270
		jb		nextAddr80		; Yes, go to the next address
8271
		cmp	ebx, [edi+4]	; Are we bigger?
8272
		jbe	callRoutine80
8273
 
8274
nextAddr80:
8275
		add	edi, 10h		; Next structure!
8276
		jmp	short checkLoop80
8277
 
8278
callRoutine80:
8279
		mov	dx, bx	; Get our address
8280
		call	ReadMemoryByte	; Standard read routine
8281
		mov	dl, al	; Put our returned value here
8282
		mov	ax, [_z80af]	; Get our AF back
8283
		jmp	short readExit80
8284
 
8285
memoryRead80:
8286
		mov	dl, [ebp + ebx]	; Get our data
8287
 
8288
readExit80:
8289
		mov	edi, [cyclesRemaining]
8290
		mov	dh, dl	; Put a copy in DH
8291
		shr	dh, 4	; Get our upper nibble in position
8292
		shl	dl, 4	; Get our lower nibble into the higher position
8293
		shl	ecx, 16	; Save this for later
8294
		mov	cl, al
8295
		and	cl, 0fh
8296
	; Only the lower nibble
8297
		or	dl, cl	; OR In A->(HL) transfer
8298
		and	al, 0f0h	; Only the upper 4 bits remain
8299
		or	al, dh	; OR It in to our accumulator
8300
		shr	ecx, 16	; Restore this
8301
		and	ah, 29h	; Retain carry & two undefined bits
8302
		mov	dh, ah	; Store our flags away for later
8303
		or	al, al	; Get our flags
8304
		lahf
8305
		and	ah,0c4h	; Only partiy, zero, and sign
8306
		or	ah, dh	; OR In our old flags
8307
		mov	[cyclesRemaining], edi
8308
		mov	[_z80af], ax	; Store AF
8309
		mov	al, dl	; And our data to write
8310
		mov	edi, [_z80MemWrite]	; Point to the write array
8311
 
8312
checkLoop81:
8313
		cmp	[edi], word 0ffffh ; End of our list?
8314
		je	memoryWrite81	; Yes - go write it!
8315
		cmp	bx, [edi]	; Are we smaller?
8316
		jb	nextAddr81	; Yes... go to the next addr
8317
		cmp	bx, [edi+4]	; Are we smaller?
8318
		jbe	callRoutine81	; If not, go call it!
8319
 
8320
nextAddr81:
8321
		add	edi, 10h		; Next structure, please
8322
		jmp	short checkLoop81
8323
 
8324
callRoutine81:
8325
		mov	dx, bx	; Get our address to target
8326
		call	WriteMemoryByte	; Go write the data!
8327
		jmp	short WriteMacroExit81
8328
memoryWrite81:
8329
		mov	[ebp + ebx], dl
8330
		mov	ax, [_z80af] ; Get our accumulator and flags
8331
WriteMacroExit81:
8332
		mov	edi, [cyclesRemaining]
8333
		xor	edx, edx	; Zero out this for later
8334
		sub	edi, byte 18
8335
		js	near noMoreExec
8336
		mov	dl, byte [esi]	; Get our next instruction
8337
		inc	esi		; Increment PC
8338
		jmp	dword [z80regular+edx*4]
8339
 
8340
 
8341
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8342
 
8343
EDInst72:
8344
		mov	dx, word [_z80sp]	; Get our original register
8345
		mov	[_orgval], dx	; Store this for later half carry computation
8346
		mov	[_orgval2], bx	; Store this, too
8347
		sahf		; Restore our flags
8348
		sbb	bx, dx	; Do the operation!
8349
		lahf		; Get our new flags
8350
		seto	dl
8351
		and	ah, 0fbh	; Knock out parity/overflow
8352
		shl	dl, 2
8353
		or		ah, dl
8354
		and	ah, 0edh	; Knock out negative & half carry flags
8355
		or	ah, 02h	; Negative!
8356
		mov	[_z80hl], bx
8357
		xor	bx, [_orgval]
8358
		xor	bx, [_orgval2]
8359
		and	bh, 10h	; Half carry?
8360
		or	ah, bh	; OR It in if so
8361
		mov	bx, [_z80hl]
8362
		xor	edx, edx	; Make sure we don't hose things
8363
		sub	edi, byte 15
8364
		js	near noMoreExec
8365
		mov	dl, byte [esi]	; Get our next instruction
8366
		inc	esi		; Increment PC
8367
		jmp	dword [z80regular+edx*4]
8368
 
8369
 
8370
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8371
 
8372
EDInst73:
8373
		mov	dx, [esi]	; Get our address to write to
8374
		add	esi, 2		; Next address, please...
8375
		mov	[cyclesRemaining], edi
8376
		mov	[_z80af], ax	; Store AF
8377
		mov	al, byte [_z80sp]	; And our data to write
8378
		mov	edi, [_z80MemWrite]	; Point to the write array
8379
 
8380
checkLoop82:
8381
		cmp	[edi], word 0ffffh ; End of our list?
8382
		je	memoryWrite82	; Yes - go write it!
8383
		cmp	dx, [edi]	; Are we smaller?
8384
		jb	nextAddr82	; Yes... go to the next addr
8385
		cmp	dx, [edi+4]	; Are we smaller?
8386
		jbe	callRoutine82	; If not, go call it!
8387
 
8388
nextAddr82:
8389
		add	edi, 10h		; Next structure, please
8390
		jmp	short checkLoop82
8391
 
8392
callRoutine82:
8393
		call	WriteMemoryByte	; Go write the data!
8394
		jmp	short WriteMacroExit82
8395
memoryWrite82:
8396
		mov	edi, edx
8397
		mov	dl, byte [_z80sp]
8398
		mov	[ebp + edi], dl
8399
		mov	edx, edi
8400
		mov	ax, [_z80af] ; Get our accumulator and flags
8401
WriteMacroExit82:
8402
		mov	edi, [cyclesRemaining]
8403
		inc	dx
8404
		mov	[cyclesRemaining], edi
8405
		mov	[_z80af], ax	; Store AF
8406
		mov	al, byte [_z80sp + 1]	; And our data to write
8407
		mov	edi, [_z80MemWrite]	; Point to the write array
8408
 
8409
checkLoop83:
8410
		cmp	[edi], word 0ffffh ; End of our list?
8411
		je	memoryWrite83	; Yes - go write it!
8412
		cmp	dx, [edi]	; Are we smaller?
8413
		jb	nextAddr83	; Yes... go to the next addr
8414
		cmp	dx, [edi+4]	; Are we smaller?
8415
		jbe	callRoutine83	; If not, go call it!
8416
 
8417
nextAddr83:
8418
		add	edi, 10h		; Next structure, please
8419
		jmp	short checkLoop83
8420
 
8421
callRoutine83:
8422
		call	WriteMemoryByte	; Go write the data!
8423
		jmp	short WriteMacroExit83
8424
memoryWrite83:
8425
		mov	edi, edx
8426
		mov	dl, byte [_z80sp + 1]
8427
		mov	[ebp + edi], dl
8428
		mov	edx, edi
8429
		mov	ax, [_z80af] ; Get our accumulator and flags
8430
WriteMacroExit83:
8431
		mov	edi, [cyclesRemaining]
8432
		xor	edx, edx	; Zero our upper word
8433
		sub	edi, byte 20
8434
		js	near noMoreExec
8435
		mov	dl, byte [esi]	; Get our next instruction
8436
		inc	esi		; Increment PC
8437
		jmp	dword [z80regular+edx*4]
8438
 
8439
 
8440
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8441
 
8442
EDInst78:
8443
		mov	dl, cl	; Address in DX... (C)
8444
		mov	[cyclesRemaining], edi
8445
		mov	edi, [_z80IoRead]	; Point to the read array
8446
 
8447
checkLoop84:
8448
		cmp	[edi], word 0ffffh ; End of the list?
8449
		je		ioRead84
8450
		cmp	dx, [edi]	; Are we smaller?
8451
		jb		nextAddr84		; Yes, go to the next address
8452
		cmp	dx, [edi+2]	; Are we bigger?
8453
		jbe	callRoutine84
8454
 
8455
nextAddr84:
8456
		add	edi, 0ch		; Next structure!
8457
		jmp	short checkLoop84
8458
 
8459
callRoutine84:
8460
		call	ReadIOByte	; Standard read routine
8461
		mov	[_z80af], al	; Save our new accumulator
8462
		mov	ax, [_z80af]	; Get our AF back
8463
		jmp	short readExit84
8464
 
8465
ioRead84:
8466
		mov	al, 0ffh	; An unreferenced read
8467
readExit84:
8468
		mov	edi, [cyclesRemaining]
8469
;
8470
; Remember, this variant of the IN instruction modifies the flags
8471
;
8472
 
8473
		sahf	; Restore our flags
8474
		mov	dh, ah	; Save flags for later
8475
		or	al, al;
8476
		lahf
8477
		and	dh, 029h	; Only keep carry and two unused flags
8478
		and	ah, 0d4h
8479
		or	ah, dh
8480
		xor	edx, edx
8481
		sub	edi, byte 12
8482
		js	near noMoreExec
8483
		mov	dl, byte [esi]	; Get our next instruction
8484
		inc	esi		; Increment PC
8485
		jmp	dword [z80regular+edx*4]
8486
 
8487
 
8488
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8489
 
8490
EDInst79:
8491
		mov	dl, cl	; Address in DX... (C)
8492
		mov	[cyclesRemaining], edi
8493
		mov	[_z80af], ax	; Store AF
8494
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
8495
 
8496
checkLoop85:
8497
		cmp	[edi], word 0ffffh ; End of our list?
8498
		je	WriteMacroExit85	; Yes - ignore it!
8499
		cmp	dx, [edi]	; Are we smaller?
8500
		jb	nextAddr85	; Yes... go to the next addr
8501
		cmp	dx, [edi+2]	; Are we bigger?
8502
		jbe	callRoutine85	; If not, go call it!
8503
 
8504
nextAddr85:
8505
		add	edi, 0ch		; Next structure, please
8506
		jmp	short checkLoop85
8507
 
8508
callRoutine85:
8509
		call	WriteIOByte	; Go write the data!
8510
WriteMacroExit85:
8511
		mov	edi, [cyclesRemaining]
8512
		xor	edx, edx
8513
		sub	edi, byte 12
8514
		js	near noMoreExec
8515
		mov	dl, byte [esi]	; Get our next instruction
8516
		inc	esi		; Increment PC
8517
		jmp	dword [z80regular+edx*4]
8518
 
8519
 
8520
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8521
 
8522
EDInst7a:
8523
		mov	dx, word [_z80sp]	; Get our original register
8524
		mov	[_orgval], dx	; Store this for later half carry computation
8525
		mov	[_orgval2], bx	; Store this, too
8526
		sahf		; Restore our flags
8527
		adc	bx, dx	; Do the operation!
8528
		lahf		; Get our new flags
8529
		seto	dl
8530
		and	ah, 0fbh	; Knock out parity/overflow
8531
		shl	dl, 2
8532
		or		ah, dl
8533
		and	ah, 0edh	; Knock out negative & half carry flags
8534
		mov	[_z80hl], bx
8535
		xor	bx, [_orgval]
8536
		xor	bx, [_orgval2]
8537
		and	bh, 10h	; Half carry?
8538
		or	ah, bh	; OR It in if so
8539
		mov	bx, [_z80hl]
8540
		xor	edx, edx	; Make sure we don't hose things
8541
		sub	edi, byte 15
8542
		js	near noMoreExec
8543
		mov	dl, byte [esi]	; Get our next instruction
8544
		inc	esi		; Increment PC
8545
		jmp	dword [z80regular+edx*4]
8546
 
8547
 
8548
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8549
 
8550
EDInst7b:
8551
		mov	dx, [esi]	; Get address to load
8552
		add	esi, 2	; Skip over it so we don't execute it
8553
		mov	[cyclesRemaining], edi
8554
		mov	edi, [_z80MemRead]	; Point to the read array
8555
 
8556
checkLoop86:
8557
		cmp	[edi], word 0ffffh ; End of the list?
8558
		je		memoryRead86
8559
		cmp	edx, [edi]	; Are we smaller?
8560
		jb		nextAddr86		; Yes, go to the next address
8561
		cmp	edx, [edi+4]	; Are we bigger?
8562
		jbe	callRoutine86
8563
 
8564
nextAddr86:
8565
		add	edi, 10h		; Next structure!
8566
		jmp	short checkLoop86
8567
 
8568
callRoutine86:
8569
		call	ReadMemoryByte	; Standard read routine
8570
		mov	byte [_z80sp], al	; Put our returned value here
8571
		mov	ax, [_z80af]	; Get our AF back
8572
		jmp	short readExit86
8573
 
8574
memoryRead86:
8575
		mov	di, dx
8576
		mov	dl, [ebp + edx]
8577
		mov	byte [_z80sp], dl
8578
		mov	dx, di
8579
readExit86:
8580
		mov	edi, [cyclesRemaining]
8581
		inc	dx
8582
		mov	[cyclesRemaining], edi
8583
		mov	edi, [_z80MemRead]	; Point to the read array
8584
 
8585
checkLoop87:
8586
		cmp	[edi], word 0ffffh ; End of the list?
8587
		je		memoryRead87
8588
		cmp	edx, [edi]	; Are we smaller?
8589
		jb		nextAddr87		; Yes, go to the next address
8590
		cmp	edx, [edi+4]	; Are we bigger?
8591
		jbe	callRoutine87
8592
 
8593
nextAddr87:
8594
		add	edi, 10h		; Next structure!
8595
		jmp	short checkLoop87
8596
 
8597
callRoutine87:
8598
		call	ReadMemoryByte	; Standard read routine
8599
		mov	byte [_z80sp + 1], al	; Put our returned value here
8600
		mov	ax, [_z80af]	; Get our AF back
8601
		jmp	short readExit87
8602
 
8603
memoryRead87:
8604
		mov	di, dx
8605
		mov	dl, [ebp + edx]
8606
		mov	byte [_z80sp + 1], dl
8607
		mov	dx, di
8608
readExit87:
8609
		mov	edi, [cyclesRemaining]
8610
		xor	edx, edx
8611
		sub	edi, byte 20
8612
		js	near noMoreExec
8613
		mov	dl, byte [esi]	; Get our next instruction
8614
		inc	esi		; Increment PC
8615
		jmp	dword [z80regular+edx*4]
8616
 
8617
 
8618
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8619
 
8620
EDInsta0:
8621
		mov	[cyclesRemaining], edi
8622
		mov	edi, [_z80MemRead]	; Point to the read array
8623
 
8624
checkLoop88:
8625
		cmp	[edi], word 0ffffh ; End of the list?
8626
		je		memoryRead88
8627
		cmp	ebx, [edi]	; Are we smaller?
8628
		jb		nextAddr88		; Yes, go to the next address
8629
		cmp	ebx, [edi+4]	; Are we bigger?
8630
		jbe	callRoutine88
8631
 
8632
nextAddr88:
8633
		add	edi, 10h		; Next structure!
8634
		jmp	short checkLoop88
8635
 
8636
callRoutine88:
8637
		mov	dx, bx	; Get our address
8638
		call	ReadMemoryByte	; Standard read routine
8639
		mov	dl, al	; Put our returned value here
8640
		mov	ax, [_z80af]	; Get our AF back
8641
		jmp	short readExit88
8642
 
8643
memoryRead88:
8644
		mov	dl, [ebp + ebx]	; Get our data
8645
 
8646
readExit88:
8647
		mov	edi, [cyclesRemaining]
8648
		mov	[cyclesRemaining], edi
8649
		mov	[_z80af], ax	; Store AF
8650
		mov	al, dl	; And our data to write
8651
		mov	dx, [_z80de]
8652
		mov	edi, [_z80MemWrite]	; Point to the write array
8653
 
8654
checkLoop89:
8655
		cmp	[edi], word 0ffffh ; End of our list?
8656
		je	memoryWrite89	; Yes - go write it!
8657
		cmp	dx, [edi]	; Are we smaller?
8658
		jb	nextAddr89	; Yes... go to the next addr
8659
		cmp	dx, [edi+4]	; Are we smaller?
8660
		jbe	callRoutine89	; If not, go call it!
8661
 
8662
nextAddr89:
8663
		add	edi, 10h		; Next structure, please
8664
		jmp	short checkLoop89
8665
 
8666
callRoutine89:
8667
		call	WriteMemoryByte	; Go write the data!
8668
		jmp	short WriteMacroExit89
8669
memoryWrite89:
8670
		mov	[ebp + edx], al
8671
		mov	ax, [_z80af] ; Get our accumulator and flags
8672
WriteMacroExit89:
8673
		mov	edi, [cyclesRemaining]
8674
		inc	bx	; Increment HL
8675
		inc	word [_z80de]	; Increment DE
8676
		dec	cx	; Decrement BC
8677
		and	ah, 0e9h ; Knock out H & N and P/V
8678
		or		cx, cx	; Flag BC
8679
		jz	atZero90 ; We're done!
8680
		or	ah, 04h	; Non-zero - we're still going!
8681
atZero90:
8682
		xor	edx, edx	; Make sure we don't hose things
8683
		sub	edi, byte 16
8684
		js	near noMoreExec
8685
		mov	dl, byte [esi]	; Get our next instruction
8686
		inc	esi		; Increment PC
8687
		jmp	dword [z80regular+edx*4]
8688
 
8689
 
8690
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8691
 
8692
EDInsta1:
8693
		mov	[cyclesRemaining], edi
8694
		mov	edi, [_z80MemRead]	; Point to the read array
8695
 
8696
checkLoop91:
8697
		cmp	[edi], word 0ffffh ; End of the list?
8698
		je		memoryRead91
8699
		cmp	ebx, [edi]	; Are we smaller?
8700
		jb		nextAddr91		; Yes, go to the next address
8701
		cmp	ebx, [edi+4]	; Are we bigger?
8702
		jbe	callRoutine91
8703
 
8704
nextAddr91:
8705
		add	edi, 10h		; Next structure!
8706
		jmp	short checkLoop91
8707
 
8708
callRoutine91:
8709
		mov	dx, bx	; Get our address
8710
		call	ReadMemoryByte	; Standard read routine
8711
		mov	dl, al	; Put our returned value here
8712
		mov	ax, [_z80af]	; Get our AF back
8713
		jmp	short readExit91
8714
 
8715
memoryRead91:
8716
		mov	dl, [ebp + ebx]	; Get our data
8717
 
8718
readExit91:
8719
		mov	edi, [cyclesRemaining]
8720
		mov	byte [_z80af], ah
8721
		sahf
8722
		cmp	al, dl	; Do our comparison
8723
		lahf
8724
		and	ah, 0fah	; No P/V or carry!
8725
		dec	cx	; Dec BC
8726
		jz	notBcZero92
8727
		or	ah, 04h	; P/V set when BC not zero
8728
notBcZero92:
8729
		or	ah, 02h	; N Gets set when we do compares
8730
		mov	dl, byte [_z80af]
8731
		and	dl, 01h
8732
		or	ah, dl	; Preserve carry!
8733
		inc	bx	; Increment!
8734
		xor	edx, edx
8735
		sub	edi, byte 16
8736
		js	near noMoreExec
8737
		mov	dl, byte [esi]	; Get our next instruction
8738
		inc	esi		; Increment PC
8739
		jmp	dword [z80regular+edx*4]
8740
 
8741
 
8742
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8743
 
8744
EDInsta2:
8745
		push	cx	; Save BC
8746
		xor	ch, ch ; We want 8 bit ports
8747
		mov	[cyclesRemaining], edi
8748
		mov	edi, [_z80IoRead]	; Point to the read array
8749
 
8750
checkLoop93:
8751
		cmp	[edi], word 0ffffh ; End of the list?
8752
		je		ioRead93
8753
		cmp	cx, [edi]	; Are we smaller?
8754
		jb		nextAddr93		; Yes, go to the next address
8755
		cmp	cx, [edi+2]	; Are we bigger?
8756
		jbe	callRoutine93
8757
 
8758
nextAddr93:
8759
		add	edi, 0ch		; Next structure!
8760
		jmp	short checkLoop93
8761
 
8762
callRoutine93:
8763
		mov	dx, cx	; Get our address
8764
		call	ReadIOByte	; Standard read routine
8765
		mov	dl, al	; Put it in DL for later consumption
8766
		mov	ax, [_z80af]	; Get our AF back
8767
		jmp	short readExit93
8768
 
8769
ioRead93:
8770
		mov	dl, 0ffh	; An unreferenced read
8771
readExit93:
8772
		mov	edi, [cyclesRemaining]
8773
		pop	cx	; Restore BC
8774
		mov	[cyclesRemaining], edi
8775
		mov	[_z80af], ax	; Store AF
8776
		mov	al, dl	; And our data to write
8777
		mov	edi, [_z80MemWrite]	; Point to the write array
8778
 
8779
checkLoop94:
8780
		cmp	[edi], word 0ffffh ; End of our list?
8781
		je	memoryWrite94	; Yes - go write it!
8782
		cmp	bx, [edi]	; Are we smaller?
8783
		jb	nextAddr94	; Yes... go to the next addr
8784
		cmp	bx, [edi+4]	; Are we smaller?
8785
		jbe	callRoutine94	; If not, go call it!
8786
 
8787
nextAddr94:
8788
		add	edi, 10h		; Next structure, please
8789
		jmp	short checkLoop94
8790
 
8791
callRoutine94:
8792
		mov	dx, bx	; Get our address to target
8793
		call	WriteMemoryByte	; Go write the data!
8794
		jmp	short WriteMacroExit94
8795
memoryWrite94:
8796
		mov	[ebp + ebx], dl
8797
		mov	ax, [_z80af] ; Get our accumulator and flags
8798
WriteMacroExit94:
8799
		mov	edi, [cyclesRemaining]
8800
		inc	bx	; Increment HL
8801
		dec	ch	; Decrement B (of C)
8802
finalExit92:
8803
		jnz	clearFlag92
8804
		or	ah, 040h	; Set the Zero flag!
8805
		jmp	short continue92
8806
clearFlag92:
8807
		and	ah, 0bfh	; Clear the zero flag
8808
continue92:
8809
		or	ah, 02h	; Set negative!
8810
		xor	edx, edx
8811
		sub	edi, byte 16
8812
		js	near noMoreExec
8813
		mov	dl, byte [esi]	; Get our next instruction
8814
		inc	esi		; Increment PC
8815
		jmp	dword [z80regular+edx*4]
8816
 
8817
 
8818
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8819
 
8820
EDInsta3:
8821
		mov	[cyclesRemaining], edi
8822
		mov	edi, [_z80MemRead]	; Point to the read array
8823
 
8824
checkLoop96:
8825
		cmp	[edi], word 0ffffh ; End of the list?
8826
		je		memoryRead96
8827
		cmp	ebx, [edi]	; Are we smaller?
8828
		jb		nextAddr96		; Yes, go to the next address
8829
		cmp	ebx, [edi+4]	; Are we bigger?
8830
		jbe	callRoutine96
8831
 
8832
nextAddr96:
8833
		add	edi, 10h		; Next structure!
8834
		jmp	short checkLoop96
8835
 
8836
callRoutine96:
8837
		mov	dx, bx	; Get our address
8838
		call	ReadMemoryByte	; Standard read routine
8839
		mov	dl, al	; Put our returned value here
8840
		mov	ax, [_z80af]	; Get our AF back
8841
		jmp	short readExit96
8842
 
8843
memoryRead96:
8844
		mov	dl, [ebp + ebx]	; Get our data
8845
 
8846
readExit96:
8847
		mov	edi, [cyclesRemaining]
8848
		push	cx	; Save BC
8849
		xor	ch, ch	; No 16 bit for this instruction!
8850
		mov	[cyclesRemaining], edi
8851
		mov	[_z80af], ax	; Store AF
8852
		mov	al, dl	; And our data to write
8853
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
8854
 
8855
checkLoop97:
8856
		cmp	[edi], word 0ffffh ; End of our list?
8857
		je	WriteMacroExit97	; Yes - ignore it!
8858
		cmp	cx, [edi]	; Are we smaller?
8859
		jb	nextAddr97	; Yes... go to the next addr
8860
		cmp	cx, [edi+2]	; Are we bigger?
8861
		jbe	callRoutine97	; If not, go call it!
8862
 
8863
nextAddr97:
8864
		add	edi, 0ch		; Next structure, please
8865
		jmp	short checkLoop97
8866
 
8867
callRoutine97:
8868
		mov	dx, cx	; Get our address to target
8869
		call	WriteIOByte	; Go write the data!
8870
WriteMacroExit97:
8871
		mov	edi, [cyclesRemaining]
8872
		pop	cx	; Restore BC now that it has been "OUT"ed
8873
		inc	bx	; Increment HL
8874
		dec	ch	; Decrement B (of C)
8875
finalExit95:
8876
		jnz	clearFlag95
8877
		or	ah, 040h	; Set the Zero flag!
8878
		jmp	short continue95
8879
clearFlag95:
8880
		and	ah, 0bfh	; Clear the zero flag
8881
continue95:
8882
		or	ah, 02h	; Set negative!
8883
		xor	edx, edx
8884
		sub	edi, byte 16
8885
		js	near noMoreExec
8886
		mov	dl, byte [esi]	; Get our next instruction
8887
		inc	esi		; Increment PC
8888
		jmp	dword [z80regular+edx*4]
8889
 
8890
 
8891
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8892
 
8893
EDInsta8:
8894
		mov	[cyclesRemaining], edi
8895
		mov	edi, [_z80MemRead]	; Point to the read array
8896
 
8897
checkLoop98:
8898
		cmp	[edi], word 0ffffh ; End of the list?
8899
		je		memoryRead98
8900
		cmp	ebx, [edi]	; Are we smaller?
8901
		jb		nextAddr98		; Yes, go to the next address
8902
		cmp	ebx, [edi+4]	; Are we bigger?
8903
		jbe	callRoutine98
8904
 
8905
nextAddr98:
8906
		add	edi, 10h		; Next structure!
8907
		jmp	short checkLoop98
8908
 
8909
callRoutine98:
8910
		mov	dx, bx	; Get our address
8911
		call	ReadMemoryByte	; Standard read routine
8912
		mov	dl, al	; Put our returned value here
8913
		mov	ax, [_z80af]	; Get our AF back
8914
		jmp	short readExit98
8915
 
8916
memoryRead98:
8917
		mov	dl, [ebp + ebx]	; Get our data
8918
 
8919
readExit98:
8920
		mov	edi, [cyclesRemaining]
8921
		mov	[cyclesRemaining], edi
8922
		mov	[_z80af], ax	; Store AF
8923
		mov	al, dl	; And our data to write
8924
		mov	dx, [_z80de]
8925
		mov	edi, [_z80MemWrite]	; Point to the write array
8926
 
8927
checkLoop99:
8928
		cmp	[edi], word 0ffffh ; End of our list?
8929
		je	memoryWrite99	; Yes - go write it!
8930
		cmp	dx, [edi]	; Are we smaller?
8931
		jb	nextAddr99	; Yes... go to the next addr
8932
		cmp	dx, [edi+4]	; Are we smaller?
8933
		jbe	callRoutine99	; If not, go call it!
8934
 
8935
nextAddr99:
8936
		add	edi, 10h		; Next structure, please
8937
		jmp	short checkLoop99
8938
 
8939
callRoutine99:
8940
		call	WriteMemoryByte	; Go write the data!
8941
		jmp	short WriteMacroExit99
8942
memoryWrite99:
8943
		mov	[ebp + edx], al
8944
		mov	ax, [_z80af] ; Get our accumulator and flags
8945
WriteMacroExit99:
8946
		mov	edi, [cyclesRemaining]
8947
		dec	bx	; Decrement HL
8948
		dec	word [_z80de]	; Decrement DE
8949
		dec	cx	; Decrement BC
8950
		and	ah, 0e9h ; Knock out H & N and P/V
8951
		or		cx, cx	; Flag BC
8952
		jz	atZero100 ; We're done!
8953
		or	ah, 04h	; Non-zero - we're still going!
8954
atZero100:
8955
		xor	edx, edx	; Make sure we don't hose things
8956
		sub	edi, byte 16
8957
		js	near noMoreExec
8958
		mov	dl, byte [esi]	; Get our next instruction
8959
		inc	esi		; Increment PC
8960
		jmp	dword [z80regular+edx*4]
8961
 
8962
 
8963
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
8964
 
8965
EDInsta9:
8966
		mov	[cyclesRemaining], edi
8967
		mov	edi, [_z80MemRead]	; Point to the read array
8968
 
8969
checkLoop101:
8970
		cmp	[edi], word 0ffffh ; End of the list?
8971
		je		memoryRead101
8972
		cmp	ebx, [edi]	; Are we smaller?
8973
		jb		nextAddr101		; Yes, go to the next address
8974
		cmp	ebx, [edi+4]	; Are we bigger?
8975
		jbe	callRoutine101
8976
 
8977
nextAddr101:
8978
		add	edi, 10h		; Next structure!
8979
		jmp	short checkLoop101
8980
 
8981
callRoutine101:
8982
		mov	dx, bx	; Get our address
8983
		call	ReadMemoryByte	; Standard read routine
8984
		mov	dl, al	; Put our returned value here
8985
		mov	ax, [_z80af]	; Get our AF back
8986
		jmp	short readExit101
8987
 
8988
memoryRead101:
8989
		mov	dl, [ebp + ebx]	; Get our data
8990
 
8991
readExit101:
8992
		mov	edi, [cyclesRemaining]
8993
		mov	byte [_z80af], ah
8994
		sahf
8995
		cmp	al, dl	; Do our comparison
8996
		lahf
8997
		and	ah, 0fah	; No P/V or carry!
8998
		dec	cx	; Dec BC
8999
		jz	notBcZero102
9000
		or	ah, 04h	; P/V set when BC not zero
9001
notBcZero102:
9002
		or	ah, 02h	; N Gets set when we do compares
9003
		mov	dl, byte [_z80af]
9004
		and	dl, 01h
9005
		or	ah, dl	; Preserve carry!
9006
		dec	bx	; Decrement!
9007
		xor	edx, edx
9008
		sub	edi, byte 16
9009
		js	near noMoreExec
9010
		mov	dl, byte [esi]	; Get our next instruction
9011
		inc	esi		; Increment PC
9012
		jmp	dword [z80regular+edx*4]
9013
 
9014
 
9015
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9016
 
9017
EDInstaa:
9018
		push	cx	; Save BC
9019
		xor	ch, ch ; We want 8 bit ports
9020
		mov	[cyclesRemaining], edi
9021
		mov	edi, [_z80IoRead]	; Point to the read array
9022
 
9023
checkLoop103:
9024
		cmp	[edi], word 0ffffh ; End of the list?
9025
		je		ioRead103
9026
		cmp	cx, [edi]	; Are we smaller?
9027
		jb		nextAddr103		; Yes, go to the next address
9028
		cmp	cx, [edi+2]	; Are we bigger?
9029
		jbe	callRoutine103
9030
 
9031
nextAddr103:
9032
		add	edi, 0ch		; Next structure!
9033
		jmp	short checkLoop103
9034
 
9035
callRoutine103:
9036
		mov	dx, cx	; Get our address
9037
		call	ReadIOByte	; Standard read routine
9038
		mov	dl, al	; Put it in DL for later consumption
9039
		mov	ax, [_z80af]	; Get our AF back
9040
		jmp	short readExit103
9041
 
9042
ioRead103:
9043
		mov	dl, 0ffh	; An unreferenced read
9044
readExit103:
9045
		mov	edi, [cyclesRemaining]
9046
		pop	cx	; Restore BC
9047
		mov	[cyclesRemaining], edi
9048
		mov	[_z80af], ax	; Store AF
9049
		mov	al, dl	; And our data to write
9050
		mov	edi, [_z80MemWrite]	; Point to the write array
9051
 
9052
checkLoop104:
9053
		cmp	[edi], word 0ffffh ; End of our list?
9054
		je	memoryWrite104	; Yes - go write it!
9055
		cmp	bx, [edi]	; Are we smaller?
9056
		jb	nextAddr104	; Yes... go to the next addr
9057
		cmp	bx, [edi+4]	; Are we smaller?
9058
		jbe	callRoutine104	; If not, go call it!
9059
 
9060
nextAddr104:
9061
		add	edi, 10h		; Next structure, please
9062
		jmp	short checkLoop104
9063
 
9064
callRoutine104:
9065
		mov	dx, bx	; Get our address to target
9066
		call	WriteMemoryByte	; Go write the data!
9067
		jmp	short WriteMacroExit104
9068
memoryWrite104:
9069
		mov	[ebp + ebx], dl
9070
		mov	ax, [_z80af] ; Get our accumulator and flags
9071
WriteMacroExit104:
9072
		mov	edi, [cyclesRemaining]
9073
		dec	bx	; Decrement HL
9074
		dec	ch	; Decrement B (of C)
9075
finalExit102:
9076
		jnz	clearFlag102
9077
		or	ah, 040h	; Set the Zero flag!
9078
		jmp	short continue102
9079
clearFlag102:
9080
		and	ah, 0bfh	; Clear the zero flag
9081
continue102:
9082
		or	ah, 02h	; Set negative!
9083
		xor	edx, edx
9084
		sub	edi, byte 16
9085
		js	near noMoreExec
9086
		mov	dl, byte [esi]	; Get our next instruction
9087
		inc	esi		; Increment PC
9088
		jmp	dword [z80regular+edx*4]
9089
 
9090
 
9091
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9092
 
9093
EDInstab:
9094
		mov	[cyclesRemaining], edi
9095
		mov	edi, [_z80MemRead]	; Point to the read array
9096
 
9097
checkLoop106:
9098
		cmp	[edi], word 0ffffh ; End of the list?
9099
		je		memoryRead106
9100
		cmp	ebx, [edi]	; Are we smaller?
9101
		jb		nextAddr106		; Yes, go to the next address
9102
		cmp	ebx, [edi+4]	; Are we bigger?
9103
		jbe	callRoutine106
9104
 
9105
nextAddr106:
9106
		add	edi, 10h		; Next structure!
9107
		jmp	short checkLoop106
9108
 
9109
callRoutine106:
9110
		mov	dx, bx	; Get our address
9111
		call	ReadMemoryByte	; Standard read routine
9112
		mov	dl, al	; Put our returned value here
9113
		mov	ax, [_z80af]	; Get our AF back
9114
		jmp	short readExit106
9115
 
9116
memoryRead106:
9117
		mov	dl, [ebp + ebx]	; Get our data
9118
 
9119
readExit106:
9120
		mov	edi, [cyclesRemaining]
9121
		push	cx	; Save BC
9122
		xor	ch, ch	; No 16 bit for this instruction!
9123
		mov	[cyclesRemaining], edi
9124
		mov	[_z80af], ax	; Store AF
9125
		mov	al, dl	; And our data to write
9126
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
9127
 
9128
checkLoop107:
9129
		cmp	[edi], word 0ffffh ; End of our list?
9130
		je	WriteMacroExit107	; Yes - ignore it!
9131
		cmp	cx, [edi]	; Are we smaller?
9132
		jb	nextAddr107	; Yes... go to the next addr
9133
		cmp	cx, [edi+2]	; Are we bigger?
9134
		jbe	callRoutine107	; If not, go call it!
9135
 
9136
nextAddr107:
9137
		add	edi, 0ch		; Next structure, please
9138
		jmp	short checkLoop107
9139
 
9140
callRoutine107:
9141
		mov	dx, cx	; Get our address to target
9142
		call	WriteIOByte	; Go write the data!
9143
WriteMacroExit107:
9144
		mov	edi, [cyclesRemaining]
9145
		pop	cx	; Restore BC now that it has been "OUT"ed
9146
		dec	bx	; Decrement HL
9147
		dec	ch	; Decrement B (of C)
9148
finalExit105:
9149
		jnz	clearFlag105
9150
		or	ah, 040h	; Set the Zero flag!
9151
		jmp	short continue105
9152
clearFlag105:
9153
		and	ah, 0bfh	; Clear the zero flag
9154
continue105:
9155
		or	ah, 02h	; Set negative!
9156
		xor	edx, edx
9157
		sub	edi, byte 16
9158
		js	near noMoreExec
9159
		mov	dl, byte [esi]	; Get our next instruction
9160
		inc	esi		; Increment PC
9161
		jmp	dword [z80regular+edx*4]
9162
 
9163
 
9164
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9165
 
9166
EDInstb0:
9167
ldRepeat108:
9168
		mov	[cyclesRemaining], edi
9169
		mov	edi, [_z80MemRead]	; Point to the read array
9170
 
9171
checkLoop108:
9172
		cmp	[edi], word 0ffffh ; End of the list?
9173
		je		memoryRead108
9174
		cmp	ebx, [edi]	; Are we smaller?
9175
		jb		nextAddr108		; Yes, go to the next address
9176
		cmp	ebx, [edi+4]	; Are we bigger?
9177
		jbe	callRoutine108
9178
 
9179
nextAddr108:
9180
		add	edi, 10h		; Next structure!
9181
		jmp	short checkLoop108
9182
 
9183
callRoutine108:
9184
		mov	dx, bx	; Get our address
9185
		call	ReadMemoryByte	; Standard read routine
9186
		mov	dl, al	; Put our returned value here
9187
		mov	ax, [_z80af]	; Get our AF back
9188
		jmp	short readExit108
9189
 
9190
memoryRead108:
9191
		mov	dl, [ebp + ebx]	; Get our data
9192
 
9193
readExit108:
9194
		mov	edi, [cyclesRemaining]
9195
		mov	[cyclesRemaining], edi
9196
		mov	[_z80af], ax	; Store AF
9197
		mov	al, dl	; And our data to write
9198
		mov	dx, [_z80de]
9199
		mov	edi, [_z80MemWrite]	; Point to the write array
9200
 
9201
checkLoop109:
9202
		cmp	[edi], word 0ffffh ; End of our list?
9203
		je	memoryWrite109	; Yes - go write it!
9204
		cmp	dx, [edi]	; Are we smaller?
9205
		jb	nextAddr109	; Yes... go to the next addr
9206
		cmp	dx, [edi+4]	; Are we smaller?
9207
		jbe	callRoutine109	; If not, go call it!
9208
 
9209
nextAddr109:
9210
		add	edi, 10h		; Next structure, please
9211
		jmp	short checkLoop109
9212
 
9213
callRoutine109:
9214
		call	WriteMemoryByte	; Go write the data!
9215
		jmp	short WriteMacroExit109
9216
memoryWrite109:
9217
		mov	[ebp + edx], al
9218
		mov	ax, [_z80af] ; Get our accumulator and flags
9219
WriteMacroExit109:
9220
		mov	edi, [cyclesRemaining]
9221
		inc	bx	; Increment HL
9222
		inc	word [_z80de]	; Increment DE
9223
		dec	cx	; Decrement BC
9224
		jz	noMore110
9225
		sub	edi, dword 16	; 16 T-States per iteration
9226
		js	noMore110
9227
		jmp	ldRepeat108 ; Loop until we're done!
9228
noMore110:
9229
		and	ah, 0e9h ; Knock out H & N and P/V
9230
		or		cx, cx	; Flag BC
9231
		jz	atZero110 ; We're done!
9232
		or	ah, 04h	; Non-zero - we're still going!
9233
		sub	esi, 2	; Adjust back to the beginning of the instruction
9234
		jmp	noMoreExec
9235
 
9236
atZero110:
9237
		xor	edx, edx	; Make sure we don't hose things
9238
		sub	edi, byte 16
9239
		js	near noMoreExec
9240
		mov	dl, byte [esi]	; Get our next instruction
9241
		inc	esi		; Increment PC
9242
		jmp	dword [z80regular+edx*4]
9243
 
9244
 
9245
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9246
 
9247
EDInstb1:
9248
cpRepeat111:
9249
		mov	[cyclesRemaining], edi
9250
		mov	edi, [_z80MemRead]	; Point to the read array
9251
 
9252
checkLoop112:
9253
		cmp	[edi], word 0ffffh ; End of the list?
9254
		je		memoryRead112
9255
		cmp	ebx, [edi]	; Are we smaller?
9256
		jb		nextAddr112		; Yes, go to the next address
9257
		cmp	ebx, [edi+4]	; Are we bigger?
9258
		jbe	callRoutine112
9259
 
9260
nextAddr112:
9261
		add	edi, 10h		; Next structure!
9262
		jmp	short checkLoop112
9263
 
9264
callRoutine112:
9265
		mov	dx, bx	; Get our address
9266
		call	ReadMemoryByte	; Standard read routine
9267
		mov	dl, al	; Put our returned value here
9268
		mov	ax, [_z80af]	; Get our AF back
9269
		jmp	short readExit112
9270
 
9271
memoryRead112:
9272
		mov	dl, [ebp + ebx]	; Get our data
9273
 
9274
readExit112:
9275
		mov	edi, [cyclesRemaining]
9276
		mov	byte [_z80af], ah
9277
		sahf
9278
		cmp	al, dl	; Do our comparison
9279
		lahf
9280
		and	ah, 0fah	; No P/V or carry!
9281
		dec	cx	; Dec BC
9282
		jz	notBcZero113
9283
		or	ah, 04h	; P/V set when BC not zero
9284
notBcZero113:
9285
		or	ah, 02h	; N Gets set when we do compares
9286
		mov	dl, byte [_z80af]
9287
		and	dl, 01h
9288
		or	ah, dl	; Preserve carry!
9289
		inc	bx	; Increment!
9290
		sahf
9291
		jz	BCDone111
9292
		jnp	BCDone111
9293
		sub	edi, dword 21
9294
		js		BCDoneExit111
9295
		jmp	cpRepeat111
9296
BCDoneExit111:
9297
		sub	esi, 2	;	Back up to the instruction again
9298
		jmp	noMoreExec
9299
 
9300
BCDone111:
9301
		xor	edx, edx
9302
		sub	edi, byte 16
9303
		js	near noMoreExec
9304
		mov	dl, byte [esi]	; Get our next instruction
9305
		inc	esi		; Increment PC
9306
		jmp	dword [z80regular+edx*4]
9307
 
9308
 
9309
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9310
 
9311
EDInstb2:
9312
loopIt113:
9313
		push	cx	; Save BC
9314
		xor	ch, ch ; We want 8 bit ports
9315
		mov	[cyclesRemaining], edi
9316
		mov	edi, [_z80IoRead]	; Point to the read array
9317
 
9318
checkLoop114:
9319
		cmp	[edi], word 0ffffh ; End of the list?
9320
		je		ioRead114
9321
		cmp	cx, [edi]	; Are we smaller?
9322
		jb		nextAddr114		; Yes, go to the next address
9323
		cmp	cx, [edi+2]	; Are we bigger?
9324
		jbe	callRoutine114
9325
 
9326
nextAddr114:
9327
		add	edi, 0ch		; Next structure!
9328
		jmp	short checkLoop114
9329
 
9330
callRoutine114:
9331
		mov	dx, cx	; Get our address
9332
		call	ReadIOByte	; Standard read routine
9333
		mov	dl, al	; Put it in DL for later consumption
9334
		mov	ax, [_z80af]	; Get our AF back
9335
		jmp	short readExit114
9336
 
9337
ioRead114:
9338
		mov	dl, 0ffh	; An unreferenced read
9339
readExit114:
9340
		mov	edi, [cyclesRemaining]
9341
		pop	cx	; Restore BC
9342
		mov	[cyclesRemaining], edi
9343
		mov	[_z80af], ax	; Store AF
9344
		mov	al, dl	; And our data to write
9345
		mov	edi, [_z80MemWrite]	; Point to the write array
9346
 
9347
checkLoop115:
9348
		cmp	[edi], word 0ffffh ; End of our list?
9349
		je	memoryWrite115	; Yes - go write it!
9350
		cmp	bx, [edi]	; Are we smaller?
9351
		jb	nextAddr115	; Yes... go to the next addr
9352
		cmp	bx, [edi+4]	; Are we smaller?
9353
		jbe	callRoutine115	; If not, go call it!
9354
 
9355
nextAddr115:
9356
		add	edi, 10h		; Next structure, please
9357
		jmp	short checkLoop115
9358
 
9359
callRoutine115:
9360
		mov	dx, bx	; Get our address to target
9361
		call	WriteMemoryByte	; Go write the data!
9362
		jmp	short WriteMacroExit115
9363
memoryWrite115:
9364
		mov	[ebp + ebx], dl
9365
		mov	ax, [_z80af] ; Get our accumulator and flags
9366
WriteMacroExit115:
9367
		mov	edi, [cyclesRemaining]
9368
		inc	bx	; Increment HL
9369
		dec	ch	; Decrement B (of C)
9370
		jz	near finalExit113
9371
		sub	edi, dword 21
9372
		js		loopExit113
9373
		jmp	loopIt113
9374
 
9375
loopExit113:
9376
		sub	esi, 2
9377
		jmp	noMoreExec
9378
 
9379
finalExit113:
9380
		jnz	clearFlag113
9381
		or	ah, 040h	; Set the Zero flag!
9382
		jmp	short continue113
9383
clearFlag113:
9384
		and	ah, 0bfh	; Clear the zero flag
9385
continue113:
9386
		or	ah, 02h	; Set negative!
9387
		xor	edx, edx
9388
		sub	edi, byte 16
9389
		js	near noMoreExec
9390
		mov	dl, byte [esi]	; Get our next instruction
9391
		inc	esi		; Increment PC
9392
		jmp	dword [z80regular+edx*4]
9393
 
9394
 
9395
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9396
 
9397
EDInstb3:
9398
loopIt116:
9399
		mov	[cyclesRemaining], edi
9400
		mov	edi, [_z80MemRead]	; Point to the read array
9401
 
9402
checkLoop117:
9403
		cmp	[edi], word 0ffffh ; End of the list?
9404
		je		memoryRead117
9405
		cmp	ebx, [edi]	; Are we smaller?
9406
		jb		nextAddr117		; Yes, go to the next address
9407
		cmp	ebx, [edi+4]	; Are we bigger?
9408
		jbe	callRoutine117
9409
 
9410
nextAddr117:
9411
		add	edi, 10h		; Next structure!
9412
		jmp	short checkLoop117
9413
 
9414
callRoutine117:
9415
		mov	dx, bx	; Get our address
9416
		call	ReadMemoryByte	; Standard read routine
9417
		mov	dl, al	; Put our returned value here
9418
		mov	ax, [_z80af]	; Get our AF back
9419
		jmp	short readExit117
9420
 
9421
memoryRead117:
9422
		mov	dl, [ebp + ebx]	; Get our data
9423
 
9424
readExit117:
9425
		mov	edi, [cyclesRemaining]
9426
		push	cx	; Save BC
9427
		xor	ch, ch	; No 16 bit for this instruction!
9428
		mov	[cyclesRemaining], edi
9429
		mov	[_z80af], ax	; Store AF
9430
		mov	al, dl	; And our data to write
9431
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
9432
 
9433
checkLoop118:
9434
		cmp	[edi], word 0ffffh ; End of our list?
9435
		je	WriteMacroExit118	; Yes - ignore it!
9436
		cmp	cx, [edi]	; Are we smaller?
9437
		jb	nextAddr118	; Yes... go to the next addr
9438
		cmp	cx, [edi+2]	; Are we bigger?
9439
		jbe	callRoutine118	; If not, go call it!
9440
 
9441
nextAddr118:
9442
		add	edi, 0ch		; Next structure, please
9443
		jmp	short checkLoop118
9444
 
9445
callRoutine118:
9446
		mov	dx, cx	; Get our address to target
9447
		call	WriteIOByte	; Go write the data!
9448
WriteMacroExit118:
9449
		mov	edi, [cyclesRemaining]
9450
		pop	cx	; Restore BC now that it has been "OUT"ed
9451
		inc	bx	; Increment HL
9452
		dec	ch	; Decrement B (of C)
9453
		jz	near finalExit116
9454
		sub	edi, dword 21
9455
		js		loopExit116
9456
		jmp	loopIt116
9457
 
9458
loopExit116:
9459
		sub	esi, 2
9460
		jmp	noMoreExec
9461
 
9462
finalExit116:
9463
		jnz	clearFlag116
9464
		or	ah, 040h	; Set the Zero flag!
9465
		jmp	short continue116
9466
clearFlag116:
9467
		and	ah, 0bfh	; Clear the zero flag
9468
continue116:
9469
		or	ah, 02h	; Set negative!
9470
		xor	edx, edx
9471
		sub	edi, byte 16
9472
		js	near noMoreExec
9473
		mov	dl, byte [esi]	; Get our next instruction
9474
		inc	esi		; Increment PC
9475
		jmp	dword [z80regular+edx*4]
9476
 
9477
 
9478
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9479
 
9480
EDInstb8:
9481
ldRepeat119:
9482
		mov	[cyclesRemaining], edi
9483
		mov	edi, [_z80MemRead]	; Point to the read array
9484
 
9485
checkLoop119:
9486
		cmp	[edi], word 0ffffh ; End of the list?
9487
		je		memoryRead119
9488
		cmp	ebx, [edi]	; Are we smaller?
9489
		jb		nextAddr119		; Yes, go to the next address
9490
		cmp	ebx, [edi+4]	; Are we bigger?
9491
		jbe	callRoutine119
9492
 
9493
nextAddr119:
9494
		add	edi, 10h		; Next structure!
9495
		jmp	short checkLoop119
9496
 
9497
callRoutine119:
9498
		mov	dx, bx	; Get our address
9499
		call	ReadMemoryByte	; Standard read routine
9500
		mov	dl, al	; Put our returned value here
9501
		mov	ax, [_z80af]	; Get our AF back
9502
		jmp	short readExit119
9503
 
9504
memoryRead119:
9505
		mov	dl, [ebp + ebx]	; Get our data
9506
 
9507
readExit119:
9508
		mov	edi, [cyclesRemaining]
9509
		mov	[cyclesRemaining], edi
9510
		mov	[_z80af], ax	; Store AF
9511
		mov	al, dl	; And our data to write
9512
		mov	dx, [_z80de]
9513
		mov	edi, [_z80MemWrite]	; Point to the write array
9514
 
9515
checkLoop120:
9516
		cmp	[edi], word 0ffffh ; End of our list?
9517
		je	memoryWrite120	; Yes - go write it!
9518
		cmp	dx, [edi]	; Are we smaller?
9519
		jb	nextAddr120	; Yes... go to the next addr
9520
		cmp	dx, [edi+4]	; Are we smaller?
9521
		jbe	callRoutine120	; If not, go call it!
9522
 
9523
nextAddr120:
9524
		add	edi, 10h		; Next structure, please
9525
		jmp	short checkLoop120
9526
 
9527
callRoutine120:
9528
		call	WriteMemoryByte	; Go write the data!
9529
		jmp	short WriteMacroExit120
9530
memoryWrite120:
9531
		mov	[ebp + edx], al
9532
		mov	ax, [_z80af] ; Get our accumulator and flags
9533
WriteMacroExit120:
9534
		mov	edi, [cyclesRemaining]
9535
		dec	bx	; Decrement HL
9536
		dec	word [_z80de]	; Decrement DE
9537
		dec	cx	; Decrement BC
9538
		jz	noMore121
9539
		sub	edi, dword 16	; 16 T-States per iteration
9540
		js	noMore121
9541
		jmp	ldRepeat119 ; Loop until we're done!
9542
noMore121:
9543
		and	ah, 0e9h ; Knock out H & N and P/V
9544
		or		cx, cx	; Flag BC
9545
		jz	atZero121 ; We're done!
9546
		or	ah, 04h	; Non-zero - we're still going!
9547
		sub	esi, 2	; Adjust back to the beginning of the instruction
9548
		jmp	noMoreExec
9549
 
9550
atZero121:
9551
		xor	edx, edx	; Make sure we don't hose things
9552
		sub	edi, byte 16
9553
		js	near noMoreExec
9554
		mov	dl, byte [esi]	; Get our next instruction
9555
		inc	esi		; Increment PC
9556
		jmp	dword [z80regular+edx*4]
9557
 
9558
 
9559
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9560
 
9561
EDInstb9:
9562
cpRepeat122:
9563
		mov	[cyclesRemaining], edi
9564
		mov	edi, [_z80MemRead]	; Point to the read array
9565
 
9566
checkLoop123:
9567
		cmp	[edi], word 0ffffh ; End of the list?
9568
		je		memoryRead123
9569
		cmp	ebx, [edi]	; Are we smaller?
9570
		jb		nextAddr123		; Yes, go to the next address
9571
		cmp	ebx, [edi+4]	; Are we bigger?
9572
		jbe	callRoutine123
9573
 
9574
nextAddr123:
9575
		add	edi, 10h		; Next structure!
9576
		jmp	short checkLoop123
9577
 
9578
callRoutine123:
9579
		mov	dx, bx	; Get our address
9580
		call	ReadMemoryByte	; Standard read routine
9581
		mov	dl, al	; Put our returned value here
9582
		mov	ax, [_z80af]	; Get our AF back
9583
		jmp	short readExit123
9584
 
9585
memoryRead123:
9586
		mov	dl, [ebp + ebx]	; Get our data
9587
 
9588
readExit123:
9589
		mov	edi, [cyclesRemaining]
9590
		mov	byte [_z80af], ah
9591
		sahf
9592
		cmp	al, dl	; Do our comparison
9593
		lahf
9594
		and	ah, 0fah	; No P/V or carry!
9595
		dec	cx	; Dec BC
9596
		jz	notBcZero124
9597
		or	ah, 04h	; P/V set when BC not zero
9598
notBcZero124:
9599
		or	ah, 02h	; N Gets set when we do compares
9600
		mov	dl, byte [_z80af]
9601
		and	dl, 01h
9602
		or	ah, dl	; Preserve carry!
9603
		dec	bx	; Decrement!
9604
		sahf
9605
		jz	BCDone122
9606
		jnp	BCDone122
9607
		sub	edi, dword 21
9608
		js		BCDoneExit122
9609
		jmp	cpRepeat122
9610
BCDoneExit122:
9611
		sub	esi, 2	;	Back up to the instruction again
9612
		jmp	noMoreExec
9613
 
9614
BCDone122:
9615
		xor	edx, edx
9616
		sub	edi, byte 16
9617
		js	near noMoreExec
9618
		mov	dl, byte [esi]	; Get our next instruction
9619
		inc	esi		; Increment PC
9620
		jmp	dword [z80regular+edx*4]
9621
 
9622
 
9623
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9624
 
9625
EDInstba:
9626
loopIt124:
9627
		push	cx	; Save BC
9628
		xor	ch, ch ; We want 8 bit ports
9629
		mov	[cyclesRemaining], edi
9630
		mov	edi, [_z80IoRead]	; Point to the read array
9631
 
9632
checkLoop125:
9633
		cmp	[edi], word 0ffffh ; End of the list?
9634
		je		ioRead125
9635
		cmp	cx, [edi]	; Are we smaller?
9636
		jb		nextAddr125		; Yes, go to the next address
9637
		cmp	cx, [edi+2]	; Are we bigger?
9638
		jbe	callRoutine125
9639
 
9640
nextAddr125:
9641
		add	edi, 0ch		; Next structure!
9642
		jmp	short checkLoop125
9643
 
9644
callRoutine125:
9645
		mov	dx, cx	; Get our address
9646
		call	ReadIOByte	; Standard read routine
9647
		mov	dl, al	; Put it in DL for later consumption
9648
		mov	ax, [_z80af]	; Get our AF back
9649
		jmp	short readExit125
9650
 
9651
ioRead125:
9652
		mov	dl, 0ffh	; An unreferenced read
9653
readExit125:
9654
		mov	edi, [cyclesRemaining]
9655
		pop	cx	; Restore BC
9656
		mov	[cyclesRemaining], edi
9657
		mov	[_z80af], ax	; Store AF
9658
		mov	al, dl	; And our data to write
9659
		mov	edi, [_z80MemWrite]	; Point to the write array
9660
 
9661
checkLoop126:
9662
		cmp	[edi], word 0ffffh ; End of our list?
9663
		je	memoryWrite126	; Yes - go write it!
9664
		cmp	bx, [edi]	; Are we smaller?
9665
		jb	nextAddr126	; Yes... go to the next addr
9666
		cmp	bx, [edi+4]	; Are we smaller?
9667
		jbe	callRoutine126	; If not, go call it!
9668
 
9669
nextAddr126:
9670
		add	edi, 10h		; Next structure, please
9671
		jmp	short checkLoop126
9672
 
9673
callRoutine126:
9674
		mov	dx, bx	; Get our address to target
9675
		call	WriteMemoryByte	; Go write the data!
9676
		jmp	short WriteMacroExit126
9677
memoryWrite126:
9678
		mov	[ebp + ebx], dl
9679
		mov	ax, [_z80af] ; Get our accumulator and flags
9680
WriteMacroExit126:
9681
		mov	edi, [cyclesRemaining]
9682
		dec	bx	; Decrement HL
9683
		dec	ch	; Decrement B (of C)
9684
		jz	near finalExit124
9685
		sub	edi, dword 21
9686
		js		loopExit124
9687
		jmp	loopIt124
9688
 
9689
loopExit124:
9690
		sub	esi, 2
9691
		jmp	noMoreExec
9692
 
9693
finalExit124:
9694
		jnz	clearFlag124
9695
		or	ah, 040h	; Set the Zero flag!
9696
		jmp	short continue124
9697
clearFlag124:
9698
		and	ah, 0bfh	; Clear the zero flag
9699
continue124:
9700
		or	ah, 02h	; Set negative!
9701
		xor	edx, edx
9702
		sub	edi, byte 16
9703
		js	near noMoreExec
9704
		mov	dl, byte [esi]	; Get our next instruction
9705
		inc	esi		; Increment PC
9706
		jmp	dword [z80regular+edx*4]
9707
 
9708
 
9709
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9710
 
9711
EDInstbb:
9712
loopIt127:
9713
		mov	[cyclesRemaining], edi
9714
		mov	edi, [_z80MemRead]	; Point to the read array
9715
 
9716
checkLoop128:
9717
		cmp	[edi], word 0ffffh ; End of the list?
9718
		je		memoryRead128
9719
		cmp	ebx, [edi]	; Are we smaller?
9720
		jb		nextAddr128		; Yes, go to the next address
9721
		cmp	ebx, [edi+4]	; Are we bigger?
9722
		jbe	callRoutine128
9723
 
9724
nextAddr128:
9725
		add	edi, 10h		; Next structure!
9726
		jmp	short checkLoop128
9727
 
9728
callRoutine128:
9729
		mov	dx, bx	; Get our address
9730
		call	ReadMemoryByte	; Standard read routine
9731
		mov	dl, al	; Put our returned value here
9732
		mov	ax, [_z80af]	; Get our AF back
9733
		jmp	short readExit128
9734
 
9735
memoryRead128:
9736
		mov	dl, [ebp + ebx]	; Get our data
9737
 
9738
readExit128:
9739
		mov	edi, [cyclesRemaining]
9740
		push	cx	; Save BC
9741
		xor	ch, ch	; No 16 bit for this instruction!
9742
		mov	[cyclesRemaining], edi
9743
		mov	[_z80af], ax	; Store AF
9744
		mov	al, dl	; And our data to write
9745
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
9746
 
9747
checkLoop129:
9748
		cmp	[edi], word 0ffffh ; End of our list?
9749
		je	WriteMacroExit129	; Yes - ignore it!
9750
		cmp	cx, [edi]	; Are we smaller?
9751
		jb	nextAddr129	; Yes... go to the next addr
9752
		cmp	cx, [edi+2]	; Are we bigger?
9753
		jbe	callRoutine129	; If not, go call it!
9754
 
9755
nextAddr129:
9756
		add	edi, 0ch		; Next structure, please
9757
		jmp	short checkLoop129
9758
 
9759
callRoutine129:
9760
		mov	dx, cx	; Get our address to target
9761
		call	WriteIOByte	; Go write the data!
9762
WriteMacroExit129:
9763
		mov	edi, [cyclesRemaining]
9764
		pop	cx	; Restore BC now that it has been "OUT"ed
9765
		dec	bx	; Decrement HL
9766
		dec	ch	; Decrement B (of C)
9767
		jz	near finalExit127
9768
		sub	edi, dword 21
9769
		js		loopExit127
9770
		jmp	loopIt127
9771
 
9772
loopExit127:
9773
		sub	esi, 2
9774
		jmp	noMoreExec
9775
 
9776
finalExit127:
9777
		jnz	clearFlag127
9778
		or	ah, 040h	; Set the Zero flag!
9779
		jmp	short continue127
9780
clearFlag127:
9781
		and	ah, 0bfh	; Clear the zero flag
9782
continue127:
9783
		or	ah, 02h	; Set negative!
9784
		xor	edx, edx
9785
		sub	edi, byte 16
9786
		js	near noMoreExec
9787
		mov	dl, byte [esi]	; Get our next instruction
9788
		inc	esi		; Increment PC
9789
		jmp	dword [z80regular+edx*4]
9790
 
9791
 
9792
 
9793
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9794
 
9795
DDInst09:
9796
		mov	dh, ah	; Get our flags
9797
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
9798
		mov	[cyclesRemaining], edi
9799
		mov	di, [_z80ix]	; Get our value
9800
		mov	[_orgval], di	; Store our original value
9801
		add	di, cx
9802
		lahf
9803
		mov	[_z80ix], di	; Store our register back
9804
		mov	di, [_orgval]	; Get original
9805
		xor	di, word [_z80ix] ; XOR It with our computed value
9806
		xor	di, cx
9807
		and	di, 1000h	; Just our half carry
9808
		or		dx, di	; Or in our flags
9809
		and	ah, 01h	; Just carry
9810
		or	ah, dh
9811
		mov	edi, [cyclesRemaining]
9812
		xor	edx, edx
9813
		sub	edi, byte 15
9814
		js	near noMoreExec
9815
		mov	dl, byte [esi]	; Get our next instruction
9816
		inc	esi		; Increment PC
9817
		jmp	dword [z80regular+edx*4]
9818
 
9819
 
9820
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9821
 
9822
DDInst19:
9823
		mov	dh, ah	; Get our flags
9824
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
9825
		mov	[cyclesRemaining], edi
9826
		mov	di, [_z80ix]	; Get our value
9827
		mov	[_orgval], di	; Store our original value
9828
		add	di, word [_z80de]
9829
		lahf
9830
		mov	[_z80ix], di	; Store our register back
9831
		mov	di, [_orgval]	; Get original
9832
		xor	di, word [_z80ix] ; XOR It with our computed value
9833
		xor	di, word [_z80de]
9834
		and	di, 1000h	; Just our half carry
9835
		or		dx, di	; Or in our flags
9836
		and	ah, 01h	; Just carry
9837
		or	ah, dh
9838
		mov	edi, [cyclesRemaining]
9839
		xor	edx, edx
9840
		sub	edi, byte 15
9841
		js	near noMoreExec
9842
		mov	dl, byte [esi]	; Get our next instruction
9843
		inc	esi		; Increment PC
9844
		jmp	dword [z80regular+edx*4]
9845
 
9846
 
9847
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9848
 
9849
DDInst21:
9850
		mov	dx, [esi]	; Get our word to load
9851
		add	esi, 2	; Advance past the word
9852
		mov	[_z80ix], dx ; Store our new value
9853
		xor	edx, edx
9854
		sub	edi, byte 14
9855
		js	near noMoreExec
9856
		mov	dl, byte [esi]	; Get our next instruction
9857
		inc	esi		; Increment PC
9858
		jmp	dword [z80regular+edx*4]
9859
 
9860
 
9861
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9862
 
9863
DDInst22:
9864
		mov	dx, [esi]	 ; Get our address to store
9865
		add	esi, 2
9866
		mov	[_orgval], dx
9867
		mov	dl, [_z80ix]
9868
		mov	[cyclesRemaining], edi
9869
		mov	[_z80af], ax	; Store AF
9870
		mov	al, dl	; And our data to write
9871
		mov	dx, [_orgval]
9872
		mov	edi, [_z80MemWrite]	; Point to the write array
9873
 
9874
checkLoop130:
9875
		cmp	[edi], word 0ffffh ; End of our list?
9876
		je	memoryWrite130	; Yes - go write it!
9877
		cmp	dx, [edi]	; Are we smaller?
9878
		jb	nextAddr130	; Yes... go to the next addr
9879
		cmp	dx, [edi+4]	; Are we smaller?
9880
		jbe	callRoutine130	; If not, go call it!
9881
 
9882
nextAddr130:
9883
		add	edi, 10h		; Next structure, please
9884
		jmp	short checkLoop130
9885
 
9886
callRoutine130:
9887
		call	WriteMemoryByte	; Go write the data!
9888
		jmp	short WriteMacroExit130
9889
memoryWrite130:
9890
		mov	[ebp + edx], al
9891
		mov	ax, [_z80af] ; Get our accumulator and flags
9892
WriteMacroExit130:
9893
		mov	edi, [cyclesRemaining]
9894
		inc	word [_orgval]
9895
		mov	dl, [_z80ix + 1]
9896
		mov	[cyclesRemaining], edi
9897
		mov	[_z80af], ax	; Store AF
9898
		mov	al, dl	; And our data to write
9899
		mov	dx, [_orgval]
9900
		mov	edi, [_z80MemWrite]	; Point to the write array
9901
 
9902
checkLoop131:
9903
		cmp	[edi], word 0ffffh ; End of our list?
9904
		je	memoryWrite131	; Yes - go write it!
9905
		cmp	dx, [edi]	; Are we smaller?
9906
		jb	nextAddr131	; Yes... go to the next addr
9907
		cmp	dx, [edi+4]	; Are we smaller?
9908
		jbe	callRoutine131	; If not, go call it!
9909
 
9910
nextAddr131:
9911
		add	edi, 10h		; Next structure, please
9912
		jmp	short checkLoop131
9913
 
9914
callRoutine131:
9915
		call	WriteMemoryByte	; Go write the data!
9916
		jmp	short WriteMacroExit131
9917
memoryWrite131:
9918
		mov	[ebp + edx], al
9919
		mov	ax, [_z80af] ; Get our accumulator and flags
9920
WriteMacroExit131:
9921
		mov	edi, [cyclesRemaining]
9922
		xor	edx, edx
9923
		sub	edi, byte 20
9924
		js	near noMoreExec
9925
		mov	dl, byte [esi]	; Get our next instruction
9926
		inc	esi		; Increment PC
9927
		jmp	dword [z80regular+edx*4]
9928
 
9929
 
9930
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9931
 
9932
DDInst23:
9933
		inc	word [_z80ix]	; Increment our mz80Index register
9934
		sub	edi, byte 10
9935
		js	near noMoreExec
9936
		mov	dl, byte [esi]	; Get our next instruction
9937
		inc	esi		; Increment PC
9938
		jmp	dword [z80regular+edx*4]
9939
 
9940
 
9941
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9942
 
9943
DDInst24:
9944
		sahf
9945
		inc	byte [_z80ix + 1]
9946
		lahf
9947
		seto	dl
9948
		and	ah, 0fbh	; Knock out parity/overflow
9949
		shl	dl, 2
9950
		or		ah, dl
9951
		and	ah, 0fdh	; Knock out N!
9952
		sub	edi, byte 9
9953
		js	near noMoreExec
9954
		mov	dl, byte [esi]	; Get our next instruction
9955
		inc	esi		; Increment PC
9956
		jmp	dword [z80regular+edx*4]
9957
 
9958
 
9959
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9960
 
9961
DDInst25:
9962
		sahf
9963
		dec	byte [_z80ix + 1]
9964
		lahf
9965
		seto	dl
9966
		and	ah, 0fbh	; Knock out parity/overflow
9967
		shl	dl, 2
9968
		or		ah, dl
9969
		or	ah, 02h	; Set negative!
9970
		sub	edi, byte 9
9971
		js	near noMoreExec
9972
		mov	dl, byte [esi]	; Get our next instruction
9973
		inc	esi		; Increment PC
9974
		jmp	dword [z80regular+edx*4]
9975
 
9976
 
9977
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9978
 
9979
DDInst26:
9980
		mov	dl, [esi]	; Get immediate byte to load
9981
		inc	esi	; Next byte
9982
		mov	byte [_z80ix + 1], dl
9983
		sub	edi, byte 9
9984
		js	near noMoreExec
9985
		mov	dl, byte [esi]	; Get our next instruction
9986
		inc	esi		; Increment PC
9987
		jmp	dword [z80regular+edx*4]
9988
 
9989
 
9990
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
9991
 
9992
DDInst29:
9993
		mov	dh, ah	; Get our flags
9994
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
9995
		mov	[cyclesRemaining], edi
9996
		mov	di, [_z80ix]	; Get our value
9997
		mov	[_orgval], di	; Store our original value
9998
		add	di, di
9999
		lahf
10000
		mov	[_z80ix], di	; Store our register back
10001
		mov	di, [_orgval]	; Get original
10002
		xor	di, word [_z80ix] ; XOR It with our computed value
10003
		xor	di, di
10004
		and	di, 1000h	; Just our half carry
10005
		or		dx, di	; Or in our flags
10006
		and	ah, 01h	; Just carry
10007
		or	ah, dh
10008
		mov	edi, [cyclesRemaining]
10009
		xor	edx, edx
10010
		sub	edi, byte 15
10011
		js	near noMoreExec
10012
		mov	dl, byte [esi]	; Get our next instruction
10013
		inc	esi		; Increment PC
10014
		jmp	dword [z80regular+edx*4]
10015
 
10016
 
10017
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10018
 
10019
DDInst2a:
10020
		mov	dx, [esi]	 ; Get our address to store
10021
		add	esi, 2
10022
		mov	[cyclesRemaining], edi
10023
		mov	edi, [_z80MemRead]	; Point to the read array
10024
 
10025
checkLoop132:
10026
		cmp	[edi], word 0ffffh ; End of the list?
10027
		je		memoryRead132
10028
		cmp	dx, [edi]	; Are we smaller?
10029
		jb		nextAddr132		; Yes, go to the next address
10030
		cmp	dx, [edi+4]	; Are we bigger?
10031
		jbe	callRoutine132
10032
 
10033
nextAddr132:
10034
		add	edi, 10h		; Next structure!
10035
		jmp	short checkLoop132
10036
 
10037
callRoutine132:
10038
		push	ax		; Save this for later
10039
		push	dx		; Save address
10040
		call	ReadMemoryByte	; Standard read routine
10041
		pop	dx		; Restore our address
10042
		inc	dx		; Next byte, please
10043
		push	ax		; Save returned byte
10044
		call	ReadMemoryByte	; Standard read routine
10045
		xchg	ah, al	; Swap for endian's sake
10046
		pop	dx	; Restore LSB
10047
		mov	dh, ah	; Our word is now in DX
10048
		pop	ax		; Restore this
10049
		mov	[_z80ix], dx	; Store our word
10050
		jmp	readExit132
10051
 
10052
memoryRead132:
10053
		mov	dx, [ebp + edx]
10054
		mov	[_z80ix], dx
10055
readExit132:
10056
		mov	edi, [cyclesRemaining]
10057
		xor	edx, edx
10058
		sub	edi, byte 20
10059
		js	near noMoreExec
10060
		mov	dl, byte [esi]	; Get our next instruction
10061
		inc	esi		; Increment PC
10062
		jmp	dword [z80regular+edx*4]
10063
 
10064
 
10065
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10066
 
10067
DDInst2b:
10068
		dec	word [_z80ix]	; Increment our mz80Index register
10069
		sub	edi, byte 10
10070
		js	near noMoreExec
10071
		mov	dl, byte [esi]	; Get our next instruction
10072
		inc	esi		; Increment PC
10073
		jmp	dword [z80regular+edx*4]
10074
 
10075
 
10076
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10077
 
10078
DDInst2c:
10079
		sahf
10080
		inc	byte [_z80ix]
10081
		lahf
10082
		seto	dl
10083
		and	ah, 0fbh	; Knock out parity/overflow
10084
		shl	dl, 2
10085
		or		ah, dl
10086
		and	ah, 0fdh	; Knock out N!
10087
		sub	edi, byte 9
10088
		js	near noMoreExec
10089
		mov	dl, byte [esi]	; Get our next instruction
10090
		inc	esi		; Increment PC
10091
		jmp	dword [z80regular+edx*4]
10092
 
10093
 
10094
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10095
 
10096
DDInst2d:
10097
		sahf
10098
		dec	byte [_z80ix]
10099
		lahf
10100
		seto	dl
10101
		and	ah, 0fbh	; Knock out parity/overflow
10102
		shl	dl, 2
10103
		or		ah, dl
10104
		or	ah, 02h	; Set negative!
10105
		sub	edi, byte 9
10106
		js	near noMoreExec
10107
		mov	dl, byte [esi]	; Get our next instruction
10108
		inc	esi		; Increment PC
10109
		jmp	dword [z80regular+edx*4]
10110
 
10111
 
10112
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10113
 
10114
DDInst2e:
10115
		mov	dl, [esi]	; Get immediate byte to load
10116
		inc	esi	; Next byte
10117
		mov	byte [_z80ix], dl
10118
		sub	edi, byte 9
10119
		js	near noMoreExec
10120
		mov	dl, byte [esi]	; Get our next instruction
10121
		inc	esi		; Increment PC
10122
		jmp	dword [z80regular+edx*4]
10123
 
10124
 
10125
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10126
 
10127
DDInst34:
10128
		mov	dl, [esi]	; Fetch our offset
10129
		inc	esi		; Move past the offset
10130
		or	dl, dl		; Is this bad boy signed?
10131
		jns	notSigned133	; Nope!
10132
		dec	dh			; Make it FFable
10133
notSigned133:
10134
		add	dx, [_z80ix]	; Our offset!
10135
		mov	[_orgval], dx
10136
		mov	[cyclesRemaining], edi
10137
		mov	edi, [_z80MemRead]	; Point to the read array
10138
 
10139
checkLoop134:
10140
		cmp	[edi], word 0ffffh ; End of the list?
10141
		je		memoryRead134
10142
		cmp	edx, [edi]	; Are we smaller?
10143
		jb		nextAddr134		; Yes, go to the next address
10144
		cmp	edx, [edi+4]	; Are we bigger?
10145
		jbe	callRoutine134
10146
 
10147
nextAddr134:
10148
		add	edi, 10h		; Next structure!
10149
		jmp	short checkLoop134
10150
 
10151
callRoutine134:
10152
		call	ReadMemoryByte	; Standard read routine
10153
		mov	dl, al	; Put our returned value here
10154
		mov	ax, [_z80af]	; Get our AF back
10155
		jmp	short readExit134
10156
 
10157
memoryRead134:
10158
		mov	dl, [ebp + edx]	; Get our data
10159
 
10160
readExit134:
10161
		mov	edi, [cyclesRemaining]
10162
		sahf
10163
		inc	dl
10164
		lahf
10165
		o16	pushf
10166
		shl	edx, 16
10167
		and	ah, 0fbh	;	Knock out parity/overflow
10168
		pop	dx
10169
		and	dh, 08h ; Just the overflow
10170
		shr	dh, 1	; Shift it into position
10171
		or	ah, dh	; OR It in with the real flags
10172
		shr	edx, 16
10173
		and	ah, 0fdh	; Knock out N!
10174
		mov	[cyclesRemaining], edi
10175
		mov	[_z80af], ax	; Store AF
10176
		mov	al, dl	; And our data to write
10177
		mov	dx, [_orgval]
10178
		mov	edi, [_z80MemWrite]	; Point to the write array
10179
 
10180
checkLoop135:
10181
		cmp	[edi], word 0ffffh ; End of our list?
10182
		je	memoryWrite135	; Yes - go write it!
10183
		cmp	dx, [edi]	; Are we smaller?
10184
		jb	nextAddr135	; Yes... go to the next addr
10185
		cmp	dx, [edi+4]	; Are we smaller?
10186
		jbe	callRoutine135	; If not, go call it!
10187
 
10188
nextAddr135:
10189
		add	edi, 10h		; Next structure, please
10190
		jmp	short checkLoop135
10191
 
10192
callRoutine135:
10193
		call	WriteMemoryByte	; Go write the data!
10194
		jmp	short WriteMacroExit135
10195
memoryWrite135:
10196
		mov	[ebp + edx], al
10197
		mov	ax, [_z80af] ; Get our accumulator and flags
10198
WriteMacroExit135:
10199
		mov	edi, [cyclesRemaining]
10200
		xor	edx, edx
10201
		sub	edi, byte 23
10202
		js	near noMoreExec
10203
		mov	dl, byte [esi]	; Get our next instruction
10204
		inc	esi		; Increment PC
10205
		jmp	dword [z80regular+edx*4]
10206
 
10207
 
10208
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10209
 
10210
DDInst35:
10211
		mov	dl, [esi]	; Fetch our offset
10212
		inc	esi		; Move past the offset
10213
		or	dl, dl		; Is this bad boy signed?
10214
		jns	notSigned136	; Nope!
10215
		dec	dh			; Make it FFable
10216
notSigned136:
10217
		add	dx, [_z80ix]	; Our offset!
10218
		mov	[_orgval], dx
10219
		mov	[cyclesRemaining], edi
10220
		mov	edi, [_z80MemRead]	; Point to the read array
10221
 
10222
checkLoop137:
10223
		cmp	[edi], word 0ffffh ; End of the list?
10224
		je		memoryRead137
10225
		cmp	edx, [edi]	; Are we smaller?
10226
		jb		nextAddr137		; Yes, go to the next address
10227
		cmp	edx, [edi+4]	; Are we bigger?
10228
		jbe	callRoutine137
10229
 
10230
nextAddr137:
10231
		add	edi, 10h		; Next structure!
10232
		jmp	short checkLoop137
10233
 
10234
callRoutine137:
10235
		call	ReadMemoryByte	; Standard read routine
10236
		mov	dl, al	; Put our returned value here
10237
		mov	ax, [_z80af]	; Get our AF back
10238
		jmp	short readExit137
10239
 
10240
memoryRead137:
10241
		mov	dl, [ebp + edx]	; Get our data
10242
 
10243
readExit137:
10244
		mov	edi, [cyclesRemaining]
10245
		sahf
10246
		dec	dl
10247
		lahf
10248
		o16	pushf
10249
		shl	edx, 16
10250
		and	ah, 0fbh	;	Knock out parity/overflow
10251
		pop	dx
10252
		and	dh, 08h ; Just the overflow
10253
		shr	dh, 1	; Shift it into position
10254
		or	ah, dh	; OR It in with the real flags
10255
		shr	edx, 16
10256
		or		ah, 02h	; Make it N!
10257
		mov	[cyclesRemaining], edi
10258
		mov	[_z80af], ax	; Store AF
10259
		mov	al, dl	; And our data to write
10260
		mov	dx, [_orgval]
10261
		mov	edi, [_z80MemWrite]	; Point to the write array
10262
 
10263
checkLoop138:
10264
		cmp	[edi], word 0ffffh ; End of our list?
10265
		je	memoryWrite138	; Yes - go write it!
10266
		cmp	dx, [edi]	; Are we smaller?
10267
		jb	nextAddr138	; Yes... go to the next addr
10268
		cmp	dx, [edi+4]	; Are we smaller?
10269
		jbe	callRoutine138	; If not, go call it!
10270
 
10271
nextAddr138:
10272
		add	edi, 10h		; Next structure, please
10273
		jmp	short checkLoop138
10274
 
10275
callRoutine138:
10276
		call	WriteMemoryByte	; Go write the data!
10277
		jmp	short WriteMacroExit138
10278
memoryWrite138:
10279
		mov	[ebp + edx], al
10280
		mov	ax, [_z80af] ; Get our accumulator and flags
10281
WriteMacroExit138:
10282
		mov	edi, [cyclesRemaining]
10283
		xor	edx, edx
10284
		sub	edi, byte 23
10285
		js	near noMoreExec
10286
		mov	dl, byte [esi]	; Get our next instruction
10287
		inc	esi		; Increment PC
10288
		jmp	dword [z80regular+edx*4]
10289
 
10290
 
10291
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10292
 
10293
DDInst36:
10294
		mov	dx, [esi]	; Get our address
10295
		add	esi, 2	; Skip over our storage bytes
10296
		mov	[cyclesRemaining], edi
10297
		mov	di, dx	; Store it here for later
10298
		xor	dh, dh
10299
		or	dl, dl
10300
		jns	noNegate139
10301
		dec	dh
10302
noNegate139:
10303
		add	dx, [_z80ix]	; Add in our index
10304
		mov	[_orgval], dx	; Store our address to write to
10305
		mov	dx, di
10306
		xchg	dh, dl
10307
		mov	edi, [cyclesRemaining]
10308
		mov	[cyclesRemaining], edi
10309
		mov	[_z80af], ax	; Store AF
10310
		mov	al, dl	; And our data to write
10311
		mov	dx, [_orgval]
10312
		mov	edi, [_z80MemWrite]	; Point to the write array
10313
 
10314
checkLoop139:
10315
		cmp	[edi], word 0ffffh ; End of our list?
10316
		je	memoryWrite139	; Yes - go write it!
10317
		cmp	dx, [edi]	; Are we smaller?
10318
		jb	nextAddr139	; Yes... go to the next addr
10319
		cmp	dx, [edi+4]	; Are we smaller?
10320
		jbe	callRoutine139	; If not, go call it!
10321
 
10322
nextAddr139:
10323
		add	edi, 10h		; Next structure, please
10324
		jmp	short checkLoop139
10325
 
10326
callRoutine139:
10327
		call	WriteMemoryByte	; Go write the data!
10328
		jmp	short WriteMacroExit139
10329
memoryWrite139:
10330
		mov	[ebp + edx], al
10331
		mov	ax, [_z80af] ; Get our accumulator and flags
10332
WriteMacroExit139:
10333
		mov	edi, [cyclesRemaining]
10334
		xor	edx, edx
10335
		sub	edi, byte 19
10336
		js	near noMoreExec
10337
		mov	dl, byte [esi]	; Get our next instruction
10338
		inc	esi		; Increment PC
10339
		jmp	dword [z80regular+edx*4]
10340
 
10341
 
10342
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10343
 
10344
DDInst39:
10345
		mov	dh, ah	; Get our flags
10346
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
10347
		mov	[cyclesRemaining], edi
10348
		mov	di, [_z80ix]	; Get our value
10349
		mov	[_orgval], di	; Store our original value
10350
		add	di, word [_z80sp]
10351
		lahf
10352
		mov	[_z80ix], di	; Store our register back
10353
		mov	di, [_orgval]	; Get original
10354
		xor	di, word [_z80ix] ; XOR It with our computed value
10355
		xor	di, word [_z80sp]
10356
		and	di, 1000h	; Just our half carry
10357
		or		dx, di	; Or in our flags
10358
		and	ah, 01h	; Just carry
10359
		or	ah, dh
10360
		mov	edi, [cyclesRemaining]
10361
		xor	edx, edx
10362
		sub	edi, byte 15
10363
		js	near noMoreExec
10364
		mov	dl, byte [esi]	; Get our next instruction
10365
		inc	esi		; Increment PC
10366
		jmp	dword [z80regular+edx*4]
10367
 
10368
 
10369
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10370
 
10371
DDInst44:
10372
		mov	ch, byte [_z80ix + 1]
10373
		xor	edx, edx
10374
		sub	edi, byte 9
10375
		js	near noMoreExec
10376
		mov	dl, byte [esi]	; Get our next instruction
10377
		inc	esi		; Increment PC
10378
		jmp	dword [z80regular+edx*4]
10379
 
10380
 
10381
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10382
 
10383
DDInst45:
10384
		mov	ch, byte [_z80ix + 0]
10385
		xor	edx, edx
10386
		sub	edi, byte 9
10387
		js	near noMoreExec
10388
		mov	dl, byte [esi]	; Get our next instruction
10389
		inc	esi		; Increment PC
10390
		jmp	dword [z80regular+edx*4]
10391
 
10392
 
10393
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10394
 
10395
DDInst46:
10396
		mov	dl, [esi]	; Fetch our offset
10397
		inc	esi		; Move past the offset
10398
		or	dl, dl		; Is this bad boy signed?
10399
		jns	notSigned141	; Nope!
10400
		dec	dh			; Make it FFable
10401
notSigned141:
10402
		add	dx, [_z80ix]	; Our offset!
10403
		mov	[cyclesRemaining], edi
10404
		mov	edi, [_z80MemRead]	; Point to the read array
10405
 
10406
checkLoop142:
10407
		cmp	[edi], word 0ffffh ; End of the list?
10408
		je		memoryRead142
10409
		cmp	edx, [edi]	; Are we smaller?
10410
		jb		nextAddr142		; Yes, go to the next address
10411
		cmp	edx, [edi+4]	; Are we bigger?
10412
		jbe	callRoutine142
10413
 
10414
nextAddr142:
10415
		add	edi, 10h		; Next structure!
10416
		jmp	short checkLoop142
10417
 
10418
callRoutine142:
10419
		call	ReadMemoryByte	; Standard read routine
10420
		mov	ch, al	; Put our returned value here
10421
		mov	ax, [_z80af]	; Get our AF back
10422
		jmp	short readExit142
10423
 
10424
memoryRead142:
10425
		mov	ch, [ebp + edx]	; Get our data
10426
 
10427
readExit142:
10428
		mov	edi, [cyclesRemaining]
10429
		xor	edx, edx	; Make sure we don't hose things
10430
		sub	edi, byte 19
10431
		js	near noMoreExec
10432
		mov	dl, byte [esi]	; Get our next instruction
10433
		inc	esi		; Increment PC
10434
		jmp	dword [z80regular+edx*4]
10435
 
10436
 
10437
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10438
 
10439
DDInst4c:
10440
		mov	cl, byte [_z80ix + 1]
10441
		xor	edx, edx
10442
		sub	edi, byte 9
10443
		js	near noMoreExec
10444
		mov	dl, byte [esi]	; Get our next instruction
10445
		inc	esi		; Increment PC
10446
		jmp	dword [z80regular+edx*4]
10447
 
10448
 
10449
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10450
 
10451
DDInst4d:
10452
		mov	cl, byte [_z80ix + 0]
10453
		xor	edx, edx
10454
		sub	edi, byte 9
10455
		js	near noMoreExec
10456
		mov	dl, byte [esi]	; Get our next instruction
10457
		inc	esi		; Increment PC
10458
		jmp	dword [z80regular+edx*4]
10459
 
10460
 
10461
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10462
 
10463
DDInst4e:
10464
		mov	dl, [esi]	; Fetch our offset
10465
		inc	esi		; Move past the offset
10466
		or	dl, dl		; Is this bad boy signed?
10467
		jns	notSigned144	; Nope!
10468
		dec	dh			; Make it FFable
10469
notSigned144:
10470
		add	dx, [_z80ix]	; Our offset!
10471
		mov	[cyclesRemaining], edi
10472
		mov	edi, [_z80MemRead]	; Point to the read array
10473
 
10474
checkLoop145:
10475
		cmp	[edi], word 0ffffh ; End of the list?
10476
		je		memoryRead145
10477
		cmp	edx, [edi]	; Are we smaller?
10478
		jb		nextAddr145		; Yes, go to the next address
10479
		cmp	edx, [edi+4]	; Are we bigger?
10480
		jbe	callRoutine145
10481
 
10482
nextAddr145:
10483
		add	edi, 10h		; Next structure!
10484
		jmp	short checkLoop145
10485
 
10486
callRoutine145:
10487
		call	ReadMemoryByte	; Standard read routine
10488
		mov	cl, al	; Put our returned value here
10489
		mov	ax, [_z80af]	; Get our AF back
10490
		jmp	short readExit145
10491
 
10492
memoryRead145:
10493
		mov	cl, [ebp + edx]	; Get our data
10494
 
10495
readExit145:
10496
		mov	edi, [cyclesRemaining]
10497
		xor	edx, edx	; Make sure we don't hose things
10498
		sub	edi, byte 19
10499
		js	near noMoreExec
10500
		mov	dl, byte [esi]	; Get our next instruction
10501
		inc	esi		; Increment PC
10502
		jmp	dword [z80regular+edx*4]
10503
 
10504
 
10505
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10506
 
10507
DDInst54:
10508
		mov	dx, [_z80de]	; Get a usable copy of DE here
10509
		mov	dh, byte [_z80ix + 1]
10510
		mov	[_z80de], dx	; Put it back!
10511
		xor	edx, edx
10512
		sub	edi, byte 9
10513
		js	near noMoreExec
10514
		mov	dl, byte [esi]	; Get our next instruction
10515
		inc	esi		; Increment PC
10516
		jmp	dword [z80regular+edx*4]
10517
 
10518
 
10519
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10520
 
10521
DDInst55:
10522
		mov	dx, [_z80de]	; Get a usable copy of DE here
10523
		mov	dh, byte [_z80ix + 0]
10524
		mov	[_z80de], dx	; Put it back!
10525
		xor	edx, edx
10526
		sub	edi, byte 9
10527
		js	near noMoreExec
10528
		mov	dl, byte [esi]	; Get our next instruction
10529
		inc	esi		; Increment PC
10530
		jmp	dword [z80regular+edx*4]
10531
 
10532
 
10533
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10534
 
10535
DDInst56:
10536
		mov	dl, [esi]	; Fetch our offset
10537
		inc	esi		; Move past the offset
10538
		or	dl, dl		; Is this bad boy signed?
10539
		jns	notSigned147	; Nope!
10540
		dec	dh			; Make it FFable
10541
notSigned147:
10542
		add	dx, [_z80ix]	; Our offset!
10543
		mov	[cyclesRemaining], edi
10544
		mov	edi, [_z80MemRead]	; Point to the read array
10545
 
10546
checkLoop148:
10547
		cmp	[edi], word 0ffffh ; End of the list?
10548
		je		memoryRead148
10549
		cmp	edx, [edi]	; Are we smaller?
10550
		jb		nextAddr148		; Yes, go to the next address
10551
		cmp	edx, [edi+4]	; Are we bigger?
10552
		jbe	callRoutine148
10553
 
10554
nextAddr148:
10555
		add	edi, 10h		; Next structure!
10556
		jmp	short checkLoop148
10557
 
10558
callRoutine148:
10559
		call	ReadMemoryByte	; Standard read routine
10560
		mov	byte [_z80de + 1], al	; Put our returned value here
10561
		mov	ax, [_z80af]	; Get our AF back
10562
		jmp	short readExit148
10563
 
10564
memoryRead148:
10565
		mov	di, dx
10566
		mov	dl, [ebp + edx]
10567
		mov	byte [_z80de + 1], dl
10568
		mov	dx, di
10569
readExit148:
10570
		mov	edi, [cyclesRemaining]
10571
		xor	edx, edx	; Make sure we don't hose things
10572
		sub	edi, byte 19
10573
		js	near noMoreExec
10574
		mov	dl, byte [esi]	; Get our next instruction
10575
		inc	esi		; Increment PC
10576
		jmp	dword [z80regular+edx*4]
10577
 
10578
 
10579
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10580
 
10581
DDInst5c:
10582
		mov	dx, [_z80de]	; Get a usable copy of DE here
10583
		mov	dl, byte [_z80ix + 1]
10584
		mov	[_z80de], dx	; Put it back!
10585
		xor	edx, edx
10586
		sub	edi, byte 9
10587
		js	near noMoreExec
10588
		mov	dl, byte [esi]	; Get our next instruction
10589
		inc	esi		; Increment PC
10590
		jmp	dword [z80regular+edx*4]
10591
 
10592
 
10593
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10594
 
10595
DDInst5d:
10596
		mov	dx, [_z80de]	; Get a usable copy of DE here
10597
		mov	dl, byte [_z80ix + 0]
10598
		mov	[_z80de], dx	; Put it back!
10599
		xor	edx, edx
10600
		sub	edi, byte 9
10601
		js	near noMoreExec
10602
		mov	dl, byte [esi]	; Get our next instruction
10603
		inc	esi		; Increment PC
10604
		jmp	dword [z80regular+edx*4]
10605
 
10606
 
10607
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10608
 
10609
DDInst5e:
10610
		mov	dl, [esi]	; Fetch our offset
10611
		inc	esi		; Move past the offset
10612
		or	dl, dl		; Is this bad boy signed?
10613
		jns	notSigned150	; Nope!
10614
		dec	dh			; Make it FFable
10615
notSigned150:
10616
		add	dx, [_z80ix]	; Our offset!
10617
		mov	[cyclesRemaining], edi
10618
		mov	edi, [_z80MemRead]	; Point to the read array
10619
 
10620
checkLoop151:
10621
		cmp	[edi], word 0ffffh ; End of the list?
10622
		je		memoryRead151
10623
		cmp	edx, [edi]	; Are we smaller?
10624
		jb		nextAddr151		; Yes, go to the next address
10625
		cmp	edx, [edi+4]	; Are we bigger?
10626
		jbe	callRoutine151
10627
 
10628
nextAddr151:
10629
		add	edi, 10h		; Next structure!
10630
		jmp	short checkLoop151
10631
 
10632
callRoutine151:
10633
		call	ReadMemoryByte	; Standard read routine
10634
		mov	byte [_z80de], al	; Put our returned value here
10635
		mov	ax, [_z80af]	; Get our AF back
10636
		jmp	short readExit151
10637
 
10638
memoryRead151:
10639
		mov	di, dx
10640
		mov	dl, [ebp + edx]
10641
		mov	byte [_z80de], dl
10642
		mov	dx, di
10643
readExit151:
10644
		mov	edi, [cyclesRemaining]
10645
		xor	edx, edx	; Make sure we don't hose things
10646
		sub	edi, byte 19
10647
		js	near noMoreExec
10648
		mov	dl, byte [esi]	; Get our next instruction
10649
		inc	esi		; Increment PC
10650
		jmp	dword [z80regular+edx*4]
10651
 
10652
 
10653
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10654
 
10655
DDInst60:
10656
		mov   byte [_z80ix + 1], ch
10657
		xor	edx, edx
10658
		sub	edi, byte 9
10659
		js	near noMoreExec
10660
		mov	dl, byte [esi]	; Get our next instruction
10661
		inc	esi		; Increment PC
10662
		jmp	dword [z80regular+edx*4]
10663
 
10664
 
10665
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10666
 
10667
DDInst61:
10668
		mov   byte [_z80ix + 1], cl
10669
		xor	edx, edx
10670
		sub	edi, byte 9
10671
		js	near noMoreExec
10672
		mov	dl, byte [esi]	; Get our next instruction
10673
		inc	esi		; Increment PC
10674
		jmp	dword [z80regular+edx*4]
10675
 
10676
 
10677
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10678
 
10679
DDInst62:
10680
	mov	dx, [_z80de]	; Get DE
10681
		mov   byte [_z80ix + 1], dh
10682
		xor	edx, edx
10683
		sub	edi, byte 9
10684
		js	near noMoreExec
10685
		mov	dl, byte [esi]	; Get our next instruction
10686
		inc	esi		; Increment PC
10687
		jmp	dword [z80regular+edx*4]
10688
 
10689
 
10690
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10691
 
10692
DDInst63:
10693
	mov	dx, [_z80de]	; Get DE
10694
		mov   byte [_z80ix + 1], dl
10695
		xor	edx, edx
10696
		sub	edi, byte 9
10697
		js	near noMoreExec
10698
		mov	dl, byte [esi]	; Get our next instruction
10699
		inc	esi		; Increment PC
10700
		jmp	dword [z80regular+edx*4]
10701
 
10702
 
10703
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10704
 
10705
DDInst64:
10706
	mov	dh, byte [_z80ix + 1]
10707
		mov   byte [_z80ix + 1], bh
10708
		xor	edx, edx
10709
		sub	edi, byte 9
10710
		js	near noMoreExec
10711
		mov	dl, byte [esi]	; Get our next instruction
10712
		inc	esi		; Increment PC
10713
		jmp	dword [z80regular+edx*4]
10714
 
10715
 
10716
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10717
 
10718
DDInst65:
10719
	mov	dl, byte [_z80ix]
10720
		mov   byte [_z80ix + 1], bl
10721
		xor	edx, edx
10722
		sub	edi, byte 9
10723
		js	near noMoreExec
10724
		mov	dl, byte [esi]	; Get our next instruction
10725
		inc	esi		; Increment PC
10726
		jmp	dword [z80regular+edx*4]
10727
 
10728
 
10729
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10730
 
10731
DDInst66:
10732
		mov	dl, [esi]	; Fetch our offset
10733
		inc	esi		; Move past the offset
10734
		or	dl, dl		; Is this bad boy signed?
10735
		jns	notSigned153	; Nope!
10736
		dec	dh			; Make it FFable
10737
notSigned153:
10738
		add	dx, [_z80ix]	; Our offset!
10739
		mov	[cyclesRemaining], edi
10740
		mov	edi, [_z80MemRead]	; Point to the read array
10741
 
10742
checkLoop154:
10743
		cmp	[edi], word 0ffffh ; End of the list?
10744
		je		memoryRead154
10745
		cmp	edx, [edi]	; Are we smaller?
10746
		jb		nextAddr154		; Yes, go to the next address
10747
		cmp	edx, [edi+4]	; Are we bigger?
10748
		jbe	callRoutine154
10749
 
10750
nextAddr154:
10751
		add	edi, 10h		; Next structure!
10752
		jmp	short checkLoop154
10753
 
10754
callRoutine154:
10755
		call	ReadMemoryByte	; Standard read routine
10756
		mov	bh, al	; Put our returned value here
10757
		mov	ax, [_z80af]	; Get our AF back
10758
		jmp	short readExit154
10759
 
10760
memoryRead154:
10761
		mov	bh, [ebp + edx]	; Get our data
10762
 
10763
readExit154:
10764
		mov	edi, [cyclesRemaining]
10765
		xor	edx, edx	; Make sure we don't hose things
10766
		sub	edi, byte 19
10767
		js	near noMoreExec
10768
		mov	dl, byte [esi]	; Get our next instruction
10769
		inc	esi		; Increment PC
10770
		jmp	dword [z80regular+edx*4]
10771
 
10772
 
10773
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10774
 
10775
DDInst67:
10776
		mov   byte [_z80ix + 1], al
10777
		xor	edx, edx
10778
		sub	edi, byte 9
10779
		js	near noMoreExec
10780
		mov	dl, byte [esi]	; Get our next instruction
10781
		inc	esi		; Increment PC
10782
		jmp	dword [z80regular+edx*4]
10783
 
10784
 
10785
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10786
 
10787
DDInst68:
10788
		mov   byte [_z80ix + 0], ch
10789
		xor	edx, edx
10790
		sub	edi, byte 9
10791
		js	near noMoreExec
10792
		mov	dl, byte [esi]	; Get our next instruction
10793
		inc	esi		; Increment PC
10794
		jmp	dword [z80regular+edx*4]
10795
 
10796
 
10797
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10798
 
10799
DDInst69:
10800
		mov   byte [_z80ix + 0], cl
10801
		xor	edx, edx
10802
		sub	edi, byte 9
10803
		js	near noMoreExec
10804
		mov	dl, byte [esi]	; Get our next instruction
10805
		inc	esi		; Increment PC
10806
		jmp	dword [z80regular+edx*4]
10807
 
10808
 
10809
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10810
 
10811
DDInst6a:
10812
	mov	dx, [_z80de]	; Get DE
10813
		mov   byte [_z80ix + 0], dh
10814
		xor	edx, edx
10815
		sub	edi, byte 9
10816
		js	near noMoreExec
10817
		mov	dl, byte [esi]	; Get our next instruction
10818
		inc	esi		; Increment PC
10819
		jmp	dword [z80regular+edx*4]
10820
 
10821
 
10822
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10823
 
10824
DDInst6b:
10825
	mov	dx, [_z80de]	; Get DE
10826
		mov   byte [_z80ix + 0], dl
10827
		xor	edx, edx
10828
		sub	edi, byte 9
10829
		js	near noMoreExec
10830
		mov	dl, byte [esi]	; Get our next instruction
10831
		inc	esi		; Increment PC
10832
		jmp	dword [z80regular+edx*4]
10833
 
10834
 
10835
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10836
 
10837
DDInst6c:
10838
	mov	dh, byte [_z80ix + 1]
10839
		mov   byte [_z80ix + 0], bh
10840
		xor	edx, edx
10841
		sub	edi, byte 9
10842
		js	near noMoreExec
10843
		mov	dl, byte [esi]	; Get our next instruction
10844
		inc	esi		; Increment PC
10845
		jmp	dword [z80regular+edx*4]
10846
 
10847
 
10848
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10849
 
10850
DDInst6d:
10851
	mov	dl, byte [_z80ix]
10852
		mov   byte [_z80ix + 0], bl
10853
		xor	edx, edx
10854
		sub	edi, byte 9
10855
		js	near noMoreExec
10856
		mov	dl, byte [esi]	; Get our next instruction
10857
		inc	esi		; Increment PC
10858
		jmp	dword [z80regular+edx*4]
10859
 
10860
 
10861
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10862
 
10863
DDInst6e:
10864
		mov	dl, [esi]	; Fetch our offset
10865
		inc	esi		; Move past the offset
10866
		or	dl, dl		; Is this bad boy signed?
10867
		jns	notSigned156	; Nope!
10868
		dec	dh			; Make it FFable
10869
notSigned156:
10870
		add	dx, [_z80ix]	; Our offset!
10871
		mov	[cyclesRemaining], edi
10872
		mov	edi, [_z80MemRead]	; Point to the read array
10873
 
10874
checkLoop157:
10875
		cmp	[edi], word 0ffffh ; End of the list?
10876
		je		memoryRead157
10877
		cmp	edx, [edi]	; Are we smaller?
10878
		jb		nextAddr157		; Yes, go to the next address
10879
		cmp	edx, [edi+4]	; Are we bigger?
10880
		jbe	callRoutine157
10881
 
10882
nextAddr157:
10883
		add	edi, 10h		; Next structure!
10884
		jmp	short checkLoop157
10885
 
10886
callRoutine157:
10887
		call	ReadMemoryByte	; Standard read routine
10888
		mov	bl, al	; Put our returned value here
10889
		mov	ax, [_z80af]	; Get our AF back
10890
		jmp	short readExit157
10891
 
10892
memoryRead157:
10893
		mov	bl, [ebp + edx]	; Get our data
10894
 
10895
readExit157:
10896
		mov	edi, [cyclesRemaining]
10897
		xor	edx, edx	; Make sure we don't hose things
10898
		sub	edi, byte 19
10899
		js	near noMoreExec
10900
		mov	dl, byte [esi]	; Get our next instruction
10901
		inc	esi		; Increment PC
10902
		jmp	dword [z80regular+edx*4]
10903
 
10904
 
10905
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10906
 
10907
DDInst6f:
10908
		mov   byte [_z80ix + 0], al
10909
		xor	edx, edx
10910
		sub	edi, byte 9
10911
		js	near noMoreExec
10912
		mov	dl, byte [esi]	; Get our next instruction
10913
		inc	esi		; Increment PC
10914
		jmp	dword [z80regular+edx*4]
10915
 
10916
 
10917
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10918
 
10919
DDInst70:
10920
		mov	dl, [esi]	; Fetch our offset
10921
		inc	esi		; Move past the offset
10922
		or	dl, dl		; Is this bad boy signed?
10923
		jns	notSigned159	; Nope!
10924
		dec	dh			; Make it FFable
10925
notSigned159:
10926
		add	dx, [_z80ix]	; Our offset!
10927
		mov	[cyclesRemaining], edi
10928
		mov	[_z80af], ax	; Store AF
10929
		mov	al, ch	; And our data to write
10930
		mov	edi, [_z80MemWrite]	; Point to the write array
10931
 
10932
checkLoop160:
10933
		cmp	[edi], word 0ffffh ; End of our list?
10934
		je	memoryWrite160	; Yes - go write it!
10935
		cmp	dx, [edi]	; Are we smaller?
10936
		jb	nextAddr160	; Yes... go to the next addr
10937
		cmp	dx, [edi+4]	; Are we smaller?
10938
		jbe	callRoutine160	; If not, go call it!
10939
 
10940
nextAddr160:
10941
		add	edi, 10h		; Next structure, please
10942
		jmp	short checkLoop160
10943
 
10944
callRoutine160:
10945
		call	WriteMemoryByte	; Go write the data!
10946
		jmp	short WriteMacroExit160
10947
memoryWrite160:
10948
		mov	[ebp + edx], ch
10949
		mov	ax, [_z80af] ; Get our accumulator and flags
10950
WriteMacroExit160:
10951
		mov	edi, [cyclesRemaining]
10952
		xor	edx, edx
10953
		sub	edi, byte 19
10954
		js	near noMoreExec
10955
		mov	dl, byte [esi]	; Get our next instruction
10956
		inc	esi		; Increment PC
10957
		jmp	dword [z80regular+edx*4]
10958
 
10959
 
10960
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
10961
 
10962
DDInst71:
10963
		mov	dl, [esi]	; Fetch our offset
10964
		inc	esi		; Move past the offset
10965
		or	dl, dl		; Is this bad boy signed?
10966
		jns	notSigned161	; Nope!
10967
		dec	dh			; Make it FFable
10968
notSigned161:
10969
		add	dx, [_z80ix]	; Our offset!
10970
		mov	[cyclesRemaining], edi
10971
		mov	[_z80af], ax	; Store AF
10972
		mov	al, cl	; And our data to write
10973
		mov	edi, [_z80MemWrite]	; Point to the write array
10974
 
10975
checkLoop162:
10976
		cmp	[edi], word 0ffffh ; End of our list?
10977
		je	memoryWrite162	; Yes - go write it!
10978
		cmp	dx, [edi]	; Are we smaller?
10979
		jb	nextAddr162	; Yes... go to the next addr
10980
		cmp	dx, [edi+4]	; Are we smaller?
10981
		jbe	callRoutine162	; If not, go call it!
10982
 
10983
nextAddr162:
10984
		add	edi, 10h		; Next structure, please
10985
		jmp	short checkLoop162
10986
 
10987
callRoutine162:
10988
		call	WriteMemoryByte	; Go write the data!
10989
		jmp	short WriteMacroExit162
10990
memoryWrite162:
10991
		mov	[ebp + edx], cl
10992
		mov	ax, [_z80af] ; Get our accumulator and flags
10993
WriteMacroExit162:
10994
		mov	edi, [cyclesRemaining]
10995
		xor	edx, edx
10996
		sub	edi, byte 19
10997
		js	near noMoreExec
10998
		mov	dl, byte [esi]	; Get our next instruction
10999
		inc	esi		; Increment PC
11000
		jmp	dword [z80regular+edx*4]
11001
 
11002
 
11003
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11004
 
11005
DDInst72:
11006
		mov	dl, [esi]	; Fetch our offset
11007
		inc	esi		; Move past the offset
11008
		or	dl, dl		; Is this bad boy signed?
11009
		jns	notSigned163	; Nope!
11010
		dec	dh			; Make it FFable
11011
notSigned163:
11012
		add	dx, [_z80ix]	; Our offset!
11013
		mov	[cyclesRemaining], edi
11014
		mov	[_z80af], ax	; Store AF
11015
		mov	al, byte [_z80de + 1]	; And our data to write
11016
		mov	edi, [_z80MemWrite]	; Point to the write array
11017
 
11018
checkLoop164:
11019
		cmp	[edi], word 0ffffh ; End of our list?
11020
		je	memoryWrite164	; Yes - go write it!
11021
		cmp	dx, [edi]	; Are we smaller?
11022
		jb	nextAddr164	; Yes... go to the next addr
11023
		cmp	dx, [edi+4]	; Are we smaller?
11024
		jbe	callRoutine164	; If not, go call it!
11025
 
11026
nextAddr164:
11027
		add	edi, 10h		; Next structure, please
11028
		jmp	short checkLoop164
11029
 
11030
callRoutine164:
11031
		call	WriteMemoryByte	; Go write the data!
11032
		jmp	short WriteMacroExit164
11033
memoryWrite164:
11034
		mov	edi, edx
11035
		mov	dl, byte [_z80de + 1]
11036
		mov	[ebp + edi], dl
11037
		mov	edx, edi
11038
		mov	ax, [_z80af] ; Get our accumulator and flags
11039
WriteMacroExit164:
11040
		mov	edi, [cyclesRemaining]
11041
		xor	edx, edx
11042
		sub	edi, byte 19
11043
		js	near noMoreExec
11044
		mov	dl, byte [esi]	; Get our next instruction
11045
		inc	esi		; Increment PC
11046
		jmp	dword [z80regular+edx*4]
11047
 
11048
 
11049
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11050
 
11051
DDInst73:
11052
		mov	dl, [esi]	; Fetch our offset
11053
		inc	esi		; Move past the offset
11054
		or	dl, dl		; Is this bad boy signed?
11055
		jns	notSigned165	; Nope!
11056
		dec	dh			; Make it FFable
11057
notSigned165:
11058
		add	dx, [_z80ix]	; Our offset!
11059
		mov	[cyclesRemaining], edi
11060
		mov	[_z80af], ax	; Store AF
11061
		mov	al, byte [_z80de]	; And our data to write
11062
		mov	edi, [_z80MemWrite]	; Point to the write array
11063
 
11064
checkLoop166:
11065
		cmp	[edi], word 0ffffh ; End of our list?
11066
		je	memoryWrite166	; Yes - go write it!
11067
		cmp	dx, [edi]	; Are we smaller?
11068
		jb	nextAddr166	; Yes... go to the next addr
11069
		cmp	dx, [edi+4]	; Are we smaller?
11070
		jbe	callRoutine166	; If not, go call it!
11071
 
11072
nextAddr166:
11073
		add	edi, 10h		; Next structure, please
11074
		jmp	short checkLoop166
11075
 
11076
callRoutine166:
11077
		call	WriteMemoryByte	; Go write the data!
11078
		jmp	short WriteMacroExit166
11079
memoryWrite166:
11080
		mov	edi, edx
11081
		mov	dl, byte [_z80de]
11082
		mov	[ebp + edi], dl
11083
		mov	edx, edi
11084
		mov	ax, [_z80af] ; Get our accumulator and flags
11085
WriteMacroExit166:
11086
		mov	edi, [cyclesRemaining]
11087
		xor	edx, edx
11088
		sub	edi, byte 19
11089
		js	near noMoreExec
11090
		mov	dl, byte [esi]	; Get our next instruction
11091
		inc	esi		; Increment PC
11092
		jmp	dword [z80regular+edx*4]
11093
 
11094
 
11095
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11096
 
11097
DDInst74:
11098
		mov	dl, [esi]	; Fetch our offset
11099
		inc	esi		; Move past the offset
11100
		or	dl, dl		; Is this bad boy signed?
11101
		jns	notSigned167	; Nope!
11102
		dec	dh			; Make it FFable
11103
notSigned167:
11104
		add	dx, [_z80ix]	; Our offset!
11105
		mov	[cyclesRemaining], edi
11106
		mov	[_z80af], ax	; Store AF
11107
		mov	al, bh	; And our data to write
11108
		mov	edi, [_z80MemWrite]	; Point to the write array
11109
 
11110
checkLoop168:
11111
		cmp	[edi], word 0ffffh ; End of our list?
11112
		je	memoryWrite168	; Yes - go write it!
11113
		cmp	dx, [edi]	; Are we smaller?
11114
		jb	nextAddr168	; Yes... go to the next addr
11115
		cmp	dx, [edi+4]	; Are we smaller?
11116
		jbe	callRoutine168	; If not, go call it!
11117
 
11118
nextAddr168:
11119
		add	edi, 10h		; Next structure, please
11120
		jmp	short checkLoop168
11121
 
11122
callRoutine168:
11123
		call	WriteMemoryByte	; Go write the data!
11124
		jmp	short WriteMacroExit168
11125
memoryWrite168:
11126
		mov	[ebp + edx], bh
11127
		mov	ax, [_z80af] ; Get our accumulator and flags
11128
WriteMacroExit168:
11129
		mov	edi, [cyclesRemaining]
11130
		xor	edx, edx
11131
		sub	edi, byte 19
11132
		js	near noMoreExec
11133
		mov	dl, byte [esi]	; Get our next instruction
11134
		inc	esi		; Increment PC
11135
		jmp	dword [z80regular+edx*4]
11136
 
11137
 
11138
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11139
 
11140
DDInst75:
11141
		mov	dl, [esi]	; Fetch our offset
11142
		inc	esi		; Move past the offset
11143
		or	dl, dl		; Is this bad boy signed?
11144
		jns	notSigned169	; Nope!
11145
		dec	dh			; Make it FFable
11146
notSigned169:
11147
		add	dx, [_z80ix]	; Our offset!
11148
		mov	[cyclesRemaining], edi
11149
		mov	[_z80af], ax	; Store AF
11150
		mov	al, bl	; And our data to write
11151
		mov	edi, [_z80MemWrite]	; Point to the write array
11152
 
11153
checkLoop170:
11154
		cmp	[edi], word 0ffffh ; End of our list?
11155
		je	memoryWrite170	; Yes - go write it!
11156
		cmp	dx, [edi]	; Are we smaller?
11157
		jb	nextAddr170	; Yes... go to the next addr
11158
		cmp	dx, [edi+4]	; Are we smaller?
11159
		jbe	callRoutine170	; If not, go call it!
11160
 
11161
nextAddr170:
11162
		add	edi, 10h		; Next structure, please
11163
		jmp	short checkLoop170
11164
 
11165
callRoutine170:
11166
		call	WriteMemoryByte	; Go write the data!
11167
		jmp	short WriteMacroExit170
11168
memoryWrite170:
11169
		mov	[ebp + edx], bl
11170
		mov	ax, [_z80af] ; Get our accumulator and flags
11171
WriteMacroExit170:
11172
		mov	edi, [cyclesRemaining]
11173
		xor	edx, edx
11174
		sub	edi, byte 19
11175
		js	near noMoreExec
11176
		mov	dl, byte [esi]	; Get our next instruction
11177
		inc	esi		; Increment PC
11178
		jmp	dword [z80regular+edx*4]
11179
 
11180
 
11181
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11182
 
11183
DDInst77:
11184
		mov	dl, [esi]	; Fetch our offset
11185
		inc	esi		; Move past the offset
11186
		or	dl, dl		; Is this bad boy signed?
11187
		jns	notSigned171	; Nope!
11188
		dec	dh			; Make it FFable
11189
notSigned171:
11190
		add	dx, [_z80ix]	; Our offset!
11191
		mov	[cyclesRemaining], edi
11192
		mov	[_z80af], ax	; Store AF
11193
		mov	edi, [_z80MemWrite]	; Point to the write array
11194
 
11195
checkLoop172:
11196
		cmp	[edi], word 0ffffh ; End of our list?
11197
		je	memoryWrite172	; Yes - go write it!
11198
		cmp	dx, [edi]	; Are we smaller?
11199
		jb	nextAddr172	; Yes... go to the next addr
11200
		cmp	dx, [edi+4]	; Are we smaller?
11201
		jbe	callRoutine172	; If not, go call it!
11202
 
11203
nextAddr172:
11204
		add	edi, 10h		; Next structure, please
11205
		jmp	short checkLoop172
11206
 
11207
callRoutine172:
11208
		call	WriteMemoryByte	; Go write the data!
11209
		jmp	short WriteMacroExit172
11210
memoryWrite172:
11211
		mov	[ebp + edx], al
11212
		mov	ax, [_z80af] ; Get our accumulator and flags
11213
WriteMacroExit172:
11214
		mov	edi, [cyclesRemaining]
11215
		xor	edx, edx
11216
		sub	edi, byte 19
11217
		js	near noMoreExec
11218
		mov	dl, byte [esi]	; Get our next instruction
11219
		inc	esi		; Increment PC
11220
		jmp	dword [z80regular+edx*4]
11221
 
11222
 
11223
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11224
 
11225
DDInst7c:
11226
		mov	al, byte [_z80ix + 1]
11227
		xor	edx, edx
11228
		sub	edi, byte 9
11229
		js	near noMoreExec
11230
		mov	dl, byte [esi]	; Get our next instruction
11231
		inc	esi		; Increment PC
11232
		jmp	dword [z80regular+edx*4]
11233
 
11234
 
11235
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11236
 
11237
DDInst7d:
11238
		mov	al, byte [_z80ix + 0]
11239
		xor	edx, edx
11240
		sub	edi, byte 9
11241
		js	near noMoreExec
11242
		mov	dl, byte [esi]	; Get our next instruction
11243
		inc	esi		; Increment PC
11244
		jmp	dword [z80regular+edx*4]
11245
 
11246
 
11247
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11248
 
11249
DDInst7e:
11250
		mov	dl, [esi]	; Fetch our offset
11251
		inc	esi		; Move past the offset
11252
		or	dl, dl		; Is this bad boy signed?
11253
		jns	notSigned173	; Nope!
11254
		dec	dh			; Make it FFable
11255
notSigned173:
11256
		add	dx, [_z80ix]	; Our offset!
11257
		mov	[cyclesRemaining], edi
11258
		mov	edi, [_z80MemRead]	; Point to the read array
11259
 
11260
checkLoop174:
11261
		cmp	[edi], word 0ffffh ; End of the list?
11262
		je		memoryRead174
11263
		cmp	edx, [edi]	; Are we smaller?
11264
		jb		nextAddr174		; Yes, go to the next address
11265
		cmp	edx, [edi+4]	; Are we bigger?
11266
		jbe	callRoutine174
11267
 
11268
nextAddr174:
11269
		add	edi, 10h		; Next structure!
11270
		jmp	short checkLoop174
11271
 
11272
callRoutine174:
11273
		call	ReadMemoryByte	; Standard read routine
11274
		mov	[_z80af], al	; Save our new accumulator
11275
		mov	ax, [_z80af]	; Get our AF back
11276
		jmp	short readExit174
11277
 
11278
memoryRead174:
11279
		mov	al, [ebp + edx]	; Get our data
11280
 
11281
readExit174:
11282
		mov	edi, [cyclesRemaining]
11283
		xor	edx, edx	; Make sure we don't hose things
11284
		sub	edi, byte 19
11285
		js	near noMoreExec
11286
		mov	dl, byte [esi]	; Get our next instruction
11287
		inc	esi		; Increment PC
11288
		jmp	dword [z80regular+edx*4]
11289
 
11290
 
11291
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11292
 
11293
DDInst84:
11294
		mov	dl, byte [_z80ix + 1]
11295
		sahf		; Store our flags in x86 flag reg
11296
		add	al, dl
11297
		lahf		; Get flags back into AH
11298
		seto	dl
11299
		and	ah, 0fbh	; Knock out parity/overflow
11300
		shl	dl, 2
11301
		or		ah, dl
11302
		and	ah, 0fdh ; No N!
11303
		sub	edi, byte 9
11304
		js	near noMoreExec
11305
		mov	dl, byte [esi]	; Get our next instruction
11306
		inc	esi		; Increment PC
11307
		jmp	dword [z80regular+edx*4]
11308
 
11309
 
11310
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11311
 
11312
DDInst85:
11313
		mov	dl, byte [_z80ix]
11314
		sahf		; Store our flags in x86 flag reg
11315
		add	al, dl
11316
		lahf		; Get flags back into AH
11317
		seto	dl
11318
		and	ah, 0fbh	; Knock out parity/overflow
11319
		shl	dl, 2
11320
		or		ah, dl
11321
		and	ah, 0fdh ; No N!
11322
		sub	edi, byte 9
11323
		js	near noMoreExec
11324
		mov	dl, byte [esi]	; Get our next instruction
11325
		inc	esi		; Increment PC
11326
		jmp	dword [z80regular+edx*4]
11327
 
11328
 
11329
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11330
 
11331
DDInst86:
11332
		mov	dl, [esi]	; Fetch our offset
11333
		inc	esi		; Move past the offset
11334
		or	dl, dl		; Is this bad boy signed?
11335
		jns	notSigned176	; Nope!
11336
		dec	dh			; Make it FFable
11337
notSigned176:
11338
		add	dx, [_z80ix]	; Our offset!
11339
		mov	[cyclesRemaining], edi
11340
		mov	edi, [_z80MemRead]	; Point to the read array
11341
 
11342
checkLoop177:
11343
		cmp	[edi], word 0ffffh ; End of the list?
11344
		je		memoryRead177
11345
		cmp	edx, [edi]	; Are we smaller?
11346
		jb		nextAddr177		; Yes, go to the next address
11347
		cmp	edx, [edi+4]	; Are we bigger?
11348
		jbe	callRoutine177
11349
 
11350
nextAddr177:
11351
		add	edi, 10h		; Next structure!
11352
		jmp	short checkLoop177
11353
 
11354
callRoutine177:
11355
		call	ReadMemoryByte	; Standard read routine
11356
		mov	dl, al	; Put our returned value here
11357
		mov	ax, [_z80af]	; Get our AF back
11358
		jmp	short readExit177
11359
 
11360
memoryRead177:
11361
		mov	dl, [ebp + edx]	; Get our data
11362
 
11363
readExit177:
11364
		mov	edi, [cyclesRemaining]
11365
		sahf
11366
		add	al, dl
11367
		lahf
11368
		seto	dl
11369
		and	ah, 0fbh	; Knock out parity/overflow
11370
		shl	dl, 2
11371
		or		ah, dl
11372
		and	ah, 0fdh	; Knock out negative
11373
		xor	edx, edx
11374
		sub	edi, byte 19
11375
		js	near noMoreExec
11376
		mov	dl, byte [esi]	; Get our next instruction
11377
		inc	esi		; Increment PC
11378
		jmp	dword [z80regular+edx*4]
11379
 
11380
 
11381
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11382
 
11383
DDInst8c:
11384
		mov	dl, byte [_z80ix + 1]
11385
		sahf		; Store our flags in x86 flag reg
11386
		adc	al, dl
11387
		lahf		; Get flags back into AH
11388
		seto	dl
11389
		and	ah, 0fbh	; Knock out parity/overflow
11390
		shl	dl, 2
11391
		or		ah, dl
11392
		and	ah, 0fdh ; No N!
11393
		sub	edi, byte 9
11394
		js	near noMoreExec
11395
		mov	dl, byte [esi]	; Get our next instruction
11396
		inc	esi		; Increment PC
11397
		jmp	dword [z80regular+edx*4]
11398
 
11399
 
11400
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11401
 
11402
DDInst8d:
11403
		mov	dl, byte [_z80ix]
11404
		sahf		; Store our flags in x86 flag reg
11405
		adc	al, dl
11406
		lahf		; Get flags back into AH
11407
		seto	dl
11408
		and	ah, 0fbh	; Knock out parity/overflow
11409
		shl	dl, 2
11410
		or		ah, dl
11411
		and	ah, 0fdh ; No N!
11412
		sub	edi, byte 9
11413
		js	near noMoreExec
11414
		mov	dl, byte [esi]	; Get our next instruction
11415
		inc	esi		; Increment PC
11416
		jmp	dword [z80regular+edx*4]
11417
 
11418
 
11419
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11420
 
11421
DDInst8e:
11422
		mov	dl, [esi]	; Fetch our offset
11423
		inc	esi		; Move past the offset
11424
		or	dl, dl		; Is this bad boy signed?
11425
		jns	notSigned178	; Nope!
11426
		dec	dh			; Make it FFable
11427
notSigned178:
11428
		add	dx, [_z80ix]	; Our offset!
11429
		mov	[cyclesRemaining], edi
11430
		mov	edi, [_z80MemRead]	; Point to the read array
11431
 
11432
checkLoop179:
11433
		cmp	[edi], word 0ffffh ; End of the list?
11434
		je		memoryRead179
11435
		cmp	edx, [edi]	; Are we smaller?
11436
		jb		nextAddr179		; Yes, go to the next address
11437
		cmp	edx, [edi+4]	; Are we bigger?
11438
		jbe	callRoutine179
11439
 
11440
nextAddr179:
11441
		add	edi, 10h		; Next structure!
11442
		jmp	short checkLoop179
11443
 
11444
callRoutine179:
11445
		call	ReadMemoryByte	; Standard read routine
11446
		mov	dl, al	; Put our returned value here
11447
		mov	ax, [_z80af]	; Get our AF back
11448
		jmp	short readExit179
11449
 
11450
memoryRead179:
11451
		mov	dl, [ebp + edx]	; Get our data
11452
 
11453
readExit179:
11454
		mov	edi, [cyclesRemaining]
11455
		sahf
11456
		adc	al, dl
11457
		lahf
11458
		seto	dl
11459
		and	ah, 0fbh	; Knock out parity/overflow
11460
		shl	dl, 2
11461
		or		ah, dl
11462
		and	ah, 0fdh	; Knock out negative
11463
		xor	edx, edx
11464
		sub	edi, byte 19
11465
		js	near noMoreExec
11466
		mov	dl, byte [esi]	; Get our next instruction
11467
		inc	esi		; Increment PC
11468
		jmp	dword [z80regular+edx*4]
11469
 
11470
 
11471
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11472
 
11473
DDInst94:
11474
		mov	dl, byte [_z80ix + 1]
11475
		sahf		; Store our flags in x86 flag reg
11476
		sub	al, dl
11477
		lahf		; Get flags back into AH
11478
		seto	dl
11479
		and	ah, 0fbh	; Knock out parity/overflow
11480
		shl	dl, 2
11481
		or		ah, dl
11482
		or	ah, 02h	; N Gets set!
11483
		sub	edi, byte 9
11484
		js	near noMoreExec
11485
		mov	dl, byte [esi]	; Get our next instruction
11486
		inc	esi		; Increment PC
11487
		jmp	dword [z80regular+edx*4]
11488
 
11489
 
11490
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11491
 
11492
DDInst95:
11493
		mov	dl, byte [_z80ix]
11494
		sahf		; Store our flags in x86 flag reg
11495
		sub	al, dl
11496
		lahf		; Get flags back into AH
11497
		seto	dl
11498
		and	ah, 0fbh	; Knock out parity/overflow
11499
		shl	dl, 2
11500
		or		ah, dl
11501
		or	ah, 02h	; N Gets set!
11502
		sub	edi, byte 9
11503
		js	near noMoreExec
11504
		mov	dl, byte [esi]	; Get our next instruction
11505
		inc	esi		; Increment PC
11506
		jmp	dword [z80regular+edx*4]
11507
 
11508
 
11509
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11510
 
11511
DDInst96:
11512
		mov	dl, [esi]	; Fetch our offset
11513
		inc	esi		; Move past the offset
11514
		or	dl, dl		; Is this bad boy signed?
11515
		jns	notSigned180	; Nope!
11516
		dec	dh			; Make it FFable
11517
notSigned180:
11518
		add	dx, [_z80ix]	; Our offset!
11519
		mov	[cyclesRemaining], edi
11520
		mov	edi, [_z80MemRead]	; Point to the read array
11521
 
11522
checkLoop181:
11523
		cmp	[edi], word 0ffffh ; End of the list?
11524
		je		memoryRead181
11525
		cmp	edx, [edi]	; Are we smaller?
11526
		jb		nextAddr181		; Yes, go to the next address
11527
		cmp	edx, [edi+4]	; Are we bigger?
11528
		jbe	callRoutine181
11529
 
11530
nextAddr181:
11531
		add	edi, 10h		; Next structure!
11532
		jmp	short checkLoop181
11533
 
11534
callRoutine181:
11535
		call	ReadMemoryByte	; Standard read routine
11536
		mov	dl, al	; Put our returned value here
11537
		mov	ax, [_z80af]	; Get our AF back
11538
		jmp	short readExit181
11539
 
11540
memoryRead181:
11541
		mov	dl, [ebp + edx]	; Get our data
11542
 
11543
readExit181:
11544
		mov	edi, [cyclesRemaining]
11545
		sahf
11546
		sub	al, dl
11547
		lahf
11548
		seto	dl
11549
		and	ah, 0fbh	; Knock out parity/overflow
11550
		shl	dl, 2
11551
		or		ah, dl
11552
		or	ah, 02h	; Set negative
11553
		xor	edx, edx
11554
		sub	edi, byte 19
11555
		js	near noMoreExec
11556
		mov	dl, byte [esi]	; Get our next instruction
11557
		inc	esi		; Increment PC
11558
		jmp	dword [z80regular+edx*4]
11559
 
11560
 
11561
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11562
 
11563
DDInst9c:
11564
		mov	dl, byte [_z80ix + 1]
11565
		sahf		; Store our flags in x86 flag reg
11566
		sbb	al, dl
11567
		lahf		; Get flags back into AH
11568
		seto	dl
11569
		and	ah, 0fbh	; Knock out parity/overflow
11570
		shl	dl, 2
11571
		or		ah, dl
11572
		or	ah, 02h	; N Gets set!
11573
		sub	edi, byte 9
11574
		js	near noMoreExec
11575
		mov	dl, byte [esi]	; Get our next instruction
11576
		inc	esi		; Increment PC
11577
		jmp	dword [z80regular+edx*4]
11578
 
11579
 
11580
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11581
 
11582
DDInst9d:
11583
		mov	dl, byte [_z80ix]
11584
		sahf		; Store our flags in x86 flag reg
11585
		sbb	al, dl
11586
		lahf		; Get flags back into AH
11587
		seto	dl
11588
		and	ah, 0fbh	; Knock out parity/overflow
11589
		shl	dl, 2
11590
		or		ah, dl
11591
		or	ah, 02h	; N Gets set!
11592
		sub	edi, byte 9
11593
		js	near noMoreExec
11594
		mov	dl, byte [esi]	; Get our next instruction
11595
		inc	esi		; Increment PC
11596
		jmp	dword [z80regular+edx*4]
11597
 
11598
 
11599
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11600
 
11601
DDInst9e:
11602
		mov	dl, [esi]	; Fetch our offset
11603
		inc	esi		; Move past the offset
11604
		or	dl, dl		; Is this bad boy signed?
11605
		jns	notSigned182	; Nope!
11606
		dec	dh			; Make it FFable
11607
notSigned182:
11608
		add	dx, [_z80ix]	; Our offset!
11609
		mov	[cyclesRemaining], edi
11610
		mov	edi, [_z80MemRead]	; Point to the read array
11611
 
11612
checkLoop183:
11613
		cmp	[edi], word 0ffffh ; End of the list?
11614
		je		memoryRead183
11615
		cmp	edx, [edi]	; Are we smaller?
11616
		jb		nextAddr183		; Yes, go to the next address
11617
		cmp	edx, [edi+4]	; Are we bigger?
11618
		jbe	callRoutine183
11619
 
11620
nextAddr183:
11621
		add	edi, 10h		; Next structure!
11622
		jmp	short checkLoop183
11623
 
11624
callRoutine183:
11625
		call	ReadMemoryByte	; Standard read routine
11626
		mov	dl, al	; Put our returned value here
11627
		mov	ax, [_z80af]	; Get our AF back
11628
		jmp	short readExit183
11629
 
11630
memoryRead183:
11631
		mov	dl, [ebp + edx]	; Get our data
11632
 
11633
readExit183:
11634
		mov	edi, [cyclesRemaining]
11635
		sahf
11636
		sbb	al, dl
11637
		lahf
11638
		seto	dl
11639
		and	ah, 0fbh	; Knock out parity/overflow
11640
		shl	dl, 2
11641
		or		ah, dl
11642
		or	ah, 02h	; Set negative
11643
		xor	edx, edx
11644
		sub	edi, byte 19
11645
		js	near noMoreExec
11646
		mov	dl, byte [esi]	; Get our next instruction
11647
		inc	esi		; Increment PC
11648
		jmp	dword [z80regular+edx*4]
11649
 
11650
 
11651
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11652
 
11653
DDInsta4:
11654
		mov	dl, byte [_z80ix + 1]
11655
		sahf		; Store our flags in x86 flag reg
11656
		and	al, dl
11657
		lahf		; Get flags back into AH
11658
		and	ah, 0ech	; Only these flags matter!
11659
		or	ah, 010h	; Half carry gets set
11660
		sub	edi, byte 9
11661
		js	near noMoreExec
11662
		mov	dl, byte [esi]	; Get our next instruction
11663
		inc	esi		; Increment PC
11664
		jmp	dword [z80regular+edx*4]
11665
 
11666
 
11667
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11668
 
11669
DDInsta5:
11670
		mov	dl, byte [_z80ix]
11671
		sahf		; Store our flags in x86 flag reg
11672
		and	al, dl
11673
		lahf		; Get flags back into AH
11674
		and	ah, 0ech	; Only these flags matter!
11675
		or	ah, 010h	; Half carry gets set
11676
		sub	edi, byte 9
11677
		js	near noMoreExec
11678
		mov	dl, byte [esi]	; Get our next instruction
11679
		inc	esi		; Increment PC
11680
		jmp	dword [z80regular+edx*4]
11681
 
11682
 
11683
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11684
 
11685
DDInsta6:
11686
		mov	dl, [esi]	; Fetch our offset
11687
		inc	esi		; Move past the offset
11688
		or	dl, dl		; Is this bad boy signed?
11689
		jns	notSigned184	; Nope!
11690
		dec	dh			; Make it FFable
11691
notSigned184:
11692
		add	dx, [_z80ix]	; Our offset!
11693
		mov	[cyclesRemaining], edi
11694
		mov	edi, [_z80MemRead]	; Point to the read array
11695
 
11696
checkLoop185:
11697
		cmp	[edi], word 0ffffh ; End of the list?
11698
		je		memoryRead185
11699
		cmp	edx, [edi]	; Are we smaller?
11700
		jb		nextAddr185		; Yes, go to the next address
11701
		cmp	edx, [edi+4]	; Are we bigger?
11702
		jbe	callRoutine185
11703
 
11704
nextAddr185:
11705
		add	edi, 10h		; Next structure!
11706
		jmp	short checkLoop185
11707
 
11708
callRoutine185:
11709
		call	ReadMemoryByte	; Standard read routine
11710
		mov	dl, al	; Put our returned value here
11711
		mov	ax, [_z80af]	; Get our AF back
11712
		jmp	short readExit185
11713
 
11714
memoryRead185:
11715
		mov	dl, [ebp + edx]	; Get our data
11716
 
11717
readExit185:
11718
		mov	edi, [cyclesRemaining]
11719
		sahf
11720
		and	al, dl
11721
		lahf
11722
		and	ah,0fch	; Knock out N & C
11723
		or	ah, 10h	; Set half carry
11724
		xor	edx, edx
11725
		sub	edi, byte 19
11726
		js	near noMoreExec
11727
		mov	dl, byte [esi]	; Get our next instruction
11728
		inc	esi		; Increment PC
11729
		jmp	dword [z80regular+edx*4]
11730
 
11731
 
11732
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11733
 
11734
DDInstac:
11735
		mov	dl, byte [_z80ix + 1]
11736
		sahf		; Store our flags in x86 flag reg
11737
		xor	al, dl
11738
		lahf		; Get flags back into AH
11739
		and	ah, 0ech	; Only these flags matter!
11740
		sub	edi, byte 9
11741
		js	near noMoreExec
11742
		mov	dl, byte [esi]	; Get our next instruction
11743
		inc	esi		; Increment PC
11744
		jmp	dword [z80regular+edx*4]
11745
 
11746
 
11747
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11748
 
11749
DDInstad:
11750
		mov	dl, byte [_z80ix]
11751
		sahf		; Store our flags in x86 flag reg
11752
		xor	al, dl
11753
		lahf		; Get flags back into AH
11754
		and	ah, 0ech	; Only these flags matter!
11755
		sub	edi, byte 9
11756
		js	near noMoreExec
11757
		mov	dl, byte [esi]	; Get our next instruction
11758
		inc	esi		; Increment PC
11759
		jmp	dword [z80regular+edx*4]
11760
 
11761
 
11762
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11763
 
11764
DDInstae:
11765
		mov	dl, [esi]	; Fetch our offset
11766
		inc	esi		; Move past the offset
11767
		or	dl, dl		; Is this bad boy signed?
11768
		jns	notSigned186	; Nope!
11769
		dec	dh			; Make it FFable
11770
notSigned186:
11771
		add	dx, [_z80ix]	; Our offset!
11772
		mov	[cyclesRemaining], edi
11773
		mov	edi, [_z80MemRead]	; Point to the read array
11774
 
11775
checkLoop187:
11776
		cmp	[edi], word 0ffffh ; End of the list?
11777
		je		memoryRead187
11778
		cmp	edx, [edi]	; Are we smaller?
11779
		jb		nextAddr187		; Yes, go to the next address
11780
		cmp	edx, [edi+4]	; Are we bigger?
11781
		jbe	callRoutine187
11782
 
11783
nextAddr187:
11784
		add	edi, 10h		; Next structure!
11785
		jmp	short checkLoop187
11786
 
11787
callRoutine187:
11788
		call	ReadMemoryByte	; Standard read routine
11789
		mov	dl, al	; Put our returned value here
11790
		mov	ax, [_z80af]	; Get our AF back
11791
		jmp	short readExit187
11792
 
11793
memoryRead187:
11794
		mov	dl, [ebp + edx]	; Get our data
11795
 
11796
readExit187:
11797
		mov	edi, [cyclesRemaining]
11798
		sahf
11799
		xor	al, dl
11800
		lahf
11801
		and	ah, 0ech	; Knock out H, N, and C
11802
		xor	edx, edx
11803
		sub	edi, byte 19
11804
		js	near noMoreExec
11805
		mov	dl, byte [esi]	; Get our next instruction
11806
		inc	esi		; Increment PC
11807
		jmp	dword [z80regular+edx*4]
11808
 
11809
 
11810
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11811
 
11812
DDInstb4:
11813
		mov	dl, byte [_z80ix + 1]
11814
		sahf		; Store our flags in x86 flag reg
11815
		or	al, dl
11816
		lahf		; Get flags back into AH
11817
		and	ah, 0ech ; No H, N, or C
11818
		and	ah, 0ech ; No H, N, or C
11819
		sub	edi, byte 9
11820
		js	near noMoreExec
11821
		mov	dl, byte [esi]	; Get our next instruction
11822
		inc	esi		; Increment PC
11823
		jmp	dword [z80regular+edx*4]
11824
 
11825
 
11826
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11827
 
11828
DDInstb5:
11829
		mov	dl, byte [_z80ix]
11830
		sahf		; Store our flags in x86 flag reg
11831
		or	al, dl
11832
		lahf		; Get flags back into AH
11833
		and	ah, 0ech ; No H, N, or C
11834
		and	ah, 0ech ; No H, N, or C
11835
		sub	edi, byte 9
11836
		js	near noMoreExec
11837
		mov	dl, byte [esi]	; Get our next instruction
11838
		inc	esi		; Increment PC
11839
		jmp	dword [z80regular+edx*4]
11840
 
11841
 
11842
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11843
 
11844
DDInstb6:
11845
		mov	dl, [esi]	; Fetch our offset
11846
		inc	esi		; Move past the offset
11847
		or	dl, dl		; Is this bad boy signed?
11848
		jns	notSigned188	; Nope!
11849
		dec	dh			; Make it FFable
11850
notSigned188:
11851
		add	dx, [_z80ix]	; Our offset!
11852
		mov	[cyclesRemaining], edi
11853
		mov	edi, [_z80MemRead]	; Point to the read array
11854
 
11855
checkLoop189:
11856
		cmp	[edi], word 0ffffh ; End of the list?
11857
		je		memoryRead189
11858
		cmp	edx, [edi]	; Are we smaller?
11859
		jb		nextAddr189		; Yes, go to the next address
11860
		cmp	edx, [edi+4]	; Are we bigger?
11861
		jbe	callRoutine189
11862
 
11863
nextAddr189:
11864
		add	edi, 10h		; Next structure!
11865
		jmp	short checkLoop189
11866
 
11867
callRoutine189:
11868
		call	ReadMemoryByte	; Standard read routine
11869
		mov	dl, al	; Put our returned value here
11870
		mov	ax, [_z80af]	; Get our AF back
11871
		jmp	short readExit189
11872
 
11873
memoryRead189:
11874
		mov	dl, [ebp + edx]	; Get our data
11875
 
11876
readExit189:
11877
		mov	edi, [cyclesRemaining]
11878
		sahf
11879
		or	al, dl
11880
		lahf
11881
		and	ah, 0ech	; Knock out H, N, and C
11882
		xor	edx, edx
11883
		sub	edi, byte 19
11884
		js	near noMoreExec
11885
		mov	dl, byte [esi]	; Get our next instruction
11886
		inc	esi		; Increment PC
11887
		jmp	dword [z80regular+edx*4]
11888
 
11889
 
11890
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11891
 
11892
DDInstbc:
11893
		mov	dl, byte [_z80ix + 1]
11894
		sahf		; Store our flags in x86 flag reg
11895
		cmp	al, dl
11896
		lahf		; Get flags back into AH
11897
		seto	dl
11898
		and	ah, 0fbh	; Knock out parity/overflow
11899
		shl	dl, 2
11900
		or		ah, dl
11901
		or	ah, 02h	; Negative gets set on a compare
11902
		sub	edi, byte 9
11903
		js	near noMoreExec
11904
		mov	dl, byte [esi]	; Get our next instruction
11905
		inc	esi		; Increment PC
11906
		jmp	dword [z80regular+edx*4]
11907
 
11908
 
11909
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11910
 
11911
DDInstbd:
11912
		mov	dl, byte [_z80ix]
11913
		sahf		; Store our flags in x86 flag reg
11914
		cmp	al, dl
11915
		lahf		; Get flags back into AH
11916
		seto	dl
11917
		and	ah, 0fbh	; Knock out parity/overflow
11918
		shl	dl, 2
11919
		or		ah, dl
11920
		or	ah, 02h	; Negative gets set on a compare
11921
		sub	edi, byte 9
11922
		js	near noMoreExec
11923
		mov	dl, byte [esi]	; Get our next instruction
11924
		inc	esi		; Increment PC
11925
		jmp	dword [z80regular+edx*4]
11926
 
11927
 
11928
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
11929
 
11930
DDInstbe:
11931
		mov	dl, [esi]	; Fetch our offset
11932
		inc	esi		; Move past the offset
11933
		or	dl, dl		; Is this bad boy signed?
11934
		jns	notSigned190	; Nope!
11935
		dec	dh			; Make it FFable
11936
notSigned190:
11937
		add	dx, [_z80ix]	; Our offset!
11938
		mov	[cyclesRemaining], edi
11939
		mov	edi, [_z80MemRead]	; Point to the read array
11940
 
11941
checkLoop191:
11942
		cmp	[edi], word 0ffffh ; End of the list?
11943
		je		memoryRead191
11944
		cmp	edx, [edi]	; Are we smaller?
11945
		jb		nextAddr191		; Yes, go to the next address
11946
		cmp	edx, [edi+4]	; Are we bigger?
11947
		jbe	callRoutine191
11948
 
11949
nextAddr191:
11950
		add	edi, 10h		; Next structure!
11951
		jmp	short checkLoop191
11952
 
11953
callRoutine191:
11954
		call	ReadMemoryByte	; Standard read routine
11955
		mov	dl, al	; Put our returned value here
11956
		mov	ax, [_z80af]	; Get our AF back
11957
		jmp	short readExit191
11958
 
11959
memoryRead191:
11960
		mov	dl, [ebp + edx]	; Get our data
11961
 
11962
readExit191:
11963
		mov	edi, [cyclesRemaining]
11964
		sahf
11965
		cmp	al, dl
11966
		lahf
11967
		seto	dl
11968
		and	ah, 0fbh	; Knock out parity/overflow
11969
		shl	dl, 2
11970
		or		ah, dl
11971
		or	ah, 02h	; Set negative
11972
		xor	edx, edx
11973
		sub	edi, byte 19
11974
		js	near noMoreExec
11975
		mov	dl, byte [esi]	; Get our next instruction
11976
		inc	esi		; Increment PC
11977
		jmp	dword [z80regular+edx*4]
11978
 
11979
DDInstcb:
11980
		mov	dx, [esi]	; Get our instruction (and offset)
11981
		add	esi, 2	; Increment our PC
11982
		mov	byte [_orgval], dl ; Store our value
11983
		or	dl, dl
11984
		js	notNeg192
11985
		mov	byte [_orgval + 1], 00h;
11986
 		jmp	short jumpHandler192
11987
notNeg192:
11988
		mov	byte [_orgval + 1], 0ffh;	It's negative
11989
jumpHandler192:
11990
		shl	ebx, 16	; Save BX away
11991
		mov	bx, [_z80ix]
11992
		add	[_orgval], bx
11993
		shr	ebx, 16	; Restore BX
11994
		mov	dl, dh	; Get our instruction
11995
		xor	dh, dh	; Zero this
11996
		jmp	dword [z80ddfdcbInstructions+edx*4]
11997
 
11998
 
11999
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12000
 
12001
DDInste1:
12002
		mov	dx, [_z80sp]
12003
		mov	[cyclesRemaining], edi
12004
		mov	edi, [_z80MemRead]	; Point to the read array
12005
 
12006
checkLoop193:
12007
		cmp	[edi], word 0ffffh ; End of the list?
12008
		je		memoryRead193
12009
		cmp	dx, [edi]	; Are we smaller?
12010
		jb		nextAddr193		; Yes, go to the next address
12011
		cmp	dx, [edi+4]	; Are we bigger?
12012
		jbe	callRoutine193
12013
 
12014
nextAddr193:
12015
		add	edi, 10h		; Next structure!
12016
		jmp	short checkLoop193
12017
 
12018
callRoutine193:
12019
		push	ax		; Save this for later
12020
		push	dx		; Save address
12021
		call	ReadMemoryByte	; Standard read routine
12022
		pop	dx		; Restore our address
12023
		inc	dx		; Next byte, please
12024
		push	ax		; Save returned byte
12025
		call	ReadMemoryByte	; Standard read routine
12026
		xchg	ah, al	; Swap for endian's sake
12027
		pop	dx	; Restore LSB
12028
		mov	dh, ah	; Our word is now in DX
12029
		pop	ax		; Restore this
12030
		mov	[_z80ix], dx	; Store our word
12031
		jmp	readExit193
12032
 
12033
memoryRead193:
12034
		mov	dx, [ebp + edx]
12035
		mov	[_z80ix], dx
12036
readExit193:
12037
		mov	edi, [cyclesRemaining]
12038
		add	word [_z80sp], 2
12039
		xor	edx, edx
12040
		sub	edi, byte 14
12041
		js	near noMoreExec
12042
		mov	dl, byte [esi]	; Get our next instruction
12043
		inc	esi		; Increment PC
12044
		jmp	dword [z80regular+edx*4]
12045
 
12046
 
12047
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12048
 
12049
DDInste3:
12050
		mov	[cyclesRemaining], edi
12051
		mov	dx, word [_z80sp]
12052
		xor	edi, edi
12053
		mov	di, [_z80ix]
12054
		xchg	di, [ebp+edx]
12055
		mov	[_z80ix], di
12056
		xor	edx, edx
12057
		mov	edi, [cyclesRemaining]
12058
		sub	edi, byte 23
12059
		js	near noMoreExec
12060
		mov	dl, byte [esi]	; Get our next instruction
12061
		inc	esi		; Increment PC
12062
		jmp	dword [z80regular+edx*4]
12063
 
12064
 
12065
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12066
 
12067
DDInste5:
12068
		sub	word [_z80sp], 2
12069
		mov	dx, [_z80sp]
12070
		mov	[cyclesRemaining], edi
12071
		mov	edi, [_z80MemWrite]	; Point to the write array
12072
 
12073
checkLoop194:
12074
		cmp	[edi], word 0ffffh ; End of the list?
12075
		je		memoryWrite194
12076
		cmp	dx, [edi]	; Are we smaller?
12077
		jb		nextAddr194		; Yes, go to the next address
12078
		cmp	dx, [edi+4]	; Are we bigger?
12079
		jbe	callRoutine194
12080
 
12081
nextAddr194:
12082
		add	edi, 10h		; Next structure!
12083
		jmp	short checkLoop194
12084
 
12085
callRoutine194:
12086
		push	ax		; Save this for later
12087
		push	dx
12088
		mov	ax, [_z80ix]
12089
		call	WriteMemoryByte
12090
		pop	dx
12091
		pop	ax
12092
		inc	dx
12093
 
12094
		push	ax
12095
		push	dx
12096
		mov	ax, [_z80ix]
12097
		xchg	ah, al
12098
		call	WriteMemoryByte
12099
		pop	dx
12100
		pop	ax	; Restore us!
12101
		jmp	writeExit194
12102
 
12103
memoryWrite194:
12104
		mov	di, [_z80ix]
12105
		mov	[ebp + edx], di	; Store our word
12106
writeExit194:
12107
		mov	edi, [cyclesRemaining]
12108
		xor	edx, edx
12109
		sub	edi, byte 15
12110
		js	near noMoreExec
12111
		mov	dl, byte [esi]	; Get our next instruction
12112
		inc	esi		; Increment PC
12113
		jmp	dword [z80regular+edx*4]
12114
 
12115
 
12116
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12117
 
12118
DDInste9:
12119
		mov	dx, [_z80ix]	; Get our value
12120
		mov	esi, edx		; New PC!
12121
		add	esi, ebp		; Add in our base
12122
		xor	edx, edx
12123
		sub	edi, byte 8
12124
		js	near noMoreExec
12125
		mov	dl, byte [esi]	; Get our next instruction
12126
		inc	esi		; Increment PC
12127
		jmp	dword [z80regular+edx*4]
12128
 
12129
 
12130
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12131
 
12132
DDInstf9:
12133
		mov	dx, [_z80ix] ; Get our source register
12134
		mov	word [_z80sp], dx	; Store our new SP
12135
		xor	edx, edx
12136
		sub	edi, byte 10
12137
		js	near noMoreExec
12138
		mov	dl, byte [esi]	; Get our next instruction
12139
		inc	esi		; Increment PC
12140
		jmp	dword [z80regular+edx*4]
12141
 
12142
 
12143
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12144
 
12145
DDFDCBInst06:
12146
		mov	dx, [_orgval]	; Get our target address
12147
		mov	[cyclesRemaining], edi
12148
		mov	edi, [_z80MemRead]	; Point to the read array
12149
 
12150
checkLoop195:
12151
		cmp	[edi], word 0ffffh ; End of the list?
12152
		je		memoryRead195
12153
		cmp	edx, [edi]	; Are we smaller?
12154
		jb		nextAddr195		; Yes, go to the next address
12155
		cmp	edx, [edi+4]	; Are we bigger?
12156
		jbe	callRoutine195
12157
 
12158
nextAddr195:
12159
		add	edi, 10h		; Next structure!
12160
		jmp	short checkLoop195
12161
 
12162
callRoutine195:
12163
		call	ReadMemoryByte	; Standard read routine
12164
		mov	dl, al	; Put our returned value here
12165
		mov	ax, [_z80af]	; Get our AF back
12166
		jmp	short readExit195
12167
 
12168
memoryRead195:
12169
		mov	dl, [ebp + edx]	; Get our data
12170
 
12171
readExit195:
12172
		mov	edi, [cyclesRemaining]
12173
		sahf		; Restore our flags
12174
		rol	dl, 1
12175
		lahf		; Get our flags back
12176
		and	ah, 0edh	; Knock out H & N
12177
		mov	[cyclesRemaining], edi
12178
		mov	[_z80af], ax	; Store AF
12179
		mov	al, dl	; And our data to write
12180
		mov	dx, [_orgval]
12181
		mov	edi, [_z80MemWrite]	; Point to the write array
12182
 
12183
checkLoop196:
12184
		cmp	[edi], word 0ffffh ; End of our list?
12185
		je	memoryWrite196	; Yes - go write it!
12186
		cmp	dx, [edi]	; Are we smaller?
12187
		jb	nextAddr196	; Yes... go to the next addr
12188
		cmp	dx, [edi+4]	; Are we smaller?
12189
		jbe	callRoutine196	; If not, go call it!
12190
 
12191
nextAddr196:
12192
		add	edi, 10h		; Next structure, please
12193
		jmp	short checkLoop196
12194
 
12195
callRoutine196:
12196
		call	WriteMemoryByte	; Go write the data!
12197
		jmp	short WriteMacroExit196
12198
memoryWrite196:
12199
		mov	[ebp + edx], al
12200
		mov	ax, [_z80af] ; Get our accumulator and flags
12201
WriteMacroExit196:
12202
		mov	edi, [cyclesRemaining]
12203
		xor	edx, edx
12204
		sub	edi, byte 23
12205
		js	near noMoreExec
12206
		mov	dl, byte [esi]	; Get our next instruction
12207
		inc	esi		; Increment PC
12208
		jmp	dword [z80regular+edx*4]
12209
 
12210
 
12211
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12212
 
12213
DDFDCBInst0e:
12214
		mov	dx, [_orgval]	; Get our target address
12215
		mov	[cyclesRemaining], edi
12216
		mov	edi, [_z80MemRead]	; Point to the read array
12217
 
12218
checkLoop197:
12219
		cmp	[edi], word 0ffffh ; End of the list?
12220
		je		memoryRead197
12221
		cmp	edx, [edi]	; Are we smaller?
12222
		jb		nextAddr197		; Yes, go to the next address
12223
		cmp	edx, [edi+4]	; Are we bigger?
12224
		jbe	callRoutine197
12225
 
12226
nextAddr197:
12227
		add	edi, 10h		; Next structure!
12228
		jmp	short checkLoop197
12229
 
12230
callRoutine197:
12231
		call	ReadMemoryByte	; Standard read routine
12232
		mov	dl, al	; Put our returned value here
12233
		mov	ax, [_z80af]	; Get our AF back
12234
		jmp	short readExit197
12235
 
12236
memoryRead197:
12237
		mov	dl, [ebp + edx]	; Get our data
12238
 
12239
readExit197:
12240
		mov	edi, [cyclesRemaining]
12241
		sahf		; Restore our flags
12242
		ror	dl, 1
12243
		lahf		; Get our flags back
12244
		and	ah, 0edh	; Knock out H & N
12245
		mov	[cyclesRemaining], edi
12246
		mov	[_z80af], ax	; Store AF
12247
		mov	al, dl	; And our data to write
12248
		mov	dx, [_orgval]
12249
		mov	edi, [_z80MemWrite]	; Point to the write array
12250
 
12251
checkLoop198:
12252
		cmp	[edi], word 0ffffh ; End of our list?
12253
		je	memoryWrite198	; Yes - go write it!
12254
		cmp	dx, [edi]	; Are we smaller?
12255
		jb	nextAddr198	; Yes... go to the next addr
12256
		cmp	dx, [edi+4]	; Are we smaller?
12257
		jbe	callRoutine198	; If not, go call it!
12258
 
12259
nextAddr198:
12260
		add	edi, 10h		; Next structure, please
12261
		jmp	short checkLoop198
12262
 
12263
callRoutine198:
12264
		call	WriteMemoryByte	; Go write the data!
12265
		jmp	short WriteMacroExit198
12266
memoryWrite198:
12267
		mov	[ebp + edx], al
12268
		mov	ax, [_z80af] ; Get our accumulator and flags
12269
WriteMacroExit198:
12270
		mov	edi, [cyclesRemaining]
12271
		xor	edx, edx
12272
		sub	edi, byte 23
12273
		js	near noMoreExec
12274
		mov	dl, byte [esi]	; Get our next instruction
12275
		inc	esi		; Increment PC
12276
		jmp	dword [z80regular+edx*4]
12277
 
12278
 
12279
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12280
 
12281
DDFDCBInst16:
12282
		mov	dx, [_orgval]	; Get our target address
12283
		mov	[cyclesRemaining], edi
12284
		mov	edi, [_z80MemRead]	; Point to the read array
12285
 
12286
checkLoop199:
12287
		cmp	[edi], word 0ffffh ; End of the list?
12288
		je		memoryRead199
12289
		cmp	edx, [edi]	; Are we smaller?
12290
		jb		nextAddr199		; Yes, go to the next address
12291
		cmp	edx, [edi+4]	; Are we bigger?
12292
		jbe	callRoutine199
12293
 
12294
nextAddr199:
12295
		add	edi, 10h		; Next structure!
12296
		jmp	short checkLoop199
12297
 
12298
callRoutine199:
12299
		call	ReadMemoryByte	; Standard read routine
12300
		mov	dl, al	; Put our returned value here
12301
		mov	ax, [_z80af]	; Get our AF back
12302
		jmp	short readExit199
12303
 
12304
memoryRead199:
12305
		mov	dl, [ebp + edx]	; Get our data
12306
 
12307
readExit199:
12308
		mov	edi, [cyclesRemaining]
12309
		sahf		; Restore our flags
12310
		rcl	dl, 1
12311
		lahf		; Get our flags back
12312
		and	ah, 0edh	; Knock out H & N
12313
		mov	[cyclesRemaining], edi
12314
		mov	[_z80af], ax	; Store AF
12315
		mov	al, dl	; And our data to write
12316
		mov	dx, [_orgval]
12317
		mov	edi, [_z80MemWrite]	; Point to the write array
12318
 
12319
checkLoop200:
12320
		cmp	[edi], word 0ffffh ; End of our list?
12321
		je	memoryWrite200	; Yes - go write it!
12322
		cmp	dx, [edi]	; Are we smaller?
12323
		jb	nextAddr200	; Yes... go to the next addr
12324
		cmp	dx, [edi+4]	; Are we smaller?
12325
		jbe	callRoutine200	; If not, go call it!
12326
 
12327
nextAddr200:
12328
		add	edi, 10h		; Next structure, please
12329
		jmp	short checkLoop200
12330
 
12331
callRoutine200:
12332
		call	WriteMemoryByte	; Go write the data!
12333
		jmp	short WriteMacroExit200
12334
memoryWrite200:
12335
		mov	[ebp + edx], al
12336
		mov	ax, [_z80af] ; Get our accumulator and flags
12337
WriteMacroExit200:
12338
		mov	edi, [cyclesRemaining]
12339
		xor	edx, edx
12340
		sub	edi, byte 23
12341
		js	near noMoreExec
12342
		mov	dl, byte [esi]	; Get our next instruction
12343
		inc	esi		; Increment PC
12344
		jmp	dword [z80regular+edx*4]
12345
 
12346
 
12347
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12348
 
12349
DDFDCBInst1e:
12350
		mov	dx, [_orgval]	; Get our target address
12351
		mov	[cyclesRemaining], edi
12352
		mov	edi, [_z80MemRead]	; Point to the read array
12353
 
12354
checkLoop201:
12355
		cmp	[edi], word 0ffffh ; End of the list?
12356
		je		memoryRead201
12357
		cmp	edx, [edi]	; Are we smaller?
12358
		jb		nextAddr201		; Yes, go to the next address
12359
		cmp	edx, [edi+4]	; Are we bigger?
12360
		jbe	callRoutine201
12361
 
12362
nextAddr201:
12363
		add	edi, 10h		; Next structure!
12364
		jmp	short checkLoop201
12365
 
12366
callRoutine201:
12367
		call	ReadMemoryByte	; Standard read routine
12368
		mov	dl, al	; Put our returned value here
12369
		mov	ax, [_z80af]	; Get our AF back
12370
		jmp	short readExit201
12371
 
12372
memoryRead201:
12373
		mov	dl, [ebp + edx]	; Get our data
12374
 
12375
readExit201:
12376
		mov	edi, [cyclesRemaining]
12377
		sahf		; Restore our flags
12378
		rcr	dl, 1
12379
		lahf		; Get our flags back
12380
		and	ah, 0edh	; Knock out H & N
12381
		mov	[cyclesRemaining], edi
12382
		mov	[_z80af], ax	; Store AF
12383
		mov	al, dl	; And our data to write
12384
		mov	dx, [_orgval]
12385
		mov	edi, [_z80MemWrite]	; Point to the write array
12386
 
12387
checkLoop202:
12388
		cmp	[edi], word 0ffffh ; End of our list?
12389
		je	memoryWrite202	; Yes - go write it!
12390
		cmp	dx, [edi]	; Are we smaller?
12391
		jb	nextAddr202	; Yes... go to the next addr
12392
		cmp	dx, [edi+4]	; Are we smaller?
12393
		jbe	callRoutine202	; If not, go call it!
12394
 
12395
nextAddr202:
12396
		add	edi, 10h		; Next structure, please
12397
		jmp	short checkLoop202
12398
 
12399
callRoutine202:
12400
		call	WriteMemoryByte	; Go write the data!
12401
		jmp	short WriteMacroExit202
12402
memoryWrite202:
12403
		mov	[ebp + edx], al
12404
		mov	ax, [_z80af] ; Get our accumulator and flags
12405
WriteMacroExit202:
12406
		mov	edi, [cyclesRemaining]
12407
		xor	edx, edx
12408
		sub	edi, byte 23
12409
		js	near noMoreExec
12410
		mov	dl, byte [esi]	; Get our next instruction
12411
		inc	esi		; Increment PC
12412
		jmp	dword [z80regular+edx*4]
12413
 
12414
 
12415
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12416
 
12417
DDFDCBInst26:
12418
		mov	dx, [_orgval]	; Get our target address
12419
		mov	[cyclesRemaining], edi
12420
		mov	edi, [_z80MemRead]	; Point to the read array
12421
 
12422
checkLoop203:
12423
		cmp	[edi], word 0ffffh ; End of the list?
12424
		je		memoryRead203
12425
		cmp	edx, [edi]	; Are we smaller?
12426
		jb		nextAddr203		; Yes, go to the next address
12427
		cmp	edx, [edi+4]	; Are we bigger?
12428
		jbe	callRoutine203
12429
 
12430
nextAddr203:
12431
		add	edi, 10h		; Next structure!
12432
		jmp	short checkLoop203
12433
 
12434
callRoutine203:
12435
		call	ReadMemoryByte	; Standard read routine
12436
		mov	dl, al	; Put our returned value here
12437
		mov	ax, [_z80af]	; Get our AF back
12438
		jmp	short readExit203
12439
 
12440
memoryRead203:
12441
		mov	dl, [ebp + edx]	; Get our data
12442
 
12443
readExit203:
12444
		mov	edi, [cyclesRemaining]
12445
		sahf		; Restore our flags
12446
		shl	dl, 1
12447
		lahf		; Get our flags back
12448
		and	ah, 0edh	; No Half carry or negative!
12449
		mov	[cyclesRemaining], edi
12450
		mov	[_z80af], ax	; Store AF
12451
		mov	al, dl	; And our data to write
12452
		mov	dx, [_orgval]
12453
		mov	edi, [_z80MemWrite]	; Point to the write array
12454
 
12455
checkLoop204:
12456
		cmp	[edi], word 0ffffh ; End of our list?
12457
		je	memoryWrite204	; Yes - go write it!
12458
		cmp	dx, [edi]	; Are we smaller?
12459
		jb	nextAddr204	; Yes... go to the next addr
12460
		cmp	dx, [edi+4]	; Are we smaller?
12461
		jbe	callRoutine204	; If not, go call it!
12462
 
12463
nextAddr204:
12464
		add	edi, 10h		; Next structure, please
12465
		jmp	short checkLoop204
12466
 
12467
callRoutine204:
12468
		call	WriteMemoryByte	; Go write the data!
12469
		jmp	short WriteMacroExit204
12470
memoryWrite204:
12471
		mov	[ebp + edx], al
12472
		mov	ax, [_z80af] ; Get our accumulator and flags
12473
WriteMacroExit204:
12474
		mov	edi, [cyclesRemaining]
12475
		xor	edx, edx
12476
		sub	edi, byte 23
12477
		js	near noMoreExec
12478
		mov	dl, byte [esi]	; Get our next instruction
12479
		inc	esi		; Increment PC
12480
		jmp	dword [z80regular+edx*4]
12481
 
12482
 
12483
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12484
 
12485
DDFDCBInst2e:
12486
		mov	dx, [_orgval]	; Get our target address
12487
		mov	[cyclesRemaining], edi
12488
		mov	edi, [_z80MemRead]	; Point to the read array
12489
 
12490
checkLoop205:
12491
		cmp	[edi], word 0ffffh ; End of the list?
12492
		je		memoryRead205
12493
		cmp	edx, [edi]	; Are we smaller?
12494
		jb		nextAddr205		; Yes, go to the next address
12495
		cmp	edx, [edi+4]	; Are we bigger?
12496
		jbe	callRoutine205
12497
 
12498
nextAddr205:
12499
		add	edi, 10h		; Next structure!
12500
		jmp	short checkLoop205
12501
 
12502
callRoutine205:
12503
		call	ReadMemoryByte	; Standard read routine
12504
		mov	dl, al	; Put our returned value here
12505
		mov	ax, [_z80af]	; Get our AF back
12506
		jmp	short readExit205
12507
 
12508
memoryRead205:
12509
		mov	dl, [ebp + edx]	; Get our data
12510
 
12511
readExit205:
12512
		mov	edi, [cyclesRemaining]
12513
		sahf		; Restore our flags
12514
		sar	dl, 1
12515
		lahf		; Get our flags back
12516
		and	ah, 0edh	; No Half carry or negative!
12517
		mov	[cyclesRemaining], edi
12518
		mov	[_z80af], ax	; Store AF
12519
		mov	al, dl	; And our data to write
12520
		mov	dx, [_orgval]
12521
		mov	edi, [_z80MemWrite]	; Point to the write array
12522
 
12523
checkLoop206:
12524
		cmp	[edi], word 0ffffh ; End of our list?
12525
		je	memoryWrite206	; Yes - go write it!
12526
		cmp	dx, [edi]	; Are we smaller?
12527
		jb	nextAddr206	; Yes... go to the next addr
12528
		cmp	dx, [edi+4]	; Are we smaller?
12529
		jbe	callRoutine206	; If not, go call it!
12530
 
12531
nextAddr206:
12532
		add	edi, 10h		; Next structure, please
12533
		jmp	short checkLoop206
12534
 
12535
callRoutine206:
12536
		call	WriteMemoryByte	; Go write the data!
12537
		jmp	short WriteMacroExit206
12538
memoryWrite206:
12539
		mov	[ebp + edx], al
12540
		mov	ax, [_z80af] ; Get our accumulator and flags
12541
WriteMacroExit206:
12542
		mov	edi, [cyclesRemaining]
12543
		xor	edx, edx
12544
		sub	edi, byte 23
12545
		js	near noMoreExec
12546
		mov	dl, byte [esi]	; Get our next instruction
12547
		inc	esi		; Increment PC
12548
		jmp	dword [z80regular+edx*4]
12549
 
12550
 
12551
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12552
 
12553
DDFDCBInst3e:
12554
		mov	dx, [_orgval]	; Get our target address
12555
		mov	[cyclesRemaining], edi
12556
		mov	edi, [_z80MemRead]	; Point to the read array
12557
 
12558
checkLoop207:
12559
		cmp	[edi], word 0ffffh ; End of the list?
12560
		je		memoryRead207
12561
		cmp	edx, [edi]	; Are we smaller?
12562
		jb		nextAddr207		; Yes, go to the next address
12563
		cmp	edx, [edi+4]	; Are we bigger?
12564
		jbe	callRoutine207
12565
 
12566
nextAddr207:
12567
		add	edi, 10h		; Next structure!
12568
		jmp	short checkLoop207
12569
 
12570
callRoutine207:
12571
		call	ReadMemoryByte	; Standard read routine
12572
		mov	dl, al	; Put our returned value here
12573
		mov	ax, [_z80af]	; Get our AF back
12574
		jmp	short readExit207
12575
 
12576
memoryRead207:
12577
		mov	dl, [ebp + edx]	; Get our data
12578
 
12579
readExit207:
12580
		mov	edi, [cyclesRemaining]
12581
		sahf		; Restore our flags
12582
		shr	dl, 1
12583
		lahf		; Get our flags back
12584
		and	ah, 0edh	; Knock out H & N
12585
		mov	[cyclesRemaining], edi
12586
		mov	[_z80af], ax	; Store AF
12587
		mov	al, dl	; And our data to write
12588
		mov	dx, [_orgval]
12589
		mov	edi, [_z80MemWrite]	; Point to the write array
12590
 
12591
checkLoop208:
12592
		cmp	[edi], word 0ffffh ; End of our list?
12593
		je	memoryWrite208	; Yes - go write it!
12594
		cmp	dx, [edi]	; Are we smaller?
12595
		jb	nextAddr208	; Yes... go to the next addr
12596
		cmp	dx, [edi+4]	; Are we smaller?
12597
		jbe	callRoutine208	; If not, go call it!
12598
 
12599
nextAddr208:
12600
		add	edi, 10h		; Next structure, please
12601
		jmp	short checkLoop208
12602
 
12603
callRoutine208:
12604
		call	WriteMemoryByte	; Go write the data!
12605
		jmp	short WriteMacroExit208
12606
memoryWrite208:
12607
		mov	[ebp + edx], al
12608
		mov	ax, [_z80af] ; Get our accumulator and flags
12609
WriteMacroExit208:
12610
		mov	edi, [cyclesRemaining]
12611
		xor	edx, edx
12612
		sub	edi, byte 23
12613
		js	near noMoreExec
12614
		mov	dl, byte [esi]	; Get our next instruction
12615
		inc	esi		; Increment PC
12616
		jmp	dword [z80regular+edx*4]
12617
 
12618
 
12619
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12620
 
12621
DDFDCBInst46:
12622
		mov	dx, [_orgval]	; Get our target address
12623
		mov	[cyclesRemaining], edi
12624
		mov	edi, [_z80MemRead]	; Point to the read array
12625
 
12626
checkLoop209:
12627
		cmp	[edi], word 0ffffh ; End of the list?
12628
		je		memoryRead209
12629
		cmp	edx, [edi]	; Are we smaller?
12630
		jb		nextAddr209		; Yes, go to the next address
12631
		cmp	edx, [edi+4]	; Are we bigger?
12632
		jbe	callRoutine209
12633
 
12634
nextAddr209:
12635
		add	edi, 10h		; Next structure!
12636
		jmp	short checkLoop209
12637
 
12638
callRoutine209:
12639
		call	ReadMemoryByte	; Standard read routine
12640
		mov	dl, al	; Put our returned value here
12641
		mov	ax, [_z80af]	; Get our AF back
12642
		jmp	short readExit209
12643
 
12644
memoryRead209:
12645
		mov	dl, [ebp + edx]	; Get our data
12646
 
12647
readExit209:
12648
		mov	edi, [cyclesRemaining]
12649
		mov	dh, ah	; Store our original flags
12650
		and	dh, 29h	; Keep our old flags
12651
		sahf		; Restore our flags
12652
		test	dl, 001h	; Is it set?
12653
		lahf		; Get our flags back
12654
		and	ah, 0edh	; No Half carry or negative!
12655
		or	ah, 10h	; OR In our half carry
12656
		and	ah, 0d0h ; New flags
12657
		or	ah, dh	; OR In our old flags
12658
		xor	edx, edx
12659
		sub	edi, byte 20
12660
		js	near noMoreExec
12661
		mov	dl, byte [esi]	; Get our next instruction
12662
		inc	esi		; Increment PC
12663
		jmp	dword [z80regular+edx*4]
12664
 
12665
 
12666
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12667
 
12668
DDFDCBInst4e:
12669
		mov	dx, [_orgval]	; Get our target address
12670
		mov	[cyclesRemaining], edi
12671
		mov	edi, [_z80MemRead]	; Point to the read array
12672
 
12673
checkLoop210:
12674
		cmp	[edi], word 0ffffh ; End of the list?
12675
		je		memoryRead210
12676
		cmp	edx, [edi]	; Are we smaller?
12677
		jb		nextAddr210		; Yes, go to the next address
12678
		cmp	edx, [edi+4]	; Are we bigger?
12679
		jbe	callRoutine210
12680
 
12681
nextAddr210:
12682
		add	edi, 10h		; Next structure!
12683
		jmp	short checkLoop210
12684
 
12685
callRoutine210:
12686
		call	ReadMemoryByte	; Standard read routine
12687
		mov	dl, al	; Put our returned value here
12688
		mov	ax, [_z80af]	; Get our AF back
12689
		jmp	short readExit210
12690
 
12691
memoryRead210:
12692
		mov	dl, [ebp + edx]	; Get our data
12693
 
12694
readExit210:
12695
		mov	edi, [cyclesRemaining]
12696
		mov	dh, ah	; Store our original flags
12697
		and	dh, 29h	; Keep our old flags
12698
		sahf		; Restore our flags
12699
		test	dl, 002h	; Is it set?
12700
		lahf		; Get our flags back
12701
		and	ah, 0edh	; No Half carry or negative!
12702
		or	ah, 10h	; OR In our half carry
12703
		and	ah, 0d0h ; New flags
12704
		or	ah, dh	; OR In our old flags
12705
		xor	edx, edx
12706
		sub	edi, byte 20
12707
		js	near noMoreExec
12708
		mov	dl, byte [esi]	; Get our next instruction
12709
		inc	esi		; Increment PC
12710
		jmp	dword [z80regular+edx*4]
12711
 
12712
 
12713
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12714
 
12715
DDFDCBInst56:
12716
		mov	dx, [_orgval]	; Get our target address
12717
		mov	[cyclesRemaining], edi
12718
		mov	edi, [_z80MemRead]	; Point to the read array
12719
 
12720
checkLoop211:
12721
		cmp	[edi], word 0ffffh ; End of the list?
12722
		je		memoryRead211
12723
		cmp	edx, [edi]	; Are we smaller?
12724
		jb		nextAddr211		; Yes, go to the next address
12725
		cmp	edx, [edi+4]	; Are we bigger?
12726
		jbe	callRoutine211
12727
 
12728
nextAddr211:
12729
		add	edi, 10h		; Next structure!
12730
		jmp	short checkLoop211
12731
 
12732
callRoutine211:
12733
		call	ReadMemoryByte	; Standard read routine
12734
		mov	dl, al	; Put our returned value here
12735
		mov	ax, [_z80af]	; Get our AF back
12736
		jmp	short readExit211
12737
 
12738
memoryRead211:
12739
		mov	dl, [ebp + edx]	; Get our data
12740
 
12741
readExit211:
12742
		mov	edi, [cyclesRemaining]
12743
		mov	dh, ah	; Store our original flags
12744
		and	dh, 29h	; Keep our old flags
12745
		sahf		; Restore our flags
12746
		test	dl, 004h	; Is it set?
12747
		lahf		; Get our flags back
12748
		and	ah, 0edh	; No Half carry or negative!
12749
		or	ah, 10h	; OR In our half carry
12750
		and	ah, 0d0h ; New flags
12751
		or	ah, dh	; OR In our old flags
12752
		xor	edx, edx
12753
		sub	edi, byte 20
12754
		js	near noMoreExec
12755
		mov	dl, byte [esi]	; Get our next instruction
12756
		inc	esi		; Increment PC
12757
		jmp	dword [z80regular+edx*4]
12758
 
12759
 
12760
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12761
 
12762
DDFDCBInst5e:
12763
		mov	dx, [_orgval]	; Get our target address
12764
		mov	[cyclesRemaining], edi
12765
		mov	edi, [_z80MemRead]	; Point to the read array
12766
 
12767
checkLoop212:
12768
		cmp	[edi], word 0ffffh ; End of the list?
12769
		je		memoryRead212
12770
		cmp	edx, [edi]	; Are we smaller?
12771
		jb		nextAddr212		; Yes, go to the next address
12772
		cmp	edx, [edi+4]	; Are we bigger?
12773
		jbe	callRoutine212
12774
 
12775
nextAddr212:
12776
		add	edi, 10h		; Next structure!
12777
		jmp	short checkLoop212
12778
 
12779
callRoutine212:
12780
		call	ReadMemoryByte	; Standard read routine
12781
		mov	dl, al	; Put our returned value here
12782
		mov	ax, [_z80af]	; Get our AF back
12783
		jmp	short readExit212
12784
 
12785
memoryRead212:
12786
		mov	dl, [ebp + edx]	; Get our data
12787
 
12788
readExit212:
12789
		mov	edi, [cyclesRemaining]
12790
		mov	dh, ah	; Store our original flags
12791
		and	dh, 29h	; Keep our old flags
12792
		sahf		; Restore our flags
12793
		test	dl, 008h	; Is it set?
12794
		lahf		; Get our flags back
12795
		and	ah, 0edh	; No Half carry or negative!
12796
		or	ah, 10h	; OR In our half carry
12797
		and	ah, 0d0h ; New flags
12798
		or	ah, dh	; OR In our old flags
12799
		xor	edx, edx
12800
		sub	edi, byte 20
12801
		js	near noMoreExec
12802
		mov	dl, byte [esi]	; Get our next instruction
12803
		inc	esi		; Increment PC
12804
		jmp	dword [z80regular+edx*4]
12805
 
12806
 
12807
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12808
 
12809
DDFDCBInst66:
12810
		mov	dx, [_orgval]	; Get our target address
12811
		mov	[cyclesRemaining], edi
12812
		mov	edi, [_z80MemRead]	; Point to the read array
12813
 
12814
checkLoop213:
12815
		cmp	[edi], word 0ffffh ; End of the list?
12816
		je		memoryRead213
12817
		cmp	edx, [edi]	; Are we smaller?
12818
		jb		nextAddr213		; Yes, go to the next address
12819
		cmp	edx, [edi+4]	; Are we bigger?
12820
		jbe	callRoutine213
12821
 
12822
nextAddr213:
12823
		add	edi, 10h		; Next structure!
12824
		jmp	short checkLoop213
12825
 
12826
callRoutine213:
12827
		call	ReadMemoryByte	; Standard read routine
12828
		mov	dl, al	; Put our returned value here
12829
		mov	ax, [_z80af]	; Get our AF back
12830
		jmp	short readExit213
12831
 
12832
memoryRead213:
12833
		mov	dl, [ebp + edx]	; Get our data
12834
 
12835
readExit213:
12836
		mov	edi, [cyclesRemaining]
12837
		mov	dh, ah	; Store our original flags
12838
		and	dh, 29h	; Keep our old flags
12839
		sahf		; Restore our flags
12840
		test	dl, 010h	; Is it set?
12841
		lahf		; Get our flags back
12842
		and	ah, 0edh	; No Half carry or negative!
12843
		or	ah, 10h	; OR In our half carry
12844
		and	ah, 0d0h ; New flags
12845
		or	ah, dh	; OR In our old flags
12846
		xor	edx, edx
12847
		sub	edi, byte 20
12848
		js	near noMoreExec
12849
		mov	dl, byte [esi]	; Get our next instruction
12850
		inc	esi		; Increment PC
12851
		jmp	dword [z80regular+edx*4]
12852
 
12853
 
12854
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12855
 
12856
DDFDCBInst6e:
12857
		mov	dx, [_orgval]	; Get our target address
12858
		mov	[cyclesRemaining], edi
12859
		mov	edi, [_z80MemRead]	; Point to the read array
12860
 
12861
checkLoop214:
12862
		cmp	[edi], word 0ffffh ; End of the list?
12863
		je		memoryRead214
12864
		cmp	edx, [edi]	; Are we smaller?
12865
		jb		nextAddr214		; Yes, go to the next address
12866
		cmp	edx, [edi+4]	; Are we bigger?
12867
		jbe	callRoutine214
12868
 
12869
nextAddr214:
12870
		add	edi, 10h		; Next structure!
12871
		jmp	short checkLoop214
12872
 
12873
callRoutine214:
12874
		call	ReadMemoryByte	; Standard read routine
12875
		mov	dl, al	; Put our returned value here
12876
		mov	ax, [_z80af]	; Get our AF back
12877
		jmp	short readExit214
12878
 
12879
memoryRead214:
12880
		mov	dl, [ebp + edx]	; Get our data
12881
 
12882
readExit214:
12883
		mov	edi, [cyclesRemaining]
12884
		mov	dh, ah	; Store our original flags
12885
		and	dh, 29h	; Keep our old flags
12886
		sahf		; Restore our flags
12887
		test	dl, 020h	; Is it set?
12888
		lahf		; Get our flags back
12889
		and	ah, 0edh	; No Half carry or negative!
12890
		or	ah, 10h	; OR In our half carry
12891
		and	ah, 0d0h ; New flags
12892
		or	ah, dh	; OR In our old flags
12893
		xor	edx, edx
12894
		sub	edi, byte 20
12895
		js	near noMoreExec
12896
		mov	dl, byte [esi]	; Get our next instruction
12897
		inc	esi		; Increment PC
12898
		jmp	dword [z80regular+edx*4]
12899
 
12900
 
12901
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12902
 
12903
DDFDCBInst76:
12904
		mov	dx, [_orgval]	; Get our target address
12905
		mov	[cyclesRemaining], edi
12906
		mov	edi, [_z80MemRead]	; Point to the read array
12907
 
12908
checkLoop215:
12909
		cmp	[edi], word 0ffffh ; End of the list?
12910
		je		memoryRead215
12911
		cmp	edx, [edi]	; Are we smaller?
12912
		jb		nextAddr215		; Yes, go to the next address
12913
		cmp	edx, [edi+4]	; Are we bigger?
12914
		jbe	callRoutine215
12915
 
12916
nextAddr215:
12917
		add	edi, 10h		; Next structure!
12918
		jmp	short checkLoop215
12919
 
12920
callRoutine215:
12921
		call	ReadMemoryByte	; Standard read routine
12922
		mov	dl, al	; Put our returned value here
12923
		mov	ax, [_z80af]	; Get our AF back
12924
		jmp	short readExit215
12925
 
12926
memoryRead215:
12927
		mov	dl, [ebp + edx]	; Get our data
12928
 
12929
readExit215:
12930
		mov	edi, [cyclesRemaining]
12931
		mov	dh, ah	; Store our original flags
12932
		and	dh, 29h	; Keep our old flags
12933
		sahf		; Restore our flags
12934
		test	dl, 040h	; Is it set?
12935
		lahf		; Get our flags back
12936
		and	ah, 0edh	; No Half carry or negative!
12937
		or	ah, 10h	; OR In our half carry
12938
		and	ah, 0d0h ; New flags
12939
		or	ah, dh	; OR In our old flags
12940
		xor	edx, edx
12941
		sub	edi, byte 20
12942
		js	near noMoreExec
12943
		mov	dl, byte [esi]	; Get our next instruction
12944
		inc	esi		; Increment PC
12945
		jmp	dword [z80regular+edx*4]
12946
 
12947
 
12948
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12949
 
12950
DDFDCBInst7e:
12951
		mov	dx, [_orgval]	; Get our target address
12952
		mov	[cyclesRemaining], edi
12953
		mov	edi, [_z80MemRead]	; Point to the read array
12954
 
12955
checkLoop216:
12956
		cmp	[edi], word 0ffffh ; End of the list?
12957
		je		memoryRead216
12958
		cmp	edx, [edi]	; Are we smaller?
12959
		jb		nextAddr216		; Yes, go to the next address
12960
		cmp	edx, [edi+4]	; Are we bigger?
12961
		jbe	callRoutine216
12962
 
12963
nextAddr216:
12964
		add	edi, 10h		; Next structure!
12965
		jmp	short checkLoop216
12966
 
12967
callRoutine216:
12968
		call	ReadMemoryByte	; Standard read routine
12969
		mov	dl, al	; Put our returned value here
12970
		mov	ax, [_z80af]	; Get our AF back
12971
		jmp	short readExit216
12972
 
12973
memoryRead216:
12974
		mov	dl, [ebp + edx]	; Get our data
12975
 
12976
readExit216:
12977
		mov	edi, [cyclesRemaining]
12978
		mov	dh, ah	; Store our original flags
12979
		and	dh, 29h	; Keep our old flags
12980
		sahf		; Restore our flags
12981
		test	dl, 080h	; Is it set?
12982
		lahf		; Get our flags back
12983
		and	ah, 0edh	; No Half carry or negative!
12984
		or	ah, 10h	; OR In our half carry
12985
		and	ah, 0d0h ; New flags
12986
		or	ah, dh	; OR In our old flags
12987
		xor	edx, edx
12988
		sub	edi, byte 20
12989
		js	near noMoreExec
12990
		mov	dl, byte [esi]	; Get our next instruction
12991
		inc	esi		; Increment PC
12992
		jmp	dword [z80regular+edx*4]
12993
 
12994
 
12995
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
12996
 
12997
DDFDCBInst86:
12998
		mov	dx, [_orgval]	; Get our target address
12999
		mov	[cyclesRemaining], edi
13000
		mov	edi, [_z80MemRead]	; Point to the read array
13001
 
13002
checkLoop217:
13003
		cmp	[edi], word 0ffffh ; End of the list?
13004
		je		memoryRead217
13005
		cmp	edx, [edi]	; Are we smaller?
13006
		jb		nextAddr217		; Yes, go to the next address
13007
		cmp	edx, [edi+4]	; Are we bigger?
13008
		jbe	callRoutine217
13009
 
13010
nextAddr217:
13011
		add	edi, 10h		; Next structure!
13012
		jmp	short checkLoop217
13013
 
13014
callRoutine217:
13015
		call	ReadMemoryByte	; Standard read routine
13016
		mov	dl, al	; Put our returned value here
13017
		mov	ax, [_z80af]	; Get our AF back
13018
		jmp	short readExit217
13019
 
13020
memoryRead217:
13021
		mov	dl, [ebp + edx]	; Get our data
13022
 
13023
readExit217:
13024
		mov	edi, [cyclesRemaining]
13025
		and	dl, 0feh	; Reset the bit
13026
		mov	[cyclesRemaining], edi
13027
		mov	[_z80af], ax	; Store AF
13028
		mov	al, dl	; And our data to write
13029
		mov	dx, [_orgval]
13030
		mov	edi, [_z80MemWrite]	; Point to the write array
13031
 
13032
checkLoop218:
13033
		cmp	[edi], word 0ffffh ; End of our list?
13034
		je	memoryWrite218	; Yes - go write it!
13035
		cmp	dx, [edi]	; Are we smaller?
13036
		jb	nextAddr218	; Yes... go to the next addr
13037
		cmp	dx, [edi+4]	; Are we smaller?
13038
		jbe	callRoutine218	; If not, go call it!
13039
 
13040
nextAddr218:
13041
		add	edi, 10h		; Next structure, please
13042
		jmp	short checkLoop218
13043
 
13044
callRoutine218:
13045
		call	WriteMemoryByte	; Go write the data!
13046
		jmp	short WriteMacroExit218
13047
memoryWrite218:
13048
		mov	[ebp + edx], al
13049
		mov	ax, [_z80af] ; Get our accumulator and flags
13050
WriteMacroExit218:
13051
		mov	edi, [cyclesRemaining]
13052
		xor	edx, edx
13053
		sub	edi, byte 23
13054
		js	near noMoreExec
13055
		mov	dl, byte [esi]	; Get our next instruction
13056
		inc	esi		; Increment PC
13057
		jmp	dword [z80regular+edx*4]
13058
 
13059
 
13060
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13061
 
13062
DDFDCBInst8e:
13063
		mov	dx, [_orgval]	; Get our target address
13064
		mov	[cyclesRemaining], edi
13065
		mov	edi, [_z80MemRead]	; Point to the read array
13066
 
13067
checkLoop219:
13068
		cmp	[edi], word 0ffffh ; End of the list?
13069
		je		memoryRead219
13070
		cmp	edx, [edi]	; Are we smaller?
13071
		jb		nextAddr219		; Yes, go to the next address
13072
		cmp	edx, [edi+4]	; Are we bigger?
13073
		jbe	callRoutine219
13074
 
13075
nextAddr219:
13076
		add	edi, 10h		; Next structure!
13077
		jmp	short checkLoop219
13078
 
13079
callRoutine219:
13080
		call	ReadMemoryByte	; Standard read routine
13081
		mov	dl, al	; Put our returned value here
13082
		mov	ax, [_z80af]	; Get our AF back
13083
		jmp	short readExit219
13084
 
13085
memoryRead219:
13086
		mov	dl, [ebp + edx]	; Get our data
13087
 
13088
readExit219:
13089
		mov	edi, [cyclesRemaining]
13090
		and	dl, 0fdh	; Reset the bit
13091
		mov	[cyclesRemaining], edi
13092
		mov	[_z80af], ax	; Store AF
13093
		mov	al, dl	; And our data to write
13094
		mov	dx, [_orgval]
13095
		mov	edi, [_z80MemWrite]	; Point to the write array
13096
 
13097
checkLoop220:
13098
		cmp	[edi], word 0ffffh ; End of our list?
13099
		je	memoryWrite220	; Yes - go write it!
13100
		cmp	dx, [edi]	; Are we smaller?
13101
		jb	nextAddr220	; Yes... go to the next addr
13102
		cmp	dx, [edi+4]	; Are we smaller?
13103
		jbe	callRoutine220	; If not, go call it!
13104
 
13105
nextAddr220:
13106
		add	edi, 10h		; Next structure, please
13107
		jmp	short checkLoop220
13108
 
13109
callRoutine220:
13110
		call	WriteMemoryByte	; Go write the data!
13111
		jmp	short WriteMacroExit220
13112
memoryWrite220:
13113
		mov	[ebp + edx], al
13114
		mov	ax, [_z80af] ; Get our accumulator and flags
13115
WriteMacroExit220:
13116
		mov	edi, [cyclesRemaining]
13117
		xor	edx, edx
13118
		sub	edi, byte 23
13119
		js	near noMoreExec
13120
		mov	dl, byte [esi]	; Get our next instruction
13121
		inc	esi		; Increment PC
13122
		jmp	dword [z80regular+edx*4]
13123
 
13124
 
13125
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13126
 
13127
DDFDCBInst96:
13128
		mov	dx, [_orgval]	; Get our target address
13129
		mov	[cyclesRemaining], edi
13130
		mov	edi, [_z80MemRead]	; Point to the read array
13131
 
13132
checkLoop221:
13133
		cmp	[edi], word 0ffffh ; End of the list?
13134
		je		memoryRead221
13135
		cmp	edx, [edi]	; Are we smaller?
13136
		jb		nextAddr221		; Yes, go to the next address
13137
		cmp	edx, [edi+4]	; Are we bigger?
13138
		jbe	callRoutine221
13139
 
13140
nextAddr221:
13141
		add	edi, 10h		; Next structure!
13142
		jmp	short checkLoop221
13143
 
13144
callRoutine221:
13145
		call	ReadMemoryByte	; Standard read routine
13146
		mov	dl, al	; Put our returned value here
13147
		mov	ax, [_z80af]	; Get our AF back
13148
		jmp	short readExit221
13149
 
13150
memoryRead221:
13151
		mov	dl, [ebp + edx]	; Get our data
13152
 
13153
readExit221:
13154
		mov	edi, [cyclesRemaining]
13155
		and	dl, 0fbh	; Reset the bit
13156
		mov	[cyclesRemaining], edi
13157
		mov	[_z80af], ax	; Store AF
13158
		mov	al, dl	; And our data to write
13159
		mov	dx, [_orgval]
13160
		mov	edi, [_z80MemWrite]	; Point to the write array
13161
 
13162
checkLoop222:
13163
		cmp	[edi], word 0ffffh ; End of our list?
13164
		je	memoryWrite222	; Yes - go write it!
13165
		cmp	dx, [edi]	; Are we smaller?
13166
		jb	nextAddr222	; Yes... go to the next addr
13167
		cmp	dx, [edi+4]	; Are we smaller?
13168
		jbe	callRoutine222	; If not, go call it!
13169
 
13170
nextAddr222:
13171
		add	edi, 10h		; Next structure, please
13172
		jmp	short checkLoop222
13173
 
13174
callRoutine222:
13175
		call	WriteMemoryByte	; Go write the data!
13176
		jmp	short WriteMacroExit222
13177
memoryWrite222:
13178
		mov	[ebp + edx], al
13179
		mov	ax, [_z80af] ; Get our accumulator and flags
13180
WriteMacroExit222:
13181
		mov	edi, [cyclesRemaining]
13182
		xor	edx, edx
13183
		sub	edi, byte 23
13184
		js	near noMoreExec
13185
		mov	dl, byte [esi]	; Get our next instruction
13186
		inc	esi		; Increment PC
13187
		jmp	dword [z80regular+edx*4]
13188
 
13189
 
13190
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13191
 
13192
DDFDCBInst9e:
13193
		mov	dx, [_orgval]	; Get our target address
13194
		mov	[cyclesRemaining], edi
13195
		mov	edi, [_z80MemRead]	; Point to the read array
13196
 
13197
checkLoop223:
13198
		cmp	[edi], word 0ffffh ; End of the list?
13199
		je		memoryRead223
13200
		cmp	edx, [edi]	; Are we smaller?
13201
		jb		nextAddr223		; Yes, go to the next address
13202
		cmp	edx, [edi+4]	; Are we bigger?
13203
		jbe	callRoutine223
13204
 
13205
nextAddr223:
13206
		add	edi, 10h		; Next structure!
13207
		jmp	short checkLoop223
13208
 
13209
callRoutine223:
13210
		call	ReadMemoryByte	; Standard read routine
13211
		mov	dl, al	; Put our returned value here
13212
		mov	ax, [_z80af]	; Get our AF back
13213
		jmp	short readExit223
13214
 
13215
memoryRead223:
13216
		mov	dl, [ebp + edx]	; Get our data
13217
 
13218
readExit223:
13219
		mov	edi, [cyclesRemaining]
13220
		and	dl, 0f7h	; Reset the bit
13221
		mov	[cyclesRemaining], edi
13222
		mov	[_z80af], ax	; Store AF
13223
		mov	al, dl	; And our data to write
13224
		mov	dx, [_orgval]
13225
		mov	edi, [_z80MemWrite]	; Point to the write array
13226
 
13227
checkLoop224:
13228
		cmp	[edi], word 0ffffh ; End of our list?
13229
		je	memoryWrite224	; Yes - go write it!
13230
		cmp	dx, [edi]	; Are we smaller?
13231
		jb	nextAddr224	; Yes... go to the next addr
13232
		cmp	dx, [edi+4]	; Are we smaller?
13233
		jbe	callRoutine224	; If not, go call it!
13234
 
13235
nextAddr224:
13236
		add	edi, 10h		; Next structure, please
13237
		jmp	short checkLoop224
13238
 
13239
callRoutine224:
13240
		call	WriteMemoryByte	; Go write the data!
13241
		jmp	short WriteMacroExit224
13242
memoryWrite224:
13243
		mov	[ebp + edx], al
13244
		mov	ax, [_z80af] ; Get our accumulator and flags
13245
WriteMacroExit224:
13246
		mov	edi, [cyclesRemaining]
13247
		xor	edx, edx
13248
		sub	edi, byte 23
13249
		js	near noMoreExec
13250
		mov	dl, byte [esi]	; Get our next instruction
13251
		inc	esi		; Increment PC
13252
		jmp	dword [z80regular+edx*4]
13253
 
13254
 
13255
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13256
 
13257
DDFDCBInsta6:
13258
		mov	dx, [_orgval]	; Get our target address
13259
		mov	[cyclesRemaining], edi
13260
		mov	edi, [_z80MemRead]	; Point to the read array
13261
 
13262
checkLoop225:
13263
		cmp	[edi], word 0ffffh ; End of the list?
13264
		je		memoryRead225
13265
		cmp	edx, [edi]	; Are we smaller?
13266
		jb		nextAddr225		; Yes, go to the next address
13267
		cmp	edx, [edi+4]	; Are we bigger?
13268
		jbe	callRoutine225
13269
 
13270
nextAddr225:
13271
		add	edi, 10h		; Next structure!
13272
		jmp	short checkLoop225
13273
 
13274
callRoutine225:
13275
		call	ReadMemoryByte	; Standard read routine
13276
		mov	dl, al	; Put our returned value here
13277
		mov	ax, [_z80af]	; Get our AF back
13278
		jmp	short readExit225
13279
 
13280
memoryRead225:
13281
		mov	dl, [ebp + edx]	; Get our data
13282
 
13283
readExit225:
13284
		mov	edi, [cyclesRemaining]
13285
		and	dl, 0efh	; Reset the bit
13286
		mov	[cyclesRemaining], edi
13287
		mov	[_z80af], ax	; Store AF
13288
		mov	al, dl	; And our data to write
13289
		mov	dx, [_orgval]
13290
		mov	edi, [_z80MemWrite]	; Point to the write array
13291
 
13292
checkLoop226:
13293
		cmp	[edi], word 0ffffh ; End of our list?
13294
		je	memoryWrite226	; Yes - go write it!
13295
		cmp	dx, [edi]	; Are we smaller?
13296
		jb	nextAddr226	; Yes... go to the next addr
13297
		cmp	dx, [edi+4]	; Are we smaller?
13298
		jbe	callRoutine226	; If not, go call it!
13299
 
13300
nextAddr226:
13301
		add	edi, 10h		; Next structure, please
13302
		jmp	short checkLoop226
13303
 
13304
callRoutine226:
13305
		call	WriteMemoryByte	; Go write the data!
13306
		jmp	short WriteMacroExit226
13307
memoryWrite226:
13308
		mov	[ebp + edx], al
13309
		mov	ax, [_z80af] ; Get our accumulator and flags
13310
WriteMacroExit226:
13311
		mov	edi, [cyclesRemaining]
13312
		xor	edx, edx
13313
		sub	edi, byte 23
13314
		js	near noMoreExec
13315
		mov	dl, byte [esi]	; Get our next instruction
13316
		inc	esi		; Increment PC
13317
		jmp	dword [z80regular+edx*4]
13318
 
13319
 
13320
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13321
 
13322
DDFDCBInstae:
13323
		mov	dx, [_orgval]	; Get our target address
13324
		mov	[cyclesRemaining], edi
13325
		mov	edi, [_z80MemRead]	; Point to the read array
13326
 
13327
checkLoop227:
13328
		cmp	[edi], word 0ffffh ; End of the list?
13329
		je		memoryRead227
13330
		cmp	edx, [edi]	; Are we smaller?
13331
		jb		nextAddr227		; Yes, go to the next address
13332
		cmp	edx, [edi+4]	; Are we bigger?
13333
		jbe	callRoutine227
13334
 
13335
nextAddr227:
13336
		add	edi, 10h		; Next structure!
13337
		jmp	short checkLoop227
13338
 
13339
callRoutine227:
13340
		call	ReadMemoryByte	; Standard read routine
13341
		mov	dl, al	; Put our returned value here
13342
		mov	ax, [_z80af]	; Get our AF back
13343
		jmp	short readExit227
13344
 
13345
memoryRead227:
13346
		mov	dl, [ebp + edx]	; Get our data
13347
 
13348
readExit227:
13349
		mov	edi, [cyclesRemaining]
13350
		and	dl, 0dfh	; Reset the bit
13351
		mov	[cyclesRemaining], edi
13352
		mov	[_z80af], ax	; Store AF
13353
		mov	al, dl	; And our data to write
13354
		mov	dx, [_orgval]
13355
		mov	edi, [_z80MemWrite]	; Point to the write array
13356
 
13357
checkLoop228:
13358
		cmp	[edi], word 0ffffh ; End of our list?
13359
		je	memoryWrite228	; Yes - go write it!
13360
		cmp	dx, [edi]	; Are we smaller?
13361
		jb	nextAddr228	; Yes... go to the next addr
13362
		cmp	dx, [edi+4]	; Are we smaller?
13363
		jbe	callRoutine228	; If not, go call it!
13364
 
13365
nextAddr228:
13366
		add	edi, 10h		; Next structure, please
13367
		jmp	short checkLoop228
13368
 
13369
callRoutine228:
13370
		call	WriteMemoryByte	; Go write the data!
13371
		jmp	short WriteMacroExit228
13372
memoryWrite228:
13373
		mov	[ebp + edx], al
13374
		mov	ax, [_z80af] ; Get our accumulator and flags
13375
WriteMacroExit228:
13376
		mov	edi, [cyclesRemaining]
13377
		xor	edx, edx
13378
		sub	edi, byte 23
13379
		js	near noMoreExec
13380
		mov	dl, byte [esi]	; Get our next instruction
13381
		inc	esi		; Increment PC
13382
		jmp	dword [z80regular+edx*4]
13383
 
13384
 
13385
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13386
 
13387
DDFDCBInstb6:
13388
		mov	dx, [_orgval]	; Get our target address
13389
		mov	[cyclesRemaining], edi
13390
		mov	edi, [_z80MemRead]	; Point to the read array
13391
 
13392
checkLoop229:
13393
		cmp	[edi], word 0ffffh ; End of the list?
13394
		je		memoryRead229
13395
		cmp	edx, [edi]	; Are we smaller?
13396
		jb		nextAddr229		; Yes, go to the next address
13397
		cmp	edx, [edi+4]	; Are we bigger?
13398
		jbe	callRoutine229
13399
 
13400
nextAddr229:
13401
		add	edi, 10h		; Next structure!
13402
		jmp	short checkLoop229
13403
 
13404
callRoutine229:
13405
		call	ReadMemoryByte	; Standard read routine
13406
		mov	dl, al	; Put our returned value here
13407
		mov	ax, [_z80af]	; Get our AF back
13408
		jmp	short readExit229
13409
 
13410
memoryRead229:
13411
		mov	dl, [ebp + edx]	; Get our data
13412
 
13413
readExit229:
13414
		mov	edi, [cyclesRemaining]
13415
		and	dl, 0bfh	; Reset the bit
13416
		mov	[cyclesRemaining], edi
13417
		mov	[_z80af], ax	; Store AF
13418
		mov	al, dl	; And our data to write
13419
		mov	dx, [_orgval]
13420
		mov	edi, [_z80MemWrite]	; Point to the write array
13421
 
13422
checkLoop230:
13423
		cmp	[edi], word 0ffffh ; End of our list?
13424
		je	memoryWrite230	; Yes - go write it!
13425
		cmp	dx, [edi]	; Are we smaller?
13426
		jb	nextAddr230	; Yes... go to the next addr
13427
		cmp	dx, [edi+4]	; Are we smaller?
13428
		jbe	callRoutine230	; If not, go call it!
13429
 
13430
nextAddr230:
13431
		add	edi, 10h		; Next structure, please
13432
		jmp	short checkLoop230
13433
 
13434
callRoutine230:
13435
		call	WriteMemoryByte	; Go write the data!
13436
		jmp	short WriteMacroExit230
13437
memoryWrite230:
13438
		mov	[ebp + edx], al
13439
		mov	ax, [_z80af] ; Get our accumulator and flags
13440
WriteMacroExit230:
13441
		mov	edi, [cyclesRemaining]
13442
		xor	edx, edx
13443
		sub	edi, byte 23
13444
		js	near noMoreExec
13445
		mov	dl, byte [esi]	; Get our next instruction
13446
		inc	esi		; Increment PC
13447
		jmp	dword [z80regular+edx*4]
13448
 
13449
 
13450
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13451
 
13452
DDFDCBInstbe:
13453
		mov	dx, [_orgval]	; Get our target address
13454
		mov	[cyclesRemaining], edi
13455
		mov	edi, [_z80MemRead]	; Point to the read array
13456
 
13457
checkLoop231:
13458
		cmp	[edi], word 0ffffh ; End of the list?
13459
		je		memoryRead231
13460
		cmp	edx, [edi]	; Are we smaller?
13461
		jb		nextAddr231		; Yes, go to the next address
13462
		cmp	edx, [edi+4]	; Are we bigger?
13463
		jbe	callRoutine231
13464
 
13465
nextAddr231:
13466
		add	edi, 10h		; Next structure!
13467
		jmp	short checkLoop231
13468
 
13469
callRoutine231:
13470
		call	ReadMemoryByte	; Standard read routine
13471
		mov	dl, al	; Put our returned value here
13472
		mov	ax, [_z80af]	; Get our AF back
13473
		jmp	short readExit231
13474
 
13475
memoryRead231:
13476
		mov	dl, [ebp + edx]	; Get our data
13477
 
13478
readExit231:
13479
		mov	edi, [cyclesRemaining]
13480
		and	dl, 07fh	; Reset the bit
13481
		mov	[cyclesRemaining], edi
13482
		mov	[_z80af], ax	; Store AF
13483
		mov	al, dl	; And our data to write
13484
		mov	dx, [_orgval]
13485
		mov	edi, [_z80MemWrite]	; Point to the write array
13486
 
13487
checkLoop232:
13488
		cmp	[edi], word 0ffffh ; End of our list?
13489
		je	memoryWrite232	; Yes - go write it!
13490
		cmp	dx, [edi]	; Are we smaller?
13491
		jb	nextAddr232	; Yes... go to the next addr
13492
		cmp	dx, [edi+4]	; Are we smaller?
13493
		jbe	callRoutine232	; If not, go call it!
13494
 
13495
nextAddr232:
13496
		add	edi, 10h		; Next structure, please
13497
		jmp	short checkLoop232
13498
 
13499
callRoutine232:
13500
		call	WriteMemoryByte	; Go write the data!
13501
		jmp	short WriteMacroExit232
13502
memoryWrite232:
13503
		mov	[ebp + edx], al
13504
		mov	ax, [_z80af] ; Get our accumulator and flags
13505
WriteMacroExit232:
13506
		mov	edi, [cyclesRemaining]
13507
		xor	edx, edx
13508
		sub	edi, byte 23
13509
		js	near noMoreExec
13510
		mov	dl, byte [esi]	; Get our next instruction
13511
		inc	esi		; Increment PC
13512
		jmp	dword [z80regular+edx*4]
13513
 
13514
 
13515
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13516
 
13517
DDFDCBInstc6:
13518
		mov	dx, [_orgval]	; Get our target address
13519
		mov	[cyclesRemaining], edi
13520
		mov	edi, [_z80MemRead]	; Point to the read array
13521
 
13522
checkLoop233:
13523
		cmp	[edi], word 0ffffh ; End of the list?
13524
		je		memoryRead233
13525
		cmp	edx, [edi]	; Are we smaller?
13526
		jb		nextAddr233		; Yes, go to the next address
13527
		cmp	edx, [edi+4]	; Are we bigger?
13528
		jbe	callRoutine233
13529
 
13530
nextAddr233:
13531
		add	edi, 10h		; Next structure!
13532
		jmp	short checkLoop233
13533
 
13534
callRoutine233:
13535
		call	ReadMemoryByte	; Standard read routine
13536
		mov	dl, al	; Put our returned value here
13537
		mov	ax, [_z80af]	; Get our AF back
13538
		jmp	short readExit233
13539
 
13540
memoryRead233:
13541
		mov	dl, [ebp + edx]	; Get our data
13542
 
13543
readExit233:
13544
		mov	edi, [cyclesRemaining]
13545
		or	dl, 001h	; Set the bit
13546
		mov	[cyclesRemaining], edi
13547
		mov	[_z80af], ax	; Store AF
13548
		mov	al, dl	; And our data to write
13549
		mov	dx, [_orgval]
13550
		mov	edi, [_z80MemWrite]	; Point to the write array
13551
 
13552
checkLoop234:
13553
		cmp	[edi], word 0ffffh ; End of our list?
13554
		je	memoryWrite234	; Yes - go write it!
13555
		cmp	dx, [edi]	; Are we smaller?
13556
		jb	nextAddr234	; Yes... go to the next addr
13557
		cmp	dx, [edi+4]	; Are we smaller?
13558
		jbe	callRoutine234	; If not, go call it!
13559
 
13560
nextAddr234:
13561
		add	edi, 10h		; Next structure, please
13562
		jmp	short checkLoop234
13563
 
13564
callRoutine234:
13565
		call	WriteMemoryByte	; Go write the data!
13566
		jmp	short WriteMacroExit234
13567
memoryWrite234:
13568
		mov	[ebp + edx], al
13569
		mov	ax, [_z80af] ; Get our accumulator and flags
13570
WriteMacroExit234:
13571
		mov	edi, [cyclesRemaining]
13572
		xor	edx, edx
13573
		sub	edi, byte 23
13574
		js	near noMoreExec
13575
		mov	dl, byte [esi]	; Get our next instruction
13576
		inc	esi		; Increment PC
13577
		jmp	dword [z80regular+edx*4]
13578
 
13579
 
13580
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13581
 
13582
DDFDCBInstce:
13583
		mov	dx, [_orgval]	; Get our target address
13584
		mov	[cyclesRemaining], edi
13585
		mov	edi, [_z80MemRead]	; Point to the read array
13586
 
13587
checkLoop235:
13588
		cmp	[edi], word 0ffffh ; End of the list?
13589
		je		memoryRead235
13590
		cmp	edx, [edi]	; Are we smaller?
13591
		jb		nextAddr235		; Yes, go to the next address
13592
		cmp	edx, [edi+4]	; Are we bigger?
13593
		jbe	callRoutine235
13594
 
13595
nextAddr235:
13596
		add	edi, 10h		; Next structure!
13597
		jmp	short checkLoop235
13598
 
13599
callRoutine235:
13600
		call	ReadMemoryByte	; Standard read routine
13601
		mov	dl, al	; Put our returned value here
13602
		mov	ax, [_z80af]	; Get our AF back
13603
		jmp	short readExit235
13604
 
13605
memoryRead235:
13606
		mov	dl, [ebp + edx]	; Get our data
13607
 
13608
readExit235:
13609
		mov	edi, [cyclesRemaining]
13610
		or	dl, 002h	; Set the bit
13611
		mov	[cyclesRemaining], edi
13612
		mov	[_z80af], ax	; Store AF
13613
		mov	al, dl	; And our data to write
13614
		mov	dx, [_orgval]
13615
		mov	edi, [_z80MemWrite]	; Point to the write array
13616
 
13617
checkLoop236:
13618
		cmp	[edi], word 0ffffh ; End of our list?
13619
		je	memoryWrite236	; Yes - go write it!
13620
		cmp	dx, [edi]	; Are we smaller?
13621
		jb	nextAddr236	; Yes... go to the next addr
13622
		cmp	dx, [edi+4]	; Are we smaller?
13623
		jbe	callRoutine236	; If not, go call it!
13624
 
13625
nextAddr236:
13626
		add	edi, 10h		; Next structure, please
13627
		jmp	short checkLoop236
13628
 
13629
callRoutine236:
13630
		call	WriteMemoryByte	; Go write the data!
13631
		jmp	short WriteMacroExit236
13632
memoryWrite236:
13633
		mov	[ebp + edx], al
13634
		mov	ax, [_z80af] ; Get our accumulator and flags
13635
WriteMacroExit236:
13636
		mov	edi, [cyclesRemaining]
13637
		xor	edx, edx
13638
		sub	edi, byte 23
13639
		js	near noMoreExec
13640
		mov	dl, byte [esi]	; Get our next instruction
13641
		inc	esi		; Increment PC
13642
		jmp	dword [z80regular+edx*4]
13643
 
13644
 
13645
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13646
 
13647
DDFDCBInstd6:
13648
		mov	dx, [_orgval]	; Get our target address
13649
		mov	[cyclesRemaining], edi
13650
		mov	edi, [_z80MemRead]	; Point to the read array
13651
 
13652
checkLoop237:
13653
		cmp	[edi], word 0ffffh ; End of the list?
13654
		je		memoryRead237
13655
		cmp	edx, [edi]	; Are we smaller?
13656
		jb		nextAddr237		; Yes, go to the next address
13657
		cmp	edx, [edi+4]	; Are we bigger?
13658
		jbe	callRoutine237
13659
 
13660
nextAddr237:
13661
		add	edi, 10h		; Next structure!
13662
		jmp	short checkLoop237
13663
 
13664
callRoutine237:
13665
		call	ReadMemoryByte	; Standard read routine
13666
		mov	dl, al	; Put our returned value here
13667
		mov	ax, [_z80af]	; Get our AF back
13668
		jmp	short readExit237
13669
 
13670
memoryRead237:
13671
		mov	dl, [ebp + edx]	; Get our data
13672
 
13673
readExit237:
13674
		mov	edi, [cyclesRemaining]
13675
		or	dl, 004h	; Set the bit
13676
		mov	[cyclesRemaining], edi
13677
		mov	[_z80af], ax	; Store AF
13678
		mov	al, dl	; And our data to write
13679
		mov	dx, [_orgval]
13680
		mov	edi, [_z80MemWrite]	; Point to the write array
13681
 
13682
checkLoop238:
13683
		cmp	[edi], word 0ffffh ; End of our list?
13684
		je	memoryWrite238	; Yes - go write it!
13685
		cmp	dx, [edi]	; Are we smaller?
13686
		jb	nextAddr238	; Yes... go to the next addr
13687
		cmp	dx, [edi+4]	; Are we smaller?
13688
		jbe	callRoutine238	; If not, go call it!
13689
 
13690
nextAddr238:
13691
		add	edi, 10h		; Next structure, please
13692
		jmp	short checkLoop238
13693
 
13694
callRoutine238:
13695
		call	WriteMemoryByte	; Go write the data!
13696
		jmp	short WriteMacroExit238
13697
memoryWrite238:
13698
		mov	[ebp + edx], al
13699
		mov	ax, [_z80af] ; Get our accumulator and flags
13700
WriteMacroExit238:
13701
		mov	edi, [cyclesRemaining]
13702
		xor	edx, edx
13703
		sub	edi, byte 23
13704
		js	near noMoreExec
13705
		mov	dl, byte [esi]	; Get our next instruction
13706
		inc	esi		; Increment PC
13707
		jmp	dword [z80regular+edx*4]
13708
 
13709
 
13710
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13711
 
13712
DDFDCBInstde:
13713
		mov	dx, [_orgval]	; Get our target address
13714
		mov	[cyclesRemaining], edi
13715
		mov	edi, [_z80MemRead]	; Point to the read array
13716
 
13717
checkLoop239:
13718
		cmp	[edi], word 0ffffh ; End of the list?
13719
		je		memoryRead239
13720
		cmp	edx, [edi]	; Are we smaller?
13721
		jb		nextAddr239		; Yes, go to the next address
13722
		cmp	edx, [edi+4]	; Are we bigger?
13723
		jbe	callRoutine239
13724
 
13725
nextAddr239:
13726
		add	edi, 10h		; Next structure!
13727
		jmp	short checkLoop239
13728
 
13729
callRoutine239:
13730
		call	ReadMemoryByte	; Standard read routine
13731
		mov	dl, al	; Put our returned value here
13732
		mov	ax, [_z80af]	; Get our AF back
13733
		jmp	short readExit239
13734
 
13735
memoryRead239:
13736
		mov	dl, [ebp + edx]	; Get our data
13737
 
13738
readExit239:
13739
		mov	edi, [cyclesRemaining]
13740
		or	dl, 008h	; Set the bit
13741
		mov	[cyclesRemaining], edi
13742
		mov	[_z80af], ax	; Store AF
13743
		mov	al, dl	; And our data to write
13744
		mov	dx, [_orgval]
13745
		mov	edi, [_z80MemWrite]	; Point to the write array
13746
 
13747
checkLoop240:
13748
		cmp	[edi], word 0ffffh ; End of our list?
13749
		je	memoryWrite240	; Yes - go write it!
13750
		cmp	dx, [edi]	; Are we smaller?
13751
		jb	nextAddr240	; Yes... go to the next addr
13752
		cmp	dx, [edi+4]	; Are we smaller?
13753
		jbe	callRoutine240	; If not, go call it!
13754
 
13755
nextAddr240:
13756
		add	edi, 10h		; Next structure, please
13757
		jmp	short checkLoop240
13758
 
13759
callRoutine240:
13760
		call	WriteMemoryByte	; Go write the data!
13761
		jmp	short WriteMacroExit240
13762
memoryWrite240:
13763
		mov	[ebp + edx], al
13764
		mov	ax, [_z80af] ; Get our accumulator and flags
13765
WriteMacroExit240:
13766
		mov	edi, [cyclesRemaining]
13767
		xor	edx, edx
13768
		sub	edi, byte 23
13769
		js	near noMoreExec
13770
		mov	dl, byte [esi]	; Get our next instruction
13771
		inc	esi		; Increment PC
13772
		jmp	dword [z80regular+edx*4]
13773
 
13774
 
13775
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13776
 
13777
DDFDCBInste6:
13778
		mov	dx, [_orgval]	; Get our target address
13779
		mov	[cyclesRemaining], edi
13780
		mov	edi, [_z80MemRead]	; Point to the read array
13781
 
13782
checkLoop241:
13783
		cmp	[edi], word 0ffffh ; End of the list?
13784
		je		memoryRead241
13785
		cmp	edx, [edi]	; Are we smaller?
13786
		jb		nextAddr241		; Yes, go to the next address
13787
		cmp	edx, [edi+4]	; Are we bigger?
13788
		jbe	callRoutine241
13789
 
13790
nextAddr241:
13791
		add	edi, 10h		; Next structure!
13792
		jmp	short checkLoop241
13793
 
13794
callRoutine241:
13795
		call	ReadMemoryByte	; Standard read routine
13796
		mov	dl, al	; Put our returned value here
13797
		mov	ax, [_z80af]	; Get our AF back
13798
		jmp	short readExit241
13799
 
13800
memoryRead241:
13801
		mov	dl, [ebp + edx]	; Get our data
13802
 
13803
readExit241:
13804
		mov	edi, [cyclesRemaining]
13805
		or	dl, 010h	; Set the bit
13806
		mov	[cyclesRemaining], edi
13807
		mov	[_z80af], ax	; Store AF
13808
		mov	al, dl	; And our data to write
13809
		mov	dx, [_orgval]
13810
		mov	edi, [_z80MemWrite]	; Point to the write array
13811
 
13812
checkLoop242:
13813
		cmp	[edi], word 0ffffh ; End of our list?
13814
		je	memoryWrite242	; Yes - go write it!
13815
		cmp	dx, [edi]	; Are we smaller?
13816
		jb	nextAddr242	; Yes... go to the next addr
13817
		cmp	dx, [edi+4]	; Are we smaller?
13818
		jbe	callRoutine242	; If not, go call it!
13819
 
13820
nextAddr242:
13821
		add	edi, 10h		; Next structure, please
13822
		jmp	short checkLoop242
13823
 
13824
callRoutine242:
13825
		call	WriteMemoryByte	; Go write the data!
13826
		jmp	short WriteMacroExit242
13827
memoryWrite242:
13828
		mov	[ebp + edx], al
13829
		mov	ax, [_z80af] ; Get our accumulator and flags
13830
WriteMacroExit242:
13831
		mov	edi, [cyclesRemaining]
13832
		xor	edx, edx
13833
		sub	edi, byte 23
13834
		js	near noMoreExec
13835
		mov	dl, byte [esi]	; Get our next instruction
13836
		inc	esi		; Increment PC
13837
		jmp	dword [z80regular+edx*4]
13838
 
13839
 
13840
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13841
 
13842
DDFDCBInstee:
13843
		mov	dx, [_orgval]	; Get our target address
13844
		mov	[cyclesRemaining], edi
13845
		mov	edi, [_z80MemRead]	; Point to the read array
13846
 
13847
checkLoop243:
13848
		cmp	[edi], word 0ffffh ; End of the list?
13849
		je		memoryRead243
13850
		cmp	edx, [edi]	; Are we smaller?
13851
		jb		nextAddr243		; Yes, go to the next address
13852
		cmp	edx, [edi+4]	; Are we bigger?
13853
		jbe	callRoutine243
13854
 
13855
nextAddr243:
13856
		add	edi, 10h		; Next structure!
13857
		jmp	short checkLoop243
13858
 
13859
callRoutine243:
13860
		call	ReadMemoryByte	; Standard read routine
13861
		mov	dl, al	; Put our returned value here
13862
		mov	ax, [_z80af]	; Get our AF back
13863
		jmp	short readExit243
13864
 
13865
memoryRead243:
13866
		mov	dl, [ebp + edx]	; Get our data
13867
 
13868
readExit243:
13869
		mov	edi, [cyclesRemaining]
13870
		or	dl, 020h	; Set the bit
13871
		mov	[cyclesRemaining], edi
13872
		mov	[_z80af], ax	; Store AF
13873
		mov	al, dl	; And our data to write
13874
		mov	dx, [_orgval]
13875
		mov	edi, [_z80MemWrite]	; Point to the write array
13876
 
13877
checkLoop244:
13878
		cmp	[edi], word 0ffffh ; End of our list?
13879
		je	memoryWrite244	; Yes - go write it!
13880
		cmp	dx, [edi]	; Are we smaller?
13881
		jb	nextAddr244	; Yes... go to the next addr
13882
		cmp	dx, [edi+4]	; Are we smaller?
13883
		jbe	callRoutine244	; If not, go call it!
13884
 
13885
nextAddr244:
13886
		add	edi, 10h		; Next structure, please
13887
		jmp	short checkLoop244
13888
 
13889
callRoutine244:
13890
		call	WriteMemoryByte	; Go write the data!
13891
		jmp	short WriteMacroExit244
13892
memoryWrite244:
13893
		mov	[ebp + edx], al
13894
		mov	ax, [_z80af] ; Get our accumulator and flags
13895
WriteMacroExit244:
13896
		mov	edi, [cyclesRemaining]
13897
		xor	edx, edx
13898
		sub	edi, byte 23
13899
		js	near noMoreExec
13900
		mov	dl, byte [esi]	; Get our next instruction
13901
		inc	esi		; Increment PC
13902
		jmp	dword [z80regular+edx*4]
13903
 
13904
 
13905
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13906
 
13907
DDFDCBInstf6:
13908
		mov	dx, [_orgval]	; Get our target address
13909
		mov	[cyclesRemaining], edi
13910
		mov	edi, [_z80MemRead]	; Point to the read array
13911
 
13912
checkLoop245:
13913
		cmp	[edi], word 0ffffh ; End of the list?
13914
		je		memoryRead245
13915
		cmp	edx, [edi]	; Are we smaller?
13916
		jb		nextAddr245		; Yes, go to the next address
13917
		cmp	edx, [edi+4]	; Are we bigger?
13918
		jbe	callRoutine245
13919
 
13920
nextAddr245:
13921
		add	edi, 10h		; Next structure!
13922
		jmp	short checkLoop245
13923
 
13924
callRoutine245:
13925
		call	ReadMemoryByte	; Standard read routine
13926
		mov	dl, al	; Put our returned value here
13927
		mov	ax, [_z80af]	; Get our AF back
13928
		jmp	short readExit245
13929
 
13930
memoryRead245:
13931
		mov	dl, [ebp + edx]	; Get our data
13932
 
13933
readExit245:
13934
		mov	edi, [cyclesRemaining]
13935
		or	dl, 040h	; Set the bit
13936
		mov	[cyclesRemaining], edi
13937
		mov	[_z80af], ax	; Store AF
13938
		mov	al, dl	; And our data to write
13939
		mov	dx, [_orgval]
13940
		mov	edi, [_z80MemWrite]	; Point to the write array
13941
 
13942
checkLoop246:
13943
		cmp	[edi], word 0ffffh ; End of our list?
13944
		je	memoryWrite246	; Yes - go write it!
13945
		cmp	dx, [edi]	; Are we smaller?
13946
		jb	nextAddr246	; Yes... go to the next addr
13947
		cmp	dx, [edi+4]	; Are we smaller?
13948
		jbe	callRoutine246	; If not, go call it!
13949
 
13950
nextAddr246:
13951
		add	edi, 10h		; Next structure, please
13952
		jmp	short checkLoop246
13953
 
13954
callRoutine246:
13955
		call	WriteMemoryByte	; Go write the data!
13956
		jmp	short WriteMacroExit246
13957
memoryWrite246:
13958
		mov	[ebp + edx], al
13959
		mov	ax, [_z80af] ; Get our accumulator and flags
13960
WriteMacroExit246:
13961
		mov	edi, [cyclesRemaining]
13962
		xor	edx, edx
13963
		sub	edi, byte 23
13964
		js	near noMoreExec
13965
		mov	dl, byte [esi]	; Get our next instruction
13966
		inc	esi		; Increment PC
13967
		jmp	dword [z80regular+edx*4]
13968
 
13969
 
13970
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
13971
 
13972
DDFDCBInstfe:
13973
		mov	dx, [_orgval]	; Get our target address
13974
		mov	[cyclesRemaining], edi
13975
		mov	edi, [_z80MemRead]	; Point to the read array
13976
 
13977
checkLoop247:
13978
		cmp	[edi], word 0ffffh ; End of the list?
13979
		je		memoryRead247
13980
		cmp	edx, [edi]	; Are we smaller?
13981
		jb		nextAddr247		; Yes, go to the next address
13982
		cmp	edx, [edi+4]	; Are we bigger?
13983
		jbe	callRoutine247
13984
 
13985
nextAddr247:
13986
		add	edi, 10h		; Next structure!
13987
		jmp	short checkLoop247
13988
 
13989
callRoutine247:
13990
		call	ReadMemoryByte	; Standard read routine
13991
		mov	dl, al	; Put our returned value here
13992
		mov	ax, [_z80af]	; Get our AF back
13993
		jmp	short readExit247
13994
 
13995
memoryRead247:
13996
		mov	dl, [ebp + edx]	; Get our data
13997
 
13998
readExit247:
13999
		mov	edi, [cyclesRemaining]
14000
		or	dl, 080h	; Set the bit
14001
		mov	[cyclesRemaining], edi
14002
		mov	[_z80af], ax	; Store AF
14003
		mov	al, dl	; And our data to write
14004
		mov	dx, [_orgval]
14005
		mov	edi, [_z80MemWrite]	; Point to the write array
14006
 
14007
checkLoop248:
14008
		cmp	[edi], word 0ffffh ; End of our list?
14009
		je	memoryWrite248	; Yes - go write it!
14010
		cmp	dx, [edi]	; Are we smaller?
14011
		jb	nextAddr248	; Yes... go to the next addr
14012
		cmp	dx, [edi+4]	; Are we smaller?
14013
		jbe	callRoutine248	; If not, go call it!
14014
 
14015
nextAddr248:
14016
		add	edi, 10h		; Next structure, please
14017
		jmp	short checkLoop248
14018
 
14019
callRoutine248:
14020
		call	WriteMemoryByte	; Go write the data!
14021
		jmp	short WriteMacroExit248
14022
memoryWrite248:
14023
		mov	[ebp + edx], al
14024
		mov	ax, [_z80af] ; Get our accumulator and flags
14025
WriteMacroExit248:
14026
		mov	edi, [cyclesRemaining]
14027
		xor	edx, edx
14028
		sub	edi, byte 23
14029
		js	near noMoreExec
14030
		mov	dl, byte [esi]	; Get our next instruction
14031
		inc	esi		; Increment PC
14032
		jmp	dword [z80regular+edx*4]
14033
 
14034
 
14035
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14036
 
14037
FDInst09:
14038
		mov	dh, ah	; Get our flags
14039
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
14040
		mov	[cyclesRemaining], edi
14041
		mov	di, [_z80iy]	; Get our value
14042
		mov	[_orgval], di	; Store our original value
14043
		add	di, cx
14044
		lahf
14045
		mov	[_z80iy], di	; Store our register back
14046
		mov	di, [_orgval]	; Get original
14047
		xor	di, word [_z80iy] ; XOR It with our computed value
14048
		xor	di, cx
14049
		and	di, 1000h	; Just our half carry
14050
		or		dx, di	; Or in our flags
14051
		and	ah, 01h	; Just carry
14052
		or	ah, dh
14053
		mov	edi, [cyclesRemaining]
14054
		xor	edx, edx
14055
		sub	edi, byte 15
14056
		js	near noMoreExec
14057
		mov	dl, byte [esi]	; Get our next instruction
14058
		inc	esi		; Increment PC
14059
		jmp	dword [z80regular+edx*4]
14060
 
14061
 
14062
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14063
 
14064
FDInst19:
14065
		mov	dh, ah	; Get our flags
14066
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
14067
		mov	[cyclesRemaining], edi
14068
		mov	di, [_z80iy]	; Get our value
14069
		mov	[_orgval], di	; Store our original value
14070
		add	di, word [_z80de]
14071
		lahf
14072
		mov	[_z80iy], di	; Store our register back
14073
		mov	di, [_orgval]	; Get original
14074
		xor	di, word [_z80iy] ; XOR It with our computed value
14075
		xor	di, word [_z80de]
14076
		and	di, 1000h	; Just our half carry
14077
		or		dx, di	; Or in our flags
14078
		and	ah, 01h	; Just carry
14079
		or	ah, dh
14080
		mov	edi, [cyclesRemaining]
14081
		xor	edx, edx
14082
		sub	edi, byte 15
14083
		js	near noMoreExec
14084
		mov	dl, byte [esi]	; Get our next instruction
14085
		inc	esi		; Increment PC
14086
		jmp	dword [z80regular+edx*4]
14087
 
14088
 
14089
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14090
 
14091
FDInst21:
14092
		mov	dx, [esi]	; Get our word to load
14093
		add	esi, 2	; Advance past the word
14094
		mov	[_z80iy], dx ; Store our new value
14095
		xor	edx, edx
14096
		sub	edi, byte 14
14097
		js	near noMoreExec
14098
		mov	dl, byte [esi]	; Get our next instruction
14099
		inc	esi		; Increment PC
14100
		jmp	dword [z80regular+edx*4]
14101
 
14102
 
14103
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14104
 
14105
FDInst22:
14106
		mov	dx, [esi]	 ; Get our address to store
14107
		add	esi, 2
14108
		mov	[_orgval], dx
14109
		mov	dl, [_z80iy]
14110
		mov	[cyclesRemaining], edi
14111
		mov	[_z80af], ax	; Store AF
14112
		mov	al, dl	; And our data to write
14113
		mov	dx, [_orgval]
14114
		mov	edi, [_z80MemWrite]	; Point to the write array
14115
 
14116
checkLoop249:
14117
		cmp	[edi], word 0ffffh ; End of our list?
14118
		je	memoryWrite249	; Yes - go write it!
14119
		cmp	dx, [edi]	; Are we smaller?
14120
		jb	nextAddr249	; Yes... go to the next addr
14121
		cmp	dx, [edi+4]	; Are we smaller?
14122
		jbe	callRoutine249	; If not, go call it!
14123
 
14124
nextAddr249:
14125
		add	edi, 10h		; Next structure, please
14126
		jmp	short checkLoop249
14127
 
14128
callRoutine249:
14129
		call	WriteMemoryByte	; Go write the data!
14130
		jmp	short WriteMacroExit249
14131
memoryWrite249:
14132
		mov	[ebp + edx], al
14133
		mov	ax, [_z80af] ; Get our accumulator and flags
14134
WriteMacroExit249:
14135
		mov	edi, [cyclesRemaining]
14136
		inc	word [_orgval]
14137
		mov	dl, [_z80iy + 1]
14138
		mov	[cyclesRemaining], edi
14139
		mov	[_z80af], ax	; Store AF
14140
		mov	al, dl	; And our data to write
14141
		mov	dx, [_orgval]
14142
		mov	edi, [_z80MemWrite]	; Point to the write array
14143
 
14144
checkLoop250:
14145
		cmp	[edi], word 0ffffh ; End of our list?
14146
		je	memoryWrite250	; Yes - go write it!
14147
		cmp	dx, [edi]	; Are we smaller?
14148
		jb	nextAddr250	; Yes... go to the next addr
14149
		cmp	dx, [edi+4]	; Are we smaller?
14150
		jbe	callRoutine250	; If not, go call it!
14151
 
14152
nextAddr250:
14153
		add	edi, 10h		; Next structure, please
14154
		jmp	short checkLoop250
14155
 
14156
callRoutine250:
14157
		call	WriteMemoryByte	; Go write the data!
14158
		jmp	short WriteMacroExit250
14159
memoryWrite250:
14160
		mov	[ebp + edx], al
14161
		mov	ax, [_z80af] ; Get our accumulator and flags
14162
WriteMacroExit250:
14163
		mov	edi, [cyclesRemaining]
14164
		xor	edx, edx
14165
		sub	edi, byte 20
14166
		js	near noMoreExec
14167
		mov	dl, byte [esi]	; Get our next instruction
14168
		inc	esi		; Increment PC
14169
		jmp	dword [z80regular+edx*4]
14170
 
14171
 
14172
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14173
 
14174
FDInst23:
14175
		inc	word [_z80iy]	; Increment our mz80Index register
14176
		sub	edi, byte 10
14177
		js	near noMoreExec
14178
		mov	dl, byte [esi]	; Get our next instruction
14179
		inc	esi		; Increment PC
14180
		jmp	dword [z80regular+edx*4]
14181
 
14182
 
14183
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14184
 
14185
FDInst24:
14186
		sahf
14187
		inc	byte [_z80iy + 1]
14188
		lahf
14189
		seto	dl
14190
		and	ah, 0fbh	; Knock out parity/overflow
14191
		shl	dl, 2
14192
		or		ah, dl
14193
		and	ah, 0fdh	; Knock out N!
14194
		sub	edi, byte 9
14195
		js	near noMoreExec
14196
		mov	dl, byte [esi]	; Get our next instruction
14197
		inc	esi		; Increment PC
14198
		jmp	dword [z80regular+edx*4]
14199
 
14200
 
14201
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14202
 
14203
FDInst25:
14204
		sahf
14205
		dec	byte [_z80iy + 1]
14206
		lahf
14207
		seto	dl
14208
		and	ah, 0fbh	; Knock out parity/overflow
14209
		shl	dl, 2
14210
		or		ah, dl
14211
		or	ah, 02h	; Set negative!
14212
		sub	edi, byte 9
14213
		js	near noMoreExec
14214
		mov	dl, byte [esi]	; Get our next instruction
14215
		inc	esi		; Increment PC
14216
		jmp	dword [z80regular+edx*4]
14217
 
14218
 
14219
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14220
 
14221
FDInst26:
14222
		mov	dl, [esi]	; Get immediate byte to load
14223
		inc	esi	; Next byte
14224
		mov	byte [_z80iy + 1], dl
14225
		sub	edi, byte 9
14226
		js	near noMoreExec
14227
		mov	dl, byte [esi]	; Get our next instruction
14228
		inc	esi		; Increment PC
14229
		jmp	dword [z80regular+edx*4]
14230
 
14231
 
14232
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14233
 
14234
FDInst29:
14235
		mov	dh, ah	; Get our flags
14236
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
14237
		mov	[cyclesRemaining], edi
14238
		mov	di, [_z80iy]	; Get our value
14239
		mov	[_orgval], di	; Store our original value
14240
		add	di, di
14241
		lahf
14242
		mov	[_z80iy], di	; Store our register back
14243
		mov	di, [_orgval]	; Get original
14244
		xor	di, word [_z80iy] ; XOR It with our computed value
14245
		xor	di, di
14246
		and	di, 1000h	; Just our half carry
14247
		or		dx, di	; Or in our flags
14248
		and	ah, 01h	; Just carry
14249
		or	ah, dh
14250
		mov	edi, [cyclesRemaining]
14251
		xor	edx, edx
14252
		sub	edi, byte 15
14253
		js	near noMoreExec
14254
		mov	dl, byte [esi]	; Get our next instruction
14255
		inc	esi		; Increment PC
14256
		jmp	dword [z80regular+edx*4]
14257
 
14258
 
14259
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14260
 
14261
FDInst2a:
14262
		mov	dx, [esi]	 ; Get our address to store
14263
		add	esi, 2
14264
		mov	[cyclesRemaining], edi
14265
		mov	edi, [_z80MemRead]	; Point to the read array
14266
 
14267
checkLoop251:
14268
		cmp	[edi], word 0ffffh ; End of the list?
14269
		je		memoryRead251
14270
		cmp	dx, [edi]	; Are we smaller?
14271
		jb		nextAddr251		; Yes, go to the next address
14272
		cmp	dx, [edi+4]	; Are we bigger?
14273
		jbe	callRoutine251
14274
 
14275
nextAddr251:
14276
		add	edi, 10h		; Next structure!
14277
		jmp	short checkLoop251
14278
 
14279
callRoutine251:
14280
		push	ax		; Save this for later
14281
		push	dx		; Save address
14282
		call	ReadMemoryByte	; Standard read routine
14283
		pop	dx		; Restore our address
14284
		inc	dx		; Next byte, please
14285
		push	ax		; Save returned byte
14286
		call	ReadMemoryByte	; Standard read routine
14287
		xchg	ah, al	; Swap for endian's sake
14288
		pop	dx	; Restore LSB
14289
		mov	dh, ah	; Our word is now in DX
14290
		pop	ax		; Restore this
14291
		mov	[_z80iy], dx	; Store our word
14292
		jmp	readExit251
14293
 
14294
memoryRead251:
14295
		mov	dx, [ebp + edx]
14296
		mov	[_z80iy], dx
14297
readExit251:
14298
		mov	edi, [cyclesRemaining]
14299
		xor	edx, edx
14300
		sub	edi, byte 20
14301
		js	near noMoreExec
14302
		mov	dl, byte [esi]	; Get our next instruction
14303
		inc	esi		; Increment PC
14304
		jmp	dword [z80regular+edx*4]
14305
 
14306
 
14307
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14308
 
14309
FDInst2b:
14310
		dec	word [_z80iy]	; Increment our mz80Index register
14311
		sub	edi, byte 10
14312
		js	near noMoreExec
14313
		mov	dl, byte [esi]	; Get our next instruction
14314
		inc	esi		; Increment PC
14315
		jmp	dword [z80regular+edx*4]
14316
 
14317
 
14318
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14319
 
14320
FDInst2c:
14321
		sahf
14322
		inc	byte [_z80iy]
14323
		lahf
14324
		seto	dl
14325
		and	ah, 0fbh	; Knock out parity/overflow
14326
		shl	dl, 2
14327
		or		ah, dl
14328
		and	ah, 0fdh	; Knock out N!
14329
		sub	edi, byte 9
14330
		js	near noMoreExec
14331
		mov	dl, byte [esi]	; Get our next instruction
14332
		inc	esi		; Increment PC
14333
		jmp	dword [z80regular+edx*4]
14334
 
14335
 
14336
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14337
 
14338
FDInst2d:
14339
		sahf
14340
		dec	byte [_z80iy]
14341
		lahf
14342
		seto	dl
14343
		and	ah, 0fbh	; Knock out parity/overflow
14344
		shl	dl, 2
14345
		or		ah, dl
14346
		or	ah, 02h	; Set negative!
14347
		sub	edi, byte 9
14348
		js	near noMoreExec
14349
		mov	dl, byte [esi]	; Get our next instruction
14350
		inc	esi		; Increment PC
14351
		jmp	dword [z80regular+edx*4]
14352
 
14353
 
14354
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14355
 
14356
FDInst2e:
14357
		mov	dl, [esi]	; Get immediate byte to load
14358
		inc	esi	; Next byte
14359
		mov	byte [_z80iy], dl
14360
		sub	edi, byte 9
14361
		js	near noMoreExec
14362
		mov	dl, byte [esi]	; Get our next instruction
14363
		inc	esi		; Increment PC
14364
		jmp	dword [z80regular+edx*4]
14365
 
14366
 
14367
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14368
 
14369
FDInst34:
14370
		mov	dl, [esi]	; Fetch our offset
14371
		inc	esi		; Move past the offset
14372
		or	dl, dl		; Is this bad boy signed?
14373
		jns	notSigned252	; Nope!
14374
		dec	dh			; Make it FFable
14375
notSigned252:
14376
		add	dx, [_z80iy]	; Our offset!
14377
		mov	[_orgval], dx
14378
		mov	[cyclesRemaining], edi
14379
		mov	edi, [_z80MemRead]	; Point to the read array
14380
 
14381
checkLoop253:
14382
		cmp	[edi], word 0ffffh ; End of the list?
14383
		je		memoryRead253
14384
		cmp	edx, [edi]	; Are we smaller?
14385
		jb		nextAddr253		; Yes, go to the next address
14386
		cmp	edx, [edi+4]	; Are we bigger?
14387
		jbe	callRoutine253
14388
 
14389
nextAddr253:
14390
		add	edi, 10h		; Next structure!
14391
		jmp	short checkLoop253
14392
 
14393
callRoutine253:
14394
		call	ReadMemoryByte	; Standard read routine
14395
		mov	dl, al	; Put our returned value here
14396
		mov	ax, [_z80af]	; Get our AF back
14397
		jmp	short readExit253
14398
 
14399
memoryRead253:
14400
		mov	dl, [ebp + edx]	; Get our data
14401
 
14402
readExit253:
14403
		mov	edi, [cyclesRemaining]
14404
		sahf
14405
		inc	dl
14406
		lahf
14407
		o16	pushf
14408
		shl	edx, 16
14409
		and	ah, 0fbh	;	Knock out parity/overflow
14410
		pop	dx
14411
		and	dh, 08h ; Just the overflow
14412
		shr	dh, 1	; Shift it into position
14413
		or	ah, dh	; OR It in with the real flags
14414
		shr	edx, 16
14415
		and	ah, 0fdh	; Knock out N!
14416
		mov	[cyclesRemaining], edi
14417
		mov	[_z80af], ax	; Store AF
14418
		mov	al, dl	; And our data to write
14419
		mov	dx, [_orgval]
14420
		mov	edi, [_z80MemWrite]	; Point to the write array
14421
 
14422
checkLoop254:
14423
		cmp	[edi], word 0ffffh ; End of our list?
14424
		je	memoryWrite254	; Yes - go write it!
14425
		cmp	dx, [edi]	; Are we smaller?
14426
		jb	nextAddr254	; Yes... go to the next addr
14427
		cmp	dx, [edi+4]	; Are we smaller?
14428
		jbe	callRoutine254	; If not, go call it!
14429
 
14430
nextAddr254:
14431
		add	edi, 10h		; Next structure, please
14432
		jmp	short checkLoop254
14433
 
14434
callRoutine254:
14435
		call	WriteMemoryByte	; Go write the data!
14436
		jmp	short WriteMacroExit254
14437
memoryWrite254:
14438
		mov	[ebp + edx], al
14439
		mov	ax, [_z80af] ; Get our accumulator and flags
14440
WriteMacroExit254:
14441
		mov	edi, [cyclesRemaining]
14442
		xor	edx, edx
14443
		sub	edi, byte 23
14444
		js	near noMoreExec
14445
		mov	dl, byte [esi]	; Get our next instruction
14446
		inc	esi		; Increment PC
14447
		jmp	dword [z80regular+edx*4]
14448
 
14449
 
14450
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14451
 
14452
FDInst35:
14453
		mov	dl, [esi]	; Fetch our offset
14454
		inc	esi		; Move past the offset
14455
		or	dl, dl		; Is this bad boy signed?
14456
		jns	notSigned255	; Nope!
14457
		dec	dh			; Make it FFable
14458
notSigned255:
14459
		add	dx, [_z80iy]	; Our offset!
14460
		mov	[_orgval], dx
14461
		mov	[cyclesRemaining], edi
14462
		mov	edi, [_z80MemRead]	; Point to the read array
14463
 
14464
checkLoop256:
14465
		cmp	[edi], word 0ffffh ; End of the list?
14466
		je		memoryRead256
14467
		cmp	edx, [edi]	; Are we smaller?
14468
		jb		nextAddr256		; Yes, go to the next address
14469
		cmp	edx, [edi+4]	; Are we bigger?
14470
		jbe	callRoutine256
14471
 
14472
nextAddr256:
14473
		add	edi, 10h		; Next structure!
14474
		jmp	short checkLoop256
14475
 
14476
callRoutine256:
14477
		call	ReadMemoryByte	; Standard read routine
14478
		mov	dl, al	; Put our returned value here
14479
		mov	ax, [_z80af]	; Get our AF back
14480
		jmp	short readExit256
14481
 
14482
memoryRead256:
14483
		mov	dl, [ebp + edx]	; Get our data
14484
 
14485
readExit256:
14486
		mov	edi, [cyclesRemaining]
14487
		sahf
14488
		dec	dl
14489
		lahf
14490
		o16	pushf
14491
		shl	edx, 16
14492
		and	ah, 0fbh	;	Knock out parity/overflow
14493
		pop	dx
14494
		and	dh, 08h ; Just the overflow
14495
		shr	dh, 1	; Shift it into position
14496
		or	ah, dh	; OR It in with the real flags
14497
		shr	edx, 16
14498
		or		ah, 02h	; Make it N!
14499
		mov	[cyclesRemaining], edi
14500
		mov	[_z80af], ax	; Store AF
14501
		mov	al, dl	; And our data to write
14502
		mov	dx, [_orgval]
14503
		mov	edi, [_z80MemWrite]	; Point to the write array
14504
 
14505
checkLoop257:
14506
		cmp	[edi], word 0ffffh ; End of our list?
14507
		je	memoryWrite257	; Yes - go write it!
14508
		cmp	dx, [edi]	; Are we smaller?
14509
		jb	nextAddr257	; Yes... go to the next addr
14510
		cmp	dx, [edi+4]	; Are we smaller?
14511
		jbe	callRoutine257	; If not, go call it!
14512
 
14513
nextAddr257:
14514
		add	edi, 10h		; Next structure, please
14515
		jmp	short checkLoop257
14516
 
14517
callRoutine257:
14518
		call	WriteMemoryByte	; Go write the data!
14519
		jmp	short WriteMacroExit257
14520
memoryWrite257:
14521
		mov	[ebp + edx], al
14522
		mov	ax, [_z80af] ; Get our accumulator and flags
14523
WriteMacroExit257:
14524
		mov	edi, [cyclesRemaining]
14525
		xor	edx, edx
14526
		sub	edi, byte 23
14527
		js	near noMoreExec
14528
		mov	dl, byte [esi]	; Get our next instruction
14529
		inc	esi		; Increment PC
14530
		jmp	dword [z80regular+edx*4]
14531
 
14532
 
14533
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14534
 
14535
FDInst36:
14536
		mov	dx, [esi]	; Get our address
14537
		add	esi, 2	; Skip over our storage bytes
14538
		mov	[cyclesRemaining], edi
14539
		mov	di, dx	; Store it here for later
14540
		xor	dh, dh
14541
		or	dl, dl
14542
		jns	noNegate258
14543
		dec	dh
14544
noNegate258:
14545
		add	dx, [_z80iy]	; Add in our index
14546
		mov	[_orgval], dx	; Store our address to write to
14547
		mov	dx, di
14548
		xchg	dh, dl
14549
		mov	edi, [cyclesRemaining]
14550
		mov	[cyclesRemaining], edi
14551
		mov	[_z80af], ax	; Store AF
14552
		mov	al, dl	; And our data to write
14553
		mov	dx, [_orgval]
14554
		mov	edi, [_z80MemWrite]	; Point to the write array
14555
 
14556
checkLoop258:
14557
		cmp	[edi], word 0ffffh ; End of our list?
14558
		je	memoryWrite258	; Yes - go write it!
14559
		cmp	dx, [edi]	; Are we smaller?
14560
		jb	nextAddr258	; Yes... go to the next addr
14561
		cmp	dx, [edi+4]	; Are we smaller?
14562
		jbe	callRoutine258	; If not, go call it!
14563
 
14564
nextAddr258:
14565
		add	edi, 10h		; Next structure, please
14566
		jmp	short checkLoop258
14567
 
14568
callRoutine258:
14569
		call	WriteMemoryByte	; Go write the data!
14570
		jmp	short WriteMacroExit258
14571
memoryWrite258:
14572
		mov	[ebp + edx], al
14573
		mov	ax, [_z80af] ; Get our accumulator and flags
14574
WriteMacroExit258:
14575
		mov	edi, [cyclesRemaining]
14576
		xor	edx, edx
14577
		sub	edi, byte 19
14578
		js	near noMoreExec
14579
		mov	dl, byte [esi]	; Get our next instruction
14580
		inc	esi		; Increment PC
14581
		jmp	dword [z80regular+edx*4]
14582
 
14583
 
14584
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14585
 
14586
FDInst39:
14587
		mov	dh, ah	; Get our flags
14588
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
14589
		mov	[cyclesRemaining], edi
14590
		mov	di, [_z80iy]	; Get our value
14591
		mov	[_orgval], di	; Store our original value
14592
		add	di, word [_z80sp]
14593
		lahf
14594
		mov	[_z80iy], di	; Store our register back
14595
		mov	di, [_orgval]	; Get original
14596
		xor	di, word [_z80iy] ; XOR It with our computed value
14597
		xor	di, word [_z80sp]
14598
		and	di, 1000h	; Just our half carry
14599
		or		dx, di	; Or in our flags
14600
		and	ah, 01h	; Just carry
14601
		or	ah, dh
14602
		mov	edi, [cyclesRemaining]
14603
		xor	edx, edx
14604
		sub	edi, byte 15
14605
		js	near noMoreExec
14606
		mov	dl, byte [esi]	; Get our next instruction
14607
		inc	esi		; Increment PC
14608
		jmp	dword [z80regular+edx*4]
14609
 
14610
 
14611
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14612
 
14613
FDInst44:
14614
		mov	ch, byte [_z80iy + 1]
14615
		xor	edx, edx
14616
		sub	edi, byte 9
14617
		js	near noMoreExec
14618
		mov	dl, byte [esi]	; Get our next instruction
14619
		inc	esi		; Increment PC
14620
		jmp	dword [z80regular+edx*4]
14621
 
14622
 
14623
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14624
 
14625
FDInst45:
14626
		mov	ch, byte [_z80iy + 0]
14627
		xor	edx, edx
14628
		sub	edi, byte 9
14629
		js	near noMoreExec
14630
		mov	dl, byte [esi]	; Get our next instruction
14631
		inc	esi		; Increment PC
14632
		jmp	dword [z80regular+edx*4]
14633
 
14634
 
14635
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14636
 
14637
FDInst46:
14638
		mov	dl, [esi]	; Fetch our offset
14639
		inc	esi		; Move past the offset
14640
		or	dl, dl		; Is this bad boy signed?
14641
		jns	notSigned260	; Nope!
14642
		dec	dh			; Make it FFable
14643
notSigned260:
14644
		add	dx, [_z80iy]	; Our offset!
14645
		mov	[cyclesRemaining], edi
14646
		mov	edi, [_z80MemRead]	; Point to the read array
14647
 
14648
checkLoop261:
14649
		cmp	[edi], word 0ffffh ; End of the list?
14650
		je		memoryRead261
14651
		cmp	edx, [edi]	; Are we smaller?
14652
		jb		nextAddr261		; Yes, go to the next address
14653
		cmp	edx, [edi+4]	; Are we bigger?
14654
		jbe	callRoutine261
14655
 
14656
nextAddr261:
14657
		add	edi, 10h		; Next structure!
14658
		jmp	short checkLoop261
14659
 
14660
callRoutine261:
14661
		call	ReadMemoryByte	; Standard read routine
14662
		mov	ch, al	; Put our returned value here
14663
		mov	ax, [_z80af]	; Get our AF back
14664
		jmp	short readExit261
14665
 
14666
memoryRead261:
14667
		mov	ch, [ebp + edx]	; Get our data
14668
 
14669
readExit261:
14670
		mov	edi, [cyclesRemaining]
14671
		xor	edx, edx	; Make sure we don't hose things
14672
		sub	edi, byte 19
14673
		js	near noMoreExec
14674
		mov	dl, byte [esi]	; Get our next instruction
14675
		inc	esi		; Increment PC
14676
		jmp	dword [z80regular+edx*4]
14677
 
14678
 
14679
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14680
 
14681
FDInst4c:
14682
		mov	cl, byte [_z80iy + 1]
14683
		xor	edx, edx
14684
		sub	edi, byte 9
14685
		js	near noMoreExec
14686
		mov	dl, byte [esi]	; Get our next instruction
14687
		inc	esi		; Increment PC
14688
		jmp	dword [z80regular+edx*4]
14689
 
14690
 
14691
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14692
 
14693
FDInst4d:
14694
		mov	cl, byte [_z80iy + 0]
14695
		xor	edx, edx
14696
		sub	edi, byte 9
14697
		js	near noMoreExec
14698
		mov	dl, byte [esi]	; Get our next instruction
14699
		inc	esi		; Increment PC
14700
		jmp	dword [z80regular+edx*4]
14701
 
14702
 
14703
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14704
 
14705
FDInst4e:
14706
		mov	dl, [esi]	; Fetch our offset
14707
		inc	esi		; Move past the offset
14708
		or	dl, dl		; Is this bad boy signed?
14709
		jns	notSigned263	; Nope!
14710
		dec	dh			; Make it FFable
14711
notSigned263:
14712
		add	dx, [_z80iy]	; Our offset!
14713
		mov	[cyclesRemaining], edi
14714
		mov	edi, [_z80MemRead]	; Point to the read array
14715
 
14716
checkLoop264:
14717
		cmp	[edi], word 0ffffh ; End of the list?
14718
		je		memoryRead264
14719
		cmp	edx, [edi]	; Are we smaller?
14720
		jb		nextAddr264		; Yes, go to the next address
14721
		cmp	edx, [edi+4]	; Are we bigger?
14722
		jbe	callRoutine264
14723
 
14724
nextAddr264:
14725
		add	edi, 10h		; Next structure!
14726
		jmp	short checkLoop264
14727
 
14728
callRoutine264:
14729
		call	ReadMemoryByte	; Standard read routine
14730
		mov	cl, al	; Put our returned value here
14731
		mov	ax, [_z80af]	; Get our AF back
14732
		jmp	short readExit264
14733
 
14734
memoryRead264:
14735
		mov	cl, [ebp + edx]	; Get our data
14736
 
14737
readExit264:
14738
		mov	edi, [cyclesRemaining]
14739
		xor	edx, edx	; Make sure we don't hose things
14740
		sub	edi, byte 19
14741
		js	near noMoreExec
14742
		mov	dl, byte [esi]	; Get our next instruction
14743
		inc	esi		; Increment PC
14744
		jmp	dword [z80regular+edx*4]
14745
 
14746
 
14747
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14748
 
14749
FDInst54:
14750
		mov	dx, [_z80de]	; Get a usable copy of DE here
14751
		mov	dh, byte [_z80iy + 1]
14752
		mov	[_z80de], dx	; Put it back!
14753
		xor	edx, edx
14754
		sub	edi, byte 9
14755
		js	near noMoreExec
14756
		mov	dl, byte [esi]	; Get our next instruction
14757
		inc	esi		; Increment PC
14758
		jmp	dword [z80regular+edx*4]
14759
 
14760
 
14761
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14762
 
14763
FDInst55:
14764
		mov	dx, [_z80de]	; Get a usable copy of DE here
14765
		mov	dh, byte [_z80iy + 0]
14766
		mov	[_z80de], dx	; Put it back!
14767
		xor	edx, edx
14768
		sub	edi, byte 9
14769
		js	near noMoreExec
14770
		mov	dl, byte [esi]	; Get our next instruction
14771
		inc	esi		; Increment PC
14772
		jmp	dword [z80regular+edx*4]
14773
 
14774
 
14775
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14776
 
14777
FDInst56:
14778
		mov	dl, [esi]	; Fetch our offset
14779
		inc	esi		; Move past the offset
14780
		or	dl, dl		; Is this bad boy signed?
14781
		jns	notSigned266	; Nope!
14782
		dec	dh			; Make it FFable
14783
notSigned266:
14784
		add	dx, [_z80iy]	; Our offset!
14785
		mov	[cyclesRemaining], edi
14786
		mov	edi, [_z80MemRead]	; Point to the read array
14787
 
14788
checkLoop267:
14789
		cmp	[edi], word 0ffffh ; End of the list?
14790
		je		memoryRead267
14791
		cmp	edx, [edi]	; Are we smaller?
14792
		jb		nextAddr267		; Yes, go to the next address
14793
		cmp	edx, [edi+4]	; Are we bigger?
14794
		jbe	callRoutine267
14795
 
14796
nextAddr267:
14797
		add	edi, 10h		; Next structure!
14798
		jmp	short checkLoop267
14799
 
14800
callRoutine267:
14801
		call	ReadMemoryByte	; Standard read routine
14802
		mov	byte [_z80de + 1], al	; Put our returned value here
14803
		mov	ax, [_z80af]	; Get our AF back
14804
		jmp	short readExit267
14805
 
14806
memoryRead267:
14807
		mov	di, dx
14808
		mov	dl, [ebp + edx]
14809
		mov	byte [_z80de + 1], dl
14810
		mov	dx, di
14811
readExit267:
14812
		mov	edi, [cyclesRemaining]
14813
		xor	edx, edx	; Make sure we don't hose things
14814
		sub	edi, byte 19
14815
		js	near noMoreExec
14816
		mov	dl, byte [esi]	; Get our next instruction
14817
		inc	esi		; Increment PC
14818
		jmp	dword [z80regular+edx*4]
14819
 
14820
 
14821
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14822
 
14823
FDInst5c:
14824
		mov	dx, [_z80de]	; Get a usable copy of DE here
14825
		mov	dl, byte [_z80iy + 1]
14826
		mov	[_z80de], dx	; Put it back!
14827
		xor	edx, edx
14828
		sub	edi, byte 9
14829
		js	near noMoreExec
14830
		mov	dl, byte [esi]	; Get our next instruction
14831
		inc	esi		; Increment PC
14832
		jmp	dword [z80regular+edx*4]
14833
 
14834
 
14835
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14836
 
14837
FDInst5d:
14838
		mov	dx, [_z80de]	; Get a usable copy of DE here
14839
		mov	dl, byte [_z80iy + 0]
14840
		mov	[_z80de], dx	; Put it back!
14841
		xor	edx, edx
14842
		sub	edi, byte 9
14843
		js	near noMoreExec
14844
		mov	dl, byte [esi]	; Get our next instruction
14845
		inc	esi		; Increment PC
14846
		jmp	dword [z80regular+edx*4]
14847
 
14848
 
14849
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14850
 
14851
FDInst5e:
14852
		mov	dl, [esi]	; Fetch our offset
14853
		inc	esi		; Move past the offset
14854
		or	dl, dl		; Is this bad boy signed?
14855
		jns	notSigned269	; Nope!
14856
		dec	dh			; Make it FFable
14857
notSigned269:
14858
		add	dx, [_z80iy]	; Our offset!
14859
		mov	[cyclesRemaining], edi
14860
		mov	edi, [_z80MemRead]	; Point to the read array
14861
 
14862
checkLoop270:
14863
		cmp	[edi], word 0ffffh ; End of the list?
14864
		je		memoryRead270
14865
		cmp	edx, [edi]	; Are we smaller?
14866
		jb		nextAddr270		; Yes, go to the next address
14867
		cmp	edx, [edi+4]	; Are we bigger?
14868
		jbe	callRoutine270
14869
 
14870
nextAddr270:
14871
		add	edi, 10h		; Next structure!
14872
		jmp	short checkLoop270
14873
 
14874
callRoutine270:
14875
		call	ReadMemoryByte	; Standard read routine
14876
		mov	byte [_z80de], al	; Put our returned value here
14877
		mov	ax, [_z80af]	; Get our AF back
14878
		jmp	short readExit270
14879
 
14880
memoryRead270:
14881
		mov	di, dx
14882
		mov	dl, [ebp + edx]
14883
		mov	byte [_z80de], dl
14884
		mov	dx, di
14885
readExit270:
14886
		mov	edi, [cyclesRemaining]
14887
		xor	edx, edx	; Make sure we don't hose things
14888
		sub	edi, byte 19
14889
		js	near noMoreExec
14890
		mov	dl, byte [esi]	; Get our next instruction
14891
		inc	esi		; Increment PC
14892
		jmp	dword [z80regular+edx*4]
14893
 
14894
 
14895
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14896
 
14897
FDInst60:
14898
		mov   byte [_z80iy + 1], ch
14899
		xor	edx, edx
14900
		sub	edi, byte 9
14901
		js	near noMoreExec
14902
		mov	dl, byte [esi]	; Get our next instruction
14903
		inc	esi		; Increment PC
14904
		jmp	dword [z80regular+edx*4]
14905
 
14906
 
14907
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14908
 
14909
FDInst61:
14910
		mov   byte [_z80iy + 1], cl
14911
		xor	edx, edx
14912
		sub	edi, byte 9
14913
		js	near noMoreExec
14914
		mov	dl, byte [esi]	; Get our next instruction
14915
		inc	esi		; Increment PC
14916
		jmp	dword [z80regular+edx*4]
14917
 
14918
 
14919
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14920
 
14921
FDInst62:
14922
	mov	dx, [_z80de]	; Get DE
14923
		mov   byte [_z80iy + 1], dh
14924
		xor	edx, edx
14925
		sub	edi, byte 9
14926
		js	near noMoreExec
14927
		mov	dl, byte [esi]	; Get our next instruction
14928
		inc	esi		; Increment PC
14929
		jmp	dword [z80regular+edx*4]
14930
 
14931
 
14932
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14933
 
14934
FDInst63:
14935
	mov	dx, [_z80de]	; Get DE
14936
		mov   byte [_z80iy + 1], dl
14937
		xor	edx, edx
14938
		sub	edi, byte 9
14939
		js	near noMoreExec
14940
		mov	dl, byte [esi]	; Get our next instruction
14941
		inc	esi		; Increment PC
14942
		jmp	dword [z80regular+edx*4]
14943
 
14944
 
14945
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14946
 
14947
FDInst64:
14948
	mov	dh, byte [_z80iy + 1]
14949
		mov   byte [_z80iy + 1], bh
14950
		xor	edx, edx
14951
		sub	edi, byte 9
14952
		js	near noMoreExec
14953
		mov	dl, byte [esi]	; Get our next instruction
14954
		inc	esi		; Increment PC
14955
		jmp	dword [z80regular+edx*4]
14956
 
14957
 
14958
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14959
 
14960
FDInst65:
14961
	mov	dl, byte [_z80iy]
14962
		mov   byte [_z80iy + 1], bl
14963
		xor	edx, edx
14964
		sub	edi, byte 9
14965
		js	near noMoreExec
14966
		mov	dl, byte [esi]	; Get our next instruction
14967
		inc	esi		; Increment PC
14968
		jmp	dword [z80regular+edx*4]
14969
 
14970
 
14971
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
14972
 
14973
FDInst66:
14974
		mov	dl, [esi]	; Fetch our offset
14975
		inc	esi		; Move past the offset
14976
		or	dl, dl		; Is this bad boy signed?
14977
		jns	notSigned272	; Nope!
14978
		dec	dh			; Make it FFable
14979
notSigned272:
14980
		add	dx, [_z80iy]	; Our offset!
14981
		mov	[cyclesRemaining], edi
14982
		mov	edi, [_z80MemRead]	; Point to the read array
14983
 
14984
checkLoop273:
14985
		cmp	[edi], word 0ffffh ; End of the list?
14986
		je		memoryRead273
14987
		cmp	edx, [edi]	; Are we smaller?
14988
		jb		nextAddr273		; Yes, go to the next address
14989
		cmp	edx, [edi+4]	; Are we bigger?
14990
		jbe	callRoutine273
14991
 
14992
nextAddr273:
14993
		add	edi, 10h		; Next structure!
14994
		jmp	short checkLoop273
14995
 
14996
callRoutine273:
14997
		call	ReadMemoryByte	; Standard read routine
14998
		mov	bh, al	; Put our returned value here
14999
		mov	ax, [_z80af]	; Get our AF back
15000
		jmp	short readExit273
15001
 
15002
memoryRead273:
15003
		mov	bh, [ebp + edx]	; Get our data
15004
 
15005
readExit273:
15006
		mov	edi, [cyclesRemaining]
15007
		xor	edx, edx	; Make sure we don't hose things
15008
		sub	edi, byte 19
15009
		js	near noMoreExec
15010
		mov	dl, byte [esi]	; Get our next instruction
15011
		inc	esi		; Increment PC
15012
		jmp	dword [z80regular+edx*4]
15013
 
15014
 
15015
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15016
 
15017
FDInst67:
15018
		mov   byte [_z80iy + 1], al
15019
		xor	edx, edx
15020
		sub	edi, byte 9
15021
		js	near noMoreExec
15022
		mov	dl, byte [esi]	; Get our next instruction
15023
		inc	esi		; Increment PC
15024
		jmp	dword [z80regular+edx*4]
15025
 
15026
 
15027
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15028
 
15029
FDInst68:
15030
		mov   byte [_z80iy + 0], ch
15031
		xor	edx, edx
15032
		sub	edi, byte 9
15033
		js	near noMoreExec
15034
		mov	dl, byte [esi]	; Get our next instruction
15035
		inc	esi		; Increment PC
15036
		jmp	dword [z80regular+edx*4]
15037
 
15038
 
15039
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15040
 
15041
FDInst69:
15042
		mov   byte [_z80iy + 0], cl
15043
		xor	edx, edx
15044
		sub	edi, byte 9
15045
		js	near noMoreExec
15046
		mov	dl, byte [esi]	; Get our next instruction
15047
		inc	esi		; Increment PC
15048
		jmp	dword [z80regular+edx*4]
15049
 
15050
 
15051
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15052
 
15053
FDInst6a:
15054
	mov	dx, [_z80de]	; Get DE
15055
		mov   byte [_z80iy + 0], dh
15056
		xor	edx, edx
15057
		sub	edi, byte 9
15058
		js	near noMoreExec
15059
		mov	dl, byte [esi]	; Get our next instruction
15060
		inc	esi		; Increment PC
15061
		jmp	dword [z80regular+edx*4]
15062
 
15063
 
15064
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15065
 
15066
FDInst6b:
15067
	mov	dx, [_z80de]	; Get DE
15068
		mov   byte [_z80iy + 0], dl
15069
		xor	edx, edx
15070
		sub	edi, byte 9
15071
		js	near noMoreExec
15072
		mov	dl, byte [esi]	; Get our next instruction
15073
		inc	esi		; Increment PC
15074
		jmp	dword [z80regular+edx*4]
15075
 
15076
 
15077
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15078
 
15079
FDInst6c:
15080
	mov	dh, byte [_z80iy + 1]
15081
		mov   byte [_z80iy + 0], bh
15082
		xor	edx, edx
15083
		sub	edi, byte 9
15084
		js	near noMoreExec
15085
		mov	dl, byte [esi]	; Get our next instruction
15086
		inc	esi		; Increment PC
15087
		jmp	dword [z80regular+edx*4]
15088
 
15089
 
15090
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15091
 
15092
FDInst6d:
15093
	mov	dl, byte [_z80iy]
15094
		mov   byte [_z80iy + 0], bl
15095
		xor	edx, edx
15096
		sub	edi, byte 9
15097
		js	near noMoreExec
15098
		mov	dl, byte [esi]	; Get our next instruction
15099
		inc	esi		; Increment PC
15100
		jmp	dword [z80regular+edx*4]
15101
 
15102
 
15103
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15104
 
15105
FDInst6e:
15106
		mov	dl, [esi]	; Fetch our offset
15107
		inc	esi		; Move past the offset
15108
		or	dl, dl		; Is this bad boy signed?
15109
		jns	notSigned275	; Nope!
15110
		dec	dh			; Make it FFable
15111
notSigned275:
15112
		add	dx, [_z80iy]	; Our offset!
15113
		mov	[cyclesRemaining], edi
15114
		mov	edi, [_z80MemRead]	; Point to the read array
15115
 
15116
checkLoop276:
15117
		cmp	[edi], word 0ffffh ; End of the list?
15118
		je		memoryRead276
15119
		cmp	edx, [edi]	; Are we smaller?
15120
		jb		nextAddr276		; Yes, go to the next address
15121
		cmp	edx, [edi+4]	; Are we bigger?
15122
		jbe	callRoutine276
15123
 
15124
nextAddr276:
15125
		add	edi, 10h		; Next structure!
15126
		jmp	short checkLoop276
15127
 
15128
callRoutine276:
15129
		call	ReadMemoryByte	; Standard read routine
15130
		mov	bl, al	; Put our returned value here
15131
		mov	ax, [_z80af]	; Get our AF back
15132
		jmp	short readExit276
15133
 
15134
memoryRead276:
15135
		mov	bl, [ebp + edx]	; Get our data
15136
 
15137
readExit276:
15138
		mov	edi, [cyclesRemaining]
15139
		xor	edx, edx	; Make sure we don't hose things
15140
		sub	edi, byte 19
15141
		js	near noMoreExec
15142
		mov	dl, byte [esi]	; Get our next instruction
15143
		inc	esi		; Increment PC
15144
		jmp	dword [z80regular+edx*4]
15145
 
15146
 
15147
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15148
 
15149
FDInst6f:
15150
		mov   byte [_z80iy + 0], al
15151
		xor	edx, edx
15152
		sub	edi, byte 9
15153
		js	near noMoreExec
15154
		mov	dl, byte [esi]	; Get our next instruction
15155
		inc	esi		; Increment PC
15156
		jmp	dword [z80regular+edx*4]
15157
 
15158
 
15159
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15160
 
15161
FDInst70:
15162
		mov	dl, [esi]	; Fetch our offset
15163
		inc	esi		; Move past the offset
15164
		or	dl, dl		; Is this bad boy signed?
15165
		jns	notSigned278	; Nope!
15166
		dec	dh			; Make it FFable
15167
notSigned278:
15168
		add	dx, [_z80iy]	; Our offset!
15169
		mov	[cyclesRemaining], edi
15170
		mov	[_z80af], ax	; Store AF
15171
		mov	al, ch	; And our data to write
15172
		mov	edi, [_z80MemWrite]	; Point to the write array
15173
 
15174
checkLoop279:
15175
		cmp	[edi], word 0ffffh ; End of our list?
15176
		je	memoryWrite279	; Yes - go write it!
15177
		cmp	dx, [edi]	; Are we smaller?
15178
		jb	nextAddr279	; Yes... go to the next addr
15179
		cmp	dx, [edi+4]	; Are we smaller?
15180
		jbe	callRoutine279	; If not, go call it!
15181
 
15182
nextAddr279:
15183
		add	edi, 10h		; Next structure, please
15184
		jmp	short checkLoop279
15185
 
15186
callRoutine279:
15187
		call	WriteMemoryByte	; Go write the data!
15188
		jmp	short WriteMacroExit279
15189
memoryWrite279:
15190
		mov	[ebp + edx], ch
15191
		mov	ax, [_z80af] ; Get our accumulator and flags
15192
WriteMacroExit279:
15193
		mov	edi, [cyclesRemaining]
15194
		xor	edx, edx
15195
		sub	edi, byte 19
15196
		js	near noMoreExec
15197
		mov	dl, byte [esi]	; Get our next instruction
15198
		inc	esi		; Increment PC
15199
		jmp	dword [z80regular+edx*4]
15200
 
15201
 
15202
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15203
 
15204
FDInst71:
15205
		mov	dl, [esi]	; Fetch our offset
15206
		inc	esi		; Move past the offset
15207
		or	dl, dl		; Is this bad boy signed?
15208
		jns	notSigned280	; Nope!
15209
		dec	dh			; Make it FFable
15210
notSigned280:
15211
		add	dx, [_z80iy]	; Our offset!
15212
		mov	[cyclesRemaining], edi
15213
		mov	[_z80af], ax	; Store AF
15214
		mov	al, cl	; And our data to write
15215
		mov	edi, [_z80MemWrite]	; Point to the write array
15216
 
15217
checkLoop281:
15218
		cmp	[edi], word 0ffffh ; End of our list?
15219
		je	memoryWrite281	; Yes - go write it!
15220
		cmp	dx, [edi]	; Are we smaller?
15221
		jb	nextAddr281	; Yes... go to the next addr
15222
		cmp	dx, [edi+4]	; Are we smaller?
15223
		jbe	callRoutine281	; If not, go call it!
15224
 
15225
nextAddr281:
15226
		add	edi, 10h		; Next structure, please
15227
		jmp	short checkLoop281
15228
 
15229
callRoutine281:
15230
		call	WriteMemoryByte	; Go write the data!
15231
		jmp	short WriteMacroExit281
15232
memoryWrite281:
15233
		mov	[ebp + edx], cl
15234
		mov	ax, [_z80af] ; Get our accumulator and flags
15235
WriteMacroExit281:
15236
		mov	edi, [cyclesRemaining]
15237
		xor	edx, edx
15238
		sub	edi, byte 19
15239
		js	near noMoreExec
15240
		mov	dl, byte [esi]	; Get our next instruction
15241
		inc	esi		; Increment PC
15242
		jmp	dword [z80regular+edx*4]
15243
 
15244
 
15245
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15246
 
15247
FDInst72:
15248
		mov	dl, [esi]	; Fetch our offset
15249
		inc	esi		; Move past the offset
15250
		or	dl, dl		; Is this bad boy signed?
15251
		jns	notSigned282	; Nope!
15252
		dec	dh			; Make it FFable
15253
notSigned282:
15254
		add	dx, [_z80iy]	; Our offset!
15255
		mov	[cyclesRemaining], edi
15256
		mov	[_z80af], ax	; Store AF
15257
		mov	al, byte [_z80de + 1]	; And our data to write
15258
		mov	edi, [_z80MemWrite]	; Point to the write array
15259
 
15260
checkLoop283:
15261
		cmp	[edi], word 0ffffh ; End of our list?
15262
		je	memoryWrite283	; Yes - go write it!
15263
		cmp	dx, [edi]	; Are we smaller?
15264
		jb	nextAddr283	; Yes... go to the next addr
15265
		cmp	dx, [edi+4]	; Are we smaller?
15266
		jbe	callRoutine283	; If not, go call it!
15267
 
15268
nextAddr283:
15269
		add	edi, 10h		; Next structure, please
15270
		jmp	short checkLoop283
15271
 
15272
callRoutine283:
15273
		call	WriteMemoryByte	; Go write the data!
15274
		jmp	short WriteMacroExit283
15275
memoryWrite283:
15276
		mov	edi, edx
15277
		mov	dl, byte [_z80de + 1]
15278
		mov	[ebp + edi], dl
15279
		mov	edx, edi
15280
		mov	ax, [_z80af] ; Get our accumulator and flags
15281
WriteMacroExit283:
15282
		mov	edi, [cyclesRemaining]
15283
		xor	edx, edx
15284
		sub	edi, byte 19
15285
		js	near noMoreExec
15286
		mov	dl, byte [esi]	; Get our next instruction
15287
		inc	esi		; Increment PC
15288
		jmp	dword [z80regular+edx*4]
15289
 
15290
 
15291
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15292
 
15293
FDInst73:
15294
		mov	dl, [esi]	; Fetch our offset
15295
		inc	esi		; Move past the offset
15296
		or	dl, dl		; Is this bad boy signed?
15297
		jns	notSigned284	; Nope!
15298
		dec	dh			; Make it FFable
15299
notSigned284:
15300
		add	dx, [_z80iy]	; Our offset!
15301
		mov	[cyclesRemaining], edi
15302
		mov	[_z80af], ax	; Store AF
15303
		mov	al, byte [_z80de]	; And our data to write
15304
		mov	edi, [_z80MemWrite]	; Point to the write array
15305
 
15306
checkLoop285:
15307
		cmp	[edi], word 0ffffh ; End of our list?
15308
		je	memoryWrite285	; Yes - go write it!
15309
		cmp	dx, [edi]	; Are we smaller?
15310
		jb	nextAddr285	; Yes... go to the next addr
15311
		cmp	dx, [edi+4]	; Are we smaller?
15312
		jbe	callRoutine285	; If not, go call it!
15313
 
15314
nextAddr285:
15315
		add	edi, 10h		; Next structure, please
15316
		jmp	short checkLoop285
15317
 
15318
callRoutine285:
15319
		call	WriteMemoryByte	; Go write the data!
15320
		jmp	short WriteMacroExit285
15321
memoryWrite285:
15322
		mov	edi, edx
15323
		mov	dl, byte [_z80de]
15324
		mov	[ebp + edi], dl
15325
		mov	edx, edi
15326
		mov	ax, [_z80af] ; Get our accumulator and flags
15327
WriteMacroExit285:
15328
		mov	edi, [cyclesRemaining]
15329
		xor	edx, edx
15330
		sub	edi, byte 19
15331
		js	near noMoreExec
15332
		mov	dl, byte [esi]	; Get our next instruction
15333
		inc	esi		; Increment PC
15334
		jmp	dword [z80regular+edx*4]
15335
 
15336
 
15337
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15338
 
15339
FDInst74:
15340
		mov	dl, [esi]	; Fetch our offset
15341
		inc	esi		; Move past the offset
15342
		or	dl, dl		; Is this bad boy signed?
15343
		jns	notSigned286	; Nope!
15344
		dec	dh			; Make it FFable
15345
notSigned286:
15346
		add	dx, [_z80iy]	; Our offset!
15347
		mov	[cyclesRemaining], edi
15348
		mov	[_z80af], ax	; Store AF
15349
		mov	al, bh	; And our data to write
15350
		mov	edi, [_z80MemWrite]	; Point to the write array
15351
 
15352
checkLoop287:
15353
		cmp	[edi], word 0ffffh ; End of our list?
15354
		je	memoryWrite287	; Yes - go write it!
15355
		cmp	dx, [edi]	; Are we smaller?
15356
		jb	nextAddr287	; Yes... go to the next addr
15357
		cmp	dx, [edi+4]	; Are we smaller?
15358
		jbe	callRoutine287	; If not, go call it!
15359
 
15360
nextAddr287:
15361
		add	edi, 10h		; Next structure, please
15362
		jmp	short checkLoop287
15363
 
15364
callRoutine287:
15365
		call	WriteMemoryByte	; Go write the data!
15366
		jmp	short WriteMacroExit287
15367
memoryWrite287:
15368
		mov	[ebp + edx], bh
15369
		mov	ax, [_z80af] ; Get our accumulator and flags
15370
WriteMacroExit287:
15371
		mov	edi, [cyclesRemaining]
15372
		xor	edx, edx
15373
		sub	edi, byte 19
15374
		js	near noMoreExec
15375
		mov	dl, byte [esi]	; Get our next instruction
15376
		inc	esi		; Increment PC
15377
		jmp	dword [z80regular+edx*4]
15378
 
15379
 
15380
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15381
 
15382
FDInst75:
15383
		mov	dl, [esi]	; Fetch our offset
15384
		inc	esi		; Move past the offset
15385
		or	dl, dl		; Is this bad boy signed?
15386
		jns	notSigned288	; Nope!
15387
		dec	dh			; Make it FFable
15388
notSigned288:
15389
		add	dx, [_z80iy]	; Our offset!
15390
		mov	[cyclesRemaining], edi
15391
		mov	[_z80af], ax	; Store AF
15392
		mov	al, bl	; And our data to write
15393
		mov	edi, [_z80MemWrite]	; Point to the write array
15394
 
15395
checkLoop289:
15396
		cmp	[edi], word 0ffffh ; End of our list?
15397
		je	memoryWrite289	; Yes - go write it!
15398
		cmp	dx, [edi]	; Are we smaller?
15399
		jb	nextAddr289	; Yes... go to the next addr
15400
		cmp	dx, [edi+4]	; Are we smaller?
15401
		jbe	callRoutine289	; If not, go call it!
15402
 
15403
nextAddr289:
15404
		add	edi, 10h		; Next structure, please
15405
		jmp	short checkLoop289
15406
 
15407
callRoutine289:
15408
		call	WriteMemoryByte	; Go write the data!
15409
		jmp	short WriteMacroExit289
15410
memoryWrite289:
15411
		mov	[ebp + edx], bl
15412
		mov	ax, [_z80af] ; Get our accumulator and flags
15413
WriteMacroExit289:
15414
		mov	edi, [cyclesRemaining]
15415
		xor	edx, edx
15416
		sub	edi, byte 19
15417
		js	near noMoreExec
15418
		mov	dl, byte [esi]	; Get our next instruction
15419
		inc	esi		; Increment PC
15420
		jmp	dword [z80regular+edx*4]
15421
 
15422
 
15423
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15424
 
15425
FDInst77:
15426
		mov	dl, [esi]	; Fetch our offset
15427
		inc	esi		; Move past the offset
15428
		or	dl, dl		; Is this bad boy signed?
15429
		jns	notSigned290	; Nope!
15430
		dec	dh			; Make it FFable
15431
notSigned290:
15432
		add	dx, [_z80iy]	; Our offset!
15433
		mov	[cyclesRemaining], edi
15434
		mov	[_z80af], ax	; Store AF
15435
		mov	edi, [_z80MemWrite]	; Point to the write array
15436
 
15437
checkLoop291:
15438
		cmp	[edi], word 0ffffh ; End of our list?
15439
		je	memoryWrite291	; Yes - go write it!
15440
		cmp	dx, [edi]	; Are we smaller?
15441
		jb	nextAddr291	; Yes... go to the next addr
15442
		cmp	dx, [edi+4]	; Are we smaller?
15443
		jbe	callRoutine291	; If not, go call it!
15444
 
15445
nextAddr291:
15446
		add	edi, 10h		; Next structure, please
15447
		jmp	short checkLoop291
15448
 
15449
callRoutine291:
15450
		call	WriteMemoryByte	; Go write the data!
15451
		jmp	short WriteMacroExit291
15452
memoryWrite291:
15453
		mov	[ebp + edx], al
15454
		mov	ax, [_z80af] ; Get our accumulator and flags
15455
WriteMacroExit291:
15456
		mov	edi, [cyclesRemaining]
15457
		xor	edx, edx
15458
		sub	edi, byte 19
15459
		js	near noMoreExec
15460
		mov	dl, byte [esi]	; Get our next instruction
15461
		inc	esi		; Increment PC
15462
		jmp	dword [z80regular+edx*4]
15463
 
15464
 
15465
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15466
 
15467
FDInst7c:
15468
		mov	al, byte [_z80iy + 1]
15469
		xor	edx, edx
15470
		sub	edi, byte 9
15471
		js	near noMoreExec
15472
		mov	dl, byte [esi]	; Get our next instruction
15473
		inc	esi		; Increment PC
15474
		jmp	dword [z80regular+edx*4]
15475
 
15476
 
15477
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15478
 
15479
FDInst7d:
15480
		mov	al, byte [_z80iy + 0]
15481
		xor	edx, edx
15482
		sub	edi, byte 9
15483
		js	near noMoreExec
15484
		mov	dl, byte [esi]	; Get our next instruction
15485
		inc	esi		; Increment PC
15486
		jmp	dword [z80regular+edx*4]
15487
 
15488
 
15489
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15490
 
15491
FDInst7e:
15492
		mov	dl, [esi]	; Fetch our offset
15493
		inc	esi		; Move past the offset
15494
		or	dl, dl		; Is this bad boy signed?
15495
		jns	notSigned292	; Nope!
15496
		dec	dh			; Make it FFable
15497
notSigned292:
15498
		add	dx, [_z80iy]	; Our offset!
15499
		mov	[cyclesRemaining], edi
15500
		mov	edi, [_z80MemRead]	; Point to the read array
15501
 
15502
checkLoop293:
15503
		cmp	[edi], word 0ffffh ; End of the list?
15504
		je		memoryRead293
15505
		cmp	edx, [edi]	; Are we smaller?
15506
		jb		nextAddr293		; Yes, go to the next address
15507
		cmp	edx, [edi+4]	; Are we bigger?
15508
		jbe	callRoutine293
15509
 
15510
nextAddr293:
15511
		add	edi, 10h		; Next structure!
15512
		jmp	short checkLoop293
15513
 
15514
callRoutine293:
15515
		call	ReadMemoryByte	; Standard read routine
15516
		mov	[_z80af], al	; Save our new accumulator
15517
		mov	ax, [_z80af]	; Get our AF back
15518
		jmp	short readExit293
15519
 
15520
memoryRead293:
15521
		mov	al, [ebp + edx]	; Get our data
15522
 
15523
readExit293:
15524
		mov	edi, [cyclesRemaining]
15525
		xor	edx, edx	; Make sure we don't hose things
15526
		sub	edi, byte 19
15527
		js	near noMoreExec
15528
		mov	dl, byte [esi]	; Get our next instruction
15529
		inc	esi		; Increment PC
15530
		jmp	dword [z80regular+edx*4]
15531
 
15532
 
15533
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15534
 
15535
FDInst84:
15536
		mov	dl, byte [_z80iy + 1]
15537
		sahf		; Store our flags in x86 flag reg
15538
		add	al, dl
15539
		lahf		; Get flags back into AH
15540
		seto	dl
15541
		and	ah, 0fbh	; Knock out parity/overflow
15542
		shl	dl, 2
15543
		or		ah, dl
15544
		and	ah, 0fdh ; No N!
15545
		sub	edi, byte 9
15546
		js	near noMoreExec
15547
		mov	dl, byte [esi]	; Get our next instruction
15548
		inc	esi		; Increment PC
15549
		jmp	dword [z80regular+edx*4]
15550
 
15551
 
15552
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15553
 
15554
FDInst85:
15555
		mov	dl, byte [_z80iy]
15556
		sahf		; Store our flags in x86 flag reg
15557
		add	al, dl
15558
		lahf		; Get flags back into AH
15559
		seto	dl
15560
		and	ah, 0fbh	; Knock out parity/overflow
15561
		shl	dl, 2
15562
		or		ah, dl
15563
		and	ah, 0fdh ; No N!
15564
		sub	edi, byte 9
15565
		js	near noMoreExec
15566
		mov	dl, byte [esi]	; Get our next instruction
15567
		inc	esi		; Increment PC
15568
		jmp	dword [z80regular+edx*4]
15569
 
15570
 
15571
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15572
 
15573
FDInst86:
15574
		mov	dl, [esi]	; Fetch our offset
15575
		inc	esi		; Move past the offset
15576
		or	dl, dl		; Is this bad boy signed?
15577
		jns	notSigned295	; Nope!
15578
		dec	dh			; Make it FFable
15579
notSigned295:
15580
		add	dx, [_z80iy]	; Our offset!
15581
		mov	[cyclesRemaining], edi
15582
		mov	edi, [_z80MemRead]	; Point to the read array
15583
 
15584
checkLoop296:
15585
		cmp	[edi], word 0ffffh ; End of the list?
15586
		je		memoryRead296
15587
		cmp	edx, [edi]	; Are we smaller?
15588
		jb		nextAddr296		; Yes, go to the next address
15589
		cmp	edx, [edi+4]	; Are we bigger?
15590
		jbe	callRoutine296
15591
 
15592
nextAddr296:
15593
		add	edi, 10h		; Next structure!
15594
		jmp	short checkLoop296
15595
 
15596
callRoutine296:
15597
		call	ReadMemoryByte	; Standard read routine
15598
		mov	dl, al	; Put our returned value here
15599
		mov	ax, [_z80af]	; Get our AF back
15600
		jmp	short readExit296
15601
 
15602
memoryRead296:
15603
		mov	dl, [ebp + edx]	; Get our data
15604
 
15605
readExit296:
15606
		mov	edi, [cyclesRemaining]
15607
		sahf
15608
		add	al, dl
15609
		lahf
15610
		seto	dl
15611
		and	ah, 0fbh	; Knock out parity/overflow
15612
		shl	dl, 2
15613
		or		ah, dl
15614
		and	ah, 0fdh	; Knock out negative
15615
		xor	edx, edx
15616
		sub	edi, byte 19
15617
		js	near noMoreExec
15618
		mov	dl, byte [esi]	; Get our next instruction
15619
		inc	esi		; Increment PC
15620
		jmp	dword [z80regular+edx*4]
15621
 
15622
 
15623
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15624
 
15625
FDInst8c:
15626
		mov	dl, byte [_z80iy + 1]
15627
		sahf		; Store our flags in x86 flag reg
15628
		adc	al, dl
15629
		lahf		; Get flags back into AH
15630
		seto	dl
15631
		and	ah, 0fbh	; Knock out parity/overflow
15632
		shl	dl, 2
15633
		or		ah, dl
15634
		and	ah, 0fdh ; No N!
15635
		sub	edi, byte 9
15636
		js	near noMoreExec
15637
		mov	dl, byte [esi]	; Get our next instruction
15638
		inc	esi		; Increment PC
15639
		jmp	dword [z80regular+edx*4]
15640
 
15641
 
15642
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15643
 
15644
FDInst8d:
15645
		mov	dl, byte [_z80iy]
15646
		sahf		; Store our flags in x86 flag reg
15647
		adc	al, dl
15648
		lahf		; Get flags back into AH
15649
		seto	dl
15650
		and	ah, 0fbh	; Knock out parity/overflow
15651
		shl	dl, 2
15652
		or		ah, dl
15653
		and	ah, 0fdh ; No N!
15654
		sub	edi, byte 9
15655
		js	near noMoreExec
15656
		mov	dl, byte [esi]	; Get our next instruction
15657
		inc	esi		; Increment PC
15658
		jmp	dword [z80regular+edx*4]
15659
 
15660
 
15661
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15662
 
15663
FDInst8e:
15664
		mov	dl, [esi]	; Fetch our offset
15665
		inc	esi		; Move past the offset
15666
		or	dl, dl		; Is this bad boy signed?
15667
		jns	notSigned297	; Nope!
15668
		dec	dh			; Make it FFable
15669
notSigned297:
15670
		add	dx, [_z80iy]	; Our offset!
15671
		mov	[cyclesRemaining], edi
15672
		mov	edi, [_z80MemRead]	; Point to the read array
15673
 
15674
checkLoop298:
15675
		cmp	[edi], word 0ffffh ; End of the list?
15676
		je		memoryRead298
15677
		cmp	edx, [edi]	; Are we smaller?
15678
		jb		nextAddr298		; Yes, go to the next address
15679
		cmp	edx, [edi+4]	; Are we bigger?
15680
		jbe	callRoutine298
15681
 
15682
nextAddr298:
15683
		add	edi, 10h		; Next structure!
15684
		jmp	short checkLoop298
15685
 
15686
callRoutine298:
15687
		call	ReadMemoryByte	; Standard read routine
15688
		mov	dl, al	; Put our returned value here
15689
		mov	ax, [_z80af]	; Get our AF back
15690
		jmp	short readExit298
15691
 
15692
memoryRead298:
15693
		mov	dl, [ebp + edx]	; Get our data
15694
 
15695
readExit298:
15696
		mov	edi, [cyclesRemaining]
15697
		sahf
15698
		adc	al, dl
15699
		lahf
15700
		seto	dl
15701
		and	ah, 0fbh	; Knock out parity/overflow
15702
		shl	dl, 2
15703
		or		ah, dl
15704
		and	ah, 0fdh	; Knock out negative
15705
		xor	edx, edx
15706
		sub	edi, byte 19
15707
		js	near noMoreExec
15708
		mov	dl, byte [esi]	; Get our next instruction
15709
		inc	esi		; Increment PC
15710
		jmp	dword [z80regular+edx*4]
15711
 
15712
 
15713
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15714
 
15715
FDInst94:
15716
		mov	dl, byte [_z80iy + 1]
15717
		sahf		; Store our flags in x86 flag reg
15718
		sub	al, dl
15719
		lahf		; Get flags back into AH
15720
		seto	dl
15721
		and	ah, 0fbh	; Knock out parity/overflow
15722
		shl	dl, 2
15723
		or		ah, dl
15724
		or	ah, 02h	; N Gets set!
15725
		sub	edi, byte 9
15726
		js	near noMoreExec
15727
		mov	dl, byte [esi]	; Get our next instruction
15728
		inc	esi		; Increment PC
15729
		jmp	dword [z80regular+edx*4]
15730
 
15731
 
15732
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15733
 
15734
FDInst95:
15735
		mov	dl, byte [_z80iy]
15736
		sahf		; Store our flags in x86 flag reg
15737
		sub	al, dl
15738
		lahf		; Get flags back into AH
15739
		seto	dl
15740
		and	ah, 0fbh	; Knock out parity/overflow
15741
		shl	dl, 2
15742
		or		ah, dl
15743
		or	ah, 02h	; N Gets set!
15744
		sub	edi, byte 9
15745
		js	near noMoreExec
15746
		mov	dl, byte [esi]	; Get our next instruction
15747
		inc	esi		; Increment PC
15748
		jmp	dword [z80regular+edx*4]
15749
 
15750
 
15751
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15752
 
15753
FDInst96:
15754
		mov	dl, [esi]	; Fetch our offset
15755
		inc	esi		; Move past the offset
15756
		or	dl, dl		; Is this bad boy signed?
15757
		jns	notSigned299	; Nope!
15758
		dec	dh			; Make it FFable
15759
notSigned299:
15760
		add	dx, [_z80iy]	; Our offset!
15761
		mov	[cyclesRemaining], edi
15762
		mov	edi, [_z80MemRead]	; Point to the read array
15763
 
15764
checkLoop300:
15765
		cmp	[edi], word 0ffffh ; End of the list?
15766
		je		memoryRead300
15767
		cmp	edx, [edi]	; Are we smaller?
15768
		jb		nextAddr300		; Yes, go to the next address
15769
		cmp	edx, [edi+4]	; Are we bigger?
15770
		jbe	callRoutine300
15771
 
15772
nextAddr300:
15773
		add	edi, 10h		; Next structure!
15774
		jmp	short checkLoop300
15775
 
15776
callRoutine300:
15777
		call	ReadMemoryByte	; Standard read routine
15778
		mov	dl, al	; Put our returned value here
15779
		mov	ax, [_z80af]	; Get our AF back
15780
		jmp	short readExit300
15781
 
15782
memoryRead300:
15783
		mov	dl, [ebp + edx]	; Get our data
15784
 
15785
readExit300:
15786
		mov	edi, [cyclesRemaining]
15787
		sahf
15788
		sub	al, dl
15789
		lahf
15790
		seto	dl
15791
		and	ah, 0fbh	; Knock out parity/overflow
15792
		shl	dl, 2
15793
		or		ah, dl
15794
		or	ah, 02h	; Set negative
15795
		xor	edx, edx
15796
		sub	edi, byte 19
15797
		js	near noMoreExec
15798
		mov	dl, byte [esi]	; Get our next instruction
15799
		inc	esi		; Increment PC
15800
		jmp	dword [z80regular+edx*4]
15801
 
15802
 
15803
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15804
 
15805
FDInst9c:
15806
		mov	dl, byte [_z80iy + 1]
15807
		sahf		; Store our flags in x86 flag reg
15808
		sbb	al, dl
15809
		lahf		; Get flags back into AH
15810
		seto	dl
15811
		and	ah, 0fbh	; Knock out parity/overflow
15812
		shl	dl, 2
15813
		or		ah, dl
15814
		or	ah, 02h	; N Gets set!
15815
		sub	edi, byte 9
15816
		js	near noMoreExec
15817
		mov	dl, byte [esi]	; Get our next instruction
15818
		inc	esi		; Increment PC
15819
		jmp	dword [z80regular+edx*4]
15820
 
15821
 
15822
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15823
 
15824
FDInst9d:
15825
		mov	dl, byte [_z80iy]
15826
		sahf		; Store our flags in x86 flag reg
15827
		sbb	al, dl
15828
		lahf		; Get flags back into AH
15829
		seto	dl
15830
		and	ah, 0fbh	; Knock out parity/overflow
15831
		shl	dl, 2
15832
		or		ah, dl
15833
		or	ah, 02h	; N Gets set!
15834
		sub	edi, byte 9
15835
		js	near noMoreExec
15836
		mov	dl, byte [esi]	; Get our next instruction
15837
		inc	esi		; Increment PC
15838
		jmp	dword [z80regular+edx*4]
15839
 
15840
 
15841
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15842
 
15843
FDInst9e:
15844
		mov	dl, [esi]	; Fetch our offset
15845
		inc	esi		; Move past the offset
15846
		or	dl, dl		; Is this bad boy signed?
15847
		jns	notSigned301	; Nope!
15848
		dec	dh			; Make it FFable
15849
notSigned301:
15850
		add	dx, [_z80iy]	; Our offset!
15851
		mov	[cyclesRemaining], edi
15852
		mov	edi, [_z80MemRead]	; Point to the read array
15853
 
15854
checkLoop302:
15855
		cmp	[edi], word 0ffffh ; End of the list?
15856
		je		memoryRead302
15857
		cmp	edx, [edi]	; Are we smaller?
15858
		jb		nextAddr302		; Yes, go to the next address
15859
		cmp	edx, [edi+4]	; Are we bigger?
15860
		jbe	callRoutine302
15861
 
15862
nextAddr302:
15863
		add	edi, 10h		; Next structure!
15864
		jmp	short checkLoop302
15865
 
15866
callRoutine302:
15867
		call	ReadMemoryByte	; Standard read routine
15868
		mov	dl, al	; Put our returned value here
15869
		mov	ax, [_z80af]	; Get our AF back
15870
		jmp	short readExit302
15871
 
15872
memoryRead302:
15873
		mov	dl, [ebp + edx]	; Get our data
15874
 
15875
readExit302:
15876
		mov	edi, [cyclesRemaining]
15877
		sahf
15878
		sbb	al, dl
15879
		lahf
15880
		seto	dl
15881
		and	ah, 0fbh	; Knock out parity/overflow
15882
		shl	dl, 2
15883
		or		ah, dl
15884
		or	ah, 02h	; Set negative
15885
		xor	edx, edx
15886
		sub	edi, byte 19
15887
		js	near noMoreExec
15888
		mov	dl, byte [esi]	; Get our next instruction
15889
		inc	esi		; Increment PC
15890
		jmp	dword [z80regular+edx*4]
15891
 
15892
 
15893
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15894
 
15895
FDInsta4:
15896
		mov	dl, byte [_z80iy + 1]
15897
		sahf		; Store our flags in x86 flag reg
15898
		and	al, dl
15899
		lahf		; Get flags back into AH
15900
		and	ah, 0ech	; Only these flags matter!
15901
		or	ah, 010h	; Half carry gets set
15902
		sub	edi, byte 9
15903
		js	near noMoreExec
15904
		mov	dl, byte [esi]	; Get our next instruction
15905
		inc	esi		; Increment PC
15906
		jmp	dword [z80regular+edx*4]
15907
 
15908
 
15909
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15910
 
15911
FDInsta5:
15912
		mov	dl, byte [_z80iy]
15913
		sahf		; Store our flags in x86 flag reg
15914
		and	al, dl
15915
		lahf		; Get flags back into AH
15916
		and	ah, 0ech	; Only these flags matter!
15917
		or	ah, 010h	; Half carry gets set
15918
		sub	edi, byte 9
15919
		js	near noMoreExec
15920
		mov	dl, byte [esi]	; Get our next instruction
15921
		inc	esi		; Increment PC
15922
		jmp	dword [z80regular+edx*4]
15923
 
15924
 
15925
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15926
 
15927
FDInsta6:
15928
		mov	dl, [esi]	; Fetch our offset
15929
		inc	esi		; Move past the offset
15930
		or	dl, dl		; Is this bad boy signed?
15931
		jns	notSigned303	; Nope!
15932
		dec	dh			; Make it FFable
15933
notSigned303:
15934
		add	dx, [_z80iy]	; Our offset!
15935
		mov	[cyclesRemaining], edi
15936
		mov	edi, [_z80MemRead]	; Point to the read array
15937
 
15938
checkLoop304:
15939
		cmp	[edi], word 0ffffh ; End of the list?
15940
		je		memoryRead304
15941
		cmp	edx, [edi]	; Are we smaller?
15942
		jb		nextAddr304		; Yes, go to the next address
15943
		cmp	edx, [edi+4]	; Are we bigger?
15944
		jbe	callRoutine304
15945
 
15946
nextAddr304:
15947
		add	edi, 10h		; Next structure!
15948
		jmp	short checkLoop304
15949
 
15950
callRoutine304:
15951
		call	ReadMemoryByte	; Standard read routine
15952
		mov	dl, al	; Put our returned value here
15953
		mov	ax, [_z80af]	; Get our AF back
15954
		jmp	short readExit304
15955
 
15956
memoryRead304:
15957
		mov	dl, [ebp + edx]	; Get our data
15958
 
15959
readExit304:
15960
		mov	edi, [cyclesRemaining]
15961
		sahf
15962
		and	al, dl
15963
		lahf
15964
		and	ah,0fch	; Knock out N & C
15965
		or	ah, 10h	; Set half carry
15966
		xor	edx, edx
15967
		sub	edi, byte 19
15968
		js	near noMoreExec
15969
		mov	dl, byte [esi]	; Get our next instruction
15970
		inc	esi		; Increment PC
15971
		jmp	dword [z80regular+edx*4]
15972
 
15973
 
15974
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15975
 
15976
FDInstac:
15977
		mov	dl, byte [_z80iy + 1]
15978
		sahf		; Store our flags in x86 flag reg
15979
		xor	al, dl
15980
		lahf		; Get flags back into AH
15981
		and	ah, 0ech	; Only these flags matter!
15982
		sub	edi, byte 9
15983
		js	near noMoreExec
15984
		mov	dl, byte [esi]	; Get our next instruction
15985
		inc	esi		; Increment PC
15986
		jmp	dword [z80regular+edx*4]
15987
 
15988
 
15989
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
15990
 
15991
FDInstad:
15992
		mov	dl, byte [_z80iy]
15993
		sahf		; Store our flags in x86 flag reg
15994
		xor	al, dl
15995
		lahf		; Get flags back into AH
15996
		and	ah, 0ech	; Only these flags matter!
15997
		sub	edi, byte 9
15998
		js	near noMoreExec
15999
		mov	dl, byte [esi]	; Get our next instruction
16000
		inc	esi		; Increment PC
16001
		jmp	dword [z80regular+edx*4]
16002
 
16003
 
16004
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16005
 
16006
FDInstae:
16007
		mov	dl, [esi]	; Fetch our offset
16008
		inc	esi		; Move past the offset
16009
		or	dl, dl		; Is this bad boy signed?
16010
		jns	notSigned305	; Nope!
16011
		dec	dh			; Make it FFable
16012
notSigned305:
16013
		add	dx, [_z80iy]	; Our offset!
16014
		mov	[cyclesRemaining], edi
16015
		mov	edi, [_z80MemRead]	; Point to the read array
16016
 
16017
checkLoop306:
16018
		cmp	[edi], word 0ffffh ; End of the list?
16019
		je		memoryRead306
16020
		cmp	edx, [edi]	; Are we smaller?
16021
		jb		nextAddr306		; Yes, go to the next address
16022
		cmp	edx, [edi+4]	; Are we bigger?
16023
		jbe	callRoutine306
16024
 
16025
nextAddr306:
16026
		add	edi, 10h		; Next structure!
16027
		jmp	short checkLoop306
16028
 
16029
callRoutine306:
16030
		call	ReadMemoryByte	; Standard read routine
16031
		mov	dl, al	; Put our returned value here
16032
		mov	ax, [_z80af]	; Get our AF back
16033
		jmp	short readExit306
16034
 
16035
memoryRead306:
16036
		mov	dl, [ebp + edx]	; Get our data
16037
 
16038
readExit306:
16039
		mov	edi, [cyclesRemaining]
16040
		sahf
16041
		xor	al, dl
16042
		lahf
16043
		and	ah, 0ech	; Knock out H, N, and C
16044
		xor	edx, edx
16045
		sub	edi, byte 19
16046
		js	near noMoreExec
16047
		mov	dl, byte [esi]	; Get our next instruction
16048
		inc	esi		; Increment PC
16049
		jmp	dword [z80regular+edx*4]
16050
 
16051
 
16052
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16053
 
16054
FDInstb4:
16055
		mov	dl, byte [_z80iy + 1]
16056
		sahf		; Store our flags in x86 flag reg
16057
		or	al, dl
16058
		lahf		; Get flags back into AH
16059
		and	ah, 0ech ; No H, N, or C
16060
		and	ah, 0ech ; No H, N, or C
16061
		sub	edi, byte 9
16062
		js	near noMoreExec
16063
		mov	dl, byte [esi]	; Get our next instruction
16064
		inc	esi		; Increment PC
16065
		jmp	dword [z80regular+edx*4]
16066
 
16067
 
16068
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16069
 
16070
FDInstb5:
16071
		mov	dl, byte [_z80iy]
16072
		sahf		; Store our flags in x86 flag reg
16073
		or	al, dl
16074
		lahf		; Get flags back into AH
16075
		and	ah, 0ech ; No H, N, or C
16076
		and	ah, 0ech ; No H, N, or C
16077
		sub	edi, byte 9
16078
		js	near noMoreExec
16079
		mov	dl, byte [esi]	; Get our next instruction
16080
		inc	esi		; Increment PC
16081
		jmp	dword [z80regular+edx*4]
16082
 
16083
 
16084
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16085
 
16086
FDInstb6:
16087
		mov	dl, [esi]	; Fetch our offset
16088
		inc	esi		; Move past the offset
16089
		or	dl, dl		; Is this bad boy signed?
16090
		jns	notSigned307	; Nope!
16091
		dec	dh			; Make it FFable
16092
notSigned307:
16093
		add	dx, [_z80iy]	; Our offset!
16094
		mov	[cyclesRemaining], edi
16095
		mov	edi, [_z80MemRead]	; Point to the read array
16096
 
16097
checkLoop308:
16098
		cmp	[edi], word 0ffffh ; End of the list?
16099
		je		memoryRead308
16100
		cmp	edx, [edi]	; Are we smaller?
16101
		jb		nextAddr308		; Yes, go to the next address
16102
		cmp	edx, [edi+4]	; Are we bigger?
16103
		jbe	callRoutine308
16104
 
16105
nextAddr308:
16106
		add	edi, 10h		; Next structure!
16107
		jmp	short checkLoop308
16108
 
16109
callRoutine308:
16110
		call	ReadMemoryByte	; Standard read routine
16111
		mov	dl, al	; Put our returned value here
16112
		mov	ax, [_z80af]	; Get our AF back
16113
		jmp	short readExit308
16114
 
16115
memoryRead308:
16116
		mov	dl, [ebp + edx]	; Get our data
16117
 
16118
readExit308:
16119
		mov	edi, [cyclesRemaining]
16120
		sahf
16121
		or	al, dl
16122
		lahf
16123
		and	ah, 0ech	; Knock out H, N, and C
16124
		xor	edx, edx
16125
		sub	edi, byte 19
16126
		js	near noMoreExec
16127
		mov	dl, byte [esi]	; Get our next instruction
16128
		inc	esi		; Increment PC
16129
		jmp	dword [z80regular+edx*4]
16130
 
16131
 
16132
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16133
 
16134
FDInstbc:
16135
		mov	dl, byte [_z80iy + 1]
16136
		sahf		; Store our flags in x86 flag reg
16137
		cmp	al, dl
16138
		lahf		; Get flags back into AH
16139
		seto	dl
16140
		and	ah, 0fbh	; Knock out parity/overflow
16141
		shl	dl, 2
16142
		or		ah, dl
16143
		or	ah, 02h	; Negative gets set on a compare
16144
		sub	edi, byte 9
16145
		js	near noMoreExec
16146
		mov	dl, byte [esi]	; Get our next instruction
16147
		inc	esi		; Increment PC
16148
		jmp	dword [z80regular+edx*4]
16149
 
16150
 
16151
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16152
 
16153
FDInstbd:
16154
		mov	dl, byte [_z80iy]
16155
		sahf		; Store our flags in x86 flag reg
16156
		cmp	al, dl
16157
		lahf		; Get flags back into AH
16158
		seto	dl
16159
		and	ah, 0fbh	; Knock out parity/overflow
16160
		shl	dl, 2
16161
		or		ah, dl
16162
		or	ah, 02h	; Negative gets set on a compare
16163
		sub	edi, byte 9
16164
		js	near noMoreExec
16165
		mov	dl, byte [esi]	; Get our next instruction
16166
		inc	esi		; Increment PC
16167
		jmp	dword [z80regular+edx*4]
16168
 
16169
 
16170
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16171
 
16172
FDInstbe:
16173
		mov	dl, [esi]	; Fetch our offset
16174
		inc	esi		; Move past the offset
16175
		or	dl, dl		; Is this bad boy signed?
16176
		jns	notSigned309	; Nope!
16177
		dec	dh			; Make it FFable
16178
notSigned309:
16179
		add	dx, [_z80iy]	; Our offset!
16180
		mov	[cyclesRemaining], edi
16181
		mov	edi, [_z80MemRead]	; Point to the read array
16182
 
16183
checkLoop310:
16184
		cmp	[edi], word 0ffffh ; End of the list?
16185
		je		memoryRead310
16186
		cmp	edx, [edi]	; Are we smaller?
16187
		jb		nextAddr310		; Yes, go to the next address
16188
		cmp	edx, [edi+4]	; Are we bigger?
16189
		jbe	callRoutine310
16190
 
16191
nextAddr310:
16192
		add	edi, 10h		; Next structure!
16193
		jmp	short checkLoop310
16194
 
16195
callRoutine310:
16196
		call	ReadMemoryByte	; Standard read routine
16197
		mov	dl, al	; Put our returned value here
16198
		mov	ax, [_z80af]	; Get our AF back
16199
		jmp	short readExit310
16200
 
16201
memoryRead310:
16202
		mov	dl, [ebp + edx]	; Get our data
16203
 
16204
readExit310:
16205
		mov	edi, [cyclesRemaining]
16206
		sahf
16207
		cmp	al, dl
16208
		lahf
16209
		seto	dl
16210
		and	ah, 0fbh	; Knock out parity/overflow
16211
		shl	dl, 2
16212
		or		ah, dl
16213
		or	ah, 02h	; Set negative
16214
		xor	edx, edx
16215
		sub	edi, byte 19
16216
		js	near noMoreExec
16217
		mov	dl, byte [esi]	; Get our next instruction
16218
		inc	esi		; Increment PC
16219
		jmp	dword [z80regular+edx*4]
16220
 
16221
FDInstcb:
16222
		mov	dx, [esi]	; Get our instruction (and offset)
16223
		add	esi, 2	; Increment our PC
16224
		mov	byte [_orgval], dl ; Store our value
16225
		or	dl, dl
16226
		js	notNeg311
16227
		mov	byte [_orgval + 1], 00h;
16228
 		jmp	short jumpHandler311
16229
notNeg311:
16230
		mov	byte [_orgval + 1], 0ffh;	It's negative
16231
jumpHandler311:
16232
		shl	ebx, 16	; Save BX away
16233
		mov	bx, [_z80iy]
16234
		add	[_orgval], bx
16235
		shr	ebx, 16	; Restore BX
16236
		mov	dl, dh	; Get our instruction
16237
		xor	dh, dh	; Zero this
16238
		jmp	dword [z80ddfdcbInstructions+edx*4]
16239
 
16240
 
16241
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16242
 
16243
FDInste1:
16244
		mov	dx, [_z80sp]
16245
		mov	[cyclesRemaining], edi
16246
		mov	edi, [_z80MemRead]	; Point to the read array
16247
 
16248
checkLoop312:
16249
		cmp	[edi], word 0ffffh ; End of the list?
16250
		je		memoryRead312
16251
		cmp	dx, [edi]	; Are we smaller?
16252
		jb		nextAddr312		; Yes, go to the next address
16253
		cmp	dx, [edi+4]	; Are we bigger?
16254
		jbe	callRoutine312
16255
 
16256
nextAddr312:
16257
		add	edi, 10h		; Next structure!
16258
		jmp	short checkLoop312
16259
 
16260
callRoutine312:
16261
		push	ax		; Save this for later
16262
		push	dx		; Save address
16263
		call	ReadMemoryByte	; Standard read routine
16264
		pop	dx		; Restore our address
16265
		inc	dx		; Next byte, please
16266
		push	ax		; Save returned byte
16267
		call	ReadMemoryByte	; Standard read routine
16268
		xchg	ah, al	; Swap for endian's sake
16269
		pop	dx	; Restore LSB
16270
		mov	dh, ah	; Our word is now in DX
16271
		pop	ax		; Restore this
16272
		mov	[_z80iy], dx	; Store our word
16273
		jmp	readExit312
16274
 
16275
memoryRead312:
16276
		mov	dx, [ebp + edx]
16277
		mov	[_z80iy], dx
16278
readExit312:
16279
		mov	edi, [cyclesRemaining]
16280
		add	word [_z80sp], 2
16281
		xor	edx, edx
16282
		sub	edi, byte 14
16283
		js	near noMoreExec
16284
		mov	dl, byte [esi]	; Get our next instruction
16285
		inc	esi		; Increment PC
16286
		jmp	dword [z80regular+edx*4]
16287
 
16288
 
16289
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16290
 
16291
FDInste3:
16292
		mov	[cyclesRemaining], edi
16293
		mov	dx, word [_z80sp]
16294
		xor	edi, edi
16295
		mov	di, [_z80iy]
16296
		xchg	di, [ebp+edx]
16297
		mov	[_z80iy], di
16298
		xor	edx, edx
16299
		mov	edi, [cyclesRemaining]
16300
		sub	edi, byte 23
16301
		js	near noMoreExec
16302
		mov	dl, byte [esi]	; Get our next instruction
16303
		inc	esi		; Increment PC
16304
		jmp	dword [z80regular+edx*4]
16305
 
16306
 
16307
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16308
 
16309
FDInste5:
16310
		sub	word [_z80sp], 2
16311
		mov	dx, [_z80sp]
16312
		mov	[cyclesRemaining], edi
16313
		mov	edi, [_z80MemWrite]	; Point to the write array
16314
 
16315
checkLoop313:
16316
		cmp	[edi], word 0ffffh ; End of the list?
16317
		je		memoryWrite313
16318
		cmp	dx, [edi]	; Are we smaller?
16319
		jb		nextAddr313		; Yes, go to the next address
16320
		cmp	dx, [edi+4]	; Are we bigger?
16321
		jbe	callRoutine313
16322
 
16323
nextAddr313:
16324
		add	edi, 10h		; Next structure!
16325
		jmp	short checkLoop313
16326
 
16327
callRoutine313:
16328
		push	ax		; Save this for later
16329
		push	dx
16330
		mov	ax, [_z80iy]
16331
		call	WriteMemoryByte
16332
		pop	dx
16333
		pop	ax
16334
		inc	dx
16335
 
16336
		push	ax
16337
		push	dx
16338
		mov	ax, [_z80iy]
16339
		xchg	ah, al
16340
		call	WriteMemoryByte
16341
		pop	dx
16342
		pop	ax	; Restore us!
16343
		jmp	writeExit313
16344
 
16345
memoryWrite313:
16346
		mov	di, [_z80iy]
16347
		mov	[ebp + edx], di	; Store our word
16348
writeExit313:
16349
		mov	edi, [cyclesRemaining]
16350
		xor	edx, edx
16351
		sub	edi, byte 15
16352
		js	near noMoreExec
16353
		mov	dl, byte [esi]	; Get our next instruction
16354
		inc	esi		; Increment PC
16355
		jmp	dword [z80regular+edx*4]
16356
 
16357
 
16358
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16359
 
16360
FDInste9:
16361
		mov	dx, [_z80iy]	; Get our value
16362
		mov	esi, edx		; New PC!
16363
		add	esi, ebp		; Add in our base
16364
		xor	edx, edx
16365
		sub	edi, byte 8
16366
		js	near noMoreExec
16367
		mov	dl, byte [esi]	; Get our next instruction
16368
		inc	esi		; Increment PC
16369
		jmp	dword [z80regular+edx*4]
16370
 
16371
 
16372
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16373
 
16374
FDInstf9:
16375
		mov	dx, [_z80iy] ; Get our source register
16376
		mov	word [_z80sp], dx	; Store our new SP
16377
		xor	edx, edx
16378
		sub	edi, byte 10
16379
		js	near noMoreExec
16380
		mov	dl, byte [esi]	; Get our next instruction
16381
		inc	esi		; Increment PC
16382
		jmp	dword [z80regular+edx*4]
16383
 
16384
 
16385
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16386
 
16387
RegInst00:
16388
		sub	edi, byte 4
16389
		js	near noMoreExec
16390
		mov	dl, byte [esi]	; Get our next instruction
16391
		inc	esi		; Increment PC
16392
		jmp	dword [z80regular+edx*4]
16393
 
16394
 
16395
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16396
 
16397
RegInst01:
16398
		mov	cx, [esi]	; Get our immediate value of BC
16399
		add	esi, 2
16400
		sub	edi, byte 10
16401
		js	near noMoreExec
16402
		mov	dl, byte [esi]	; Get our next instruction
16403
		inc	esi		; Increment PC
16404
		jmp	dword [z80regular+edx*4]
16405
 
16406
 
16407
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16408
 
16409
RegInst02:
16410
		mov	[cyclesRemaining], edi
16411
		mov	[_z80af], ax	; Store AF
16412
		mov	edi, [_z80MemWrite]	; Point to the write array
16413
 
16414
checkLoop314:
16415
		cmp	[edi], word 0ffffh ; End of our list?
16416
		je	memoryWrite314	; Yes - go write it!
16417
		cmp	cx, [edi]	; Are we smaller?
16418
		jb	nextAddr314	; Yes... go to the next addr
16419
		cmp	cx, [edi+4]	; Are we smaller?
16420
		jbe	callRoutine314	; If not, go call it!
16421
 
16422
nextAddr314:
16423
		add	edi, 10h		; Next structure, please
16424
		jmp	short checkLoop314
16425
 
16426
callRoutine314:
16427
		mov	dx, cx	; Get our address to target
16428
		call	WriteMemoryByte	; Go write the data!
16429
		jmp	short WriteMacroExit314
16430
memoryWrite314:
16431
		mov	[ebp + ecx], al
16432
		mov	ax, [_z80af] ; Get our accumulator and flags
16433
WriteMacroExit314:
16434
		mov	edi, [cyclesRemaining]
16435
		xor	edx, edx
16436
		sub	edi, byte 7
16437
		js	near noMoreExec
16438
		mov	dl, byte [esi]	; Get our next instruction
16439
		inc	esi		; Increment PC
16440
		jmp	dword [z80regular+edx*4]
16441
 
16442
 
16443
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16444
 
16445
RegInst03:
16446
		inc	cx
16447
		sub	edi, byte 6
16448
		js	near noMoreExec
16449
		mov	dl, byte [esi]	; Get our next instruction
16450
		inc	esi		; Increment PC
16451
		jmp	dword [z80regular+edx*4]
16452
 
16453
 
16454
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16455
 
16456
RegInst04:
16457
		sahf
16458
		inc	ch
16459
		lahf
16460
		seto	dl
16461
		and	ah, 0fbh	; Knock out parity/overflow
16462
		shl	dl, 2
16463
		or		ah, dl
16464
		and	ah, 0fdh	; Knock out N!
16465
		sub	edi, byte 4
16466
		js	near noMoreExec
16467
		mov	dl, byte [esi]	; Get our next instruction
16468
		inc	esi		; Increment PC
16469
		jmp	dword [z80regular+edx*4]
16470
 
16471
 
16472
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16473
 
16474
RegInst05:
16475
		sahf
16476
		dec	ch
16477
		lahf
16478
		seto	dl
16479
		and	ah, 0fbh	; Knock out parity/overflow
16480
		shl	dl, 2
16481
		or		ah, dl
16482
		or	ah, 02h	; Set negative!
16483
		sub	edi, byte 4
16484
		js	near noMoreExec
16485
		mov	dl, byte [esi]	; Get our next instruction
16486
		inc	esi		; Increment PC
16487
		jmp	dword [z80regular+edx*4]
16488
 
16489
 
16490
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16491
 
16492
RegInst06:
16493
		mov	ch, [esi]	; Get our immediate value
16494
		inc	esi
16495
		sub	edi, byte 7
16496
		js	near noMoreExec
16497
		mov	dl, byte [esi]	; Get our next instruction
16498
		inc	esi		; Increment PC
16499
		jmp	dword [z80regular+edx*4]
16500
 
16501
 
16502
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16503
 
16504
RegInst07:
16505
		sahf
16506
		rol	al, 1
16507
		lahf
16508
		and	ah, 0edh
16509
		sub	edi, byte 4
16510
		js	near noMoreExec
16511
		mov	dl, byte [esi]	; Get our next instruction
16512
		inc	esi		; Increment PC
16513
		jmp	dword [z80regular+edx*4]
16514
 
16515
 
16516
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16517
 
16518
RegInst08:
16519
		xchg	ah, al
16520
		xchg	ax, [_z80afprime]
16521
		xchg	ah, al
16522
		sub	edi, byte 4
16523
		js	near noMoreExec
16524
		mov	dl, byte [esi]	; Get our next instruction
16525
		inc	esi		; Increment PC
16526
		jmp	dword [z80regular+edx*4]
16527
 
16528
 
16529
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16530
 
16531
RegInst09:
16532
		mov	dh, ah	; Get our flags
16533
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
16534
		mov	[_orgval], bx	; Store our original value
16535
		add	bx, cx
16536
		lahf
16537
		mov	[cyclesRemaining], edi
16538
		mov	di, [_orgval]	; Get original
16539
		xor	di, bx ; XOR It with our computed value
16540
		xor	di, cx
16541
		and	di, 1000h	; Just our half carry
16542
		or		dx, di	; Or in our flags
16543
		and	ah, 01h	; Just carry
16544
		or	ah, dh
16545
		mov	edi, [cyclesRemaining]
16546
		xor	edx, edx
16547
		sub	edi, byte 11
16548
		js	near noMoreExec
16549
		mov	dl, byte [esi]	; Get our next instruction
16550
		inc	esi		; Increment PC
16551
		jmp	dword [z80regular+edx*4]
16552
 
16553
 
16554
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16555
 
16556
RegInst0a:
16557
		mov	[cyclesRemaining], edi
16558
		mov	edi, [_z80MemRead]	; Point to the read array
16559
 
16560
checkLoop315:
16561
		cmp	[edi], word 0ffffh ; End of the list?
16562
		je		memoryRead315
16563
		cmp	ecx, [edi]	; Are we smaller?
16564
		jb		nextAddr315		; Yes, go to the next address
16565
		cmp	ecx, [edi+4]	; Are we bigger?
16566
		jbe	callRoutine315
16567
 
16568
nextAddr315:
16569
		add	edi, 10h		; Next structure!
16570
		jmp	short checkLoop315
16571
 
16572
callRoutine315:
16573
		mov	dx, cx	; Get our address
16574
		call	ReadMemoryByte	; Standard read routine
16575
		mov	[_z80af], al	; Save our new accumulator
16576
		mov	ax, [_z80af]	; Get our AF back
16577
		jmp	short readExit315
16578
 
16579
memoryRead315:
16580
		mov	al, [ebp + ecx]	; Get our data
16581
 
16582
readExit315:
16583
		mov	edi, [cyclesRemaining]
16584
		xor	edx, edx
16585
		sub	edi, byte 7
16586
		js	near noMoreExec
16587
		mov	dl, byte [esi]	; Get our next instruction
16588
		inc	esi		; Increment PC
16589
		jmp	dword [z80regular+edx*4]
16590
 
16591
 
16592
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16593
 
16594
RegInst0b:
16595
		dec	cx
16596
		sub	edi, byte 6
16597
		js	near noMoreExec
16598
		mov	dl, byte [esi]	; Get our next instruction
16599
		inc	esi		; Increment PC
16600
		jmp	dword [z80regular+edx*4]
16601
 
16602
 
16603
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16604
 
16605
RegInst0c:
16606
		sahf
16607
		inc	cl
16608
		lahf
16609
		seto	dl
16610
		and	ah, 0fbh	; Knock out parity/overflow
16611
		shl	dl, 2
16612
		or		ah, dl
16613
		and	ah, 0fdh	; Knock out N!
16614
		sub	edi, byte 4
16615
		js	near noMoreExec
16616
		mov	dl, byte [esi]	; Get our next instruction
16617
		inc	esi		; Increment PC
16618
		jmp	dword [z80regular+edx*4]
16619
 
16620
 
16621
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16622
 
16623
RegInst0d:
16624
		sahf
16625
		dec	cl
16626
		lahf
16627
		seto	dl
16628
		and	ah, 0fbh	; Knock out parity/overflow
16629
		shl	dl, 2
16630
		or		ah, dl
16631
		or	ah, 02h	; Set negative!
16632
		sub	edi, byte 4
16633
		js	near noMoreExec
16634
		mov	dl, byte [esi]	; Get our next instruction
16635
		inc	esi		; Increment PC
16636
		jmp	dword [z80regular+edx*4]
16637
 
16638
 
16639
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16640
 
16641
RegInst0e:
16642
		mov	cl, [esi]	; Get our immediate value
16643
		inc	esi
16644
		sub	edi, byte 7
16645
		js	near noMoreExec
16646
		mov	dl, byte [esi]	; Get our next instruction
16647
		inc	esi		; Increment PC
16648
		jmp	dword [z80regular+edx*4]
16649
 
16650
 
16651
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16652
 
16653
RegInst0f:
16654
		sahf
16655
		ror	al, 1
16656
		lahf
16657
		and	ah, 0edh
16658
		sub	edi, byte 4
16659
		js	near noMoreExec
16660
		mov	dl, byte [esi]	; Get our next instruction
16661
		inc	esi		; Increment PC
16662
		jmp	dword [z80regular+edx*4]
16663
 
16664
 
16665
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16666
 
16667
RegInst10:
16668
		mov	dl, [esi] ; Get our relative offset
16669
		inc	esi	; Next instruction, please!
16670
		dec	ch	; Decrement B
16671
		jz	noJump	; Don't take the jump if it's done!
16672
; Otherwise, take the jump
16673
		sub	edi, 5
16674
		xchg	eax, edx
16675
		cbw
16676
		xchg 	eax, edx
16677
		sub	esi, ebp
16678
		add	si, dx
16679
		add	esi, ebp
16680
noJump:
16681
		xor	edx, edx
16682
		sub	edi, byte 8
16683
		js	near noMoreExec
16684
		mov	dl, byte [esi]	; Get our next instruction
16685
		inc	esi		; Increment PC
16686
		jmp	dword [z80regular+edx*4]
16687
 
16688
 
16689
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16690
 
16691
RegInst11:
16692
		mov	dx, [esi]	; Get our immediate value of DE
16693
		mov	word [_z80de], dx ; Store DE
16694
		xor	edx, edx
16695
		add	esi, 2
16696
		sub	edi, byte 10
16697
		js	near noMoreExec
16698
		mov	dl, byte [esi]	; Get our next instruction
16699
		inc	esi		; Increment PC
16700
		jmp	dword [z80regular+edx*4]
16701
 
16702
 
16703
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16704
 
16705
RegInst12:
16706
		mov	[cyclesRemaining], edi
16707
		mov	[_z80af], ax	; Store AF
16708
		mov	dx, [_z80de]
16709
		mov	edi, [_z80MemWrite]	; Point to the write array
16710
 
16711
checkLoop316:
16712
		cmp	[edi], word 0ffffh ; End of our list?
16713
		je	memoryWrite316	; Yes - go write it!
16714
		cmp	dx, [edi]	; Are we smaller?
16715
		jb	nextAddr316	; Yes... go to the next addr
16716
		cmp	dx, [edi+4]	; Are we smaller?
16717
		jbe	callRoutine316	; If not, go call it!
16718
 
16719
nextAddr316:
16720
		add	edi, 10h		; Next structure, please
16721
		jmp	short checkLoop316
16722
 
16723
callRoutine316:
16724
		call	WriteMemoryByte	; Go write the data!
16725
		jmp	short WriteMacroExit316
16726
memoryWrite316:
16727
		mov	[ebp + edx], al
16728
		mov	ax, [_z80af] ; Get our accumulator and flags
16729
WriteMacroExit316:
16730
		mov	edi, [cyclesRemaining]
16731
		xor	edx, edx
16732
		sub	edi, byte 7
16733
		js	near noMoreExec
16734
		mov	dl, byte [esi]	; Get our next instruction
16735
		inc	esi		; Increment PC
16736
		jmp	dword [z80regular+edx*4]
16737
 
16738
 
16739
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16740
 
16741
RegInst13:
16742
		inc	word [_z80de]
16743
		sub	edi, byte 6
16744
		js	near noMoreExec
16745
		mov	dl, byte [esi]	; Get our next instruction
16746
		inc	esi		; Increment PC
16747
		jmp	dword [z80regular+edx*4]
16748
 
16749
 
16750
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16751
 
16752
RegInst14:
16753
		sahf
16754
		inc	byte [_z80de + 1]
16755
		lahf
16756
		seto	dl
16757
		and	ah, 0fbh	; Knock out parity/overflow
16758
		shl	dl, 2
16759
		or		ah, dl
16760
		and	ah, 0fdh	; Knock out N!
16761
		sub	edi, byte 4
16762
		js	near noMoreExec
16763
		mov	dl, byte [esi]	; Get our next instruction
16764
		inc	esi		; Increment PC
16765
		jmp	dword [z80regular+edx*4]
16766
 
16767
 
16768
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16769
 
16770
RegInst15:
16771
		sahf
16772
		dec	byte [_z80de + 1]
16773
		lahf
16774
		seto	dl
16775
		and	ah, 0fbh	; Knock out parity/overflow
16776
		shl	dl, 2
16777
		or		ah, dl
16778
		or	ah, 02h	; Set negative!
16779
		sub	edi, byte 4
16780
		js	near noMoreExec
16781
		mov	dl, byte [esi]	; Get our next instruction
16782
		inc	esi		; Increment PC
16783
		jmp	dword [z80regular+edx*4]
16784
 
16785
 
16786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16787
 
16788
RegInst16:
16789
		mov	dl, [esi]	; Get our immediate value
16790
		mov	byte [_z80de + 1], dl	; Store our new value
16791
		inc	esi
16792
		sub	edi, byte 7
16793
		js	near noMoreExec
16794
		mov	dl, byte [esi]	; Get our next instruction
16795
		inc	esi		; Increment PC
16796
		jmp	dword [z80regular+edx*4]
16797
 
16798
 
16799
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16800
 
16801
RegInst17:
16802
		sahf
16803
		rcl	al, 1
16804
		lahf
16805
		and	ah, 0edh
16806
		sub	edi, byte 4
16807
		js	near noMoreExec
16808
		mov	dl, byte [esi]	; Get our next instruction
16809
		inc	esi		; Increment PC
16810
		jmp	dword [z80regular+edx*4]
16811
 
16812
 
16813
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16814
 
16815
RegInst18:
16816
		sub	esi, ebp
16817
		and	esi, 0ffffh
16818
		add	esi, ebp
16819
		mov	dl, [esi] ; Get our relative offset
16820
		inc	esi	; Next instruction, please!
16821
		cmp	dl, 0feh	; Jump to self?
16822
		je		yesJrMan	; Yup! Bail out!
16823
		xchg	eax, edx
16824
		cbw
16825
		xchg	eax, edx
16826
		sub	esi, ebp
16827
		add	si, dx
16828
		and	esi, 0ffffh	; Only the lower 16 bits
16829
		add	esi, ebp
16830
		xor	dh, dh
16831
noJumpMan317:
16832
		sub	edi, byte 12
16833
		js	near noMoreExec
16834
		mov	dl, byte [esi]	; Get our next instruction
16835
		inc	esi		; Increment PC
16836
		jmp	dword [z80regular+edx*4]
16837
 
16838
yesJrMan:
16839
		xor	edx, edx		; Zero me for later
16840
		mov	edi, edx
16841
		mov	[cyclesRemaining], edx
16842
		sub	esi, 2	; Back to the instruction again
16843
		jmp	noMoreExec
16844
 
16845
 
16846
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16847
 
16848
RegInst19:
16849
		mov	dh, ah	; Get our flags
16850
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
16851
		mov	[_orgval], bx	; Store our original value
16852
		add	bx, word [_z80de]
16853
		lahf
16854
		mov	[cyclesRemaining], edi
16855
		mov	di, [_orgval]	; Get original
16856
		xor	di, bx ; XOR It with our computed value
16857
		xor	di, word [_z80de]
16858
		and	di, 1000h	; Just our half carry
16859
		or		dx, di	; Or in our flags
16860
		and	ah, 01h	; Just carry
16861
		or	ah, dh
16862
		mov	edi, [cyclesRemaining]
16863
		xor	edx, edx
16864
		sub	edi, byte 11
16865
		js	near noMoreExec
16866
		mov	dl, byte [esi]	; Get our next instruction
16867
		inc	esi		; Increment PC
16868
		jmp	dword [z80regular+edx*4]
16869
 
16870
 
16871
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16872
 
16873
RegInst1a:
16874
		mov	dx, [_z80de]
16875
		mov	[cyclesRemaining], edi
16876
		mov	edi, [_z80MemRead]	; Point to the read array
16877
 
16878
checkLoop318:
16879
		cmp	[edi], word 0ffffh ; End of the list?
16880
		je		memoryRead318
16881
		cmp	edx, [edi]	; Are we smaller?
16882
		jb		nextAddr318		; Yes, go to the next address
16883
		cmp	edx, [edi+4]	; Are we bigger?
16884
		jbe	callRoutine318
16885
 
16886
nextAddr318:
16887
		add	edi, 10h		; Next structure!
16888
		jmp	short checkLoop318
16889
 
16890
callRoutine318:
16891
		call	ReadMemoryByte	; Standard read routine
16892
		mov	[_z80af], al	; Save our new accumulator
16893
		mov	ax, [_z80af]	; Get our AF back
16894
		jmp	short readExit318
16895
 
16896
memoryRead318:
16897
		mov	al, [ebp + edx]	; Get our data
16898
 
16899
readExit318:
16900
		mov	edi, [cyclesRemaining]
16901
		xor	edx, edx
16902
		sub	edi, byte 7
16903
		js	near noMoreExec
16904
		mov	dl, byte [esi]	; Get our next instruction
16905
		inc	esi		; Increment PC
16906
		jmp	dword [z80regular+edx*4]
16907
 
16908
 
16909
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16910
 
16911
RegInst1b:
16912
		dec	word [_z80de]
16913
		sub	edi, byte 6
16914
		js	near noMoreExec
16915
		mov	dl, byte [esi]	; Get our next instruction
16916
		inc	esi		; Increment PC
16917
		jmp	dword [z80regular+edx*4]
16918
 
16919
 
16920
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16921
 
16922
RegInst1c:
16923
		sahf
16924
		inc	byte [_z80de]
16925
		lahf
16926
		seto	dl
16927
		and	ah, 0fbh	; Knock out parity/overflow
16928
		shl	dl, 2
16929
		or		ah, dl
16930
		and	ah, 0fdh	; Knock out N!
16931
		sub	edi, byte 4
16932
		js	near noMoreExec
16933
		mov	dl, byte [esi]	; Get our next instruction
16934
		inc	esi		; Increment PC
16935
		jmp	dword [z80regular+edx*4]
16936
 
16937
 
16938
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16939
 
16940
RegInst1d:
16941
		sahf
16942
		dec	byte [_z80de]
16943
		lahf
16944
		seto	dl
16945
		and	ah, 0fbh	; Knock out parity/overflow
16946
		shl	dl, 2
16947
		or		ah, dl
16948
		or	ah, 02h	; Set negative!
16949
		sub	edi, byte 4
16950
		js	near noMoreExec
16951
		mov	dl, byte [esi]	; Get our next instruction
16952
		inc	esi		; Increment PC
16953
		jmp	dword [z80regular+edx*4]
16954
 
16955
 
16956
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16957
 
16958
RegInst1e:
16959
		mov	dl, [esi]	; Get our immediate value
16960
		mov	byte [_z80de], dl	; Store our new value
16961
		inc	esi
16962
		sub	edi, byte 7
16963
		js	near noMoreExec
16964
		mov	dl, byte [esi]	; Get our next instruction
16965
		inc	esi		; Increment PC
16966
		jmp	dword [z80regular+edx*4]
16967
 
16968
 
16969
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16970
 
16971
RegInst1f:
16972
		sahf
16973
		rcr	al, 1
16974
		lahf
16975
		and	ah, 0edh
16976
		sub	edi, byte 4
16977
		js	near noMoreExec
16978
		mov	dl, byte [esi]	; Get our next instruction
16979
		inc	esi		; Increment PC
16980
		jmp	dword [z80regular+edx*4]
16981
 
16982
 
16983
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
16984
 
16985
RegInst20:
16986
		sub	esi, ebp
16987
		and	esi, 0ffffh
16988
		add	esi, ebp
16989
		mov	dl, [esi] ; Get our relative offset
16990
		inc	esi	; Next instruction, please!
16991
		sahf
16992
		jnz	takeJump319
16993
		jmp	short noJumpMan319
16994
takeJump319:
16995
		sub	edi, 5
16996
		xchg	eax, edx
16997
		cbw
16998
		xchg	eax, edx
16999
		sub	esi, ebp
17000
		add	si, dx
17001
		and	esi, 0ffffh	; Only the lower 16 bits
17002
		add	esi, ebp
17003
		xor	dh, dh
17004
noJumpMan319:
17005
		sub	edi, byte 7
17006
		js	near noMoreExec
17007
		mov	dl, byte [esi]	; Get our next instruction
17008
		inc	esi		; Increment PC
17009
		jmp	dword [z80regular+edx*4]
17010
 
17011
 
17012
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17013
 
17014
RegInst21:
17015
		mov	bx, [esi]	; Get our immediate value of HL
17016
		add	esi, 2
17017
		sub	edi, byte 10
17018
		js	near noMoreExec
17019
		mov	dl, byte [esi]	; Get our next instruction
17020
		inc	esi		; Increment PC
17021
		jmp	dword [z80regular+edx*4]
17022
 
17023
 
17024
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17025
 
17026
RegInst22:
17027
		mov	dx, [esi]	; Get our address to write to
17028
		add	esi, 2		; Next address, please...
17029
		mov	[cyclesRemaining], edi
17030
		mov	edi, [_z80MemWrite]	; Point to the write array
17031
 
17032
checkLoop320:
17033
		cmp	[edi], word 0ffffh ; End of the list?
17034
		je		memoryWrite320
17035
		cmp	dx, [edi]	; Are we smaller?
17036
		jb		nextAddr320		; Yes, go to the next address
17037
		cmp	dx, [edi+4]	; Are we bigger?
17038
		jbe	callRoutine320
17039
 
17040
nextAddr320:
17041
		add	edi, 10h		; Next structure!
17042
		jmp	short checkLoop320
17043
 
17044
callRoutine320:
17045
		push	ax		; Save this for later
17046
		push	dx
17047
		mov	ax, bx
17048
		call	WriteMemoryByte
17049
		pop	dx
17050
		pop	ax
17051
		inc	dx
17052
 
17053
		push	ax
17054
		push	dx
17055
		mov	ax, bx
17056
		xchg	ah, al
17057
		call	WriteMemoryByte
17058
		pop	dx
17059
		pop	ax	; Restore us!
17060
		jmp	writeExit320
17061
 
17062
memoryWrite320:
17063
		mov	[ebp + edx], bx	; Store our word
17064
writeExit320:
17065
		mov	edi, [cyclesRemaining]
17066
		xor	edx, edx	; Zero our upper byte
17067
		sub	edi, byte 16
17068
		js	near noMoreExec
17069
		mov	dl, byte [esi]	; Get our next instruction
17070
		inc	esi		; Increment PC
17071
		jmp	dword [z80regular+edx*4]
17072
 
17073
 
17074
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17075
 
17076
RegInst23:
17077
		inc	bx
17078
		sub	edi, byte 6
17079
		js	near noMoreExec
17080
		mov	dl, byte [esi]	; Get our next instruction
17081
		inc	esi		; Increment PC
17082
		jmp	dword [z80regular+edx*4]
17083
 
17084
 
17085
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17086
 
17087
RegInst24:
17088
		sahf
17089
		inc	bh
17090
		lahf
17091
		seto	dl
17092
		and	ah, 0fbh	; Knock out parity/overflow
17093
		shl	dl, 2
17094
		or		ah, dl
17095
		and	ah, 0fdh	; Knock out N!
17096
		sub	edi, byte 4
17097
		js	near noMoreExec
17098
		mov	dl, byte [esi]	; Get our next instruction
17099
		inc	esi		; Increment PC
17100
		jmp	dword [z80regular+edx*4]
17101
 
17102
 
17103
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17104
 
17105
RegInst25:
17106
		sahf
17107
		dec	bh
17108
		lahf
17109
		seto	dl
17110
		and	ah, 0fbh	; Knock out parity/overflow
17111
		shl	dl, 2
17112
		or		ah, dl
17113
		or	ah, 02h	; Set negative!
17114
		sub	edi, byte 4
17115
		js	near noMoreExec
17116
		mov	dl, byte [esi]	; Get our next instruction
17117
		inc	esi		; Increment PC
17118
		jmp	dword [z80regular+edx*4]
17119
 
17120
 
17121
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17122
 
17123
RegInst26:
17124
		mov	bh, [esi]	; Get our immediate value
17125
		inc	esi
17126
		sub	edi, byte 7
17127
		js	near noMoreExec
17128
		mov	dl, byte [esi]	; Get our next instruction
17129
		inc	esi		; Increment PC
17130
		jmp	dword [z80regular+edx*4]
17131
 
17132
 
17133
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17134
 
17135
RegInst27:
17136
		mov	dh, ah
17137
		and	dh, 02ah
17138
		test	ah, 02h	; Were we doing a subtraction?
17139
		jnz	handleNeg ; Nope!
17140
		sahf
17141
		daa
17142
		lahf
17143
		jmp	short endDaa
17144
handleNeg:
17145
		sahf
17146
		das
17147
		lahf
17148
endDaa:
17149
		and	ah, 0d5h
17150
		or	ah, dh
17151
		xor	edx, edx
17152
		sub	edi, byte 4
17153
		js	near noMoreExec
17154
		mov	dl, byte [esi]	; Get our next instruction
17155
		inc	esi		; Increment PC
17156
		jmp	dword [z80regular+edx*4]
17157
 
17158
 
17159
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17160
 
17161
RegInst28:
17162
		sub	esi, ebp
17163
		and	esi, 0ffffh
17164
		add	esi, ebp
17165
		mov	dl, [esi] ; Get our relative offset
17166
		inc	esi	; Next instruction, please!
17167
		sahf
17168
		jz	takeJump321
17169
		jmp	short noJumpMan321
17170
takeJump321:
17171
		sub	edi, 5
17172
		xchg	eax, edx
17173
		cbw
17174
		xchg	eax, edx
17175
		sub	esi, ebp
17176
		add	si, dx
17177
		and	esi, 0ffffh	; Only the lower 16 bits
17178
		add	esi, ebp
17179
		xor	dh, dh
17180
noJumpMan321:
17181
		sub	edi, byte 7
17182
		js	near noMoreExec
17183
		mov	dl, byte [esi]	; Get our next instruction
17184
		inc	esi		; Increment PC
17185
		jmp	dword [z80regular+edx*4]
17186
 
17187
 
17188
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17189
 
17190
RegInst29:
17191
		mov	dh, ah	; Get our flags
17192
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
17193
		mov	[_orgval], bx	; Store our original value
17194
		add	bx, bx
17195
		lahf
17196
		mov	[cyclesRemaining], edi
17197
		mov	di, [_orgval]	; Get original
17198
		xor	di, bx ; XOR It with our computed value
17199
		xor	di, bx
17200
		and	di, 1000h	; Just our half carry
17201
		or		dx, di	; Or in our flags
17202
		and	ah, 01h	; Just carry
17203
		or	ah, dh
17204
		mov	edi, [cyclesRemaining]
17205
		xor	edx, edx
17206
		sub	edi, byte 11
17207
		js	near noMoreExec
17208
		mov	dl, byte [esi]	; Get our next instruction
17209
		inc	esi		; Increment PC
17210
		jmp	dword [z80regular+edx*4]
17211
 
17212
 
17213
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17214
 
17215
RegInst2a:
17216
		mov	dx, [esi]	; Get address to load
17217
		add	esi, 2	; Skip over it so we don't execute it
17218
		mov	[cyclesRemaining], edi
17219
		mov	edi, [_z80MemRead]	; Point to the read array
17220
 
17221
checkLoop322:
17222
		cmp	[edi], word 0ffffh ; End of the list?
17223
		je		memoryRead322
17224
		cmp	dx, [edi]	; Are we smaller?
17225
		jb		nextAddr322		; Yes, go to the next address
17226
		cmp	dx, [edi+4]	; Are we bigger?
17227
		jbe	callRoutine322
17228
 
17229
nextAddr322:
17230
		add	edi, 10h		; Next structure!
17231
		jmp	short checkLoop322
17232
 
17233
callRoutine322:
17234
		push	ax		; Save this for later
17235
		push	dx		; Save address
17236
		call	ReadMemoryByte	; Standard read routine
17237
		pop	dx		; Restore our address
17238
		inc	dx		; Next byte, please
17239
		push	ax		; Save returned byte
17240
		call	ReadMemoryByte	; Standard read routine
17241
		xchg	ah, al	; Swap for endian's sake
17242
		pop	dx	; Restore LSB
17243
		mov	dh, ah	; Our word is now in DX
17244
		pop	ax		; Restore this
17245
		mov	bx, dx	; Store our word
17246
		jmp	readExit322
17247
 
17248
memoryRead322:
17249
		mov	bx, [ebp + edx]
17250
readExit322:
17251
		mov	edi, [cyclesRemaining]
17252
		xor	edx, edx
17253
		sub	edi, byte 16
17254
		js	near noMoreExec
17255
		mov	dl, byte [esi]	; Get our next instruction
17256
		inc	esi		; Increment PC
17257
		jmp	dword [z80regular+edx*4]
17258
 
17259
 
17260
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17261
 
17262
RegInst2b:
17263
		dec	bx
17264
		sub	edi, byte 6
17265
		js	near noMoreExec
17266
		mov	dl, byte [esi]	; Get our next instruction
17267
		inc	esi		; Increment PC
17268
		jmp	dword [z80regular+edx*4]
17269
 
17270
 
17271
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17272
 
17273
RegInst2c:
17274
		sahf
17275
		inc	bl
17276
		lahf
17277
		seto	dl
17278
		and	ah, 0fbh	; Knock out parity/overflow
17279
		shl	dl, 2
17280
		or		ah, dl
17281
		and	ah, 0fdh	; Knock out N!
17282
		sub	edi, byte 4
17283
		js	near noMoreExec
17284
		mov	dl, byte [esi]	; Get our next instruction
17285
		inc	esi		; Increment PC
17286
		jmp	dword [z80regular+edx*4]
17287
 
17288
 
17289
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17290
 
17291
RegInst2d:
17292
		sahf
17293
		dec	bl
17294
		lahf
17295
		seto	dl
17296
		and	ah, 0fbh	; Knock out parity/overflow
17297
		shl	dl, 2
17298
		or		ah, dl
17299
		or	ah, 02h	; Set negative!
17300
		sub	edi, byte 4
17301
		js	near noMoreExec
17302
		mov	dl, byte [esi]	; Get our next instruction
17303
		inc	esi		; Increment PC
17304
		jmp	dword [z80regular+edx*4]
17305
 
17306
 
17307
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17308
 
17309
RegInst2e:
17310
		mov	bl, [esi]	; Get our immediate value
17311
		inc	esi
17312
		sub	edi, byte 7
17313
		js	near noMoreExec
17314
		mov	dl, byte [esi]	; Get our next instruction
17315
		inc	esi		; Increment PC
17316
		jmp	dword [z80regular+edx*4]
17317
 
17318
 
17319
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17320
 
17321
RegInst2f:
17322
		not	al
17323
		or	ah, 012h	; N And H are now on!
17324
		sub	edi, byte 4
17325
		js	near noMoreExec
17326
		mov	dl, byte [esi]	; Get our next instruction
17327
		inc	esi		; Increment PC
17328
		jmp	dword [z80regular+edx*4]
17329
 
17330
 
17331
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17332
 
17333
RegInst30:
17334
		sub	esi, ebp
17335
		and	esi, 0ffffh
17336
		add	esi, ebp
17337
		mov	dl, [esi] ; Get our relative offset
17338
		inc	esi	; Next instruction, please!
17339
		sahf
17340
		jnc	takeJump323
17341
		jmp	short noJumpMan323
17342
takeJump323:
17343
		sub	edi, 5
17344
		xchg	eax, edx
17345
		cbw
17346
		xchg	eax, edx
17347
		sub	esi, ebp
17348
		add	si, dx
17349
		and	esi, 0ffffh	; Only the lower 16 bits
17350
		add	esi, ebp
17351
		xor	dh, dh
17352
noJumpMan323:
17353
		sub	edi, byte 7
17354
		js	near noMoreExec
17355
		mov	dl, byte [esi]	; Get our next instruction
17356
		inc	esi		; Increment PC
17357
		jmp	dword [z80regular+edx*4]
17358
 
17359
 
17360
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17361
 
17362
RegInst31:
17363
		mov	dx, [esi]	; Get our immediate value of SP
17364
		mov	word [_z80sp], dx	; Store it!
17365
		xor	edx, edx
17366
		add	esi, 2
17367
		sub	edi, byte 10
17368
		js	near noMoreExec
17369
		mov	dl, byte [esi]	; Get our next instruction
17370
		inc	esi		; Increment PC
17371
		jmp	dword [z80regular+edx*4]
17372
 
17373
 
17374
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17375
 
17376
RegInst32:
17377
		mov	dx, [esi]	; Get our address to write to
17378
		add	esi, 2		; Next address, please...
17379
		mov	[cyclesRemaining], edi
17380
		mov	[_z80af], ax	; Store AF
17381
		mov	edi, [_z80MemWrite]	; Point to the write array
17382
 
17383
checkLoop324:
17384
		cmp	[edi], word 0ffffh ; End of our list?
17385
		je	memoryWrite324	; Yes - go write it!
17386
		cmp	dx, [edi]	; Are we smaller?
17387
		jb	nextAddr324	; Yes... go to the next addr
17388
		cmp	dx, [edi+4]	; Are we smaller?
17389
		jbe	callRoutine324	; If not, go call it!
17390
 
17391
nextAddr324:
17392
		add	edi, 10h		; Next structure, please
17393
		jmp	short checkLoop324
17394
 
17395
callRoutine324:
17396
		call	WriteMemoryByte	; Go write the data!
17397
		jmp	short WriteMacroExit324
17398
memoryWrite324:
17399
		mov	[ebp + edx], al
17400
		mov	ax, [_z80af] ; Get our accumulator and flags
17401
WriteMacroExit324:
17402
		mov	edi, [cyclesRemaining]
17403
		xor	edx, edx	; Zero our upper byte
17404
		sub	edi, byte 13
17405
		js	near noMoreExec
17406
		mov	dl, byte [esi]	; Get our next instruction
17407
		inc	esi		; Increment PC
17408
		jmp	dword [z80regular+edx*4]
17409
 
17410
 
17411
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17412
 
17413
RegInst33:
17414
		inc	word [_z80sp]
17415
		sub	edi, byte 6
17416
		js	near noMoreExec
17417
		mov	dl, byte [esi]	; Get our next instruction
17418
		inc	esi		; Increment PC
17419
		jmp	dword [z80regular+edx*4]
17420
 
17421
 
17422
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17423
 
17424
RegInst34:
17425
		mov	[cyclesRemaining], edi
17426
		mov	edi, [_z80MemRead]	; Point to the read array
17427
 
17428
checkLoop325:
17429
		cmp	[edi], word 0ffffh ; End of the list?
17430
		je		memoryRead325
17431
		cmp	ebx, [edi]	; Are we smaller?
17432
		jb		nextAddr325		; Yes, go to the next address
17433
		cmp	ebx, [edi+4]	; Are we bigger?
17434
		jbe	callRoutine325
17435
 
17436
nextAddr325:
17437
		add	edi, 10h		; Next structure!
17438
		jmp	short checkLoop325
17439
 
17440
callRoutine325:
17441
		mov	dx, bx	; Get our address
17442
		call	ReadMemoryByte	; Standard read routine
17443
		mov	dl, al	; Put our returned value here
17444
		mov	ax, [_z80af]	; Get our AF back
17445
		jmp	short readExit325
17446
 
17447
memoryRead325:
17448
		mov	dl, [ebp + ebx]	; Get our data
17449
 
17450
readExit325:
17451
		mov	edi, [cyclesRemaining]
17452
		sahf
17453
		inc	dl
17454
		lahf
17455
		o16	pushf
17456
		shl	edx, 16
17457
		and	ah, 0fbh	;	Knock out parity/overflow
17458
		pop	dx
17459
		and	dh, 08h ; Just the overflow
17460
		shr	dh, 1	; Shift it into position
17461
		or	ah, dh	; OR It in with the real flags
17462
		shr	edx, 16
17463
		and	ah, 0fdh	; Knock out N!
17464
		mov	[cyclesRemaining], edi
17465
		mov	[_z80af], ax	; Store AF
17466
		mov	al, dl	; And our data to write
17467
		mov	edi, [_z80MemWrite]	; Point to the write array
17468
 
17469
checkLoop326:
17470
		cmp	[edi], word 0ffffh ; End of our list?
17471
		je	memoryWrite326	; Yes - go write it!
17472
		cmp	bx, [edi]	; Are we smaller?
17473
		jb	nextAddr326	; Yes... go to the next addr
17474
		cmp	bx, [edi+4]	; Are we smaller?
17475
		jbe	callRoutine326	; If not, go call it!
17476
 
17477
nextAddr326:
17478
		add	edi, 10h		; Next structure, please
17479
		jmp	short checkLoop326
17480
 
17481
callRoutine326:
17482
		mov	dx, bx	; Get our address to target
17483
		call	WriteMemoryByte	; Go write the data!
17484
		jmp	short WriteMacroExit326
17485
memoryWrite326:
17486
		mov	[ebp + ebx], dl
17487
		mov	ax, [_z80af] ; Get our accumulator and flags
17488
WriteMacroExit326:
17489
		mov	edi, [cyclesRemaining]
17490
		xor	edx, edx
17491
		sub	edi, byte 11
17492
		js	near noMoreExec
17493
		mov	dl, byte [esi]	; Get our next instruction
17494
		inc	esi		; Increment PC
17495
		jmp	dword [z80regular+edx*4]
17496
 
17497
 
17498
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17499
 
17500
RegInst35:
17501
		mov	[cyclesRemaining], edi
17502
		mov	edi, [_z80MemRead]	; Point to the read array
17503
 
17504
checkLoop327:
17505
		cmp	[edi], word 0ffffh ; End of the list?
17506
		je		memoryRead327
17507
		cmp	ebx, [edi]	; Are we smaller?
17508
		jb		nextAddr327		; Yes, go to the next address
17509
		cmp	ebx, [edi+4]	; Are we bigger?
17510
		jbe	callRoutine327
17511
 
17512
nextAddr327:
17513
		add	edi, 10h		; Next structure!
17514
		jmp	short checkLoop327
17515
 
17516
callRoutine327:
17517
		mov	dx, bx	; Get our address
17518
		call	ReadMemoryByte	; Standard read routine
17519
		mov	dl, al	; Put our returned value here
17520
		mov	ax, [_z80af]	; Get our AF back
17521
		jmp	short readExit327
17522
 
17523
memoryRead327:
17524
		mov	dl, [ebp + ebx]	; Get our data
17525
 
17526
readExit327:
17527
		mov	edi, [cyclesRemaining]
17528
		sahf
17529
		dec	dl
17530
		lahf
17531
		o16	pushf
17532
		shl	edx, 16
17533
		and	ah, 0fbh	;	Knock out parity/overflow
17534
		pop	dx
17535
		and	dh, 08h ; Just the overflow
17536
		shr	dh, 1	; Shift it into position
17537
		or	ah, dh	; OR It in with the real flags
17538
		shr	edx, 16
17539
		or		ah, 02h	; Make it N!
17540
		mov	[cyclesRemaining], edi
17541
		mov	[_z80af], ax	; Store AF
17542
		mov	al, dl	; And our data to write
17543
		mov	edi, [_z80MemWrite]	; Point to the write array
17544
 
17545
checkLoop328:
17546
		cmp	[edi], word 0ffffh ; End of our list?
17547
		je	memoryWrite328	; Yes - go write it!
17548
		cmp	bx, [edi]	; Are we smaller?
17549
		jb	nextAddr328	; Yes... go to the next addr
17550
		cmp	bx, [edi+4]	; Are we smaller?
17551
		jbe	callRoutine328	; If not, go call it!
17552
 
17553
nextAddr328:
17554
		add	edi, 10h		; Next structure, please
17555
		jmp	short checkLoop328
17556
 
17557
callRoutine328:
17558
		mov	dx, bx	; Get our address to target
17559
		call	WriteMemoryByte	; Go write the data!
17560
		jmp	short WriteMacroExit328
17561
memoryWrite328:
17562
		mov	[ebp + ebx], dl
17563
		mov	ax, [_z80af] ; Get our accumulator and flags
17564
WriteMacroExit328:
17565
		mov	edi, [cyclesRemaining]
17566
		xor	edx, edx
17567
		sub	edi, byte 11
17568
		js	near noMoreExec
17569
		mov	dl, byte [esi]	; Get our next instruction
17570
		inc	esi		; Increment PC
17571
		jmp	dword [z80regular+edx*4]
17572
 
17573
 
17574
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17575
 
17576
RegInst36:
17577
		mov	[cyclesRemaining], edi
17578
		mov	[_z80af], ax	; Store AF
17579
		mov	al, [esi]	; And our data to write
17580
		inc	esi	; Increment our program counter
17581
		mov	edi, [_z80MemWrite]	; Point to the write array
17582
 
17583
checkLoop329:
17584
		cmp	[edi], word 0ffffh ; End of our list?
17585
		je	memoryWrite329	; Yes - go write it!
17586
		cmp	bx, [edi]	; Are we smaller?
17587
		jb	nextAddr329	; Yes... go to the next addr
17588
		cmp	bx, [edi+4]	; Are we smaller?
17589
		jbe	callRoutine329	; If not, go call it!
17590
 
17591
nextAddr329:
17592
		add	edi, 10h		; Next structure, please
17593
		jmp	short checkLoop329
17594
 
17595
callRoutine329:
17596
		mov	dx, bx	; Get our address to target
17597
		call	WriteMemoryByte	; Go write the data!
17598
		jmp	short WriteMacroExit329
17599
memoryWrite329:
17600
		mov	[ebp + ebx], al	; Store our direct value
17601
		mov	ax, [_z80af] ; Get our accumulator and flags
17602
WriteMacroExit329:
17603
		mov	edi, [cyclesRemaining]
17604
		xor	edx, edx
17605
		sub	edi, byte 10
17606
		js	near noMoreExec
17607
		mov	dl, byte [esi]	; Get our next instruction
17608
		inc	esi		; Increment PC
17609
		jmp	dword [z80regular+edx*4]
17610
 
17611
 
17612
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17613
 
17614
RegInst37:
17615
		or	ah, 1
17616
		and	ah,0edh
17617
		sub	edi, byte 4
17618
		js	near noMoreExec
17619
		mov	dl, byte [esi]	; Get our next instruction
17620
		inc	esi		; Increment PC
17621
		jmp	dword [z80regular+edx*4]
17622
 
17623
 
17624
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17625
 
17626
RegInst38:
17627
		sub	esi, ebp
17628
		and	esi, 0ffffh
17629
		add	esi, ebp
17630
		mov	dl, [esi] ; Get our relative offset
17631
		inc	esi	; Next instruction, please!
17632
		sahf
17633
		jc	takeJump330
17634
		jmp	short noJumpMan330
17635
takeJump330:
17636
		sub	edi, 5
17637
		xchg	eax, edx
17638
		cbw
17639
		xchg	eax, edx
17640
		sub	esi, ebp
17641
		add	si, dx
17642
		and	esi, 0ffffh	; Only the lower 16 bits
17643
		add	esi, ebp
17644
		xor	dh, dh
17645
noJumpMan330:
17646
		sub	edi, byte 7
17647
		js	near noMoreExec
17648
		mov	dl, byte [esi]	; Get our next instruction
17649
		inc	esi		; Increment PC
17650
		jmp	dword [z80regular+edx*4]
17651
 
17652
 
17653
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17654
 
17655
RegInst39:
17656
		mov	dh, ah	; Get our flags
17657
		and	dh, 0ech	; Preserve the top three and bits 2 & 3
17658
		mov	[_orgval], bx	; Store our original value
17659
		add	bx, word [_z80sp]
17660
		lahf
17661
		mov	[cyclesRemaining], edi
17662
		mov	di, [_orgval]	; Get original
17663
		xor	di, bx ; XOR It with our computed value
17664
		xor	di, word [_z80sp]
17665
		and	di, 1000h	; Just our half carry
17666
		or		dx, di	; Or in our flags
17667
		and	ah, 01h	; Just carry
17668
		or	ah, dh
17669
		mov	edi, [cyclesRemaining]
17670
		xor	edx, edx
17671
		sub	edi, byte 11
17672
		js	near noMoreExec
17673
		mov	dl, byte [esi]	; Get our next instruction
17674
		inc	esi		; Increment PC
17675
		jmp	dword [z80regular+edx*4]
17676
 
17677
 
17678
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17679
 
17680
RegInst3a:
17681
		mov	dx, [esi]	; Get our address
17682
		add	esi, 2		; Skip past the address
17683
		mov	[cyclesRemaining], edi
17684
		mov	edi, [_z80MemRead]	; Point to the read array
17685
 
17686
checkLoop331:
17687
		cmp	[edi], word 0ffffh ; End of the list?
17688
		je		memoryRead331
17689
		cmp	edx, [edi]	; Are we smaller?
17690
		jb		nextAddr331		; Yes, go to the next address
17691
		cmp	edx, [edi+4]	; Are we bigger?
17692
		jbe	callRoutine331
17693
 
17694
nextAddr331:
17695
		add	edi, 10h		; Next structure!
17696
		jmp	short checkLoop331
17697
 
17698
callRoutine331:
17699
		call	ReadMemoryByte	; Standard read routine
17700
		mov	[_z80af], al	; Save our new accumulator
17701
		mov	ax, [_z80af]	; Get our AF back
17702
		jmp	short readExit331
17703
 
17704
memoryRead331:
17705
		mov	al, [ebp + edx]	; Get our data
17706
 
17707
readExit331:
17708
		mov	edi, [cyclesRemaining]
17709
		xor	edx, edx	; Make sure we don't hose things
17710
		sub	edi, byte 13
17711
		js	near noMoreExec
17712
		mov	dl, byte [esi]	; Get our next instruction
17713
		inc	esi		; Increment PC
17714
		jmp	dword [z80regular+edx*4]
17715
 
17716
 
17717
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17718
 
17719
RegInst3b:
17720
		dec	word [_z80sp]
17721
		sub	edi, byte 6
17722
		js	near noMoreExec
17723
		mov	dl, byte [esi]	; Get our next instruction
17724
		inc	esi		; Increment PC
17725
		jmp	dword [z80regular+edx*4]
17726
 
17727
 
17728
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17729
 
17730
RegInst3c:
17731
		sahf
17732
		inc	al
17733
		lahf
17734
		seto	dl
17735
		and	ah, 0fbh	; Knock out parity/overflow
17736
		shl	dl, 2
17737
		or		ah, dl
17738
		and	ah, 0fdh	; Knock out N!
17739
		sub	edi, byte 4
17740
		js	near noMoreExec
17741
		mov	dl, byte [esi]	; Get our next instruction
17742
		inc	esi		; Increment PC
17743
		jmp	dword [z80regular+edx*4]
17744
 
17745
 
17746
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17747
 
17748
RegInst3d:
17749
		sahf
17750
		dec	al
17751
		lahf
17752
		seto	dl
17753
		and	ah, 0fbh	; Knock out parity/overflow
17754
		shl	dl, 2
17755
		or		ah, dl
17756
		or	ah, 02h	; Set negative!
17757
		sub	edi, byte 4
17758
		js	near noMoreExec
17759
		mov	dl, byte [esi]	; Get our next instruction
17760
		inc	esi		; Increment PC
17761
		jmp	dword [z80regular+edx*4]
17762
 
17763
 
17764
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17765
 
17766
RegInst3e:
17767
		mov	al, [esi]	; Get our immediate value
17768
		inc	esi
17769
		sub	edi, byte 7
17770
		js	near noMoreExec
17771
		mov	dl, byte [esi]	; Get our next instruction
17772
		inc	esi		; Increment PC
17773
		jmp	dword [z80regular+edx*4]
17774
 
17775
 
17776
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17777
 
17778
RegInst3f:
17779
		mov	dl, ah
17780
		and	dl, 01h
17781
		shl	dl, 4
17782
		xor	ah, 01h
17783
		and	ah, 0edh
17784
		or	ah, dl
17785
		sub	edi, byte 4
17786
		js	near noMoreExec
17787
		mov	dl, byte [esi]	; Get our next instruction
17788
		inc	esi		; Increment PC
17789
		jmp	dword [z80regular+edx*4]
17790
 
17791
 
17792
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17793
 
17794
RegInst40:
17795
		sub	edi, byte 4
17796
		js	near noMoreExec
17797
		mov	dl, byte [esi]	; Get our next instruction
17798
		inc	esi		; Increment PC
17799
		jmp	dword [z80regular+edx*4]
17800
 
17801
 
17802
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17803
 
17804
RegInst41:
17805
		mov	ch, cl
17806
		sub	edi, byte 4
17807
		js	near noMoreExec
17808
		mov	dl, byte [esi]	; Get our next instruction
17809
		inc	esi		; Increment PC
17810
		jmp	dword [z80regular+edx*4]
17811
 
17812
 
17813
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17814
 
17815
RegInst42:
17816
		mov	ch, byte [_z80de + 1]
17817
		sub	edi, byte 4
17818
		js	near noMoreExec
17819
		mov	dl, byte [esi]	; Get our next instruction
17820
		inc	esi		; Increment PC
17821
		jmp	dword [z80regular+edx*4]
17822
 
17823
 
17824
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17825
 
17826
RegInst43:
17827
		mov	ch, byte [_z80de]
17828
		sub	edi, byte 4
17829
		js	near noMoreExec
17830
		mov	dl, byte [esi]	; Get our next instruction
17831
		inc	esi		; Increment PC
17832
		jmp	dword [z80regular+edx*4]
17833
 
17834
 
17835
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17836
 
17837
RegInst44:
17838
		mov	ch, bh
17839
		sub	edi, byte 4
17840
		js	near noMoreExec
17841
		mov	dl, byte [esi]	; Get our next instruction
17842
		inc	esi		; Increment PC
17843
		jmp	dword [z80regular+edx*4]
17844
 
17845
 
17846
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17847
 
17848
RegInst45:
17849
		mov	ch, bl
17850
		sub	edi, byte 4
17851
		js	near noMoreExec
17852
		mov	dl, byte [esi]	; Get our next instruction
17853
		inc	esi		; Increment PC
17854
		jmp	dword [z80regular+edx*4]
17855
 
17856
 
17857
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17858
 
17859
RegInst46:
17860
		mov	[cyclesRemaining], edi
17861
		mov	edi, [_z80MemRead]	; Point to the read array
17862
 
17863
checkLoop332:
17864
		cmp	[edi], word 0ffffh ; End of the list?
17865
		je		memoryRead332
17866
		cmp	ebx, [edi]	; Are we smaller?
17867
		jb		nextAddr332		; Yes, go to the next address
17868
		cmp	ebx, [edi+4]	; Are we bigger?
17869
		jbe	callRoutine332
17870
 
17871
nextAddr332:
17872
		add	edi, 10h		; Next structure!
17873
		jmp	short checkLoop332
17874
 
17875
callRoutine332:
17876
		mov	dx, bx	; Get our address
17877
		call	ReadMemoryByte	; Standard read routine
17878
		mov	ch, al	; Put our returned value here
17879
		mov	ax, [_z80af]	; Get our AF back
17880
		jmp	short readExit332
17881
 
17882
memoryRead332:
17883
		mov	ch, [ebp + ebx]	; Get our data
17884
 
17885
readExit332:
17886
		mov	edi, [cyclesRemaining]
17887
		xor	edx, edx
17888
		sub	edi, byte 7
17889
		js	near noMoreExec
17890
		mov	dl, byte [esi]	; Get our next instruction
17891
		inc	esi		; Increment PC
17892
		jmp	dword [z80regular+edx*4]
17893
 
17894
 
17895
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17896
 
17897
RegInst47:
17898
		mov	ch, al
17899
		sub	edi, byte 4
17900
		js	near noMoreExec
17901
		mov	dl, byte [esi]	; Get our next instruction
17902
		inc	esi		; Increment PC
17903
		jmp	dword [z80regular+edx*4]
17904
 
17905
 
17906
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17907
 
17908
RegInst48:
17909
		mov	cl, ch
17910
		sub	edi, byte 4
17911
		js	near noMoreExec
17912
		mov	dl, byte [esi]	; Get our next instruction
17913
		inc	esi		; Increment PC
17914
		jmp	dword [z80regular+edx*4]
17915
 
17916
 
17917
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17918
 
17919
RegInst49:
17920
		sub	edi, byte 4
17921
		js	near noMoreExec
17922
		mov	dl, byte [esi]	; Get our next instruction
17923
		inc	esi		; Increment PC
17924
		jmp	dword [z80regular+edx*4]
17925
 
17926
 
17927
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17928
 
17929
RegInst4a:
17930
		mov	cl, byte [_z80de + 1]
17931
		sub	edi, byte 4
17932
		js	near noMoreExec
17933
		mov	dl, byte [esi]	; Get our next instruction
17934
		inc	esi		; Increment PC
17935
		jmp	dword [z80regular+edx*4]
17936
 
17937
 
17938
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17939
 
17940
RegInst4b:
17941
		mov	cl, byte [_z80de]
17942
		sub	edi, byte 4
17943
		js	near noMoreExec
17944
		mov	dl, byte [esi]	; Get our next instruction
17945
		inc	esi		; Increment PC
17946
		jmp	dword [z80regular+edx*4]
17947
 
17948
 
17949
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17950
 
17951
RegInst4c:
17952
		mov	cl, bh
17953
		sub	edi, byte 4
17954
		js	near noMoreExec
17955
		mov	dl, byte [esi]	; Get our next instruction
17956
		inc	esi		; Increment PC
17957
		jmp	dword [z80regular+edx*4]
17958
 
17959
 
17960
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17961
 
17962
RegInst4d:
17963
		mov	cl, bl
17964
		sub	edi, byte 4
17965
		js	near noMoreExec
17966
		mov	dl, byte [esi]	; Get our next instruction
17967
		inc	esi		; Increment PC
17968
		jmp	dword [z80regular+edx*4]
17969
 
17970
 
17971
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
17972
 
17973
RegInst4e:
17974
		mov	[cyclesRemaining], edi
17975
		mov	edi, [_z80MemRead]	; Point to the read array
17976
 
17977
checkLoop333:
17978
		cmp	[edi], word 0ffffh ; End of the list?
17979
		je		memoryRead333
17980
		cmp	ebx, [edi]	; Are we smaller?
17981
		jb		nextAddr333		; Yes, go to the next address
17982
		cmp	ebx, [edi+4]	; Are we bigger?
17983
		jbe	callRoutine333
17984
 
17985
nextAddr333:
17986
		add	edi, 10h		; Next structure!
17987
		jmp	short checkLoop333
17988
 
17989
callRoutine333:
17990
		mov	dx, bx	; Get our address
17991
		call	ReadMemoryByte	; Standard read routine
17992
		mov	cl, al	; Put our returned value here
17993
		mov	ax, [_z80af]	; Get our AF back
17994
		jmp	short readExit333
17995
 
17996
memoryRead333:
17997
		mov	cl, [ebp + ebx]	; Get our data
17998
 
17999
readExit333:
18000
		mov	edi, [cyclesRemaining]
18001
		xor	edx, edx
18002
		sub	edi, byte 7
18003
		js	near noMoreExec
18004
		mov	dl, byte [esi]	; Get our next instruction
18005
		inc	esi		; Increment PC
18006
		jmp	dword [z80regular+edx*4]
18007
 
18008
 
18009
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18010
 
18011
RegInst4f:
18012
		mov	cl, al
18013
		sub	edi, byte 4
18014
		js	near noMoreExec
18015
		mov	dl, byte [esi]	; Get our next instruction
18016
		inc	esi		; Increment PC
18017
		jmp	dword [z80regular+edx*4]
18018
 
18019
 
18020
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18021
 
18022
RegInst50:
18023
		mov	byte [_z80de + 1], ch
18024
		sub	edi, byte 4
18025
		js	near noMoreExec
18026
		mov	dl, byte [esi]	; Get our next instruction
18027
		inc	esi		; Increment PC
18028
		jmp	dword [z80regular+edx*4]
18029
 
18030
 
18031
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18032
 
18033
RegInst51:
18034
		mov	byte [_z80de + 1], cl
18035
		sub	edi, byte 4
18036
		js	near noMoreExec
18037
		mov	dl, byte [esi]	; Get our next instruction
18038
		inc	esi		; Increment PC
18039
		jmp	dword [z80regular+edx*4]
18040
 
18041
 
18042
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18043
 
18044
RegInst52:
18045
		sub	edi, byte 4
18046
		js	near noMoreExec
18047
		mov	dl, byte [esi]	; Get our next instruction
18048
		inc	esi		; Increment PC
18049
		jmp	dword [z80regular+edx*4]
18050
 
18051
 
18052
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18053
 
18054
RegInst53:
18055
		mov	dl, byte [_z80de]
18056
		mov	[_z80de + 1], dl
18057
		sub	edi, byte 4
18058
		js	near noMoreExec
18059
		mov	dl, byte [esi]	; Get our next instruction
18060
		inc	esi		; Increment PC
18061
		jmp	dword [z80regular+edx*4]
18062
 
18063
 
18064
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18065
 
18066
RegInst54:
18067
		mov	byte [_z80de + 1], bh
18068
		sub	edi, byte 4
18069
		js	near noMoreExec
18070
		mov	dl, byte [esi]	; Get our next instruction
18071
		inc	esi		; Increment PC
18072
		jmp	dword [z80regular+edx*4]
18073
 
18074
 
18075
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18076
 
18077
RegInst55:
18078
		mov	byte [_z80de + 1], bl
18079
		sub	edi, byte 4
18080
		js	near noMoreExec
18081
		mov	dl, byte [esi]	; Get our next instruction
18082
		inc	esi		; Increment PC
18083
		jmp	dword [z80regular+edx*4]
18084
 
18085
 
18086
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18087
 
18088
RegInst56:
18089
		mov	[cyclesRemaining], edi
18090
		mov	edi, [_z80MemRead]	; Point to the read array
18091
 
18092
checkLoop334:
18093
		cmp	[edi], word 0ffffh ; End of the list?
18094
		je		memoryRead334
18095
		cmp	ebx, [edi]	; Are we smaller?
18096
		jb		nextAddr334		; Yes, go to the next address
18097
		cmp	ebx, [edi+4]	; Are we bigger?
18098
		jbe	callRoutine334
18099
 
18100
nextAddr334:
18101
		add	edi, 10h		; Next structure!
18102
		jmp	short checkLoop334
18103
 
18104
callRoutine334:
18105
		mov	dx, bx	; Get our address
18106
		call	ReadMemoryByte	; Standard read routine
18107
		mov	dh, al	; Put our returned value here
18108
		mov	ax, [_z80af]	; Get our AF back
18109
		jmp	short readExit334
18110
 
18111
memoryRead334:
18112
		mov	dh, [ebp + ebx]	; Get our data
18113
 
18114
readExit334:
18115
		mov	edi, [cyclesRemaining]
18116
		mov	byte [_z80de + 1], dh
18117
		xor	edx, edx
18118
		sub	edi, byte 7
18119
		js	near noMoreExec
18120
		mov	dl, byte [esi]	; Get our next instruction
18121
		inc	esi		; Increment PC
18122
		jmp	dword [z80regular+edx*4]
18123
 
18124
 
18125
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18126
 
18127
RegInst57:
18128
		mov	byte [_z80de + 1], al
18129
		sub	edi, byte 4
18130
		js	near noMoreExec
18131
		mov	dl, byte [esi]	; Get our next instruction
18132
		inc	esi		; Increment PC
18133
		jmp	dword [z80regular+edx*4]
18134
 
18135
 
18136
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18137
 
18138
RegInst58:
18139
		mov	byte [_z80de], ch
18140
		sub	edi, byte 4
18141
		js	near noMoreExec
18142
		mov	dl, byte [esi]	; Get our next instruction
18143
		inc	esi		; Increment PC
18144
		jmp	dword [z80regular+edx*4]
18145
 
18146
 
18147
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18148
 
18149
RegInst59:
18150
		mov	byte [_z80de], cl
18151
		sub	edi, byte 4
18152
		js	near noMoreExec
18153
		mov	dl, byte [esi]	; Get our next instruction
18154
		inc	esi		; Increment PC
18155
		jmp	dword [z80regular+edx*4]
18156
 
18157
 
18158
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18159
 
18160
RegInst5a:
18161
		mov	dl, byte [_z80de + 1]
18162
		mov	[_z80de], dl
18163
		sub	edi, byte 4
18164
		js	near noMoreExec
18165
		mov	dl, byte [esi]	; Get our next instruction
18166
		inc	esi		; Increment PC
18167
		jmp	dword [z80regular+edx*4]
18168
 
18169
 
18170
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18171
 
18172
RegInst5b:
18173
		sub	edi, byte 4
18174
		js	near noMoreExec
18175
		mov	dl, byte [esi]	; Get our next instruction
18176
		inc	esi		; Increment PC
18177
		jmp	dword [z80regular+edx*4]
18178
 
18179
 
18180
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18181
 
18182
RegInst5c:
18183
		mov	byte [_z80de], bh
18184
		sub	edi, byte 4
18185
		js	near noMoreExec
18186
		mov	dl, byte [esi]	; Get our next instruction
18187
		inc	esi		; Increment PC
18188
		jmp	dword [z80regular+edx*4]
18189
 
18190
 
18191
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18192
 
18193
RegInst5d:
18194
		mov	byte [_z80de], bl
18195
		sub	edi, byte 4
18196
		js	near noMoreExec
18197
		mov	dl, byte [esi]	; Get our next instruction
18198
		inc	esi		; Increment PC
18199
		jmp	dword [z80regular+edx*4]
18200
 
18201
 
18202
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18203
 
18204
RegInst5e:
18205
		mov	[cyclesRemaining], edi
18206
		mov	edi, [_z80MemRead]	; Point to the read array
18207
 
18208
checkLoop335:
18209
		cmp	[edi], word 0ffffh ; End of the list?
18210
		je		memoryRead335
18211
		cmp	ebx, [edi]	; Are we smaller?
18212
		jb		nextAddr335		; Yes, go to the next address
18213
		cmp	ebx, [edi+4]	; Are we bigger?
18214
		jbe	callRoutine335
18215
 
18216
nextAddr335:
18217
		add	edi, 10h		; Next structure!
18218
		jmp	short checkLoop335
18219
 
18220
callRoutine335:
18221
		mov	dx, bx	; Get our address
18222
		call	ReadMemoryByte	; Standard read routine
18223
		mov	dl, al	; Put our returned value here
18224
		mov	ax, [_z80af]	; Get our AF back
18225
		jmp	short readExit335
18226
 
18227
memoryRead335:
18228
		mov	dl, [ebp + ebx]	; Get our data
18229
 
18230
readExit335:
18231
		mov	edi, [cyclesRemaining]
18232
		mov	byte [_z80de], dl
18233
		xor	edx, edx
18234
		sub	edi, byte 7
18235
		js	near noMoreExec
18236
		mov	dl, byte [esi]	; Get our next instruction
18237
		inc	esi		; Increment PC
18238
		jmp	dword [z80regular+edx*4]
18239
 
18240
 
18241
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18242
 
18243
RegInst5f:
18244
		mov	byte [_z80de], al
18245
		sub	edi, byte 4
18246
		js	near noMoreExec
18247
		mov	dl, byte [esi]	; Get our next instruction
18248
		inc	esi		; Increment PC
18249
		jmp	dword [z80regular+edx*4]
18250
 
18251
 
18252
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18253
 
18254
RegInst60:
18255
		mov	bh, ch
18256
		sub	edi, byte 4
18257
		js	near noMoreExec
18258
		mov	dl, byte [esi]	; Get our next instruction
18259
		inc	esi		; Increment PC
18260
		jmp	dword [z80regular+edx*4]
18261
 
18262
 
18263
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18264
 
18265
RegInst61:
18266
		mov	bh, cl
18267
		sub	edi, byte 4
18268
		js	near noMoreExec
18269
		mov	dl, byte [esi]	; Get our next instruction
18270
		inc	esi		; Increment PC
18271
		jmp	dword [z80regular+edx*4]
18272
 
18273
 
18274
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18275
 
18276
RegInst62:
18277
		mov	bh, byte [_z80de + 1]
18278
		sub	edi, byte 4
18279
		js	near noMoreExec
18280
		mov	dl, byte [esi]	; Get our next instruction
18281
		inc	esi		; Increment PC
18282
		jmp	dword [z80regular+edx*4]
18283
 
18284
 
18285
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18286
 
18287
RegInst63:
18288
		mov	bh, byte [_z80de]
18289
		sub	edi, byte 4
18290
		js	near noMoreExec
18291
		mov	dl, byte [esi]	; Get our next instruction
18292
		inc	esi		; Increment PC
18293
		jmp	dword [z80regular+edx*4]
18294
 
18295
 
18296
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18297
 
18298
RegInst64:
18299
		sub	edi, byte 4
18300
		js	near noMoreExec
18301
		mov	dl, byte [esi]	; Get our next instruction
18302
		inc	esi		; Increment PC
18303
		jmp	dword [z80regular+edx*4]
18304
 
18305
 
18306
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18307
 
18308
RegInst65:
18309
		mov	bh, bl
18310
		sub	edi, byte 4
18311
		js	near noMoreExec
18312
		mov	dl, byte [esi]	; Get our next instruction
18313
		inc	esi		; Increment PC
18314
		jmp	dword [z80regular+edx*4]
18315
 
18316
 
18317
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18318
 
18319
RegInst66:
18320
		mov	[cyclesRemaining], edi
18321
		mov	edi, [_z80MemRead]	; Point to the read array
18322
 
18323
checkLoop336:
18324
		cmp	[edi], word 0ffffh ; End of the list?
18325
		je		memoryRead336
18326
		cmp	ebx, [edi]	; Are we smaller?
18327
		jb		nextAddr336		; Yes, go to the next address
18328
		cmp	ebx, [edi+4]	; Are we bigger?
18329
		jbe	callRoutine336
18330
 
18331
nextAddr336:
18332
		add	edi, 10h		; Next structure!
18333
		jmp	short checkLoop336
18334
 
18335
callRoutine336:
18336
		mov	dx, bx	; Get our address
18337
		call	ReadMemoryByte	; Standard read routine
18338
		mov	bh, al	; Put our returned value here
18339
		mov	ax, [_z80af]	; Get our AF back
18340
		jmp	short readExit336
18341
 
18342
memoryRead336:
18343
		mov	bh, [ebp + ebx]	; Get our data
18344
 
18345
readExit336:
18346
		mov	edi, [cyclesRemaining]
18347
		xor	edx, edx
18348
		sub	edi, byte 7
18349
		js	near noMoreExec
18350
		mov	dl, byte [esi]	; Get our next instruction
18351
		inc	esi		; Increment PC
18352
		jmp	dword [z80regular+edx*4]
18353
 
18354
 
18355
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18356
 
18357
RegInst67:
18358
		mov	bh, al
18359
		sub	edi, byte 4
18360
		js	near noMoreExec
18361
		mov	dl, byte [esi]	; Get our next instruction
18362
		inc	esi		; Increment PC
18363
		jmp	dword [z80regular+edx*4]
18364
 
18365
 
18366
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18367
 
18368
RegInst68:
18369
		mov	bl, ch
18370
		sub	edi, byte 4
18371
		js	near noMoreExec
18372
		mov	dl, byte [esi]	; Get our next instruction
18373
		inc	esi		; Increment PC
18374
		jmp	dword [z80regular+edx*4]
18375
 
18376
 
18377
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18378
 
18379
RegInst69:
18380
		mov	bl, cl
18381
		sub	edi, byte 4
18382
		js	near noMoreExec
18383
		mov	dl, byte [esi]	; Get our next instruction
18384
		inc	esi		; Increment PC
18385
		jmp	dword [z80regular+edx*4]
18386
 
18387
 
18388
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18389
 
18390
RegInst6a:
18391
		mov	bl, byte [_z80de + 1]
18392
		sub	edi, byte 4
18393
		js	near noMoreExec
18394
		mov	dl, byte [esi]	; Get our next instruction
18395
		inc	esi		; Increment PC
18396
		jmp	dword [z80regular+edx*4]
18397
 
18398
 
18399
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18400
 
18401
RegInst6b:
18402
		mov	bl, byte [_z80de]
18403
		sub	edi, byte 4
18404
		js	near noMoreExec
18405
		mov	dl, byte [esi]	; Get our next instruction
18406
		inc	esi		; Increment PC
18407
		jmp	dword [z80regular+edx*4]
18408
 
18409
 
18410
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18411
 
18412
RegInst6c:
18413
		mov	bl, bh
18414
		sub	edi, byte 4
18415
		js	near noMoreExec
18416
		mov	dl, byte [esi]	; Get our next instruction
18417
		inc	esi		; Increment PC
18418
		jmp	dword [z80regular+edx*4]
18419
 
18420
 
18421
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18422
 
18423
RegInst6d:
18424
		sub	edi, byte 4
18425
		js	near noMoreExec
18426
		mov	dl, byte [esi]	; Get our next instruction
18427
		inc	esi		; Increment PC
18428
		jmp	dword [z80regular+edx*4]
18429
 
18430
 
18431
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18432
 
18433
RegInst6e:
18434
		mov	[cyclesRemaining], edi
18435
		mov	edi, [_z80MemRead]	; Point to the read array
18436
 
18437
checkLoop337:
18438
		cmp	[edi], word 0ffffh ; End of the list?
18439
		je		memoryRead337
18440
		cmp	ebx, [edi]	; Are we smaller?
18441
		jb		nextAddr337		; Yes, go to the next address
18442
		cmp	ebx, [edi+4]	; Are we bigger?
18443
		jbe	callRoutine337
18444
 
18445
nextAddr337:
18446
		add	edi, 10h		; Next structure!
18447
		jmp	short checkLoop337
18448
 
18449
callRoutine337:
18450
		mov	dx, bx	; Get our address
18451
		call	ReadMemoryByte	; Standard read routine
18452
		mov	bl, al	; Put our returned value here
18453
		mov	ax, [_z80af]	; Get our AF back
18454
		jmp	short readExit337
18455
 
18456
memoryRead337:
18457
		mov	bl, [ebp + ebx]	; Get our data
18458
 
18459
readExit337:
18460
		mov	edi, [cyclesRemaining]
18461
		xor	edx, edx
18462
		sub	edi, byte 7
18463
		js	near noMoreExec
18464
		mov	dl, byte [esi]	; Get our next instruction
18465
		inc	esi		; Increment PC
18466
		jmp	dword [z80regular+edx*4]
18467
 
18468
 
18469
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18470
 
18471
RegInst6f:
18472
		mov	bl, al
18473
		sub	edi, byte 4
18474
		js	near noMoreExec
18475
		mov	dl, byte [esi]	; Get our next instruction
18476
		inc	esi		; Increment PC
18477
		jmp	dword [z80regular+edx*4]
18478
 
18479
 
18480
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18481
 
18482
RegInst70:
18483
		mov	[cyclesRemaining], edi
18484
		mov	[_z80af], ax	; Store AF
18485
		mov	al, ch	; And our data to write
18486
		mov	edi, [_z80MemWrite]	; Point to the write array
18487
 
18488
checkLoop338:
18489
		cmp	[edi], word 0ffffh ; End of our list?
18490
		je	memoryWrite338	; Yes - go write it!
18491
		cmp	bx, [edi]	; Are we smaller?
18492
		jb	nextAddr338	; Yes... go to the next addr
18493
		cmp	bx, [edi+4]	; Are we smaller?
18494
		jbe	callRoutine338	; If not, go call it!
18495
 
18496
nextAddr338:
18497
		add	edi, 10h		; Next structure, please
18498
		jmp	short checkLoop338
18499
 
18500
callRoutine338:
18501
		mov	dx, bx	; Get our address to target
18502
		call	WriteMemoryByte	; Go write the data!
18503
		jmp	short WriteMacroExit338
18504
memoryWrite338:
18505
		mov	[ebp + ebx], ch
18506
		mov	ax, [_z80af] ; Get our accumulator and flags
18507
WriteMacroExit338:
18508
		mov	edi, [cyclesRemaining]
18509
		xor	edx, edx
18510
		sub	edi, byte 7
18511
		js	near noMoreExec
18512
		mov	dl, byte [esi]	; Get our next instruction
18513
		inc	esi		; Increment PC
18514
		jmp	dword [z80regular+edx*4]
18515
 
18516
 
18517
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18518
 
18519
RegInst71:
18520
		mov	[cyclesRemaining], edi
18521
		mov	[_z80af], ax	; Store AF
18522
		mov	al, cl	; And our data to write
18523
		mov	edi, [_z80MemWrite]	; Point to the write array
18524
 
18525
checkLoop339:
18526
		cmp	[edi], word 0ffffh ; End of our list?
18527
		je	memoryWrite339	; Yes - go write it!
18528
		cmp	bx, [edi]	; Are we smaller?
18529
		jb	nextAddr339	; Yes... go to the next addr
18530
		cmp	bx, [edi+4]	; Are we smaller?
18531
		jbe	callRoutine339	; If not, go call it!
18532
 
18533
nextAddr339:
18534
		add	edi, 10h		; Next structure, please
18535
		jmp	short checkLoop339
18536
 
18537
callRoutine339:
18538
		mov	dx, bx	; Get our address to target
18539
		call	WriteMemoryByte	; Go write the data!
18540
		jmp	short WriteMacroExit339
18541
memoryWrite339:
18542
		mov	[ebp + ebx], cl
18543
		mov	ax, [_z80af] ; Get our accumulator and flags
18544
WriteMacroExit339:
18545
		mov	edi, [cyclesRemaining]
18546
		xor	edx, edx
18547
		sub	edi, byte 7
18548
		js	near noMoreExec
18549
		mov	dl, byte [esi]	; Get our next instruction
18550
		inc	esi		; Increment PC
18551
		jmp	dword [z80regular+edx*4]
18552
 
18553
 
18554
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18555
 
18556
RegInst72:
18557
		mov	[cyclesRemaining], edi
18558
		mov	[_z80af], ax	; Store AF
18559
		mov	al, byte [_z80de + 1]	; And our data to write
18560
		mov	edi, [_z80MemWrite]	; Point to the write array
18561
 
18562
checkLoop340:
18563
		cmp	[edi], word 0ffffh ; End of our list?
18564
		je	memoryWrite340	; Yes - go write it!
18565
		cmp	bx, [edi]	; Are we smaller?
18566
		jb	nextAddr340	; Yes... go to the next addr
18567
		cmp	bx, [edi+4]	; Are we smaller?
18568
		jbe	callRoutine340	; If not, go call it!
18569
 
18570
nextAddr340:
18571
		add	edi, 10h		; Next structure, please
18572
		jmp	short checkLoop340
18573
 
18574
callRoutine340:
18575
		mov	dx, bx	; Get our address to target
18576
		call	WriteMemoryByte	; Go write the data!
18577
		jmp	short WriteMacroExit340
18578
memoryWrite340:
18579
		mov	edi, edx
18580
		mov	dl, byte [_z80de + 1]
18581
		mov	[ebp + ebx], dl
18582
		mov	edx, edi
18583
		mov	ax, [_z80af] ; Get our accumulator and flags
18584
WriteMacroExit340:
18585
		mov	edi, [cyclesRemaining]
18586
		xor	edx, edx
18587
		sub	edi, byte 7
18588
		js	near noMoreExec
18589
		mov	dl, byte [esi]	; Get our next instruction
18590
		inc	esi		; Increment PC
18591
		jmp	dword [z80regular+edx*4]
18592
 
18593
 
18594
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18595
 
18596
RegInst73:
18597
		mov	[cyclesRemaining], edi
18598
		mov	[_z80af], ax	; Store AF
18599
		mov	al, byte [_z80de]	; And our data to write
18600
		mov	edi, [_z80MemWrite]	; Point to the write array
18601
 
18602
checkLoop341:
18603
		cmp	[edi], word 0ffffh ; End of our list?
18604
		je	memoryWrite341	; Yes - go write it!
18605
		cmp	bx, [edi]	; Are we smaller?
18606
		jb	nextAddr341	; Yes... go to the next addr
18607
		cmp	bx, [edi+4]	; Are we smaller?
18608
		jbe	callRoutine341	; If not, go call it!
18609
 
18610
nextAddr341:
18611
		add	edi, 10h		; Next structure, please
18612
		jmp	short checkLoop341
18613
 
18614
callRoutine341:
18615
		mov	dx, bx	; Get our address to target
18616
		call	WriteMemoryByte	; Go write the data!
18617
		jmp	short WriteMacroExit341
18618
memoryWrite341:
18619
		mov	edi, edx
18620
		mov	dl, byte [_z80de]
18621
		mov	[ebp + ebx], dl
18622
		mov	edx, edi
18623
		mov	ax, [_z80af] ; Get our accumulator and flags
18624
WriteMacroExit341:
18625
		mov	edi, [cyclesRemaining]
18626
		xor	edx, edx
18627
		sub	edi, byte 7
18628
		js	near noMoreExec
18629
		mov	dl, byte [esi]	; Get our next instruction
18630
		inc	esi		; Increment PC
18631
		jmp	dword [z80regular+edx*4]
18632
 
18633
 
18634
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18635
 
18636
RegInst74:
18637
		mov	[cyclesRemaining], edi
18638
		mov	[_z80af], ax	; Store AF
18639
		mov	al, bh	; And our data to write
18640
		mov	edi, [_z80MemWrite]	; Point to the write array
18641
 
18642
checkLoop342:
18643
		cmp	[edi], word 0ffffh ; End of our list?
18644
		je	memoryWrite342	; Yes - go write it!
18645
		cmp	bx, [edi]	; Are we smaller?
18646
		jb	nextAddr342	; Yes... go to the next addr
18647
		cmp	bx, [edi+4]	; Are we smaller?
18648
		jbe	callRoutine342	; If not, go call it!
18649
 
18650
nextAddr342:
18651
		add	edi, 10h		; Next structure, please
18652
		jmp	short checkLoop342
18653
 
18654
callRoutine342:
18655
		mov	dx, bx	; Get our address to target
18656
		call	WriteMemoryByte	; Go write the data!
18657
		jmp	short WriteMacroExit342
18658
memoryWrite342:
18659
		mov	[ebp + ebx], bh
18660
		mov	ax, [_z80af] ; Get our accumulator and flags
18661
WriteMacroExit342:
18662
		mov	edi, [cyclesRemaining]
18663
		xor	edx, edx
18664
		sub	edi, byte 7
18665
		js	near noMoreExec
18666
		mov	dl, byte [esi]	; Get our next instruction
18667
		inc	esi		; Increment PC
18668
		jmp	dword [z80regular+edx*4]
18669
 
18670
 
18671
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18672
 
18673
RegInst75:
18674
		mov	[cyclesRemaining], edi
18675
		mov	[_z80af], ax	; Store AF
18676
		mov	al, bl	; And our data to write
18677
		mov	edi, [_z80MemWrite]	; Point to the write array
18678
 
18679
checkLoop343:
18680
		cmp	[edi], word 0ffffh ; End of our list?
18681
		je	memoryWrite343	; Yes - go write it!
18682
		cmp	bx, [edi]	; Are we smaller?
18683
		jb	nextAddr343	; Yes... go to the next addr
18684
		cmp	bx, [edi+4]	; Are we smaller?
18685
		jbe	callRoutine343	; If not, go call it!
18686
 
18687
nextAddr343:
18688
		add	edi, 10h		; Next structure, please
18689
		jmp	short checkLoop343
18690
 
18691
callRoutine343:
18692
		mov	dx, bx	; Get our address to target
18693
		call	WriteMemoryByte	; Go write the data!
18694
		jmp	short WriteMacroExit343
18695
memoryWrite343:
18696
		mov	[ebp + ebx], bl
18697
		mov	ax, [_z80af] ; Get our accumulator and flags
18698
WriteMacroExit343:
18699
		mov	edi, [cyclesRemaining]
18700
		xor	edx, edx
18701
		sub	edi, byte 7
18702
		js	near noMoreExec
18703
		mov	dl, byte [esi]	; Get our next instruction
18704
		inc	esi		; Increment PC
18705
		jmp	dword [z80regular+edx*4]
18706
 
18707
 
18708
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18709
 
18710
RegInst76:
18711
		mov	dword [_z80halted], 1	; We've halted the chip!
18712
		xor	edi, edi
18713
		mov	[cyclesRemaining], edi
18714
		jmp	noMoreExec
18715
 
18716
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18717
 
18718
RegInst77:
18719
		mov	[cyclesRemaining], edi
18720
		mov	[_z80af], ax	; Store AF
18721
		mov	edi, [_z80MemWrite]	; Point to the write array
18722
 
18723
checkLoop344:
18724
		cmp	[edi], word 0ffffh ; End of our list?
18725
		je	memoryWrite344	; Yes - go write it!
18726
		cmp	bx, [edi]	; Are we smaller?
18727
		jb	nextAddr344	; Yes... go to the next addr
18728
		cmp	bx, [edi+4]	; Are we smaller?
18729
		jbe	callRoutine344	; If not, go call it!
18730
 
18731
nextAddr344:
18732
		add	edi, 10h		; Next structure, please
18733
		jmp	short checkLoop344
18734
 
18735
callRoutine344:
18736
		mov	dx, bx	; Get our address to target
18737
		call	WriteMemoryByte	; Go write the data!
18738
		jmp	short WriteMacroExit344
18739
memoryWrite344:
18740
		mov	[ebp + ebx], al
18741
		mov	ax, [_z80af] ; Get our accumulator and flags
18742
WriteMacroExit344:
18743
		mov	edi, [cyclesRemaining]
18744
		xor	edx, edx
18745
		sub	edi, byte 7
18746
		js	near noMoreExec
18747
		mov	dl, byte [esi]	; Get our next instruction
18748
		inc	esi		; Increment PC
18749
		jmp	dword [z80regular+edx*4]
18750
 
18751
 
18752
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18753
 
18754
RegInst78:
18755
		mov	al, ch
18756
		sub	edi, byte 4
18757
		js	near noMoreExec
18758
		mov	dl, byte [esi]	; Get our next instruction
18759
		inc	esi		; Increment PC
18760
		jmp	dword [z80regular+edx*4]
18761
 
18762
 
18763
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18764
 
18765
RegInst79:
18766
		mov	al, cl
18767
		sub	edi, byte 4
18768
		js	near noMoreExec
18769
		mov	dl, byte [esi]	; Get our next instruction
18770
		inc	esi		; Increment PC
18771
		jmp	dword [z80regular+edx*4]
18772
 
18773
 
18774
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18775
 
18776
RegInst7a:
18777
		mov	al, byte [_z80de + 1]
18778
		sub	edi, byte 4
18779
		js	near noMoreExec
18780
		mov	dl, byte [esi]	; Get our next instruction
18781
		inc	esi		; Increment PC
18782
		jmp	dword [z80regular+edx*4]
18783
 
18784
 
18785
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18786
 
18787
RegInst7b:
18788
		mov	al, byte [_z80de]
18789
		sub	edi, byte 4
18790
		js	near noMoreExec
18791
		mov	dl, byte [esi]	; Get our next instruction
18792
		inc	esi		; Increment PC
18793
		jmp	dword [z80regular+edx*4]
18794
 
18795
 
18796
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18797
 
18798
RegInst7c:
18799
		mov	al, bh
18800
		sub	edi, byte 4
18801
		js	near noMoreExec
18802
		mov	dl, byte [esi]	; Get our next instruction
18803
		inc	esi		; Increment PC
18804
		jmp	dword [z80regular+edx*4]
18805
 
18806
 
18807
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18808
 
18809
RegInst7d:
18810
		mov	al, bl
18811
		sub	edi, byte 4
18812
		js	near noMoreExec
18813
		mov	dl, byte [esi]	; Get our next instruction
18814
		inc	esi		; Increment PC
18815
		jmp	dword [z80regular+edx*4]
18816
 
18817
 
18818
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18819
 
18820
RegInst7e:
18821
		mov	[cyclesRemaining], edi
18822
		mov	edi, [_z80MemRead]	; Point to the read array
18823
 
18824
checkLoop345:
18825
		cmp	[edi], word 0ffffh ; End of the list?
18826
		je		memoryRead345
18827
		cmp	ebx, [edi]	; Are we smaller?
18828
		jb		nextAddr345		; Yes, go to the next address
18829
		cmp	ebx, [edi+4]	; Are we bigger?
18830
		jbe	callRoutine345
18831
 
18832
nextAddr345:
18833
		add	edi, 10h		; Next structure!
18834
		jmp	short checkLoop345
18835
 
18836
callRoutine345:
18837
		mov	dx, bx	; Get our address
18838
		call	ReadMemoryByte	; Standard read routine
18839
		mov	[_z80af], al	; Save our new accumulator
18840
		mov	ax, [_z80af]	; Get our AF back
18841
		jmp	short readExit345
18842
 
18843
memoryRead345:
18844
		mov	al, [ebp + ebx]	; Get our data
18845
 
18846
readExit345:
18847
		mov	edi, [cyclesRemaining]
18848
		xor	edx, edx
18849
		sub	edi, byte 7
18850
		js	near noMoreExec
18851
		mov	dl, byte [esi]	; Get our next instruction
18852
		inc	esi		; Increment PC
18853
		jmp	dword [z80regular+edx*4]
18854
 
18855
 
18856
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18857
 
18858
RegInst7f:
18859
		sub	edi, byte 4
18860
		js	near noMoreExec
18861
		mov	dl, byte [esi]	; Get our next instruction
18862
		inc	esi		; Increment PC
18863
		jmp	dword [z80regular+edx*4]
18864
 
18865
 
18866
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18867
 
18868
RegInst80:
18869
		sahf
18870
		add	al, ch
18871
		lahf
18872
		seto	dl
18873
		and	ah, 0fbh	; Knock out parity/overflow
18874
		shl	dl, 2
18875
		or		ah, dl
18876
		and	ah, 0fdh ; No N!
18877
		sub	edi, byte 4
18878
		js	near noMoreExec
18879
		mov	dl, byte [esi]	; Get our next instruction
18880
		inc	esi		; Increment PC
18881
		jmp	dword [z80regular+edx*4]
18882
 
18883
 
18884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18885
 
18886
RegInst81:
18887
		sahf
18888
		add	al, cl
18889
		lahf
18890
		seto	dl
18891
		and	ah, 0fbh	; Knock out parity/overflow
18892
		shl	dl, 2
18893
		or		ah, dl
18894
		and	ah, 0fdh ; No N!
18895
		sub	edi, byte 4
18896
		js	near noMoreExec
18897
		mov	dl, byte [esi]	; Get our next instruction
18898
		inc	esi		; Increment PC
18899
		jmp	dword [z80regular+edx*4]
18900
 
18901
 
18902
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18903
 
18904
RegInst82:
18905
		sahf
18906
		add	al, byte [_z80de + 1]
18907
		lahf
18908
		seto	dl
18909
		and	ah, 0fbh	; Knock out parity/overflow
18910
		shl	dl, 2
18911
		or		ah, dl
18912
		and	ah, 0fdh ; No N!
18913
		sub	edi, byte 4
18914
		js	near noMoreExec
18915
		mov	dl, byte [esi]	; Get our next instruction
18916
		inc	esi		; Increment PC
18917
		jmp	dword [z80regular+edx*4]
18918
 
18919
 
18920
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18921
 
18922
RegInst83:
18923
		sahf
18924
		add	al, byte [_z80de]
18925
		lahf
18926
		seto	dl
18927
		and	ah, 0fbh	; Knock out parity/overflow
18928
		shl	dl, 2
18929
		or		ah, dl
18930
		and	ah, 0fdh ; No N!
18931
		sub	edi, byte 4
18932
		js	near noMoreExec
18933
		mov	dl, byte [esi]	; Get our next instruction
18934
		inc	esi		; Increment PC
18935
		jmp	dword [z80regular+edx*4]
18936
 
18937
 
18938
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18939
 
18940
RegInst84:
18941
		sahf
18942
		add	al, bh
18943
		lahf
18944
		seto	dl
18945
		and	ah, 0fbh	; Knock out parity/overflow
18946
		shl	dl, 2
18947
		or		ah, dl
18948
		and	ah, 0fdh ; No N!
18949
		sub	edi, byte 4
18950
		js	near noMoreExec
18951
		mov	dl, byte [esi]	; Get our next instruction
18952
		inc	esi		; Increment PC
18953
		jmp	dword [z80regular+edx*4]
18954
 
18955
 
18956
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18957
 
18958
RegInst85:
18959
		sahf
18960
		add	al, bl
18961
		lahf
18962
		seto	dl
18963
		and	ah, 0fbh	; Knock out parity/overflow
18964
		shl	dl, 2
18965
		or		ah, dl
18966
		and	ah, 0fdh ; No N!
18967
		sub	edi, byte 4
18968
		js	near noMoreExec
18969
		mov	dl, byte [esi]	; Get our next instruction
18970
		inc	esi		; Increment PC
18971
		jmp	dword [z80regular+edx*4]
18972
 
18973
 
18974
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
18975
 
18976
RegInst86:
18977
		mov	[cyclesRemaining], edi
18978
		mov	edi, [_z80MemRead]	; Point to the read array
18979
 
18980
checkLoop346:
18981
		cmp	[edi], word 0ffffh ; End of the list?
18982
		je		memoryRead346
18983
		cmp	ebx, [edi]	; Are we smaller?
18984
		jb		nextAddr346		; Yes, go to the next address
18985
		cmp	ebx, [edi+4]	; Are we bigger?
18986
		jbe	callRoutine346
18987
 
18988
nextAddr346:
18989
		add	edi, 10h		; Next structure!
18990
		jmp	short checkLoop346
18991
 
18992
callRoutine346:
18993
		mov	dx, bx	; Get our address
18994
		call	ReadMemoryByte	; Standard read routine
18995
		mov	dl, al	; Put our returned value here
18996
		mov	ax, [_z80af]	; Get our AF back
18997
		jmp	short readExit346
18998
 
18999
memoryRead346:
19000
		mov	dl, [ebp + ebx]	; Get our data
19001
 
19002
readExit346:
19003
		mov	edi, [cyclesRemaining]
19004
		sahf
19005
		add	al, dl
19006
		lahf
19007
		seto	dl
19008
		and	ah, 0fbh	; Knock out parity/overflow
19009
		shl	dl, 2
19010
		or		ah, dl
19011
		and	ah, 0fdh ; No N!
19012
		xor	edx, edx	; Zero this...
19013
		sub	edi, byte 7
19014
		js	near noMoreExec
19015
		mov	dl, byte [esi]	; Get our next instruction
19016
		inc	esi		; Increment PC
19017
		jmp	dword [z80regular+edx*4]
19018
 
19019
 
19020
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19021
 
19022
RegInst87:
19023
		sahf
19024
		add	al, al
19025
		lahf
19026
		seto	dl
19027
		and	ah, 0fbh	; Knock out parity/overflow
19028
		shl	dl, 2
19029
		or		ah, dl
19030
		and	ah, 0fdh ; No N!
19031
		sub	edi, byte 4
19032
		js	near noMoreExec
19033
		mov	dl, byte [esi]	; Get our next instruction
19034
		inc	esi		; Increment PC
19035
		jmp	dword [z80regular+edx*4]
19036
 
19037
 
19038
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19039
 
19040
RegInst88:
19041
		sahf
19042
		adc	al, ch
19043
		lahf
19044
		seto	dl
19045
		and	ah, 0fbh	; Knock out parity/overflow
19046
		shl	dl, 2
19047
		or		ah, dl
19048
		and	ah, 0fdh ; No N!
19049
		sub	edi, byte 4
19050
		js	near noMoreExec
19051
		mov	dl, byte [esi]	; Get our next instruction
19052
		inc	esi		; Increment PC
19053
		jmp	dword [z80regular+edx*4]
19054
 
19055
 
19056
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19057
 
19058
RegInst89:
19059
		sahf
19060
		adc	al, cl
19061
		lahf
19062
		seto	dl
19063
		and	ah, 0fbh	; Knock out parity/overflow
19064
		shl	dl, 2
19065
		or		ah, dl
19066
		and	ah, 0fdh ; No N!
19067
		sub	edi, byte 4
19068
		js	near noMoreExec
19069
		mov	dl, byte [esi]	; Get our next instruction
19070
		inc	esi		; Increment PC
19071
		jmp	dword [z80regular+edx*4]
19072
 
19073
 
19074
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19075
 
19076
RegInst8a:
19077
		sahf
19078
		adc	al, byte [_z80de + 1]
19079
		lahf
19080
		seto	dl
19081
		and	ah, 0fbh	; Knock out parity/overflow
19082
		shl	dl, 2
19083
		or		ah, dl
19084
		and	ah, 0fdh ; No N!
19085
		sub	edi, byte 4
19086
		js	near noMoreExec
19087
		mov	dl, byte [esi]	; Get our next instruction
19088
		inc	esi		; Increment PC
19089
		jmp	dword [z80regular+edx*4]
19090
 
19091
 
19092
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19093
 
19094
RegInst8b:
19095
		sahf
19096
		adc	al, byte [_z80de]
19097
		lahf
19098
		seto	dl
19099
		and	ah, 0fbh	; Knock out parity/overflow
19100
		shl	dl, 2
19101
		or		ah, dl
19102
		and	ah, 0fdh ; No N!
19103
		sub	edi, byte 4
19104
		js	near noMoreExec
19105
		mov	dl, byte [esi]	; Get our next instruction
19106
		inc	esi		; Increment PC
19107
		jmp	dword [z80regular+edx*4]
19108
 
19109
 
19110
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19111
 
19112
RegInst8c:
19113
		sahf
19114
		adc	al, bh
19115
		lahf
19116
		seto	dl
19117
		and	ah, 0fbh	; Knock out parity/overflow
19118
		shl	dl, 2
19119
		or		ah, dl
19120
		and	ah, 0fdh ; No N!
19121
		sub	edi, byte 4
19122
		js	near noMoreExec
19123
		mov	dl, byte [esi]	; Get our next instruction
19124
		inc	esi		; Increment PC
19125
		jmp	dword [z80regular+edx*4]
19126
 
19127
 
19128
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19129
 
19130
RegInst8d:
19131
		sahf
19132
		adc	al, bl
19133
		lahf
19134
		seto	dl
19135
		and	ah, 0fbh	; Knock out parity/overflow
19136
		shl	dl, 2
19137
		or		ah, dl
19138
		and	ah, 0fdh ; No N!
19139
		sub	edi, byte 4
19140
		js	near noMoreExec
19141
		mov	dl, byte [esi]	; Get our next instruction
19142
		inc	esi		; Increment PC
19143
		jmp	dword [z80regular+edx*4]
19144
 
19145
 
19146
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19147
 
19148
RegInst8e:
19149
		mov	[cyclesRemaining], edi
19150
		mov	edi, [_z80MemRead]	; Point to the read array
19151
 
19152
checkLoop347:
19153
		cmp	[edi], word 0ffffh ; End of the list?
19154
		je		memoryRead347
19155
		cmp	ebx, [edi]	; Are we smaller?
19156
		jb		nextAddr347		; Yes, go to the next address
19157
		cmp	ebx, [edi+4]	; Are we bigger?
19158
		jbe	callRoutine347
19159
 
19160
nextAddr347:
19161
		add	edi, 10h		; Next structure!
19162
		jmp	short checkLoop347
19163
 
19164
callRoutine347:
19165
		mov	dx, bx	; Get our address
19166
		call	ReadMemoryByte	; Standard read routine
19167
		mov	dl, al	; Put our returned value here
19168
		mov	ax, [_z80af]	; Get our AF back
19169
		jmp	short readExit347
19170
 
19171
memoryRead347:
19172
		mov	dl, [ebp + ebx]	; Get our data
19173
 
19174
readExit347:
19175
		mov	edi, [cyclesRemaining]
19176
		sahf
19177
		adc	al, dl
19178
		lahf
19179
		seto	dl
19180
		and	ah, 0fbh	; Knock out parity/overflow
19181
		shl	dl, 2
19182
		or		ah, dl
19183
		and	ah, 0fdh ; No N!
19184
		xor	edx, edx	; Zero this...
19185
		sub	edi, byte 7
19186
		js	near noMoreExec
19187
		mov	dl, byte [esi]	; Get our next instruction
19188
		inc	esi		; Increment PC
19189
		jmp	dword [z80regular+edx*4]
19190
 
19191
 
19192
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19193
 
19194
RegInst8f:
19195
		sahf
19196
		adc	al, al
19197
		lahf
19198
		seto	dl
19199
		and	ah, 0fbh	; Knock out parity/overflow
19200
		shl	dl, 2
19201
		or		ah, dl
19202
		and	ah, 0fdh ; No N!
19203
		sub	edi, byte 4
19204
		js	near noMoreExec
19205
		mov	dl, byte [esi]	; Get our next instruction
19206
		inc	esi		; Increment PC
19207
		jmp	dword [z80regular+edx*4]
19208
 
19209
 
19210
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19211
 
19212
RegInst90:
19213
		sahf
19214
		sub	al, ch
19215
		lahf
19216
		seto	dl
19217
		and	ah, 0fbh	; Knock out parity/overflow
19218
		shl	dl, 2
19219
		or		ah, dl
19220
		or	ah, 02h	; N Gets set!
19221
		sub	edi, byte 4
19222
		js	near noMoreExec
19223
		mov	dl, byte [esi]	; Get our next instruction
19224
		inc	esi		; Increment PC
19225
		jmp	dword [z80regular+edx*4]
19226
 
19227
 
19228
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19229
 
19230
RegInst91:
19231
		sahf
19232
		sub	al, cl
19233
		lahf
19234
		seto	dl
19235
		and	ah, 0fbh	; Knock out parity/overflow
19236
		shl	dl, 2
19237
		or		ah, dl
19238
		or	ah, 02h	; N Gets set!
19239
		sub	edi, byte 4
19240
		js	near noMoreExec
19241
		mov	dl, byte [esi]	; Get our next instruction
19242
		inc	esi		; Increment PC
19243
		jmp	dword [z80regular+edx*4]
19244
 
19245
 
19246
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19247
 
19248
RegInst92:
19249
		sahf
19250
		sub	al, byte [_z80de + 1]
19251
		lahf
19252
		seto	dl
19253
		and	ah, 0fbh	; Knock out parity/overflow
19254
		shl	dl, 2
19255
		or		ah, dl
19256
		or	ah, 02h	; N Gets set!
19257
		sub	edi, byte 4
19258
		js	near noMoreExec
19259
		mov	dl, byte [esi]	; Get our next instruction
19260
		inc	esi		; Increment PC
19261
		jmp	dword [z80regular+edx*4]
19262
 
19263
 
19264
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19265
 
19266
RegInst93:
19267
		sahf
19268
		sub	al, byte [_z80de]
19269
		lahf
19270
		seto	dl
19271
		and	ah, 0fbh	; Knock out parity/overflow
19272
		shl	dl, 2
19273
		or		ah, dl
19274
		or	ah, 02h	; N Gets set!
19275
		sub	edi, byte 4
19276
		js	near noMoreExec
19277
		mov	dl, byte [esi]	; Get our next instruction
19278
		inc	esi		; Increment PC
19279
		jmp	dword [z80regular+edx*4]
19280
 
19281
 
19282
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19283
 
19284
RegInst94:
19285
		sahf
19286
		sub	al, bh
19287
		lahf
19288
		seto	dl
19289
		and	ah, 0fbh	; Knock out parity/overflow
19290
		shl	dl, 2
19291
		or		ah, dl
19292
		or	ah, 02h	; N Gets set!
19293
		sub	edi, byte 4
19294
		js	near noMoreExec
19295
		mov	dl, byte [esi]	; Get our next instruction
19296
		inc	esi		; Increment PC
19297
		jmp	dword [z80regular+edx*4]
19298
 
19299
 
19300
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19301
 
19302
RegInst95:
19303
		sahf
19304
		sub	al, bl
19305
		lahf
19306
		seto	dl
19307
		and	ah, 0fbh	; Knock out parity/overflow
19308
		shl	dl, 2
19309
		or		ah, dl
19310
		or	ah, 02h	; N Gets set!
19311
		sub	edi, byte 4
19312
		js	near noMoreExec
19313
		mov	dl, byte [esi]	; Get our next instruction
19314
		inc	esi		; Increment PC
19315
		jmp	dword [z80regular+edx*4]
19316
 
19317
 
19318
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19319
 
19320
RegInst96:
19321
		mov	[cyclesRemaining], edi
19322
		mov	edi, [_z80MemRead]	; Point to the read array
19323
 
19324
checkLoop348:
19325
		cmp	[edi], word 0ffffh ; End of the list?
19326
		je		memoryRead348
19327
		cmp	ebx, [edi]	; Are we smaller?
19328
		jb		nextAddr348		; Yes, go to the next address
19329
		cmp	ebx, [edi+4]	; Are we bigger?
19330
		jbe	callRoutine348
19331
 
19332
nextAddr348:
19333
		add	edi, 10h		; Next structure!
19334
		jmp	short checkLoop348
19335
 
19336
callRoutine348:
19337
		mov	dx, bx	; Get our address
19338
		call	ReadMemoryByte	; Standard read routine
19339
		mov	dl, al	; Put our returned value here
19340
		mov	ax, [_z80af]	; Get our AF back
19341
		jmp	short readExit348
19342
 
19343
memoryRead348:
19344
		mov	dl, [ebp + ebx]	; Get our data
19345
 
19346
readExit348:
19347
		mov	edi, [cyclesRemaining]
19348
		sahf
19349
		sub	al, dl
19350
		lahf
19351
		seto	dl
19352
		and	ah, 0fbh	; Knock out parity/overflow
19353
		shl	dl, 2
19354
		or		ah, dl
19355
		or	ah, 02h	; N Gets set!
19356
		xor	edx, edx	; Zero this...
19357
		sub	edi, byte 7
19358
		js	near noMoreExec
19359
		mov	dl, byte [esi]	; Get our next instruction
19360
		inc	esi		; Increment PC
19361
		jmp	dword [z80regular+edx*4]
19362
 
19363
 
19364
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19365
 
19366
RegInst97:
19367
		sahf
19368
		sub	al, al
19369
		lahf
19370
		seto	dl
19371
		and	ah, 0fbh	; Knock out parity/overflow
19372
		shl	dl, 2
19373
		or		ah, dl
19374
		or	ah, 02h	; N Gets set!
19375
		sub	edi, byte 4
19376
		js	near noMoreExec
19377
		mov	dl, byte [esi]	; Get our next instruction
19378
		inc	esi		; Increment PC
19379
		jmp	dword [z80regular+edx*4]
19380
 
19381
 
19382
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19383
 
19384
RegInst98:
19385
		sahf
19386
		sbb	al, ch
19387
		lahf
19388
		seto	dl
19389
		and	ah, 0fbh	; Knock out parity/overflow
19390
		shl	dl, 2
19391
		or		ah, dl
19392
		or	ah, 02h	; N Gets set!
19393
		sub	edi, byte 4
19394
		js	near noMoreExec
19395
		mov	dl, byte [esi]	; Get our next instruction
19396
		inc	esi		; Increment PC
19397
		jmp	dword [z80regular+edx*4]
19398
 
19399
 
19400
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19401
 
19402
RegInst99:
19403
		sahf
19404
		sbb	al, cl
19405
		lahf
19406
		seto	dl
19407
		and	ah, 0fbh	; Knock out parity/overflow
19408
		shl	dl, 2
19409
		or		ah, dl
19410
		or	ah, 02h	; N Gets set!
19411
		sub	edi, byte 4
19412
		js	near noMoreExec
19413
		mov	dl, byte [esi]	; Get our next instruction
19414
		inc	esi		; Increment PC
19415
		jmp	dword [z80regular+edx*4]
19416
 
19417
 
19418
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19419
 
19420
RegInst9a:
19421
		sahf
19422
		sbb	al, byte [_z80de + 1]
19423
		lahf
19424
		seto	dl
19425
		and	ah, 0fbh	; Knock out parity/overflow
19426
		shl	dl, 2
19427
		or		ah, dl
19428
		or	ah, 02h	; N Gets set!
19429
		sub	edi, byte 4
19430
		js	near noMoreExec
19431
		mov	dl, byte [esi]	; Get our next instruction
19432
		inc	esi		; Increment PC
19433
		jmp	dword [z80regular+edx*4]
19434
 
19435
 
19436
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19437
 
19438
RegInst9b:
19439
		sahf
19440
		sbb	al, byte [_z80de]
19441
		lahf
19442
		seto	dl
19443
		and	ah, 0fbh	; Knock out parity/overflow
19444
		shl	dl, 2
19445
		or		ah, dl
19446
		or	ah, 02h	; N Gets set!
19447
		sub	edi, byte 4
19448
		js	near noMoreExec
19449
		mov	dl, byte [esi]	; Get our next instruction
19450
		inc	esi		; Increment PC
19451
		jmp	dword [z80regular+edx*4]
19452
 
19453
 
19454
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19455
 
19456
RegInst9c:
19457
		sahf
19458
		sbb	al, bh
19459
		lahf
19460
		seto	dl
19461
		and	ah, 0fbh	; Knock out parity/overflow
19462
		shl	dl, 2
19463
		or		ah, dl
19464
		or	ah, 02h	; N Gets set!
19465
		sub	edi, byte 4
19466
		js	near noMoreExec
19467
		mov	dl, byte [esi]	; Get our next instruction
19468
		inc	esi		; Increment PC
19469
		jmp	dword [z80regular+edx*4]
19470
 
19471
 
19472
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19473
 
19474
RegInst9d:
19475
		sahf
19476
		sbb	al, bl
19477
		lahf
19478
		seto	dl
19479
		and	ah, 0fbh	; Knock out parity/overflow
19480
		shl	dl, 2
19481
		or		ah, dl
19482
		or	ah, 02h	; N Gets set!
19483
		sub	edi, byte 4
19484
		js	near noMoreExec
19485
		mov	dl, byte [esi]	; Get our next instruction
19486
		inc	esi		; Increment PC
19487
		jmp	dword [z80regular+edx*4]
19488
 
19489
 
19490
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19491
 
19492
RegInst9e:
19493
		mov	[cyclesRemaining], edi
19494
		mov	edi, [_z80MemRead]	; Point to the read array
19495
 
19496
checkLoop349:
19497
		cmp	[edi], word 0ffffh ; End of the list?
19498
		je		memoryRead349
19499
		cmp	ebx, [edi]	; Are we smaller?
19500
		jb		nextAddr349		; Yes, go to the next address
19501
		cmp	ebx, [edi+4]	; Are we bigger?
19502
		jbe	callRoutine349
19503
 
19504
nextAddr349:
19505
		add	edi, 10h		; Next structure!
19506
		jmp	short checkLoop349
19507
 
19508
callRoutine349:
19509
		mov	dx, bx	; Get our address
19510
		call	ReadMemoryByte	; Standard read routine
19511
		mov	dl, al	; Put our returned value here
19512
		mov	ax, [_z80af]	; Get our AF back
19513
		jmp	short readExit349
19514
 
19515
memoryRead349:
19516
		mov	dl, [ebp + ebx]	; Get our data
19517
 
19518
readExit349:
19519
		mov	edi, [cyclesRemaining]
19520
		sahf
19521
		sbb	al, dl
19522
		lahf
19523
		seto	dl
19524
		and	ah, 0fbh	; Knock out parity/overflow
19525
		shl	dl, 2
19526
		or		ah, dl
19527
		or	ah, 02h	; N Gets set!
19528
		xor	edx, edx	; Zero this...
19529
		sub	edi, byte 7
19530
		js	near noMoreExec
19531
		mov	dl, byte [esi]	; Get our next instruction
19532
		inc	esi		; Increment PC
19533
		jmp	dword [z80regular+edx*4]
19534
 
19535
 
19536
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19537
 
19538
RegInst9f:
19539
		sahf
19540
		sbb	al, al
19541
		lahf
19542
		seto	dl
19543
		and	ah, 0fbh	; Knock out parity/overflow
19544
		shl	dl, 2
19545
		or		ah, dl
19546
		or	ah, 02h	; N Gets set!
19547
		sub	edi, byte 4
19548
		js	near noMoreExec
19549
		mov	dl, byte [esi]	; Get our next instruction
19550
		inc	esi		; Increment PC
19551
		jmp	dword [z80regular+edx*4]
19552
 
19553
 
19554
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19555
 
19556
RegInsta0:
19557
		sahf
19558
		and	al, ch
19559
		lahf
19560
		and	ah, 0ech	; Only these flags matter!
19561
		or	ah, 010h	; Half carry gets set
19562
		sub	edi, byte 4
19563
		js	near noMoreExec
19564
		mov	dl, byte [esi]	; Get our next instruction
19565
		inc	esi		; Increment PC
19566
		jmp	dword [z80regular+edx*4]
19567
 
19568
 
19569
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19570
 
19571
RegInsta1:
19572
		sahf
19573
		and	al, cl
19574
		lahf
19575
		and	ah, 0ech	; Only these flags matter!
19576
		or	ah, 010h	; Half carry gets set
19577
		sub	edi, byte 4
19578
		js	near noMoreExec
19579
		mov	dl, byte [esi]	; Get our next instruction
19580
		inc	esi		; Increment PC
19581
		jmp	dword [z80regular+edx*4]
19582
 
19583
 
19584
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19585
 
19586
RegInsta2:
19587
		sahf
19588
		and	al, byte [_z80de + 1]
19589
		lahf
19590
		and	ah, 0ech	; Only these flags matter!
19591
		or	ah, 010h	; Half carry gets set
19592
		sub	edi, byte 4
19593
		js	near noMoreExec
19594
		mov	dl, byte [esi]	; Get our next instruction
19595
		inc	esi		; Increment PC
19596
		jmp	dword [z80regular+edx*4]
19597
 
19598
 
19599
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19600
 
19601
RegInsta3:
19602
		sahf
19603
		and	al, byte [_z80de]
19604
		lahf
19605
		and	ah, 0ech	; Only these flags matter!
19606
		or	ah, 010h	; Half carry gets set
19607
		sub	edi, byte 4
19608
		js	near noMoreExec
19609
		mov	dl, byte [esi]	; Get our next instruction
19610
		inc	esi		; Increment PC
19611
		jmp	dword [z80regular+edx*4]
19612
 
19613
 
19614
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19615
 
19616
RegInsta4:
19617
		sahf
19618
		and	al, bh
19619
		lahf
19620
		and	ah, 0ech	; Only these flags matter!
19621
		or	ah, 010h	; Half carry gets set
19622
		sub	edi, byte 4
19623
		js	near noMoreExec
19624
		mov	dl, byte [esi]	; Get our next instruction
19625
		inc	esi		; Increment PC
19626
		jmp	dword [z80regular+edx*4]
19627
 
19628
 
19629
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19630
 
19631
RegInsta5:
19632
		sahf
19633
		and	al, bl
19634
		lahf
19635
		and	ah, 0ech	; Only these flags matter!
19636
		or	ah, 010h	; Half carry gets set
19637
		sub	edi, byte 4
19638
		js	near noMoreExec
19639
		mov	dl, byte [esi]	; Get our next instruction
19640
		inc	esi		; Increment PC
19641
		jmp	dword [z80regular+edx*4]
19642
 
19643
 
19644
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19645
 
19646
RegInsta6:
19647
		mov	[cyclesRemaining], edi
19648
		mov	edi, [_z80MemRead]	; Point to the read array
19649
 
19650
checkLoop350:
19651
		cmp	[edi], word 0ffffh ; End of the list?
19652
		je		memoryRead350
19653
		cmp	ebx, [edi]	; Are we smaller?
19654
		jb		nextAddr350		; Yes, go to the next address
19655
		cmp	ebx, [edi+4]	; Are we bigger?
19656
		jbe	callRoutine350
19657
 
19658
nextAddr350:
19659
		add	edi, 10h		; Next structure!
19660
		jmp	short checkLoop350
19661
 
19662
callRoutine350:
19663
		mov	dx, bx	; Get our address
19664
		call	ReadMemoryByte	; Standard read routine
19665
		mov	dl, al	; Put our returned value here
19666
		mov	ax, [_z80af]	; Get our AF back
19667
		jmp	short readExit350
19668
 
19669
memoryRead350:
19670
		mov	dl, [ebp + ebx]	; Get our data
19671
 
19672
readExit350:
19673
		mov	edi, [cyclesRemaining]
19674
		sahf
19675
		and	al, dl
19676
		lahf
19677
		and	ah, 0ech	; Only these flags matter!
19678
		or	ah, 010h	; Half carry gets set
19679
		xor	edx, edx	; Zero this...
19680
		sub	edi, byte 7
19681
		js	near noMoreExec
19682
		mov	dl, byte [esi]	; Get our next instruction
19683
		inc	esi		; Increment PC
19684
		jmp	dword [z80regular+edx*4]
19685
 
19686
 
19687
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19688
 
19689
RegInsta7:
19690
		sahf
19691
		and	al, al
19692
		lahf
19693
		and	ah, 0ech	; Only these flags matter!
19694
		or	ah, 010h	; Half carry gets set
19695
		sub	edi, byte 4
19696
		js	near noMoreExec
19697
		mov	dl, byte [esi]	; Get our next instruction
19698
		inc	esi		; Increment PC
19699
		jmp	dword [z80regular+edx*4]
19700
 
19701
 
19702
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19703
 
19704
RegInsta8:
19705
		sahf
19706
		xor	al, ch
19707
		lahf
19708
		and	ah, 0ech	; Only these flags matter!
19709
		sub	edi, byte 4
19710
		js	near noMoreExec
19711
		mov	dl, byte [esi]	; Get our next instruction
19712
		inc	esi		; Increment PC
19713
		jmp	dword [z80regular+edx*4]
19714
 
19715
 
19716
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19717
 
19718
RegInsta9:
19719
		sahf
19720
		xor	al, cl
19721
		lahf
19722
		and	ah, 0ech	; Only these flags matter!
19723
		sub	edi, byte 4
19724
		js	near noMoreExec
19725
		mov	dl, byte [esi]	; Get our next instruction
19726
		inc	esi		; Increment PC
19727
		jmp	dword [z80regular+edx*4]
19728
 
19729
 
19730
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19731
 
19732
RegInstaa:
19733
		sahf
19734
		xor	al, byte [_z80de + 1]
19735
		lahf
19736
		and	ah, 0ech	; Only these flags matter!
19737
		sub	edi, byte 4
19738
		js	near noMoreExec
19739
		mov	dl, byte [esi]	; Get our next instruction
19740
		inc	esi		; Increment PC
19741
		jmp	dword [z80regular+edx*4]
19742
 
19743
 
19744
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19745
 
19746
RegInstab:
19747
		sahf
19748
		xor	al, byte [_z80de]
19749
		lahf
19750
		and	ah, 0ech	; Only these flags matter!
19751
		sub	edi, byte 4
19752
		js	near noMoreExec
19753
		mov	dl, byte [esi]	; Get our next instruction
19754
		inc	esi		; Increment PC
19755
		jmp	dword [z80regular+edx*4]
19756
 
19757
 
19758
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19759
 
19760
RegInstac:
19761
		sahf
19762
		xor	al, bh
19763
		lahf
19764
		and	ah, 0ech	; Only these flags matter!
19765
		sub	edi, byte 4
19766
		js	near noMoreExec
19767
		mov	dl, byte [esi]	; Get our next instruction
19768
		inc	esi		; Increment PC
19769
		jmp	dword [z80regular+edx*4]
19770
 
19771
 
19772
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19773
 
19774
RegInstad:
19775
		sahf
19776
		xor	al, bl
19777
		lahf
19778
		and	ah, 0ech	; Only these flags matter!
19779
		sub	edi, byte 4
19780
		js	near noMoreExec
19781
		mov	dl, byte [esi]	; Get our next instruction
19782
		inc	esi		; Increment PC
19783
		jmp	dword [z80regular+edx*4]
19784
 
19785
 
19786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19787
 
19788
RegInstae:
19789
		mov	[cyclesRemaining], edi
19790
		mov	edi, [_z80MemRead]	; Point to the read array
19791
 
19792
checkLoop351:
19793
		cmp	[edi], word 0ffffh ; End of the list?
19794
		je		memoryRead351
19795
		cmp	ebx, [edi]	; Are we smaller?
19796
		jb		nextAddr351		; Yes, go to the next address
19797
		cmp	ebx, [edi+4]	; Are we bigger?
19798
		jbe	callRoutine351
19799
 
19800
nextAddr351:
19801
		add	edi, 10h		; Next structure!
19802
		jmp	short checkLoop351
19803
 
19804
callRoutine351:
19805
		mov	dx, bx	; Get our address
19806
		call	ReadMemoryByte	; Standard read routine
19807
		mov	dl, al	; Put our returned value here
19808
		mov	ax, [_z80af]	; Get our AF back
19809
		jmp	short readExit351
19810
 
19811
memoryRead351:
19812
		mov	dl, [ebp + ebx]	; Get our data
19813
 
19814
readExit351:
19815
		mov	edi, [cyclesRemaining]
19816
		sahf
19817
		xor	al, dl
19818
		lahf
19819
		and	ah, 0ech	; Only these flags matter!
19820
		xor	edx, edx	; Zero this...
19821
		sub	edi, byte 7
19822
		js	near noMoreExec
19823
		mov	dl, byte [esi]	; Get our next instruction
19824
		inc	esi		; Increment PC
19825
		jmp	dword [z80regular+edx*4]
19826
 
19827
 
19828
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19829
 
19830
RegInstaf:
19831
		sahf
19832
		xor	al, al
19833
		lahf
19834
		and	ah, 0ech	; Only these flags matter!
19835
		sub	edi, byte 4
19836
		js	near noMoreExec
19837
		mov	dl, byte [esi]	; Get our next instruction
19838
		inc	esi		; Increment PC
19839
		jmp	dword [z80regular+edx*4]
19840
 
19841
 
19842
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19843
 
19844
RegInstb0:
19845
		sahf
19846
		or	al, ch
19847
		lahf
19848
		and	ah, 0ech ; No H, N, or C
19849
		sub	edi, byte 4
19850
		js	near noMoreExec
19851
		mov	dl, byte [esi]	; Get our next instruction
19852
		inc	esi		; Increment PC
19853
		jmp	dword [z80regular+edx*4]
19854
 
19855
 
19856
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19857
 
19858
RegInstb1:
19859
		sahf
19860
		or	al, cl
19861
		lahf
19862
		and	ah, 0ech ; No H, N, or C
19863
		sub	edi, byte 4
19864
		js	near noMoreExec
19865
		mov	dl, byte [esi]	; Get our next instruction
19866
		inc	esi		; Increment PC
19867
		jmp	dword [z80regular+edx*4]
19868
 
19869
 
19870
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19871
 
19872
RegInstb2:
19873
		sahf
19874
		or	al, byte [_z80de + 1]
19875
		lahf
19876
		and	ah, 0ech ; No H, N, or C
19877
		sub	edi, byte 4
19878
		js	near noMoreExec
19879
		mov	dl, byte [esi]	; Get our next instruction
19880
		inc	esi		; Increment PC
19881
		jmp	dword [z80regular+edx*4]
19882
 
19883
 
19884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19885
 
19886
RegInstb3:
19887
		sahf
19888
		or	al, byte [_z80de]
19889
		lahf
19890
		and	ah, 0ech ; No H, N, or C
19891
		sub	edi, byte 4
19892
		js	near noMoreExec
19893
		mov	dl, byte [esi]	; Get our next instruction
19894
		inc	esi		; Increment PC
19895
		jmp	dword [z80regular+edx*4]
19896
 
19897
 
19898
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19899
 
19900
RegInstb4:
19901
		sahf
19902
		or	al, bh
19903
		lahf
19904
		and	ah, 0ech ; No H, N, or C
19905
		sub	edi, byte 4
19906
		js	near noMoreExec
19907
		mov	dl, byte [esi]	; Get our next instruction
19908
		inc	esi		; Increment PC
19909
		jmp	dword [z80regular+edx*4]
19910
 
19911
 
19912
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19913
 
19914
RegInstb5:
19915
		sahf
19916
		or	al, bl
19917
		lahf
19918
		and	ah, 0ech ; No H, N, or C
19919
		sub	edi, byte 4
19920
		js	near noMoreExec
19921
		mov	dl, byte [esi]	; Get our next instruction
19922
		inc	esi		; Increment PC
19923
		jmp	dword [z80regular+edx*4]
19924
 
19925
 
19926
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19927
 
19928
RegInstb6:
19929
		mov	[cyclesRemaining], edi
19930
		mov	edi, [_z80MemRead]	; Point to the read array
19931
 
19932
checkLoop352:
19933
		cmp	[edi], word 0ffffh ; End of the list?
19934
		je		memoryRead352
19935
		cmp	ebx, [edi]	; Are we smaller?
19936
		jb		nextAddr352		; Yes, go to the next address
19937
		cmp	ebx, [edi+4]	; Are we bigger?
19938
		jbe	callRoutine352
19939
 
19940
nextAddr352:
19941
		add	edi, 10h		; Next structure!
19942
		jmp	short checkLoop352
19943
 
19944
callRoutine352:
19945
		mov	dx, bx	; Get our address
19946
		call	ReadMemoryByte	; Standard read routine
19947
		mov	dl, al	; Put our returned value here
19948
		mov	ax, [_z80af]	; Get our AF back
19949
		jmp	short readExit352
19950
 
19951
memoryRead352:
19952
		mov	dl, [ebp + ebx]	; Get our data
19953
 
19954
readExit352:
19955
		mov	edi, [cyclesRemaining]
19956
		sahf
19957
		or	al, dl
19958
		lahf
19959
		and	ah, 0ech ; No H, N, or C
19960
		xor	edx, edx	; Zero this...
19961
		sub	edi, byte 7
19962
		js	near noMoreExec
19963
		mov	dl, byte [esi]	; Get our next instruction
19964
		inc	esi		; Increment PC
19965
		jmp	dword [z80regular+edx*4]
19966
 
19967
 
19968
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19969
 
19970
RegInstb7:
19971
		sahf
19972
		or	al, al
19973
		lahf
19974
		and	ah, 0ech ; No H, N, or C
19975
		sub	edi, byte 4
19976
		js	near noMoreExec
19977
		mov	dl, byte [esi]	; Get our next instruction
19978
		inc	esi		; Increment PC
19979
		jmp	dword [z80regular+edx*4]
19980
 
19981
 
19982
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
19983
 
19984
RegInstb8:
19985
		sahf
19986
		cmp	al, ch
19987
		lahf
19988
		seto	dl
19989
		and	ah, 0fbh	; Knock out parity/overflow
19990
		shl	dl, 2
19991
		or		ah, dl
19992
		or	ah, 02h	; Set N for compare!
19993
		sub	edi, byte 4
19994
		js	near noMoreExec
19995
		mov	dl, byte [esi]	; Get our next instruction
19996
		inc	esi		; Increment PC
19997
		jmp	dword [z80regular+edx*4]
19998
 
19999
 
20000
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20001
 
20002
RegInstb9:
20003
		sahf
20004
		cmp	al, cl
20005
		lahf
20006
		seto	dl
20007
		and	ah, 0fbh	; Knock out parity/overflow
20008
		shl	dl, 2
20009
		or		ah, dl
20010
		or	ah, 02h	; Set N for compare!
20011
		sub	edi, byte 4
20012
		js	near noMoreExec
20013
		mov	dl, byte [esi]	; Get our next instruction
20014
		inc	esi		; Increment PC
20015
		jmp	dword [z80regular+edx*4]
20016
 
20017
 
20018
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20019
 
20020
RegInstba:
20021
		sahf
20022
		cmp	al, byte [_z80de + 1]
20023
		lahf
20024
		seto	dl
20025
		and	ah, 0fbh	; Knock out parity/overflow
20026
		shl	dl, 2
20027
		or		ah, dl
20028
		or	ah, 02h	; Set N for compare!
20029
		sub	edi, byte 4
20030
		js	near noMoreExec
20031
		mov	dl, byte [esi]	; Get our next instruction
20032
		inc	esi		; Increment PC
20033
		jmp	dword [z80regular+edx*4]
20034
 
20035
 
20036
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20037
 
20038
RegInstbb:
20039
		sahf
20040
		cmp	al, byte [_z80de]
20041
		lahf
20042
		seto	dl
20043
		and	ah, 0fbh	; Knock out parity/overflow
20044
		shl	dl, 2
20045
		or		ah, dl
20046
		or	ah, 02h	; Set N for compare!
20047
		sub	edi, byte 4
20048
		js	near noMoreExec
20049
		mov	dl, byte [esi]	; Get our next instruction
20050
		inc	esi		; Increment PC
20051
		jmp	dword [z80regular+edx*4]
20052
 
20053
 
20054
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20055
 
20056
RegInstbc:
20057
		sahf
20058
		cmp	al, bh
20059
		lahf
20060
		seto	dl
20061
		and	ah, 0fbh	; Knock out parity/overflow
20062
		shl	dl, 2
20063
		or		ah, dl
20064
		or	ah, 02h	; Set N for compare!
20065
		sub	edi, byte 4
20066
		js	near noMoreExec
20067
		mov	dl, byte [esi]	; Get our next instruction
20068
		inc	esi		; Increment PC
20069
		jmp	dword [z80regular+edx*4]
20070
 
20071
 
20072
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20073
 
20074
RegInstbd:
20075
		sahf
20076
		cmp	al, bl
20077
		lahf
20078
		seto	dl
20079
		and	ah, 0fbh	; Knock out parity/overflow
20080
		shl	dl, 2
20081
		or		ah, dl
20082
		or	ah, 02h	; Set N for compare!
20083
		sub	edi, byte 4
20084
		js	near noMoreExec
20085
		mov	dl, byte [esi]	; Get our next instruction
20086
		inc	esi		; Increment PC
20087
		jmp	dword [z80regular+edx*4]
20088
 
20089
 
20090
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20091
 
20092
RegInstbe:
20093
		mov	[cyclesRemaining], edi
20094
		mov	edi, [_z80MemRead]	; Point to the read array
20095
 
20096
checkLoop353:
20097
		cmp	[edi], word 0ffffh ; End of the list?
20098
		je		memoryRead353
20099
		cmp	ebx, [edi]	; Are we smaller?
20100
		jb		nextAddr353		; Yes, go to the next address
20101
		cmp	ebx, [edi+4]	; Are we bigger?
20102
		jbe	callRoutine353
20103
 
20104
nextAddr353:
20105
		add	edi, 10h		; Next structure!
20106
		jmp	short checkLoop353
20107
 
20108
callRoutine353:
20109
		mov	dx, bx	; Get our address
20110
		call	ReadMemoryByte	; Standard read routine
20111
		mov	dl, al	; Put our returned value here
20112
		mov	ax, [_z80af]	; Get our AF back
20113
		jmp	short readExit353
20114
 
20115
memoryRead353:
20116
		mov	dl, [ebp + ebx]	; Get our data
20117
 
20118
readExit353:
20119
		mov	edi, [cyclesRemaining]
20120
		sahf
20121
		cmp	al, dl
20122
		lahf
20123
		seto	dl
20124
		and	ah, 0fbh	; Knock out parity/overflow
20125
		shl	dl, 2
20126
		or		ah, dl
20127
		or	ah, 02h	; Set N for compare!
20128
		xor	edx, edx	; Zero this...
20129
		sub	edi, byte 7
20130
		js	near noMoreExec
20131
		mov	dl, byte [esi]	; Get our next instruction
20132
		inc	esi		; Increment PC
20133
		jmp	dword [z80regular+edx*4]
20134
 
20135
 
20136
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20137
 
20138
RegInstbf:
20139
		sahf
20140
		cmp	al, al
20141
		lahf
20142
		seto	dl
20143
		and	ah, 0fbh	; Knock out parity/overflow
20144
		shl	dl, 2
20145
		or		ah, dl
20146
		or	ah, 02h	; Set N for compare!
20147
		sub	edi, byte 4
20148
		js	near noMoreExec
20149
		mov	dl, byte [esi]	; Get our next instruction
20150
		inc	esi		; Increment PC
20151
		jmp	dword [z80regular+edx*4]
20152
 
20153
 
20154
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20155
 
20156
RegInstc0:
20157
		sahf
20158
		jnz	takeReturn354
20159
		jmp	short retNotTaken354
20160
takeReturn354:
20161
		sub	edi, byte 6
20162
		mov	dx, word [_z80sp]	; Get our current stack pointer
20163
		mov	si, [edx+ebp]	; Get our return address
20164
		and	esi, 0ffffh		; Only within 64K!
20165
		add	esi, ebp			; Add in our base address
20166
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20167
		xor	edx, edx
20168
retNotTaken354:
20169
		sub	edi, byte 5
20170
		js	near noMoreExec
20171
		mov	dl, byte [esi]	; Get our next instruction
20172
		inc	esi		; Increment PC
20173
		jmp	dword [z80regular+edx*4]
20174
 
20175
 
20176
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20177
 
20178
RegInstc1:
20179
		mov	dx, [_z80sp]
20180
		mov	[cyclesRemaining], edi
20181
		mov	edi, [_z80MemRead]	; Point to the read array
20182
 
20183
checkLoop355:
20184
		cmp	[edi], word 0ffffh ; End of the list?
20185
		je		memoryRead355
20186
		cmp	dx, [edi]	; Are we smaller?
20187
		jb		nextAddr355		; Yes, go to the next address
20188
		cmp	dx, [edi+4]	; Are we bigger?
20189
		jbe	callRoutine355
20190
 
20191
nextAddr355:
20192
		add	edi, 10h		; Next structure!
20193
		jmp	short checkLoop355
20194
 
20195
callRoutine355:
20196
		push	ax		; Save this for later
20197
		push	dx		; Save address
20198
		call	ReadMemoryByte	; Standard read routine
20199
		pop	dx		; Restore our address
20200
		inc	dx		; Next byte, please
20201
		push	ax		; Save returned byte
20202
		call	ReadMemoryByte	; Standard read routine
20203
		xchg	ah, al	; Swap for endian's sake
20204
		pop	dx	; Restore LSB
20205
		mov	dh, ah	; Our word is now in DX
20206
		pop	ax		; Restore this
20207
		mov	cx, dx	; Store our word
20208
		jmp	readExit355
20209
 
20210
memoryRead355:
20211
		mov	cx, [ebp + edx]
20212
readExit355:
20213
		mov	edi, [cyclesRemaining]
20214
		add	word [_z80sp], 2
20215
		xor	edx, edx
20216
		sub	edi, byte 10
20217
		js	near noMoreExec
20218
		mov	dl, byte [esi]	; Get our next instruction
20219
		inc	esi		; Increment PC
20220
		jmp	dword [z80regular+edx*4]
20221
 
20222
 
20223
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20224
 
20225
RegInstc2:
20226
		sahf		; Restore our flags
20227
		jnz	takeJump356	; We're going to take a jump
20228
		add	esi, 2		; Skip past the address
20229
		jmp	short nextInst356	 ; Go execute the next instruction
20230
takeJump356:
20231
		mov	si, [esi]	; Get our new offset
20232
		and	esi, 0ffffh	; Only the lower WORD is valid
20233
		add	esi, ebp		; Our new address!
20234
nextInst356:
20235
		sub	edi, byte 10
20236
		js	near noMoreExec
20237
		mov	dl, byte [esi]	; Get our next instruction
20238
		inc	esi		; Increment PC
20239
		jmp	dword [z80regular+edx*4]
20240
 
20241
 
20242
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20243
 
20244
RegInstc3:
20245
		mov	si, [esi]	; Get our new address
20246
		and	esi, 0ffffh	; Only the lower 16 bits
20247
		add	esi, ebp		; Our new address!
20248
		sub	edi, byte 10
20249
		js	near noMoreExec
20250
		mov	dl, byte [esi]	; Get our next instruction
20251
		inc	esi		; Increment PC
20252
		jmp	dword [z80regular+edx*4]
20253
 
20254
 
20255
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20256
 
20257
RegInstc4:
20258
		sahf		; Restore our flags
20259
		jnz	takeJump357	; We're going call in this case
20260
		add	esi, 2		; Skip past the address
20261
		jmp	short noCallTaken357	 ; Go execute the next instruction
20262
takeJump357:
20263
		sub	edi, 7
20264
		mov	dx, [esi]	; Get our call to address
20265
		mov	[_z80pc], dx ; Store our new program counter
20266
		add	esi, 2		; Skip to our new address to be pushed
20267
		sub	esi, ebp		; Value to push onto the "stack"
20268
		mov	dx, word [_z80sp] ; Get the current stack pointer
20269
		sub	dx, 2		; Back up two bytes
20270
		mov	[ebp+edx], si ; PUSH It!
20271
		mov	word [_z80sp], dx	; Store our new stack pointer
20272
		mov	si, [_z80pc] ; Get our new program counter
20273
		add	esi, ebp		; Naturalize it!
20274
noCallTaken357:
20275
		xor	edx, edx
20276
		sub	edi, byte 10
20277
		js	near noMoreExec
20278
		mov	dl, byte [esi]	; Get our next instruction
20279
		inc	esi		; Increment PC
20280
		jmp	dword [z80regular+edx*4]
20281
 
20282
 
20283
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20284
 
20285
RegInstc5:
20286
		sub	word [_z80sp], 2
20287
		mov	dx, [_z80sp]
20288
		mov	[cyclesRemaining], edi
20289
		mov	edi, [_z80MemWrite]	; Point to the write array
20290
 
20291
checkLoop358:
20292
		cmp	[edi], word 0ffffh ; End of the list?
20293
		je		memoryWrite358
20294
		cmp	dx, [edi]	; Are we smaller?
20295
		jb		nextAddr358		; Yes, go to the next address
20296
		cmp	dx, [edi+4]	; Are we bigger?
20297
		jbe	callRoutine358
20298
 
20299
nextAddr358:
20300
		add	edi, 10h		; Next structure!
20301
		jmp	short checkLoop358
20302
 
20303
callRoutine358:
20304
		push	ax		; Save this for later
20305
		push	dx
20306
		mov	ax, cx
20307
		call	WriteMemoryByte
20308
		pop	dx
20309
		pop	ax
20310
		inc	dx
20311
 
20312
		push	ax
20313
		push	dx
20314
		mov	ax, cx
20315
		xchg	ah, al
20316
		call	WriteMemoryByte
20317
		pop	dx
20318
		pop	ax	; Restore us!
20319
		jmp	writeExit358
20320
 
20321
memoryWrite358:
20322
		mov	[ebp + edx], cx	; Store our word
20323
writeExit358:
20324
		mov	edi, [cyclesRemaining]
20325
		xor	edx, edx
20326
		sub	edi, byte 11
20327
		js	near noMoreExec
20328
		mov	dl, byte [esi]	; Get our next instruction
20329
		inc	esi		; Increment PC
20330
		jmp	dword [z80regular+edx*4]
20331
 
20332
 
20333
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20334
 
20335
RegInstc6:
20336
		sahf
20337
		add	al, [esi]
20338
		lahf
20339
		seto	dl
20340
		and	ah, 0fbh	; Knock out parity/overflow
20341
		shl	dl, 2
20342
		or		ah, dl
20343
		and	ah, 0fdh ; Knock out N!
20344
		inc	esi
20345
		sub	edi, byte 7
20346
		js	near noMoreExec
20347
		mov	dl, byte [esi]	; Get our next instruction
20348
		inc	esi		; Increment PC
20349
		jmp	dword [z80regular+edx*4]
20350
 
20351
 
20352
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20353
 
20354
RegInstc7:
20355
		mov	dx, word [_z80sp]	; Get our stack pointer
20356
		sub	dx, 2		; Make room for the new value!
20357
		mov	word [_z80sp], dx	; Store our new stack pointer
20358
		sub	esi, ebp		; Get our real PC
20359
		mov	[ebp+edx], si	; Our return address
20360
		mov	si, 000h	; Our new call address
20361
		add	esi, ebp	; Back to the base!
20362
		xor	edx, edx
20363
		sub	edi, byte 11
20364
		js	near noMoreExec
20365
		mov	dl, byte [esi]	; Get our next instruction
20366
		inc	esi		; Increment PC
20367
		jmp	dword [z80regular+edx*4]
20368
 
20369
 
20370
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20371
 
20372
RegInstc8:
20373
		sahf
20374
		jz	takeReturn359
20375
		jmp	short retNotTaken359
20376
takeReturn359:
20377
		sub	edi, byte 6
20378
		mov	dx, word [_z80sp]	; Get our current stack pointer
20379
		mov	si, [edx+ebp]	; Get our return address
20380
		and	esi, 0ffffh		; Only within 64K!
20381
		add	esi, ebp			; Add in our base address
20382
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20383
		xor	edx, edx
20384
retNotTaken359:
20385
		sub	edi, byte 5
20386
		js	near noMoreExec
20387
		mov	dl, byte [esi]	; Get our next instruction
20388
		inc	esi		; Increment PC
20389
		jmp	dword [z80regular+edx*4]
20390
 
20391
 
20392
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20393
 
20394
RegInstc9:
20395
		mov	dx, word [_z80sp]	; Get our current stack pointer
20396
		mov	si, [edx+ebp]	; Get our return address
20397
		and	esi, 0ffffh		; Only within 64K!
20398
		add	esi, ebp			; Add in our base address
20399
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20400
		xor	edx, edx
20401
		sub	edi, byte 10
20402
		js	near noMoreExec
20403
		mov	dl, byte [esi]	; Get our next instruction
20404
		inc	esi		; Increment PC
20405
		jmp	dword [z80regular+edx*4]
20406
 
20407
 
20408
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20409
 
20410
RegInstca:
20411
		sahf		; Restore our flags
20412
		jz	takeJump360	; We're going to take a jump
20413
		add	esi, 2		; Skip past the address
20414
		jmp	short nextInst360	 ; Go execute the next instruction
20415
takeJump360:
20416
		mov	si, [esi]	; Get our new offset
20417
		and	esi, 0ffffh	; Only the lower WORD is valid
20418
		add	esi, ebp		; Our new address!
20419
nextInst360:
20420
		sub	edi, byte 10
20421
		js	near noMoreExec
20422
		mov	dl, byte [esi]	; Get our next instruction
20423
		inc	esi		; Increment PC
20424
		jmp	dword [z80regular+edx*4]
20425
 
20426
;
20427
; Handler for all CBxx instructions
20428
;
20429
 
20430
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20431
 
20432
RegInstcb:
20433
		mov	dl, [esi]
20434
		inc	esi
20435
		jmp	dword [z80PrefixCB+edx*4]
20436
 
20437
 
20438
 
20439
 
20440
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20441
 
20442
RegInstcc:
20443
		sahf		; Restore our flags
20444
		jz	takeJump361	; We're going call in this case
20445
		add	esi, 2		; Skip past the address
20446
		jmp	short noCallTaken361	 ; Go execute the next instruction
20447
takeJump361:
20448
		sub	edi, 7
20449
		mov	dx, [esi]	; Get our call to address
20450
		mov	[_z80pc], dx ; Store our new program counter
20451
		add	esi, 2		; Skip to our new address to be pushed
20452
		sub	esi, ebp		; Value to push onto the "stack"
20453
		mov	dx, word [_z80sp] ; Get the current stack pointer
20454
		sub	dx, 2		; Back up two bytes
20455
		mov	[ebp+edx], si ; PUSH It!
20456
		mov	word [_z80sp], dx	; Store our new stack pointer
20457
		mov	si, [_z80pc] ; Get our new program counter
20458
		add	esi, ebp		; Naturalize it!
20459
noCallTaken361:
20460
		xor	edx, edx
20461
		sub	edi, byte 10
20462
		js	near noMoreExec
20463
		mov	dl, byte [esi]	; Get our next instruction
20464
		inc	esi		; Increment PC
20465
		jmp	dword [z80regular+edx*4]
20466
 
20467
 
20468
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20469
 
20470
RegInstcd:
20471
		mov	dx, [esi]	; Get our call to address
20472
		mov	[_z80pc], dx ; Store our new program counter
20473
		add	esi, 2		; Skip to our new address to be pushed
20474
		sub	esi, ebp		; Value to push onto the "stack"
20475
		mov	dx, word [_z80sp] ; Get the current stack pointer
20476
		sub	dx, 2		; Back up two bytes
20477
		mov	[ebp+edx], si ; PUSH It!
20478
		mov	word [_z80sp], dx	; Store our new stack pointer
20479
		mov	si, [_z80pc] ; Get our new program counter
20480
		add	esi, ebp		; Naturalize it!
20481
		xor	edx, edx
20482
		sub	edi, byte 17
20483
		js	near noMoreExec
20484
		mov	dl, byte [esi]	; Get our next instruction
20485
		inc	esi		; Increment PC
20486
		jmp	dword [z80regular+edx*4]
20487
 
20488
 
20489
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20490
 
20491
RegInstce:
20492
		sahf
20493
		adc	al, [esi]
20494
		lahf
20495
		seto	dl
20496
		and	ah, 0fbh	; Knock out parity/overflow
20497
		shl	dl, 2
20498
		or		ah, dl
20499
		and	ah, 0fdh ; Knock out N!
20500
		inc	esi
20501
		sub	edi, byte 7
20502
		js	near noMoreExec
20503
		mov	dl, byte [esi]	; Get our next instruction
20504
		inc	esi		; Increment PC
20505
		jmp	dword [z80regular+edx*4]
20506
 
20507
 
20508
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20509
 
20510
RegInstcf:
20511
		mov	dx, word [_z80sp]	; Get our stack pointer
20512
		sub	dx, 2		; Make room for the new value!
20513
		mov	word [_z80sp], dx	; Store our new stack pointer
20514
		sub	esi, ebp		; Get our real PC
20515
		mov	[ebp+edx], si	; Our return address
20516
		mov	si, 008h	; Our new call address
20517
		add	esi, ebp	; Back to the base!
20518
		xor	edx, edx
20519
		sub	edi, byte 11
20520
		js	near noMoreExec
20521
		mov	dl, byte [esi]	; Get our next instruction
20522
		inc	esi		; Increment PC
20523
		jmp	dword [z80regular+edx*4]
20524
 
20525
 
20526
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20527
 
20528
RegInstd0:
20529
		sahf
20530
		jnc	takeReturn362
20531
		jmp	short retNotTaken362
20532
takeReturn362:
20533
		sub	edi, byte 6
20534
		mov	dx, word [_z80sp]	; Get our current stack pointer
20535
		mov	si, [edx+ebp]	; Get our return address
20536
		and	esi, 0ffffh		; Only within 64K!
20537
		add	esi, ebp			; Add in our base address
20538
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20539
		xor	edx, edx
20540
retNotTaken362:
20541
		sub	edi, byte 5
20542
		js	near noMoreExec
20543
		mov	dl, byte [esi]	; Get our next instruction
20544
		inc	esi		; Increment PC
20545
		jmp	dword [z80regular+edx*4]
20546
 
20547
 
20548
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20549
 
20550
RegInstd1:
20551
		mov	dx, [_z80sp]
20552
		mov	[cyclesRemaining], edi
20553
		mov	edi, [_z80MemRead]	; Point to the read array
20554
 
20555
checkLoop363:
20556
		cmp	[edi], word 0ffffh ; End of the list?
20557
		je		memoryRead363
20558
		cmp	dx, [edi]	; Are we smaller?
20559
		jb		nextAddr363		; Yes, go to the next address
20560
		cmp	dx, [edi+4]	; Are we bigger?
20561
		jbe	callRoutine363
20562
 
20563
nextAddr363:
20564
		add	edi, 10h		; Next structure!
20565
		jmp	short checkLoop363
20566
 
20567
callRoutine363:
20568
		push	ax		; Save this for later
20569
		push	dx		; Save address
20570
		call	ReadMemoryByte	; Standard read routine
20571
		pop	dx		; Restore our address
20572
		inc	dx		; Next byte, please
20573
		push	ax		; Save returned byte
20574
		call	ReadMemoryByte	; Standard read routine
20575
		xchg	ah, al	; Swap for endian's sake
20576
		pop	dx	; Restore LSB
20577
		mov	dh, ah	; Our word is now in DX
20578
		pop	ax		; Restore this
20579
		mov	word [_z80de], dx	; Store our word
20580
		jmp	readExit363
20581
 
20582
memoryRead363:
20583
		mov	dx, [ebp + edx]
20584
		mov	word [_z80de], dx
20585
readExit363:
20586
		mov	edi, [cyclesRemaining]
20587
		add	word [_z80sp], 2
20588
		xor	edx, edx
20589
		sub	edi, byte 10
20590
		js	near noMoreExec
20591
		mov	dl, byte [esi]	; Get our next instruction
20592
		inc	esi		; Increment PC
20593
		jmp	dword [z80regular+edx*4]
20594
 
20595
 
20596
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20597
 
20598
RegInstd2:
20599
		sahf		; Restore our flags
20600
		jnc	takeJump364	; We're going to take a jump
20601
		add	esi, 2		; Skip past the address
20602
		jmp	short nextInst364	 ; Go execute the next instruction
20603
takeJump364:
20604
		mov	si, [esi]	; Get our new offset
20605
		and	esi, 0ffffh	; Only the lower WORD is valid
20606
		add	esi, ebp		; Our new address!
20607
nextInst364:
20608
		sub	edi, byte 10
20609
		js	near noMoreExec
20610
		mov	dl, byte [esi]	; Get our next instruction
20611
		inc	esi		; Increment PC
20612
		jmp	dword [z80regular+edx*4]
20613
 
20614
 
20615
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20616
 
20617
RegInstd3:
20618
		mov	dl, [esi]	; Get our address to 'out' to
20619
		inc	esi	; Next address
20620
		mov	[cyclesRemaining], edi
20621
		mov	[_z80af], ax	; Store AF
20622
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
20623
 
20624
checkLoop365:
20625
		cmp	[edi], word 0ffffh ; End of our list?
20626
		je	WriteMacroExit365	; Yes - ignore it!
20627
		cmp	dx, [edi]	; Are we smaller?
20628
		jb	nextAddr365	; Yes... go to the next addr
20629
		cmp	dx, [edi+2]	; Are we bigger?
20630
		jbe	callRoutine365	; If not, go call it!
20631
 
20632
nextAddr365:
20633
		add	edi, 0ch		; Next structure, please
20634
		jmp	short checkLoop365
20635
 
20636
callRoutine365:
20637
		call	WriteIOByte	; Go write the data!
20638
WriteMacroExit365:
20639
		mov	edi, [cyclesRemaining]
20640
		xor	edx, edx
20641
		sub	edi, byte 11
20642
		js	near noMoreExec
20643
		mov	dl, byte [esi]	; Get our next instruction
20644
		inc	esi		; Increment PC
20645
		jmp	dword [z80regular+edx*4]
20646
 
20647
 
20648
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20649
 
20650
RegInstd4:
20651
		sahf		; Restore our flags
20652
		jnc	takeJump366	; We're going call in this case
20653
		add	esi, 2		; Skip past the address
20654
		jmp	short noCallTaken366	 ; Go execute the next instruction
20655
takeJump366:
20656
		sub	edi, 7
20657
		mov	dx, [esi]	; Get our call to address
20658
		mov	[_z80pc], dx ; Store our new program counter
20659
		add	esi, 2		; Skip to our new address to be pushed
20660
		sub	esi, ebp		; Value to push onto the "stack"
20661
		mov	dx, word [_z80sp] ; Get the current stack pointer
20662
		sub	dx, 2		; Back up two bytes
20663
		mov	[ebp+edx], si ; PUSH It!
20664
		mov	word [_z80sp], dx	; Store our new stack pointer
20665
		mov	si, [_z80pc] ; Get our new program counter
20666
		add	esi, ebp		; Naturalize it!
20667
noCallTaken366:
20668
		xor	edx, edx
20669
		sub	edi, byte 10
20670
		js	near noMoreExec
20671
		mov	dl, byte [esi]	; Get our next instruction
20672
		inc	esi		; Increment PC
20673
		jmp	dword [z80regular+edx*4]
20674
 
20675
 
20676
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20677
 
20678
RegInstd5:
20679
		sub	word [_z80sp], 2
20680
		mov	dx, [_z80sp]
20681
		mov	[cyclesRemaining], edi
20682
		mov	edi, [_z80MemWrite]	; Point to the write array
20683
 
20684
checkLoop367:
20685
		cmp	[edi], word 0ffffh ; End of the list?
20686
		je		memoryWrite367
20687
		cmp	dx, [edi]	; Are we smaller?
20688
		jb		nextAddr367		; Yes, go to the next address
20689
		cmp	dx, [edi+4]	; Are we bigger?
20690
		jbe	callRoutine367
20691
 
20692
nextAddr367:
20693
		add	edi, 10h		; Next structure!
20694
		jmp	short checkLoop367
20695
 
20696
callRoutine367:
20697
		push	ax		; Save this for later
20698
		push	dx
20699
		mov	ax, word [_z80de]
20700
		call	WriteMemoryByte
20701
		pop	dx
20702
		pop	ax
20703
		inc	dx
20704
 
20705
		push	ax
20706
		push	dx
20707
		mov	ax, word [_z80de]
20708
		xchg	ah, al
20709
		call	WriteMemoryByte
20710
		pop	dx
20711
		pop	ax	; Restore us!
20712
		jmp	writeExit367
20713
 
20714
memoryWrite367:
20715
		mov	di, word [_z80de]
20716
		mov	[ebp + edx], di	; Store our word
20717
writeExit367:
20718
		mov	edi, [cyclesRemaining]
20719
		xor	edx, edx
20720
		sub	edi, byte 11
20721
		js	near noMoreExec
20722
		mov	dl, byte [esi]	; Get our next instruction
20723
		inc	esi		; Increment PC
20724
		jmp	dword [z80regular+edx*4]
20725
 
20726
 
20727
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20728
 
20729
RegInstd6:
20730
		sahf
20731
		sub	al, [esi]
20732
		lahf
20733
		seto	dl
20734
		and	ah, 0fbh	; Knock out parity/overflow
20735
		shl	dl, 2
20736
		or		ah, dl
20737
		or	ah, 02h	; Set negative!
20738
		inc	esi
20739
		sub	edi, byte 7
20740
		js	near noMoreExec
20741
		mov	dl, byte [esi]	; Get our next instruction
20742
		inc	esi		; Increment PC
20743
		jmp	dword [z80regular+edx*4]
20744
 
20745
 
20746
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20747
 
20748
RegInstd7:
20749
		mov	dx, word [_z80sp]	; Get our stack pointer
20750
		sub	dx, 2		; Make room for the new value!
20751
		mov	word [_z80sp], dx	; Store our new stack pointer
20752
		sub	esi, ebp		; Get our real PC
20753
		mov	[ebp+edx], si	; Our return address
20754
		mov	si, 010h	; Our new call address
20755
		add	esi, ebp	; Back to the base!
20756
		xor	edx, edx
20757
		sub	edi, byte 11
20758
		js	near noMoreExec
20759
		mov	dl, byte [esi]	; Get our next instruction
20760
		inc	esi		; Increment PC
20761
		jmp	dword [z80regular+edx*4]
20762
 
20763
 
20764
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20765
 
20766
RegInstd8:
20767
		sahf
20768
		jc	takeReturn368
20769
		jmp	short retNotTaken368
20770
takeReturn368:
20771
		sub	edi, byte 6
20772
		mov	dx, word [_z80sp]	; Get our current stack pointer
20773
		mov	si, [edx+ebp]	; Get our return address
20774
		and	esi, 0ffffh		; Only within 64K!
20775
		add	esi, ebp			; Add in our base address
20776
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20777
		xor	edx, edx
20778
retNotTaken368:
20779
		sub	edi, byte 5
20780
		js	near noMoreExec
20781
		mov	dl, byte [esi]	; Get our next instruction
20782
		inc	esi		; Increment PC
20783
		jmp	dword [z80regular+edx*4]
20784
 
20785
 
20786
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20787
 
20788
RegInstd9:
20789
		mov	[cyclesRemaining], edi
20790
		mov	di, [_z80de]
20791
		xchg	cx, [_z80bcprime]
20792
		xchg	di, [_z80deprime]
20793
		xchg	bx, [_z80hlprime]
20794
		mov	[_z80de], di
20795
		mov	edi, [cyclesRemaining]
20796
		sub	edi, byte 4
20797
		js	near noMoreExec
20798
		mov	dl, byte [esi]	; Get our next instruction
20799
		inc	esi		; Increment PC
20800
		jmp	dword [z80regular+edx*4]
20801
 
20802
 
20803
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20804
 
20805
RegInstda:
20806
		sahf		; Restore our flags
20807
		jc	takeJump369	; We're going to take a jump
20808
		add	esi, 2		; Skip past the address
20809
		jmp	short nextInst369	 ; Go execute the next instruction
20810
takeJump369:
20811
		mov	si, [esi]	; Get our new offset
20812
		and	esi, 0ffffh	; Only the lower WORD is valid
20813
		add	esi, ebp		; Our new address!
20814
nextInst369:
20815
		sub	edi, byte 10
20816
		js	near noMoreExec
20817
		mov	dl, byte [esi]	; Get our next instruction
20818
		inc	esi		; Increment PC
20819
		jmp	dword [z80regular+edx*4]
20820
 
20821
 
20822
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20823
 
20824
RegInstdb:
20825
		mov	dl, [esi]	; Get our address to 'out' to
20826
		inc	esi	; Next address
20827
		mov	[cyclesRemaining], edi
20828
		mov	edi, [_z80IoRead]	; Point to the read array
20829
 
20830
checkLoop370:
20831
		cmp	[edi], word 0ffffh ; End of the list?
20832
		je		ioRead370
20833
		cmp	dx, [edi]	; Are we smaller?
20834
		jb		nextAddr370		; Yes, go to the next address
20835
		cmp	dx, [edi+2]	; Are we bigger?
20836
		jbe	callRoutine370
20837
 
20838
nextAddr370:
20839
		add	edi, 0ch		; Next structure!
20840
		jmp	short checkLoop370
20841
 
20842
callRoutine370:
20843
		call	ReadIOByte	; Standard read routine
20844
		mov	[_z80af], al	; Save our new accumulator
20845
		mov	ax, [_z80af]	; Get our AF back
20846
		jmp	short readExit370
20847
 
20848
ioRead370:
20849
		mov	al, 0ffh	; An unreferenced read
20850
readExit370:
20851
		mov	edi, [cyclesRemaining]
20852
		xor	edx, edx
20853
		sub	edi, byte 11
20854
		js	near noMoreExec
20855
		mov	dl, byte [esi]	; Get our next instruction
20856
		inc	esi		; Increment PC
20857
		jmp	dword [z80regular+edx*4]
20858
 
20859
 
20860
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20861
 
20862
RegInstdc:
20863
		sahf		; Restore our flags
20864
		jc	takeJump371	; We're going call in this case
20865
		add	esi, 2		; Skip past the address
20866
		jmp	short noCallTaken371	 ; Go execute the next instruction
20867
takeJump371:
20868
		sub	edi, 7
20869
		mov	dx, [esi]	; Get our call to address
20870
		mov	[_z80pc], dx ; Store our new program counter
20871
		add	esi, 2		; Skip to our new address to be pushed
20872
		sub	esi, ebp		; Value to push onto the "stack"
20873
		mov	dx, word [_z80sp] ; Get the current stack pointer
20874
		sub	dx, 2		; Back up two bytes
20875
		mov	[ebp+edx], si ; PUSH It!
20876
		mov	word [_z80sp], dx	; Store our new stack pointer
20877
		mov	si, [_z80pc] ; Get our new program counter
20878
		add	esi, ebp		; Naturalize it!
20879
noCallTaken371:
20880
		xor	edx, edx
20881
		sub	edi, byte 10
20882
		js	near noMoreExec
20883
		mov	dl, byte [esi]	; Get our next instruction
20884
		inc	esi		; Increment PC
20885
		jmp	dword [z80regular+edx*4]
20886
 
20887
;
20888
; Handler for all DDxx instructions
20889
;
20890
 
20891
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20892
 
20893
RegInstdd:
20894
		mov	dl, [esi]
20895
		inc	esi
20896
		jmp	dword [z80PrefixDD+edx*4]
20897
 
20898
 
20899
 
20900
 
20901
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20902
 
20903
RegInstde:
20904
		sahf
20905
		sbb	al, [esi]
20906
		lahf
20907
		seto	dl
20908
		and	ah, 0fbh	; Knock out parity/overflow
20909
		shl	dl, 2
20910
		or		ah, dl
20911
		or	ah, 02h	; Set negative!
20912
		inc	esi
20913
		sub	edi, byte 7
20914
		js	near noMoreExec
20915
		mov	dl, byte [esi]	; Get our next instruction
20916
		inc	esi		; Increment PC
20917
		jmp	dword [z80regular+edx*4]
20918
 
20919
 
20920
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20921
 
20922
RegInstdf:
20923
		mov	dx, word [_z80sp]	; Get our stack pointer
20924
		sub	dx, 2		; Make room for the new value!
20925
		mov	word [_z80sp], dx	; Store our new stack pointer
20926
		sub	esi, ebp		; Get our real PC
20927
		mov	[ebp+edx], si	; Our return address
20928
		mov	si, 018h	; Our new call address
20929
		add	esi, ebp	; Back to the base!
20930
		xor	edx, edx
20931
		sub	edi, byte 11
20932
		js	near noMoreExec
20933
		mov	dl, byte [esi]	; Get our next instruction
20934
		inc	esi		; Increment PC
20935
		jmp	dword [z80regular+edx*4]
20936
 
20937
 
20938
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20939
 
20940
RegInste0:
20941
		sahf
20942
		jpo	takeReturn372
20943
		jmp	short retNotTaken372
20944
takeReturn372:
20945
		sub	edi, byte 6
20946
		mov	dx, word [_z80sp]	; Get our current stack pointer
20947
		mov	si, [edx+ebp]	; Get our return address
20948
		and	esi, 0ffffh		; Only within 64K!
20949
		add	esi, ebp			; Add in our base address
20950
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
20951
		xor	edx, edx
20952
retNotTaken372:
20953
		sub	edi, byte 5
20954
		js	near noMoreExec
20955
		mov	dl, byte [esi]	; Get our next instruction
20956
		inc	esi		; Increment PC
20957
		jmp	dword [z80regular+edx*4]
20958
 
20959
 
20960
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
20961
 
20962
RegInste1:
20963
		mov	dx, [_z80sp]
20964
		mov	[cyclesRemaining], edi
20965
		mov	edi, [_z80MemRead]	; Point to the read array
20966
 
20967
checkLoop373:
20968
		cmp	[edi], word 0ffffh ; End of the list?
20969
		je		memoryRead373
20970
		cmp	dx, [edi]	; Are we smaller?
20971
		jb		nextAddr373		; Yes, go to the next address
20972
		cmp	dx, [edi+4]	; Are we bigger?
20973
		jbe	callRoutine373
20974
 
20975
nextAddr373:
20976
		add	edi, 10h		; Next structure!
20977
		jmp	short checkLoop373
20978
 
20979
callRoutine373:
20980
		push	ax		; Save this for later
20981
		push	dx		; Save address
20982
		call	ReadMemoryByte	; Standard read routine
20983
		pop	dx		; Restore our address
20984
		inc	dx		; Next byte, please
20985
		push	ax		; Save returned byte
20986
		call	ReadMemoryByte	; Standard read routine
20987
		xchg	ah, al	; Swap for endian's sake
20988
		pop	dx	; Restore LSB
20989
		mov	dh, ah	; Our word is now in DX
20990
		pop	ax		; Restore this
20991
		mov	bx, dx	; Store our word
20992
		jmp	readExit373
20993
 
20994
memoryRead373:
20995
		mov	bx, [ebp + edx]
20996
readExit373:
20997
		mov	edi, [cyclesRemaining]
20998
		add	word [_z80sp], 2
20999
		xor	edx, edx
21000
		sub	edi, byte 10
21001
		js	near noMoreExec
21002
		mov	dl, byte [esi]	; Get our next instruction
21003
		inc	esi		; Increment PC
21004
		jmp	dword [z80regular+edx*4]
21005
 
21006
 
21007
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21008
 
21009
RegInste2:
21010
		sahf		; Restore our flags
21011
		jpo	takeJump374	; We're going to take a jump
21012
		add	esi, 2		; Skip past the address
21013
		jmp	short nextInst374	 ; Go execute the next instruction
21014
takeJump374:
21015
		mov	si, [esi]	; Get our new offset
21016
		and	esi, 0ffffh	; Only the lower WORD is valid
21017
		add	esi, ebp		; Our new address!
21018
nextInst374:
21019
		sub	edi, byte 10
21020
		js	near noMoreExec
21021
		mov	dl, byte [esi]	; Get our next instruction
21022
		inc	esi		; Increment PC
21023
		jmp	dword [z80regular+edx*4]
21024
 
21025
 
21026
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21027
 
21028
RegInste3:
21029
		mov	dx, word [_z80sp]
21030
		xchg	bx, [ebp+edx]
21031
		xor	edx, edx
21032
		sub	edi, byte 19
21033
		js	near noMoreExec
21034
		mov	dl, byte [esi]	; Get our next instruction
21035
		inc	esi		; Increment PC
21036
		jmp	dword [z80regular+edx*4]
21037
 
21038
 
21039
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21040
 
21041
RegInste4:
21042
		sahf		; Restore our flags
21043
		jpo	takeJump375	; We're going call in this case
21044
		add	esi, 2		; Skip past the address
21045
		jmp	short noCallTaken375	 ; Go execute the next instruction
21046
takeJump375:
21047
		sub	edi, 7
21048
		mov	dx, [esi]	; Get our call to address
21049
		mov	[_z80pc], dx ; Store our new program counter
21050
		add	esi, 2		; Skip to our new address to be pushed
21051
		sub	esi, ebp		; Value to push onto the "stack"
21052
		mov	dx, word [_z80sp] ; Get the current stack pointer
21053
		sub	dx, 2		; Back up two bytes
21054
		mov	[ebp+edx], si ; PUSH It!
21055
		mov	word [_z80sp], dx	; Store our new stack pointer
21056
		mov	si, [_z80pc] ; Get our new program counter
21057
		add	esi, ebp		; Naturalize it!
21058
noCallTaken375:
21059
		xor	edx, edx
21060
		sub	edi, byte 10
21061
		js	near noMoreExec
21062
		mov	dl, byte [esi]	; Get our next instruction
21063
		inc	esi		; Increment PC
21064
		jmp	dword [z80regular+edx*4]
21065
 
21066
 
21067
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21068
 
21069
RegInste5:
21070
		sub	word [_z80sp], 2
21071
		mov	dx, [_z80sp]
21072
		mov	[cyclesRemaining], edi
21073
		mov	edi, [_z80MemWrite]	; Point to the write array
21074
 
21075
checkLoop376:
21076
		cmp	[edi], word 0ffffh ; End of the list?
21077
		je		memoryWrite376
21078
		cmp	dx, [edi]	; Are we smaller?
21079
		jb		nextAddr376		; Yes, go to the next address
21080
		cmp	dx, [edi+4]	; Are we bigger?
21081
		jbe	callRoutine376
21082
 
21083
nextAddr376:
21084
		add	edi, 10h		; Next structure!
21085
		jmp	short checkLoop376
21086
 
21087
callRoutine376:
21088
		push	ax		; Save this for later
21089
		push	dx
21090
		mov	ax, bx
21091
		call	WriteMemoryByte
21092
		pop	dx
21093
		pop	ax
21094
		inc	dx
21095
 
21096
		push	ax
21097
		push	dx
21098
		mov	ax, bx
21099
		xchg	ah, al
21100
		call	WriteMemoryByte
21101
		pop	dx
21102
		pop	ax	; Restore us!
21103
		jmp	writeExit376
21104
 
21105
memoryWrite376:
21106
		mov	[ebp + edx], bx	; Store our word
21107
writeExit376:
21108
		mov	edi, [cyclesRemaining]
21109
		xor	edx, edx
21110
		sub	edi, byte 11
21111
		js	near noMoreExec
21112
		mov	dl, byte [esi]	; Get our next instruction
21113
		inc	esi		; Increment PC
21114
		jmp	dword [z80regular+edx*4]
21115
 
21116
 
21117
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21118
 
21119
RegInste6:
21120
		sahf
21121
		and	al, [esi]
21122
		lahf
21123
		and	ah, 0ech ; Only parity, half carry, sign, zero
21124
		or	ah, 10h	; Half carry
21125
		inc	esi
21126
		sub	edi, byte 7
21127
		js	near noMoreExec
21128
		mov	dl, byte [esi]	; Get our next instruction
21129
		inc	esi		; Increment PC
21130
		jmp	dword [z80regular+edx*4]
21131
 
21132
 
21133
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21134
 
21135
RegInste7:
21136
		mov	dx, word [_z80sp]	; Get our stack pointer
21137
		sub	dx, 2		; Make room for the new value!
21138
		mov	word [_z80sp], dx	; Store our new stack pointer
21139
		sub	esi, ebp		; Get our real PC
21140
		mov	[ebp+edx], si	; Our return address
21141
		mov	si, 020h	; Our new call address
21142
		add	esi, ebp	; Back to the base!
21143
		xor	edx, edx
21144
		sub	edi, byte 11
21145
		js	near noMoreExec
21146
		mov	dl, byte [esi]	; Get our next instruction
21147
		inc	esi		; Increment PC
21148
		jmp	dword [z80regular+edx*4]
21149
 
21150
 
21151
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21152
 
21153
RegInste8:
21154
		sahf
21155
		jpe	takeReturn377
21156
		jmp	short retNotTaken377
21157
takeReturn377:
21158
		sub	edi, byte 6
21159
		mov	dx, word [_z80sp]	; Get our current stack pointer
21160
		mov	si, [edx+ebp]	; Get our return address
21161
		and	esi, 0ffffh		; Only within 64K!
21162
		add	esi, ebp			; Add in our base address
21163
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
21164
		xor	edx, edx
21165
retNotTaken377:
21166
		sub	edi, byte 5
21167
		js	near noMoreExec
21168
		mov	dl, byte [esi]	; Get our next instruction
21169
		inc	esi		; Increment PC
21170
		jmp	dword [z80regular+edx*4]
21171
 
21172
 
21173
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21174
 
21175
RegInste9:
21176
		mov	si, bx
21177
		and	esi, 0ffffh
21178
		add	esi, ebp
21179
		sub	edi, byte 4
21180
		js	near noMoreExec
21181
		mov	dl, byte [esi]	; Get our next instruction
21182
		inc	esi		; Increment PC
21183
		jmp	dword [z80regular+edx*4]
21184
 
21185
 
21186
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21187
 
21188
RegInstea:
21189
		sahf		; Restore our flags
21190
		jpe	takeJump378	; We're going to take a jump
21191
		add	esi, 2		; Skip past the address
21192
		jmp	short nextInst378	 ; Go execute the next instruction
21193
takeJump378:
21194
		mov	si, [esi]	; Get our new offset
21195
		and	esi, 0ffffh	; Only the lower WORD is valid
21196
		add	esi, ebp		; Our new address!
21197
nextInst378:
21198
		sub	edi, byte 10
21199
		js	near noMoreExec
21200
		mov	dl, byte [esi]	; Get our next instruction
21201
		inc	esi		; Increment PC
21202
		jmp	dword [z80regular+edx*4]
21203
 
21204
 
21205
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21206
 
21207
RegInsteb:
21208
		xchg	[_z80de], bx	; Exchange DE & HL
21209
		sub	edi, byte 4
21210
		js	near noMoreExec
21211
		mov	dl, byte [esi]	; Get our next instruction
21212
		inc	esi		; Increment PC
21213
		jmp	dword [z80regular+edx*4]
21214
 
21215
 
21216
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21217
 
21218
RegInstec:
21219
		sahf		; Restore our flags
21220
		jpe	takeJump379	; We're going call in this case
21221
		add	esi, 2		; Skip past the address
21222
		jmp	short noCallTaken379	 ; Go execute the next instruction
21223
takeJump379:
21224
		sub	edi, 7
21225
		mov	dx, [esi]	; Get our call to address
21226
		mov	[_z80pc], dx ; Store our new program counter
21227
		add	esi, 2		; Skip to our new address to be pushed
21228
		sub	esi, ebp		; Value to push onto the "stack"
21229
		mov	dx, word [_z80sp] ; Get the current stack pointer
21230
		sub	dx, 2		; Back up two bytes
21231
		mov	[ebp+edx], si ; PUSH It!
21232
		mov	word [_z80sp], dx	; Store our new stack pointer
21233
		mov	si, [_z80pc] ; Get our new program counter
21234
		add	esi, ebp		; Naturalize it!
21235
noCallTaken379:
21236
		xor	edx, edx
21237
		sub	edi, byte 10
21238
		js	near noMoreExec
21239
		mov	dl, byte [esi]	; Get our next instruction
21240
		inc	esi		; Increment PC
21241
		jmp	dword [z80regular+edx*4]
21242
 
21243
;
21244
; Handler for all EDxx instructions
21245
;
21246
 
21247
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21248
 
21249
RegInsted:
21250
		mov	dl, [esi]
21251
		inc	esi
21252
		jmp	dword [z80PrefixED+edx*4]
21253
 
21254
 
21255
 
21256
 
21257
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21258
 
21259
RegInstee:
21260
		sahf
21261
		xor	al, [esi]
21262
		lahf
21263
		and	ah, 0ech	; No H, N, or C
21264
		inc	esi
21265
		sub	edi, byte 7
21266
		js	near noMoreExec
21267
		mov	dl, byte [esi]	; Get our next instruction
21268
		inc	esi		; Increment PC
21269
		jmp	dword [z80regular+edx*4]
21270
 
21271
 
21272
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21273
 
21274
RegInstef:
21275
		mov	dx, word [_z80sp]	; Get our stack pointer
21276
		sub	dx, 2		; Make room for the new value!
21277
		mov	word [_z80sp], dx	; Store our new stack pointer
21278
		sub	esi, ebp		; Get our real PC
21279
		mov	[ebp+edx], si	; Our return address
21280
		mov	si, 028h	; Our new call address
21281
		add	esi, ebp	; Back to the base!
21282
		xor	edx, edx
21283
		sub	edi, byte 11
21284
		js	near noMoreExec
21285
		mov	dl, byte [esi]	; Get our next instruction
21286
		inc	esi		; Increment PC
21287
		jmp	dword [z80regular+edx*4]
21288
 
21289
 
21290
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21291
 
21292
RegInstf0:
21293
		sahf
21294
		jns	takeReturn380
21295
		jmp	short retNotTaken380
21296
takeReturn380:
21297
		sub	edi, byte 6
21298
		mov	dx, word [_z80sp]	; Get our current stack pointer
21299
		mov	si, [edx+ebp]	; Get our return address
21300
		and	esi, 0ffffh		; Only within 64K!
21301
		add	esi, ebp			; Add in our base address
21302
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
21303
		xor	edx, edx
21304
retNotTaken380:
21305
		sub	edi, byte 5
21306
		js	near noMoreExec
21307
		mov	dl, byte [esi]	; Get our next instruction
21308
		inc	esi		; Increment PC
21309
		jmp	dword [z80regular+edx*4]
21310
 
21311
 
21312
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21313
 
21314
RegInstf1:
21315
		mov	dx, [_z80sp]
21316
		mov	[cyclesRemaining], edi
21317
		mov	edi, [_z80MemRead]	; Point to the read array
21318
 
21319
checkLoop381:
21320
		cmp	[edi], word 0ffffh ; End of the list?
21321
		je		memoryRead381
21322
		cmp	dx, [edi]	; Are we smaller?
21323
		jb		nextAddr381		; Yes, go to the next address
21324
		cmp	dx, [edi+4]	; Are we bigger?
21325
		jbe	callRoutine381
21326
 
21327
nextAddr381:
21328
		add	edi, 10h		; Next structure!
21329
		jmp	short checkLoop381
21330
 
21331
callRoutine381:
21332
		push	dx		; Save address
21333
		call	ReadMemoryByte	; Standard read routine
21334
		pop	dx		; Restore our address
21335
		inc	dx		; Next byte, please
21336
		push	ax		; Save returned byte
21337
		call	ReadMemoryByte	; Standard read routine
21338
		xchg	ah, al	; Swap for endian's sake
21339
		pop	dx	; Restore LSB
21340
		mov	dh, ah	; Our word is now in DX
21341
		mov	ax, dx
21342
		xchg	ah, al
21343
		jmp	readExit381
21344
 
21345
memoryRead381:
21346
		mov	ax, [ebp + edx]
21347
		xchg	ah, al
21348
readExit381:
21349
		mov	edi, [cyclesRemaining]
21350
		add	word [_z80sp], 2
21351
		xor	edx, edx
21352
		sub	edi, byte 10
21353
		js	near noMoreExec
21354
		mov	dl, byte [esi]	; Get our next instruction
21355
		inc	esi		; Increment PC
21356
		jmp	dword [z80regular+edx*4]
21357
 
21358
 
21359
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21360
 
21361
RegInstf2:
21362
		sahf		; Restore our flags
21363
		jns	takeJump382	; We're going to take a jump
21364
		add	esi, 2		; Skip past the address
21365
		jmp	short nextInst382	 ; Go execute the next instruction
21366
takeJump382:
21367
		mov	si, [esi]	; Get our new offset
21368
		and	esi, 0ffffh	; Only the lower WORD is valid
21369
		add	esi, ebp		; Our new address!
21370
nextInst382:
21371
		sub	edi, byte 10
21372
		js	near noMoreExec
21373
		mov	dl, byte [esi]	; Get our next instruction
21374
		inc	esi		; Increment PC
21375
		jmp	dword [z80regular+edx*4]
21376
 
21377
 
21378
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21379
 
21380
RegInstf3:
21381
		and	dword [_z80iff], (~IFF1)	; Not in an interrupt
21382
		sub	edi, byte 4
21383
		js	near noMoreExec
21384
		mov	dl, byte [esi]	; Get our next instruction
21385
		inc	esi		; Increment PC
21386
		jmp	dword [z80regular+edx*4]
21387
 
21388
 
21389
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21390
 
21391
RegInstf4:
21392
		sahf		; Restore our flags
21393
		jns	takeJump383	; We're going call in this case
21394
		add	esi, 2		; Skip past the address
21395
		jmp	short noCallTaken383	 ; Go execute the next instruction
21396
takeJump383:
21397
		sub	edi, 7
21398
		mov	dx, [esi]	; Get our call to address
21399
		mov	[_z80pc], dx ; Store our new program counter
21400
		add	esi, 2		; Skip to our new address to be pushed
21401
		sub	esi, ebp		; Value to push onto the "stack"
21402
		mov	dx, word [_z80sp] ; Get the current stack pointer
21403
		sub	dx, 2		; Back up two bytes
21404
		mov	[ebp+edx], si ; PUSH It!
21405
		mov	word [_z80sp], dx	; Store our new stack pointer
21406
		mov	si, [_z80pc] ; Get our new program counter
21407
		add	esi, ebp		; Naturalize it!
21408
noCallTaken383:
21409
		xor	edx, edx
21410
		sub	edi, byte 10
21411
		js	near noMoreExec
21412
		mov	dl, byte [esi]	; Get our next instruction
21413
		inc	esi		; Increment PC
21414
		jmp	dword [z80regular+edx*4]
21415
 
21416
 
21417
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21418
 
21419
RegInstf5:
21420
		sub	word [_z80sp], 2
21421
		mov	dx, [_z80sp]
21422
		mov	[cyclesRemaining], edi
21423
		mov	edi, [_z80MemWrite]	; Point to the write array
21424
 
21425
checkLoop384:
21426
		cmp	[edi], word 0ffffh ; End of the list?
21427
		je		memoryWrite384
21428
		cmp	dx, [edi]	; Are we smaller?
21429
		jb		nextAddr384		; Yes, go to the next address
21430
		cmp	dx, [edi+4]	; Are we bigger?
21431
		jbe	callRoutine384
21432
 
21433
nextAddr384:
21434
		add	edi, 10h		; Next structure!
21435
		jmp	short checkLoop384
21436
 
21437
callRoutine384:
21438
		push	ax		; Save this for later
21439
		push	dx
21440
		xchg	ah, al
21441
		call	WriteMemoryByte
21442
		pop	dx
21443
		pop	ax
21444
		inc	dx
21445
 
21446
		push	ax
21447
		push	dx
21448
		call	WriteMemoryByte
21449
		pop	dx
21450
		pop	ax	; Restore us!
21451
		jmp	writeExit384
21452
 
21453
memoryWrite384:
21454
		xchg	ah, al	; Swap for later
21455
		mov	[ebp + edx], ax	; Store our word
21456
		xchg	ah, al	; Restore
21457
writeExit384:
21458
		mov	edi, [cyclesRemaining]
21459
		xor	edx, edx
21460
		sub	edi, byte 11
21461
		js	near noMoreExec
21462
		mov	dl, byte [esi]	; Get our next instruction
21463
		inc	esi		; Increment PC
21464
		jmp	dword [z80regular+edx*4]
21465
 
21466
 
21467
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21468
 
21469
RegInstf6:
21470
		sahf
21471
		or	al, [esi]
21472
		lahf
21473
		and	ah, 0ech	; No H, N, or C
21474
		inc	esi
21475
		sub	edi, byte 7
21476
		js	near noMoreExec
21477
		mov	dl, byte [esi]	; Get our next instruction
21478
		inc	esi		; Increment PC
21479
		jmp	dword [z80regular+edx*4]
21480
 
21481
 
21482
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21483
 
21484
RegInstf7:
21485
		mov	dx, word [_z80sp]	; Get our stack pointer
21486
		sub	dx, 2		; Make room for the new value!
21487
		mov	word [_z80sp], dx	; Store our new stack pointer
21488
		sub	esi, ebp		; Get our real PC
21489
		mov	[ebp+edx], si	; Our return address
21490
		mov	si, 030h	; Our new call address
21491
		add	esi, ebp	; Back to the base!
21492
		xor	edx, edx
21493
		sub	edi, byte 11
21494
		js	near noMoreExec
21495
		mov	dl, byte [esi]	; Get our next instruction
21496
		inc	esi		; Increment PC
21497
		jmp	dword [z80regular+edx*4]
21498
 
21499
 
21500
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21501
 
21502
RegInstf8:
21503
		sahf
21504
		js	takeReturn385
21505
		jmp	short retNotTaken385
21506
takeReturn385:
21507
		sub	edi, byte 6
21508
		mov	dx, word [_z80sp]	; Get our current stack pointer
21509
		mov	si, [edx+ebp]	; Get our return address
21510
		and	esi, 0ffffh		; Only within 64K!
21511
		add	esi, ebp			; Add in our base address
21512
		add	word [_z80sp], 02h	; Remove our two bytes from the stack
21513
		xor	edx, edx
21514
retNotTaken385:
21515
		sub	edi, byte 5
21516
		js	near noMoreExec
21517
		mov	dl, byte [esi]	; Get our next instruction
21518
		inc	esi		; Increment PC
21519
		jmp	dword [z80regular+edx*4]
21520
 
21521
 
21522
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21523
 
21524
RegInstf9:
21525
		mov	word [_z80sp], bx
21526
		sub	edi, byte 6
21527
		js	near noMoreExec
21528
		mov	dl, byte [esi]	; Get our next instruction
21529
		inc	esi		; Increment PC
21530
		jmp	dword [z80regular+edx*4]
21531
 
21532
 
21533
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21534
 
21535
RegInstfa:
21536
		sahf		; Restore our flags
21537
		js	takeJump386	; We're going to take a jump
21538
		add	esi, 2		; Skip past the address
21539
		jmp	short nextInst386	 ; Go execute the next instruction
21540
takeJump386:
21541
		mov	si, [esi]	; Get our new offset
21542
		and	esi, 0ffffh	; Only the lower WORD is valid
21543
		add	esi, ebp		; Our new address!
21544
nextInst386:
21545
		sub	edi, byte 10
21546
		js	near noMoreExec
21547
		mov	dl, byte [esi]	; Get our next instruction
21548
		inc	esi		; Increment PC
21549
		jmp	dword [z80regular+edx*4]
21550
 
21551
 
21552
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21553
 
21554
RegInstfb:
21555
		or		dword [_z80iff], IFF1	; Indicate interrupts are enabled now
21556
		sub	edi, 4	; Takes 4 cycles!
21557
		mov	[dwEITiming], edi	; Snapshot our current timing
21558
		mov	[bEIExit], byte 1	; Indicate we're exiting because of an EI
21559
		xor	edi, edi	; Force next instruction to exit
21560
		mov	dl, byte [esi]	; Get our next instruction
21561
		inc	esi	; Next PC
21562
		jmp	dword [z80regular+edx*4]
21563
 
21564
		sub	edi, byte 4
21565
		js	near noMoreExec
21566
		mov	dl, byte [esi]	; Get our next instruction
21567
		inc	esi		; Increment PC
21568
		jmp	dword [z80regular+edx*4]
21569
 
21570
 
21571
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21572
 
21573
RegInstfc:
21574
		sahf		; Restore our flags
21575
		js	takeJump387	; We're going call in this case
21576
		add	esi, 2		; Skip past the address
21577
		jmp	short noCallTaken387	 ; Go execute the next instruction
21578
takeJump387:
21579
		sub	edi, 7
21580
		mov	dx, [esi]	; Get our call to address
21581
		mov	[_z80pc], dx ; Store our new program counter
21582
		add	esi, 2		; Skip to our new address to be pushed
21583
		sub	esi, ebp		; Value to push onto the "stack"
21584
		mov	dx, word [_z80sp] ; Get the current stack pointer
21585
		sub	dx, 2		; Back up two bytes
21586
		mov	[ebp+edx], si ; PUSH It!
21587
		mov	word [_z80sp], dx	; Store our new stack pointer
21588
		mov	si, [_z80pc] ; Get our new program counter
21589
		add	esi, ebp		; Naturalize it!
21590
noCallTaken387:
21591
		xor	edx, edx
21592
		sub	edi, byte 10
21593
		js	near noMoreExec
21594
		mov	dl, byte [esi]	; Get our next instruction
21595
		inc	esi		; Increment PC
21596
		jmp	dword [z80regular+edx*4]
21597
 
21598
;
21599
; Handler for all FDxx instructions
21600
;
21601
 
21602
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21603
 
21604
RegInstfd:
21605
		mov	dl, [esi]
21606
		inc	esi
21607
		jmp	dword [z80PrefixFD+edx*4]
21608
 
21609
 
21610
 
21611
 
21612
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21613
 
21614
RegInstfe:
21615
		sahf
21616
		cmp	al, [esi]
21617
		lahf
21618
		seto	dl
21619
		and	ah, 0fbh	; Knock out parity/overflow
21620
		shl	dl, 2
21621
		or		ah, dl
21622
		or	ah, 02h	; Set negative!
21623
		inc	esi
21624
		sub	edi, byte 7
21625
		js	near noMoreExec
21626
		mov	dl, byte [esi]	; Get our next instruction
21627
		inc	esi		; Increment PC
21628
		jmp	dword [z80regular+edx*4]
21629
 
21630
 
21631
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21632
 
21633
RegInstff:
21634
		mov	dx, word [_z80sp]	; Get our stack pointer
21635
		sub	dx, 2		; Make room for the new value!
21636
		mov	word [_z80sp], dx	; Store our new stack pointer
21637
		sub	esi, ebp		; Get our real PC
21638
		mov	[ebp+edx], si	; Our return address
21639
		mov	si, 038h	; Our new call address
21640
		add	esi, ebp	; Back to the base!
21641
		xor	edx, edx
21642
		sub	edi, byte 11
21643
		js	near noMoreExec
21644
		mov	dl, byte [esi]	; Get our next instruction
21645
		inc	esi		; Increment PC
21646
		jmp	dword [z80regular+edx*4]
21647
 
21648
 
21649
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21650
 
21651
; This is a generic read memory byte handler when a foreign
21652
; handler is to be called
21653
 
21654
; EDI=Handler address, EDX=Address
21655
; On return, EDX & EDI are undisturbed and AL=Byte read
21656
 
21657
ReadMemoryByte:
21658
		mov	[_z80af], ax	; Save AF
21659
		cmp	[edi+8], dword 0 ; Null handler?
21660
		je	directReadHandler	; Yep! It's a direct read!
21661
 
21662
		mov	[_z80hl], bx	; Save HL
21663
		mov	[_z80bc], cx	; Save BC
21664
		sub	esi, ebp	; Our program counter
21665
		mov	[_z80pc], si	; Save our program counter
21666
		mov	esi, [dwOriginalExec]
21667
		sub	esi, [cyclesRemaining]
21668
		add	[dwElapsedTicks], esi
21669
		add	[_z80rCounter], esi
21670
		sub	[dwOriginalExec], esi
21671
		push	edi	; Save our structure address
21672
		push	edx	; And our desired address
21673
		call	dword [edi + 8]	; Go call our handler
21674
		pop	edx	; Restore our address
21675
		pop	edi	; Restore our handler's address
21676
		xor	ebx, ebx	; Zero our future HL
21677
		xor	esi, esi	; Zero it!
21678
		mov	ebp, [_z80Base] ; Base pointer comes back
21679
		mov	si, [_z80pc]	; Get our program counter back
21680
		xor	ecx, ecx	; Zero our future BC
21681
		add	esi, ebp	; Rebase it properly
21682
		mov	bx, [_z80hl]	; Get HL back
21683
		mov	cx, [_z80bc]	; Get BC back
21684
		ret
21685
 
21686
directReadHandler:
21687
		mov	eax, [edi+12]	; Get our base address
21688
		sub	edx, [edi]	; Subtract our base (low) address
21689
		mov	al, [edx+eax]	; Get our data byte
21690
		and	eax, 0ffh	; Only the lower byte matters!
21691
		add	edx, [edi]	; Add our base back
21692
		ret		; Return to caller!
21693
 
21694
 
21695
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21696
 
21697
; This is a generic read memory byte handler when a foreign
21698
; handler is to be called.
21699
; EDI=Handler address, AL=Byte to write, EDX=Address
21700
; EDI and EDX Are undisturbed on exit
21701
 
21702
WriteMemoryByte:
21703
		cmp	[edi+8], dword 0	; Null handler?
21704
		je	directWriteHandler
21705
 
21706
		mov	[_z80hl], bx	; Save HL
21707
		mov	[_z80bc], cx	; Save BX
21708
		sub	esi, ebp	; Our program counter
21709
		mov	[_z80pc], si	; Save our program counter
21710
		mov	esi, [dwOriginalExec]
21711
		sub	esi, [cyclesRemaining]
21712
		add	[dwElapsedTicks], esi
21713
		add	[_z80rCounter], esi
21714
		sub	[dwOriginalExec], esi
21715
		push	edi	; Save our structure address
21716
		push	eax	; Data to write
21717
		push	edx	; And our desired address
21718
		call	dword [edi + 8]	; Go call our handler
21719
		pop	edx	; Restore our address
21720
		pop	eax	; Restore our data written
21721
		pop	edi	; Save our structure address
21722
		xor	ebx, ebx	; Zero our future HL
21723
		xor	ecx, ecx	; Zero our future BC
21724
		mov	bx, [_z80hl]	; Get HL back
21725
		mov	cx, [_z80bc]	; Get BC back
21726
		mov	ax, [_z80af]	; Get AF back
21727
		xor	esi, esi	; Zero it!
21728
		mov	si, [_z80pc]	; Get our program counter back
21729
		mov	ebp, [_z80Base] ; Base pointer comes back
21730
		add	esi, ebp	; Rebase it properly
21731
		ret
21732
 
21733
directWriteHandler:
21734
		sub	edx, [edi]	; Subtract our offset
21735
		add	edx, [edi+12]	; Add in the base address
21736
		mov	[edx], al	; Store our byte
21737
		sub	edx, [edi+12]	; Restore our base address
21738
		add	edx, [edi]	; And put our offset back
21739
		ret
21740
 
21741
 
21742
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21743
 
21744
; This is a generic I/O read byte handler for when a foreign
21745
; handler is to be called
21746
; EDI=Handler address, EDX=I/O Address
21747
; On return, EDX & EDI are undisturbed and AL=Byte read
21748
 
21749
ReadIOByte:
21750
		mov	[_z80af], ax	; Save AF
21751
		mov	[_z80hl], bx	; Save HL
21752
		mov	[_z80bc], cx	; Save BC
21753
		sub	esi, ebp	; Our program counter
21754
		mov	[_z80pc], si	; Save our program counter
21755
		mov	esi, [dwOriginalExec]
21756
		sub	esi, [cyclesRemaining]
21757
		add	[dwElapsedTicks], esi
21758
		add	[_z80rCounter], esi
21759
		sub	[dwOriginalExec], esi
21760
		push	edi	; Save our structure address
21761
		push	edx	; And our desired I/O port
21762
		call	dword [edi + 4]	; Go call our handler
21763
		pop	edx	; Restore our address
21764
		pop	edi	; Restore our handler's address
21765
		xor	ebx, ebx	; Zero our future HL
21766
		xor	ecx, ecx	; Zero our future BC
21767
		xor	esi, esi	; Zero it!
21768
		mov	si, [_z80pc]	; Get our program counter back
21769
		mov	ebp, [_z80Base] ; Base pointer comes back
21770
		add	esi, ebp	; Rebase it properly
21771
		mov	bx, [_z80hl]	; Get HL back
21772
		mov	cx, [_z80bc]	; Get BC back
21773
		ret
21774
 
21775
 
21776
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21777
 
21778
; This is a generic write I/O byte handler when a foreign handler is to
21779
; be called
21780
; EDI=Handler address, AL=Byte to write, EDX=I/O Address
21781
; EDI and EDX Are undisturbed on exit
21782
 
21783
WriteIOByte:
21784
		mov	[_z80hl], bx	; Save HL
21785
		mov	[_z80bc], cx	; Save BX
21786
		sub	esi, ebp	; Our program counter
21787
		mov	[_z80pc], si	; Save our program counter
21788
		mov	esi, [dwOriginalExec]
21789
		sub	esi, [cyclesRemaining]
21790
		add	[dwElapsedTicks], esi
21791
		add	[_z80rCounter], esi
21792
		sub	[dwOriginalExec], esi
21793
		push	edi	; Save our structure address
21794
		push	eax	; Data to write
21795
		push	edx	; And our desired I/O address
21796
		call	dword [edi + 4]	; Go call our handler
21797
		pop	edx	; Restore our address
21798
		pop	eax	; Restore our data written
21799
		pop	edi	; Save our structure address
21800
		xor	ebx, ebx	; Zero our future HL
21801
		xor	ecx, ecx	; Zero our future BC
21802
		mov	bx, [_z80hl]	; Get HL back
21803
		mov	cx, [_z80bc]	; Get BC back
21804
		mov	ax, [_z80af]	; Get AF back
21805
		xor	esi, esi	; Zero it!
21806
		mov	si, [_z80pc]	; Get our program counter back
21807
		mov	ebp, [_z80Base] ; Base pointer comes back
21808
		add	esi, ebp	; Rebase it properly
21809
		ret
21810
 
21811
		global	_mz80GetContext
21812
		global	mz80GetContext_
21813
		global	mz80GetContext
21814
 
21815
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21816
 
21817
mz80GetContext_:
21818
_mz80GetContext:
21819
mz80GetContext:
21820
		mov	eax, [esp+4]	; Get our context address
21821
		push	esi		; Save registers we use
21822
		push	edi
21823
		push	ecx
21824
		push	es
21825
		mov	di, ds
21826
		mov	es, di
21827
		mov	esi, _mz80contextBegin
21828
		mov	edi, eax	; Source address in ESI
21829
		mov     ecx, (_mz80contextEnd - _mz80contextBegin) >> 2
21830
		rep	movsd
21831
		mov     ecx, (_mz80contextEnd - _mz80contextBegin) & 0x03
21832
		rep	movsb
21833
		pop	es
21834
		pop	ecx
21835
		pop	edi
21836
		pop	esi
21837
		ret			; No return code
21838
		global	_mz80SetContext
21839
		global	mz80SetContext_
21840
		global	mz80SetContext
21841
 
21842
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21843
 
21844
mz80SetContext_:
21845
_mz80SetContext:
21846
mz80SetContext:
21847
		mov	eax, [esp+4]	; Get our context address
21848
		push	esi		; Save registers we use
21849
		push	edi
21850
		push	ecx
21851
		push	es
21852
		mov	di, ds
21853
		mov	es, di
21854
		mov	edi, _mz80contextBegin
21855
		mov	esi, eax	; Source address in ESI
21856
		mov     ecx, (_mz80contextEnd - _mz80contextBegin) >> 2
21857
		rep	movsd
21858
		mov     ecx, (_mz80contextEnd - _mz80contextBegin) & 0x03
21859
		rep	movsb
21860
		pop	es
21861
		pop	ecx
21862
		pop	edi
21863
		pop	esi
21864
		ret			; No return code
21865
		global	_mz80GetContextSize
21866
		global	mz80GetContextSize_
21867
		global	mz80GetContextSize
21868
 
21869
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21870
 
21871
mz80GetContextSize_:
21872
_mz80GetContextSize:
21873
mz80GetContextSize:
21874
		mov     eax, _mz80contextEnd - _mz80contextBegin
21875
		ret
21876
 
21877
		global	_mz80GetElapsedTicks
21878
		global	mz80GetElapsedTicks_
21879
		global	mz80GetElapsedTicks
21880
 
21881
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21882
 
21883
 
21884
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21885
 
21886
mz80GetElapsedTicks_:
21887
_mz80GetElapsedTicks:
21888
mz80GetElapsedTicks:
21889
		mov	eax, [esp+4]	; Get our context address
21890
		or	eax, eax	; Should we clear it?
21891
		jz	getTicks
21892
		xor	eax, eax
21893
		xchg	eax, [dwElapsedTicks]
21894
		ret
21895
getTicks:
21896
		mov	eax, [dwElapsedTicks]
21897
		ret
21898
		global	_mz80ReleaseTimeslice
21899
		global	mz80ReleaseTimeslice_
21900
		global	mz80ReleaseTimeslice
21901
 
21902
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21903
 
21904
 
21905
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21906
 
21907
mz80ReleaseTimeslice_:
21908
_mz80ReleaseTimeslice:
21909
mz80ReleaseTimeslice:
21910
		mov	eax, [cyclesRemaining]
21911
		sub	[dwOriginalExec], eax
21912
		mov	[cyclesRemaining], dword 0
21913
		ret
21914
 
21915
		global	_mz80reset
21916
		global	mz80reset_
21917
		global	mz80reset
21918
 
21919
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21920
 
21921
mz80reset_:
21922
_mz80reset:
21923
mz80reset:
21924
		xor	eax, eax 	; Zero AX
21925
 
21926
		mov	dword [_z80halted], eax	; We're not halted anymore!
21927
		mov	word [_z80af], 0040h	; Zero A & flags - zero flag set
21928
		mov	word [_z80bc], ax	; Zero BC
21929
		mov	word [_z80de],	ax	; Zero DE
21930
		mov	word [_z80hl], ax	; Zero HL
21931
		mov	word [_z80afprime], ax	; Zero AF Prime
21932
		mov	word [_z80bcprime], ax	; Zero BC prime
21933
		mov	word [_z80deprime], ax ; Zero DE prime
21934
		mov	word [_z80hlprime], ax ; Zero HL prime
21935
		mov	byte [_z80i], al	; Zero Interrupt register
21936
		mov	byte [_z80r], al	; Zero refresh register
21937
		mov	word [_z80ix], 0ffffh	; Default mz80Index register
21938
		mov	word [_z80iy], 0ffffh	; Default mz80Index register
21939
		mov	word [_z80pc], ax	; Zero program counter
21940
		mov	word [_z80sp], ax	; And the stack pointer
21941
		mov	dword [_z80iff], eax ; IFF1/IFF2 disabled!
21942
		mov	dword [_z80interruptMode], eax ; Clear our interrupt mode (0)
21943
		mov	word [_z80intAddr], 38h ; Set default interrupt address
21944
		mov	word [_z80nmiAddr], 66h ; Set default nmi addr
21945
 
21946
		ret
21947
 
21948
		global	_mz80int
21949
		global	mz80int_
21950
		global	mz80int
21951
 
21952
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
21953
 
21954
mz80int_:
21955
_mz80int:
21956
mz80int:
21957
		mov	eax, [esp+4]	; Get our (potential) lower interrupt address
21958
		mov	dword [_z80halted], 0	; We're not halted anymore!
21959
		mov	ah, IFF1	; Is IFF1 enabled?
21960
		and	ah, [_z80iff]	; Well, is it?
21961
		jz		near interruptsDisabled
21962
 
21963
; Interrupts enabled. Clear IFF1 and IFF2
21964
 
21965
		and	dword [_z80iff], ~(IFF1 | IFF2);
21966
 
21967
		mov	[_z80intPending], byte 0
21968
 
21969
		push	ebp
21970
		push	edi
21971
		push	edx
21972
		mov	ebp, [_z80Base]
21973
 
21974
		mov	dx, [_z80pc]
21975
		xor	edi, edi
21976
		mov	di, word [_z80sp]
21977
		sub	di, 2
21978
		mov	word [_z80sp], di
21979
		mov	[ebp+edi], dx
21980
		cmp	dword [_z80interruptMode], 2 ; Are we lower than mode 2?
21981
		jb		justModeTwo
21982
		mov	ah, [_z80i]	; Get our high address here
21983
		and	eax, 0ffffh ; Only the lower part
21984
		mov	ax, [eax+ebp] ; Get our vector
21985
		jmp	short setNewVector ; Go set it!
21986
justModeTwo:
21987
		mov	ax, word [_z80intAddr]
21988
setNewVector:
21989
		mov	[_z80pc], ax
21990
 
21991
		pop	edx
21992
		pop	edi
21993
		pop	ebp
21994
 
21995
		xor	eax, eax	; Zero this so we can use it as an index
21996
		mov	al, [_z80interruptMode]
21997
		mov	al, [intModeTStates+eax]
21998
		add	[dwElapsedTicks], eax
21999
		add	[_z80rCounter], eax
22000
		xor	eax, eax	; Indicate we took the interrupt
22001
		jmp	short z80intExit
22002
 
22003
interruptsDisabled:
22004
		mov	[_z80intPending], byte 1
22005
		mov	[_intData], al	; Save this info for later
22006
		mov	eax, 0ffffffffh		; Indicate we didn't take it
22007
 
22008
z80intExit:
22009
		ret
22010
 
22011
		global	_mz80ClearPendingInterrupt
22012
		global	mz80ClearPendingInterrupt_
22013
		global	mz80ClearPendingInterrupt
22014
 
22015
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22016
 
22017
mz80ClearPendingInterrupt_:
22018
_mz80ClearPendingInterrupt:
22019
mz80ClearPendingInterrupt:
22020
		mov	[_z80intPending], byte 0
22021
		ret
22022
 
22023
		global	_mz80nmi
22024
		global	mz80nmi_
22025
		global	mz80nmi
22026
 
22027
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22028
 
22029
mz80nmi_:
22030
_mz80nmi:
22031
mz80nmi:
22032
		mov	dword [_z80halted], 0	; We're not halted anymore!
22033
		mov	al, [_z80iff]	; Get our IFF setting
22034
		and	al, IFF1	; Just IFF 1
22035
		shl	al, 1	; Makes IFF1->IFF2 and zeros IFF1
22036
		mov	[_z80iff], al	; Store it back to the interrupt state!
22037
 
22038
		push	ebp
22039
		push	edi
22040
		mov	ebp, [_z80Base]
22041
 
22042
		xor	eax, eax
22043
		mov	ax, [_z80pc]
22044
		xor	edi, edi
22045
		mov	di, word [_z80sp]
22046
		sub	di, 2
22047
		mov	word [_z80sp], di
22048
		mov	[ebp+edi], ax
22049
		mov	ax, [_z80nmiAddr]
22050
		mov	[_z80pc], ax
22051
 
22052
		add	[dwElapsedTicks], dword 11	; 11 T-States for NMI
22053
		add	[_z80rCounter], dword 11
22054
		pop	edi
22055
		pop	ebp
22056
 
22057
		xor	eax, eax	; Indicate we took the interrupt
22058
		ret
22059
		global	_mz80exec
22060
		global	mz80exec_
22061
		global	mz80exec
22062
 
22063
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22064
 
22065
mz80exec_:
22066
_mz80exec:
22067
mz80exec:
22068
		mov	eax, [esp+4]	; Get our execution cycle count
22069
		push	ebx			; Save all registers we use
22070
		push	ecx
22071
		push	edx
22072
		push	ebp
22073
		push	esi
22074
		push	edi
22075
 
22076
		mov	edi, eax
22077
		mov	dword [cyclesRemaining], eax	; Store # of instructions to
22078
		mov	[dwLastRSample], eax
22079
		mov	[dwOriginalExec], eax	; Store this!
22080
		cmp	dword [_z80halted], 0
22081
		je	goCpu
22082
		add	[_z80rCounter], eax
22083
		add	dword [dwElapsedTicks], eax
22084
		mov	dword [cyclesRemaining], 0	; Nothing left!
22085
		mov	eax, 80000000h	; Successful exection
22086
		jmp	popReg
22087
goCpu:
22088
		cld				; Go forward!
22089
 
22090
		xor	eax, eax		; Zero EAX 'cause we use it!
22091
		xor	ebx, ebx		; Zero EBX, too
22092
		xor	ecx, ecx		; Zero ECX
22093
		xor	edx, edx		; And EDX
22094
		xor	esi, esi		; Zero our source address
22095
 
22096
		mov	ax, [_z80af]		; Accumulator & flags
22097
		xchg	ah, al		; Swap these for later
22098
		mov	bx, [_z80hl]		; Get our HL value
22099
		mov	cx, [_z80bc]		; And our BC value
22100
		mov	ebp, [_z80Base]		; Get the base address
22101
		mov	si, [_z80pc]		; Get our program counter
22102
		add	esi, ebp		; Add in our base address
22103
		cmp	[_z80intPending], byte 0	; Interrupt pending?
22104
		jz		masterExecTarget
22105
 
22106
		call	causeInternalInterrupt
22107
 
22108
masterExecTarget:
22109
		mov	dl, [esi]
22110
		inc	esi
22111
		jmp	dword [z80regular+edx*4]
22112
 
22113
; We get to invalidInsWord if it's a double byte invalid opcode
22114
 
22115
invalidInsWord:
22116
		dec	esi
22117
 
22118
; We get to invalidInsByte if it's a single byte invalid opcode
22119
 
22120
invalidInsByte:
22121
		xchg	ah, al		; Swap them back so they look good
22122
		mov	[_z80af], ax		; Store A & flags
22123
		dec	esi			; Back up one instruction...
22124
		mov	edx, esi		; Get our address in EAX
22125
		sub	edx, ebp		; And subtract our base for
22126
						; an invalid instruction
22127
		jmp	short emulateEnd
22128
 
22129
noMoreExec:
22130
		cmp	[bEIExit], byte 0	; Are we exiting because of an EI?
22131
		jne	checkEI
22132
noMoreExecNoEI:
22133
		xchg	ah, al		; Swap these for later
22134
		mov	[_z80af], ax		; Store A & flags
22135
		mov	edx, [dwOriginalExec]	; Original exec time
22136
		sub	edx, edi		; Subtract # of cycles remaining
22137
		add	[_z80rCounter], edx
22138
		add	[dwElapsedTicks], edx	; Add our executed time
22139
		mov	edx, 80000000h		; Indicate successful exec
22140
		jmp	short emulateEnd	; All finished!
22141
 
22142
; Now let's tuck away the virtual registers for next time
22143
 
22144
storeFlags:
22145
		xchg	ah, al		; Swap these for later
22146
		mov	[_z80af], ax		; Store A & flags
22147
emulateEnd:
22148
		mov	[_z80hl], bx		; Store HL
22149
		mov	[_z80bc], cx		; Store BC
22150
		sub	esi, [_z80Base]		; Knock off physical address
22151
		mov	[_z80pc], si		; And store virtual address
22152
		mov	eax, edx		; Result code return
22153
 
22154
popReg:
22155
		pop	edi			; Restore registers
22156
		pop	esi
22157
		pop	ebp
22158
		pop	edx
22159
		pop	ecx
22160
		pop	ebx
22161
 
22162
		ret
22163
 
22164
 
22165
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22166
 
22167
checkEI:
22168
		xor	edx, edx
22169
		mov	[bEIExit], byte 0
22170
		sub	edx, edi	; Find out how much time has passed
22171
		mov	edi, [dwEITiming]
22172
		sub	edi, edx
22173
		js		noMoreExecNoEI
22174
		xor	edx, edx
22175
		cmp	[_z80intPending], byte 0
22176
		je	near masterExecTarget
22177
		call	causeInternalInterrupt
22178
		jmp	masterExecTarget
22179
 
22180
 
22181
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22182
 
22183
causeInternalInterrupt:
22184
		mov	dword [_z80halted], 0	; We're not halted anymore!
22185
		test	[_z80iff], byte IFF1	; Interrupt enabled yet?
22186
		jz		near internalInterruptsDisabled
22187
 
22188
; Interrupts enabled. Clear IFF1 and IFF2
22189
 
22190
		mov	[_z80intPending], byte 0
22191
 
22192
; Save off our active register sets
22193
 
22194
		xchg	ah, al		; Swap these for later
22195
		mov	[_z80af], ax		; Store A & flags
22196
		mov	[_z80hl], bx		; Store HL
22197
		mov	[_z80bc], cx		; Store BC
22198
		sub	esi, ebp			; Knock off physical address
22199
		mov	[_z80pc], si		; And store virtual address
22200
		xor	eax, eax
22201
		mov	al, [_intData]
22202
 
22203
 
22204
		push	edi
22205
 
22206
		mov	dx, [_z80pc]
22207
		xor	edi, edi
22208
		mov	di, word [_z80sp]
22209
		sub	di, 2
22210
		mov	word [_z80sp], di
22211
		mov	[ebp+edi], dx
22212
		cmp	dword [_z80interruptMode], 2 ; Are we lower than mode 2?
22213
		jb		internalJustModeTwo
22214
		mov	ah, [_z80i]	; Get our high address here
22215
		and	eax, 0ffffh ; Only the lower part
22216
		mov	ax, [eax+ebp] ; Get our vector
22217
		jmp	short internalSetNewVector ; Go set it!
22218
internalJustModeTwo:
22219
		mov	ax, word [_z80intAddr]
22220
internalSetNewVector:
22221
		mov	[_z80pc], ax
22222
 
22223
		pop	edi
22224
 
22225
		xor	eax, eax	; Zero this so we can use it as an index
22226
		mov	al, [_z80interruptMode]
22227
		mov	al, [intModeTStates+eax]
22228
		sub	edi, eax
22229
		add	[_z80rCounter], eax
22230
 
22231
; Restore all the registers and whatnot
22232
 
22233
		mov	ax, [_z80af]		; Accumulator & flags
22234
		xchg	ah, al		; Swap these for later
22235
		mov	bx, [_z80hl]		; Get our HL value
22236
		mov	cx, [_z80bc]		; And our BC value
22237
		mov	ebp, [_z80Base]		; Get the base address
22238
		mov	si, [_z80pc]		; Get our program counter
22239
		add	esi, ebp		; Add in our base address
22240
internalInterruptsDisabled:
22241
		xor	edx, edx
22242
		ret
22243
		global	_mz80init
22244
		global	mz80init_
22245
		global	mz80init
22246
 
22247
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22248
 
22249
mz80init_:
22250
_mz80init:
22251
mz80init:
22252
		ret
22253
 
22254
		global	_mz80shutdown
22255
		global	mz80shutdown_
22256
		global	mz80shutdown
22257
 
22258
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22259
 
22260
mz80shutdown_:
22261
_mz80shutdown:
22262
mz80shutdown:
22263
		ret
22264
 
22265
 
22266
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22267
 
22268
;
22269
; In : EAX=Reg #, ESI=Context address
22270
; Out: EAX=Value of register
22271
;
22272
getRegValueInternal:
22273
		push	ecx
22274
		push	edx
22275
 
22276
		cmp	eax, CPUREG_MAXINDEX
22277
		jae	badIndex2
22278
 
22279
		shl	eax, 4	; Times 16 for table entry size
22280
		add	eax, RegTable	; Now it's the memory location
22281
		mov	edx, [eax+4]	; Get the offset of the register
22282
		mov	edx, [edx + esi]	; Get our value
22283
		mov	ecx, [eax+8]	; Get our shift value
22284
		shr	edx, cl			; Shift it right by a value
22285
		and	edx, [eax+12]	; Mask off any unneeded bits
22286
		mov	eax, edx			; Put our value in EAX
22287
		jmp	short indexExit	; Index's exit!
22288
badIndex2:
22289
		mov	eax, 0ffffffffh
22290
 
22291
indexExit:
22292
		pop	edx
22293
		pop	ecx
22294
		ret
22295
 
22296
 
22297
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22298
 
22299
;
22300
; In : EAX=Value, EDX=Reg #, ESI=Context address
22301
; Out: EAX=Value of register
22302
;
22303
convertValueToText:
22304
		push	ecx
22305
		push	edx
22306
 
22307
		cmp	edx, CPUREG_MAXINDEX
22308
		jae	badIndex3
22309
 
22310
		shl	edx, 4	; Times 16 for table entry size
22311
		add	edx, RegTable	; Now it's the memory location
22312
		mov	edx, [edx + 12] ; Shift mask
22313
		xor	ecx, ecx	; Zero our shift
22314
shiftLoop:
22315
		test	edx, 0f0000000h	; High nibble nonzero yet?
22316
		jnz	convertLoop		; Yup!
22317
		shl	edx, 4			; Move over, bacon
22318
		shl	eax, 4		; Move the value over, too
22319
		jmp	short shiftLoop	; Keep shiftin'
22320
 
22321
convertLoop:
22322
		mov	ecx, eax			; Get our value
22323
		shr	ecx, 28			; Only the top nibble
22324
		add	cl, '0'			; Convert to ASCII
22325
		cmp	cl, '9'			; Greater than 9?
22326
		jbe	noAdd				; Nope! Don't add it
22327
		add	cl, 32+7			; Convert from lowercase a-f
22328
noAdd:
22329
		mov	[edi], cl		; New value storage
22330
		inc	edi			; Next byte, please
22331
		shl	eax, 4			; Move the mask over
22332
		shl	edx, 4			; Move the mask over
22333
		jnz	convertLoop		; Keep convertin'
22334
 
22335
badIndex3:
22336
		mov	[edi], byte 0	; Null terminate the sucker!
22337
		pop	edx
22338
		pop	ecx
22339
		ret
22340
 
22341
		global	_mz80SetRegisterValue
22342
		global	mz80SetRegisterValue_
22343
		global	mz80SetRegisterValue
22344
 
22345
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22346
 
22347
mz80SetRegisterValue_:
22348
_mz80SetRegisterValue:
22349
mz80SetRegisterValue:
22350
		push	esi
22351
		push	edi
22352
		push	edx
22353
		push	ecx
22354
		mov	eax, [esp+20]	; Get our register #
22355
		mov	esi, [esp+24]	; Get our context address
22356
		mov	edi, [esp+28]	; Value to assign
22357
		or	esi, esi	; Are we NULL?
22358
		jnz	userDefined
22359
		mov	esi, _mz80contextBegin
22360
userDefined:
22361
 
22362
		shl	eax, 4	; Times 16 for reg entry size
22363
		add	eax, RegTable
22364
		mov	edx, [eax+12] ; Our mask
22365
		not	edx	; Invert EDX!
22366
		test	edi, edx	; Did we set any invalid bits?
22367
		jnz	rangeViolation
22368
 
22369
		not	edx	; Toggle it back to normal
22370
		mov	ecx, [eax+8]	; Get our shift value
22371
		shl	edx, cl	; Shift our mask
22372
		shl	eax, cl	; And our value to OR in
22373
		not	edx	; Make it the inverse of what we want
22374
		mov	eax, [eax+4]	; Get our offset into the context
22375
		and	[esi+eax], edx	; Mask off the bits we're changin
22376
		or	[esi+eax], edi	; Or in our new value
22377
 
22378
		xor	eax, eax
22379
		jmp	short  setExit
22380
 
22381
rangeViolation:
22382
		mov	eax, 0ffffffffh
22383
 
22384
setExit:
22385
		pop	ecx
22386
		pop	edx
22387
		pop	edi
22388
		pop	esi
22389
 
22390
		ret
22391
 
22392
 
22393
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22394
 
22395
		global	_mz80GetRegisterValue
22396
		global	mz80GetRegisterValue_
22397
		global	mz80GetRegisterValue
22398
 
22399
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22400
 
22401
mz80GetRegisterValue_:
22402
_mz80GetRegisterValue:
22403
mz80GetRegisterValue:
22404
		push	esi
22405
		mov	eax, [esp+8]	; Get our register #
22406
		mov	esi, [esp+12]	; Get our context address
22407
		or	esi, esi	; Is context NULL?
22408
		jnz	getVal	; Nope - use it!
22409
		mov	esi, _mz80contextBegin
22410
 
22411
getVal:
22412
		call	getRegValueInternal
22413
 
22414
		pop	esi
22415
		ret
22416
 
22417
 
22418
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22419
 
22420
		global	_mz80GetRegisterName
22421
		global	mz80GetRegisterName_
22422
		global	mz80GetRegisterName
22423
 
22424
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22425
 
22426
mz80GetRegisterName_:
22427
_mz80GetRegisterName:
22428
mz80GetRegisterName:
22429
		mov	eax, [esp+4]	; Get our register #
22430
		cmp	eax, CPUREG_MAXINDEX
22431
		jae	badIndex
22432
		shl	eax, 4	; Times 16 bytes for each entry
22433
		mov	eax, [eax+RegTable]
22434
		jmp	nameExit
22435
 
22436
badIndex:
22437
		xor	eax, eax
22438
 
22439
nameExit:
22440
		ret
22441
 
22442
 
22443
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22444
 
22445
		global	_mz80GetRegisterTextValue
22446
		global	mz80GetRegisterTextValue_
22447
		global	mz80GetRegisterTextValue
22448
 
22449
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22450
 
22451
mz80GetRegisterTextValue_:
22452
_mz80GetRegisterTextValue:
22453
mz80GetRegisterTextValue:
22454
		push	esi
22455
		push	edi
22456
		push	edx
22457
		mov	eax, [esp+16]	; Get our register #
22458
		mov	esi, [esp+20]	; Get our context address
22459
		mov	edi, [esp+24]	; Address to place text
22460
		or	esi, esi	; Is context NULL?
22461
		jnz	getVal2	; Nope - use it!
22462
		mov	esi, _mz80contextBegin
22463
 
22464
getVal2:
22465
		mov	edx, eax	; Save off our index for later
22466
		call	getRegValueInternal
22467
 
22468
; EAX Holds the value, EDX=Register #, and EDI=Destination!
22469
 
22470
		call	convertValueToText
22471
 
22472
		pop	edx
22473
		pop	esi
22474
		pop	edi
22475
		ret
22476
 
22477
 
22478
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22479
 
22480
		global	_mz80WriteValue
22481
		global	mz80WriteValue_
22482
		global	mz80WriteValue
22483
 
22484
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22485
 
22486
mz80WriteValue_:
22487
_mz80WriteValue:
22488
mz80WriteValue:
22489
		push	esi
22490
		push	edi
22491
		push	edx
22492
		push	ebx
22493
		push	ecx
22494
		push	ebp
22495
		mov	eax, [esp+28]	; What kind of write is this?
22496
		mov	ebx, [esp+32]	; Address
22497
		mov	edx, [esp+36]	; Value
22498
		cmp	eax, 1	; Is it a word write?
22499
		je	near invalidWrite	; Yep - it's not valid
22500
		cmp	eax, 2	; Is it a dword write?
22501
		je	near invalidWrite	; Yep - it's not valid
22502
 
22503
		or	eax, eax	; Is it a byte write?
22504
		jnz	itsIoDummy	; Nope... it's an I/O write
22505
 
22506
		mov	ebp, [_z80Base] ; Base pointer comes back
22507
		mov	edi, [_z80MemWrite]	; Point to the write array
22508
checkLoop:
22509
		cmp	[edi], word 0ffffh ; End of our list?
22510
		je	memoryWrite	; Yes - go write it!
22511
		cmp	bx, [edi]	; Are we smaller?
22512
		jb	nextAddr	; Yes... go to the next addr
22513
		cmp	bx, [edi+4]	; Are we smaller?
22514
		jbe	callRoutine	; If not, go call it!
22515
nextAddr:
22516
		add	edi, 10h		; Next structure, please
22517
		jmp	short checkLoop
22518
callRoutine:
22519
 
22520
;
22521
; EBX=Address to target, DL=Byte to write
22522
;
22523
 
22524
		cmp	[edi+8], dword 0	; Null handler?
22525
		je	directWriteHandler2
22526
 
22527
		push	edi	; Handler
22528
		push	edx	; Byte
22529
		push	ebx	; Address
22530
		call	dword [edi + 8]	; Go call our handler
22531
		add	esp, 12
22532
		jmp	short itsGood
22533
directWriteHandler2:
22534
		sub	ebx, [edi]	; Subtract our offset
22535
		add	ebx, [edi+12]	; Add in the base address
22536
		mov	[ebx], dl	; Store our byte
22537
		jmp	short itsGood
22538
memoryWrite:
22539
		mov	[ebp + ebx], dl
22540
 
22541
		jmp	short itsGood
22542
itsIoDummy:
22543
		mov	edi, [_z80IoWrite]	; Point to the I/O write array
22544
IOCheck:
22545
		cmp	[edi], word 0ffffh ; End of our list?
22546
		je	itsGood	; Yes - ignore it!
22547
		cmp	bx, [edi]	; Are we smaller?
22548
		jb	nextIOAddr	; Yes... go to the next addr
22549
		cmp	bx, [edi+2]	; Are we bigger?
22550
		jbe	callIOHandler	; If not, go call it!
22551
nextIOAddr:
22552
		add	edi, 0ch		; Next structure, please
22553
		jmp	short IOCheck
22554
callIOHandler:
22555
		push	edi	; Handler
22556
		push	edx	; Byte
22557
		push	ebx	; Address
22558
		call	dword [edi+4]	; Call the handler!
22559
		add	esp, 12
22560
		jmp	short itsGood
22561
 
22562
invalidWrite:
22563
		mov	eax, 0ffffffffh
22564
		jmp	short writeValueExit
22565
 
22566
itsGood:
22567
		xor	eax, eax
22568
 
22569
writeValueExit:
22570
		pop	ebp
22571
		pop	ecx
22572
		pop	ebx
22573
		pop	edx
22574
		pop	esi
22575
		pop	edi
22576
		ret
22577
 
22578
 
22579
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22580
 
22581
		global	_mz80ReadValue
22582
		global	mz80ReadValue_
22583
		global	mz80ReadValue
22584
 
22585
times ($$-$) & 3 nop	; pad with NOPs to 4-byte boundary
22586
 
22587
mz80ReadValue_:
22588
_mz80ReadValue:
22589
mz80ReadValue:
22590
		push	esi
22591
		push	edi
22592
		push	edx
22593
		push	ebx
22594
		push	ecx
22595
		push	ebp
22596
		mov	eax, [esp+28]	; What kind of read is this?
22597
		mov	ebx, [esp+32]	; Address
22598
		cmp	eax, 1	; Is it a word read?
22599
		je	near invalidRead	; Yep - it's not valid
22600
		cmp	eax, 2	; Is it a dword read?
22601
		je	near invalidRead	; Yep - it's not valid
22602
 
22603
		or	eax, eax	; Is it a byte read?
22604
		jnz	itsIoDummyRead	; Nope... it's an I/O read
22605
 
22606
		mov	ebp, [_z80Base] ; Base pointer comes back
22607
		mov	edi, [_z80MemRead]	; Point to the read array
22608
checkLoopRead:
22609
		cmp	[edi], word 0ffffh ; End of our list?
22610
		je	memoryRead	; Yes - go read it!
22611
		cmp	bx, [edi]	; Are we smaller?
22612
		jb	nextAddrRead	; Yes... go to the next addr
22613
		cmp	bx, [edi+4]	; Are we smaller?
22614
		jbe	callRoutineRead	; If not, go call it!
22615
nextAddrRead:
22616
		add	edi, 10h		; Next structure, please
22617
		jmp	short checkLoopRead
22618
callRoutineRead:
22619
 
22620
;
22621
; EBX=Address to target
22622
;
22623
 
22624
		cmp	[edi+8], dword 0 ; NULL HAndler?
22625
		je	handleSharedRead
22626
 
22627
		push	edi	; Handler
22628
		push	ebx	; Address
22629
		call	dword [edi + 8]	; Go call our handler
22630
		mov	dl, al	; Get our byte read
22631
		add	esp, 8
22632
		jmp	short itsGoodRead
22633
 
22634
memoryRead:
22635
		mov	dl, [ebp+ebx]
22636
 
22637
		jmp	short itsGoodRead
22638
 
22639
handleSharedRead:
22640
		sub	ebx, [edi]
22641
		add	ebx, [edi+12]
22642
		mov	dl, [ebx]
22643
		jmp	short itsGoodRead
22644
 
22645
itsIoDummyRead:
22646
		mov	edi, [_z80IoRead]	; Point to the I/O read array
22647
		mov	dl, 0ffh	; Assume no handler
22648
IOCheckRead:
22649
		cmp	[edi], word 0ffffh ; End of our list?
22650
		je	itsGoodRead	; Yes - ignore it!
22651
		cmp	bx, [edi]	; Are we smaller?
22652
		jb	nextIOAddrRead	; Yes... go to the next addr
22653
		cmp	bx, [edi+2]	; Are we bigger?
22654
		jbe	callIOHandlerRead	; If not, go call it!
22655
nextIOAddrRead:
22656
		add	edi, 0ch		; Next structure, please
22657
		jmp	short IOCheckRead
22658
callIOHandlerRead:
22659
		push	edi	; Handler
22660
		push	ebx	; Address
22661
		call	dword [edi+4]	; Call the handler!
22662
		mov	dl, al	; Get our byte read
22663
		add	esp, 8
22664
		jmp	short itsGoodRead
22665
 
22666
invalidRead:
22667
		mov	eax, 0ffffffffh
22668
		jmp	short ReadValueExit
22669
 
22670
itsGoodRead:
22671
		xor	eax, eax
22672
		mov	al, dl
22673
 
22674
ReadValueExit:
22675
		pop	ebp
22676
		pop	ecx
22677
		pop	ebx
22678
		pop	edx
22679
		pop	esi
22680
		pop	edi
22681
		ret
22682
 
22683
 
22684
%ifdef NASM_STACK_NOEXEC
22685
section .note.GNU-stack noalloc noexec nowrite progbits
22686
%endif