I'm trying to upload a snapshot, but I'm getting an error message.
Anyway, my basic code.
void ramWrite( unsigned short int address, unsigned char byte ){
siRam[ address ] = byte ;
if( address > 0x2400 )
siVram(address,byte);
}
//
void siVram( unsigned short int address , unsigned char byte ){
int posx, posy, color;
posx = address>>5;
color = address&0x1f;
posy = ((address&0x1F)<<3);
_putpixel32(Buffer,posx,255-((posy) ), byte&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 1), byte>>1&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 2), byte>>2&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 3), byte>>3&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 4), byte>>4&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 5), byte>>5&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 6), byte>>6&1 ? Overlay[color] : black );
_putpixel32(Buffer,posx,255-((posy)+ 7), byte>>7&1 ? Overlay[color] : black );
}
void siIrq( unsigned short int address ){
if ( inte ){
inte=0;
pushpc( pc ) ;
pc = address ;
//no need to decrement cycles
}
}
main(){
//my main loop. Just for test
while(!key[KEY_ESC]){ //
cpuRun( 17000 );
siIrq( 0x0008 );
blit(buffer,screen,0,0,0,0,224,256);
clear_bitmap(buffer);//wrong way to clean
cpuRun( 17000 );
siIrq( 0x0010 );
// audio/joystick update
}
}
Looks like everything(except timing and sound) that was emulated is ok. But look the picture.
using clear_bitmap(buffer):
I don't now how to fix this bug. I don't understand the right way to work with vram and how to update the screen. The clear_bitmap(buffer) was the last attempt.