So I noticed this post in the ERE forum mentioning that a PAR that works in Kega didn't work correctly in Gens.
It appears that Gens does not handle PAR codes like the hardware does. In gens, the write size for RAM writes is based on how many characters are after the :, but since the real hardware forces you into FFXXXXXXXX format, you don't have a choice on that. Gens also supports 32-bit writes, which isn't possible on the real PAR hardware.
As described in this post, if a PAR code is <= 0xFF, it is considered to be 8-bit and written that way. Thus a code with a value of :00FB would only write FB at the 8-bit address specified.
The problem lies in gg_code.c:
Could you add
Would you agree with this change? I guess it may break 16-bit codes designed specifically for Gens, but for accuracy it would be correct.
It appears that Gens does not handle PAR codes like the hardware does. In gens, the write size for RAM writes is based on how many characters are after the :, but since the real hardware forces you into FFXXXXXXXX format, you don't have a choice on that. Gens also supports 32-bit writes, which isn't possible on the real PAR hardware.
As described in this post, if a PAR code is <= 0xFF, it is considered to be 8-bit and written that way. Thus a code with a value of :00FB would only write FB at the 8-bit address specified.
The problem lies in gg_code.c:
CODE
int data_chr_len = strlen(code) - pos_colon - 1; // Length of the data segment.
if (data_chr_len <= 2)
{
// 1-2 characters: 8-bit code.
datasize = DS_BYTE;
data &= 0xFF;
}
else if (data_chr_len <= 4)
{
// 3-4 characters: 16-bit code.
datasize = DS_WORD;
data &= 0xFFFF;
}
else if (data_chr_len <= 8)
{
// 5-8 characters: 32-bit code.
datasize = DS_DWORD;
}
if (data_chr_len <= 2)
{
// 1-2 characters: 8-bit code.
datasize = DS_BYTE;
data &= 0xFF;
}
else if (data_chr_len <= 4)
{
// 3-4 characters: 16-bit code.
datasize = DS_WORD;
data &= 0xFFFF;
}
else if (data_chr_len <= 8)
{
// 5-8 characters: 32-bit code.
datasize = DS_DWORD;
}
Could you add
CODE
if(data <= 0xFF){
datasize = DS_BYTE;
}
to the end of the data_chr_len <= 4 case so that it properly handles PAR codes in the original format?datasize = DS_BYTE;
}
Would you agree with this change? I guess it may break 16-bit codes designed specifically for Gens, but for accuracy it would be correct.


