2017-06-04 20:38:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-22 20:57:01 +00:00
|
|
|
#include <cstdint>
|
2017-06-04 20:38:34 +00:00
|
|
|
#include <string>
|
2017-10-22 20:57:01 +00:00
|
|
|
#include <sstream>
|
2017-07-25 13:12:34 +00:00
|
|
|
#include <boost/format.hpp>
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2018-10-20 19:52:41 +00:00
|
|
|
#include <Bus.h>
|
|
|
|
|
|
|
|
#include "Intel8080.h"
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-11-05 12:47:42 +00:00
|
|
|
namespace EightBit {
|
2017-06-04 20:38:34 +00:00
|
|
|
class Disassembler {
|
|
|
|
public:
|
2018-10-20 19:52:41 +00:00
|
|
|
Disassembler(Bus& bus) noexcept;
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2018-06-24 19:58:20 +00:00
|
|
|
static std::string state(Intel8080& cpu);
|
|
|
|
std::string disassemble(Intel8080& cpu);
|
2017-06-04 20:38:34 +00:00
|
|
|
|
2017-07-25 13:32:31 +00:00
|
|
|
static std::string flag(uint8_t value, int flag, std::string represents, std::string off = "-");
|
2017-06-16 00:58:12 +00:00
|
|
|
static std::string flags(uint8_t value);
|
2017-06-04 20:38:34 +00:00
|
|
|
static std::string hex(uint8_t value);
|
|
|
|
static std::string hex(uint16_t value);
|
|
|
|
static std::string binary(uint8_t value);
|
|
|
|
|
|
|
|
static std::string invalid(uint8_t value);
|
2017-07-25 13:12:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
mutable boost::format m_formatter;
|
2018-10-20 19:52:41 +00:00
|
|
|
Bus& m_bus;
|
2017-07-25 13:12:34 +00:00
|
|
|
|
2018-06-24 19:58:20 +00:00
|
|
|
void disassemble(std::ostringstream& output, Intel8080& cpu, uint16_t pc);
|
2017-07-25 13:12:34 +00:00
|
|
|
|
|
|
|
void disassemble(
|
|
|
|
std::ostringstream& output,
|
|
|
|
const Intel8080& cpu,
|
|
|
|
uint16_t pc,
|
|
|
|
std::string& specification,
|
|
|
|
int& dumpCount,
|
|
|
|
int x, int y, int z,
|
|
|
|
int p, int q);
|
|
|
|
|
|
|
|
std::string RP(int rp) const;
|
|
|
|
std::string RP2(int rp) const;
|
|
|
|
std::string R(int r) const;
|
|
|
|
static std::string cc(int flag);
|
|
|
|
static std::string alu(int which);
|
|
|
|
static std::string alu2(int which);
|
2018-10-20 19:52:41 +00:00
|
|
|
|
|
|
|
Bus& BUS() { return m_bus; }
|
2017-06-04 20:38:34 +00:00
|
|
|
};
|
|
|
|
}
|