sm530: add some opcodes (nw)
This commit is contained in:
parent
7cc3012c22
commit
aa455aa20b
@ -36,16 +36,14 @@ void sm500_device::data_4x10x4(address_map &map)
|
|||||||
|
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm500_device(mconfig, SM500, tag, owner, clock, 1 /* stack levels */, 7 /* o group pins */, 11 /* prg width */, address_map_constructor(FUNC(sm500_device::program_1_2k), this), 6 /* data width */, address_map_constructor(FUNC(sm500_device::data_4x10x4), this))
|
sm500_device(mconfig, SM500, tag, owner, clock, 1 /* stack levels */, 7 /* o group pins */, 11 /* prg width */, address_map_constructor(FUNC(sm500_device::program_1_2k), this), 6 /* data width */, address_map_constructor(FUNC(sm500_device::data_4x10x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
|
sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
|
||||||
: sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data),
|
sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data),
|
||||||
m_o_pins(o_pins)
|
m_o_pins(o_pins)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// disasm
|
// disasm
|
||||||
|
@ -149,6 +149,7 @@ protected:
|
|||||||
u8 m_bl;
|
u8 m_bl;
|
||||||
u8 m_bm;
|
u8 m_bm;
|
||||||
bool m_sbm;
|
bool m_sbm;
|
||||||
|
bool m_sbl;
|
||||||
u8 m_c;
|
u8 m_c;
|
||||||
bool m_skip;
|
bool m_skip;
|
||||||
u8 m_w;
|
u8 m_w;
|
||||||
@ -164,7 +165,7 @@ protected:
|
|||||||
emu_timer *m_lcd_timer;
|
emu_timer *m_lcd_timer;
|
||||||
u8 m_l, m_x;
|
u8 m_l, m_x;
|
||||||
u8 m_y;
|
u8 m_y;
|
||||||
bool m_bp;
|
u8 m_bp;
|
||||||
bool m_bc;
|
bool m_bc;
|
||||||
|
|
||||||
u16 get_lcd_row(int column, u8* ram);
|
u16 get_lcd_row(int column, u8* ram);
|
||||||
@ -214,6 +215,7 @@ protected:
|
|||||||
// opcode handlers
|
// opcode handlers
|
||||||
virtual void op_lb();
|
virtual void op_lb();
|
||||||
virtual void op_lbl();
|
virtual void op_lbl();
|
||||||
|
virtual void op_sbl();
|
||||||
virtual void op_sbm();
|
virtual void op_sbm();
|
||||||
virtual void op_exbla();
|
virtual void op_exbla();
|
||||||
virtual void op_incb();
|
virtual void op_incb();
|
||||||
|
@ -61,6 +61,7 @@ void sm510_base_device::device_start()
|
|||||||
m_acc = 0;
|
m_acc = 0;
|
||||||
m_bl = 0;
|
m_bl = 0;
|
||||||
m_bm = 0;
|
m_bm = 0;
|
||||||
|
m_sbl = false;
|
||||||
m_sbm = false;
|
m_sbm = false;
|
||||||
m_c = 0;
|
m_c = 0;
|
||||||
m_skip = false;
|
m_skip = false;
|
||||||
@ -73,7 +74,7 @@ void sm510_base_device::device_start()
|
|||||||
m_l = 0;
|
m_l = 0;
|
||||||
m_x = 0;
|
m_x = 0;
|
||||||
m_y = 0;
|
m_y = 0;
|
||||||
m_bp = false;
|
m_bp = 0;
|
||||||
m_bc = false;
|
m_bc = false;
|
||||||
m_halt = false;
|
m_halt = false;
|
||||||
m_melody_rd = 0;
|
m_melody_rd = 0;
|
||||||
@ -93,6 +94,7 @@ void sm510_base_device::device_start()
|
|||||||
save_item(NAME(m_acc));
|
save_item(NAME(m_acc));
|
||||||
save_item(NAME(m_bl));
|
save_item(NAME(m_bl));
|
||||||
save_item(NAME(m_bm));
|
save_item(NAME(m_bm));
|
||||||
|
save_item(NAME(m_sbl));
|
||||||
save_item(NAME(m_sbm));
|
save_item(NAME(m_sbm));
|
||||||
save_item(NAME(m_c));
|
save_item(NAME(m_c));
|
||||||
save_item(NAME(m_skip));
|
save_item(NAME(m_skip));
|
||||||
@ -147,13 +149,14 @@ void sm510_base_device::device_reset()
|
|||||||
// ACL
|
// ACL
|
||||||
m_skip = false;
|
m_skip = false;
|
||||||
m_halt = false;
|
m_halt = false;
|
||||||
|
m_sbl = false;
|
||||||
m_sbm = false;
|
m_sbm = false;
|
||||||
m_op = m_prev_op = 0;
|
m_op = m_prev_op = 0;
|
||||||
reset_vector();
|
reset_vector();
|
||||||
m_prev_pc = m_pc;
|
m_prev_pc = m_pc;
|
||||||
|
|
||||||
// lcd is on (Bp on, BC off, bs(y) off)
|
// lcd is on (Bp on, BC off, bs(y) off)
|
||||||
m_bp = true;
|
m_bp = 1;
|
||||||
m_bc = false;
|
m_bc = false;
|
||||||
m_y = 0;
|
m_y = 0;
|
||||||
|
|
||||||
|
@ -37,10 +37,9 @@ void sm510_device::data_96_32x4(address_map &map)
|
|||||||
|
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm510_device::sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm510_device::sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm510_base_device(mconfig, SM510, tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, address_map_constructor(FUNC(sm510_device::program_2_7k), this), 7 /* data width */, address_map_constructor(FUNC(sm510_device::data_96_32x4), this))
|
sm510_base_device(mconfig, SM510, tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, address_map_constructor(FUNC(sm510_device::program_2_7k), this), 7 /* data width */, address_map_constructor(FUNC(sm510_device::data_96_32x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// disasm
|
// disasm
|
||||||
|
@ -125,6 +125,8 @@ public:
|
|||||||
|
|
||||||
virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override;
|
virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override;
|
||||||
|
|
||||||
|
virtual u32 interface_flags() const override { return NONLINEAR_PC | PAGED; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const u8 sm530_mnemonic[0x100];
|
static const u8 sm530_mnemonic[0x100];
|
||||||
};
|
};
|
||||||
|
@ -11,15 +11,17 @@
|
|||||||
|
|
||||||
u8 sm510_base_device::ram_r()
|
u8 sm510_base_device::ram_r()
|
||||||
{
|
{
|
||||||
|
int blh = (m_sbl) ? 8 : 0; // from SBL (optional)
|
||||||
int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
|
int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
|
||||||
u8 address = (bmh | m_bm << 4 | m_bl) & m_datamask;
|
u8 address = (bmh | blh | m_bm << 4 | m_bl) & m_datamask;
|
||||||
return m_data->read_byte(address) & 0xf;
|
return m_data->read_byte(address) & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm510_base_device::ram_w(u8 data)
|
void sm510_base_device::ram_w(u8 data)
|
||||||
{
|
{
|
||||||
|
int blh = (m_sbl) ? 8 : 0; // from SBL (optional)
|
||||||
int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
|
int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
|
||||||
u8 address = (bmh | m_bm << 4 | m_bl) & m_datamask;
|
u8 address = (bmh | blh | m_bm << 4 | m_bl) & m_datamask;
|
||||||
m_data->write_byte(address, data & 0xf);
|
m_data->write_byte(address, data & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ void sm510_base_device::push_stack()
|
|||||||
void sm510_base_device::do_branch(u8 pu, u8 pm, u8 pl)
|
void sm510_base_device::do_branch(u8 pu, u8 pm, u8 pl)
|
||||||
{
|
{
|
||||||
// set new PC(Pu/Pm/Pl)
|
// set new PC(Pu/Pm/Pl)
|
||||||
m_pc = ((pu << 10 & 0xc00) | (pm << 6 & 0x3c0) | (pl & 0x03f)) & m_prgmask;
|
m_pc = ((pu << 10) | (pm << 6 & 0x3c0) | (pl & 0x03f)) & m_prgmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sm510_base_device::bitmask(u16 param)
|
u8 sm510_base_device::bitmask(u16 param)
|
||||||
@ -69,6 +71,11 @@ void sm510_base_device::op_lbl()
|
|||||||
m_bm = (m_param & m_datamask) >> 4;
|
m_bm = (m_param & m_datamask) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sm510_base_device::op_sbl()
|
||||||
|
{
|
||||||
|
// SBL: set BL high bit for next opcode - handled in execute_one()
|
||||||
|
}
|
||||||
|
|
||||||
void sm510_base_device::op_sbm()
|
void sm510_base_device::op_sbm()
|
||||||
{
|
{
|
||||||
// SBM: set BM high bit for next opcode - handled in execute_one()
|
// SBM: set BM high bit for next opcode - handled in execute_one()
|
||||||
@ -139,7 +146,7 @@ void sm510_base_device::op_tml()
|
|||||||
|
|
||||||
void sm510_base_device::op_tm()
|
void sm510_base_device::op_tm()
|
||||||
{
|
{
|
||||||
// TM x: indirect subroutine call, pointers(IDX) are in page 0
|
// TM x: indirect subroutine call, pointers(IDX) are on page 0
|
||||||
m_icount--;
|
m_icount--;
|
||||||
push_stack();
|
push_stack();
|
||||||
u8 idx = m_program->read_byte(m_op & 0x3f);
|
u8 idx = m_program->read_byte(m_op & 0x3f);
|
||||||
@ -225,7 +232,7 @@ void sm510_base_device::op_kta()
|
|||||||
void sm510_base_device::op_atbp()
|
void sm510_base_device::op_atbp()
|
||||||
{
|
{
|
||||||
// ATBP: output ACC to BP(internal LCD backplate signal)
|
// ATBP: output ACC to BP(internal LCD backplate signal)
|
||||||
m_bp = ((m_acc & 1) != 0);
|
m_bp = m_acc & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm510_base_device::op_atx()
|
void sm510_base_device::op_atx()
|
||||||
|
@ -54,20 +54,17 @@ std::unique_ptr<util::disasm_interface> sm511_device::create_disassembler()
|
|||||||
|
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm511_device::sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm511_device::sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm511_device(mconfig, SM511, tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, address_map_constructor(FUNC(sm511_device::program_4k), this), 7 /* data width */, address_map_constructor(FUNC(sm511_device::data_96_32x4), this))
|
sm511_device(mconfig, SM511, tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, address_map_constructor(FUNC(sm511_device::program_4k), this), 7 /* data width */, address_map_constructor(FUNC(sm511_device::data_96_32x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm511_device::sm511_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
|
sm511_device::sm511_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
|
||||||
: sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm512_device::sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm512_device::sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm511_device(mconfig, SM512, tag, owner, clock, 2, 12, address_map_constructor(FUNC(sm512_device::program_4k), this), 7, address_map_constructor(FUNC(sm512_device::data_80_48x4), this))
|
sm511_device(mconfig, SM512, tag, owner, clock, 2, 12, address_map_constructor(FUNC(sm512_device::program_4k), this), 7, address_map_constructor(FUNC(sm512_device::data_80_48x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,14 +25,30 @@ protected:
|
|||||||
void program_2k(address_map &map);
|
void program_2k(address_map &map);
|
||||||
void data_64_24x4(address_map &map);
|
void data_64_24x4(address_map &map);
|
||||||
|
|
||||||
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
|
|
||||||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||||
|
virtual u64 execute_clocks_to_cycles(u64 clocks) const override { return (clocks + 3 - 1) / 3; } // 3 cycles per machine cycle
|
||||||
|
virtual u64 execute_cycles_to_clocks(u64 cycles) const override { return (cycles * 3); } // "
|
||||||
virtual void execute_one() override;
|
virtual void execute_one() override;
|
||||||
virtual void get_opcode_param() override;
|
virtual void get_opcode_param() override;
|
||||||
|
|
||||||
virtual u8 ram_r() override;
|
using sm510_base_device::do_branch;
|
||||||
virtual void ram_w(u8 data) override;
|
virtual void do_branch(u8 pu, u8 pl); // does not have Pm
|
||||||
|
virtual void reset_vector() override { do_branch(0xf, 0); }
|
||||||
|
virtual void wakeup_vector() override { reset_vector(); }
|
||||||
|
|
||||||
|
// opcode handlers
|
||||||
|
virtual void op_lb() override;
|
||||||
|
virtual void op_incb() override;
|
||||||
|
|
||||||
|
virtual void op_tl() override;
|
||||||
|
virtual void op_trs();
|
||||||
|
|
||||||
|
virtual void op_adx() override;
|
||||||
|
|
||||||
|
virtual void op_atbp() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class sm531_device : public sm530_device
|
class sm531_device : public sm530_device
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Sharp SM530 MCU core implementation
|
Sharp SM530 MCU core implementation
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- everything
|
- almost everything
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ void sm530_device::program_2k(address_map &map)
|
|||||||
void sm530_device::data_64_24x4(address_map &map)
|
void sm530_device::data_64_24x4(address_map &map)
|
||||||
{
|
{
|
||||||
map(0x00, 0x3f).ram();
|
map(0x00, 0x3f).ram();
|
||||||
map(0x40, 0x4b).ram();
|
map(0x40, 0x4b).mirror(0x20).ram().share("lcd_ram_a");
|
||||||
map(0x50, 0x5b).ram();
|
map(0x50, 0x5b).mirror(0x20).ram().share("lcd_ram_b");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,19 +42,28 @@ std::unique_ptr<util::disasm_interface> sm530_device::create_disassembler()
|
|||||||
|
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm530_device::sm530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm530_device::sm530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm530_device(mconfig, SM530, tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, address_map_constructor(FUNC(sm530_device::program_2k), this), 7 /* data width */, address_map_constructor(FUNC(sm530_device::data_64_24x4), this))
|
sm530_device(mconfig, SM530, tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, address_map_constructor(FUNC(sm530_device::program_2k), this), 7 /* data width */, address_map_constructor(FUNC(sm530_device::data_64_24x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm530_device::sm530_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
|
sm530_device::sm530_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
|
||||||
: sm511_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
sm511_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm531_device::sm531_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm531_device::sm531_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm530_device(mconfig, SM531, tag, owner, clock, 1, 11, address_map_constructor(FUNC(sm531_device::program_2k), this), 7, address_map_constructor(FUNC(sm531_device::data_64_24x4), this))
|
sm530_device(mconfig, SM531, tag, owner, clock, 1, 11, address_map_constructor(FUNC(sm531_device::program_2k), this), 7, address_map_constructor(FUNC(sm531_device::data_64_24x4), this))
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void sm530_device::device_start()
|
||||||
{
|
{
|
||||||
|
// common init
|
||||||
|
sm511_device::device_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +74,8 @@ sm531_device::sm531_device(const machine_config &mconfig, const char *tag, devic
|
|||||||
|
|
||||||
void sm530_device::device_reset()
|
void sm530_device::device_reset()
|
||||||
{
|
{
|
||||||
sm510_base_device::device_reset();
|
// common reset
|
||||||
|
sm511_device::device_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -76,8 +86,91 @@ void sm530_device::device_reset()
|
|||||||
|
|
||||||
void sm530_device::get_opcode_param()
|
void sm530_device::get_opcode_param()
|
||||||
{
|
{
|
||||||
|
// LBL, PRE, TL opcodes are 2 bytes
|
||||||
|
if (m_op == 0x6b || m_op == 0x78 || ((m_op & 0xf8) == 0x60))
|
||||||
|
{
|
||||||
|
m_icount--;
|
||||||
|
m_param = m_program->read_byte(m_pc);
|
||||||
|
increment_pc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm530_device::execute_one()
|
void sm530_device::execute_one()
|
||||||
{
|
{
|
||||||
|
switch (m_op & 0xf0)
|
||||||
|
{
|
||||||
|
case 0x00: op_adx(); break;
|
||||||
|
case 0x10: op_lax(); break;
|
||||||
|
case 0x30: op_lb(); break;
|
||||||
|
|
||||||
|
case 0x80: case 0x90: case 0xa0: case 0xb0:
|
||||||
|
op_t(); break; // TR
|
||||||
|
case 0xc0: case 0xd0: case 0xe0: case 0xf0:
|
||||||
|
op_trs(); break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
switch (m_op & 0xfc)
|
||||||
|
{
|
||||||
|
case 0x20: op_lda(); break;
|
||||||
|
case 0x24: op_exc(); break;
|
||||||
|
case 0x28: op_exci(); break;
|
||||||
|
case 0x2c: op_excd(); break;
|
||||||
|
case 0x40: op_rm(); break;
|
||||||
|
case 0x44: op_sm(); break;
|
||||||
|
case 0x48: op_tmi(); break; // TM
|
||||||
|
case 0x60: case 0x64: op_tl(); break;
|
||||||
|
//case 0x6c: op_tg(); break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
switch (m_op)
|
||||||
|
{
|
||||||
|
case 0x4c: op_incb(); break;
|
||||||
|
case 0x4d: op_decb(); break;
|
||||||
|
//case 0x4e: op_rds(); break;
|
||||||
|
//case 0x4f: op_sds(); break;
|
||||||
|
|
||||||
|
case 0x50: op_kta(); break;
|
||||||
|
//case 0x51: op_keta(); break;
|
||||||
|
//case 0x52: op_dta(); break;
|
||||||
|
case 0x53: op_coma(); break;
|
||||||
|
case 0x54: op_add(); break;
|
||||||
|
case 0x55: op_add11(); break; // ADDC
|
||||||
|
case 0x56: op_rc(); break;
|
||||||
|
case 0x57: op_sc(); break;
|
||||||
|
case 0x58: op_tabl(); break;
|
||||||
|
case 0x59: op_tam(); break;
|
||||||
|
case 0x5a: op_exbla(); break; // EXBL
|
||||||
|
case 0x5b: op_tc(); break;
|
||||||
|
//case 0x5c: op_ats(); break;
|
||||||
|
//case 0x5d: op_atf(); break;
|
||||||
|
case 0x5e: op_atbp(); break;
|
||||||
|
|
||||||
|
case 0x68: op_rtn0(); break; // RTN
|
||||||
|
case 0x69: op_rtn1(); break; // RTNS
|
||||||
|
case 0x6a: op_atpl(); break;
|
||||||
|
case 0x6b: op_lbl(); break;
|
||||||
|
|
||||||
|
//case 0x70: op_idiv(); break;
|
||||||
|
//case 0x71: op_inis(); break;
|
||||||
|
case 0x72: op_sbm(); break; // SABM
|
||||||
|
case 0x73: op_sbl(); break; // SABL
|
||||||
|
case 0x74: op_cend(); break;
|
||||||
|
case 0x75: op_tmel(); break;
|
||||||
|
case 0x76: op_rme(); break;
|
||||||
|
case 0x77: op_sme(); break;
|
||||||
|
case 0x78: op_pre(); break;
|
||||||
|
case 0x79: op_tal(); break; // TBA
|
||||||
|
|
||||||
|
default: op_illegal(); break;
|
||||||
|
}
|
||||||
|
break; // 0xff
|
||||||
|
|
||||||
|
}
|
||||||
|
break; // 0xfc
|
||||||
|
|
||||||
|
} // big switch
|
||||||
|
|
||||||
|
// SABL/SABM is only valid for 1 step
|
||||||
|
m_sbl = (m_op == 0x73);
|
||||||
|
m_sbm = (m_op == 0x72);
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,66 @@
|
|||||||
|
|
||||||
// internal helpers
|
// internal helpers
|
||||||
|
|
||||||
u8 sm530_device::ram_r()
|
void sm530_device::do_branch(u8 pu, u8 pl)
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sm530_device::ram_w(u8 data)
|
|
||||||
{
|
{
|
||||||
|
// set new PC(Pu/Pl)
|
||||||
|
m_pc = ((pu << 6) | (pl & 0x3f)) & m_prgmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// instruction set
|
// instruction set
|
||||||
|
|
||||||
|
// RAM address instructions
|
||||||
|
|
||||||
|
void sm530_device::op_lb()
|
||||||
|
{
|
||||||
|
// LB x: load BM/BL with 4-bit immediate value (partial)
|
||||||
|
m_bl = (m_op << 2 & 8) | (m_op & 1) | 6;
|
||||||
|
m_bm = m_op >> 2 & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sm530_device::op_incb()
|
||||||
|
{
|
||||||
|
// INCB: increment BL, but overflow on 3rd bit!
|
||||||
|
sm510_base_device::op_incb();
|
||||||
|
m_skip = (m_bl == 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ROM address instructions
|
||||||
|
|
||||||
|
void sm530_device::op_tl()
|
||||||
|
{
|
||||||
|
// TL xy: long jump
|
||||||
|
do_branch((m_op << 2) | (m_param >> 6 & 3), m_param & 0x3f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sm530_device::op_trs()
|
||||||
|
{
|
||||||
|
// TRS x: indirect subroutine call, jump vectors are on page 14
|
||||||
|
m_icount--;
|
||||||
|
push_stack();
|
||||||
|
u8 jump = m_program->read_byte((14 << 6) | (m_op & 0x3f));
|
||||||
|
do_branch(jump >> 5 & 7, jump & 0x1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Arithmetic instructions
|
||||||
|
|
||||||
|
void sm530_device::op_adx()
|
||||||
|
{
|
||||||
|
// ADX x: add immediate value to ACC, skip next on carry
|
||||||
|
m_acc += (m_op & 0xf);
|
||||||
|
m_skip = bool(m_acc & 0x10);
|
||||||
|
m_acc &= 0xf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// I/O instructions
|
||||||
|
|
||||||
|
void sm530_device::op_atbp()
|
||||||
|
{
|
||||||
|
// ATBP: output ACC to BP
|
||||||
|
m_bp = m_acc;
|
||||||
|
}
|
||||||
|
@ -35,25 +35,21 @@ void sm590_device::data_16x2x4(address_map &map)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm590_device::sm590_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm590_device::sm590_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm590_device(mconfig, SM590, tag, owner, clock, 4 /* stack levels */, 9 /* prg width */, address_map_constructor(FUNC(sm590_device::program_1x128x4), this), 5 /* data width */, address_map_constructor(FUNC(sm590_device::data_16x2x4), this))
|
sm590_device(mconfig, SM590, tag, owner, clock, 4 /* stack levels */, 9 /* prg width */, address_map_constructor(FUNC(sm590_device::program_1x128x4), this), 5 /* data width */, address_map_constructor(FUNC(sm590_device::data_16x2x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
//sm591_device::sm591_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
//sm591_device::sm591_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
// : sm510_base_device(mconfig, SM591, tag, owner, clock, 4 /* stack levels */, 10 /* prg width */, address_map_constructor(FUNC(sm591_device::program_2x128x4), this), 6 /* data width */, address_map_constructor(FUNC(sm591_device::data_16x3.5x4), this))
|
// sm510_base_device(mconfig, SM591, tag, owner, clock, 4 /* stack levels */, 10 /* prg width */, address_map_constructor(FUNC(sm591_device::program_2x128x4), this), 6 /* data width */, address_map_constructor(FUNC(sm591_device::data_16x3.5x4), this))
|
||||||
//{
|
//{ }
|
||||||
//}
|
|
||||||
|
|
||||||
//sm595_device::sm595_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
//sm595_device::sm595_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
// : sm510_base_device(mconfig, SM595, tag, owner, clock, 4 /* stack levels */, 10 /* prg width */, address_map_constructor(FUNC(sm595_device::program_1x128x4_1x128x2), this), 5 /* data width */, address_map_constructor(FUNC(sm595_device::data_16x2x4), this))
|
// sm510_base_device(mconfig, SM595, tag, owner, clock, 4 /* stack levels */, 10 /* prg width */, address_map_constructor(FUNC(sm595_device::program_1x128x4_1x128x2), this), 5 /* data width */, address_map_constructor(FUNC(sm595_device::data_16x2x4), this))
|
||||||
//{
|
//{ }
|
||||||
//}
|
|
||||||
|
|
||||||
sm590_device::sm590_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
|
sm590_device::sm590_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
|
||||||
: sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<util::disasm_interface> sm590_device::create_disassembler()
|
std::unique_ptr<util::disasm_interface> sm590_device::create_disassembler()
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// internal helpers
|
// internal helpers
|
||||||
|
|
||||||
void sm590_device::do_branch(u8 pu, u8 pm, u8 pl)
|
void sm590_device::do_branch(u8 pu, u8 pm, u8 pl)
|
||||||
{
|
{
|
||||||
// set new PC(Pu/Pm/Pl)
|
// set new PC(Pu/Pm/Pl)
|
||||||
|
@ -44,25 +44,21 @@ void sm5a_device::data_5x13x4(address_map &map)
|
|||||||
|
|
||||||
|
|
||||||
// device definitions
|
// device definitions
|
||||||
sm5a_device::sm5a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm5a_device::sm5a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm5a_device(mconfig, SM5A, tag, owner, clock, 1 /* stack levels */, 9 /* o group pins */, 11 /* prg width */, address_map_constructor(FUNC(sm5a_device::program_1_8k), this), 7 /* data width */, address_map_constructor(FUNC(sm5a_device::data_5x13x4), this))
|
sm5a_device(mconfig, SM5A, tag, owner, clock, 1 /* stack levels */, 9 /* o group pins */, 11 /* prg width */, address_map_constructor(FUNC(sm5a_device::program_1_8k), this), 7 /* data width */, address_map_constructor(FUNC(sm5a_device::data_5x13x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm5a_device::sm5a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
|
sm5a_device::sm5a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
|
||||||
: sm500_device(mconfig, type, tag, owner, clock, stack_levels, o_pins, prgwidth, program, datawidth, data)
|
sm500_device(mconfig, type, tag, owner, clock, stack_levels, o_pins, prgwidth, program, datawidth, data)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
sm5l_device::sm5l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
sm5l_device::sm5l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm5a_device(mconfig, SM5L, tag, owner, clock, 1, 9, 11, address_map_constructor(FUNC(sm5l_device::program_1_8k), this), 7, address_map_constructor(FUNC(sm5l_device::data_5x13x4), this))
|
sm5a_device(mconfig, SM5L, tag, owner, clock, 1, 9, 11, address_map_constructor(FUNC(sm5l_device::program_1_8k), this), 7, address_map_constructor(FUNC(sm5l_device::data_5x13x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
|
||||||
: sm5a_device(mconfig, KB1013VK12, tag, owner, clock, 1, 9, 11, address_map_constructor(FUNC(kb1013vk12_device::program_1_8k), this), 7, address_map_constructor(FUNC(kb1013vk12_device::data_5x13x4), this))
|
sm5a_device(mconfig, KB1013VK12, tag, owner, clock, 1, 9, 11, address_map_constructor(FUNC(kb1013vk12_device::program_1_8k), this), 7, address_map_constructor(FUNC(kb1013vk12_device::data_5x13x4), this))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// disasm
|
// disasm
|
||||||
|
Loading…
Reference in New Issue
Block a user