mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
m6809/konami: enable 'hd6309 native mode'
This commit is contained in:
parent
14c847d681
commit
814ef88c1a
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nathan Woods,Sean Riddle,Tim Lindner
|
||||
/*****************************************************************************
|
||||
|
||||
6x09dasm.cpp - a 6809/6309/Konami opcode disassembler
|
||||
a 6809/6309/Konami opcode disassembler
|
||||
|
||||
Based on:
|
||||
6309dasm.c - a 6309 opcode disassembler
|
||||
@ -10,7 +10,6 @@
|
||||
Copyright Tim Lindner
|
||||
|
||||
and
|
||||
|
||||
6809dasm.c - a 6809 opcode disassembler
|
||||
Version 1.4 1-MAR-95
|
||||
Copyright Sean Riddle
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nathan Woods,Sean Riddle,Tim Lindner
|
||||
/*****************************************************************************
|
||||
|
||||
6x09dasm.cpp - a 6809/6309/Konami opcode disassembler
|
||||
a 6809/6309/Konami opcode disassembler
|
||||
|
||||
Based on:
|
||||
6309dasm.c - a 6309 opcode disassembler
|
||||
|
@ -2,8 +2,6 @@
|
||||
// copyright-holders:Nathan Woods,Tim Lindner
|
||||
/*********************************************************************
|
||||
|
||||
hd6309.c
|
||||
|
||||
Copyright John Butler
|
||||
Copyright Tim Lindner
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/*********************************************************************
|
||||
|
||||
hd6309.h
|
||||
|
||||
Portable Hitachi 6309 emulator
|
||||
|
||||
**********************************************************************/
|
||||
@ -49,6 +47,7 @@ protected:
|
||||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||
|
||||
virtual bool is_6809() override { return false; }
|
||||
virtual bool hd6309_native_mode() override { return m_md & 0x01; }
|
||||
|
||||
private:
|
||||
typedef m6809_base_device super;
|
||||
@ -77,11 +76,11 @@ private:
|
||||
};
|
||||
|
||||
// CPU registers
|
||||
PAIR16 m_v;
|
||||
uint8_t m_md;
|
||||
PAIR16 m_v;
|
||||
uint8_t m_md;
|
||||
|
||||
// other state
|
||||
uint8_t m_temp_im;
|
||||
uint8_t m_temp_im;
|
||||
|
||||
// operand reading/writing
|
||||
uint8_t read_operand();
|
||||
@ -90,8 +89,8 @@ private:
|
||||
void write_operand(int ordinal, uint8_t data);
|
||||
|
||||
// interrupt registers
|
||||
bool firq_saves_entire_state() { return m_md & 0x02; }
|
||||
uint16_t entire_state_registers() { return hd6309_native_mode() ? 0x3FF : 0xFF; }
|
||||
bool firq_saves_entire_state() { return m_md & 0x02; }
|
||||
uint16_t entire_state_registers() { return hd6309_native_mode() ? 0x3FF : 0xFF; }
|
||||
|
||||
// bit tests
|
||||
uint8_t &bittest_register();
|
||||
@ -105,16 +104,15 @@ private:
|
||||
bool divd();
|
||||
|
||||
// miscellaneous
|
||||
void set_e() { m_addressing_mode = ADDRESSING_MODE_REGISTER_E; }
|
||||
void set_f() { m_addressing_mode = ADDRESSING_MODE_REGISTER_F; }
|
||||
void set_w() { m_addressing_mode = ADDRESSING_MODE_REGISTER_W; }
|
||||
void set_e() { m_addressing_mode = ADDRESSING_MODE_REGISTER_E; }
|
||||
void set_f() { m_addressing_mode = ADDRESSING_MODE_REGISTER_F; }
|
||||
void set_w() { m_addressing_mode = ADDRESSING_MODE_REGISTER_W; }
|
||||
uint16_t read_exgtfr_register(uint8_t reg);
|
||||
void write_exgtfr_register(uint8_t reg, uint16_t value);
|
||||
bool tfr_read(uint8_t opcode, uint8_t arg, uint8_t &data);
|
||||
bool tfr_write(uint8_t opcode, uint8_t arg, uint8_t data);
|
||||
bool add8_sets_h() { return (m_opcode & 0xFE) != 0x30; }
|
||||
bool add8_sets_h() { return (m_opcode & 0xFE) != 0x30; }
|
||||
void register_register_op();
|
||||
bool hd6309_native_mode() { return m_md & 0x01; }
|
||||
|
||||
void execute_one();
|
||||
};
|
||||
|
@ -2,9 +2,8 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/*********************************************************************
|
||||
|
||||
konami.c
|
||||
|
||||
Portable Konami cpu emulator
|
||||
Custom HD6309 in a gate array with ROM blocks for instruction decoding.
|
||||
|
||||
Based on M6809 cpu core copyright John Butler
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/*********************************************************************
|
||||
|
||||
konami.h
|
||||
|
||||
Portable Konami CPU emulator
|
||||
|
||||
**********************************************************************/
|
||||
@ -44,6 +42,8 @@ protected:
|
||||
// device_disasm_interface overrides
|
||||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||
|
||||
virtual bool hd6309_native_mode() override { return true; }
|
||||
|
||||
private:
|
||||
typedef m6809_base_device super;
|
||||
|
||||
|
@ -410,7 +410,7 @@ INDEXED:
|
||||
case 0xA7: case 0xB7: case 0xD7: case 0xE7: case 0xF7:
|
||||
// relative to register D
|
||||
m_temp.w = ireg() + (int16_t) m_q.r.d;
|
||||
@eat(4);
|
||||
@eat(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -579,7 +579,6 @@ RORD:
|
||||
ABS8:
|
||||
@m_temp.b.l = read_operand();
|
||||
m_temp.b.l = set_flags<uint8_t>(CC_NZVC, 0, m_temp.b.l, ((int8_t) m_temp.b.l) >= 0 ? m_temp.b.l : -m_temp.b.l);
|
||||
@eat(1);
|
||||
write_operand(m_temp.b.l);
|
||||
return;
|
||||
|
||||
@ -587,7 +586,6 @@ ABS16:
|
||||
@m_temp.b.h = read_operand(0);
|
||||
@m_temp.b.l = read_operand(1);
|
||||
m_temp.w = set_flags<uint16_t>(CC_NZVC, 0, m_temp.w, ((int16_t) m_temp.w) >= 0 ? m_temp.w : -m_temp.w);
|
||||
@eat(1);
|
||||
@write_operand(0, m_temp.b.h);
|
||||
write_operand(1, m_temp.b.l);
|
||||
return;
|
||||
|
@ -2,8 +2,6 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/*********************************************************************
|
||||
|
||||
m6809.h
|
||||
|
||||
Portable Motorola 6809 emulator
|
||||
|
||||
**********************************************************************/
|
||||
@ -157,13 +155,13 @@ protected:
|
||||
M6809Q m_q; // accumulator a and b (plus e and f on 6309)
|
||||
PAIR16 m_x, m_y; // index registers
|
||||
PAIR16 m_u, m_s; // stack pointers
|
||||
uint8_t m_dp; // direct page register
|
||||
uint8_t m_cc;
|
||||
uint8_t m_dp; // direct page register
|
||||
uint8_t m_cc;
|
||||
PAIR16 m_temp;
|
||||
uint8_t m_opcode;
|
||||
uint8_t m_opcode;
|
||||
|
||||
// other internal state
|
||||
uint8_t * m_reg8;
|
||||
uint8_t * m_reg8;
|
||||
PAIR16 * m_reg16;
|
||||
int m_reg;
|
||||
bool m_nmi_line;
|
||||
@ -176,10 +174,10 @@ protected:
|
||||
PAIR16 m_ea; // effective address
|
||||
|
||||
// Callbacks
|
||||
devcb_write_line m_lic_func; // LIC pin on the 6809E
|
||||
devcb_write_line m_lic_func; // LIC pin on the 6809E
|
||||
|
||||
// eat cycles
|
||||
inline void eat(int cycles) { m_icount -= cycles; }
|
||||
inline void eat(int cycles) { m_icount -= cycles; }
|
||||
void eat_remaining();
|
||||
|
||||
// read a byte from given memory location
|
||||
@ -198,22 +196,22 @@ protected:
|
||||
inline uint8_t read_opcode_arg(uint16_t address) { eat(1); return m_mintf->read_opcode_arg(address); }
|
||||
|
||||
// read_opcode() and bump the program counter
|
||||
inline uint8_t read_opcode() { return read_opcode(m_pc.w++); }
|
||||
inline uint8_t read_opcode_arg() { return read_opcode_arg(m_pc.w++); }
|
||||
inline void dummy_read_opcode_arg(uint16_t delta) { read_opcode_arg(m_pc.w + delta); }
|
||||
inline void dummy_vma(int count) { for(int i=0; i != count; i++) { read_opcode_arg(0xffff); } }
|
||||
inline uint8_t read_opcode() { return read_opcode(m_pc.w++); }
|
||||
inline uint8_t read_opcode_arg() { return read_opcode_arg(m_pc.w++); }
|
||||
inline void dummy_read_opcode_arg(uint16_t delta) { read_opcode_arg(m_pc.w + delta); }
|
||||
inline void dummy_vma(int count) { for(int i=0; i != count; i++) { read_opcode_arg(0xffff); } }
|
||||
|
||||
// state stack - implemented as a uint32_t
|
||||
void push_state(uint16_t state) { m_state = (m_state << 9) | state; }
|
||||
uint16_t pop_state() { uint16_t result = m_state & 0x1ff; m_state >>= 9; return result; }
|
||||
void push_state(uint16_t state) { m_state = (m_state << 9) | state; }
|
||||
uint16_t pop_state() { uint16_t result = m_state & 0x1ff; m_state >>= 9; return result; }
|
||||
void reset_state() { m_state = 0; }
|
||||
|
||||
// effective address reading/writing
|
||||
uint8_t read_ea() { return read_memory(m_ea.w); }
|
||||
void write_ea(uint8_t data) { write_memory(m_ea.w, data); }
|
||||
void set_ea(uint16_t ea) { m_ea.w = ea; m_addressing_mode = ADDRESSING_MODE_EA; }
|
||||
void set_ea_h(uint8_t ea_h) { m_ea.b.h = ea_h; }
|
||||
void set_ea_l(uint8_t ea_l) { m_ea.b.l = ea_l; m_addressing_mode = ADDRESSING_MODE_EA; }
|
||||
uint8_t read_ea() { return read_memory(m_ea.w); }
|
||||
void write_ea(uint8_t data) { write_memory(m_ea.w, data); }
|
||||
void set_ea(uint16_t ea) { m_ea.w = ea; m_addressing_mode = ADDRESSING_MODE_EA; }
|
||||
void set_ea_h(uint8_t ea_h) { m_ea.b.h = ea_h; }
|
||||
void set_ea_l(uint8_t ea_l) { m_ea.b.l = ea_l; m_addressing_mode = ADDRESSING_MODE_EA; }
|
||||
|
||||
// operand reading/writing
|
||||
uint8_t read_operand();
|
||||
@ -233,13 +231,13 @@ protected:
|
||||
void set_b() { m_addressing_mode = ADDRESSING_MODE_REGISTER_B; }
|
||||
void set_d() { m_addressing_mode = ADDRESSING_MODE_REGISTER_D; }
|
||||
void set_imm() { m_addressing_mode = ADDRESSING_MODE_IMMEDIATE; }
|
||||
void set_regop8(uint8_t ®) { m_reg8 = ® m_reg16 = nullptr; }
|
||||
void set_regop8(uint8_t ®) { m_reg8 = ® m_reg16 = nullptr; }
|
||||
void set_regop16(PAIR16 ®) { m_reg16 = ® m_reg8 = nullptr; }
|
||||
uint8_t ®op8() { assert(m_reg8 != nullptr); return *m_reg8; }
|
||||
uint8_t ®op8() { assert(m_reg8 != nullptr); return *m_reg8; }
|
||||
PAIR16 ®op16() { assert(m_reg16 != nullptr); return *m_reg16; }
|
||||
bool is_register_register_op_16_bit() { return m_reg16 != nullptr; }
|
||||
bool add8_sets_h() { return true; }
|
||||
bool hd6309_native_mode() { return false; }
|
||||
virtual bool hd6309_native_mode() { return false; }
|
||||
|
||||
// index reg
|
||||
uint16_t &ireg();
|
||||
@ -250,10 +248,10 @@ protected:
|
||||
|
||||
// branch conditions
|
||||
inline bool cond_hi() { return !(m_cc & CC_ZC); } // BHI/BLS
|
||||
inline bool cond_cc() { return !(m_cc & CC_C); } // BCC/BCS
|
||||
inline bool cond_ne() { return !(m_cc & CC_Z); } // BNE/BEQ
|
||||
inline bool cond_vc() { return !(m_cc & CC_V); } // BVC/BVS
|
||||
inline bool cond_pl() { return !(m_cc & CC_N); } // BPL/BMI
|
||||
inline bool cond_cc() { return !(m_cc & CC_C); } // BCC/BCS
|
||||
inline bool cond_ne() { return !(m_cc & CC_Z); } // BNE/BEQ
|
||||
inline bool cond_vc() { return !(m_cc & CC_V); } // BVC/BVS
|
||||
inline bool cond_pl() { return !(m_cc & CC_N); } // BPL/BMI
|
||||
inline bool cond_ge() { return (m_cc & CC_N ? true : false) == (m_cc & CC_V ? true : false); } // BGE/BLT
|
||||
inline bool cond_gt() { return cond_ge() && !(m_cc & CC_Z); } // BGT/BLE
|
||||
inline void set_cond(bool cond) { m_cond = cond; }
|
||||
@ -261,8 +259,8 @@ protected:
|
||||
|
||||
// interrupt registers
|
||||
bool firq_saves_entire_state() { return false; }
|
||||
uint16_t partial_state_registers() { return 0x81; }
|
||||
uint16_t entire_state_registers() { return 0xFF; }
|
||||
uint16_t partial_state_registers() { return 0x81; }
|
||||
uint16_t entire_state_registers() { return 0xFF; }
|
||||
|
||||
// miscellaneous
|
||||
inline uint16_t read_tfr_exg_816_register(uint8_t reg);
|
||||
|
@ -2,8 +2,6 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/*********************************************************************
|
||||
|
||||
m6809inl.h
|
||||
|
||||
Portable 6809 emulator - Inline functions for the purposes of
|
||||
optimization
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user