2019-02-12 22:13:09 -05:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
2019-03-07 20:12:32 -05:00
|
|
|
class Console;
|
2019-07-25 22:22:09 -04:00
|
|
|
class MemoryDumper;
|
2019-04-28 22:19:52 -04:00
|
|
|
class LabelManager;
|
2020-02-07 22:55:27 -05:00
|
|
|
class EmuSettings;
|
2019-02-12 22:13:09 -05:00
|
|
|
|
2019-07-25 22:22:09 -04:00
|
|
|
enum class SnesMemoryType;
|
2019-04-06 09:15:19 -04:00
|
|
|
enum class CpuType : uint8_t;
|
2019-02-12 22:13:09 -05:00
|
|
|
|
|
|
|
class DisassemblyInfo
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
uint8_t _byteCode[4];
|
|
|
|
uint8_t _opSize;
|
|
|
|
uint8_t _flags;
|
2019-04-06 09:15:19 -04:00
|
|
|
CpuType _cpuType;
|
2019-04-05 00:02:43 -04:00
|
|
|
bool _initialized = false;
|
2019-02-12 22:13:09 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
DisassemblyInfo();
|
2021-03-10 11:13:28 -05:00
|
|
|
DisassemblyInfo(uint8_t *opPointer, uint8_t cpuFlags, CpuType type);
|
2019-02-27 19:49:26 -05:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
void Initialize(uint8_t *opPointer, uint8_t cpuFlags, CpuType type);
|
2020-05-18 16:10:53 -04:00
|
|
|
void Initialize(uint32_t cpuAddress, uint8_t cpuFlags, CpuType type, MemoryDumper* memoryDumper);
|
2019-04-05 00:02:43 -04:00
|
|
|
bool IsInitialized();
|
2019-05-14 19:11:00 -04:00
|
|
|
bool IsValid(uint8_t cpuFlags);
|
2019-04-05 00:02:43 -04:00
|
|
|
void Reset();
|
2019-02-12 22:13:09 -05:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
void GetDisassembly(string &out, uint32_t memoryAddr, LabelManager *labelManager, EmuSettings* settings);
|
|
|
|
|
2019-07-30 22:34:52 -04:00
|
|
|
CpuType GetCpuType();
|
2019-04-06 09:15:19 -04:00
|
|
|
uint8_t GetOpCode();
|
2019-04-06 17:38:14 -04:00
|
|
|
uint8_t GetOpSize();
|
2019-04-06 09:15:19 -04:00
|
|
|
uint8_t GetFlags();
|
|
|
|
uint8_t* GetByteCode();
|
2019-02-27 19:49:26 -05:00
|
|
|
|
|
|
|
void GetByteCode(uint8_t copyBuffer[4]);
|
2021-03-10 11:13:28 -05:00
|
|
|
void GetByteCode(string &out);
|
2019-04-06 09:15:19 -04:00
|
|
|
|
2019-04-06 17:38:14 -04:00
|
|
|
static uint8_t GetOpSize(uint8_t opCode, uint8_t flags, CpuType type);
|
2019-04-07 12:25:14 -04:00
|
|
|
static bool IsJumpToSub(uint8_t opCode, CpuType type);
|
|
|
|
static bool IsReturnInstruction(uint8_t opCode, CpuType type);
|
|
|
|
|
2020-05-18 16:10:53 -04:00
|
|
|
bool IsUnconditionalJump();
|
|
|
|
void UpdateCpuFlags(uint8_t& cpuFlags);
|
2019-05-14 19:11:00 -04:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
int32_t GetEffectiveAddress(Console *console, void *cpuState, CpuType type);
|
|
|
|
uint16_t GetMemoryValue(uint32_t effectiveAddress, MemoryDumper *memoryDumper, SnesMemoryType memType, uint8_t &valueSize);
|
2019-02-12 22:13:09 -05:00
|
|
|
};
|
2021-03-10 11:13:28 -05:00
|
|
|
|