From e7bcdb5c5b65e1b14c8a953afb813015d8b3eb49 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 27 Dec 2016 22:29:23 +0100 Subject: Untangle screen updates into different routines + other clean-ups (nw) --- src/mame/drivers/namcos21.cpp | 509 +++++++++++++++++++++--------------------- src/mame/includes/namcos21.h | 2 + src/mame/video/namcos21.cpp | 219 ++++++++++-------- 3 files changed, 380 insertions(+), 350 deletions(-) diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index 830f6818909..0398937aaaf 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -1591,6 +1591,258 @@ static ADDRESS_MAP_START( driveyes_68k_slave, AS_PROGRAM, 16, namcos21_state ) DRIVEYES_68K_COMMON ADDRESS_MAP_END +/*************************************************************/ +/* */ +/* NAMCO SYSTEM 21 INPUT PORTS */ +/* */ +/*************************************************************/ + +static INPUT_PORTS_START( s21default ) + PORT_START("PORTB") /* 63B05Z0 - PORT B */ + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) + + PORT_START("PORTC") /* 63B05Z0 - PORT C & SCI */ + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_0) PORT_TOGGLE // alt test mode switch + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) + + PORT_START("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x60,0x9f) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) + PORT_START("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x60,0x9f) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) + PORT_START("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PORTH") /* 63B05Z0 - PORT H */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW") /* 63B05Z0 - $2000 DIP SW */ + PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) + PORT_DIPNAME( 0x02, 0x02, "DSW2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "DSW3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "DSW4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "DSW5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, "PCM ROM") + PORT_DIPSETTING( 0x20, "2M" ) + PORT_DIPSETTING( 0x00, "4M" ) + PORT_DIPNAME( 0x40, 0x40, "DSW7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Screen Stop") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DIAL0") /* 63B05Z0 - $3000 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("DIAL1") /* 63B05Z0 - $3001 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("DIAL2") /* 63B05Z0 - $3002 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("DIAL3") /* 63B05Z0 - $3003 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +/* "SCI - ? */ +static INPUT_PORTS_START( winrun ) + PORT_INCLUDE(s21default) + + PORT_MODIFY("DSW") + PORT_DIPNAME( 0x20, 0x20, "PCM ROM") + PORT_DIPSETTING( 0x20, "2M" ) + PORT_DIPSETTING( 0x00, "4M" ) + + PORT_MODIFY("PORTB") /* 63B05Z0 - PORT B */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) /* ? */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) /* ? */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* ? */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* ? */ + + PORT_MODIFY("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ + PORT_BIT( 0xff, 0x80, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal") + PORT_MODIFY("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel") + PORT_MODIFY("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ + PORT_BIT( 0xff, 0x80, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") + PORT_MODIFY("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Shift Down") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Shift Up") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( winrungp ) + PORT_INCLUDE(winrun) + + PORT_MODIFY("DSW") + PORT_DIPNAME( 0x20, 0x00, "PCM ROM") + PORT_DIPSETTING( 0x20, "2M" ) + PORT_DIPSETTING( 0x00, "4M" ) +INPUT_PORTS_END + +/* 1 3 5 + |-|-| Gearbox scheme is identical to Ridge Racer deluxe and Ace Driver + 2 4 6 +*/ +// TODO: convert to namcoio_gearbox_device +CUSTOM_INPUT_MEMBER(namcos21_state::driveyes_gearbox_r) +{ + bool clutch_pressed = (ioport("PORTB")->read() & 8) == 0; + const char gearbox_output[16] = { '1', '-', '-', '-', + '-', '6', '5', 'N', + '-', '2', '1', 'N', + '-', '4', '3', 'N' }; + + popmessage("%c %c",gearbox_output[m_gearbox_state],clutch_pressed == true ? '*' : '.'); + + if(clutch_pressed == false) + return m_gearbox_state; + + m_gearbox_state = ioport("GEARBOX")->read() & 0xf; + + return 0xf; // return neutral while changing gear +} + +//static const ioport_value gearbox_table[] = { 0x0f, 0x0a, 0x09, 0x0e, 0x0d, 0x06, 0x05 }; + +static INPUT_PORTS_START( driveyes ) + PORT_INCLUDE(winrungp) + + PORT_MODIFY("PORTB") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Clutch Pedal") + PORT_BIT( 0x37, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("GEARBOX") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Gearbox Up") + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Gearbox Down") + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Gearbox Left") + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Gearbox Right") + + PORT_MODIFY("DIAL0") + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, namcos21_state,driveyes_gearbox_r, nullptr) + //PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL_V ) PORT_POSITIONS(7) PORT_REMAP_TABLE(gearbox_table) PORT_SENSITIVITY(15) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_PLAYER(1) PORT_NAME("GearBox") + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Red Button") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green Button") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +// the default inc/dec analog keys have been chosen to map 'tank' style inputs found on Assault. +// this makes the game easier to use with the keyboard, providing a familiar left/right stick mapping +// ports are limited to 10/ef because otherwise, even when calibrated, the game will act as if the +// inputs wrap around when they hit the maximum, causing undesired movement +static INPUT_PORTS_START( cybsled ) + PORT_INCLUDE(s21default) + + PORT_MODIFY("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ + PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) /* right joystick: vertical */ + PORT_MODIFY("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ + PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_E) PORT_CODE_INC(KEYCODE_D) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) /* left joystick: vertical */ + PORT_MODIFY("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ + PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) /* right joystick: horizontal */ + PORT_MODIFY("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ + PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_S) PORT_CODE_INC(KEYCODE_F) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) /* left joystick: horizontal */ + PORT_MODIFY("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Viewport Change Button") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Missile Button") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Gun Button") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( aircomb ) + PORT_INCLUDE(s21default) + + PORT_MODIFY("AN0") /* IN#2: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN1") /* IN#3: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) + PORT_MODIFY("AN2") /* IN#4: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) + PORT_MODIFY("AN3") /* IN#5: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE + PORT_MODIFY("AN4") /* IN#6: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN5") /* IN#7: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN6") /* IN#8: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("AN7") /* IN#9: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_MODIFY("DSW") /* 63B05Z0 - $2000 DIP SW */ + PORT_DIPNAME( 0x01, 0x01, "DSW1") // not test mode on this game + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_MODIFY("PORTH") /* IN#10: 63B05Z0 - PORT H */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) ///??? + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) // prev color + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) // ???next color + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + static const gfx_layout tile_layout = { @@ -1733,7 +1985,7 @@ static MACHINE_CONFIG_START( driveyes, namcos21_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(NAMCOS21_POLY_FRAME_WIDTH,NAMCOS21_POLY_FRAME_HEIGHT) MCFG_SCREEN_VISIBLE_AREA(0,495,0,479) - MCFG_SCREEN_UPDATE_DRIVER(namcos21_state, screen_update_namcos21) + MCFG_SCREEN_UPDATE_DRIVER(namcos21_state, screen_update_driveyes) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", namcos21) @@ -1792,13 +2044,12 @@ static MACHINE_CONFIG_START( winrun, namcos21_state ) MCFG_MACHINE_RESET_OVERRIDE(namcos21_state,namcos2) MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(NAMCOS21_POLY_FRAME_WIDTH,NAMCOS21_POLY_FRAME_HEIGHT) MCFG_SCREEN_VISIBLE_AREA(0,495,0,479) - MCFG_SCREEN_UPDATE_DRIVER(namcos21_state, screen_update_namcos21) + MCFG_SCREEN_UPDATE_DRIVER(namcos21_state, screen_update_winrun) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) @@ -2507,258 +2758,6 @@ DRIVER_INIT_MEMBER(namcos21_state,driveyes) m_mbNeedsKickstart = 0; } -/*************************************************************/ -/* */ -/* NAMCO SYSTEM 21 INPUT PORTS */ -/* */ -/*************************************************************/ - -static INPUT_PORTS_START( s21default ) - PORT_START("PORTB") /* 63B05Z0 - PORT B */ - PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) - - PORT_START("PORTC") /* 63B05Z0 - PORT C & SCI */ - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_0) PORT_TOGGLE // alt test mode switch - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) - - PORT_START("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x60,0x9f) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) - PORT_START("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x60,0x9f) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) - PORT_START("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PORTH") /* 63B05Z0 - PORT H */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("DSW") /* 63B05Z0 - $2000 DIP SW */ - PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) - PORT_DIPNAME( 0x02, 0x02, "DSW2") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DSW3") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DSW4") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DSW5") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, "PCM ROM") - PORT_DIPSETTING( 0x20, "2M" ) - PORT_DIPSETTING( 0x00, "4M" ) - PORT_DIPNAME( 0x40, 0x40, "DSW7") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Screen Stop") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DIAL0") /* 63B05Z0 - $3000 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DIAL1") /* 63B05Z0 - $3001 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DIAL2") /* 63B05Z0 - $3002 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DIAL3") /* 63B05Z0 - $3003 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -/* "SCI - ? */ -static INPUT_PORTS_START( winrun ) - PORT_INCLUDE(s21default) - - PORT_MODIFY("DSW") - PORT_DIPNAME( 0x20, 0x20, "PCM ROM") - PORT_DIPSETTING( 0x20, "2M" ) - PORT_DIPSETTING( 0x00, "4M" ) - - PORT_MODIFY("PORTB") /* 63B05Z0 - PORT B */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) /* ? */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) /* ? */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* ? */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* ? */ - - PORT_MODIFY("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ - PORT_BIT( 0xff, 0x80, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal") - PORT_MODIFY("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel") - PORT_MODIFY("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ - PORT_BIT( 0xff, 0x80, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(15) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") - PORT_MODIFY("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Shift Down") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Shift Up") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( winrungp ) - PORT_INCLUDE(winrun) - - PORT_MODIFY("DSW") - PORT_DIPNAME( 0x20, 0x00, "PCM ROM") - PORT_DIPSETTING( 0x20, "2M" ) - PORT_DIPSETTING( 0x00, "4M" ) -INPUT_PORTS_END - -/* 1 3 5 - |-|-| Gearbox scheme is identical to Ridge Racer deluxe and Ace Driver - 2 4 6 -*/ -// TODO: convert to namcoio_gearbox_device -CUSTOM_INPUT_MEMBER(namcos21_state::driveyes_gearbox_r) -{ - bool clutch_pressed = (ioport("PORTB")->read() & 8) == 0; - const char gearbox_output[16] = { '1', '-', '-', '-', - '-', '6', '5', 'N', - '-', '2', '1', 'N', - '-', '4', '3', 'N' }; - - popmessage("%c %c",gearbox_output[m_gearbox_state],clutch_pressed == true ? '*' : '.'); - - if(clutch_pressed == false) - return m_gearbox_state; - - m_gearbox_state = ioport("GEARBOX")->read() & 0xf; - - return 0xf; // return neutral while changing gear -} - -//static const ioport_value gearbox_table[] = { 0x0f, 0x0a, 0x09, 0x0e, 0x0d, 0x06, 0x05 }; - -static INPUT_PORTS_START( driveyes ) - PORT_INCLUDE(winrungp) - - PORT_MODIFY("PORTB") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Clutch Pedal") - PORT_BIT( 0x37, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("GEARBOX") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Gearbox Up") - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Gearbox Down") - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Gearbox Left") - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Gearbox Right") - - PORT_MODIFY("DIAL0") - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, namcos21_state,driveyes_gearbox_r, nullptr) - //PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL_V ) PORT_POSITIONS(7) PORT_REMAP_TABLE(gearbox_table) PORT_SENSITIVITY(15) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_PLAYER(1) PORT_NAME("GearBox") - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Red Button") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green Button") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -// the default inc/dec analog keys have been chosen to map 'tank' style inputs found on Assault. -// this makes the game easier to use with the keyboard, providing a familiar left/right stick mapping -// ports are limited to 10/ef because otherwise, even when calibrated, the game will act as if the -// inputs wrap around when they hit the maximum, causing undesired movement -static INPUT_PORTS_START( cybsled ) - PORT_INCLUDE(s21default) - - PORT_MODIFY("AN0") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ - PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) /* right joystick: vertical */ - PORT_MODIFY("AN1") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ - PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_E) PORT_CODE_INC(KEYCODE_D) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) /* left joystick: vertical */ - PORT_MODIFY("AN2") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ - PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) /* right joystick: horizontal */ - PORT_MODIFY("AN3") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ - PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xef) /* using 0x00 / 0xff causes controls to malfunction */ PORT_CODE_DEC(KEYCODE_S) PORT_CODE_INC(KEYCODE_F) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) /* left joystick: horizontal */ - PORT_MODIFY("AN4") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN5") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN6") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN7") /* 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Viewport Change Button") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Missile Button") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Gun Button") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( aircomb ) - PORT_INCLUDE(s21default) - - PORT_MODIFY("AN0") /* IN#2: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 0 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN1") /* IN#3: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 1 */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) - PORT_MODIFY("AN2") /* IN#4: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 2 */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) - PORT_MODIFY("AN3") /* IN#5: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 3 */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE - PORT_MODIFY("AN4") /* IN#6: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 4 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN5") /* IN#7: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 5 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN6") /* IN#8: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 6 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("AN7") /* IN#9: 63B05Z0 - 8 CHANNEL ANALOG - CHANNEL 7 */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_MODIFY("DSW") /* 63B05Z0 - $2000 DIP SW */ - PORT_DIPNAME( 0x01, 0x01, "DSW1") // not test mode on this game - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_MODIFY("PORTH") /* IN#10: 63B05Z0 - PORT H */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) ///??? - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) // prev color - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) // ???next color - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - /* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */ GAME( 1988, winrun, 0, winrun, winrun, namcos21_state, winrun, ROT0, "Namco", "Winning Run", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1989, winrungp, 0, winrun, winrungp, namcos21_state, winrun, ROT0, "Namco", "Winning Run Suzuka Grand Prix (Japan)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/includes/namcos21.h b/src/mame/includes/namcos21.h index d5f72c0c3ec..2d309808583 100644 --- a/src/mame/includes/namcos21.h +++ b/src/mame/includes/namcos21.h @@ -167,6 +167,8 @@ public: DECLARE_MACHINE_START(namcos21); DECLARE_VIDEO_START(namcos21); uint32_t screen_update_namcos21(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_winrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_driveyes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void allocate_poly_framebuffer(); void clear_poly_framebuffer(); void copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const rectangle &clip, int zlo, int zhi); diff --git a/src/mame/video/namcos21.cpp b/src/mame/video/namcos21.cpp index df6a7b79ac6..dcbdffdb047 100644 --- a/src/mame/video/namcos21.cpp +++ b/src/mame/video/namcos21.cpp @@ -7,6 +7,22 @@ Namco System 21 Video Hardware - there are no tilemaps - 3d graphics are managed by DSP processors */ +/* Palette: + 0x0000..0x1fff sprite palettes (0x10 sets of 0x100 colors) + + 0x2000..0x3fff polygon palette bank0 (0x10 sets of 0x200 colors) + (in starblade, some palette animation effects are performed here) + + 0x4000..0x5fff polygon palette bank1 (0x10 sets of 0x200 colors) + + 0x6000..0x7fff polygon palette bank2 (0x10 sets of 0x200 colors) + + The polygon-dedicated color sets within a bank typically increase in + intensity from very dark to full intensity. + + Probably the selected palette is determined by most significant bits of z-code. + This is not yet hooked up. + */ #include "emu.h" #include "includes/namcoic.h" @@ -103,101 +119,6 @@ void namcos21_state::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const r } } -VIDEO_START_MEMBER(namcos21_state,namcos21) -{ - if( m_gametype == NAMCOS21_WINRUN91 ) - { - m_videoram = std::make_unique(0x80000); - } - allocate_poly_framebuffer(); - c355_obj_init( - 0, /* gfx bank */ - 0xf, /* reverse palette mapping */ - namcos2_shared_state::c355_obj_code2tile_delegate() ); -} - - -/* Palette: - 0x0000..0x1fff sprite palettes (0x10 sets of 0x100 colors) - - 0x2000..0x3fff polygon palette bank0 (0x10 sets of 0x200 colors) - (in starblade, some palette animation effects are performed here) - - 0x4000..0x5fff polygon palette bank1 (0x10 sets of 0x200 colors) - - 0x6000..0x7fff polygon palette bank2 (0x10 sets of 0x200 colors) - - The polygon-dedicated color sets within a bank typically increase in - intensity from very dark to full intensity. - - Probably the selected palette is determined by most significant bits of z-code. - This is not yet hooked up. - */ - - -uint32_t namcos21_state::screen_update_namcos21(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *videoram = m_videoram.get(); - int pivot = 3; - int pri; - bitmap.fill(0xff, cliprect ); - - if( m_gametype != NAMCOS21_WINRUN91 ) - { /* draw low priority 2d sprites */ - c355_obj_draw(screen, bitmap, cliprect, 2 ); - c355_obj_draw(screen, bitmap, cliprect, 14 ); //driver's eyes - } - - copy_visible_poly_framebuffer(bitmap, cliprect, 0x7fc0, 0x7ffe); - - if( m_gametype != NAMCOS21_WINRUN91 ) - { /* draw low priority 2d sprites */ - c355_obj_draw(screen, bitmap, cliprect, 0 ); - c355_obj_draw(screen, bitmap, cliprect, 1 ); - } - - copy_visible_poly_framebuffer(bitmap, cliprect, 0, 0x7fbf); - - - if( m_gametype != NAMCOS21_WINRUN91 ) - { /* draw high priority 2d sprites */ - for( pri=pivot; pri<8; pri++ ) - { - c355_obj_draw(screen, bitmap, cliprect, pri ); - } - c355_obj_draw(screen, bitmap, cliprect, 15 ); //driver's eyes - } - else - { /* winrun bitmap layer */ - int yscroll = -cliprect.min_y+(int16_t)m_winrun_gpu_register[0x2/2]; - int base = 0x1000+0x100*(m_winrun_color&0xf); - int sx,sy; - for( sy=cliprect.min_y; sy<=cliprect.max_y; sy++ ) - { - const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; - uint16_t *pDest = &bitmap.pix16(sy); - for( sx=cliprect.min_x; sx<=cliprect.max_x; sx++ ) - { - int pen = pSource[sx]; - switch( pen ) - { - case 0xff: - break; - case 0x00: - pDest[sx] = (pDest[sx]&0x1fff)+0x4000; - break; - case 0x01: - pDest[sx] = (pDest[sx]&0x1fff)+0x6000; - break; - default: - pDest[sx] = base|pen; - break; - } - } - } - } /* winrun bitmap layer */ - return 0; -} /*********************************************************************************************/ @@ -436,3 +357,111 @@ void namcos21_state::draw_quad(int sx[4], int sy[4], int zcode[4], int color) rendertri(&a, &b, &c, color, depthcueenable); rendertri(&c, &d, &a, color, depthcueenable); } + +VIDEO_START_MEMBER(namcos21_state,namcos21) +{ + if( m_gametype == NAMCOS21_WINRUN91 ) + { + m_videoram = std::make_unique(0x80000); + } + allocate_poly_framebuffer(); + c355_obj_init( + 0, /* gfx bank */ + 0xf, /* reverse palette mapping */ + namcos2_shared_state::c355_obj_code2tile_delegate() ); +} + +uint32_t namcos21_state::screen_update_namcos21(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + //uint8_t *videoram = m_videoram.get(); + int pivot = 3; + int pri; + bitmap.fill(0xff, cliprect ); + + c355_obj_draw(screen, bitmap, cliprect, 2 ); + //c355_obj_draw(screen, bitmap, cliprect, 14 ); //driver's eyes + + copy_visible_poly_framebuffer(bitmap, cliprect, 0x7fc0, 0x7ffe); + + c355_obj_draw(screen, bitmap, cliprect, 0 ); + c355_obj_draw(screen, bitmap, cliprect, 1 ); + + copy_visible_poly_framebuffer(bitmap, cliprect, 0, 0x7fbf); + + /* draw high priority 2d sprites */ + for( pri=pivot; pri<8; pri++ ) + { + c355_obj_draw(screen, bitmap, cliprect, pri ); + } + // c355_obj_draw(screen, bitmap, cliprect, 15 ); //driver's eyes + return 0; +} + +uint32_t namcos21_state::screen_update_driveyes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + //uint8_t *videoram = m_videoram.get(); + int pivot = 3; + int pri; + bitmap.fill(0xff, cliprect ); + + c355_obj_draw(screen, bitmap, cliprect, 2 ); + c355_obj_draw(screen, bitmap, cliprect, 14 ); //driver's eyes + + copy_visible_poly_framebuffer(bitmap, cliprect, 0x7fc0, 0x7ffe); + + c355_obj_draw(screen, bitmap, cliprect, 0 ); + c355_obj_draw(screen, bitmap, cliprect, 1 ); + + copy_visible_poly_framebuffer(bitmap, cliprect, 0, 0x7fbf); + + for( pri=pivot; pri<8; pri++ ) + c355_obj_draw(screen, bitmap, cliprect, pri ); + + c355_obj_draw(screen, bitmap, cliprect, 15 ); //driver's eyes + + return 0; + +} + +uint32_t namcos21_state::screen_update_winrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint8_t *videoram = m_videoram.get(); + //int pivot = 3; + //int pri; + bitmap.fill(0xff, cliprect ); + + copy_visible_poly_framebuffer(bitmap, cliprect, 0x7fc0, 0x7ffe); + + copy_visible_poly_framebuffer(bitmap, cliprect, 0, 0x7fbf); + + + { /* winrun bitmap layer */ + int yscroll = -cliprect.min_y+(int16_t)m_winrun_gpu_register[0x2/2]; + int base = 0x1000+0x100*(m_winrun_color&0xf); + int sx,sy; + for( sy=cliprect.min_y; sy<=cliprect.max_y; sy++ ) + { + const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; + uint16_t *pDest = &bitmap.pix16(sy); + for( sx=cliprect.min_x; sx<=cliprect.max_x; sx++ ) + { + int pen = pSource[sx]; + switch( pen ) + { + case 0xff: + break; + case 0x00: + pDest[sx] = (pDest[sx]&0x1fff)+0x4000; + break; + case 0x01: + pDest[sx] = (pDest[sx]&0x1fff)+0x6000; + break; + default: + pDest[sx] = base|pen; + break; + } + } + } + } /* winrun bitmap layer */ + return 0; +} -- cgit v1.2.3