Re: [hatari-devel] Emulation of the TT second MFP

[ Thread Index | Date Index | More Archives ]

Le 12/03/2021 à 10:29, Markus Fröschle a écrit :
Hello everybody,

bringing up this old issue again.

I have had a look into it and it appears that the ASV Unix crash dump is misleading here. Using the Hatari debugger,
I tried to find out what happens here.

Indeed it appears to indicate the MFP involved in the crash, but actually, this seems to be a subsequent fault (as it shows the registers from the crashdump writeout itself that is not only written to the screen but to the
serial port as well).

The root cause of the crash appears to be indeed this:

WARN : Write to unimplemented RTC/NVRAM interrupt enable bits 0x40

ASV seems to be using the TT RTC's timer interrupt as kind of watchdog and crashes if this does not trigger as expected. Not sure if this is the only issue that prevents ASV from booting, but at least I would really like to give it a try.

Question is: what would it take to properly implement this interrupt? Can somebody provide pointers on where to look best for a sample implementation of an interrupt trigger in Hatari's source code that could be used as a template?

I already peeked into the source tree but admitted, I'm a bit lost on where to start. Hints appreciated.

Thank you!


there're 2 possibilities to handle such alarm :
- add a new dedicated interrupt handler in includes/cycInt.h , but such handlers are taking more cpu time to emulate as they're evaluated very often, so it might not be necessary in this case.

- call a dedicated function in the RTC code that check if the alarm expires, but doing it less often. For example if the alarm has a 1 second precision, you can call the function on every VBL and check if the alarm expired or not, and if so change the corresponding MFP bit

This is the second case that is used in Hatari in the similar case of the IKBD's internal clock. On each VBL we call IKBD_UpdateClockOnVBL() and this function update the internal clock. You can do the same and check for an alarm.

What kind of alarm does the ASV Unix code use ? Alarm after 'n' seconds or alarm on a specific date/time ? (maybe the required precision is less than 1 sec, I haven't check the nvram datasheet)


Mail converted by MHonArc 2.6.19+