openMSX
Dasm.hh
Go to the documentation of this file.
1#ifndef DASM_HH
2#define DASM_HH
3
4#include "EmuTime.hh"
5
6#include <cstdint>
7#include <functional>
8#include <span>
9#include <string>
10
11namespace openmsx {
12
13class MSXCPUInterface;
14
15void appendAddrAsHex(std::string& output, uint16_t addr);
16
26unsigned dasm(const MSXCPUInterface& interface, uint16_t pc, std::span<uint8_t, 4> buf,
27 std::string& dest, EmuTime::param time,
28 std::function<void(std::string&, uint16_t)> appendAddr = &appendAddrAsHex);
29
37unsigned instructionLength(const MSXCPUInterface& interface, uint16_t pc,
38 EmuTime::param time);
39
58uint16_t instructionBoundary(const MSXCPUInterface& interface, uint16_t addr,
59 EmuTime::param time);
60
69uint16_t nInstructionsBefore(const MSXCPUInterface& interface, uint16_t addr,
70 EmuTime::param time, int n);
71
72} // namespace openmsx
73
74#endif
This file implemented 3 utility functions:
Definition: Autofire.cc:9
unsigned dasm(const MSXCPUInterface &interface, uint16_t pc, std::span< uint8_t, 4 > buf, std::string &dest, EmuTime::param time, std::function< void(std::string &, uint16_t)> appendAddr)
Disassemble.
Definition: Dasm.cc:24
uint16_t instructionBoundary(const MSXCPUInterface &interface, uint16_t addr, EmuTime::param time)
This is only an heuristic to display instructions in a debugger disassembly view.
Definition: Dasm.cc:173
uint16_t nInstructionsBefore(const MSXCPUInterface &interface, uint16_t addr, EmuTime::param time, int n)
Get the start address of the 'n'th instruction before the instruction containing the byte at the give...
Definition: Dasm.cc:180
unsigned instructionLength(const MSXCPUInterface &interface, uint16_t pc, EmuTime::param time)
Calculate the length of the instruction at the given address.
Definition: Dasm.cc:112
void appendAddrAsHex(std::string &output, uint16_t addr)
Definition: Dasm.cc:19