summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/z80/z80.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/z80/z80.cpp')
-rw-r--r--src/devices/cpu/z80/z80.cpp210
1 files changed, 105 insertions, 105 deletions
diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp
index 6b72570a63c..a23dfbe4bf6 100644
--- a/src/devices/cpu/z80/z80.cpp
+++ b/src/devices/cpu/z80/z80.cpp
@@ -96,7 +96,7 @@
* now also adjust the r register depending on the skipped opcodes.
* Changes in 2.2:
* - Fixed bugs in CPL, SCF and CCF instructions flag handling.
- * - Changed variable ea and arg16() function to UINT32; this
+ * - Changed variable ea and arg16() function to uint32_t; this
* produces slightly more efficient code.
* - The DD/FD XY CB opcodes where XY is 40-7F and Y is not 6/E
* are changed to calls to the X6/XE opcodes to reduce object size.
@@ -183,16 +183,16 @@
static bool tables_initialised = false;
-static UINT8 SZ[256]; /* zero and sign flags */
-static UINT8 SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
-static UINT8 SZP[256]; /* zero, sign and parity flags */
-static UINT8 SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
-static UINT8 SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
+static uint8_t SZ[256]; /* zero and sign flags */
+static uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
+static uint8_t SZP[256]; /* zero, sign and parity flags */
+static uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
+static uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
-static UINT8 SZHVC_add[2*256*256];
-static UINT8 SZHVC_sub[2*256*256];
+static uint8_t SZHVC_add[2*256*256];
+static uint8_t SZHVC_sub[2*256*256];
-static const UINT8 cc_op[0x100] = {
+static const uint8_t cc_op[0x100] = {
4,10, 7, 6, 4, 4, 7, 4, 4,11, 7, 6, 4, 4, 7, 4,
8,10, 7, 6, 4, 4, 7, 4,12,11, 7, 6, 4, 4, 7, 4,
7,10,16, 6, 4, 4, 7, 4, 7,11,16, 6, 4, 4, 7, 4,
@@ -211,7 +211,7 @@ static const UINT8 cc_op[0x100] = {
5,10,10, 4,10,11, 7,11, 5, 6,10, 4,10, 0, 7,11 /* fd -> cc_xy */
};
-static const UINT8 cc_cb[0x100] = {
+static const uint8_t cc_cb[0x100] = {
8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
@@ -230,7 +230,7 @@ static const UINT8 cc_cb[0x100] = {
8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8
};
-static const UINT8 cc_ed[0x100] = {
+static const uint8_t cc_ed[0x100] = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -250,7 +250,7 @@ static const UINT8 cc_ed[0x100] = {
};
/* ix/iy: with the exception of (i+offset) opcodes, t-states are main_opcode_table + 4 */
-static const UINT8 cc_xy[0x100] = {
+static const uint8_t cc_xy[0x100] = {
4+4,10+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4, 4+4,11+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,
8+4,10+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,12+4,11+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,
7+4,10+4,16+4, 6+4, 4+4, 4+4, 7+4, 4+4, 7+4,11+4,16+4, 6+4, 4+4, 4+4, 7+4, 4+4,
@@ -269,7 +269,7 @@ static const UINT8 cc_xy[0x100] = {
5+4,10+4,10+4, 4+4,10+4,11+4, 7+4,11+4, 5+4, 6+4,10+4, 4+4,10+4, 4 , 7+4,11+4 /* fd -> cc_xy again */
};
-static const UINT8 cc_xycb[0x100] = {
+static const uint8_t cc_xycb[0x100] = {
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
@@ -289,7 +289,7 @@ static const UINT8 cc_xycb[0x100] = {
};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
-static const UINT8 cc_ex[0x100] = {
+static const uint8_t cc_ex[0x100] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */
5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */
@@ -417,7 +417,7 @@ inline void z80_device::leave_halt()
/***************************************************************
* Input a byte from given I/O port
***************************************************************/
-inline UINT8 z80_device::in(UINT16 port)
+inline uint8_t z80_device::in(uint16_t port)
{
return m_io->read_byte(port);
}
@@ -425,7 +425,7 @@ inline UINT8 z80_device::in(UINT16 port)
/***************************************************************
* Output a byte to given I/O port
***************************************************************/
-inline void z80_device::out(UINT16 port, UINT8 value)
+inline void z80_device::out(uint16_t port, uint8_t value)
{
m_io->write_byte(port, value);
}
@@ -433,7 +433,7 @@ inline void z80_device::out(UINT16 port, UINT8 value)
/***************************************************************
* Read a byte from given memory location
***************************************************************/
-inline UINT8 z80_device::rm(UINT16 addr)
+inline uint8_t z80_device::rm(uint16_t addr)
{
return m_program->read_byte(addr);
}
@@ -441,7 +441,7 @@ inline UINT8 z80_device::rm(UINT16 addr)
/***************************************************************
* Read a word from given memory location
***************************************************************/
-inline void z80_device::rm16(UINT16 addr, PAIR &r)
+inline void z80_device::rm16(uint16_t addr, PAIR &r)
{
r.b.l = rm(addr);
r.b.h = rm((addr+1));
@@ -450,7 +450,7 @@ inline void z80_device::rm16(UINT16 addr, PAIR &r)
/***************************************************************
* Write a byte to given memory location
***************************************************************/
-inline void z80_device::wm(UINT16 addr, UINT8 value)
+inline void z80_device::wm(uint16_t addr, uint8_t value)
{
m_program->write_byte(addr, value);
}
@@ -458,7 +458,7 @@ inline void z80_device::wm(UINT16 addr, UINT8 value)
/***************************************************************
* Write a word to given memory location
***************************************************************/
-inline void z80_device::wm16(UINT16 addr, PAIR &r)
+inline void z80_device::wm16(uint16_t addr, PAIR &r)
{
wm(addr, r.b.l);
wm((addr+1), r.b.h);
@@ -469,11 +469,11 @@ inline void z80_device::wm16(UINT16 addr, PAIR &r)
* reading opcodes. In case of system with memory mapped I/O,
* this function can be used to greatly speed up emulation
***************************************************************/
-inline UINT8 z80_device::rop()
+inline uint8_t z80_device::rop()
{
unsigned pc = PCD;
PC++;
- UINT8 res = m_decrypted_opcodes_direct->read_byte(pc);
+ uint8_t res = m_decrypted_opcodes_direct->read_byte(pc);
m_icount -= 2;
m_refresh_cb((m_i << 8) | (m_r2 & 0x80) | ((m_r-1) & 0x7f));
m_icount += 2;
@@ -486,14 +486,14 @@ inline UINT8 z80_device::rop()
* support systems that use different encoding mechanisms for
* opcodes and opcode arguments
***************************************************************/
-inline UINT8 z80_device::arg()
+inline uint8_t z80_device::arg()
{
unsigned pc = PCD;
PC++;
return m_direct->read_byte(pc);
}
-inline UINT16 z80_device::arg16()
+inline uint16_t z80_device::arg16()
{
unsigned pc = PCD;
PC += 2;
@@ -506,13 +506,13 @@ inline UINT16 z80_device::arg16()
***************************************************************/
inline void z80_device::eax()
{
- m_ea = (UINT32)(UINT16)(IX + (INT8)arg());
+ m_ea = (uint32_t)(uint16_t)(IX + (int8_t)arg());
WZ = m_ea;
}
inline void z80_device::eay()
{
- m_ea = (UINT32)(UINT16)(IY + (INT8)arg());
+ m_ea = (uint32_t)(uint16_t)(IY + (int8_t)arg());
WZ = m_ea;
}
@@ -564,7 +564,7 @@ inline void z80_device::jp_cond(bool cond)
***************************************************************/
inline void z80_device::jr()
{
- INT8 a = (INT8)arg(); /* arg() also increments PC */
+ int8_t a = (int8_t)arg(); /* arg() also increments PC */
PC += a; /* so don't do PC += arg() */
WZ = PC;
}
@@ -572,7 +572,7 @@ inline void z80_device::jr()
/***************************************************************
* JR_COND
***************************************************************/
-inline void z80_device::jr_cond(bool cond, UINT8 opcode)
+inline void z80_device::jr_cond(bool cond, uint8_t opcode)
{
if (cond)
{
@@ -597,7 +597,7 @@ inline void z80_device::call()
/***************************************************************
* CALL_COND
***************************************************************/
-inline void z80_device::call_cond(bool cond, UINT8 opcode)
+inline void z80_device::call_cond(bool cond, uint8_t opcode)
{
if (cond)
{
@@ -616,7 +616,7 @@ inline void z80_device::call_cond(bool cond, UINT8 opcode)
/***************************************************************
* RET_COND
***************************************************************/
-inline void z80_device::ret_cond(bool cond, UINT8 opcode)
+inline void z80_device::ret_cond(bool cond, uint8_t opcode)
{
if (cond)
{
@@ -689,7 +689,7 @@ inline void z80_device::ld_a_i()
/***************************************************************
* RST
***************************************************************/
-inline void z80_device::rst(UINT16 addr)
+inline void z80_device::rst(uint16_t addr)
{
push(m_pc);
PCD = addr;
@@ -699,19 +699,19 @@ inline void z80_device::rst(UINT16 addr)
/***************************************************************
* INC r8
***************************************************************/
-inline UINT8 z80_device::inc(UINT8 value)
+inline uint8_t z80_device::inc(uint8_t value)
{
- UINT8 res = value + 1;
+ uint8_t res = value + 1;
F = (F & CF) | SZHV_inc[res];
- return (UINT8)res;
+ return (uint8_t)res;
}
/***************************************************************
* DEC r8
***************************************************************/
-inline UINT8 z80_device::dec(UINT8 value)
+inline uint8_t z80_device::dec(uint8_t value)
{
- UINT8 res = value - 1;
+ uint8_t res = value - 1;
F = (F & CF) | SZHV_dec[res];
return res;
}
@@ -740,8 +740,8 @@ inline void z80_device::rrca()
***************************************************************/
inline void z80_device::rla()
{
- UINT8 res = (A << 1) | (F & CF);
- UINT8 c = (A & 0x80) ? CF : 0;
+ uint8_t res = (A << 1) | (F & CF);
+ uint8_t c = (A & 0x80) ? CF : 0;
F = (F & (SF | ZF | PF)) | c | (res & (YF | XF));
A = res;
}
@@ -751,8 +751,8 @@ inline void z80_device::rla()
***************************************************************/
inline void z80_device::rra()
{
- UINT8 res = (A >> 1) | (F << 7);
- UINT8 c = (A & 0x01) ? CF : 0;
+ uint8_t res = (A >> 1) | (F << 7);
+ uint8_t c = (A & 0x01) ? CF : 0;
F = (F & (SF | ZF | PF)) | c | (res & (YF | XF));
A = res;
}
@@ -762,7 +762,7 @@ inline void z80_device::rra()
***************************************************************/
inline void z80_device::rrd()
{
- UINT8 n = rm(HL);
+ uint8_t n = rm(HL);
WZ = HL+1;
wm(HL, (n >> 4) | (A << 4));
A = (A & 0xf0) | (n & 0x0f);
@@ -774,7 +774,7 @@ inline void z80_device::rrd()
***************************************************************/
inline void z80_device::rld()
{
- UINT8 n = rm(HL);
+ uint8_t n = rm(HL);
WZ = HL+1;
wm(HL, (n << 4) | (A & 0x0f));
A = (A & 0xf0) | (n >> 4);
@@ -784,10 +784,10 @@ inline void z80_device::rld()
/***************************************************************
* ADD A,n
***************************************************************/
-inline void z80_device::add_a(UINT8 value)
+inline void z80_device::add_a(uint8_t value)
{
- UINT32 ah = AFD & 0xff00;
- UINT32 res = (UINT8)((ah >> 8) + value);
+ uint32_t ah = AFD & 0xff00;
+ uint32_t res = (uint8_t)((ah >> 8) + value);
F = SZHVC_add[ah | res];
A = res;
}
@@ -795,10 +795,10 @@ inline void z80_device::add_a(UINT8 value)
/***************************************************************
* ADC A,n
***************************************************************/
-inline void z80_device::adc_a(UINT8 value)
+inline void z80_device::adc_a(uint8_t value)
{
- UINT32 ah = AFD & 0xff00, c = AFD & 1;
- UINT32 res = (UINT8)((ah >> 8) + value + c);
+ uint32_t ah = AFD & 0xff00, c = AFD & 1;
+ uint32_t res = (uint8_t)((ah >> 8) + value + c);
F = SZHVC_add[(c << 16) | ah | res];
A = res;
}
@@ -806,10 +806,10 @@ inline void z80_device::adc_a(UINT8 value)
/***************************************************************
* SUB n
***************************************************************/
-inline void z80_device::sub(UINT8 value)
+inline void z80_device::sub(uint8_t value)
{
- UINT32 ah = AFD & 0xff00;
- UINT32 res = (UINT8)((ah >> 8) - value);
+ uint32_t ah = AFD & 0xff00;
+ uint32_t res = (uint8_t)((ah >> 8) - value);
F = SZHVC_sub[ah | res];
A = res;
}
@@ -817,10 +817,10 @@ inline void z80_device::sub(UINT8 value)
/***************************************************************
* SBC A,n
***************************************************************/
-inline void z80_device::sbc_a(UINT8 value)
+inline void z80_device::sbc_a(uint8_t value)
{
- UINT32 ah = AFD & 0xff00, c = AFD & 1;
- UINT32 res = (UINT8)((ah >> 8) - value - c);
+ uint32_t ah = AFD & 0xff00, c = AFD & 1;
+ uint32_t res = (uint8_t)((ah >> 8) - value - c);
F = SZHVC_sub[(c<<16) | ah | res];
A = res;
}
@@ -830,7 +830,7 @@ inline void z80_device::sbc_a(UINT8 value)
***************************************************************/
inline void z80_device::neg()
{
- UINT8 value = A;
+ uint8_t value = A;
A = 0;
sub(value);
}
@@ -840,7 +840,7 @@ inline void z80_device::neg()
***************************************************************/
inline void z80_device::daa()
{
- UINT8 a = A;
+ uint8_t a = A;
if (F & NF) {
if ((F&HF) | ((A&0xf)>9)) a-=6;
if ((F&CF) | (A>0x99)) a-=0x60;
@@ -857,7 +857,7 @@ inline void z80_device::daa()
/***************************************************************
* AND n
***************************************************************/
-inline void z80_device::and_a(UINT8 value)
+inline void z80_device::and_a(uint8_t value)
{
A &= value;
F = SZP[A] | HF;
@@ -866,7 +866,7 @@ inline void z80_device::and_a(UINT8 value)
/***************************************************************
* OR n
***************************************************************/
-inline void z80_device::or_a(UINT8 value)
+inline void z80_device::or_a(uint8_t value)
{
A |= value;
F = SZP[A];
@@ -875,7 +875,7 @@ inline void z80_device::or_a(UINT8 value)
/***************************************************************
* XOR n
***************************************************************/
-inline void z80_device::xor_a(UINT8 value)
+inline void z80_device::xor_a(uint8_t value)
{
A ^= value;
F = SZP[A];
@@ -884,11 +884,11 @@ inline void z80_device::xor_a(UINT8 value)
/***************************************************************
* CP n
***************************************************************/
-inline void z80_device::cp(UINT8 value)
+inline void z80_device::cp(uint8_t value)
{
unsigned val = value;
- UINT32 ah = AFD & 0xff00;
- UINT32 res = (UINT8)((ah >> 8) - val);
+ uint32_t ah = AFD & 0xff00;
+ uint32_t res = (uint8_t)((ah >> 8) - val);
F = (SZHVC_sub[ah | res] & ~(YF | XF)) |
(val & (YF | XF));
}
@@ -939,12 +939,12 @@ inline void z80_device::ex_sp(PAIR &r)
***************************************************************/
inline void z80_device::add16(PAIR &dr, PAIR &sr)
{
- UINT32 res = dr.d + sr.d;
+ uint32_t res = dr.d + sr.d;
WZ = dr.d + 1;
F = (F & (SF | ZF | VF)) |
(((dr.d ^ res ^ sr.d) >> 8) & HF) |
((res >> 16) & CF) | ((res >> 8) & (YF | XF));
- dr.w.l = (UINT16)res;
+ dr.w.l = (uint16_t)res;
}
/***************************************************************
@@ -952,14 +952,14 @@ inline void z80_device::add16(PAIR &dr, PAIR &sr)
***************************************************************/
inline void z80_device::adc_hl(PAIR &r)
{
- UINT32 res = HLD + r.d + (F & CF);
+ uint32_t res = HLD + r.d + (F & CF);
WZ = HL + 1;
F = (((HLD ^ res ^ r.d) >> 8) & HF) |
((res >> 16) & CF) |
((res >> 8) & (SF | YF | XF)) |
((res & 0xffff) ? 0 : ZF) |
(((r.d ^ HLD ^ 0x8000) & (r.d ^ res) & 0x8000) >> 13);
- HL = (UINT16)res;
+ HL = (uint16_t)res;
}
/***************************************************************
@@ -967,20 +967,20 @@ inline void z80_device::adc_hl(PAIR &r)
***************************************************************/
inline void z80_device::sbc_hl(PAIR &r)
{
- UINT32 res = HLD - r.d - (F & CF);
+ uint32_t res = HLD - r.d - (F & CF);
WZ = HL + 1;
F = (((HLD ^ res ^ r.d) >> 8) & HF) | NF |
((res >> 16) & CF) |
((res >> 8) & (SF | YF | XF)) |
((res & 0xffff) ? 0 : ZF) |
(((r.d ^ HLD) & (HLD ^ res) &0x8000) >> 13);
- HL = (UINT16)res;
+ HL = (uint16_t)res;
}
/***************************************************************
* RLC r8
***************************************************************/
-inline UINT8 z80_device::rlc(UINT8 value)
+inline uint8_t z80_device::rlc(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x80) ? CF : 0;
@@ -992,7 +992,7 @@ inline UINT8 z80_device::rlc(UINT8 value)
/***************************************************************
* RRC r8
***************************************************************/
-inline UINT8 z80_device::rrc(UINT8 value)
+inline uint8_t z80_device::rrc(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x01) ? CF : 0;
@@ -1004,7 +1004,7 @@ inline UINT8 z80_device::rrc(UINT8 value)
/***************************************************************
* RL r8
***************************************************************/
-inline UINT8 z80_device::rl(UINT8 value)
+inline uint8_t z80_device::rl(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x80) ? CF : 0;
@@ -1016,7 +1016,7 @@ inline UINT8 z80_device::rl(UINT8 value)
/***************************************************************
* RR r8
***************************************************************/
-inline UINT8 z80_device::rr(UINT8 value)
+inline uint8_t z80_device::rr(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x01) ? CF : 0;
@@ -1028,7 +1028,7 @@ inline UINT8 z80_device::rr(UINT8 value)
/***************************************************************
* SLA r8
***************************************************************/
-inline UINT8 z80_device::sla(UINT8 value)
+inline uint8_t z80_device::sla(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x80) ? CF : 0;
@@ -1040,7 +1040,7 @@ inline UINT8 z80_device::sla(UINT8 value)
/***************************************************************
* SRA r8
***************************************************************/
-inline UINT8 z80_device::sra(UINT8 value)
+inline uint8_t z80_device::sra(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x01) ? CF : 0;
@@ -1052,7 +1052,7 @@ inline UINT8 z80_device::sra(UINT8 value)
/***************************************************************
* SLL r8
***************************************************************/
-inline UINT8 z80_device::sll(UINT8 value)
+inline uint8_t z80_device::sll(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x80) ? CF : 0;
@@ -1064,7 +1064,7 @@ inline UINT8 z80_device::sll(UINT8 value)
/***************************************************************
* SRL r8
***************************************************************/
-inline UINT8 z80_device::srl(UINT8 value)
+inline uint8_t z80_device::srl(uint8_t value)
{
unsigned res = value;
unsigned c = (res & 0x01) ? CF : 0;
@@ -1076,7 +1076,7 @@ inline UINT8 z80_device::srl(UINT8 value)
/***************************************************************
* BIT bit,r8
***************************************************************/
-inline void z80_device::bit(int bit, UINT8 value)
+inline void z80_device::bit(int bit, uint8_t value)
{
F = (F & CF) | HF | (SZ_BIT[value & (1<<bit)] & ~(YF|XF)) | (value & (YF|XF));
}
@@ -1084,7 +1084,7 @@ inline void z80_device::bit(int bit, UINT8 value)
/***************************************************************
* BIT bit,(HL)
***************************************************************/
-inline void z80_device::bit_hl(int bit, UINT8 value)
+inline void z80_device::bit_hl(int bit, uint8_t value)
{
F = (F & CF) | HF | (SZ_BIT[value & (1<<bit)] & ~(YF|XF)) | (WZ_H & (YF|XF));
}
@@ -1092,7 +1092,7 @@ inline void z80_device::bit_hl(int bit, UINT8 value)
/***************************************************************
* BIT bit,(IX/Y+o)
***************************************************************/
-inline void z80_device::bit_xy(int bit, UINT8 value)
+inline void z80_device::bit_xy(int bit, uint8_t value)
{
F = (F & CF) | HF | (SZ_BIT[value & (1<<bit)] & ~(YF|XF)) | ((m_ea>>8) & (YF|XF));
}
@@ -1100,7 +1100,7 @@ inline void z80_device::bit_xy(int bit, UINT8 value)
/***************************************************************
* RES bit,r8
***************************************************************/
-inline UINT8 z80_device::res(int bit, UINT8 value)
+inline uint8_t z80_device::res(int bit, uint8_t value)
{
return value & ~(1<<bit);
}
@@ -1108,7 +1108,7 @@ inline UINT8 z80_device::res(int bit, UINT8 value)
/***************************************************************
* SET bit,r8
***************************************************************/
-inline UINT8 z80_device::set(int bit, UINT8 value)
+inline uint8_t z80_device::set(int bit, uint8_t value)
{
return value | (1<<bit);
}
@@ -1118,7 +1118,7 @@ inline UINT8 z80_device::set(int bit, UINT8 value)
***************************************************************/
inline void z80_device::ldi()
{
- UINT8 io = rm(HL);
+ uint8_t io = rm(HL);
wm(DE, io);
F &= SF | ZF | CF;
if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */
@@ -1132,8 +1132,8 @@ inline void z80_device::ldi()
***************************************************************/
inline void z80_device::cpi()
{
- UINT8 val = rm(HL);
- UINT8 res = A - val;
+ uint8_t val = rm(HL);
+ uint8_t res = A - val;
WZ++;
HL++; BC--;
F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF;
@@ -1149,7 +1149,7 @@ inline void z80_device::cpi()
inline void z80_device::ini()
{
unsigned t;
- UINT8 io = in(BC);
+ uint8_t io = in(BC);
WZ = BC + 1;
B--;
wm(HL, io);
@@ -1158,7 +1158,7 @@ inline void z80_device::ini()
t = (unsigned)((C + 1) & 0xff) + (unsigned)io;
if (io & SF) F |= NF;
if (t & 0x100) F |= HF | CF;
- F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;
+ F |= SZP[(uint8_t)(t & 0x07) ^ B] & PF;
}
/***************************************************************
@@ -1167,7 +1167,7 @@ inline void z80_device::ini()
inline void z80_device::outi()
{
unsigned t;
- UINT8 io = rm(HL);
+ uint8_t io = rm(HL);
B--;
WZ = BC + 1;
out(BC, io);
@@ -1176,7 +1176,7 @@ inline void z80_device::outi()
t = (unsigned)L + (unsigned)io;
if (io & SF) F |= NF;
if (t & 0x100) F |= HF | CF;
- F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;
+ F |= SZP[(uint8_t)(t & 0x07) ^ B] & PF;
}
/***************************************************************
@@ -1184,7 +1184,7 @@ inline void z80_device::outi()
***************************************************************/
inline void z80_device::ldd()
{
- UINT8 io = rm(HL);
+ uint8_t io = rm(HL);
wm(DE, io);
F &= SF | ZF | CF;
if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */
@@ -1198,8 +1198,8 @@ inline void z80_device::ldd()
***************************************************************/
inline void z80_device::cpd()
{
- UINT8 val = rm(HL);
- UINT8 res = A - val;
+ uint8_t val = rm(HL);
+ uint8_t res = A - val;
WZ--;
HL--; BC--;
F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF;
@@ -1215,7 +1215,7 @@ inline void z80_device::cpd()
inline void z80_device::ind()
{
unsigned t;
- UINT8 io = in(BC);
+ uint8_t io = in(BC);
WZ = BC - 1;
B--;
wm(HL, io);
@@ -1224,7 +1224,7 @@ inline void z80_device::ind()
t = ((unsigned)(C - 1) & 0xff) + (unsigned)io;
if (io & SF) F |= NF;
if (t & 0x100) F |= HF | CF;
- F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;
+ F |= SZP[(uint8_t)(t & 0x07) ^ B] & PF;
}
/***************************************************************
@@ -1233,7 +1233,7 @@ inline void z80_device::ind()
inline void z80_device::outd()
{
unsigned t;
- UINT8 io = rm(HL);
+ uint8_t io = rm(HL);
B--;
WZ = BC - 1;
out(BC, io);
@@ -1242,7 +1242,7 @@ inline void z80_device::outd()
t = (unsigned)L + (unsigned)io;
if (io & SF) F |= NF;
if (t & 0x100) F |= HF | CF;
- F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;
+ F |= SZP[(uint8_t)(t & 0x07) ^ B] & PF;
}
/***************************************************************
@@ -2669,7 +2669,7 @@ OP(ed,6d) { reti(); } /* RETI
OP(ed,6e) { m_im = 0; } /* IM 0 */
OP(ed,6f) { rld(); } /* RLD (HL) */
-OP(ed,70) { UINT8 res = in(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */
+OP(ed,70) { uint8_t res = in(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */
OP(ed,71) { out(BC, 0); } /* OUT (C),0 */
OP(ed,72) { sbc_hl(m_sp); } /* SBC HL,SP */
OP(ed,73) { m_ea = arg16(); wm16(m_ea, m_sp); WZ = m_ea + 1; } /* LD (w),SP */
@@ -3270,10 +3270,10 @@ void z80_device::device_start()
{
if( !tables_initialised )
{
- UINT8 *padd = &SZHVC_add[ 0*256];
- UINT8 *padc = &SZHVC_add[256*256];
- UINT8 *psub = &SZHVC_sub[ 0*256];
- UINT8 *psbc = &SZHVC_sub[256*256];
+ uint8_t *padd = &SZHVC_add[ 0*256];
+ uint8_t *padc = &SZHVC_add[256*256];
+ uint8_t *psub = &SZHVC_sub[ 0*256];
+ uint8_t *psbc = &SZHVC_sub[256*256];
for (int oldval = 0; oldval < 256; oldval++)
{
for (int newval = 0; newval < 256; newval++)
@@ -3669,7 +3669,7 @@ void z80_device::state_string_export(const device_state_entry &entry, std::strin
// helper function
//-------------------------------------------------
-offs_t z80_device::disasm_disassemble( char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options )
+offs_t z80_device::disasm_disassemble( char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options )
{
extern CPU_DISASSEMBLE( z80 );
return CPU_DISASSEMBLE_NAME(z80)(this, buffer, pc, oprom, opram, options);
@@ -3680,7 +3680,7 @@ offs_t z80_device::disasm_disassemble( char *buffer, offs_t pc, const UINT8 *opr
* Generic set_info
**************************************************************************/
-void z80_device::z80_set_cycle_tables(const UINT8 *op, const UINT8 *cb, const UINT8 *ed, const UINT8 *xy, const UINT8 *xycb, const UINT8 *ex)
+void z80_device::z80_set_cycle_tables(const uint8_t *op, const uint8_t *cb, const uint8_t *ed, const uint8_t *xy, const uint8_t *xycb, const uint8_t *ex)
{
m_cc_op = (op != nullptr) ? op : cc_op;
m_cc_cb = (cb != nullptr) ? cb : cc_cb;
@@ -3691,7 +3691,7 @@ void z80_device::z80_set_cycle_tables(const UINT8 *op, const UINT8 *cb, const UI
}
-z80_device::z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+z80_device::z80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
cpu_device(mconfig, Z80, "Z80", tag, owner, clock, "z80", __FILE__),
z80_daisy_chain_interface(mconfig, *this),
m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0),
@@ -3702,7 +3702,7 @@ z80_device::z80_device(const machine_config &mconfig, const char *tag, device_t
{
}
-z80_device::z80_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
+z80_device::z80_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
z80_daisy_chain_interface(mconfig, *this),
m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0),
@@ -3726,7 +3726,7 @@ const address_space_config *z80_device::memory_space_config(address_spacenum spa
const device_type Z80 = &device_creator<z80_device>;
-nsc800_device::nsc800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+nsc800_device::nsc800_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: z80_device(mconfig, NSC800, "NSC800", tag, owner, clock, "nsc800", __FILE__)
{
}