Fix disassembler not advancing past PC

This commit is contained in:
Guy Perfect 2024-11-01 15:01:09 -05:00
parent ae22c95dbe
commit 53826584b8
3 changed files with 21 additions and 3 deletions

View File

@ -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 ***********************************/

View File

@ -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 */

View File

@ -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 */