[hatari-devel] Conditional breakpoint code, please comment!
npomarede at corp.free.fr
npomarede at corp.free.fr
Sat Jul 4 17:17:50 CEST 2009
On Sat, 4 Jul 2009, Eero Tamminen wrote:
> Hi,
>
>> On Friday 03 July 2009, npomarede at corp.free.fr wrote:
>>> I committed a change to handle addresses between 0xff8000 and 0xffffff.
>>>
>>> In the case of indirect addresses, I also added a mask to only keep the
>>> 24 lower bits of the address (when checking value and reading memory).
>>> This way $ffff820a is also recognized as io mem $ff820a (which is the
>>> same in the 68000).
>
> Btw. Why the masking is done both when checking breakpoints:
> --------------------------------
> @@ -102,6 +102,8 @@
> */
> static Uint32 BreakCond_ReadSTMemory(Uint32 addr, const bc_value_t
> *bc_value)
> {
> + addr &= 0x00ffffff; /* use a 24 bit address */
> +
> switch (bc_value->bits) {
> case 32:
> return STMemory_ReadLong(addr);
> --------------------------------
>
> And when parsing them:
> --------------------------------
> @@ -301,7 +303,9 @@
> EXITFUNC(("-> true (DSP)\n"));
> return true;
> }
> - if ((addr > STRamEnd && addr < 0xe00000) || addr > 0xff0000) {
> +
> + addr &= 0x00ffffff; /* use a 24 bit address */
> + if ((addr > STRamEnd && addr < 0xe00000) || (addr >= 0xff0000 && addr <
> 0xff8000)) {
> --------------------------------
>
> Why parsing stage shouldn't give a warning if given address is > 0x00ffffff?
> (user probably mistyped it and masking it would be misleading?)
>
When parsing, we should check only for the lowest 24 bit of the address,
as done in the 68000, since bits 24-31 are ignored anyway.
In fact, we could consider that the address needs a warning if bit 23 (0
or 1) is not correctly extended to bit 24-31 in case those bits are not
all 0 or all 1.
So, valid addresses without warning would be :
$00ff820a, $ffff820a, $00123456
And valid addresses with a warning would be :
$0fff820a, $f0ff820a, $55ff820a, $ff123456, $07123456
sthg like :
bit23 = ( address >> 23 ) & 1;
highbyte = ( address >> 24 ) & 255;
if ( ( bit23==0 && highbyte!=0 ) || ( bit23==1 && highbyte!=0xff ) )
print_warning ( address );
With this, we're reaching the limit of the refinement we can make :)
Nicolas
More information about the hatari-devel
mailing list