VDP is skipping commands?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
User avatar
Posts: 27
Joined: Wed Mar 24, 2010 1:15 am
Location: Chile

VDP is skipping commands?

Post by HCKTROX » Mon Sep 07, 2015 3:41 pm


This time I'm trying something different for Sega CD... Keep SubCPU to process all the main engine, and MainCPU to process all I/O. For such, I have done the following: From SoulessSentinel's SCD template, I have done exactly the inverse method: SubCPU to hold all the main code, and MainCPU to hold requests. And finally, I have reserved some space in WordRAM, consisting on a little queue that should run the same requests, but from VInt instead.

Depending of situation, some code ran through MainCPU/VInt may or may not take more than a single frame to be completed. But the problem is, that if I set up a heavy code block to be run at VInt (on mine case, mine routine that loads the level map for first time in full screen), the next and lightier commands (such as write $9299 to control port) simply won't work, UNLESS I arrange my queue to start from the simpler to the heavier requests (or just call this heavy routine inmediately, not adding to VInt queue).

Mine level map loading routine DO take more than 1 frame to draw the screen for first time, from 2 to 3 depending of a few settings with the file format.
Is there any possibility this problem is caused because trying to write #$9299 to $C00004 in a "bad moment" or something? Or is that I have a really obscure race condition I still couldn't track?

If not the latter... then why it happens? Doesn't RTE merely consist on popping SR/PC from stack? And yes, I have done VDP writes in the past, outside VInt. So I'm really confused here =S

- Note that interrupts are disabled while the queue is being ran.

- For some dumb reason I couldn't remember at this precise moment, I had this routine to re-enable the interrupts after half of process was done (i.e. after drawing only 1 of each plane). Naturally it went in such a situation that VInt ran inside VInt and all queue went messed up. Feel free to trash this post.
skype: hcktrox

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests