From 53826584b839ccc0d72f3b5e64c63153408ae10b Mon Sep 17 00:00:00 2001 From: Guy Perfect Date: Fri, 1 Nov 2024 15:01:09 -0500 Subject: [PATCH] Fix disassembler not advancing past PC --- core/vb.h | 18 ++++++++++++++++++ core/vsu.c | 2 +- util/disassembler.c | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core/vb.h b/core/vb.h index aebd68f..b535485 100644 --- a/core/vb.h +++ b/core/vb.h @@ -84,6 +84,24 @@ extern "C" { /* Option keys */ #define VB_PSEUDO_HALT 0 +/* Controller buttons */ +#define VB_PWR 0x0001 +#define VB_SGN 0x0002 +#define VB_A 0x0004 +#define VB_B 0x0008 +#define VB_RT 0x0010 +#define VB_LT 0x0020 +#define VB_RU 0x0040 +#define VB_RR 0x0080 +#define VB_LR 0x0100 +#define VB_LL 0x0200 +#define VB_LD 0x0400 +#define VB_LU 0x0800 +#define VB_STA 0x1000 +#define VB_SEL 0x2000 +#define VB_RL 0x4000 +#define VB_RD 0x8000 + /*********************************** Types ***********************************/ diff --git a/core/vsu.c b/core/vsu.c index cf4c866..5cf2e83 100644 --- a/core/vsu.c +++ b/core/vsu.c @@ -295,7 +295,7 @@ static void vsuWriteLRV(VB *sim, int index, uint8_t value) { /* Write a value to S*RAM */ static void vsuWriteRAM(VB *sim, int index, uint8_t value) { - sim->vsu.channels[index].wave.wave = value & 7; + sim->vsu.channels[index].wave.wave = value & 15; } /* Write a value to S5SWP */ diff --git a/util/disassembler.c b/util/disassembler.c index 80f1743..3165e85 100644 --- a/util/disassembler.c +++ b/util/disassembler.c @@ -511,7 +511,7 @@ static int dasmLine(VB *sim, uint32_t *address, uint32_t pc, line->isPC = *address == pc; for (x = 0; x < line->codeLength; x++) line->code[x] = vbRead(sim, *address + x, VB_U8); - *address += pc - *address < line->codeLength ? + *address += pc != *address && pc - *address < line->codeLength ? pc - *address : line->codeLength; /* Do not process text members */ @@ -655,7 +655,7 @@ static VBU_DasmLine* dasmDisassemble(VB *sim, uint32_t address, size = dasmInstSize(sim, addr); if (address - addr < size) break; - addr += pc - addr < size ? pc - addr : size; + addr += addr != pc && pc - addr < size ? pc - addr : size; } /* Address of first line is in the circular buffer */