mirror of
https://github.com/jscrane/r65emu.git
synced 2024-09-30 02:58:36 +00:00
changes from emul8
This commit is contained in:
parent
8b81f13e4d
commit
8c0e0dd22e
14
z80.cpp
14
z80.cpp
@ -160,7 +160,6 @@ void z80::_step_idx(EXT_OP f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void z80::_ddfd(uint16_t &ix, uint8_t &ixL, uint8_t &ixH, EXT_OP op) {
|
void z80::_ddfd(uint16_t &ix, uint8_t &ixL, uint8_t &ixH, EXT_OP op) {
|
||||||
uint16_t m;
|
|
||||||
switch (_fetch_op()) {
|
switch (_fetch_op()) {
|
||||||
case 0x09:
|
case 0x09:
|
||||||
_add16(ix, BC);
|
_add16(ix, BC);
|
||||||
@ -191,9 +190,7 @@ void z80::_ddfd(uint16_t &ix, uint8_t &ixL, uint8_t &ixH, EXT_OP op) {
|
|||||||
_add16(ix, ix);
|
_add16(ix, ix);
|
||||||
break;
|
break;
|
||||||
case 0x2a:
|
case 0x2a:
|
||||||
m = _rw(PC);
|
ix = _rwPC();
|
||||||
ix = _rw(m); PC += 2;
|
|
||||||
_memptr = m+1;
|
|
||||||
break;
|
break;
|
||||||
case 0x2b:
|
case 0x2b:
|
||||||
ix--;
|
ix--;
|
||||||
@ -432,13 +429,11 @@ void z80::ed() {
|
|||||||
switch (_fetch_op()) {
|
switch (_fetch_op()) {
|
||||||
case 0x40:
|
case 0x40:
|
||||||
B = _inr(BC);
|
B = _inr(BC);
|
||||||
_memptr = BC+1;
|
|
||||||
break;
|
break;
|
||||||
case 0x41:
|
case 0x41:
|
||||||
_outr(BC, B);
|
_outr(BC, B);
|
||||||
break;
|
break;
|
||||||
case 0x42:
|
case 0x42:
|
||||||
_memptr = HL+1;
|
|
||||||
_sbc16(BC);
|
_sbc16(BC);
|
||||||
break;
|
break;
|
||||||
case 0x43:
|
case 0x43:
|
||||||
@ -484,7 +479,6 @@ void z80::ed() {
|
|||||||
_outr(BC, C);
|
_outr(BC, C);
|
||||||
break;
|
break;
|
||||||
case 0x4a:
|
case 0x4a:
|
||||||
_memptr = HL+1;
|
|
||||||
_adc16(BC);
|
_adc16(BC);
|
||||||
break;
|
break;
|
||||||
case 0x4b:
|
case 0x4b:
|
||||||
@ -501,7 +495,6 @@ void z80::ed() {
|
|||||||
_outr(BC, D);
|
_outr(BC, D);
|
||||||
break;
|
break;
|
||||||
case 0x52:
|
case 0x52:
|
||||||
_memptr = HL+1;
|
|
||||||
_sbc16(DE);
|
_sbc16(DE);
|
||||||
break;
|
break;
|
||||||
case 0x53:
|
case 0x53:
|
||||||
@ -525,7 +518,6 @@ void z80::ed() {
|
|||||||
_outr(BC, E);
|
_outr(BC, E);
|
||||||
break;
|
break;
|
||||||
case 0x5a:
|
case 0x5a:
|
||||||
_memptr = HL+1;
|
|
||||||
_adc16(DE);
|
_adc16(DE);
|
||||||
break;
|
break;
|
||||||
case 0x5b:
|
case 0x5b:
|
||||||
@ -549,7 +541,6 @@ void z80::ed() {
|
|||||||
_outr(BC, H);
|
_outr(BC, H);
|
||||||
break;
|
break;
|
||||||
case 0x62:
|
case 0x62:
|
||||||
_memptr = HL+1;
|
|
||||||
_sbc16(HL);
|
_sbc16(HL);
|
||||||
break;
|
break;
|
||||||
case 0x63:
|
case 0x63:
|
||||||
@ -572,7 +563,6 @@ void z80::ed() {
|
|||||||
_outr(BC, L);
|
_outr(BC, L);
|
||||||
break;
|
break;
|
||||||
case 0x6a:
|
case 0x6a:
|
||||||
_memptr = HL+1;
|
|
||||||
_adc16(HL);
|
_adc16(HL);
|
||||||
break;
|
break;
|
||||||
case 0x6b:
|
case 0x6b:
|
||||||
@ -595,7 +585,6 @@ void z80::ed() {
|
|||||||
_outr(BC, 0);
|
_outr(BC, 0);
|
||||||
break;
|
break;
|
||||||
case 0x72:
|
case 0x72:
|
||||||
_memptr = HL+1;
|
|
||||||
_sbc16(SP);
|
_sbc16(SP);
|
||||||
break;
|
break;
|
||||||
case 0x73:
|
case 0x73:
|
||||||
@ -608,7 +597,6 @@ void z80::ed() {
|
|||||||
_outr(BC, A);
|
_outr(BC, A);
|
||||||
break;
|
break;
|
||||||
case 0x7a:
|
case 0x7a:
|
||||||
_memptr = HL+1;
|
|
||||||
_adc16(SP);
|
_adc16(SP);
|
||||||
break;
|
break;
|
||||||
case 0x7b:
|
case 0x7b:
|
||||||
|
74
z80.h
74
z80.h
@ -270,6 +270,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void _adc16(uint16_t w) {
|
inline void _adc16(uint16_t w) {
|
||||||
|
_memptr = HL+1;
|
||||||
_mc(IR, 1); _mc(IR, 1); _mc(IR, 1);
|
_mc(IR, 1); _mc(IR, 1); _mc(IR, 1);
|
||||||
_mc(IR, 1); _mc(IR, 1); _mc(IR, 1); _mc(IR, 1);
|
_mc(IR, 1); _mc(IR, 1); _mc(IR, 1); _mc(IR, 1);
|
||||||
unsigned long r = HL + w + flags.C;
|
unsigned long r = HL + w + flags.C;
|
||||||
@ -360,9 +361,8 @@ private:
|
|||||||
uint8_t b = _rb(PC);
|
uint8_t b = _rb(PC);
|
||||||
_mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1);
|
||||||
PC++;
|
PC++;
|
||||||
uint16_t w = _ads(a, o);
|
_memptr = _ads(a, o);
|
||||||
_sb(w, b);
|
_sb(_memptr, b);
|
||||||
_memptr = w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t _rbO(Memory::address a) {
|
inline uint8_t _rbO(Memory::address a) {
|
||||||
@ -370,9 +370,8 @@ private:
|
|||||||
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
||||||
_mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1);
|
||||||
PC++;
|
PC++;
|
||||||
uint16_t w = _ads(a, o);
|
_memptr = _ads(a, o);
|
||||||
_memptr = w;
|
return _rb(_memptr);
|
||||||
return _rb(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void _sbO(Memory::address a, uint8_t b) {
|
inline void _sbO(Memory::address a, uint8_t b) {
|
||||||
@ -380,16 +379,15 @@ private:
|
|||||||
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
||||||
_mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1);
|
||||||
PC++;
|
PC++;
|
||||||
uint16_t w = _ads(a, o);
|
_memptr = _ads(a, o);
|
||||||
_memptr = w;
|
_sb(_memptr, b);
|
||||||
_sb(w, b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void _exSP(uint16_t ®) {
|
inline void _exSP(uint16_t ®) {
|
||||||
uint16_t w = _pop();
|
_memptr = _pop();
|
||||||
_mc(SP-1, 1);
|
_mc(SP-1, 1);
|
||||||
_push(reg);
|
_push(reg);
|
||||||
_memptr = reg = w;
|
reg = _memptr;
|
||||||
_mc(SP, 1); _mc(SP, 1);
|
_mc(SP, 1); _mc(SP, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +417,7 @@ private:
|
|||||||
|
|
||||||
// 0x08
|
// 0x08
|
||||||
inline void exaf() { _exch(AF, AF_); }
|
inline void exaf() { _exch(AF, AF_); }
|
||||||
inline void addhlbc() { _memptr = HL+1; _add16(HL, BC); }
|
inline void addhlbc() { _add16(HL, BC); }
|
||||||
inline void ldaBC() { A = _rb(BC); _memptr = BC+1; }
|
inline void ldaBC() { A = _rb(BC); _memptr = BC+1; }
|
||||||
inline void decbc() { BC--; _mc(IR, 1); _mc(IR, 1); }
|
inline void decbc() { BC--; _mc(IR, 1); _mc(IR, 1); }
|
||||||
inline void incc() { _inc(C); }
|
inline void incc() { _inc(C); }
|
||||||
@ -452,7 +450,7 @@ private:
|
|||||||
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
_mc(PC, 1); _mc(PC, 1); _mc(PC, 1); _mc(PC, 1); _mc(PC, 1);
|
||||||
_memptr = PC = _ads(PC, b+1);
|
_memptr = PC = _ads(PC, b+1);
|
||||||
}
|
}
|
||||||
inline void addhlde() { _memptr = HL+1; _add16(HL, DE); }
|
inline void addhlde() { _add16(HL, DE); }
|
||||||
inline void ldaDE() { A = _rb(DE); _memptr = DE+1; }
|
inline void ldaDE() { A = _rb(DE); _memptr = DE+1; }
|
||||||
inline void decde() { DE--; _mc(IR, 1); _mc(IR, 1); }
|
inline void decde() { DE--; _mc(IR, 1); _mc(IR, 1); }
|
||||||
inline void ince() { _inc(E); }
|
inline void ince() { _inc(E); }
|
||||||
@ -1316,9 +1314,8 @@ private:
|
|||||||
|
|
||||||
// 0x40
|
// 0x40
|
||||||
inline void _bitIX(int i, uint8_t o) {
|
inline void _bitIX(int i, uint8_t o) {
|
||||||
uint16_t a = _ads(IX, o);
|
_memptr = _ads(IX, o);
|
||||||
_memptr = a;
|
_bitI(i, _memptr);
|
||||||
_bitI(i, a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void bit0IX(uint8_t o) { _bitIX(0, o); }
|
inline void bit0IX(uint8_t o) { _bitIX(0, o); }
|
||||||
@ -1529,9 +1526,8 @@ private:
|
|||||||
|
|
||||||
// 0x00
|
// 0x00
|
||||||
inline void _rlcIY(uint8_t &b, uint8_t o) {
|
inline void _rlcIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_rlc(b); _sb(_memptr, b);
|
||||||
_rlc(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void rlcIYB(uint8_t o) { _rlcIY(B, o); }
|
inline void rlcIYB(uint8_t o) { _rlcIY(B, o); }
|
||||||
inline void rlcIYC(uint8_t o) { _rlcIY(C, o); }
|
inline void rlcIYC(uint8_t o) { _rlcIY(C, o); }
|
||||||
@ -1544,9 +1540,8 @@ private:
|
|||||||
|
|
||||||
// 0x08
|
// 0x08
|
||||||
inline void _rrcIY(uint8_t &b, uint8_t o) {
|
inline void _rrcIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_rrc(b); _sb(_memptr, b);
|
||||||
_rrc(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void rrcIYB(uint8_t o) { _rrcIY(B, o); }
|
inline void rrcIYB(uint8_t o) { _rrcIY(B, o); }
|
||||||
inline void rrcIYC(uint8_t o) { _rrcIY(C, o); }
|
inline void rrcIYC(uint8_t o) { _rrcIY(C, o); }
|
||||||
@ -1559,9 +1554,8 @@ private:
|
|||||||
|
|
||||||
// 0x10
|
// 0x10
|
||||||
inline void _rlIY(uint8_t &b, uint8_t o) {
|
inline void _rlIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_rl(b); _sb(_memptr, b);
|
||||||
_rl(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void rlIYB(uint8_t o) { _rlIY(B, o); }
|
inline void rlIYB(uint8_t o) { _rlIY(B, o); }
|
||||||
inline void rlIYC(uint8_t o) { _rlIY(C, o); }
|
inline void rlIYC(uint8_t o) { _rlIY(C, o); }
|
||||||
@ -1574,9 +1568,8 @@ private:
|
|||||||
|
|
||||||
// 0x18
|
// 0x18
|
||||||
inline void _rrIY(uint8_t &b, uint8_t o) {
|
inline void _rrIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_rr(b); _sb(_memptr, b);
|
||||||
_rr(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void rrIYB(uint8_t o) { _rrIY(B, o); }
|
inline void rrIYB(uint8_t o) { _rrIY(B, o); }
|
||||||
inline void rrIYC(uint8_t o) { _rrIY(C, o); }
|
inline void rrIYC(uint8_t o) { _rrIY(C, o); }
|
||||||
@ -1589,9 +1582,8 @@ private:
|
|||||||
|
|
||||||
// 0x20
|
// 0x20
|
||||||
inline void _slaIY(uint8_t &b, uint8_t o) {
|
inline void _slaIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_sla(b); _sb(_memptr, b);
|
||||||
_sla(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void slaIYB(uint8_t o) { _slaIY(B, o); }
|
inline void slaIYB(uint8_t o) { _slaIY(B, o); }
|
||||||
inline void slaIYC(uint8_t o) { _slaIY(C, o); }
|
inline void slaIYC(uint8_t o) { _slaIY(C, o); }
|
||||||
@ -1604,9 +1596,8 @@ private:
|
|||||||
|
|
||||||
// 0x28
|
// 0x28
|
||||||
inline void _sraIY(uint8_t &b, uint8_t o) {
|
inline void _sraIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_sra(b); _sb(_memptr, b);
|
||||||
_sra(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void sraIYB(uint8_t o) { _sraIY(B, o); }
|
inline void sraIYB(uint8_t o) { _sraIY(B, o); }
|
||||||
inline void sraIYC(uint8_t o) { _sraIY(C, o); }
|
inline void sraIYC(uint8_t o) { _sraIY(C, o); }
|
||||||
@ -1619,9 +1610,8 @@ private:
|
|||||||
|
|
||||||
// 0x30
|
// 0x30
|
||||||
inline void _sllIY(uint8_t &b, uint8_t o) {
|
inline void _sllIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_sll(b); _sb(_memptr, b);
|
||||||
_sll(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void sllIYB(uint8_t o) { _sllIY(B, o); }
|
inline void sllIYB(uint8_t o) { _sllIY(B, o); }
|
||||||
inline void sllIYC(uint8_t o) { _sllIY(C, o); }
|
inline void sllIYC(uint8_t o) { _sllIY(C, o); }
|
||||||
@ -1634,9 +1624,8 @@ private:
|
|||||||
|
|
||||||
// 0x38
|
// 0x38
|
||||||
inline void _srlIY(uint8_t &b, uint8_t o) {
|
inline void _srlIY(uint8_t &b, uint8_t o) {
|
||||||
uint16_t a = _rbIY(b, o);
|
_memptr = _rbIY(b, o);
|
||||||
_memptr = a;
|
_srl(b); _sb(_memptr, b);
|
||||||
_srl(b); _sb(a, b);
|
|
||||||
}
|
}
|
||||||
inline void srlIYB(uint8_t o) { _srlIY(B, o); }
|
inline void srlIYB(uint8_t o) { _srlIY(B, o); }
|
||||||
inline void srlIYC(uint8_t o) { _srlIY(C, o); }
|
inline void srlIYC(uint8_t o) { _srlIY(C, o); }
|
||||||
@ -1649,9 +1638,8 @@ private:
|
|||||||
|
|
||||||
// 0x40
|
// 0x40
|
||||||
inline void _bitIY(int i, uint8_t o) {
|
inline void _bitIY(int i, uint8_t o) {
|
||||||
uint16_t a = _ads(IY, o);
|
_memptr = _ads(IY, o);
|
||||||
_memptr = a;
|
_bitI(i, _memptr);
|
||||||
_bitI(i, a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void bit0IY(uint8_t o) { _bitIY(0, o); }
|
inline void bit0IY(uint8_t o) { _bitIY(0, o); }
|
||||||
|
Loading…
Reference in New Issue
Block a user