HBlank Timings
Moderators: BigEvilCorporation, Mask of Destiny
sure it is.. from the code disassembling, any value below 924 would workmickagame wrote:With hblank flag end at h-int + 860 it's correct.
in this case, this would mean Hblank flag is cleared even later regarding to Hint... so the problem is still there, on the contrarymickagame wrote:Other supposition :
To determine where hblank flag is set to ON/OFF we have only h-counter value.
So imagine that in fact the h-counter begins to 0 after left border at the start of active display (as Charles MC Donald said in his doc) .
So The problem is gone out and we respect his values ...
as i said, this need to be tested again to be sure of values, as well as Hcounter value when Hint is processed and the VBLANK flag
actually, the only thing we are sure is Interrupt occurences regarding to active display/borders area
Using interrupt routines to read VDP status flags could provide some valuable informations.
-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT
Is this a good way?
Burning eprom...
Code: Select all
HBL2:
;a6 is $C00004 on this Hint execution
MOVE.w $4(a6), -(a7) ;Get HVcounter
MOVE.w (a6), -(a7) ;Get VDPstatus
MOVE.l (a7)+, $E01000 ;Save both values to a known location and restore stack position
RTE
Burning eprom...

Cool that you have possibility to test that !!!
Perhaps it will be more precise to make a loop reading hv counter and when the interrupt occurs to know the last value readed?
Because with this methode you have latency between the moment the h-int occurs and the moment the register is readed (308 MCLKS), it's the time necessary to 68k before executing the first instruction.
That's why i think it will be better to do like that.
Thank you very much for your test
Perhaps it will be more precise to make a loop reading hv counter and when the interrupt occurs to know the last value readed?
Because with this methode you have latency between the moment the h-int occurs and the moment the register is readed (308 MCLKS), it's the time necessary to 68k before executing the first instruction.
That's why i think it will be better to do like that.
Thank you very much for your test

I think it's a better approach to read the Hcounter value in the Hint routine: you can still substract the interrupt cycles later to get an estimated value
Having the main program reading the HV counter then writing RAM introduces more latency... and the interrupt could be taken between a read and a write and you could not know.
About the VDP status flag, it would be better to have a loop which starts reading the status value as soon as Hint is processed and store successively read values in consectutive RAM addresses until the desired bit changes its value (quite like Sonic 2 Hint routine does btw)
Testing HCounter and VDP status separately is also better imo
Thanks for this anyway, can't wait for you results
PS:
some other stuff you could test when you have time:
- when VBLANK flag is being set/cleared ?
- when VINT flag is being set (relative to VINT occurence)
- how long does VINT (HINT) irq lines remains pending when interrupt are masked on 68k side (i.e does the VDP clear IRQ lines after a while) ?
- is VINT flag set when VINT interrupt is disabled on VDP side ?
- is VINT flag cleared by reading the VDP status when VINT interrupt is enable on VDP side but masked on 68k side ?
Having the main program reading the HV counter then writing RAM introduces more latency... and the interrupt could be taken between a read and a write and you could not know.
About the VDP status flag, it would be better to have a loop which starts reading the status value as soon as Hint is processed and store successively read values in consectutive RAM addresses until the desired bit changes its value (quite like Sonic 2 Hint routine does btw)
Testing HCounter and VDP status separately is also better imo
Thanks for this anyway, can't wait for you results

PS:
some other stuff you could test when you have time:
- when VBLANK flag is being set/cleared ?
- when VINT flag is being set (relative to VINT occurence)
- how long does VINT (HINT) irq lines remains pending when interrupt are masked on 68k side (i.e does the VDP clear IRQ lines after a while) ?
- is VINT flag set when VINT interrupt is disabled on VDP side ?
- is VINT flag cleared by reading the VDP status when VINT interrupt is enable on VDP side but masked on 68k side ?
Last edited by Eke on Thu Mar 12, 2009 4:54 pm, edited 1 time in total.
oh well, something like this ?mickagame wrote:I thought to read hvcounter in a loop and write to ram only in interrupt routine, not each time you read it![]()
Code: Select all
Main:
LEA $C00004,A6
Loop:
MOVE.w (a6), D0 ;Get HVcounter
BRA Loop;
Hint:
MOVE.w D0 $E01000
// DISPLAY STORED VALUE ON SCREEN
RTE;

-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT
Jorge Nuno wrote:Is this a good way?
Code: Select all
HBL2: ;a6 is $C00004 on this Hint execution MOVE.w $4(a6), -(a7) ;Get HVcounter MOVE.w (a6), -(a7) ;Get VDPstatus MOVE.l (a7)+, $E01000 ;Save both values to a known location and restore stack position RTE
Burning eprom...
In PAL:
Minimum value from $E01002 was #$80ED and max was #$80F6
From $E01000 was #$8205
In NTSC:
Min: #$80EC, max #$80F5
$E01000: #$8204
I obtain those values with about 40 readings
My MD has a 53.2034MHz osc
I can post a pic later if anyone wants.
-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT
-
- Very interested
- Posts: 374
- Joined: Mon Jun 11, 2007 3:09 am
- Location: Azeitão, PT