Phoenix. Background Layer

Something about background layer. Seems that original emulator uses (0x800+pos) (originally, blit(video,video_buffer_bg,0x800+(d*8)) because all "tiles" stored as big bitmap and background tiles are located at offset 0x800 of this bitmap. But in case of Saturn emulator, it can't access lower size of tile_data (where stored background tiles) this way (i.e. [0x800+RAM] do nothing). I think we need to try something about this:

for map_data use tile_data and for gfx_data use tile_data2 (with different locations in memory)

i.e. tile_data used to storage foreground tiles

and tile_data2 to storage background tiles.

So, video_decode will look something like:

for(c=0;c<0x100;c++) // do a char

{

for(i=0;i<8;i++) //do a ver. line

{

line1=RAM[0x8000+(c*8)+7-i];

line2=RAM[0x9000+(c*8)+7-i];

for(j=0;j<8;j++) //do a hor. line

{

bit1=((line1&(0x01<<j))>>j);

bit2=((line2&(0x01<<j))>>j);

lookup=(((c%256)>>5)

| (bit1<<3) | (bit2<<4)

| (!((c&0xFF00)&&1)<<5));

//This is suited to Saturn, ie. total conversion of tile data.

tile_data[(c*0x40)+(j*8)+i] = (Uint8) lookup;

}

}

}

for(c=0x100;c<0x200;c++) // do a char

{

for(i=0;i<8;i++) //do a ver. line

{

line1=RAM[0x8000+(c*8)+7-i];

line2=RAM[0x9000+(c*8)+7-i];

for(j=0;j<8;j++) //do a hor. line

{

bit1=((line1&(0x01<<j))>>j);

bit2=((line2&(0x01<<j))>>j);

lookup=(((c%256)>>5)

| (bit1<<3) | (bit2<<4)

| (!((c&0xFF00)&&1)<<5));

//This is suited to Saturn, ie. total conversion of tile data.

tile_data2[((c-0x100)*0x40)+(j*8)+i] = (Uint8) lookup;

}

}

}

}

But, it's not quite right (and somehow, not work).

Just for debugging, I used tile_data2 for map_data and got foreground drawn by backround tiles.

Need to investigate this more...
 
Back
Top