Backport Shrooms2 disassembler

This commit is contained in:
2026-10-17 22:01:08 -05:00
parent 31b7403252
commit 41cd7bc089
3 changed files with 779 additions and 620 deletions
+29 -26
View File
@@ -17,25 +17,27 @@ extern "C" {
/********************************* Constants *********************************/
/* Disassembler options */
#define VBU_0X 0
#define VBU_C 1
#define VBU_DEST_FIRST 1
#define VBU_DEST_LAST 0
#define VBU_DOLLAR 1
#define VBU_E 0
#define VBU_H 2
#define VBU_INSIDE 1
#define VBU_JOINED 0
#define VBU_L 0
#define VBU_LOWER 1
#define VBU_NAMES 1
#define VBU_NONE 0
#define VBU_NUMBER 1
#define VBU_NUMBERS 0
#define VBU_OUTSIDE 0
#define VBU_SPLIT 1
#define VBU_UPPER 0
#define VBU_Z 1
#define VBU_ABSOLUTE 0
#define VBU_C 1
#define VBU_DEST_FIRST 1
#define VBU_DEST_LAST 0
#define VBU_E 0
#define VBU_INSIDE 1
#define VBU_JOINED 0
#define VBU_L 0
#define VBU_LOWER 1
#define VBU_NAMES 1
#define VBU_NONE 0
#define VBU_NUMBERS 0
#define VBU_OUTSIDE 0
#define VBU_PREFIX_0X 0
#define VBU_PREFIX_DOLLAR 1
#define VBU_PREFIX_NUMBER 1
#define VBU_RELATIVE 1
#define VBU_SPLIT 1
#define VBU_SUFFIX_H 2
#define VBU_UPPER 0
#define VBU_Z 1
@@ -44,13 +46,14 @@ extern "C" {
/* Disassembler text options */
typedef struct { /* Defaults listed first */
uint8_t bcondNotation; /* JOINED, SPLIT */
uint8_t branchNotation; /* ABSOLUTE, RELATIVE */
uint8_t conditionCase; /* LOWER, UPPER */
uint8_t conditionCL; /* L, C */
uint8_t conditionEZ; /* Z, E */
uint8_t conditionNotation; /* NAMES, NUMBERS */
uint8_t hexCase; /* UPPER, LOWER */
uint8_t hexNotation; /* 0X, H, DOLLAR */
uint8_t immediateNotation; /* NONE, NUMBER */
uint8_t hexNotation; /* PREFIX_0X, SUFFIX_H, PREFIX_DOLLAR */
uint8_t immediateNotation; /* NONE, SUFFIX_NUMBER */
uint8_t memoryNotation; /* OUTSIDE, INSIDE */
uint8_t mnemonicCase; /* UPPER, LOWER */
uint8_t operandOrder; /* DEST_LAST, DEST_FIRST */
@@ -66,7 +69,7 @@ typedef struct {
/* Parsed */
uint32_t address; /* Memory address */
uint16_t code[4]; /* Instruction bytes */
uint8_t code[4]; /* Instruction bytes */
uint8_t codeLength; /* Number of items in code */
uint8_t isPC; /* Set if PC is on this line */
@@ -85,10 +88,10 @@ typedef struct {
/******************************* API Commands ********************************/
VBUAPI int vbuCodeSize (VB *sim, uint32_t address);
VBUAPI VBU_DasmConfig* vbuDasmInit (VBU_DasmConfig *config);
VBUAPI VBU_DasmLine* vbuDisassemble(VB *sim, uint32_t address, VBU_DasmConfig *config, unsigned length, int line);
VBUAPI void* vbuFromISX (void *bytes, size_t length, size_t *romLength);
VBUAPI int vbuCodeSize (VB *sim, uint32_t address);
VBUAPI VBU_DasmConfig* vbuDasmDefaults(VBU_DasmConfig *config);
VBUAPI VBU_DasmLine* vbuDisassemble (VB *sim, uint32_t address, VBU_DasmConfig *config, unsigned length, int line);
VBUAPI void* vbuFromISX (void *bytes, size_t length, size_t *romLength);