* removed all traces to video/generic.h
* fix flipscreen issue with autosave
* on a hires pcb picture, verified resistor and capacitor values
This commit is contained in:
Couriersud 2008-01-20 00:38:14 +00:00
parent 729fa5efc6
commit 4696730bc8
4 changed files with 79 additions and 54 deletions

View File

@ -74,30 +74,41 @@
/****************************************************************
*
* Mario Discrete Sound Interface
*
* verified against picture of a TMA1-04-CPU Board. Some
* of the values were hard to read, though.
*
****************************************************************/
#define MR_R6 RES_K(4.7) /* verified */
#define MR_R7 RES_K(4.7) /* verified */
#define MR_R17 RES_K(27) /* verified, 30K in schematics */
#define MR_R18 RES_K(27) /* verified, 30K in schematics */
#define MR_R19 RES_K(22) /* verified */
#define MR_R20 RES_K(22) /* verified */
#define MR_R40 RES_K(22) /* verified */
#define MR_R41 RES_K(100) /* verified, hard to read */
#define MR_R61 RES_K(47) /* verified, hard to read */
#define MR_R64 RES_K(20) /* verified */
#define MR_R65 RES_K(10) /* verified */
#define MR_C3 CAP_U(10) /* verified */
#define MR_C4 CAP_U(47) /* illegible, 4.7 or 47 pcb/schematics */
#define MR_C5 CAP_N(39) /* illegible on pcb */
#define MR_C6 CAP_N(3.9) /* illegible on pcb */
#define MR_C14 CAP_U(4.7) /* verified */
#define MR_C15 CAP_U(4.7) /* verified */
#define MR_C16 CAP_N(6.8) /* verified */
#define MR_C17 CAP_N(22) /* illegible on pcb */
#define MR_C31 CAP_U(0.022) /* not found */
#define MR_C32 CAP_U(1) /* illegible on pcb */
#define MR_C39 CAP_N(4.7) /* not found */
#define MR_C40 CAP_N(22) /* verified */
#define MR_C41 CAP_U(4.7) /* verified, hard to read */
#define MR_C43 CAP_U(3.3) /* verified */
#define MR_C44 CAP_U(3.3) /* verified */
#define MR_R6 RES_K(4.7)
#define MR_R7 RES_K(4.7)
#define MR_R17 RES_K(30)
#define MR_R18 RES_K(30)
#define MR_R61 RES_K(47)
#define MR_R64 RES_K(20)
#define MR_R65 RES_K(10)
#define MR_C3 CAP_U(10)
#define MR_C4 CAP_U(47)
#define MR_C5 CAP_N(39)
#define MR_C6 CAP_N(3.9)
#define MR_C14 CAP_U(4.7)
#define MR_C15 CAP_U(4.7)
#define MR_C16 CAP_N(6.8)
#define MR_C17 CAP_N(22)
#define MR_C39 CAP_N(4.7)
#define MR_C40 CAP_N(22)
#define MR_C41 CAP_U(4.7)
#define MR_C43 CAP_U(3.3)
#define MR_C44 CAP_U(3.3)
/* KT = 0.25 for diode circuit, 0.33 else */
@ -109,21 +120,13 @@
#define DISCRETE_BITSET(_N, _N1, _B) DISCRETE_TRANSFORM3(_N, 1, _N1, 1 << ((_B)-1), 0, "01&2>")
#define DISCRETE_ENERGY_NAND(_N, _E, _N1, _N2) DISCRETE_TRANSFORM3(_N, _E, _N1, _N2, 1, "201*-")
#define MR_R20 RES_K(22)
#define MR_R19 RES_K(22)
#define MR_R41 RES_K(100)
#define MR_R40 RES_K(22)
#define MR_C32 CAP_U(1)
#define MR_C31 CAP_U(0.022)
static const discrete_mixer_desc mario_mixer_desc =
{DISC_MIXER_IS_RESISTOR,
{MR_R20, MR_R19, MR_R41, MR_R40},
{0,0,0,0,0}, // no variable resistors
{0,0,0,0,0}, // no node capacitors
0, RES_M(1), // Dummy,
0, 0,
MR_C31,
MR_C32,
0, 1};
@ -175,7 +178,7 @@ static DISCRETE_SOUND_START(mario)
DISCRETE_MULTIPLY(DS_OUT_SOUND1, 1, NODE_25, TTL_HIGH)
/************************************************/
/* SOUND7 */
/* SOUND7 */
/************************************************/
DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT)
@ -217,7 +220,10 @@ static DISCRETE_SOUND_START(mario)
/* Amplifier: internal amplifier
* Just a 1:n amplifier without filters and no output capacitor
*/
DISCRETE_OUTPUT(NODE_295, 32767.0/5.0 * 3 )
// EZV20 equivalent filter circuit ...
DISCRETE_CRFILTER(NODE_296,1,NODE_295, RES_K(1), CAP_U(4.7))
DISCRETE_OUTPUT(NODE_296, 32767.0/5.0 * 3 )
//DISCRETE_WAVELOG1(DS_OUT_DAC, 32767/5.0)
DISCRETE_SOUND_END

View File

