interrupts and VDP access

Page 2/2
1 |

By santiontanon

Paragon (1770)

santiontanon's picture

16-07-2018, 16:06

Metalion wrote:
santiontanon wrote:

Nothing is restored after an interrupt as far as I know, not even the Z80 state. It is up to the interrupt code to save and restore register status.

No, that's incorrect. At 0038h, all registers (even alternate ones) are saved to stack before calling the interrupt hook. And they are restored after returning from it.

Are you sure all MSX bios's do this? (I can see C-BIOS does it: https://sourceforge.net/p/cbios/cbios/ci/master/tree/src/mai... ), but in my experience, if I don't push/pop the registers myself manually in my interrupt code (when putting it in H.TIMI, for example), everything breaks...

By Grauw

Ascended (10708)

Grauw's picture

16-07-2018, 17:16

Dolphin101546015 wrote:

Dude, and now please read all my messages above.

Dear dude, if you don't want my responses, then you've just gotten your way!

By Louthrax

Prophet (2436)

Louthrax's picture

16-07-2018, 20:14

That latched register write value really tied the VDP together Running Naked in a Field of Flowers (sorry, had to make a Big Lebowski related joke here...)

By Dolphin101546015

Champion (335)

Dolphin101546015's picture

16-07-2018, 22:29

Grauw wrote:
Dolphin101546015 wrote:

Dude, and now please read all my messages above.

Dear dude, if you don't want my responses, then you've just gotten your way!

Question
Ok, no problems. I just not understand, why you explain me thats i told before.

By ARTRAG

Enlighted (6933)

ARTRAG's picture

17-07-2018, 08:14

Yes, bios always save all z80 registers in the Isr and restore them before returning to the interrupted code

By Sepulep

Resident (36)

Sepulep's picture

17-07-2018, 11:38

@grauw, @santiontanon, thanks btw guys for the awesomely impressive work on the glass assembler and ToP (and the very nice blogpost about it!!)

By Grauw

Ascended (10708)

Grauw's picture

17-07-2018, 14:07

santiontanon wrote:

Are you sure all MSX bios's do this? (I can see C-BIOS does it: https://sourceforge.net/p/cbios/cbios/ci/master/tree/src/mai... ), but in my experience, if I don't push/pop the registers myself manually in my interrupt code (when putting it in H.TIMI, for example), everything breaks...

That’s strange, should not be needed at all... In H.KEYI nothing needs to be preserved, and in H.TIMI you only need to preserve AF because otherwise the status register mirror doesn’t update correctly. But omitting that won’t usually lead to problems, and either way all registers are preserved and restored by the ISR on entry and exit (I believe unlike the CPC which does modifies EX registers).

https://sourceforge.net/p/msxsyssrc/git/ci/master/tree/base1...

By santiontanon

Paragon (1770)

santiontanon's picture

17-07-2018, 16:47

@Sepulep: Thanks! Big smile will try to keep it up!
@Grauw: Ok, strange indeed. I'll investigate a bit more, maybe I'm doing something wrong. But if what you guys say is true, then I can save a few bytes/CPU ticks, which is great too! Smile

Page 2/2
1 |