Re: [hatari-devel] Dynamic Bus Sizing and I/O Register Access

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Wed, 10 Jan 2024 23:53:43 +0200
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:

> Hi,
> 
> On 9.1.2024 21.07, Andreas Grabher wrote:
> > I have a question regarding register access via ioMem.c:
> > 
> > Does this code respect 68020 and 68030 dynamic bus sizing?
> > 
> > I have a problem with Previous that seems to be impossible to solve with the given code. There is a byte wide register on the board that is accessed in two ways on the 68030. The bootloader uses long (32 bit) access and the OS uses byte (8 bit) access to read or write this register. While this obviously works on real hardware it fails on Previous. I can either make it work with byte or with long access but not both. I suspect that dynamic bus sizing is not yet emulated. Or am I using the code in the wrong way?
> > 
> > This is the entry in the memory table:
> > { 0x02010000, SIZE_BYTE, Brightness_Read, Brightness_Write },
> > 
> > And this is one of the handler functions:
> > void Brightness_Write(void) {
> >      bright_reg = IoMem[IoAccessCurrentAddress & IO_SEG_MASK];
> >      Log_Printf(LOG_DEBUG,"[Brightness] Write at $%08x val=$%02x PC=$%08x\n", IoAccessCurrentAddress, IoMem[IoAccessCurrentAddress & IO_SEG_MASK], m68k_getpc());
> >      if (bright_reg&BRIGHTNESS_UNBLANK) {
> >          Log_Printf(LOG_WARN,"[Brightness] Setting brightness to %02x\n", bright_reg&BRIGHTNESS_MASK);
> >      }
> > }
> > 
> > This works with the OS (byte access) but not with the bootloader (long access). Any thoughts on this?  
> 
> This is really Nicolas' area, but AFAIK there are registers on Atari 
> that behave differently depending on how they're accessed, and Hatari 
> has several register handler functions that take that into account.
> 
> For examples, see:
> 	git grep nIoMemAccessSize

Yes, right. This basically depends on what your I/O hardware (like the
"glue" on the ST) is doing with the accesses on the bus.

Do you know what's supposed to happen if the bootloader write a 32-bit word
to 0x02010000 ? For example, if it wrote 0x12345678 to that address, which
byte is supposed to end up in the brightness register?

 Thomas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/