summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author Sterophonick <34801996+Sterophonick@users.noreply.github.com>2020-06-19 23:04:17 -0700
committer Sterophonick <34801996+Sterophonick@users.noreply.github.com>2020-06-19 23:04:17 -0700
commit207695334f717311a7e101b95e4c64376ed17164 (patch)
tree5102ff47bc38c872b60a7a4e8b19ad60144c713a /src/devices/cpu
parentdb01fc5e55b63cdd04dd66defa29a809a979b3e9 (diff)
gigatron: some more work
- Add comments for the jumps - Mask out the 15-bit ROM space as necessary - Hook up gamepad
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/gigatron/gigatron.cpp27
-rw-r--r--src/devices/cpu/gigatron/gigatron.h4
2 files changed, 18 insertions, 13 deletions
diff --git a/src/devices/cpu/gigatron/gigatron.cpp b/src/devices/cpu/gigatron/gigatron.cpp
index bddfbe80128..019631af2c5 100644
--- a/src/devices/cpu/gigatron/gigatron.cpp
+++ b/src/devices/cpu/gigatron/gigatron.cpp
@@ -13,7 +13,7 @@
#include "gigatrondasm.h"
-DEFINE_DEVICE_TYPE(GTRON, gigatron_cpu_device, "gigatron_cpu", "Gigatron CPU")
+DEFINE_DEVICE_TYPE(GTRON, gigatron_cpu_device, "gigatron_cpu", "Gigatron")
/* FLAGS */
@@ -24,7 +24,6 @@ DEFINE_DEVICE_TYPE(GTRON, gigatron_cpu_device, "gigatron_cpu", "Gigatron CPU")
#define C 0x10
#endif
-
#define gigatron_readop(A) m_program->read_word(A)
#define gigatron_readmem16(A) m_data->read_dword(A)
#define gigatron_readmem8(A) m_data->read_byte(A)
@@ -52,7 +51,8 @@ void gigatron_cpu_device::execute_run()
debugger_instruction_hook(m_pc);
opcode = gigatron_readop(m_pc);
- m_pc = m_npc++;
+ m_pc = m_npc;
+ m_npc = (m_pc + 1) & 0x7FFF;
uint8_t op = (opcode >> 13) & 0x0007;
uint8_t mode = (opcode >> 10) & 0x0007;
@@ -98,7 +98,7 @@ void gigatron_cpu_device::init()
m_x = 0;
m_y = 0;
m_pc = 0;
- m_npc = (m_pc + 1);
+ m_npc = (m_pc + 1) & 0x7FFF;
m_ppc = 0;
m_inReg = 0xFF;
@@ -109,6 +109,7 @@ void gigatron_cpu_device::init()
state_add(GTRON_AC, "AC", m_ac);
state_add(GTRON_X, "X", m_x);
state_add(GTRON_Y, "Y", m_y);
+ state_add(GTRON_IREG, "IREG", m_inReg);
set_icountptr(m_icount);
@@ -121,6 +122,7 @@ void gigatron_cpu_device::init()
save_item(NAME(m_pc));
m_outx_cb.resolve_safe();
+ m_ir_cb.resolve_safe();
}
void gigatron_cpu_device::branchOp(uint8_t op, uint8_t mode, uint8_t bus, uint8_t d)
@@ -131,29 +133,29 @@ void gigatron_cpu_device::branchOp(uint8_t op, uint8_t mode, uint8_t bus, uint8_
uint16_t base = m_pc & 0xff00;
switch (mode)
{
- case 0:
+ case 0: //jmp
c = true;
base = m_y << 8;
break;
- case 1:
+ case 1: //bgt
c = (ac2 > ZERO);
break;
- case 2:
+ case 2: //blt
c = (ac2 < ZERO);
break;
- case 3:
+ case 3: //bne
c = (ac2 != ZERO);
break;
- case 4:
+ case 4: //beq
c = (ac2 == ZERO);
break;
- case 5:
+ case 5: //bge
c = (ac2 >= ZERO);
break;
- case 6:
+ case 6: //ble
c = (ac2 <= ZERO);
break;
- case 7:
+ case 7: //bra
c = true;
break;
}
@@ -320,6 +322,7 @@ gigatron_cpu_device::gigatron_cpu_device(const machine_config &mconfig, const ch
, m_program_config("program", ENDIANNESS_BIG, 16, 14, -1)
, m_data_config("data", ENDIANNESS_BIG, 8, 15, 0)
, m_outx_cb(*this)
+ , m_ir_cb(*this)
{
}
diff --git a/src/devices/cpu/gigatron/gigatron.h b/src/devices/cpu/gigatron/gigatron.h
index 6cc1173d23c..a216978ab0d 100644
--- a/src/devices/cpu/gigatron/gigatron.h
+++ b/src/devices/cpu/gigatron/gigatron.h
@@ -16,7 +16,7 @@
enum
{
GTRON_PC, GTRON_NPC,
- GTRON_AC, GTRON_X, GTRON_Y
+ GTRON_AC, GTRON_X, GTRON_Y, GTRON_IREG
};
@@ -26,6 +26,7 @@ public:
// construction/destruction
gigatron_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto outx_cb() { return m_outx_cb.bind(); }
+ auto ir_cb() { return m_ir_cb.bind(); }
protected:
// device-level overrides
@@ -79,6 +80,7 @@ private:
void gigatron_illegal();
devcb_write8 m_outx_cb;
+ devcb_read8 m_ir_cb;
};