@ -163,8 +163,8 @@ static void mario_dma_write_byte(offs_t offset, UINT8 data)
static ADDRESS_MAP_START( mario_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x6fff) AM_RAM
AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) /* physical sprite ram */
AM_RANGE(0x7400, 0x77ff) AM_READWRITE(MRA8_RAM, mario_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE_MEMBER(mario_state, spriteram) AM_SIZE_MEMBER(mario_state, spriteram_size) /* physical sprite ram */
AM_RANGE(0x7400, 0x77ff) AM_READWRITE(MRA8_RAM, mario_videoram_w) AM_BASE_MEMBER(mario_state, videoram)
AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_WRITE(mario_sh1_w) /* Mario run sample */
AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_WRITE(mario_sh2_w) /* Luigi run sample */
AM_RANGE(0x7d00, 0x7d00) AM_WRITE(mario_scroll_w)

View File

@ -45,7 +45,13 @@ struct _mario_state
UINT8 gfx_bank;
UINT8 palette_bank;
UINT16 gfx_scroll;
UINT8 flip;
/* driver general */
UINT8 *spriteram;
UINT8 *videoram;
size_t spriteram_size;
tilemap *bg_tilemap;
int monitor;
};

View File

@ -81,7 +81,7 @@ WRITE8_HANDLER( mario_videoram_w )
{
mario_state *state = Machine->driver_data;
videoram[offset] = data;
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
@ -116,16 +116,26 @@ WRITE8_HANDLER( mario_scroll_w )
WRITE8_HANDLER( mario_flip_w )
{
flip_screen_set(data & 0x01);
mario_state *state = Machine->driver_data;
if (state->flip != (data & 0x01))
{
state->flip = data & 0x01;
if (state->flip)
tilemap_set_flip(ALL_TILEMAPS, TILEMAP_FLIPX | TILEMAP_FLIPY);
else
tilemap_set_flip(ALL_TILEMAPS, 0);
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
}
}
static TILE_GET_INFO( get_bg_tile_info )
{
mario_state *state = Machine->driver_data;
int code = videoram[tile_index] + 256 * state->gfx_bank;
int code = state->videoram[tile_index] + 256 * state->gfx_bank;
int color;
color = ((videoram[tile_index] >> 2) & 0x38) | 0x40 | (state->palette_bank<<7) | (state->monitor<<8);
color = ((state->videoram[tile_index] >> 2) & 0x38) | 0x40 | (state->palette_bank<<7) | (state->monitor<<8);
color = color >> 2;
SET_TILE_INFO(0, code, color, 0);
}
@ -143,7 +153,7 @@ VIDEO_START( mario )
state_save_register_global(state->gfx_bank);
state_save_register_global(state->palette_bank);
state_save_register_global(state->gfx_scroll);
state_save_register_global(flip_screen);
state_save_register_global(state->flip);
}
/*
@ -156,29 +166,29 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
mario_state *state = Machine->driver_data;
int offs;
for (offs = 0;offs < spriteram_size;offs += 4)
for (offs = 0;offs < state->spriteram_size;offs += 4)
{
if (spriteram[offs])
if (state->spriteram[offs])
{
int x, y;
// from schematics ....
y = (spriteram[offs] + (flip_screen ? 0xF7 : 0xF9) + 1) & 0xFF;
x = spriteram[offs+3];
y = (state->spriteram[offs] + (state->flip ? 0xF7 : 0xF9) + 1) & 0xFF;
x = state->spriteram[offs+3];
// sprite will be drawn if (y + scanline) & 0xF0 = 0xF0
y = 240 - y; /* logical screen position */
y = y ^ (flip_screen ? 0xFF : 0x00); /* physical screen location */
x = x ^ (flip_screen ? 0xFF : 0x00); /* physical screen location */
y = y ^ (state->flip ? 0xFF : 0x00); /* physical screen location */
x = x ^ (state->flip ? 0xFF : 0x00); /* physical screen location */
if (flip_screen)
if (state->flip)
{
y -= 6;
y -= 14;
x -= 7;
drawgfx(bitmap,machine->gfx[1],
spriteram[offs + 2],
(spriteram[offs + 1] & 0x0f) + 16 * state->palette_bank + 32 * state->monitor,
!(spriteram[offs + 1] & 0x80),!(spriteram[offs + 1] & 0x40),
state->spriteram[offs + 2],
(state->spriteram[offs + 1] & 0x0f) + 16 * state->palette_bank + 32 * state->monitor,
!(state->spriteram[offs + 1] & 0x80),!(state->spriteram[offs + 1] & 0x40),
x, y,
cliprect,TRANSPARENCY_PEN,0);
}
@ -187,9 +197,9 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
y += 1;
x -= 8;
drawgfx(bitmap,machine->gfx[1],
spriteram[offs + 2],
(spriteram[offs + 1] & 0x0f) + 16 * state->palette_bank + 32 * state->monitor,
(spriteram[offs + 1] & 0x80),(spriteram[offs + 1] & 0x40),
state->spriteram[offs + 2],
(state->spriteram[offs + 1] & 0x0f) + 16 * state->palette_bank + 32 * state->monitor,
(state->spriteram[offs + 1] & 0x80),(state->spriteram[offs + 1] & 0x40),
x, y,
cliprect,TRANSPARENCY_PEN,0);
}
@ -208,9 +218,12 @@ VIDEO_UPDATE( mario )
state->monitor = t;
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
}
tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen ? (HTOTAL-HBSTART) : 0);
tilemap_set_scrolly(state->bg_tilemap, 0, state->gfx_scroll);
tilemap_set_scrollx(state->bg_tilemap, 0, state->flip ? (HTOTAL-HBSTART) : 0);
tilemap_set_scrolly(state->bg_tilemap, 0, state->gfx_scroll - (state->flip ? 8 : 0));
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_sprites(machine, bitmap, cliprect);
return 0;
}