2018-08-26 18:08:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
2018-10-20 19:52:41 +00:00
|
|
|
#include <Bus.h>
|
|
|
|
|
2018-08-26 18:08:07 +00:00
|
|
|
#include "mc6809.h"
|
|
|
|
|
|
|
|
namespace EightBit {
|
2018-08-28 17:28:00 +00:00
|
|
|
class Disassembly final {
|
2018-08-26 18:08:07 +00:00
|
|
|
public:
|
2018-10-20 19:52:41 +00:00
|
|
|
Disassembly(Bus& bus, mc6809& processor);
|
2018-08-26 18:08:07 +00:00
|
|
|
|
2018-08-30 00:37:09 +00:00
|
|
|
bool ignore();
|
2018-08-27 09:43:12 +00:00
|
|
|
|
2018-08-30 00:37:09 +00:00
|
|
|
std::string trace(uint16_t current);
|
|
|
|
std::string trace(register16_t current);
|
|
|
|
std::string trace();
|
2018-08-26 18:08:07 +00:00
|
|
|
|
|
|
|
private:
|
2018-10-20 19:52:41 +00:00
|
|
|
Bus& m_bus;
|
2018-08-27 00:19:22 +00:00
|
|
|
mc6809& m_cpu;
|
2018-08-26 18:08:07 +00:00
|
|
|
|
|
|
|
mutable uint16_t m_address = 0xffff;
|
|
|
|
|
2018-08-27 00:19:22 +00:00
|
|
|
bool m_prefix10 = false;
|
|
|
|
bool m_prefix11 = false;
|
|
|
|
|
2018-08-28 17:28:00 +00:00
|
|
|
static std::string dump_Flags(uint8_t value);
|
|
|
|
static std::string dump_ByteValue(uint8_t value);
|
|
|
|
static std::string dump_RelativeValue(int8_t value);
|
|
|
|
static std::string dump_WordValue(uint16_t value);
|
|
|
|
static std::string dump_WordValue(register16_t value);
|
|
|
|
static std::string dump_RelativeValue(int16_t value);
|
|
|
|
static std::string dump_RelativeValue(register16_t value);
|
|
|
|
|
2018-08-30 00:37:09 +00:00
|
|
|
std::string disassemble(uint16_t current);
|
|
|
|
std::string disassemble(register16_t current);
|
|
|
|
std::string disassemble();
|
|
|
|
|
2018-08-26 18:08:07 +00:00
|
|
|
static void dump(std::ostream& out, int value, int width);
|
|
|
|
|
2018-08-27 00:19:22 +00:00
|
|
|
mc6809& CPU() { return m_cpu; }
|
|
|
|
|
|
|
|
uint8_t getByte(uint16_t address);
|
|
|
|
uint16_t getWord(uint16_t address);
|
|
|
|
|
|
|
|
std::string disassembleUnprefixed();
|
|
|
|
std::string disassemble10();
|
|
|
|
std::string disassemble11();
|
|
|
|
|
|
|
|
//
|
2018-08-27 21:48:08 +00:00
|
|
|
|
2018-08-27 00:19:22 +00:00
|
|
|
std::string RR(int which);
|
2018-08-29 12:25:19 +00:00
|
|
|
std::string wrapIndirect(std::string what, bool indirect);
|
2018-08-27 00:19:22 +00:00
|
|
|
|
2018-08-28 12:56:06 +00:00
|
|
|
std::string Address_direct(std::string mnemomic);
|
2018-08-27 00:19:22 +00:00
|
|
|
std::string Address_indexed(std::string mnemomic);
|
2018-08-27 21:48:08 +00:00
|
|
|
std::string Address_extended(std::string mnemomic);
|
|
|
|
std::string Address_relative_byte(std::string mnemomic);
|
2018-08-28 12:56:06 +00:00
|
|
|
std::string Address_relative_word(std::string mnemomic);
|
2018-08-26 18:08:07 +00:00
|
|
|
|
2018-08-27 12:11:43 +00:00
|
|
|
std::string AM_immediate_byte(std::string mnemomic);
|
2018-08-27 10:29:15 +00:00
|
|
|
std::string AM_immediate_word(std::string mnemomic);
|
2018-08-27 21:48:08 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
std::string branchShort(std::string mnemomic);
|
|
|
|
std::string branchLong(std::string mnemomic);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
std::string referenceTransfer8(int specifier);
|
|
|
|
std::string referenceTransfer16(int specifier);
|
2018-08-28 12:56:06 +00:00
|
|
|
std::string tfr(std::string mnemomic);
|
2018-10-02 21:35:31 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
|
2018-10-03 19:15:44 +00:00
|
|
|
std::string pulS();
|
|
|
|
std::string pulU();
|
|
|
|
std::string pshS();
|
|
|
|
std::string pshU();
|
|
|
|
std::string pulX(std::string mnemomic, std::string upon);
|
|
|
|
std::string pshX(std::string mnemomic, std::string upon);
|
2018-10-20 19:52:41 +00:00
|
|
|
|
|
|
|
Bus& BUS() { return m_bus; }
|
2018-08-26 18:08:07 +00:00
|
|
|
};
|
|
|
|
}
|