|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Periodic interrupts every 1/10th of a frame.
Posted: Tue Jun 25, 2019 12:35 pm
|
I want to get some precise timing using the VDP but reading the docs I don't know how scanline interrupts work.
If I wanted to have an interrupt every tenth of a frame, even during active/blanking, will it work by just setting the counter register to 312/10 (31)? |
|
|
Posted: Tue Jun 25, 2019 1:00 pm |
you won't have any line interrupt during v-blank, unfortunately - you'll have to find some other way to handle the timing right in that phase. | |
|
Posted: Tue Jun 25, 2019 1:21 pm |
The shortest period then it would be at a minimum the duration of VBlank, setting the line register to VBlank length and on the last line setting it to Zero as to get a line interrupt as soon as the active area starts again.
I'll need to crunch the numbers if it is feasible ... |
|
|
Posted: Tue Jun 25, 2019 1:48 pm |
but vblank is quite long, at least on a PAL machine: 313-192 lines... | |
|
Posted: Tue Jun 25, 2019 6:50 pm |
So not only I'm out of interrupts on VBlank but also on the inactive areas. :/ Maybe I can get something workable with TMS modes, actually I don't really need Mode 4 for this. And I really don't want to fake it and add an external timer circuit. |
|
|
Posted: Wed Jun 26, 2019 5:55 am |
if you need precise timing (for music?) and you don't need to do something else (on screen?) at the same time, you could just have a big delay inside your loop. Timing would be very precise, as Maxim's pcmenc demonstrates well. | |
|
Posted: Wed Jun 26, 2019 6:59 am |
But as soon as your periodic code has any branches, you start to have difficulty cycle counting... | |
|
Posted: Wed Jun 26, 2019 7:35 pm |
I want to move away from cycle counting and start using strictly interrupt based code. I'll give it a try this weekend. | |
|
Posted: Thu Jun 27, 2019 1:26 am |
Polling v counter is probably your best bet. http://www.smspower.org/Development/ScanlineCounter
Calindro and I used the the technique a while back to play a high frequency chip tune, works well. |
|