mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
cosmac: Attach following byte to disassembly of OUT instruction when P = X
This commit is contained in:
parent
78e33db911
commit
fdbf57d5e2
@ -63,7 +63,7 @@ u32 cosmac_disassembler::opcode_alignment() const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cosmac_disassembler::cosmac_disassembler(int variant) : m_variant(variant)
|
cosmac_disassembler::cosmac_disassembler(int variant, cosmac_disassembler::config *conf) : m_variant(variant), m_config(conf)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,20 +169,13 @@ offs_t cosmac_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
|
|||||||
case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
|
case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
|
||||||
case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
|
case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
|
||||||
CDP1801_OPCODE("STR R%d", implied(opcode)); break;
|
CDP1801_OPCODE("STR R%d", implied(opcode)); break;
|
||||||
case 0x61: CDP1801_OPCODE("OUT 1"); break;
|
case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67:
|
||||||
case 0x62: CDP1801_OPCODE("OUT 2"); break;
|
CDP1801_OPCODE("OUT %d", opcode & 7);
|
||||||
case 0x63: CDP1801_OPCODE("OUT 3"); break;
|
if (m_config && m_config->get_p() == m_config->get_x())
|
||||||
case 0x64: CDP1801_OPCODE("OUT 4"); break;
|
util::stream_format(stream, "; DB #%02X", immediate(pc, params));
|
||||||
case 0x65: CDP1801_OPCODE("OUT 5"); break;
|
break;
|
||||||
case 0x66: CDP1801_OPCODE("OUT 6"); break;
|
case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
|
||||||
case 0x67: CDP1801_OPCODE("OUT 7"); break;
|
CDP1801_OPCODE("INP %d", opcode & 7); break;
|
||||||
case 0x69: CDP1801_OPCODE("INP 1"); break;
|
|
||||||
case 0x6a: CDP1801_OPCODE("INP 2"); break;
|
|
||||||
case 0x6b: CDP1801_OPCODE("INP 3"); break;
|
|
||||||
case 0x6c: CDP1801_OPCODE("INP 4"); break;
|
|
||||||
case 0x6d: CDP1801_OPCODE("INP 5"); break;
|
|
||||||
case 0x6e: CDP1801_OPCODE("INP 6"); break;
|
|
||||||
case 0x6f: CDP1801_OPCODE("INP 7"); break;
|
|
||||||
case 0x70: CDP1801_OPCODE("RET"); flags = STEP_OUT; break;
|
case 0x70: CDP1801_OPCODE("RET"); flags = STEP_OUT; break;
|
||||||
case 0x71: CDP1801_OPCODE("DIS"); flags = STEP_OUT; break;
|
case 0x71: CDP1801_OPCODE("DIS"); flags = STEP_OUT; break;
|
||||||
case 0x78: CDP1801_OPCODE("SAV"); break;
|
case 0x78: CDP1801_OPCODE("SAV"); break;
|
||||||
@ -222,7 +215,11 @@ offs_t cosmac_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
|
|||||||
// CDP1802
|
// CDP1802
|
||||||
case 0x31: CDP1802_OPCODE("BQ %04X", short_branch(base_pc, pc, params)); break;
|
case 0x31: CDP1802_OPCODE("BQ %04X", short_branch(base_pc, pc, params)); break;
|
||||||
case 0x39: CDP1802_OPCODE("BNQ %04X", short_branch(base_pc, pc, params)); break;
|
case 0x39: CDP1802_OPCODE("BNQ %04X", short_branch(base_pc, pc, params)); break;
|
||||||
case 0x60: util::stream_format(stream, m_variant < TYPE_1802 ? "OUT 0" : "IRX"); break;
|
case 0x60:
|
||||||
|
util::stream_format(stream, m_variant < TYPE_1802 ? "OUT 0" : "IRX");
|
||||||
|
if (m_config && m_config->get_p() == m_config->get_x())
|
||||||
|
util::stream_format(stream, "; DB #%02X", immediate(pc, params));
|
||||||
|
break;
|
||||||
case 0x68: disassemble_68(stream, base_pc, pc, opcodes, params); break;
|
case 0x68: disassemble_68(stream, base_pc, pc, opcodes, params); break;
|
||||||
case 0x72: CDP1802_OPCODE("LDXA"); break;
|
case 0x72: CDP1802_OPCODE("LDXA"); break;
|
||||||
case 0x73: CDP1802_OPCODE("STXD"); break;
|
case 0x73: CDP1802_OPCODE("STXD"); break;
|
||||||
|
@ -24,7 +24,14 @@ public:
|
|||||||
TYPE_1805
|
TYPE_1805
|
||||||
};
|
};
|
||||||
|
|
||||||
cosmac_disassembler(int variant);
|
class config {
|
||||||
|
public:
|
||||||
|
virtual ~config() = default;
|
||||||
|
virtual uint8_t get_p() const = 0;
|
||||||
|
virtual uint8_t get_x() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
cosmac_disassembler(int variant, config *conf = nullptr);
|
||||||
virtual ~cosmac_disassembler() = default;
|
virtual ~cosmac_disassembler() = default;
|
||||||
|
|
||||||
virtual u32 opcode_alignment() const override;
|
virtual u32 opcode_alignment() const override;
|
||||||
@ -42,6 +49,8 @@ private:
|
|||||||
offs_t long_skip(offs_t pc);
|
offs_t long_skip(offs_t pc);
|
||||||
|
|
||||||
void disassemble_68(std::ostream &stream, offs_t base_pc, offs_t &pc, const data_buffer &opcodes, const data_buffer ¶ms);
|
void disassemble_68(std::ostream &stream, offs_t base_pc, offs_t &pc, const data_buffer &opcodes, const data_buffer ¶ms);
|
||||||
|
|
||||||
|
config *const m_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,7 +18,6 @@ TODO:
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "cosmac.h"
|
#include "cosmac.h"
|
||||||
#include "cosdasm.h"
|
|
||||||
#include "coreutil.h"
|
#include "coreutil.h"
|
||||||
|
|
||||||
// permit our enums to be saved
|
// permit our enums to be saved
|
||||||
@ -363,6 +362,7 @@ DEFINE_DEVICE_TYPE(CDP1806, cdp1806_device, "cdp1806", "RCA CDP1806")
|
|||||||
|
|
||||||
cosmac_device::cosmac_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
cosmac_device::cosmac_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: cpu_device(mconfig, type, tag, owner, clock),
|
: cpu_device(mconfig, type, tag, owner, clock),
|
||||||
|
cosmac_disassembler::config(),
|
||||||
m_program_config("program", ENDIANNESS_LITTLE, 8, 16),
|
m_program_config("program", ENDIANNESS_LITTLE, 8, 16),
|
||||||
m_io_config("io", ENDIANNESS_LITTLE, 8, 3),
|
m_io_config("io", ENDIANNESS_LITTLE, 8, 3),
|
||||||
m_read_wait(*this),
|
m_read_wait(*this),
|
||||||
@ -620,19 +620,19 @@ void cosmac_device::state_string_export(const device_state_entry &entry, std::st
|
|||||||
|
|
||||||
std::unique_ptr<util::disasm_interface> cdp1801_device::create_disassembler()
|
std::unique_ptr<util::disasm_interface> cdp1801_device::create_disassembler()
|
||||||
{
|
{
|
||||||
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1801);
|
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1801, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<util::disasm_interface> cdp1802_device::create_disassembler()
|
std::unique_ptr<util::disasm_interface> cdp1802_device::create_disassembler()
|
||||||
{
|
{
|
||||||
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1802);
|
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1802, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<util::disasm_interface> cdp1805_device::create_disassembler()
|
std::unique_ptr<util::disasm_interface> cdp1805_device::create_disassembler()
|
||||||
{
|
{
|
||||||
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1805);
|
return std::make_unique<cosmac_disassembler>(cosmac_disassembler::TYPE_1805, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "cosdasm.h"
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -119,7 +120,7 @@ enum cosmac_state_code
|
|||||||
|
|
||||||
// ======================> cosmac_device
|
// ======================> cosmac_device
|
||||||
|
|
||||||
class cosmac_device : public cpu_device
|
class cosmac_device : public cpu_device, public cosmac_disassembler::config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// registers
|
// registers
|
||||||
@ -203,6 +204,10 @@ protected:
|
|||||||
virtual void state_export(const device_state_entry &entry) override;
|
virtual void state_export(const device_state_entry &entry) override;
|
||||||
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
|
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
|
||||||
|
|
||||||
|
// cosmac_disassembler::config overrides
|
||||||
|
virtual uint8_t get_p() const override { return m_p; }
|
||||||
|
virtual uint8_t get_x() const override { return m_x; }
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
inline uint8_t read_opcode(offs_t pc);
|
inline uint8_t read_opcode(offs_t pc);
|
||||||
inline uint8_t read_byte(offs_t address);
|
inline uint8_t read_byte(offs_t address);
|
||||||
|
Loading…
Reference in New Issue
Block a user