How h interrupt register works?

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Miquel
Very interested
Posts: 284
Joined: Sat Jul 30, 2016 12:33 am

How h interrupt register works?

Post by Miquel » Sat Jun 09, 2018 5:54 pm

How "h interrupt register" reg #10 really works?

I'm trying to modify it's value inside a horizontal exception to fire again in X raster lines more and it seems to completely ignore the value, instead fires again at the previous value, but strangely enough half screen later takes my value into account (?!?).

My first suspicion was that the value that counts is taken at the end of the v-blank, but no, after a while seems to work.

Any crazy idea?

How I'm doing is:
1) In v-blank I set reg10 to a in screen value
2) In a first h-exception I set reg10 to a second in screen value
3) In a second h-exception I set reg10 to 0xFF

User avatar
Sik
Very interested
Posts: 679
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: How h interrupt register works?

Post by Sik » Sat Jun 09, 2018 6:00 pm

The counter is reloaded as soon as the interrupt fires, and the register only takes effect when the counter gets reloaded, so yes, it'll only take effect on the interrupt following the next one.

Yes, it's annoying and you have to work around it.
Sik is pronounced as "seek", not as "sick".

Miquel
Very interested
Posts: 284
Joined: Sat Jul 30, 2016 12:33 am

Re: How h interrupt register works?

Post by Miquel » Sun Jun 10, 2018 9:33 am

Quite bothering indeed.

That's the best explanation I have found so far:

Code: Select all

 The VDP has a counter that is decremented on every line. When the counter
 has expired, and if bit 4 (IE1) of register #0 is set, then a level 4
 interrupt will occur.

 The counter is loaded with the contents of register #10 in the following
 situations:

 - Line zero of the frame.
 - When the counter has expired.
 - Lines 225 through 261. (note that line 224 is not included)

 The counter is *not* loaded when register #10 is written to.
from: https://emudocs.org/Genesis/Graphics/genvdp.txt

I just ended setting reg10 to 0 and use an internal counter, and the result have been a bit better than I thought (check attached rom file).
Alien noise.zip
(8.38 KiB) Downloaded 6 times

Miquel
Very interested
Posts: 284
Joined: Sat Jul 30, 2016 12:33 am

Re: How h interrupt register works?

Post by Miquel » Tue Jun 12, 2018 11:45 am

I just tried to disconnect display while dma'ing and works MUCH better, on real hardware I only see artefacts with sprites on a very precise line (on the top of the D), and not at all with planes.

Alien Noise (clearer than before).zip
(8.49 KiB) Downloaded 4 times

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests