fix buggy TOM writes, fixes Baldies

This commit is contained in:
CasualPokePlayer 2022-09-28 19:45:41 -07:00
parent f8a4524df7
commit d7810f6ea9
3 changed files with 18 additions and 9 deletions

Binary file not shown.

View File

@ -319,13 +319,20 @@ bool CDHLEJerryCallback(void)
DACWriteWord(0xF1A14A, GET16(cd_buf2352, cd_buf_pos + 0));
DACWriteWord(0xF1A14E, GET16(cd_buf2352, cd_buf_pos + 2));
//cd_read_addr_start += 4;
cd_buf_pos += 4;
cd_buf_rm -= 4;
// don't think this is right
/*if (cd_read_addr_start > cd_read_addr_end && !((cd_read_addr_start - cd_read_orig_addr_start) & 0x3F))
{
cd_is_reading = false;
}*/
return true;
}
static void ResetCallbacks(void)
static void ResetCallback(void)
{
RemoveCallback(CDHLECallback);
if (!cd_jerry)
@ -431,7 +438,7 @@ static void CD_jeri(void)
{
fprintf(stderr, "changing jerry mode %d -> %d\n", cd_jerry, njerry);
cd_jerry = njerry;
ResetCallbacks();
ResetCallback();
}
}
@ -573,7 +580,7 @@ static void CD_read(void)
cd_buf_pos = 0;
cd_buf_rm = bufRm;
cd_buf_circular_size = circBufSz ? (1 << circBufSz) : 0;
ResetCallbacks();
ResetCallback();
JERRYWriteWord(0xF10020, 0, M68K);
//GPUWriteLong(0xF02100, GPUReadLong(0xF02100, M68K) | 0x20, M68K);
break;
@ -594,7 +601,7 @@ static void CD_read(void)
cd_buf_pos = 0;
cd_buf_rm = 0;
cd_buf_circular_size = 0;
ResetCallbacks();
ResetCallback();
JERRYWriteWord(0xF10020, 0, M68K);
//GPUWriteLong(0xF02100, GPUReadLong(0xF02100, M68K) | 0x20, M68K);
}

View File

@ -555,8 +555,6 @@ uint16_t TOMReadWord(uint32_t offset, uint32_t who)
//
void TOMWriteByte(uint32_t offset, uint8_t data, uint32_t who)
{
tomRam8[offset & 0x3FFF] = data;
if ((offset >= 0xF08000) && (offset <= 0xF0BFFF))
offset &= 0xFF7FFF;
@ -601,6 +599,10 @@ void TOMWriteByte(uint32_t offset, uint8_t data, uint32_t who)
offset &= 0x5FF;
tomRam8[offset] = data, tomRam8[offset + 0x200] = data;
}
else
{
tomRam8[offset & 0x3FFF] = data;
}
}
//
@ -608,9 +610,6 @@ void TOMWriteByte(uint32_t offset, uint8_t data, uint32_t who)
//
void TOMWriteWord(uint32_t offset, uint16_t data, uint32_t who)
{
tomRam8[(offset + 0) & 0x3FFF] = data >> 8;
tomRam8[(offset + 1) & 0x3FFF] = data & 0xFF;
if ((offset >= 0xF08000) && (offset <= 0xF0BFFF))
offset &= 0xFF7FFF;
@ -680,6 +679,9 @@ void TOMWriteWord(uint32_t offset, uint16_t data, uint32_t who)
tomWidth = width, tomHeight = height;
}
}
tomRam8[(offset + 0) & 0x3FFF] = data >> 8;
tomRam8[(offset + 1) & 0x3FFF] = data & 0xFF;
}
int TOMIRQEnabled(int irq)