First you should know that the 68000 code, once removed the HINT, only access the VDP in the vertical exception (VINT), but I don't know how much it lasts. At the most it moves throw DMA all the sprite array, all the horizontal scroll array and possibly a single tile. When I need to make big changes to the VDP I turn it off, always at a VINT, and do the job.
By turning off display, I mean 3rth bit off vdp register 1.
So, continuing, now I'm trying to move the HINT code from the 68000 to the Z80. I started with something simple, just a colour change per line, but it blocks the game complitly, screen in black and some of the DMA done other not.
This Z80 code is (I don't care what exactly does, I was just expecting to do something, then I do it right):
Code: Select all
typedef char s8;
typedef short s16;
typedef long s32;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned int uint;
typedef int bool;
#define g_vpdDataPort (*((volatile u16*)0x8000))
#define g_vpdCtrlPort32 (*((volatile u32*)0x8004))
#define g_vpdHCounterPort (*((volatile u8*)0x8008))
void main()
{
u16 color = 0xFF00;
u8 lastLine = g_vpdHCounterPort;
for(;;)
{
u8 currLine = g_vpdHCounterPort;
if( (currLine < 100) && (currLine > 80) && (currLine != lastLine) )
{
g_vpdCtrlPort32 = 0xC0000000;
g_vpdDataPort = color++;
lastLine = currLine;
}
}
}
Questions:
¿When I turn off display hcounter is still on rolling?
¿ Why it goes that catastrophically wrong?
¿ Is there any way to know from Z80 perspective to know when display is off?
¿Is there any procedure to access VPD 68000 and Z80 both syncronized ?