mirror of
https://github.com/holub/mame
synced 2025-05-24 06:30:04 +03:00
[SNES]
* Fixed Mode 7 shared scrolling/matrix registers * Slightly optimized Mode 7 math (by using Anomie's recursive formula) * Moved some more register contents to PPU struct
This commit is contained in:
parent
c4765b716b
commit
b9f6760e13
@ -413,7 +413,7 @@ extern UINT8 *snes_ram; /* Main memory */
|
||||
extern UINT8 *spc_ram; /* SPC main memory */
|
||||
extern UINT8 spc_port_in[4]; /* SPC input ports */
|
||||
extern UINT8 spc_port_out[4]; /* SPC output ports */
|
||||
struct SNES_PPU_STRUCT
|
||||
struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it would be better to reorganize it a bit... */
|
||||
{
|
||||
struct
|
||||
{
|
||||
@ -474,12 +474,21 @@ struct SNES_PPU_STRUCT
|
||||
INT16 matrix_d;
|
||||
INT16 origin_x;
|
||||
INT16 origin_y;
|
||||
UINT16 hor_offset;
|
||||
UINT16 ver_offset;
|
||||
} mode7;
|
||||
UINT8 mosaic_size;
|
||||
UINT8 main_color_mask;
|
||||
UINT8 sub_color_mask;
|
||||
UINT8 sub_add_mode;
|
||||
UINT8 bg3_priority_bit;
|
||||
UINT8 direct_color;
|
||||
UINT8 ppu_last_scroll; /* as per Anomie's doc and Theme Park, all scroll regs shares (but mode 7 ones) the same
|
||||
'previous' scroll value */
|
||||
UINT8 mode7_last_scroll; /* as per Anomie's doc mode 7 scroll regs use a different value, shared with mode 7 matrix! */
|
||||
|
||||
UINT8 main_bg_enabled[5]; // these would probably better fit the layer struct, but it would make worse the code in snes_update_mode_X()
|
||||
UINT8 sub_bg_enabled[5];
|
||||
|
||||
UINT16 mosaic_table[16][4096];
|
||||
UINT8 clipmasks[6][SNES_SCR_WIDTH + 8];
|
||||
|
@ -31,7 +31,6 @@ static UINT16 cgram_address; /* CGRAM address */
|
||||
static UINT8 vram_read_offset; /* VRAM read offset */
|
||||
UINT8 spc_port_in[4]; /* Port for sending data to the SPC700 */
|
||||
UINT8 spc_port_out[4]; /* Port for receiving data from the SPC700 */
|
||||
static UINT8 ppu_last_scroll; /* as per Theme Park, this is shared by all scroll regs */
|
||||
static UINT8 snes_hdma_chnl; /* channels enabled for HDMA */
|
||||
static UINT8 joy1l, joy1h, joy2l, joy2h, joy3l, joy3h, joy4l, joy4h;
|
||||
static UINT8 read_ophct = 0, read_opvct = 0;
|
||||
@ -340,15 +339,25 @@ READ8_HANDLER( snes_r_io )
|
||||
case CGDATA:
|
||||
return snes_ram[offset];
|
||||
case MPYL: /* Multiplication result (low) */
|
||||
{
|
||||
/* Perform 16bit * 8bit multiply */
|
||||
UINT32 c = snes_ppu.mode7.matrix_a * (INT8)(snes_ppu.mode7.matrix_b >> 8);
|
||||
snes_ram[MPYL] = c & 0xff;
|
||||
return snes_ram[MPYL];
|
||||
}
|
||||
case MPYM: /* Multiplication result (mid) */
|
||||
{
|
||||
/* Perform 16bit * 8bit multiply */
|
||||
UINT32 c = snes_ppu.mode7.matrix_a * (INT8)(snes_ppu.mode7.matrix_b >> 8);
|
||||
snes_ram[MPYM] = (c >> 8) & 0xff;
|
||||
return snes_ram[MPYM];
|
||||
}
|
||||
case MPYH: /* Multiplication result (high) */
|
||||
{
|
||||
/* Perform 16bit * 8bit multiply */
|
||||
INT32 c = snes_ppu.mode7.matrix_a * (snes_ppu.mode7.matrix_b >> 8);
|
||||
snes_ram[MPYL] = c & 0xff;
|
||||
snes_ram[MPYM] = (c >> 8) & 0xff;
|
||||
UINT32 c = snes_ppu.mode7.matrix_a * (INT8)(snes_ppu.mode7.matrix_b >> 8);
|
||||
snes_ram[MPYH] = (c >> 16) & 0xff;
|
||||
return snes_ram[offset];
|
||||
return snes_ram[MPYH];
|
||||
}
|
||||
case SLHV: /* Software latch for H/V counter */
|
||||
snes_latch_counters(space->machine);
|
||||
@ -680,7 +689,7 @@ WRITE8_HANDLER( snes_w_io )
|
||||
else
|
||||
{
|
||||
snes_oam[oam_addr] &= 0x00ff;
|
||||
snes_oam[oam_addr] |= (data<<8);
|
||||
snes_oam[oam_addr] |= (data << 8);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -692,7 +701,7 @@ WRITE8_HANDLER( snes_w_io )
|
||||
}
|
||||
else
|
||||
{
|
||||
snes_oam[oam_addr] = (data<<8) | snes_ppu.oam.write_latch;
|
||||
snes_oam[oam_addr] = (data << 8) | snes_ppu.oam.write_latch;
|
||||
}
|
||||
}
|
||||
snes_ram[OAMDATA] = (snes_ram[OAMDATA] + 1) % 2;
|
||||
@ -706,7 +715,7 @@ WRITE8_HANDLER( snes_w_io )
|
||||
return;
|
||||
}
|
||||
case BGMODE: /* BG mode and character size settings */
|
||||
snes_ppu.mode = data & 0x7;
|
||||
snes_ppu.mode = data & 0x07;
|
||||
{
|
||||
rectangle visarea = *video_screen_get_visible_area(space->machine->primary_screen);
|
||||
|
||||
@ -730,7 +739,7 @@ WRITE8_HANDLER( snes_w_io )
|
||||
else
|
||||
video_screen_configure(space->machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL, &visarea, video_screen_get_frame_period(space->machine->primary_screen).attoseconds);
|
||||
}
|
||||
|
||||
snes_ppu.bg3_priority_bit = data & 0x08;
|
||||
snes_ppu.layer[0].tile_size = (data >> 4) & 0x1;
|
||||
snes_ppu.layer[1].tile_size = (data >> 5) & 0x1;
|
||||
snes_ppu.layer[2].tile_size = (data >> 6) & 0x1;
|
||||
@ -761,45 +770,53 @@ WRITE8_HANDLER( snes_w_io )
|
||||
snes_ppu.layer[3].data = (data & 0xf0) << 9;
|
||||
break;
|
||||
|
||||
// Anomie says "H Current = (Byte<<8) | (Prev&~7) | ((Current>>8)&7); V Current = (Current<<8) | Prev;"
|
||||
// Anomie says "H Current = (Byte<<8) | (Prev&~7) | ((Current>>8)&7); V Current = (Current<<8) | Prev;" and Prev is shared by all scrolls but in Mode 7!
|
||||
case BG1HOFS: /* BG1 - horizontal scroll (DW) */
|
||||
snes_ppu.layer[0].offset.horizontal = (data<<8) | (ppu_last_scroll & ~7) | ((snes_ppu.layer[0].offset.horizontal>>8) & 7);
|
||||
ppu_last_scroll = data;
|
||||
/* In Mode 0->6 we use ppu_last_scroll as Prev */
|
||||
snes_ppu.layer[0].offset.horizontal = (data << 8) | (snes_ppu.ppu_last_scroll & ~7) | ((snes_ppu.layer[0].offset.horizontal >> 8) & 7);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
/* In Mode 7 we use mode7_last_scroll as Prev */
|
||||
snes_ppu.mode7.hor_offset = (data << 8) | (snes_ppu.mode7_last_scroll & ~7) | ((snes_ppu.mode7.hor_offset >> 8) & 7);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG1VOFS: /* BG1 - vertical scroll (DW) */
|
||||
snes_ppu.layer[0].offset.vertical = (data<<8) | (ppu_last_scroll);
|
||||
ppu_last_scroll = data;
|
||||
/* In Mode 0->6 we use ppu_last_scroll as Prev */
|
||||
snes_ppu.layer[0].offset.vertical = (data << 8) | snes_ppu.ppu_last_scroll;
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
/* In Mode 7 we use mode7_last_scroll as Prev */
|
||||
snes_ppu.mode7.ver_offset = (data << 8) | snes_ppu.mode7_last_scroll;
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG2HOFS: /* BG2 - horizontal scroll (DW) */
|
||||
snes_ppu.layer[1].offset.horizontal = (data<<8) | (ppu_last_scroll & ~7) | ((snes_ppu.layer[1].offset.horizontal>>8) & 7);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[1].offset.horizontal = (data << 8) | (snes_ppu.ppu_last_scroll & ~7) | ((snes_ppu.layer[1].offset.horizontal >> 8) & 7);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG2VOFS: /* BG2 - vertical scroll (DW) */
|
||||
snes_ppu.layer[1].offset.vertical = (data<<8) | (ppu_last_scroll);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[1].offset.vertical = (data << 8) | (snes_ppu.ppu_last_scroll);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG3HOFS: /* BG3 - horizontal scroll (DW) */
|
||||
snes_ppu.layer[2].offset.horizontal = (data<<8) | (ppu_last_scroll & ~7) | ((snes_ppu.layer[2].offset.horizontal>>8) & 7);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[2].offset.horizontal = (data << 8) | (snes_ppu.ppu_last_scroll & ~7) | ((snes_ppu.layer[2].offset.horizontal >> 8) & 7);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG3VOFS: /* BG3 - vertical scroll (DW) */
|
||||
snes_ppu.layer[2].offset.vertical = (data<<8) | (ppu_last_scroll);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[2].offset.vertical = (data << 8) | (snes_ppu.ppu_last_scroll);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG4HOFS: /* BG4 - horizontal scroll (DW) */
|
||||
snes_ppu.layer[3].offset.horizontal = (data<<8) | (ppu_last_scroll & ~7) | ((snes_ppu.layer[3].offset.horizontal>>8) & 7);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[3].offset.horizontal = (data << 8) | (snes_ppu.ppu_last_scroll & ~7) | ((snes_ppu.layer[3].offset.horizontal >> 8) & 7);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case BG4VOFS: /* BG4 - vertical scroll (DW) */
|
||||
snes_ppu.layer[3].offset.vertical = (data<<8) | (ppu_last_scroll);
|
||||
ppu_last_scroll = data;
|
||||
snes_ppu.layer[3].offset.vertical = (data << 8) | (snes_ppu.ppu_last_scroll);
|
||||
snes_ppu.ppu_last_scroll = data;
|
||||
snes_ppu.update_offsets = 1;
|
||||
return;
|
||||
case VMAIN: /* VRAM address increment value designation */
|
||||
@ -898,23 +915,30 @@ WRITE8_HANDLER( snes_w_io )
|
||||
snes_ppu.mode7.vflip = data & 0x02;
|
||||
snes_ppu.mode7.hflip = data & 0x01;
|
||||
break;
|
||||
/* As per Anomie's doc: Reg = (Current<<8) | Prev; and there is only one Prev, shared by these matrix regs and Mode 7 scroll regs */
|
||||
case M7A: /* Mode 7 COS angle/x expansion (DW) */
|
||||
snes_ppu.mode7.matrix_a = ((snes_ppu.mode7.matrix_a >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.matrix_a = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case M7B: /* Mode 7 SIN angle/ x expansion (DW) */
|
||||
snes_ppu.mode7.matrix_b = ((snes_ppu.mode7.matrix_b >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.matrix_b = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case M7C: /* Mode 7 SIN angle/y expansion (DW) */
|
||||
snes_ppu.mode7.matrix_c = ((snes_ppu.mode7.matrix_c >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.matrix_c = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case M7D: /* Mode 7 COS angle/y expansion (DW) */
|
||||
snes_ppu.mode7.matrix_d = ((snes_ppu.mode7.matrix_d >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.matrix_d = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case M7X: /* Mode 7 x center position (DW) */
|
||||
snes_ppu.mode7.origin_x = ((snes_ppu.mode7.origin_x >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.origin_x = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case M7Y: /* Mode 7 y center position (DW) */
|
||||
snes_ppu.mode7.origin_y = ((snes_ppu.mode7.origin_y >> 8) & 0xff) + (data << 8);
|
||||
snes_ppu.mode7.origin_y = snes_ppu.mode7_last_scroll + (data << 8);
|
||||
snes_ppu.mode7_last_scroll = data;
|
||||
break;
|
||||
case CGADD: /* Initial address for colour RAM writing */
|
||||
/* CGRAM is 16-bit, but when reading/writing we treat it as
|
||||
@ -938,7 +962,18 @@ WRITE8_HANDLER( snes_w_io )
|
||||
snes_ppu.update_windows = 1;
|
||||
break;
|
||||
case TM: /* Main screen designation */
|
||||
snes_ppu.main_bg_enabled[0] = data & 0x01;
|
||||
snes_ppu.main_bg_enabled[1] = data & 0x02;
|
||||
snes_ppu.main_bg_enabled[2] = data & 0x04;
|
||||
snes_ppu.main_bg_enabled[3] = data & 0x08;
|
||||
snes_ppu.main_bg_enabled[4] = data & 0x10;
|
||||
break;
|
||||
case TS: /* Subscreen designation */
|
||||
snes_ppu.sub_bg_enabled[0] = data & 0x01;
|
||||
snes_ppu.sub_bg_enabled[1] = data & 0x02;
|
||||
snes_ppu.sub_bg_enabled[2] = data & 0x04;
|
||||
snes_ppu.sub_bg_enabled[3] = data & 0x08;
|
||||
snes_ppu.sub_bg_enabled[4] = data & 0x10;
|
||||
break;
|
||||
case TMW: /* Window mask for main screen designation */
|
||||
snes_ppu.layer[0].main_window_enabled = data & 0x01;
|
||||
|
@ -575,7 +575,7 @@ static void snes_update_line_mode7(UINT8 screen, UINT8 priority_a, UINT8 priorit
|
||||
{
|
||||
UINT32 tiled;
|
||||
INT16 ma, mb, mc, md;
|
||||
INT32 xc, yc, tx, ty, sx, sy, hs, vs, xpos, xdir;
|
||||
INT32 xc, yc, tx, ty, sx, sy, hs, vs, xpos, xdir, x0, y0;
|
||||
UINT8 priority = priority_a;
|
||||
UINT8 colour = 0;
|
||||
UINT16 *mosaic_x, *mosaic_y;
|
||||
@ -594,8 +594,8 @@ static void snes_update_line_mode7(UINT8 screen, UINT8 priority_a, UINT8 priorit
|
||||
md = snes_ppu.mode7.matrix_d;
|
||||
xc = snes_ppu.mode7.origin_x;
|
||||
yc = snes_ppu.mode7.origin_y;
|
||||
hs = snes_ppu.layer[layer].offset.horizontal;
|
||||
vs = snes_ppu.layer[layer].offset.vertical;
|
||||
hs = snes_ppu.mode7.hor_offset;
|
||||
vs = snes_ppu.mode7.ver_offset;
|
||||
|
||||
/* Sign extend */
|
||||
xc <<= 19;
|
||||
@ -638,10 +638,14 @@ static void snes_update_line_mode7(UINT8 screen, UINT8 priority_a, UINT8 priorit
|
||||
}
|
||||
|
||||
/* Let's do some mode7 drawing huh? */
|
||||
/* These can be computed only once, since they do not depend on sx */
|
||||
x0 = ((ma * MODE7_CLIP(hs - xc)) & ~0x3f) + ((mb * mosaic_y[sy]) & ~0x3f) + ((mb * MODE7_CLIP(vs - yc)) & ~0x3f) + (xc << 8);
|
||||
y0 = ((mc * MODE7_CLIP(hs - xc)) & ~0x3f) + ((md * mosaic_y[sy]) & ~0x3f) + ((md * MODE7_CLIP(vs - yc)) & ~0x3f) + (yc << 8);
|
||||
|
||||
for (sx = 0; sx < 256; sx++, xpos += xdir)
|
||||
{
|
||||
tx = (((ma * MODE7_CLIP(hs - xc)) & ~0x3f) + ((mb * MODE7_CLIP(vs - yc)) & ~0x3f) + (xc << 8) + (ma * mosaic_x[sx]) + ((mb * mosaic_y[sy]) & ~0x3f)) >> 8;
|
||||
ty = (((mc * MODE7_CLIP(hs - xc)) & ~0x3f) + ((md * MODE7_CLIP(vs - yc)) & ~0x3f) + (yc << 8) + (mc * mosaic_x[sx]) + ((md * mosaic_y[sy]) & ~0x3f)) >> 8;
|
||||
tx = (x0 + (ma * mosaic_x[sx])) >> 8;
|
||||
ty = (y0 + (mc * mosaic_x[sx])) >> 8;
|
||||
|
||||
switch (snes_ppu.mode7.repeat)
|
||||
{
|
||||
@ -843,89 +847,102 @@ static void snes_update_objects( UINT8 screen, UINT8 priority_tbl, UINT16 curlin
|
||||
*********************************************/
|
||||
static void snes_update_mode_0( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 7, 10, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 6, 9, 1, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x04) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 1, 4, 2, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x08) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 3, 3, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 0, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 7, 10, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 6, 9, 1, curline);
|
||||
if (bg_enabled[2]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 1, 4, 2, curline);
|
||||
if (bg_enabled[3]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 3, 3, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_1( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
UINT8 bg3_pty = snes_ram[BGMODE] & 0x08;
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (!bg3_pty)
|
||||
if (!snes_ppu.bg3_priority_bit)
|
||||
{
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 1, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 5, 8, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 4, 7, 1, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x04) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 2, 2, curline);
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 1, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 5, 8, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 4, 7, 1, curline);
|
||||
if (bg_enabled[2]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 2, 2, curline);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 9, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 4, 7, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 3, 6, 1, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x04) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 9, 2, curline);
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 9, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 4, 7, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 3, 6, 1, curline);
|
||||
if (bg_enabled[2]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 9, 2, curline);
|
||||
}
|
||||
}
|
||||
|
||||
static void snes_update_mode_2( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 2, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 2, 6, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 0, 4, 1, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 2, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 2, 6, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 0, 4, 1, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_3( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 3, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_8BPP, 0, 2, 6, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 0, 4, 1, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 3, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_8BPP, 0, 2, 6, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 0, 0, 4, 1, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_4( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 4, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_8BPP, 0, 2, 6, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 4, 1, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 4, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_8BPP, 0, 2, 6, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 0, 0, 4, 1, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_5( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 5, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 1, 2, 6, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 1, 0, 4, 1, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 5, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 1, 2, 6, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line(screen, SNES_COLOR_DEPTH_2BPP, 1, 0, 4, 1, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_6( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 6, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 1, 1, 4, 0, curline);
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 6, curline);
|
||||
if (bg_enabled[0]) snes_update_line(screen, SNES_COLOR_DEPTH_4BPP, 1, 1, 4, 0, curline);
|
||||
}
|
||||
|
||||
static void snes_update_mode_7( UINT8 screen, UINT16 curline )
|
||||
{
|
||||
UINT16 bg_enable_reg = (screen == MAINSCREEN) ? TM : TS;
|
||||
UINT8 extbg_mode = snes_ram[SETINI] & 0x40;
|
||||
UINT8 *bg_enabled;
|
||||
bg_enabled = (screen == MAINSCREEN) ? snes_ppu.main_bg_enabled : snes_ppu.sub_bg_enabled;
|
||||
|
||||
if (!extbg_mode)
|
||||
{
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 7, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line_mode7(screen, 1, 1, 0, curline);
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 7, curline);
|
||||
if (bg_enabled[0]) snes_update_line_mode7(screen, 1, 1, 0, curline);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (snes_ram[bg_enable_reg] & 0x10) snes_update_objects(screen, 8, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x01) snes_update_line_mode7(screen, 2, 2, 0, curline);
|
||||
if (snes_ram[bg_enable_reg] & 0x02) snes_update_line_mode7(screen, 0, 4, 1, curline);
|
||||
if (bg_enabled[4]) snes_update_objects(screen, 8, curline);
|
||||
if (bg_enabled[0]) snes_update_line_mode7(screen, 2, 2, 0, curline);
|
||||
if (bg_enabled[1]) snes_update_line_mode7(screen, 0, 4, 1, curline);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user