Skip to content

Instantly share code, notes, and snippets.

@remogatto
Created June 18, 2010 15:44
Show Gist options
  • Save remogatto/443803 to your computer and use it in GitHub Desktop.
Save remogatto/443803 to your computer and use it in GitHub Desktop.
package z80
import (
"container/vector"
"fmt"
)
/* The flags */
const FLAG_C = 0x01
const FLAG_N = 0x02
const FLAG_P = 0x04
const FLAG_V = FLAG_P
const FLAG_3 = 0x08
const FLAG_H = 0x10
const FLAG_5 = 0x20
const FLAG_Z = 0x40
const FLAG_S = 0x80
type Z80 struct {
a, f, b, c, d, e, h, l byte
a_, f_, b_, c_, d_, e_, h_, l_ byte
ixh, ixl, iyh, iyl byte
sp, i, r, r7, pc, iff1, iff2, im uint16
sz53Table, sz53pTable, parityTable [0x100]byte
halted byte
tstates uint16
LogEvents bool
}
var memory, initialMemory [0x10000]byte
var events *vector.StringVector
var event_next_event uint16
func NewZ80() *Z80 {
z80 := new(Z80)
z80.initTables()
events = new(vector.StringVector)
return z80
}
func (z80 *Z80) DumpRegisters(out *vector.StringVector) {
out.Push(fmt.Sprintf("%02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %04x %04x\n",
z80.a, z80.f, z80.b, z80.c, z80.d, z80.e, z80.h, z80.l, z80.a_, z80.f_, z80.b_, z80.c_, z80.d_, z80.e_, z80.h_, z80.l_, z80.ixh, z80.ixl, z80.iyh, z80.iyl, z80.sp, z80.pc))
out.Push(fmt.Sprintf("%02x %02x %d %d %d %d %d\n", z80.i, (z80.r7&0x80)|(z80.r&0x7f),
z80.iff1, z80.iff2, z80.im, z80.halted, z80.tstates))
}
func (z80 *Z80) DumpMemory(out *vector.StringVector) {
for i, _ := range memory {
if memory[i] == initialMemory[i] {
continue
}
line := fmt.Sprintf("%04x ", i)
for i < 0x10000 && memory[i] != initialMemory[i] {
line += fmt.Sprintf("%02x ", memory[i])
i++
}
line += fmt.Sprintf("-1\n")
out.Push(line)
}
}
func (z80 *Z80) Reset() {
z80.a, z80.f, z80.b, z80.c, z80.d, z80.e, z80.h, z80.l = 0, 0, 0, 0, 0, 0, 0, 0
z80.a_, z80.f_, z80.b_, z80.c_, z80.d_, z80.e_, z80.h_, z80.l_ = 0, 0, 0, 0, 0, 0, 0, 0
z80.ixh, z80.ixl, z80.iyh, z80.iyl = 0, 0, 0, 0
z80.sp, z80.i, z80.r, z80.r7, z80.pc, z80.iff1, z80.iff2, z80.im = 0, 0, 0, 0, 0, 0, 0, 0
z80.halted = 0
z80.tstates = 0
for i, _ := range memory {
memory[i] = 0
}
}
func ternOpB(cond bool, ret1, ret2 byte) byte {
if cond {
return ret1
}
return ret2
}
func (z80 *Z80) initTables() {
var i int16
var j, k byte
var parity byte
for i = 0; i < 0x100; i++ {
z80.sz53Table[i] = byte(i) & (0x08 | 0x20 | 0x80)
j = byte(i)
parity = 0
for k = 0; k < 8; k++ {
parity ^= j & 1
j >>= 1
}
z80.parityTable[i] = ternOpB(parity == 1, 0, 0x04)
z80.sz53pTable[i] = z80.sz53Table[i] | z80.parityTable[i]
}
z80.sz53Table[0] |= 0x40
z80.sz53pTable[0] |= 0x40
}
func (z80 *Z80) incA() {
z80.a++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.a == 0x80, FLAG_V, 0)) | (ternOpB((z80.a&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.a]
}
func (z80 *Z80) decA() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.a&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.a--
z80.f |= (ternOpB(z80.a == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.a]
}
func (z80 *Z80) incB() {
z80.b++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.b == 0x80, FLAG_V, 0)) | (ternOpB((z80.b&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.b]
}
func (z80 *Z80) decB() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.b&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.b--
z80.f |= (ternOpB(z80.b == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.b]
}
func (z80 *Z80) incC() {
z80.c++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.c == 0x80, FLAG_V, 0)) | (ternOpB((z80.c&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.c]
}
func (z80 *Z80) decC() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.c&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.c--
z80.f |= (ternOpB(z80.c == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.c]
}
func (z80 *Z80) incD() {
z80.d++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.d == 0x80, FLAG_V, 0)) | (ternOpB((z80.d&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.d]
}
func (z80 *Z80) decD() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.d&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.d--
z80.f |= (ternOpB(z80.d == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.d]
}
func (z80 *Z80) incE() {
z80.e++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.e == 0x80, FLAG_V, 0)) | (ternOpB((z80.e&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.e]
}
func (z80 *Z80) decE() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.e&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.e--
z80.f |= (ternOpB(z80.e == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.e]
}
func (z80 *Z80) incH() {
z80.h++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.h == 0x80, FLAG_V, 0)) | (ternOpB((z80.h&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.h]
}
func (z80 *Z80) decH() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.h&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.h--
z80.f |= (ternOpB(z80.h == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.h]
}
func (z80 *Z80) incL() {
z80.l++
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.l == 0x80, FLAG_V, 0)) | (ternOpB((z80.l&0x0f) == 1, 0, FLAG_H)) | z80.sz53Table[z80.l]
}
func (z80 *Z80) decL() {
z80.f = (z80.f & FLAG_C) | (ternOpB(z80.l&0x0f == 1, 0, FLAG_H)) | FLAG_N
z80.l--
z80.f |= (ternOpB(z80.l == 0x7f, FLAG_V, 0)) | z80.sz53Table[z80.l]
}
func (z80 *Z80) BC() uint16 {
return uint16(z80.c) | (uint16(z80.b) << 8)
}
func (z80 *Z80) incBC() {
temp := z80.BC() + 1
z80.b = byte(temp >> 8)
z80.c = byte(temp & 0xff)
}
func (z80 *Z80) HL() uint16 {
return uint16(z80.l) | (uint16(z80.h) << 8)
}
func (z80 *Z80) IR() uint16 {
return uint16((z80.i)<<8 | (z80.r7 & 0x80) | (z80.r & 0x7f))
}
func (z80 *Z80) readByteInternal(addr uint16) byte {
events.Push(fmt.Sprintf("%5d MR %04x %02x\n", z80.tstates, addr, memory[addr]))
return memory[addr]
}
func (z80 *Z80) readByte(addr uint16) byte {
events.Push(fmt.Sprintf("%5d MC %04x\n", z80.tstates, addr))
z80.tstates += 3
return z80.readByteInternal(addr)
}
func (z80 *Z80) writeByte(address uint16, b byte) {
events.Push(fmt.Sprintf("%5d MC %04x\n", z80.tstates, address))
z80.tstates += 3
z80.writebyteInternal(address, b)
}
func (z80 *Z80) writebyteInternal(address uint16, b byte) {
events.Push(fmt.Sprintf("%5d MW %04x %02x\n", z80.tstates, address, b))
memory[address] = b
}
func (z80 *Z80) contendRead(addr, time uint16) {
events.Push(fmt.Sprintf("%5d MC %04x\n", z80.tstates, addr))
z80.tstates += time
}
func (z80 *Z80) contendReadNoMreq(address, time uint16) {
z80.contendRead(address, time)
}
func (z80 *Z80) contendWriteNoMreq(address, time uint16) {
events.Push(fmt.Sprintf("%5d MC %04x\n", z80.tstates, address))
z80.tstates += time
}
func (z80 *Z80) doOpcodes() {
for z80.tstates < event_next_event {
z80.r = (z80.r + 1) & 0x7f
z80.contendRead(z80.pc, 4)
opcode := z80.readByteInternal(z80.pc)
z80.pc++
switch opcode {
/* opcodes_base.c: unshifted Z80 opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_base.dat',
and included in 'z80_ops.c' */
case 0x00: /* NOP */
break
case 0x01: /* LD BC,nnnn */
C = z80.readByte(z80.pc)
z80.pc++
B = z80.readByte(z80.pc)
z80.pc++
break
case 0x02: /* LD (BC),A */
z80.writeByte(BC, A)
break
case 0x03: /* INC BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incBC()
break
case 0x04: /* INC B */
z80.incB()
break
case 0x05: /* DEC B */
z80.decB()
break
case 0x06: /* LD B,nn */
B = z80.readByte(z80.pc)
z80.pc++
break
case 0x07: /* RLCA */
z80.a = (z80.a << 1) | (z80.a >> 7)
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) |
(z80.a & (FLAG_C | FLAG_3 | FLAG_5))
break
case 0x08: /* EX AF,AF' */
/* Tape saving trap: note this traps the EX AF,AF' at #04d0, not
#04d1 as PC has already been incremented */
/* 0x76 - Timex 2068 save routine in EXROM */
if z80.pc == 0x04d1 || z80.pc == 0x0077 {
if tape_save_trap() == 0 {
break
}
}
var wordtemp uint16 = z80.AF()
z80.setAF(z80.AF_())
z80.setAF_(wordtemp)
break
case 0x09: /* ADD HL,BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(HL, BC)
break
case 0x0a: /* LD A,(BC) */
A = z80.readByte(BC)
break
case 0x0b: /* DEC BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decBC()
break
case 0x0c: /* INC C */
z80.incC()
break
case 0x0d: /* DEC C */
z80.decC()
break
case 0x0e: /* LD C,nn */
C = z80.readByte(z80.pc)
z80.pc++
break
case 0x0f: /* RRCA */
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) | (z80.a & FLAG_C)
z80.a = (z80.a >> 1) | (z80.a << 7)
z80.f |= (z80.a & (FLAG_3 | FLAG_5))
break
case 0x10: /* DJNZ offset */
z80.contendReadNoMReq(z80.IR(), 1)
z80.b--
if B {
JR()
} else {
z80.contendRead(z80.pc, 3)
}
z80.pc++
break
case 0x11: /* LD DE,nnnn */
E = z80.readByte(z80.pc)
z80.pc++
D = z80.readByte(z80.pc)
z80.pc++
break
case 0x12: /* LD (DE),A */
z80.writeByte(DE, A)
break
case 0x13: /* INC DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incDE()
break
case 0x14: /* INC D */
z80.incD()
break
case 0x15: /* DEC D */
z80.decD()
break
case 0x16: /* LD D,nn */
D = z80.readByte(z80.pc)
z80.pc++
break
case 0x17: /* RLA */
var bytetemp byte = z80.a
z80.a = (z80.a << 1) | (z80.f & FLAG_C)
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) | (z80.a & (FLAG_3 | FLAG_5)) | (bytetemp >> 7)
break
case 0x18: /* JR offset */
JR()
z80.pc++
break
case 0x19: /* ADD HL,DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(HL, DE)
break
case 0x1a: /* LD A,(DE) */
A = z80.readByte(DE)
break
case 0x1b: /* DEC DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decDE()
break
case 0x1c: /* INC E */
z80.incE()
break
case 0x1d: /* DEC E */
z80.decE()
break
case 0x1e: /* LD E,nn */
E = z80.readByte(z80.pc)
z80.pc++
break
case 0x1f: /* RRA */
var bytetemp byte = z80.a
z80.a = (z80.a >> 1) | (z80.f << 7)
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) | (z80.a & (FLAG_3 | FLAG_5)) | (bytetemp & FLAG_C)
break
case 0x20: /* JR NZ,offset */
if !(F & FLAG_Z) {
JR()
} else {
z80.contendRead(z80.pc, 3)
}
z80.pc++
break
case 0x21: /* LD HL,nnnn */
L = z80.readByte(z80.pc)
z80.pc++
H = z80.readByte(z80.pc)
z80.pc++
break
case 0x22: /* LD (nnnn),HL */
LD16_NNRR(L, H)
break
case 0x23: /* INC HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incHL()
break
case 0x24: /* INC H */
z80.incH()
break
case 0x25: /* DEC H */
z80.decH()
break
case 0x26: /* LD H,nn */
H = z80.readByte(z80.pc)
z80.pc++
break
case 0x27: /* DAA */
var add, carry byte = 0, (z80.f & FLAG_C)
if (z80.f & FLAG_H) || ((z80.a & 0x0f) > 9) {
add = 6
}
if carry || (z80.a > 0x99) {
add |= 0x60
}
if z80.a > 0x99 {
carry = FLAG_C
}
if z80.f & FLAG_N {
SUB(add)
} else {
ADD(add)
}
z80.f = (z80.f & ^(FLAG_C | FLAG_P)) | carry | z80.parityTable[z80.a]
break
case 0x28: /* JR Z,offset */
if F & FLAG_Z {
JR()
} else {
z80.contendRead(z80.pc, 3)
}
z80.pc++
break
case 0x29: /* ADD HL,HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(HL, HL)
break
case 0x2a: /* LD HL,(nnnn) */
LD16_RRNN(L, H)
break
case 0x2b: /* DEC HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decHL()
break
case 0x2c: /* INC L */
z80.incL()
break
case 0x2d: /* DEC L */
z80.decL()
break
case 0x2e: /* LD L,nn */
L = z80.readByte(z80.pc)
z80.pc++
break
case 0x2f: /* CPL */
z80.a ^= 0xff
z80.f = (z80.f & (FLAG_C | FLAG_P | FLAG_Z | FLAG_S)) |
(z80.a & (FLAG_3 | FLAG_5)) | (FLAG_N | FLAG_H)
break
case 0x30: /* JR NC,offset */
if !(F & FLAG_C) {
JR()
} else {
z80.contendRead(z80.pc, 3)
}
z80.pc++
break
case 0x31: /* LD SP,nnnn */
SPL = z80.readByte(z80.pc)
z80.pc++
SPH = z80.readByte(z80.pc)
z80.pc++
break
case 0x32: /* LD (nnnn),A */
var wordtemp uint16 = z80.readByte(z80.pc)
z80.pc++
wordtemp |= z80.readByte(z80.pc) << 8
z80.pc++
z80.writeByte(wordtemp, z80.a)
break
case 0x33: /* INC SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incSP()
break
case 0x34: /* INC (HL) */
{
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
INC(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
}
break
case 0x35: /* DEC (HL) */
{
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
DEC(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
}
break
case 0x36: /* LD (HL),nn */
z80.writeByte(HL, z80.readByte(z80.pc))
z80.pc++
break
case 0x37: /* SCF */
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) |
(z80.a & (FLAG_3 | FLAG_5)) |
FLAG_C
break
case 0x38: /* JR C,offset */
if F & FLAG_C {
JR()
} else {
z80.contendRead(z80.pc, 3)
}
z80.pc++
break
case 0x39: /* ADD HL,SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(HL, SP)
break
case 0x3a: /* LD A,(nnnn) */
var wordtemp uint16
wordtemp = z80.readByte(z80.pc)
z80.pc++
wordtemp |= (z80.readByte(z80.pc) << 8)
z80.pc++
z80.a = z80.readByte(wordtemp)
break
case 0x3b: /* DEC SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decSP()
break
case 0x3c: /* INC A */
z80.incA()
break
case 0x3d: /* DEC A */
z80.decA()
break
case 0x3e: /* LD A,nn */
A = z80.readByte(z80.pc)
z80.pc++
break
case 0x3f: /* CCF */
z80.f = (z80.f & (FLAG_P | FLAG_Z | FLAG_S)) |
ternOpB((z80.f&FLAG_C) == 1, FLAG_H, FLAG_C) | (z80.a & (FLAG_3 | FLAG_5))
break
case 0x40: /* LD B,B */
break
case 0x41: /* LD B,C */
B = C
break
case 0x42: /* LD B,D */
B = D
break
case 0x43: /* LD B,E */
B = E
break
case 0x44: /* LD B,H */
B = H
break
case 0x45: /* LD B,L */
B = L
break
case 0x46: /* LD B,(HL) */
B = z80.readByte(HL)
break
case 0x47: /* LD B,A */
B = A
break
case 0x48: /* LD C,B */
C = B
break
case 0x49: /* LD C,C */
break
case 0x4a: /* LD C,D */
C = D
break
case 0x4b: /* LD C,E */
C = E
break
case 0x4c: /* LD C,H */
C = H
break
case 0x4d: /* LD C,L */
C = L
break
case 0x4e: /* LD C,(HL) */
C = z80.readByte(HL)
break
case 0x4f: /* LD C,A */
C = A
break
case 0x50: /* LD D,B */
D = B
break
case 0x51: /* LD D,C */
D = C
break
case 0x52: /* LD D,D */
break
case 0x53: /* LD D,E */
D = E
break
case 0x54: /* LD D,H */
D = H
break
case 0x55: /* LD D,L */
D = L
break
case 0x56: /* LD D,(HL) */
D = z80.readByte(HL)
break
case 0x57: /* LD D,A */
D = A
break
case 0x58: /* LD E,B */
E = B
break
case 0x59: /* LD E,C */
E = C
break
case 0x5a: /* LD E,D */
E = D
break
case 0x5b: /* LD E,E */
break
case 0x5c: /* LD E,H */
E = H
break
case 0x5d: /* LD E,L */
E = L
break
case 0x5e: /* LD E,(HL) */
E = z80.readByte(HL)
break
case 0x5f: /* LD E,A */
E = A
break
case 0x60: /* LD H,B */
H = B
break
case 0x61: /* LD H,C */
H = C
break
case 0x62: /* LD H,D */
H = D
break
case 0x63: /* LD H,E */
H = E
break
case 0x64: /* LD H,H */
break
case 0x65: /* LD H,L */
H = L
break
case 0x66: /* LD H,(HL) */
H = z80.readByte(HL)
break
case 0x67: /* LD H,A */
H = A
break
case 0x68: /* LD L,B */
L = B
break
case 0x69: /* LD L,C */
L = C
break
case 0x6a: /* LD L,D */
L = D
break
case 0x6b: /* LD L,E */
L = E
break
case 0x6c: /* LD L,H */
L = H
break
case 0x6d: /* LD L,L */
break
case 0x6e: /* LD L,(HL) */
L = z80.readByte(HL)
break
case 0x6f: /* LD L,A */
L = A
break
case 0x70: /* LD (HL),B */
z80.writeByte(HL, B)
break
case 0x71: /* LD (HL),C */
z80.writeByte(HL, C)
break
case 0x72: /* LD (HL),D */
z80.writeByte(HL, D)
break
case 0x73: /* LD (HL),E */
z80.writeByte(HL, E)
break
case 0x74: /* LD (HL),H */
z80.writeByte(HL, H)
break
case 0x75: /* LD (HL),L */
z80.writeByte(HL, L)
break
case 0x76: /* HALT */
z80.halted = 1
z80.pc--
break
case 0x77: /* LD (HL),A */
z80.writeByte(HL, A)
break
case 0x78: /* LD A,B */
A = B
break
case 0x79: /* LD A,C */
A = C
break
case 0x7a: /* LD A,D */
A = D
break
case 0x7b: /* LD A,E */
A = E
break
case 0x7c: /* LD A,H */
A = H
break
case 0x7d: /* LD A,L */
A = L
break
case 0x7e: /* LD A,(HL) */
A = z80.readByte(HL)
break
case 0x7f: /* LD A,A */
break
case 0x80: /* ADD A,B */
ADD(B)
break
case 0x81: /* ADD A,C */
ADD(C)
break
case 0x82: /* ADD A,D */
ADD(D)
break
case 0x83: /* ADD A,E */
ADD(E)
break
case 0x84: /* ADD A,H */
ADD(H)
break
case 0x85: /* ADD A,L */
ADD(L)
break
case 0x86: /* ADD A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
ADD(bytetemp)
}
break
case 0x87: /* ADD A,A */
ADD(A)
break
case 0x88: /* ADC A,B */
ADC(B)
break
case 0x89: /* ADC A,C */
ADC(C)
break
case 0x8a: /* ADC A,D */
ADC(D)
break
case 0x8b: /* ADC A,E */
ADC(E)
break
case 0x8c: /* ADC A,H */
ADC(H)
break
case 0x8d: /* ADC A,L */
ADC(L)
break
case 0x8e: /* ADC A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
ADC(bytetemp)
}
break
case 0x8f: /* ADC A,A */
ADC(A)
break
case 0x90: /* SUB A,B */
SUB(B)
break
case 0x91: /* SUB A,C */
SUB(C)
break
case 0x92: /* SUB A,D */
SUB(D)
break
case 0x93: /* SUB A,E */
SUB(E)
break
case 0x94: /* SUB A,H */
SUB(H)
break
case 0x95: /* SUB A,L */
SUB(L)
break
case 0x96: /* SUB A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
SUB(bytetemp)
}
break
case 0x97: /* SUB A,A */
SUB(A)
break
case 0x98: /* SBC A,B */
SBC(B)
break
case 0x99: /* SBC A,C */
SBC(C)
break
case 0x9a: /* SBC A,D */
SBC(D)
break
case 0x9b: /* SBC A,E */
SBC(E)
break
case 0x9c: /* SBC A,H */
SBC(H)
break
case 0x9d: /* SBC A,L */
SBC(L)
break
case 0x9e: /* SBC A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
SBC(bytetemp)
}
break
case 0x9f: /* SBC A,A */
SBC(A)
break
case 0xa0: /* AND A,B */
AND(B)
break
case 0xa1: /* AND A,C */
AND(C)
break
case 0xa2: /* AND A,D */
AND(D)
break
case 0xa3: /* AND A,E */
AND(E)
break
case 0xa4: /* AND A,H */
AND(H)
break
case 0xa5: /* AND A,L */
AND(L)
break
case 0xa6: /* AND A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
AND(bytetemp)
}
break
case 0xa7: /* AND A,A */
AND(A)
break
case 0xa8: /* XOR A,B */
XOR(B)
break
case 0xa9: /* XOR A,C */
XOR(C)
break
case 0xaa: /* XOR A,D */
XOR(D)
break
case 0xab: /* XOR A,E */
XOR(E)
break
case 0xac: /* XOR A,H */
XOR(H)
break
case 0xad: /* XOR A,L */
XOR(L)
break
case 0xae: /* XOR A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
XOR(bytetemp)
}
break
case 0xaf: /* XOR A,A */
XOR(A)
break
case 0xb0: /* OR A,B */
OR(B)
break
case 0xb1: /* OR A,C */
OR(C)
break
case 0xb2: /* OR A,D */
OR(D)
break
case 0xb3: /* OR A,E */
OR(E)
break
case 0xb4: /* OR A,H */
OR(H)
break
case 0xb5: /* OR A,L */
OR(L)
break
case 0xb6: /* OR A,(HL) */
{
var bytetemp byte = z80.readByte(HL)
OR(bytetemp)
}
break
case 0xb7: /* OR A,A */
OR(A)
break
case 0xb8: /* CP B */
CP(B)
break
case 0xb9: /* CP C */
CP(C)
break
case 0xba: /* CP D */
CP(D)
break
case 0xbb: /* CP E */
CP(E)
break
case 0xbc: /* CP H */
CP(H)
break
case 0xbd: /* CP L */
CP(L)
break
case 0xbe: /* CP (HL) */
{
var bytetemp byte = z80.readByte(HL)
CP(bytetemp)
}
break
case 0xbf: /* CP A */
CP(A)
break
case 0xc0: /* RET NZ */
z80.contendReadNoMReq(z80.IR(), 1)
if z80.pc == 0x056c || z80.pc == 0x0112 {
if tape_load_trap() == 0 {
break
}
}
if !(z80.f & FLAG_Z) {
RET()
}
break
case 0xc1: /* POP BC */
POP16(C, B)
break
case 0xc2: /* JP NZ,nnnn */
if !(z80.f & FLAG_Z) {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xc3: /* JP nnnn */
JP()
break
case 0xc4: /* CALL NZ,nnnn */
if !(z80.f & FLAG_Z) {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xc5: /* PUSH BC */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(C, B)
break
case 0xc6: /* ADD A,nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
ADD(bytetemp)
}
break
case 0xc7: /* RST 00 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x00)
break
case 0xc8: /* RET Z */
z80.contendReadNoMReq(z80.IR(), 1)
if z80.f & FLAG_Z {
RET()
}
break
case 0xc9: /* RET */
RET()
break
case 0xca: /* JP Z,nnnn */
if z80.f & FLAG_Z {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xcb: /* shift CB */
{
var opcode2 byte
z80.contendRead(z80.pc, 4)
opcode2 = z80.readByteInternal(z80.pc)
z80.pc++
z80.r++
switch opcode2 {
/* z80_cb.c: Z80 CBxx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_cb.dat',
and included in 'z80_ops.c' */
case 0x00: /* RLC B */
RLC(B)
break
case 0x01: /* RLC C */
RLC(C)
break
case 0x02: /* RLC D */
RLC(D)
break
case 0x03: /* RLC E */
RLC(E)
break
case 0x04: /* RLC H */
RLC(H)
break
case 0x05: /* RLC L */
RLC(L)
break
case 0x06: /* RLC (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
RLC(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x07: /* RLC A */
RLC(A)
break
case 0x08: /* RRC B */
RRC(B)
break
case 0x09: /* RRC C */
RRC(C)
break
case 0x0a: /* RRC D */
RRC(D)
break
case 0x0b: /* RRC E */
RRC(E)
break
case 0x0c: /* RRC H */
RRC(H)
break
case 0x0d: /* RRC L */
RRC(L)
break
case 0x0e: /* RRC (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
RRC(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x0f: /* RRC A */
RRC(A)
break
case 0x10: /* RL B */
RL(B)
break
case 0x11: /* RL C */
RL(C)
break
case 0x12: /* RL D */
RL(D)
break
case 0x13: /* RL E */
RL(E)
break
case 0x14: /* RL H */
RL(H)
break
case 0x15: /* RL L */
RL(L)
break
case 0x16: /* RL (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
RL(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x17: /* RL A */
RL(A)
break
case 0x18: /* RR B */
RR(B)
break
case 0x19: /* RR C */
RR(C)
break
case 0x1a: /* RR D */
RR(D)
break
case 0x1b: /* RR E */
RR(E)
break
case 0x1c: /* RR H */
RR(H)
break
case 0x1d: /* RR L */
RR(L)
break
case 0x1e: /* RR (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
RR(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x1f: /* RR A */
RR(A)
break
case 0x20: /* SLA B */
SLA(B)
break
case 0x21: /* SLA C */
SLA(C)
break
case 0x22: /* SLA D */
SLA(D)
break
case 0x23: /* SLA E */
SLA(E)
break
case 0x24: /* SLA H */
SLA(H)
break
case 0x25: /* SLA L */
SLA(L)
break
case 0x26: /* SLA (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
SLA(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x27: /* SLA A */
SLA(A)
break
case 0x28: /* SRA B */
SRA(B)
break
case 0x29: /* SRA C */
SRA(C)
break
case 0x2a: /* SRA D */
SRA(D)
break
case 0x2b: /* SRA E */
SRA(E)
break
case 0x2c: /* SRA H */
SRA(H)
break
case 0x2d: /* SRA L */
SRA(L)
break
case 0x2e: /* SRA (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
SRA(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x2f: /* SRA A */
SRA(A)
break
case 0x30: /* SLL B */
SLL(B)
break
case 0x31: /* SLL C */
SLL(C)
break
case 0x32: /* SLL D */
SLL(D)
break
case 0x33: /* SLL E */
SLL(E)
break
case 0x34: /* SLL H */
SLL(H)
break
case 0x35: /* SLL L */
SLL(L)
break
case 0x36: /* SLL (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
SLL(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x37: /* SLL A */
SLL(A)
break
case 0x38: /* SRL B */
SRL(B)
break
case 0x39: /* SRL C */
SRL(C)
break
case 0x3a: /* SRL D */
SRL(D)
break
case 0x3b: /* SRL E */
SRL(E)
break
case 0x3c: /* SRL H */
SRL(H)
break
case 0x3d: /* SRL L */
SRL(L)
break
case 0x3e: /* SRL (HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
SRL(bytetemp)
z80.writeByte(z80.HL(), bytetemp)
break
case 0x3f: /* SRL A */
SRL(A)
break
case 0x40: /* BIT 0,B */
BIT(0, B)
break
case 0x41: /* BIT 0,C */
BIT(0, C)
break
case 0x42: /* BIT 0,D */
BIT(0, D)
break
case 0x43: /* BIT 0,E */
BIT(0, E)
break
case 0x44: /* BIT 0,H */
BIT(0, H)
break
case 0x45: /* BIT 0,L */
BIT(0, L)
break
case 0x46: /* BIT 0,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(0, bytetemp)
break
case 0x47: /* BIT 0,A */
BIT(0, A)
break
case 0x48: /* BIT 1,B */
BIT(1, B)
break
case 0x49: /* BIT 1,C */
BIT(1, C)
break
case 0x4a: /* BIT 1,D */
BIT(1, D)
break
case 0x4b: /* BIT 1,E */
BIT(1, E)
break
case 0x4c: /* BIT 1,H */
BIT(1, H)
break
case 0x4d: /* BIT 1,L */
BIT(1, L)
break
case 0x4e: /* BIT 1,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(1, bytetemp)
break
case 0x4f: /* BIT 1,A */
BIT(1, A)
break
case 0x50: /* BIT 2,B */
BIT(2, B)
break
case 0x51: /* BIT 2,C */
BIT(2, C)
break
case 0x52: /* BIT 2,D */
BIT(2, D)
break
case 0x53: /* BIT 2,E */
BIT(2, E)
break
case 0x54: /* BIT 2,H */
BIT(2, H)
break
case 0x55: /* BIT 2,L */
BIT(2, L)
break
case 0x56: /* BIT 2,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(2, bytetemp)
break
case 0x57: /* BIT 2,A */
BIT(2, A)
break
case 0x58: /* BIT 3,B */
BIT(3, B)
break
case 0x59: /* BIT 3,C */
BIT(3, C)
break
case 0x5a: /* BIT 3,D */
BIT(3, D)
break
case 0x5b: /* BIT 3,E */
BIT(3, E)
break
case 0x5c: /* BIT 3,H */
BIT(3, H)
break
case 0x5d: /* BIT 3,L */
BIT(3, L)
break
case 0x5e: /* BIT 3,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(3, bytetemp)
break
case 0x5f: /* BIT 3,A */
BIT(3, A)
break
case 0x60: /* BIT 4,B */
BIT(4, B)
break
case 0x61: /* BIT 4,C */
BIT(4, C)
break
case 0x62: /* BIT 4,D */
BIT(4, D)
break
case 0x63: /* BIT 4,E */
BIT(4, E)
break
case 0x64: /* BIT 4,H */
BIT(4, H)
break
case 0x65: /* BIT 4,L */
BIT(4, L)
break
case 0x66: /* BIT 4,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(4, bytetemp)
break
case 0x67: /* BIT 4,A */
BIT(4, A)
break
case 0x68: /* BIT 5,B */
BIT(5, B)
break
case 0x69: /* BIT 5,C */
BIT(5, C)
break
case 0x6a: /* BIT 5,D */
BIT(5, D)
break
case 0x6b: /* BIT 5,E */
BIT(5, E)
break
case 0x6c: /* BIT 5,H */
BIT(5, H)
break
case 0x6d: /* BIT 5,L */
BIT(5, L)
break
case 0x6e: /* BIT 5,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(5, bytetemp)
break
case 0x6f: /* BIT 5,A */
BIT(5, A)
break
case 0x70: /* BIT 6,B */
BIT(6, B)
break
case 0x71: /* BIT 6,C */
BIT(6, C)
break
case 0x72: /* BIT 6,D */
BIT(6, D)
break
case 0x73: /* BIT 6,E */
BIT(6, E)
break
case 0x74: /* BIT 6,H */
BIT(6, H)
break
case 0x75: /* BIT 6,L */
BIT(6, L)
break
case 0x76: /* BIT 6,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(6, bytetemp)
break
case 0x77: /* BIT 6,A */
BIT(6, A)
break
case 0x78: /* BIT 7,B */
BIT(7, B)
break
case 0x79: /* BIT 7,C */
BIT(7, C)
break
case 0x7a: /* BIT 7,D */
BIT(7, D)
break
case 0x7b: /* BIT 7,E */
BIT(7, E)
break
case 0x7c: /* BIT 7,H */
BIT(7, H)
break
case 0x7d: /* BIT 7,L */
BIT(7, L)
break
case 0x7e: /* BIT 7,(HL) */
bytetemp := z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
BIT(7, bytetemp)
break
case 0x7f: /* BIT 7,A */
BIT(7, A)
break
case 0x80: /* RES 0,B */
B &= 0xfe
break
case 0x81: /* RES 0,C */
C &= 0xfe
break
case 0x82: /* RES 0,D */
D &= 0xfe
break
case 0x83: /* RES 0,E */
E &= 0xfe
break
case 0x84: /* RES 0,H */
H &= 0xfe
break
case 0x85: /* RES 0,L */
L &= 0xfe
break
case 0x86: /* RES 0,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xfe)
break
case 0x87: /* RES 0,A */
A &= 0xfe
break
case 0x88: /* RES 1,B */
B &= 0xfd
break
case 0x89: /* RES 1,C */
C &= 0xfd
break
case 0x8a: /* RES 1,D */
D &= 0xfd
break
case 0x8b: /* RES 1,E */
E &= 0xfd
break
case 0x8c: /* RES 1,H */
H &= 0xfd
break
case 0x8d: /* RES 1,L */
L &= 0xfd
break
case 0x8e: /* RES 1,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xfd)
break
case 0x8f: /* RES 1,A */
A &= 0xfd
break
case 0x90: /* RES 2,B */
B &= 0xfb
break
case 0x91: /* RES 2,C */
C &= 0xfb
break
case 0x92: /* RES 2,D */
D &= 0xfb
break
case 0x93: /* RES 2,E */
E &= 0xfb
break
case 0x94: /* RES 2,H */
H &= 0xfb
break
case 0x95: /* RES 2,L */
L &= 0xfb
break
case 0x96: /* RES 2,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xfb)
break
case 0x97: /* RES 2,A */
A &= 0xfb
break
case 0x98: /* RES 3,B */
B &= 0xf7
break
case 0x99: /* RES 3,C */
C &= 0xf7
break
case 0x9a: /* RES 3,D */
D &= 0xf7
break
case 0x9b: /* RES 3,E */
E &= 0xf7
break
case 0x9c: /* RES 3,H */
H &= 0xf7
break
case 0x9d: /* RES 3,L */
L &= 0xf7
break
case 0x9e: /* RES 3,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xf7)
break
case 0x9f: /* RES 3,A */
A &= 0xf7
break
case 0xa0: /* RES 4,B */
B &= 0xef
break
case 0xa1: /* RES 4,C */
C &= 0xef
break
case 0xa2: /* RES 4,D */
D &= 0xef
break
case 0xa3: /* RES 4,E */
E &= 0xef
break
case 0xa4: /* RES 4,H */
H &= 0xef
break
case 0xa5: /* RES 4,L */
L &= 0xef
break
case 0xa6: /* RES 4,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xef)
break
case 0xa7: /* RES 4,A */
A &= 0xef
break
case 0xa8: /* RES 5,B */
B &= 0xdf
break
case 0xa9: /* RES 5,C */
C &= 0xdf
break
case 0xaa: /* RES 5,D */
D &= 0xdf
break
case 0xab: /* RES 5,E */
E &= 0xdf
break
case 0xac: /* RES 5,H */
H &= 0xdf
break
case 0xad: /* RES 5,L */
L &= 0xdf
break
case 0xae: /* RES 5,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xdf)
break
case 0xaf: /* RES 5,A */
A &= 0xdf
break
case 0xb0: /* RES 6,B */
B &= 0xbf
break
case 0xb1: /* RES 6,C */
C &= 0xbf
break
case 0xb2: /* RES 6,D */
D &= 0xbf
break
case 0xb3: /* RES 6,E */
E &= 0xbf
break
case 0xb4: /* RES 6,H */
H &= 0xbf
break
case 0xb5: /* RES 6,L */
L &= 0xbf
break
case 0xb6: /* RES 6,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0xbf)
break
case 0xb7: /* RES 6,A */
A &= 0xbf
break
case 0xb8: /* RES 7,B */
B &= 0x7f
break
case 0xb9: /* RES 7,C */
C &= 0x7f
break
case 0xba: /* RES 7,D */
D &= 0x7f
break
case 0xbb: /* RES 7,E */
E &= 0x7f
break
case 0xbc: /* RES 7,H */
H &= 0x7f
break
case 0xbd: /* RES 7,L */
L &= 0x7f
break
case 0xbe: /* RES 7,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp&0x7f)
break
case 0xbf: /* RES 7,A */
A &= 0x7f
break
case 0xc0: /* SET 0,B */
B |= 0x01
break
case 0xc1: /* SET 0,C */
C |= 0x01
break
case 0xc2: /* SET 0,D */
D |= 0x01
break
case 0xc3: /* SET 0,E */
E |= 0x01
break
case 0xc4: /* SET 0,H */
H |= 0x01
break
case 0xc5: /* SET 0,L */
L |= 0x01
break
case 0xc6: /* SET 0,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x01)
break
case 0xc7: /* SET 0,A */
A |= 0x01
break
case 0xc8: /* SET 1,B */
B |= 0x02
break
case 0xc9: /* SET 1,C */
C |= 0x02
break
case 0xca: /* SET 1,D */
D |= 0x02
break
case 0xcb: /* SET 1,E */
E |= 0x02
break
case 0xcc: /* SET 1,H */
H |= 0x02
break
case 0xcd: /* SET 1,L */
L |= 0x02
break
case 0xce: /* SET 1,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x02)
break
case 0xcf: /* SET 1,A */
A |= 0x02
break
case 0xd0: /* SET 2,B */
B |= 0x04
break
case 0xd1: /* SET 2,C */
C |= 0x04
break
case 0xd2: /* SET 2,D */
D |= 0x04
break
case 0xd3: /* SET 2,E */
E |= 0x04
break
case 0xd4: /* SET 2,H */
H |= 0x04
break
case 0xd5: /* SET 2,L */
L |= 0x04
break
case 0xd6: /* SET 2,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x04)
break
case 0xd7: /* SET 2,A */
A |= 0x04
break
case 0xd8: /* SET 3,B */
B |= 0x08
break
case 0xd9: /* SET 3,C */
C |= 0x08
break
case 0xda: /* SET 3,D */
D |= 0x08
break
case 0xdb: /* SET 3,E */
E |= 0x08
break
case 0xdc: /* SET 3,H */
H |= 0x08
break
case 0xdd: /* SET 3,L */
L |= 0x08
break
case 0xde: /* SET 3,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x08)
break
case 0xdf: /* SET 3,A */
A |= 0x08
break
case 0xe0: /* SET 4,B */
B |= 0x10
break
case 0xe1: /* SET 4,C */
C |= 0x10
break
case 0xe2: /* SET 4,D */
D |= 0x10
break
case 0xe3: /* SET 4,E */
E |= 0x10
break
case 0xe4: /* SET 4,H */
H |= 0x10
break
case 0xe5: /* SET 4,L */
L |= 0x10
break
case 0xe6: /* SET 4,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x10)
break
case 0xe7: /* SET 4,A */
A |= 0x10
break
case 0xe8: /* SET 5,B */
B |= 0x20
break
case 0xe9: /* SET 5,C */
C |= 0x20
break
case 0xea: /* SET 5,D */
D |= 0x20
break
case 0xeb: /* SET 5,E */
E |= 0x20
break
case 0xec: /* SET 5,H */
H |= 0x20
break
case 0xed: /* SET 5,L */
L |= 0x20
break
case 0xee: /* SET 5,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x20)
break
case 0xef: /* SET 5,A */
A |= 0x20
break
case 0xf0: /* SET 6,B */
B |= 0x40
break
case 0xf1: /* SET 6,C */
C |= 0x40
break
case 0xf2: /* SET 6,D */
D |= 0x40
break
case 0xf3: /* SET 6,E */
E |= 0x40
break
case 0xf4: /* SET 6,H */
H |= 0x40
break
case 0xf5: /* SET 6,L */
L |= 0x40
break
case 0xf6: /* SET 6,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x40)
break
case 0xf7: /* SET 6,A */
A |= 0x40
break
case 0xf8: /* SET 7,B */
B |= 0x80
break
case 0xf9: /* SET 7,C */
C |= 0x80
break
case 0xfa: /* SET 7,D */
D |= 0x80
break
case 0xfb: /* SET 7,E */
E |= 0x80
break
case 0xfc: /* SET 7,H */
H |= 0x80
break
case 0xfd: /* SET 7,L */
L |= 0x80
break
case 0xfe: /* SET 7,(HL) */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), bytetemp|0x80)
break
case 0xff: /* SET 7,A */
A |= 0x80
break
}
}
break
case 0xcc: /* CALL Z,nnnn */
if z80.f & FLAG_Z {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xcd: /* CALL nnnn */
CALL()
break
case 0xce: /* ADC A,nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
ADC(bytetemp)
}
break
case 0xcf: /* RST 8 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x08)
break
case 0xd0: /* RET NC */
z80.contendReadNoMReq(z80.IR(), 1)
if !(z80.f & FLAG_C) {
RET()
}
break
case 0xd1: /* POP DE */
POP16(E, D)
break
case 0xd2: /* JP NC,nnnn */
if !(z80.f & FLAG_C) {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xd3: /* OUT (nn),A */
var outtemp uint16
outtemp = z80.readByte(z80.pc) + (z80.a << 8)
z80.pc++
writeport(outtemp, z80.a)
break
case 0xd4: /* CALL NC,nnnn */
if !(z80.f & FLAG_C) {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xd5: /* PUSH DE */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(E, D)
break
case 0xd6: /* SUB nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
SUB(bytetemp)
}
break
case 0xd7: /* RST 10 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x10)
break
case 0xd8: /* RET C */
z80.contendReadNoMReq(z80.IR(), 1)
if z80.f & FLAG_C {
RET()
}
break
case 0xd9: /* EXX */
var wordtemp uint16
wordtemp = BC
BC = BC_
BC_ = wordtemp
wordtemp = DE
DE = DE_
DE_ = wordtemp
wordtemp = z80.HL()
HL = HL_
HL_ = wordtemp
break
case 0xda: /* JP C,nnnn */
if z80.f & FLAG_C {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xdb: /* IN A,(nn) */
var intemp uint16
intemp = z80.readByte(z80.pc) + (z80.a << 8)
z80.pc++
z80.a = readport(intemp)
break
case 0xdc: /* CALL C,nnnn */
if z80.f & FLAG_C {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xdd: /* shift DD */
{
var opcode2 byte
z80.contendRead(z80.pc, 4)
opcode2 = z80.readByteInternal(z80.pc)
z80.pc++
z80.r++
switch opcode2 {
/* z80_ddfd.c Z80 {DD,FD}xx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_ddfd.dat',
and included in 'z80_ops.c' */
case 0x09: /* ADD REGISTER,BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, BC)
break
case 0x19: /* ADD REGISTER,DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, DE)
break
case 0x21: /* LD REGISTER,nnnn */
REGISTERL = z80.readByte(z80.pc)
z80.pc++
REGISTERH = z80.readByte(z80.pc)
z80.pc++
break
case 0x22: /* LD (nnnn),REGISTER */
LD16_NNRR(REGISTERL, REGISTERH)
break
case 0x23: /* INC REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incREGISTER()
break
case 0x24: /* INC REGISTERH */
z80.incREGISTERH()
break
case 0x25: /* DEC REGISTERH */
z80.decREGISTERH()
break
case 0x26: /* LD REGISTERH,nn */
REGISTERH = z80.readByte(z80.pc)
z80.pc++
break
case 0x29: /* ADD REGISTER,REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, REGISTER)
break
case 0x2a: /* LD REGISTER,(nnnn) */
LD16_RRNN(REGISTERL, REGISTERH)
break
case 0x2b: /* DEC REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decREGISTER()
break
case 0x2c: /* INC REGISTERL */
z80.incREGISTERL()
break
case 0x2d: /* DEC REGISTERL */
z80.decREGISTERL()
break
case 0x2e: /* LD REGISTERL,nn */
REGISTERL = z80.readByte(z80.pc)
z80.pc++
break
case 0x34: /* INC (REGISTER+dd) */
var offset, bytetemp byte
var wordtemp uint16
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
wordtemp = REGISTER + signExtend(offset)
bytetemp = z80.readByte(wordtemp)
z80.contendReadNoMReq(wordtemp, 1)
INC(bytetemp)
z80.writeByte(wordtemp, bytetemp)
break
case 0x35: /* DEC (REGISTER+dd) */
var offset, bytetemp byte
var wordtemp uint16
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
wordtemp = REGISTER + signExtend(offset)
bytetemp = z80.readByte(wordtemp)
z80.contendReadNoMReq(wordtemp, 1)
DEC(bytetemp)
z80.writeByte(wordtemp, bytetemp)
break
case 0x36: /* LD (REGISTER+dd),nn */
offset := z80.readByte(z80.pc)
z80.pc++
value := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), value)
break
case 0x39: /* ADD REGISTER,SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, SP)
break
case 0x44: /* LD B,REGISTERH */
B = REGISTERH
break
case 0x45: /* LD B,REGISTERL */
B = REGISTERL
break
case 0x46: /* LD B,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
B = z80.readByte(REGISTER + signExtend(offset))
break
case 0x4c: /* LD C,REGISTERH */
C = REGISTERH
break
case 0x4d: /* LD C,REGISTERL */
C = REGISTERL
break
case 0x4e: /* LD C,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
C = z80.readByte(REGISTER + signExtend(offset))
break
case 0x54: /* LD D,REGISTERH */
D = REGISTERH
break
case 0x55: /* LD D,REGISTERL */
D = REGISTERL
break
case 0x56: /* LD D,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
D = z80.readByte(REGISTER + signExtend(offset))
break
case 0x5c: /* LD E,REGISTERH */
E = REGISTERH
break
case 0x5d: /* LD E,REGISTERL */
E = REGISTERL
break
case 0x5e: /* LD E,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
E = z80.readByte(REGISTER + signExtend(offset))
break
case 0x60: /* LD REGISTERH,B */
REGISTERH = B
break
case 0x61: /* LD REGISTERH,C */
REGISTERH = C
break
case 0x62: /* LD REGISTERH,D */
REGISTERH = D
break
case 0x63: /* LD REGISTERH,E */
REGISTERH = E
break
case 0x64: /* LD REGISTERH,REGISTERH */
break
case 0x65: /* LD REGISTERH,REGISTERL */
REGISTERH = REGISTERL
break
case 0x66: /* LD H,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
H = z80.readByte(REGISTER + signExtend(offset))
break
case 0x67: /* LD REGISTERH,A */
REGISTERH = A
break
case 0x68: /* LD REGISTERL,B */
REGISTERL = B
break
case 0x69: /* LD REGISTERL,C */
REGISTERL = C
break
case 0x6a: /* LD REGISTERL,D */
REGISTERL = D
break
case 0x6b: /* LD REGISTERL,E */
REGISTERL = E
break
case 0x6c: /* LD REGISTERL,REGISTERH */
REGISTERL = REGISTERH
break
case 0x6d: /* LD REGISTERL,REGISTERL */
break
case 0x6e: /* LD L,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
L = z80.readByte(REGISTER + signExtend(offset))
break
case 0x6f: /* LD REGISTERL,A */
REGISTERL = A
break
case 0x70: /* LD (REGISTER+dd),B */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), B)
break
case 0x71: /* LD (REGISTER+dd),C */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), C)
break
case 0x72: /* LD (REGISTER+dd),D */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), D)
break
case 0x73: /* LD (REGISTER+dd),E */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), E)
break
case 0x74: /* LD (REGISTER+dd),H */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), H)
break
case 0x75: /* LD (REGISTER+dd),L */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), L)
break
case 0x77: /* LD (REGISTER+dd),A */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), A)
break
case 0x7c: /* LD A,REGISTERH */
A = REGISTERH
break
case 0x7d: /* LD A,REGISTERL */
A = REGISTERL
break
case 0x7e: /* LD A,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
A = z80.readByte(REGISTER + signExtend(offset))
break
case 0x84: /* ADD A,REGISTERH */
ADD(REGISTERH)
break
case 0x85: /* ADD A,REGISTERL */
ADD(REGISTERL)
break
case 0x86: /* ADD A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
ADD(bytetemp)
break
case 0x8c: /* ADC A,REGISTERH */
ADC(REGISTERH)
break
case 0x8d: /* ADC A,REGISTERL */
ADC(REGISTERL)
break
case 0x8e: /* ADC A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
ADC(bytetemp)
break
case 0x94: /* SUB A,REGISTERH */
SUB(REGISTERH)
break
case 0x95: /* SUB A,REGISTERL */
SUB(REGISTERL)
break
case 0x96: /* SUB A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
SUB(bytetemp)
break
case 0x9c: /* SBC A,REGISTERH */
SBC(REGISTERH)
break
case 0x9d: /* SBC A,REGISTERL */
SBC(REGISTERL)
break
case 0x9e: /* SBC A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
SBC(bytetemp)
break
case 0xa4: /* AND A,REGISTERH */
AND(REGISTERH)
break
case 0xa5: /* AND A,REGISTERL */
AND(REGISTERL)
break
case 0xa6: /* AND A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
AND(bytetemp)
break
case 0xac: /* XOR A,REGISTERH */
XOR(REGISTERH)
break
case 0xad: /* XOR A,REGISTERL */
XOR(REGISTERL)
break
case 0xae: /* XOR A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
XOR(bytetemp)
break
case 0xb4: /* OR A,REGISTERH */
OR(REGISTERH)
break
case 0xb5: /* OR A,REGISTERL */
OR(REGISTERL)
break
case 0xb6: /* OR A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
OR(bytetemp)
break
case 0xbc: /* CP A,REGISTERH */
CP(REGISTERH)
break
case 0xbd: /* CP A,REGISTERL */
CP(REGISTERL)
break
case 0xbe: /* CP A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
CP(bytetemp)
break
case 0xcb: /* shift DDFDCB */
var tempaddr uint16
var opcode3 byte
z80.contendRead(z80.pc, 3)
tempaddr = REGISTER + signExtend(z80.readByteInternal(z80.pc))
z80.pc++
z80.contendRead(z80.pc, 3)
opcode3 = z80.readByteInternal(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
switch opcode3 {
/* z80_ddfdcb.c Z80 {DD,FD}CBxx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_ddfdcb.dat',
and included in 'z80_ops.c' */
case 0x00: /* LD B,RLC (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(B)
z80.writeByte(tempaddr, B)
break
case 0x01: /* LD C,RLC (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(C)
z80.writeByte(tempaddr, C)
break
case 0x02: /* LD D,RLC (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(D)
z80.writeByte(tempaddr, D)
break
case 0x03: /* LD E,RLC (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(E)
z80.writeByte(tempaddr, E)
break
case 0x04: /* LD H,RLC (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(H)
z80.writeByte(tempaddr, H)
break
case 0x05: /* LD L,RLC (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(L)
z80.writeByte(tempaddr, L)
break
case 0x06: /* RLC (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x07: /* LD A,RLC (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(A)
z80.writeByte(tempaddr, A)
break
case 0x08: /* LD B,RRC (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(B)
z80.writeByte(tempaddr, B)
break
case 0x09: /* LD C,RRC (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(C)
z80.writeByte(tempaddr, C)
break
case 0x0a: /* LD D,RRC (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(D)
z80.writeByte(tempaddr, D)
break
case 0x0b: /* LD E,RRC (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(E)
z80.writeByte(tempaddr, E)
break
case 0x0c: /* LD H,RRC (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(H)
z80.writeByte(tempaddr, H)
break
case 0x0d: /* LD L,RRC (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(L)
z80.writeByte(tempaddr, L)
break
case 0x0e: /* RRC (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x0f: /* LD A,RRC (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(A)
z80.writeByte(tempaddr, A)
break
case 0x10: /* LD B,RL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(B)
z80.writeByte(tempaddr, B)
break
case 0x11: /* LD C,RL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(C)
z80.writeByte(tempaddr, C)
break
case 0x12: /* LD D,RL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(D)
z80.writeByte(tempaddr, D)
break
case 0x13: /* LD E,RL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(E)
z80.writeByte(tempaddr, E)
break
case 0x14: /* LD H,RL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(H)
z80.writeByte(tempaddr, H)
break
case 0x15: /* LD L,RL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(L)
z80.writeByte(tempaddr, L)
break
case 0x16: /* RL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x17: /* LD A,RL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(A)
z80.writeByte(tempaddr, A)
break
case 0x18: /* LD B,RR (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(B)
z80.writeByte(tempaddr, B)
break
case 0x19: /* LD C,RR (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(C)
z80.writeByte(tempaddr, C)
break
case 0x1a: /* LD D,RR (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(D)
z80.writeByte(tempaddr, D)
break
case 0x1b: /* LD E,RR (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(E)
z80.writeByte(tempaddr, E)
break
case 0x1c: /* LD H,RR (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(H)
z80.writeByte(tempaddr, H)
break
case 0x1d: /* LD L,RR (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(L)
z80.writeByte(tempaddr, L)
break
case 0x1e: /* RR (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x1f: /* LD A,RR (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(A)
z80.writeByte(tempaddr, A)
break
case 0x20: /* LD B,SLA (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(B)
z80.writeByte(tempaddr, B)
break
case 0x21: /* LD C,SLA (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(C)
z80.writeByte(tempaddr, C)
break
case 0x22: /* LD D,SLA (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(D)
z80.writeByte(tempaddr, D)
break
case 0x23: /* LD E,SLA (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(E)
z80.writeByte(tempaddr, E)
break
case 0x24: /* LD H,SLA (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(H)
z80.writeByte(tempaddr, H)
break
case 0x25: /* LD L,SLA (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(L)
z80.writeByte(tempaddr, L)
break
case 0x26: /* SLA (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x27: /* LD A,SLA (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(A)
z80.writeByte(tempaddr, A)
break
case 0x28: /* LD B,SRA (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(B)
z80.writeByte(tempaddr, B)
break
case 0x29: /* LD C,SRA (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(C)
z80.writeByte(tempaddr, C)
break
case 0x2a: /* LD D,SRA (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(D)
z80.writeByte(tempaddr, D)
break
case 0x2b: /* LD E,SRA (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(E)
z80.writeByte(tempaddr, E)
break
case 0x2c: /* LD H,SRA (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(H)
z80.writeByte(tempaddr, H)
break
case 0x2d: /* LD L,SRA (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(L)
z80.writeByte(tempaddr, L)
break
case 0x2e: /* SRA (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x2f: /* LD A,SRA (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(A)
z80.writeByte(tempaddr, A)
break
case 0x30: /* LD B,SLL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(B)
z80.writeByte(tempaddr, B)
break
case 0x31: /* LD C,SLL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(C)
z80.writeByte(tempaddr, C)
break
case 0x32: /* LD D,SLL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(D)
z80.writeByte(tempaddr, D)
break
case 0x33: /* LD E,SLL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(E)
z80.writeByte(tempaddr, E)
break
case 0x34: /* LD H,SLL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(H)
z80.writeByte(tempaddr, H)
break
case 0x35: /* LD L,SLL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(L)
z80.writeByte(tempaddr, L)
break
case 0x36: /* SLL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x37: /* LD A,SLL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(A)
z80.writeByte(tempaddr, A)
break
case 0x38: /* LD B,SRL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(B)
z80.writeByte(tempaddr, B)
break
case 0x39: /* LD C,SRL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(C)
z80.writeByte(tempaddr, C)
break
case 0x3a: /* LD D,SRL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(D)
z80.writeByte(tempaddr, D)
break
case 0x3b: /* LD E,SRL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(E)
z80.writeByte(tempaddr, E)
break
case 0x3c: /* LD H,SRL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(H)
z80.writeByte(tempaddr, H)
break
case 0x3d: /* LD L,SRL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(L)
z80.writeByte(tempaddr, L)
break
case 0x3e: /* SRL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x3f: /* LD A,SRL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(A)
z80.writeByte(tempaddr, A)
break
case 0x40:
case 0x41:
case 0x42:
case 0x43:
case 0x44:
case 0x45:
case 0x46:
case 0x47: /* BIT 0,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(0, bytetemp, tempaddr)
break
case 0x48:
case 0x49:
case 0x4a:
case 0x4b:
case 0x4c:
case 0x4d:
case 0x4e:
case 0x4f: /* BIT 1,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(1, bytetemp, tempaddr)
break
case 0x50:
case 0x51:
case 0x52:
case 0x53:
case 0x54:
case 0x55:
case 0x56:
case 0x57: /* BIT 2,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(2, bytetemp, tempaddr)
break
case 0x58:
case 0x59:
case 0x5a:
case 0x5b:
case 0x5c:
case 0x5d:
case 0x5e:
case 0x5f: /* BIT 3,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(3, bytetemp, tempaddr)
break
case 0x60:
case 0x61:
case 0x62:
case 0x63:
case 0x64:
case 0x65:
case 0x66:
case 0x67: /* BIT 4,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(4, bytetemp, tempaddr)
break
case 0x68:
case 0x69:
case 0x6a:
case 0x6b:
case 0x6c:
case 0x6d:
case 0x6e:
case 0x6f: /* BIT 5,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(5, bytetemp, tempaddr)
break
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x76:
case 0x77: /* BIT 6,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(6, bytetemp, tempaddr)
break
case 0x78:
case 0x79:
case 0x7a:
case 0x7b:
case 0x7c:
case 0x7d:
case 0x7e:
case 0x7f: /* BIT 7,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(7, bytetemp, tempaddr)
break
case 0x80: /* LD B,RES 0,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x81: /* LD C,RES 0,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x82: /* LD D,RES 0,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x83: /* LD E,RES 0,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x84: /* LD H,RES 0,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x85: /* LD L,RES 0,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x86: /* RES 0,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfe)
break
case 0x87: /* LD A,RES 0,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x88: /* LD B,RES 1,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x89: /* LD C,RES 1,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x8a: /* LD D,RES 1,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x8b: /* LD E,RES 1,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x8c: /* LD H,RES 1,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x8d: /* LD L,RES 1,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x8e: /* RES 1,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfd)
break
case 0x8f: /* LD A,RES 1,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x90: /* LD B,RES 2,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x91: /* LD C,RES 2,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x92: /* LD D,RES 2,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x93: /* LD E,RES 2,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x94: /* LD H,RES 2,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x95: /* LD L,RES 2,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x96: /* RES 2,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfb)
break
case 0x97: /* LD A,RES 2,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x98: /* LD B,RES 3,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x99: /* LD C,RES 3,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x9a: /* LD D,RES 3,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x9b: /* LD E,RES 3,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x9c: /* LD H,RES 3,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x9d: /* LD L,RES 3,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x9e: /* RES 3,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xf7)
break
case 0x9f: /* LD A,RES 3,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xa0: /* LD B,RES 4,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xa1: /* LD C,RES 4,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xa2: /* LD D,RES 4,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xa3: /* LD E,RES 4,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xa4: /* LD H,RES 4,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xa5: /* LD L,RES 4,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xa6: /* RES 4,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xef)
break
case 0xa7: /* LD A,RES 4,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xa8: /* LD B,RES 5,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xa9: /* LD C,RES 5,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xaa: /* LD D,RES 5,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xab: /* LD E,RES 5,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xac: /* LD H,RES 5,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xad: /* LD L,RES 5,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xae: /* RES 5,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xdf)
break
case 0xaf: /* LD A,RES 5,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xb0: /* LD B,RES 6,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xb1: /* LD C,RES 6,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xb2: /* LD D,RES 6,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xb3: /* LD E,RES 6,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xb4: /* LD H,RES 6,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xb5: /* LD L,RES 6,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xb6: /* RES 6,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xbf)
break
case 0xb7: /* LD A,RES 6,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xb8: /* LD B,RES 7,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xb9: /* LD C,RES 7,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xba: /* LD D,RES 7,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xbb: /* LD E,RES 7,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xbc: /* LD H,RES 7,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xbd: /* LD L,RES 7,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xbe: /* RES 7,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0x7f)
break
case 0xbf: /* LD A,RES 7,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xc0: /* LD B,SET 0,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xc1: /* LD C,SET 0,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xc2: /* LD D,SET 0,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xc3: /* LD E,SET 0,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xc4: /* LD H,SET 0,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xc5: /* LD L,SET 0,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xc6: /* SET 0,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x01)
break
case 0xc7: /* LD A,SET 0,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xc8: /* LD B,SET 1,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xc9: /* LD C,SET 1,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xca: /* LD D,SET 1,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xcb: /* LD E,SET 1,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xcc: /* LD H,SET 1,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xcd: /* LD L,SET 1,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xce: /* SET 1,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x02)
break
case 0xcf: /* LD A,SET 1,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xd0: /* LD B,SET 2,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xd1: /* LD C,SET 2,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xd2: /* LD D,SET 2,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xd3: /* LD E,SET 2,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xd4: /* LD H,SET 2,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xd5: /* LD L,SET 2,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xd6: /* SET 2,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x04)
break
case 0xd7: /* LD A,SET 2,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xd8: /* LD B,SET 3,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xd9: /* LD C,SET 3,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xda: /* LD D,SET 3,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xdb: /* LD E,SET 3,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xdc: /* LD H,SET 3,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xdd: /* LD L,SET 3,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xde: /* SET 3,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x08)
break
case 0xdf: /* LD A,SET 3,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xe0: /* LD B,SET 4,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xe1: /* LD C,SET 4,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xe2: /* LD D,SET 4,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xe3: /* LD E,SET 4,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xe4: /* LD H,SET 4,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xe5: /* LD L,SET 4,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xe6: /* SET 4,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x10)
break
case 0xe7: /* LD A,SET 4,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xe8: /* LD B,SET 5,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xe9: /* LD C,SET 5,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xea: /* LD D,SET 5,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xeb: /* LD E,SET 5,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xec: /* LD H,SET 5,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xed: /* LD L,SET 5,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xee: /* SET 5,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x20)
break
case 0xef: /* LD A,SET 5,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xf0: /* LD B,SET 6,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xf1: /* LD C,SET 6,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xf2: /* LD D,SET 6,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xf3: /* LD E,SET 6,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xf4: /* LD H,SET 6,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xf5: /* LD L,SET 6,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xf6: /* SET 6,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x40)
break
case 0xf7: /* LD A,SET 6,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xf8: /* LD B,SET 7,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xf9: /* LD C,SET 7,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xfa: /* LD D,SET 7,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xfb: /* LD E,SET 7,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xfc: /* LD H,SET 7,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xfd: /* LD L,SET 7,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xfe: /* SET 7,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x80)
break
case 0xff: /* LD A,SET 7,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
}
break
case 0xe1: /* POP REGISTER */
POP16(REGISTERL, REGISTERH)
break
case 0xe3: /* EX (SP),REGISTER */
var bytetempl, bytetemph byte
bytetempl = z80.readByte(z80.SP())
bytetemph = z80.readByte(z80.SP() + 1)
z80.contendReadNoMReq(z80.SP()+1, 1)
z80.writeByte(z80.SP()+1, REGISTERH)
z80.writeByte(z80, SP(), REGISTERL)
z80.contendWriteNoMReq(z80.SP(), 1)
z80.contendWriteNoMreq(z80.SP(), 1)
REGISTERL = bytetempl
REGISTERH = bytetemph
break
case 0xe5: /* PUSH REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(REGISTERL, REGISTERH)
break
case 0xe9: /* JP REGISTER */
z80.pc = REGISTER /* NB: NOT INDIRECT! */
break
case 0xf9: /* LD SP,REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SP = REGISTER
break
default: /* Instruction did not involve H or L, so backtrack
one instruction and parse again */
z80.pc--
z80.r--
opcode = opcode2
goto end_opcode
}
}
break
case 0xde: /* SBC A,nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
SBC(bytetemp)
}
break
case 0xdf: /* RST 18 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x18)
break
case 0xe0: /* RET PO */
z80.contendReadNoMReq(z80.IR(), 1)
if !(z80.f & FLAG_P) {
RET()
}
break
case 0xe1: /* POP HL */
POP16(L, H)
break
case 0xe2: /* JP PO,nnnn */
if !(z80.f & FLAG_P) {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xe3: /* EX (SP),HL */
var bytetempl, bytetemph byte
bytetempl = z80.readByte(z80.SP())
bytetemph = z80.readByte(z80.SP() + 1)
z80.contendReadNoMReq(z80.SP()+1, 1)
z80.writeByte(z80.SP()+1, H)
z80.writeByte(z80, SP(), L)
z80.contendWriteNoMReq(z80.SP(), 1)
z80.contendWriteNoMreq(z80.SP(), 1)
L = bytetempl
H = bytetemph
break
case 0xe4: /* CALL PO,nnnn */
if !(z80.f & FLAG_P) {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xe5: /* PUSH HL */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(L, H)
break
case 0xe6: /* AND nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
AND(bytetemp)
}
break
case 0xe7: /* RST 20 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x20)
break
case 0xe8: /* RET PE */
z80.contendReadNoMReq(z80.IR(), 1)
if z80.f & FLAG_P {
RET()
}
break
case 0xe9: /* JP HL */
z80.pc = HL /* NB: NOT INDIRECT! */
break
case 0xea: /* JP PE,nnnn */
if z80.f & FLAG_P {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xeb: /* EX DE,HL */
var wordtemp uint16 = z80.DE()
z80.setDE(z80.HL())
z80.setHL(wordtemp)
break
case 0xec: /* CALL PE,nnnn */
if z80.f & FLAG_P {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xed: /* shift ED */
{
var opcode2 byte
z80.contendRead(z80.pc, 4)
opcode2 = z80.readByteInternal(z80.pc)
z80.pc++
z80.r++
switch opcode2 {
/* z80_ed.c: Z80 CBxx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_ed.dat',
and included in 'z80_ops.c' */
case 0x40: /* IN B,(C) */
Z80_IN(B, BC)
break
case 0x41: /* OUT (C),B */
writeport(BC, B)
break
case 0x42: /* SBC HL,BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SBC16(BC)
break
case 0x43: /* LD (nnnn),BC */
LD16_NNRR(C, B)
break
case 0x44:
case 0x4c:
case 0x54:
case 0x5c:
case 0x64:
case 0x6c:
case 0x74:
case 0x7c: /* NEG */
bytetemp := z80.a
z80.a = 0
SUB(bytetemp)
break
case 0x45:
case 0x4d:
case 0x55:
case 0x5d:
case 0x65:
case 0x6d:
case 0x75:
case 0x7d: /* RETN */
z80.iff1, z80.iff2 = 0, 0
RET()
break
case 0x46:
case 0x4e:
case 0x66:
case 0x6e: /* IM 0 */
IM = 0
break
case 0x47: /* LD I,A */
z80.contendReadNoMReq(z80.IR(), 1)
I = A
break
case 0x48: /* IN C,(C) */
Z80_IN(C, BC)
break
case 0x49: /* OUT (C),C */
writeport(BC, C)
break
case 0x4a: /* ADC HL,BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADC16(BC)
break
case 0x4b: /* LD BC,(nnnn) */
LD16_RRNN(C, B)
break
case 0x4f: /* LD R,A */
z80.contendReadNoMReq(z80.IR(), 1)
/* Keep the RZX instruction counter right */
rzx_instructions_offset += (R - z80.a)
z80.r, z80.r7 = z80.a, z80.a
break
case 0x50: /* IN D,(C) */
Z80_IN(D, BC)
break
case 0x51: /* OUT (C),D */
writeport(BC, D)
break
case 0x52: /* SBC HL,DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SBC16(DE)
break
case 0x53: /* LD (nnnn),DE */
LD16_NNRR(E, D)
break
case 0x56:
case 0x76: /* IM 1 */
IM = 1
break
case 0x57: /* LD A,I */
z80.contendReadNoMReq(z80.IR(), 1)
A = I
z80.f = (z80.f & FLAG_C) | z80.sz53Table[z80.a] | ternOpB(IFF2 == 1, FLAG_V, 0)
break
case 0x58: /* IN E,(C) */
Z80_IN(E, BC)
break
case 0x59: /* OUT (C),E */
writeport(BC, E)
break
case 0x5a: /* ADC HL,DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADC16(DE)
break
case 0x5b: /* LD DE,(nnnn) */
LD16_RRNN(E, D)
break
case 0x5e:
case 0x7e: /* IM 2 */
IM = 2
break
case 0x5f: /* LD A,R */
z80.contendReadNoMReq(z80.IR(), 1)
z80.a = (R & 0x7f) | (R7 & 0x80)
z80.f = (z80.f & FLAG_C) | z80.sz53Table[z80.a] | ternOpB(IFF2 == 1, FLAG_V, 0)
break
case 0x60: /* IN H,(C) */
Z80_IN(H, BC)
break
case 0x61: /* OUT (C),H */
writeport(BC, H)
break
case 0x62: /* SBC HL,HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SBC16(HL)
break
case 0x63: /* LD (nnnn),HL */
LD16_NNRR(L, H)
break
case 0x67: /* RRD */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), (z80.a<<4)|(bytetemp>>4))
z80.a = (z80.a & 0xf0) | (bytetemp & 0x0f)
z80.f = (z80.f & FLAG_C) | z80.sz53pTable[z80.a]
break
case 0x68: /* IN L,(C) */
Z80_IN(L, BC)
break
case 0x69: /* OUT (C),L */
writeport(BC, L)
break
case 0x6a: /* ADC HL,HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADC16(HL)
break
case 0x6b: /* LD HL,(nnnn) */
LD16_RRNN(L, H)
break
case 0x6f: /* RLD */
var bytetemp byte = z80.readByte(z80.HL())
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.writeByte(z80.HL(), (bytetemp<<4)|(z80.a&0x0f))
z80.a = (z80.a & 0xf0) | (bytetemp >> 4)
z80.f = (z80.f & FLAG_C) | z80.sz53pTable[z80.a]
break
case 0x70: /* IN F,(C) */
var bytetemp byte
Z80_IN(bytetemp, BC)
break
case 0x71: /* OUT (C),0 */
writeport(BC, 0)
break
case 0x72: /* SBC HL,SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SBC16(SP)
break
case 0x73: /* LD (nnnn),SP */
LD16_NNRR(SPL, SPH)
break
case 0x78: /* IN A,(C) */
Z80_IN(A, BC)
break
case 0x79: /* OUT (C),A */
writeport(BC, A)
break
case 0x7a: /* ADC HL,SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADC16(SP)
break
case 0x7b: /* LD SP,(nnnn) */
LD16_RRNN(SPL, SPH)
break
case 0xa0: /* LDI */
var bytetemp byte = z80.readByte(z80.HL())
BC--
z80.writeByte(DE, bytetemp)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
DE++
HL++
bytetemp += z80.a
z80.f = (z80.f & (FLAG_C | FLAG_Z | FLAG_S)) | ternOpB(BC == 1, FLAG_V, 0) |
(bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
break
case 0xa1: /* CPI */
var value, bytetemp, lookup byte = z80.readByte(z80.HL()), z80.a - value, ((z80.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
HL++
BC--
z80.f = (z80.f & FLAG_C) | ternOpB(BC == 1, FLAG_V|FLAG_N, FLAG_N) | z80.halfCarrySubTable[lookup] | ternOpB(bytetemp == 1, 0, FLAG_Z) | (bytetemp & FLAG_S)
if z80.f & FLAG_H {
bytetemp--
}
z80.f |= (bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
break
case 0xa2: /* INI */
var initemp, initemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
initemp = readport(BC)
z80.writeByte(z80.HL(), initemp)
z80.b--
HL++
initemp2 = initemp + C + 1
z80.f = ternOpB((initemp&0x80) == 1, FLAG_N, 0) | ternOpB(initemp2 < initemp, FLAG_H|FLAG_C, 0) | ternOpB(z80.parityTable[(initemp2&0x07)^B] == 1, FLAG_P, 0) | z80.sz53Table[B]
break
case 0xa3: /* OUTI */
var outitemp, outitemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
outitemp = z80.readByte(z80.HL())
z80.b-- /* This does happen first, despite what the specs say */
writeport(BC, outitemp)
HL++
outitemp2 = outitemp + L
z80.f = ternOpB((outitemp&0x80) == 1, FLAG_N, 0) |
ternOpB(outitemp2 < outitemp, FLAG_H|FLAG_C, 0) |
ternopB(z80.parityTable[(outitemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
break
case 0xa8: /* LDD */
var bytetemp byte = z80.readByte(z80.HL())
BC--
z80.writeByte(DE, bytetemp)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
DE--
HL--
bytetemp += z80.a
z80.f = (z80.f & (FLAG_C | FLAG_Z | FLAG_S)) | ternOpB(BC == 1, FLAG_V, 0) |
(bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
break
case 0xa9: /* CPD */
var value, bytetemp, lookup byte = z80.readByte(z80.HL()), z80.a - value, ((z80.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
HL--
BC--
z80.f = (z80.f & FLAG_C) | ternOpB(BC == 1, FLAG_V|FLAG_N, FLAG_N) | z80.halfCarrySubTable[lookup] | ternOpB(bytetemp == 1, 0, FLAG_Z) | (bytetemp & FLAG_S)
if z80.f & FLAG_H {
bytetemp--
}
z80.f |= (bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
break
case 0xaa: /* IND */
var initemp, initemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
initemp = readport(BC)
z80.writeByte(z80.HL(), initemp)
z80.b--
HL--
initemp2 = initemp + C - 1
z80.f = ternOpB((initemp&0x80) == 1, FLAG_N, 0) | ternOpB(initemp2 < initemp, FLAG_H|FLAG_C, 0) | ternOpB(z80.parityTable[(initemp2&0x07)^B] == 1, FLAG_P, 0) | z80.sz53Table[B]
break
case 0xab: /* OUTD */
var outitemp, outitemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
outitemp = z80.readByte(z80.HL())
z80.b-- /* This does happen first, despite what the specs say */
writeport(BC, outitemp)
HL--
outitemp2 = outitemp + L
z80.f = ternOpB((outitemp&0x80) == 1, FLAG_N, 0) |
ternOpB(outitemp2 < outitemp, FLAG_H|FLAG_C, 0) |
ternopB(z80.parityTable[(outitemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
break
case 0xb0: /* LDIR */
var bytetemp byte = z80.readByte(z80.HL())
z80.writeByte(DE, bytetemp)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
BC--
bytetemp += z80.a
z80.f = (z80.f & (FLAG_C | FLAG_Z | FLAG_S)) | ternOp(BC == 1, FLAG_V, 0) | (bytetemp & FLAG_3) | ternOp((bytetemp&0x02 == 1), FLAG_5, 0)
if BC {
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
z80.pc -= 2
}
HL++
DE++
break
case 0xb1: /* CPIR */
var value, bytetemp, lookup byte = z80.readByte(z80.HL()), z80.a - value, ((z80.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.decBC()
z80.f = (z80.f & FLAG_C) | (ternOpB(BC == 1, (FLAG_V | FLAG_N), FLAG_N)) | z80.halfCarrySubTable[lookup] | (ternOpB(bytetemp == 1, 0, FLAG_Z)) | (bytetemp & FLAG_S)
if z80.f & FLAG_H {
bytetemp--
}
z80.f |= (bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
if (z80.f & (FLAG_V | FLAG_Z)) == FLAG_V {
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.pc -= 2
}
HL++
break
case 0xb2: /* INIR */
var initemp, initemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
initemp = readport(BC)
z80.writeByte(z80.HL(), initemp)
z80.b--
initemp2 = initemp + C + 1
z80.f = ternOpB(initemp&0x80 == 1, FLAG_N, 0) |
ternOpB(initemp2 < initemp, FLAG_H|FLAG_C, 0) |
ternOpB(z80.parityTable[(initemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
if B {
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.pc -= 2
}
HL++
break
case 0xb3: /* OTIR */
var outitemp, outitemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
outitemp = z80.readByte(z80.HL())
z80.b-- /* This does happen first, despite what the specs say */
writeport(BC, outitemp)
HL++
outitemp2 = outitemp + L
z80.f = ternOpB((outitemp&0x80) == 1, FLAG_N, 0) |
ternOpB(outitemp2 < outitemp, FLAG_H|FLAG_C, 0) |
ternOpB(z80.parityTable[(outitemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
if B {
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.pc -= 2
}
break
case 0xb8: /* LDDR */
var bytetemp byte = z80.readByte(z80.HL())
z80.writeByte(DE, bytetemp)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
BC--
bytetemp += z80.a
z80.f = (z80.f & (FLAG_C | FLAG_Z | FLAG_S)) | ternOp(BC == 1, FLAG_V, 0) | (bytetemp & FLAG_3) | ternOp((bytetemp&0x02 == 1), FLAG_5, 0)
if BC {
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
contend_write_no_mreq(DE, 1)
z80.pc -= 2
}
HL--
DE--
break
case 0xb9: /* CPDR */
var value, bytetemp, lookup byte = z80.readByte(z80.HL()), z80.a - value, ((z80.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.decBC()
z80.f = (z80.f & FLAG_C) | (ternOpB(BC == 1, (FLAG_V | FLAG_N), FLAG_N)) | z80.halfCarrySubTable[lookup] | (ternOpB(bytetemp == 1, 0, FLAG_Z)) | (bytetemp & FLAG_S)
if z80.f & FLAG_H {
bytetemp--
}
z80.f |= (bytetemp & FLAG_3) | ternOpB((bytetemp&0x02) == 1, FLAG_5, 0)
if (z80.f & (FLAG_V | FLAG_Z)) == FLAG_V {
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.contendReadNoMReq(z80.HL(), 1)
z80.pc -= 2
}
HL--
break
case 0xba: /* INDR */
var initemp, initemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
initemp = readport(BC)
z80.writeByte(z80.HL(), initemp)
z80.b--
initemp2 = initemp + C - 1
z80.f = ternOpB(initemp&0x80 == 1, FLAG_N, 0) |
ternOpB(initemp2 < initemp, FLAG_H|FLAG_C, 0) |
ternOpB(z80.parityTable[(initemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
if B {
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.contendWriteNoMReq(z80.HL(), 1)
z80.pc -= 2
}
HL--
break
case 0xbb: /* OTDR */
var outitemp, outitemp2 byte
z80.contendReadNoMReq(z80.IR(), 1)
outitemp = z80.readByte(z80.HL())
z80.b-- /* This does happen first, despite what the specs say */
writeport(BC, outitemp)
HL--
outitemp2 = outitemp + L
z80.f = ternOpB((outitemp&0x80) == 1, FLAG_N, 0) |
ternOpB(outitemp2 < outitemp, FLAG_H|FLAG_C, 0) |
ternOpB(z80.parityTable[(outitemp2&0x07)^B] == 1, FLAG_P, 0) |
z80.sz53Table[B]
if B {
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.contendReadNoMReq(BC, 1)
z80.pc -= 2
}
break
case 0xfb: /* slttrap */
slt_trap(z80.HL(), A)
break
default: /* All other opcodes are NOPD */
break
}
}
break
case 0xee: /* XOR A,nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
XOR(bytetemp)
}
break
case 0xef: /* RST 28 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x28)
break
case 0xf0: /* RET P */
z80.contendReadNoMReq(z80.IR(), 1)
if !(z80.f & FLAG_S) {
RET()
}
break
case 0xf1: /* POP AF */
POP16(F, A)
break
case 0xf2: /* JP P,nnnn */
if !(z80.f & FLAG_S) {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xf3: /* DI */
z80.iff1, z80.iff2 = 0, 0
break
case 0xf4: /* CALL P,nnnn */
if !(z80.f & FLAG_S) {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xf5: /* PUSH AF */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(F, A)
break
case 0xf6: /* OR nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
OR(bytetemp)
}
break
case 0xf7: /* RST 30 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x30)
break
case 0xf8: /* RET M */
z80.contendReadNoMReq(z80.IR(), 1)
if z80.f & FLAG_S {
RET()
}
break
case 0xf9: /* LD SP,HL */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SP = HL
break
case 0xfa: /* JP M,nnnn */
if z80.f & FLAG_S {
JP()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xfb: /* EI */
/* Interrupts are not accepted immediately after an EI, but are
accepted after the next instruction */
z80.iff1, z80.iff2 = 0, 0
z80.interrupts_enabled_at = tstates
event_add(tstates+1, z80_interrupt_event)
break
case 0xfc: /* CALL M,nnnn */
if z80.f & FLAG_S {
CALL()
} else {
z80.contendRead(z80.pc, 3)
z80.contendRead(z80.pc+1, 3)
z80.pc += 2
}
break
case 0xfd: /* shift FD */
{
var opcode2 byte
z80.contendRead(z80.pc, 4)
opcode2 = z80.readByteInternal(z80.pc)
z80.pc++
z80.r++
switch opcode2 {
/* z80_ddfd.c Z80 {DD,FD}xx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_ddfd.dat',
and included in 'z80_ops.c' */
case 0x09: /* ADD REGISTER,BC */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, BC)
break
case 0x19: /* ADD REGISTER,DE */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, DE)
break
case 0x21: /* LD REGISTER,nnnn */
REGISTERL = z80.readByte(z80.pc)
z80.pc++
REGISTERH = z80.readByte(z80.pc)
z80.pc++
break
case 0x22: /* LD (nnnn),REGISTER */
LD16_NNRR(REGISTERL, REGISTERH)
break
case 0x23: /* INC REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.incREGISTER()
break
case 0x24: /* INC REGISTERH */
z80.incREGISTERH()
break
case 0x25: /* DEC REGISTERH */
z80.decREGISTERH()
break
case 0x26: /* LD REGISTERH,nn */
REGISTERH = z80.readByte(z80.pc)
z80.pc++
break
case 0x29: /* ADD REGISTER,REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, REGISTER)
break
case 0x2a: /* LD REGISTER,(nnnn) */
LD16_RRNN(REGISTERL, REGISTERH)
break
case 0x2b: /* DEC REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.decREGISTER()
break
case 0x2c: /* INC REGISTERL */
z80.incREGISTERL()
break
case 0x2d: /* DEC REGISTERL */
z80.decREGISTERL()
break
case 0x2e: /* LD REGISTERL,nn */
REGISTERL = z80.readByte(z80.pc)
z80.pc++
break
case 0x34: /* INC (REGISTER+dd) */
var offset, bytetemp byte
var wordtemp uint16
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
wordtemp = REGISTER + signExtend(offset)
bytetemp = z80.readByte(wordtemp)
z80.contendReadNoMReq(wordtemp, 1)
INC(bytetemp)
z80.writeByte(wordtemp, bytetemp)
break
case 0x35: /* DEC (REGISTER+dd) */
var offset, bytetemp byte
var wordtemp uint16
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
wordtemp = REGISTER + signExtend(offset)
bytetemp = z80.readByte(wordtemp)
z80.contendReadNoMReq(wordtemp, 1)
DEC(bytetemp)
z80.writeByte(wordtemp, bytetemp)
break
case 0x36: /* LD (REGISTER+dd),nn */
offset := z80.readByte(z80.pc)
z80.pc++
value := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), value)
break
case 0x39: /* ADD REGISTER,SP */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
ADD16(REGISTER, SP)
break
case 0x44: /* LD B,REGISTERH */
B = REGISTERH
break
case 0x45: /* LD B,REGISTERL */
B = REGISTERL
break
case 0x46: /* LD B,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
B = z80.readByte(REGISTER + signExtend(offset))
break
case 0x4c: /* LD C,REGISTERH */
C = REGISTERH
break
case 0x4d: /* LD C,REGISTERL */
C = REGISTERL
break
case 0x4e: /* LD C,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
C = z80.readByte(REGISTER + signExtend(offset))
break
case 0x54: /* LD D,REGISTERH */
D = REGISTERH
break
case 0x55: /* LD D,REGISTERL */
D = REGISTERL
break
case 0x56: /* LD D,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
D = z80.readByte(REGISTER + signExtend(offset))
break
case 0x5c: /* LD E,REGISTERH */
E = REGISTERH
break
case 0x5d: /* LD E,REGISTERL */
E = REGISTERL
break
case 0x5e: /* LD E,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
E = z80.readByte(REGISTER + signExtend(offset))
break
case 0x60: /* LD REGISTERH,B */
REGISTERH = B
break
case 0x61: /* LD REGISTERH,C */
REGISTERH = C
break
case 0x62: /* LD REGISTERH,D */
REGISTERH = D
break
case 0x63: /* LD REGISTERH,E */
REGISTERH = E
break
case 0x64: /* LD REGISTERH,REGISTERH */
break
case 0x65: /* LD REGISTERH,REGISTERL */
REGISTERH = REGISTERL
break
case 0x66: /* LD H,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
H = z80.readByte(REGISTER + signExtend(offset))
break
case 0x67: /* LD REGISTERH,A */
REGISTERH = A
break
case 0x68: /* LD REGISTERL,B */
REGISTERL = B
break
case 0x69: /* LD REGISTERL,C */
REGISTERL = C
break
case 0x6a: /* LD REGISTERL,D */
REGISTERL = D
break
case 0x6b: /* LD REGISTERL,E */
REGISTERL = E
break
case 0x6c: /* LD REGISTERL,REGISTERH */
REGISTERL = REGISTERH
break
case 0x6d: /* LD REGISTERL,REGISTERL */
break
case 0x6e: /* LD L,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
L = z80.readByte(REGISTER + signExtend(offset))
break
case 0x6f: /* LD REGISTERL,A */
REGISTERL = A
break
case 0x70: /* LD (REGISTER+dd),B */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), B)
break
case 0x71: /* LD (REGISTER+dd),C */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), C)
break
case 0x72: /* LD (REGISTER+dd),D */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), D)
break
case 0x73: /* LD (REGISTER+dd),E */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), E)
break
case 0x74: /* LD (REGISTER+dd),H */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), H)
break
case 0x75: /* LD (REGISTER+dd),L */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), L)
break
case 0x77: /* LD (REGISTER+dd),A */
offset := z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
z80.writeByte(REGISTER+signExtend(offset), A)
break
case 0x7c: /* LD A,REGISTERH */
A = REGISTERH
break
case 0x7d: /* LD A,REGISTERL */
A = REGISTERL
break
case 0x7e: /* LD A,(REGISTER+dd) */
var offset byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
A = z80.readByte(REGISTER + signExtend(offset))
break
case 0x84: /* ADD A,REGISTERH */
ADD(REGISTERH)
break
case 0x85: /* ADD A,REGISTERL */
ADD(REGISTERL)
break
case 0x86: /* ADD A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
ADD(bytetemp)
break
case 0x8c: /* ADC A,REGISTERH */
ADC(REGISTERH)
break
case 0x8d: /* ADC A,REGISTERL */
ADC(REGISTERL)
break
case 0x8e: /* ADC A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
ADC(bytetemp)
break
case 0x94: /* SUB A,REGISTERH */
SUB(REGISTERH)
break
case 0x95: /* SUB A,REGISTERL */
SUB(REGISTERL)
break
case 0x96: /* SUB A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
SUB(bytetemp)
break
case 0x9c: /* SBC A,REGISTERH */
SBC(REGISTERH)
break
case 0x9d: /* SBC A,REGISTERL */
SBC(REGISTERL)
break
case 0x9e: /* SBC A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
SBC(bytetemp)
break
case 0xa4: /* AND A,REGISTERH */
AND(REGISTERH)
break
case 0xa5: /* AND A,REGISTERL */
AND(REGISTERL)
break
case 0xa6: /* AND A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
AND(bytetemp)
break
case 0xac: /* XOR A,REGISTERH */
XOR(REGISTERH)
break
case 0xad: /* XOR A,REGISTERL */
XOR(REGISTERL)
break
case 0xae: /* XOR A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
XOR(bytetemp)
break
case 0xb4: /* OR A,REGISTERH */
OR(REGISTERH)
break
case 0xb5: /* OR A,REGISTERL */
OR(REGISTERL)
break
case 0xb6: /* OR A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
OR(bytetemp)
break
case 0xbc: /* CP A,REGISTERH */
CP(REGISTERH)
break
case 0xbd: /* CP A,REGISTERL */
CP(REGISTERL)
break
case 0xbe: /* CP A,(REGISTER+dd) */
var offset, bytetemp byte
offset = z80.readByte(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
bytetemp = z80.readByte(REGISTER + signExtend(offset))
CP(bytetemp)
break
case 0xcb: /* shift DDFDCB */
var tempaddr uint16
var opcode3 byte
z80.contendRead(z80.pc, 3)
tempaddr = REGISTER + signExtend(z80.readByteInternal(z80.pc))
z80.pc++
z80.contendRead(z80.pc, 3)
opcode3 = z80.readByteInternal(z80.pc)
z80.contendReadNoMReq(z80.pc, 1)
z80.contendReadNoMReq(z80.pc, 1)
z80.pc++
switch opcode3 {
/* z80_ddfdcb.c Z80 {DD,FD}CBxx opcodes
Copyright (c) 1999-2003 Philip Kendall
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
/* NB: this file is autogenerated by './z80.pl' from 'opcodes_ddfdcb.dat',
and included in 'z80_ops.c' */
case 0x00: /* LD B,RLC (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(B)
z80.writeByte(tempaddr, B)
break
case 0x01: /* LD C,RLC (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(C)
z80.writeByte(tempaddr, C)
break
case 0x02: /* LD D,RLC (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(D)
z80.writeByte(tempaddr, D)
break
case 0x03: /* LD E,RLC (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(E)
z80.writeByte(tempaddr, E)
break
case 0x04: /* LD H,RLC (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(H)
z80.writeByte(tempaddr, H)
break
case 0x05: /* LD L,RLC (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(L)
z80.writeByte(tempaddr, L)
break
case 0x06: /* RLC (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x07: /* LD A,RLC (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RLC(A)
z80.writeByte(tempaddr, A)
break
case 0x08: /* LD B,RRC (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(B)
z80.writeByte(tempaddr, B)
break
case 0x09: /* LD C,RRC (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(C)
z80.writeByte(tempaddr, C)
break
case 0x0a: /* LD D,RRC (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(D)
z80.writeByte(tempaddr, D)
break
case 0x0b: /* LD E,RRC (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(E)
z80.writeByte(tempaddr, E)
break
case 0x0c: /* LD H,RRC (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(H)
z80.writeByte(tempaddr, H)
break
case 0x0d: /* LD L,RRC (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(L)
z80.writeByte(tempaddr, L)
break
case 0x0e: /* RRC (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x0f: /* LD A,RRC (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RRC(A)
z80.writeByte(tempaddr, A)
break
case 0x10: /* LD B,RL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(B)
z80.writeByte(tempaddr, B)
break
case 0x11: /* LD C,RL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(C)
z80.writeByte(tempaddr, C)
break
case 0x12: /* LD D,RL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(D)
z80.writeByte(tempaddr, D)
break
case 0x13: /* LD E,RL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(E)
z80.writeByte(tempaddr, E)
break
case 0x14: /* LD H,RL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(H)
z80.writeByte(tempaddr, H)
break
case 0x15: /* LD L,RL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(L)
z80.writeByte(tempaddr, L)
break
case 0x16: /* RL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x17: /* LD A,RL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RL(A)
z80.writeByte(tempaddr, A)
break
case 0x18: /* LD B,RR (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(B)
z80.writeByte(tempaddr, B)
break
case 0x19: /* LD C,RR (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(C)
z80.writeByte(tempaddr, C)
break
case 0x1a: /* LD D,RR (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(D)
z80.writeByte(tempaddr, D)
break
case 0x1b: /* LD E,RR (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(E)
z80.writeByte(tempaddr, E)
break
case 0x1c: /* LD H,RR (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(H)
z80.writeByte(tempaddr, H)
break
case 0x1d: /* LD L,RR (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(L)
z80.writeByte(tempaddr, L)
break
case 0x1e: /* RR (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x1f: /* LD A,RR (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
RR(A)
z80.writeByte(tempaddr, A)
break
case 0x20: /* LD B,SLA (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(B)
z80.writeByte(tempaddr, B)
break
case 0x21: /* LD C,SLA (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(C)
z80.writeByte(tempaddr, C)
break
case 0x22: /* LD D,SLA (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(D)
z80.writeByte(tempaddr, D)
break
case 0x23: /* LD E,SLA (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(E)
z80.writeByte(tempaddr, E)
break
case 0x24: /* LD H,SLA (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(H)
z80.writeByte(tempaddr, H)
break
case 0x25: /* LD L,SLA (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(L)
z80.writeByte(tempaddr, L)
break
case 0x26: /* SLA (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x27: /* LD A,SLA (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLA(A)
z80.writeByte(tempaddr, A)
break
case 0x28: /* LD B,SRA (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(B)
z80.writeByte(tempaddr, B)
break
case 0x29: /* LD C,SRA (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(C)
z80.writeByte(tempaddr, C)
break
case 0x2a: /* LD D,SRA (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(D)
z80.writeByte(tempaddr, D)
break
case 0x2b: /* LD E,SRA (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(E)
z80.writeByte(tempaddr, E)
break
case 0x2c: /* LD H,SRA (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(H)
z80.writeByte(tempaddr, H)
break
case 0x2d: /* LD L,SRA (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(L)
z80.writeByte(tempaddr, L)
break
case 0x2e: /* SRA (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x2f: /* LD A,SRA (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRA(A)
z80.writeByte(tempaddr, A)
break
case 0x30: /* LD B,SLL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(B)
z80.writeByte(tempaddr, B)
break
case 0x31: /* LD C,SLL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(C)
z80.writeByte(tempaddr, C)
break
case 0x32: /* LD D,SLL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(D)
z80.writeByte(tempaddr, D)
break
case 0x33: /* LD E,SLL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(E)
z80.writeByte(tempaddr, E)
break
case 0x34: /* LD H,SLL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(H)
z80.writeByte(tempaddr, H)
break
case 0x35: /* LD L,SLL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(L)
z80.writeByte(tempaddr, L)
break
case 0x36: /* SLL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x37: /* LD A,SLL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SLL(A)
z80.writeByte(tempaddr, A)
break
case 0x38: /* LD B,SRL (REGISTER+dd) */
B = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(B)
z80.writeByte(tempaddr, B)
break
case 0x39: /* LD C,SRL (REGISTER+dd) */
C = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(C)
z80.writeByte(tempaddr, C)
break
case 0x3a: /* LD D,SRL (REGISTER+dd) */
D = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(D)
z80.writeByte(tempaddr, D)
break
case 0x3b: /* LD E,SRL (REGISTER+dd) */
E = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(E)
z80.writeByte(tempaddr, E)
break
case 0x3c: /* LD H,SRL (REGISTER+dd) */
H = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(H)
z80.writeByte(tempaddr, H)
break
case 0x3d: /* LD L,SRL (REGISTER+dd) */
L = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(L)
z80.writeByte(tempaddr, L)
break
case 0x3e: /* SRL (REGISTER+dd) */
var bytetemp byte = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(bytetemp)
z80.writeByte(tempaddr, bytetemp)
break
case 0x3f: /* LD A,SRL (REGISTER+dd) */
A = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
SRL(A)
z80.writeByte(tempaddr, A)
break
case 0x40:
case 0x41:
case 0x42:
case 0x43:
case 0x44:
case 0x45:
case 0x46:
case 0x47: /* BIT 0,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(0, bytetemp, tempaddr)
break
case 0x48:
case 0x49:
case 0x4a:
case 0x4b:
case 0x4c:
case 0x4d:
case 0x4e:
case 0x4f: /* BIT 1,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(1, bytetemp, tempaddr)
break
case 0x50:
case 0x51:
case 0x52:
case 0x53:
case 0x54:
case 0x55:
case 0x56:
case 0x57: /* BIT 2,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(2, bytetemp, tempaddr)
break
case 0x58:
case 0x59:
case 0x5a:
case 0x5b:
case 0x5c:
case 0x5d:
case 0x5e:
case 0x5f: /* BIT 3,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(3, bytetemp, tempaddr)
break
case 0x60:
case 0x61:
case 0x62:
case 0x63:
case 0x64:
case 0x65:
case 0x66:
case 0x67: /* BIT 4,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(4, bytetemp, tempaddr)
break
case 0x68:
case 0x69:
case 0x6a:
case 0x6b:
case 0x6c:
case 0x6d:
case 0x6e:
case 0x6f: /* BIT 5,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(5, bytetemp, tempaddr)
break
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x76:
case 0x77: /* BIT 6,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(6, bytetemp, tempaddr)
break
case 0x78:
case 0x79:
case 0x7a:
case 0x7b:
case 0x7c:
case 0x7d:
case 0x7e:
case 0x7f: /* BIT 7,(REGISTER+dd) */
bytetemp := z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
BIT_I(7, bytetemp, tempaddr)
break
case 0x80: /* LD B,RES 0,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x81: /* LD C,RES 0,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x82: /* LD D,RES 0,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x83: /* LD E,RES 0,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x84: /* LD H,RES 0,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x85: /* LD L,RES 0,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x86: /* RES 0,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfe)
break
case 0x87: /* LD A,RES 0,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfe
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x88: /* LD B,RES 1,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x89: /* LD C,RES 1,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x8a: /* LD D,RES 1,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x8b: /* LD E,RES 1,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x8c: /* LD H,RES 1,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x8d: /* LD L,RES 1,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x8e: /* RES 1,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfd)
break
case 0x8f: /* LD A,RES 1,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfd
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x90: /* LD B,RES 2,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x91: /* LD C,RES 2,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x92: /* LD D,RES 2,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x93: /* LD E,RES 2,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x94: /* LD H,RES 2,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x95: /* LD L,RES 2,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x96: /* RES 2,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xfb)
break
case 0x97: /* LD A,RES 2,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xfb
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0x98: /* LD B,RES 3,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0x99: /* LD C,RES 3,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0x9a: /* LD D,RES 3,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0x9b: /* LD E,RES 3,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0x9c: /* LD H,RES 3,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0x9d: /* LD L,RES 3,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0x9e: /* RES 3,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xf7)
break
case 0x9f: /* LD A,RES 3,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xf7
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xa0: /* LD B,RES 4,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xa1: /* LD C,RES 4,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xa2: /* LD D,RES 4,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xa3: /* LD E,RES 4,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xa4: /* LD H,RES 4,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xa5: /* LD L,RES 4,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xa6: /* RES 4,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xef)
break
case 0xa7: /* LD A,RES 4,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xef
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xa8: /* LD B,RES 5,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xa9: /* LD C,RES 5,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xaa: /* LD D,RES 5,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xab: /* LD E,RES 5,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xac: /* LD H,RES 5,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xad: /* LD L,RES 5,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xae: /* RES 5,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xdf)
break
case 0xaf: /* LD A,RES 5,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xdf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xb0: /* LD B,RES 6,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xb1: /* LD C,RES 6,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xb2: /* LD D,RES 6,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xb3: /* LD E,RES 6,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xb4: /* LD H,RES 6,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xb5: /* LD L,RES 6,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xb6: /* RES 6,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0xbf)
break
case 0xb7: /* LD A,RES 6,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0xbf
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xb8: /* LD B,RES 7,(REGISTER+dd) */
B = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xb9: /* LD C,RES 7,(REGISTER+dd) */
C = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xba: /* LD D,RES 7,(REGISTER+dd) */
D = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xbb: /* LD E,RES 7,(REGISTER+dd) */
E = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xbc: /* LD H,RES 7,(REGISTER+dd) */
H = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xbd: /* LD L,RES 7,(REGISTER+dd) */
L = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xbe: /* RES 7,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp&0x7f)
break
case 0xbf: /* LD A,RES 7,(REGISTER+dd) */
A = z80.readByte(tempaddr) & 0x7f
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xc0: /* LD B,SET 0,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xc1: /* LD C,SET 0,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xc2: /* LD D,SET 0,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xc3: /* LD E,SET 0,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xc4: /* LD H,SET 0,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xc5: /* LD L,SET 0,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xc6: /* SET 0,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x01)
break
case 0xc7: /* LD A,SET 0,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x01
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xc8: /* LD B,SET 1,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xc9: /* LD C,SET 1,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xca: /* LD D,SET 1,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xcb: /* LD E,SET 1,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xcc: /* LD H,SET 1,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xcd: /* LD L,SET 1,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xce: /* SET 1,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x02)
break
case 0xcf: /* LD A,SET 1,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x02
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xd0: /* LD B,SET 2,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xd1: /* LD C,SET 2,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xd2: /* LD D,SET 2,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xd3: /* LD E,SET 2,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xd4: /* LD H,SET 2,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xd5: /* LD L,SET 2,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xd6: /* SET 2,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x04)
break
case 0xd7: /* LD A,SET 2,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x04
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xd8: /* LD B,SET 3,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xd9: /* LD C,SET 3,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xda: /* LD D,SET 3,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xdb: /* LD E,SET 3,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xdc: /* LD H,SET 3,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xdd: /* LD L,SET 3,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xde: /* SET 3,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x08)
break
case 0xdf: /* LD A,SET 3,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x08
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xe0: /* LD B,SET 4,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xe1: /* LD C,SET 4,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xe2: /* LD D,SET 4,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xe3: /* LD E,SET 4,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xe4: /* LD H,SET 4,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xe5: /* LD L,SET 4,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xe6: /* SET 4,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x10)
break
case 0xe7: /* LD A,SET 4,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x10
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xe8: /* LD B,SET 5,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xe9: /* LD C,SET 5,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xea: /* LD D,SET 5,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xeb: /* LD E,SET 5,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xec: /* LD H,SET 5,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xed: /* LD L,SET 5,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xee: /* SET 5,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x20)
break
case 0xef: /* LD A,SET 5,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x20
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xf0: /* LD B,SET 6,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xf1: /* LD C,SET 6,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xf2: /* LD D,SET 6,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xf3: /* LD E,SET 6,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xf4: /* LD H,SET 6,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xf5: /* LD L,SET 6,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xf6: /* SET 6,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x40)
break
case 0xf7: /* LD A,SET 6,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x40
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
case 0xf8: /* LD B,SET 7,(REGISTER+dd) */
B = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, B)
break
case 0xf9: /* LD C,SET 7,(REGISTER+dd) */
C = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, C)
break
case 0xfa: /* LD D,SET 7,(REGISTER+dd) */
D = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, D)
break
case 0xfb: /* LD E,SET 7,(REGISTER+dd) */
E = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, E)
break
case 0xfc: /* LD H,SET 7,(REGISTER+dd) */
H = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, H)
break
case 0xfd: /* LD L,SET 7,(REGISTER+dd) */
L = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, L)
break
case 0xfe: /* SET 7,(REGISTER+dd) */
var bytetemp byte
bytetemp = z80.readByte(tempaddr)
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, bytetemp|0x80)
break
case 0xff: /* LD A,SET 7,(REGISTER+dd) */
A = z80.readByte(tempaddr) | 0x80
z80.contendReadNoMReq(tempaddr, 1)
z80.writeByte(tempaddr, A)
break
}
break
case 0xe1: /* POP REGISTER */
POP16(REGISTERL, REGISTERH)
break
case 0xe3: /* EX (SP),REGISTER */
var bytetempl, bytetemph byte
bytetempl = z80.readByte(z80.SP())
bytetemph = z80.readByte(z80.SP() + 1)
z80.contendReadNoMReq(z80.SP()+1, 1)
z80.writeByte(z80.SP()+1, REGISTERH)
z80.writeByte(z80, SP(), REGISTERL)
z80.contendWriteNoMReq(z80.SP(), 1)
z80.contendWriteNoMreq(z80.SP(), 1)
REGISTERL = bytetempl
REGISTERH = bytetemph
break
case 0xe5: /* PUSH REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
PUSH16(REGISTERL, REGISTERH)
break
case 0xe9: /* JP REGISTER */
z80.pc = REGISTER /* NB: NOT INDIRECT! */
break
case 0xf9: /* LD SP,REGISTER */
z80.contendReadNoMReq(z80.IR(), 1)
z80.contendReadNoMReq(z80.IR(), 1)
SP = REGISTER
break
default: /* Instruction did not involve H or L, so backtrack
one instruction and parse again */
z80.pc--
z80.r--
opcode = opcode2
goto end_opcode
}
}
break
case 0xfe: /* CP nn */
{
var bytetemp byte = z80.readByte(PC)
z80.pc++
CP(bytetemp)
}
break
case 0xff: /* RST 38 */
z80.contendReadNoMReq(z80.IR(), 1)
RST(0x38)
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment