summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/i8008/i8008.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/i8008/i8008.cpp')
-rw-r--r--src/devices/cpu/i8008/i8008.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/devices/cpu/i8008/i8008.cpp b/src/devices/cpu/i8008/i8008.cpp
index ec404c8902d..2c997f30c4f 100644
--- a/src/devices/cpu/i8008/i8008.cpp
+++ b/src/devices/cpu/i8008/i8008.cpp
@@ -10,7 +10,6 @@
#include "emu.h"
#include "i8008.h"
#include "8008dasm.h"
-#include "debugger.h"
//**************************************************************************
// MACROS
@@ -37,9 +36,7 @@ DEFINE_DEVICE_TYPE(I8008, i8008_device, "i8008", "Intel 8008")
i8008_device::i8008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, I8008, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 14)
- , m_io_config("io", ENDIANNESS_LITTLE, 8, 5)
- , m_program(nullptr)
- , m_cache(nullptr)
+ , m_io_config("io", ENDIANNESS_LITTLE, 8, 16)
{
// set our instruction counter
set_icountptr(m_icount);
@@ -52,9 +49,9 @@ i8008_device::i8008_device(const machine_config &mconfig, const char *tag, devic
void i8008_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
// save state
save_item(NAME(m_PC));
@@ -278,7 +275,7 @@ void i8008_device::take_interrupt()
m_HALT = 0;
}
// For now only support one byte operation to be executed
- execute_one(standard_irq_callback(0));
+ execute_one(standard_irq_callback(0, m_PC.d));
}
inline void i8008_device::execute_one(int opcode)
@@ -511,11 +508,11 @@ inline void i8008_device::execute_one(int opcode)
if (((opcode>>4)&3)==0) {
// INP
m_icount -= 8;
- m_A = m_io->read_byte((opcode >> 1) & 0x1f);
+ m_A = m_io.read_byte((m_A << 8) + ((opcode >> 1) & 0x1f));
} else {
// OUT
m_icount -= 6;
- m_io->write_byte((opcode >> 1) & 0x1f, m_A);
+ m_io.write_byte((m_A << 8) + ((opcode >> 1) & 0x1f), m_A);
}
break;
}
@@ -601,7 +598,7 @@ inline void i8008_device::pop_stack()
inline uint8_t i8008_device::rop()
{
- uint8_t retVal = m_cache->read_byte(GET_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(GET_PC.w.l);
GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff;
m_PC = GET_PC;
return retVal;
@@ -618,7 +615,7 @@ inline uint8_t i8008_device::get_reg(uint8_t reg)
case 4 : retVal = m_E; break;
case 5 : retVal = m_H; break;
case 6 : retVal = m_L; break;
- default: retVal = m_program->read_byte((m_H << 8) + m_L); break;
+ default: retVal = m_program.read_byte((m_H << 8) + m_L); break;
}
return retVal;
}
@@ -633,13 +630,13 @@ inline void i8008_device::set_reg(uint8_t reg, uint8_t val)
case 4 : m_E = val; break;
case 5 : m_H = val; break;
case 6 : m_L = val; break;
- default: m_program->write_byte((m_H << 8) + m_L, val); break;
+ default: m_program.write_byte((m_H << 8) + m_L, val); break;
}
}
inline uint8_t i8008_device::arg()
{
- uint8_t retVal = m_cache->read_byte(GET_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(GET_PC.w.l);
GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff;
m_PC = GET_PC;
return retVal;