2015-06-24 23:26:19 +00:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
2017-03-15 23:19:41 +00:00
|
|
|
#include "DebuggerTypes.h"
|
2015-06-24 23:26:19 +00:00
|
|
|
|
2016-11-20 00:21:28 +00:00
|
|
|
struct State;
|
|
|
|
class MemoryManager;
|
2015-06-24 23:26:19 +00:00
|
|
|
class DisassemblyInfo;
|
2016-11-23 03:38:14 +00:00
|
|
|
class LabelManager;
|
2016-11-28 00:43:17 +00:00
|
|
|
class Debugger;
|
2017-03-15 23:19:41 +00:00
|
|
|
class BaseMapper;
|
2015-06-24 23:26:19 +00:00
|
|
|
|
2018-01-03 23:48:16 +00:00
|
|
|
enum class DataType
|
|
|
|
{
|
|
|
|
VerifiedCode,
|
|
|
|
VerifiedData,
|
|
|
|
UnidentifiedData,
|
|
|
|
};
|
|
|
|
|
2015-06-24 23:26:19 +00:00
|
|
|
class Disassembler
|
|
|
|
{
|
|
|
|
private:
|
2016-11-28 00:43:17 +00:00
|
|
|
Debugger* _debugger;
|
2017-03-15 23:19:41 +00:00
|
|
|
MemoryManager* _memoryManager;
|
|
|
|
BaseMapper *_mapper;
|
|
|
|
|
2015-06-24 23:26:19 +00:00
|
|
|
vector<shared_ptr<DisassemblyInfo>> _disassembleCache;
|
2017-03-15 23:19:41 +00:00
|
|
|
vector<shared_ptr<DisassemblyInfo>> _disassembleWorkRamCache;
|
|
|
|
vector<shared_ptr<DisassemblyInfo>> _disassembleSaveRamCache;
|
2015-07-02 03:17:14 +00:00
|
|
|
vector<shared_ptr<DisassemblyInfo>> _disassembleMemoryCache;
|
2015-06-24 23:26:19 +00:00
|
|
|
|
2018-02-11 02:23:22 +00:00
|
|
|
void GetLine(string &out, string code = "", string comment = string(), int32_t cpuAddress = -1, int32_t absoluteAddress = -1, DataType dataType = DataType::VerifiedCode, char memoryType = ' ');
|
|
|
|
void GetCodeLine(string &out, string &code, string &comment, int32_t cpuAddress, int32_t absoluteAddress, string &byteCode, string &addressing, DataType dataType, bool isIndented, char memoryType = ' ');
|
2017-03-10 04:50:20 +00:00
|
|
|
void GetSubHeader(string &out, DisassemblyInfo *info, string &label, uint16_t relativeAddr, uint16_t resetVector, uint16_t nmiVector, uint16_t irqVector);
|
2017-03-15 23:19:41 +00:00
|
|
|
|
|
|
|
void GetInfo(AddressTypeInfo &info, uint8_t** source, uint32_t &size, vector<shared_ptr<DisassemblyInfo>> **cache);
|
2016-11-19 01:28:11 +00:00
|
|
|
|
2015-06-24 23:26:19 +00:00
|
|
|
public:
|
2017-03-15 23:19:41 +00:00
|
|
|
Disassembler(MemoryManager* memoryManager, BaseMapper* mapper, Debugger* debugger);
|
2015-07-02 03:17:14 +00:00
|
|
|
~Disassembler();
|
2016-12-04 16:16:44 +00:00
|
|
|
|
|
|
|
void BuildOpCodeTables(bool useLowerCase);
|
2017-08-20 02:00:12 +00:00
|
|
|
void Reset();
|
2015-06-24 23:26:19 +00:00
|
|
|
|
2019-11-03 18:52:15 +00:00
|
|
|
uint32_t BuildCache(AddressTypeInfo &info, uint16_t memoryAddr, bool isSubEntryPoint, bool processJumps, bool forceDisassemble = false);
|
2017-03-15 23:19:41 +00:00
|
|
|
void InvalidateCache(AddressTypeInfo &info);
|
2016-01-11 00:56:40 +00:00
|
|
|
|
2017-03-04 21:18:28 +00:00
|
|
|
bool IsUnofficialOpCode(uint8_t opCode);
|
2019-01-20 01:41:31 +00:00
|
|
|
static bool IsJump(uint8_t opCode);
|
2019-01-03 03:40:21 +00:00
|
|
|
bool IsUnconditionalJump(uint8_t opCode);
|
2017-03-04 21:18:28 +00:00
|
|
|
|
2018-01-03 23:48:16 +00:00
|
|
|
string GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uint16_t memoryAddr, State& cpuState, shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager);
|
2016-02-14 03:19:42 +00:00
|
|
|
|
2017-08-05 21:18:09 +00:00
|
|
|
DisassemblyInfo GetDisassemblyInfo(AddressTypeInfo &info);
|
2017-03-11 20:01:33 +00:00
|
|
|
|
|
|
|
void RebuildPrgRomCache(uint32_t absoluteAddr, int32_t length);
|
2015-06-24 23:26:19 +00:00
|
|
|
};
|