summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/mb86233/mb86233.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/mb86233/mb86233.h')
-rw-r--r--src/devices/cpu/mb86233/mb86233.h206
1 files changed, 100 insertions, 106 deletions
diff --git a/src/devices/cpu/mb86233/mb86233.h b/src/devices/cpu/mb86233/mb86233.h
index 1d25be5eae4..255b16d16e4 100644
--- a/src/devices/cpu/mb86233/mb86233.h
+++ b/src/devices/cpu/mb86233/mb86233.h
@@ -1,143 +1,137 @@
// license:BSD-3-Clause
-// copyright-holders:Ernesto Corvi
+// copyright-holders:Olivier Galibert
+
#ifndef MAME_CPU_MB86233_MB86233_H
#define MAME_CPU_MB86233_MB86233_H
#pragma once
+class mb86233_device : public cpu_device
+{
+public:
+ enum address_space_ids {
+ AS_RF = 4,
+ AS_EXTERNAL = 5
+ };
-#define MCFG_MB86233_FIFO_READ_CB(_devcb) \
- devcb = &downcast<mb86233_cpu_device &>(*device).set_fifo_read_cb(DEVCB_##_devcb);
-#define MCFG_MB86233_FIFO_READ_OK_CB(_devcb) \
- devcb = &downcast<mb86233_cpu_device &>(*device).set_fifo_read_ok_cb(DEVCB_##_devcb);
-#define MCFG_MB86233_FIFO_WRITE_CB(_devcb) \
- devcb = &downcast<mb86233_cpu_device &>(*device).set_fifo_write_cb(DEVCB_##_devcb);
-#define MCFG_MB86233_TABLE_REGION(_region) \
- downcast<mb86233_cpu_device &>(*device).set_tablergn(_region);
+ enum regs_ids {
+ REG_A, REG_B, REG_D, REG_P,
+ REG_R, REG_C0, REG_C1,
+ REG_B0, REG_B1, REG_X0, REG_X1, REG_I0, REG_I1,
+ REG_SFT, REG_VSM, REG_MASK, REG_M,
+ REG_PCS0, REG_PCS1, REG_PCS2, REG_PCS3
+ };
+ enum st_flags {
+ F_ZRC = 0x00000001,
+ F_ZRD = 0x00000002,
+ F_SGC = 0x00000004,
+ F_SGD = 0x00000008,
+ F_CPC = 0x00000010,
+ F_CPD = 0x00000020,
+ F_OVC = 0x00000040,
+ F_OVD = 0x00000080,
+ F_UNC = 0x00000100,
+ F_UND = 0x00000200,
+ F_DVZC = 0x00000400,
+ F_DVZD = 0x00000800,
+ F_CA = 0x00001000,
+ F_CPP = 0x00002000,
+ F_OVM = 0x00004000,
+ F_UNM = 0x00008000,
+ F_SIF0 = 0x00010000,
+ F_SIF1 = 0x00020000,
+ F_SOF0 = 0x00040000,
+
+ F_PIF = 0x00100000,
+ F_POF = 0x00200000,
+ F_PAIF = 0x00400000,
+ F_PAOF = 0x00800000,
+ F_F0S = 0x01000000,
+ F_F1S = 0x02000000,
+ F_IT = 0x04000000,
+ F_ZX0 = 0x08000000,
+ F_ZX1 = 0x10000000,
+ F_ZX2 = 0x20000000,
+ F_ZC0 = 0x40000000,
+ F_ZC1 = 0x80000000
+ };
-class mb86233_cpu_device : public cpu_device
-{
-public:
- // construction/destruction
- mb86233_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ mb86233_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // configuration helpers
- template <class Object> devcb_base &set_fifo_read_cb(Object &&cb) { return m_fifo_read_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_fifo_read_ok_cb(Object &&cb) { return m_fifo_read_ok_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_fifo_write_cb(Object &&cb) { return m_fifo_write_cb.set_callback(std::forward<Object>(cb)); }
- void set_tablergn(const char *tablergn) { m_tablergn = tablergn; }
+ void stall() { m_stall = true; }
+
+ DECLARE_WRITE_LINE_MEMBER(gpio0_w);
+ DECLARE_WRITE_LINE_MEMBER(gpio1_w);
+ DECLARE_WRITE_LINE_MEMBER(gpio2_w);
+ DECLARE_WRITE_LINE_MEMBER(gpio3_w);
protected:
- // register enumeration
- enum
- {
- MB86233_PC=1,
- MB86233_A,
- MB86233_B,
- MB86233_D,
- MB86233_P,
- MB86233_REP,
- MB86233_SP,
- MB86233_EB,
- MB86233_SHIFT,
- MB86233_FLAGS,
- MB86233_R0,
- MB86233_R1,
- MB86233_R2,
- MB86233_R3,
- MB86233_R4,
- MB86233_R5,
- MB86233_R6,
- MB86233_R7,
- MB86233_R8,
- MB86233_R9,
- MB86233_R10,
- MB86233_R11,
- MB86233_R12,
- MB86233_R13,
- MB86233_R14,
- MB86233_R15
- };
+ mb86233_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- // device_execute_interface overrides
virtual uint32_t execute_min_cycles() const override { return 1; }
- virtual uint32_t execute_max_cycles() const override { return 2; }
- virtual uint32_t execute_input_lines() const override { return 0; }
+ virtual uint32_t execute_max_cycles() const override { return 1; }
+ virtual uint32_t execute_input_lines() const override { return 4; }
virtual void execute_run() override;
- // device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
-
- // device_state_interface overrides
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
- // device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
private:
address_space_config m_program_config;
address_space_config m_data_config;
+ address_space_config m_io_config;
+ address_space_config m_rf_config;
- union MB86233_REG
- {
- int32_t i;
- uint32_t u;
- float f;
- };
-
- uint16_t m_pc;
- MB86233_REG m_a;
- MB86233_REG m_b;
- MB86233_REG m_d;
- MB86233_REG m_p;
-
- uint16_t m_reps;
- uint16_t m_pcs[4];
- uint8_t m_pcsp;
- uint32_t m_eb;
- uint32_t m_shift;
- uint32_t m_repcnt;
- uint16_t m_sr;
- uint8_t m_fpucontrol;
-
- uint32_t m_gpr[16];
- uint32_t m_extport[0x30];
-
- address_space *m_program;
+ address_space *m_program, *m_data, *m_io, *m_rf;
direct_read_data<-2> *m_direct;
int m_icount;
- /* FIFO */
- int m_fifo_wait;
- devcb_read32 m_fifo_read_cb;
- devcb_read_line m_fifo_read_ok_cb;
- devcb_write32 m_fifo_write_cb;
- const char *m_tablergn;
-
- /* internal RAM */
- uint32_t m_RAM[2 * 0x200];
- uint32_t *m_ARAM, *m_BRAM;
- uint32_t *m_Tables;
-
- void FLAGSF( float v );
- void FLAGSI( uint32_t v );
- int COND( uint32_t cond );
- void ALU( uint32_t alu);
- uint32_t ScaleExp(unsigned int v,int scale);
- uint32_t GETEXTERNAL( uint32_t EB, uint32_t offset );
- void SETEXTERNAL( uint32_t EB, uint32_t offset, uint32_t value );
- uint32_t GETREGS( uint32_t reg, int source );
- void SETREGS( uint32_t reg, uint32_t val );
- uint32_t INDIRECT( uint32_t reg, int source );
+ u32 m_st, m_a, m_b, m_d, m_p;
+ u32 m_alu_stmask, m_alu_stset, m_alu_r1, m_alu_r2;
+ u16 m_ppc, m_pc, m_sp, m_b0, m_b1, m_x0, m_x1, m_i0, m_i1, m_vsmr, m_pcs[4], m_mask, m_m;
+ u8 m_r, m_rpc, m_c0, m_c1, m_sft, m_vsm;
+ bool m_gpio0, m_gpio1, m_gpio2, m_gpio3;
+
+ bool m_stall;
+
+ static s32 s24_32(u32 val);
+ static u32 set_exp(u32 val, u32 exp);
+ static u32 set_mant(u32 val, u32 mant);
+ static u32 get_exp(u32 val);
+ static u32 get_mant(u32 val);
+
+ void testdz();
+ void alu_update_st();
+ void alu_pre(u32 alu);
+ void alu_post(u32 alu);
+ u16 ea_pre_0(u32 r);
+ void ea_post_0(u32 r);
+ u16 ea_pre_1(u32 r);
+ void ea_post_1(u32 r);
+ void pcs_push();
+ void pcs_pop();
+
+ u32 read_reg(u32 r);
+ void write_reg(u32 r, u32 v);
+ void write_mem_internal_1(u32 r, u32 v, bool bank);
+ void write_mem_external_1(u32 r, u32 v);
+ void write_mem_io_1(u32 r, u32 v);
+};
+class mb86234_device : public mb86233_device
+{
+public:
+ mb86234_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-DECLARE_DEVICE_TYPE(MB86233, mb86233_cpu_device)
+DECLARE_DEVICE_TYPE(MB86233, mb86233_device)
+DECLARE_DEVICE_TYPE(MB86234, mb86234_device)
#endif // MAME_CPU_MB86233_MB86233_H