diff options
author | 2016-06-15 03:51:52 +0200 | |
---|---|---|
committer | 2016-06-15 03:51:52 +0200 | |
commit | 6df371a0f10fb57820e7d1ee08a3344372a27246 (patch) | |
tree | 25c12953615cae15d971ed9c0e2d34bbe9aa5143 | |
parent | b82d7c4aef44eac0c4752b7db3c29306610a84ac (diff) |
romload.cpp: added ROMX_FILL, passing a ROM_SKIP(param_value) will fill and skip just like a ROM_LOAD16_BYTE macro [Angelo Salese]
Added line blinking and overlay opacity selectors for esh.cpp [Angelo Salese]
Some minor improvements for LDP-1000 (nw)
-rw-r--r-- | src/devices/machine/ldp1000.cpp | 51 | ||||
-rw-r--r-- | src/devices/machine/ldp1000.h | 8 | ||||
-rw-r--r-- | src/emu/romload.cpp | 11 | ||||
-rw-r--r-- | src/emu/romload.h | 1 | ||||
-rw-r--r-- | src/mame/drivers/esh.cpp | 116 |
5 files changed, 132 insertions, 55 deletions
diff --git a/src/devices/machine/ldp1000.cpp b/src/devices/machine/ldp1000.cpp index 415a4581097..abfa23913b0 100644 --- a/src/devices/machine/ldp1000.cpp +++ b/src/devices/machine/ldp1000.cpp @@ -15,6 +15,7 @@ #include "machine/ldp1000.h" #define DUMP_BCD 1 +#define FIFO_MAX 0x10 ROM_START( ldp1000 ) ROM_REGION( 0x2000, "ldp1000", 0 ) @@ -70,6 +71,9 @@ void sony_ldp1000_device::device_start() void sony_ldp1000_device::device_reset() { laserdisc_device::device_reset(); + + for(int i=0;i<0x10;i++) + m_internal_bcd[i] = 0; } @@ -119,11 +123,10 @@ READ8_MEMBER( sony_ldp1000_device::status_r ) return res; } -void sony_ldp1000_device::set_new_player_state(ldp1000_player_state which, UINT8 fifo_size) +void sony_ldp1000_device::set_new_player_state(ldp1000_player_state which) { m_player_state = which; m_index_state = 0; - m_index_size = fifo_size; printf("set new player state\n"); } @@ -132,18 +135,36 @@ void sony_ldp1000_device::set_new_player_bcd(UINT8 data) { m_internal_bcd[m_index_state] = data; m_index_state ++; - if(m_index_state >= m_index_size) + if(m_index_state >= FIFO_MAX) + throw emu_fatalerror("FIFO MAX reached"); + + m_status = stat_ack; +} + +UINT32 sony_ldp1000_device::bcd_to_raw() +{ + UINT32 res = 0; + for(int i=0;i<6;i++) + res |= (m_internal_bcd[i] & 0xf) << i*4; + return res; +} + +void sony_ldp1000_device::exec_enter_cmd() +{ + //const UINT32 saved_frame = bcd_to_raw(); + + switch(m_player_state) { - #if DUMP_BCD - for(int i=0;i<m_index_size;i++) - printf("%02x ",m_internal_bcd[i]); + case player_standby: + throw emu_fatalerror("Unimplemented standby state detected"); - printf("[size = %02x]\n",m_index_size); - #endif - m_status = stat_ack; + case player_search: + // TODO: move to timer + //advance_slider(1); + //set_slider_speed(saved_frame); + break; } - else - m_status = stat_ack; + m_player_state = player_standby; } @@ -154,7 +175,7 @@ WRITE8_MEMBER( sony_ldp1000_device::command_w ) // 0x30 to 0x69 range causes an ACK, anything else is invalid m_command = data; - if((m_command & 0xf0) == 0x30) + if((m_command & 0xf0) == 0x30 && (m_command & 0xf) < 0x0a) { set_new_player_bcd(data); return; @@ -162,11 +183,13 @@ WRITE8_MEMBER( sony_ldp1000_device::command_w ) switch(m_command) { - case 0x40: // enter bcd command, todo + case 0x40: // enter, process BCD command + exec_enter_cmd(); + m_status = stat_ack; break; case 0x43: // search - set_new_player_state(player_search,5); + set_new_player_state(player_search); m_status = stat_ack; break; diff --git a/src/devices/machine/ldp1000.h b/src/devices/machine/ldp1000.h index b7cf9cbeea4..142886da936 100644 --- a/src/devices/machine/ldp1000.h +++ b/src/devices/machine/ldp1000.h @@ -72,12 +72,14 @@ private: ldp1000_status m_status; ldp1000_player_state m_player_state; bool m_audio_enable[2]; - // TODO: sub-class - void set_new_player_state(ldp1000_player_state which, UINT8 fifo_size); + // TODO: sub-class into a specific internal player state + void set_new_player_state(ldp1000_player_state which); void set_new_player_bcd(UINT8 data); + UINT32 bcd_to_raw(); + void exec_enter_cmd(); UINT8 m_internal_bcd[0x10]; UINT8 m_index_state; - UINT8 m_index_size; + }; diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 2efc80a4dc5..1f56418cad9 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -801,6 +801,7 @@ int rom_load_manager::read_rom_data(const rom_entry *parent_region, const rom_en void rom_load_manager::fill_rom_data(const rom_entry *romp) { UINT32 numbytes = ROM_GETLENGTH(romp); + int skip = ROM_GETSKIPCOUNT(romp); UINT8 *base = m_region->base() + ROM_GETOFFSET(romp); /* make sure we fill within the region space */ @@ -811,8 +812,16 @@ void rom_load_manager::fill_rom_data(const rom_entry *romp) if (numbytes == 0) fatalerror("Error in RomModule definition: FILL has an invalid length\n"); + printf("base %08x %02x\n",numbytes,skip); + /* fill the data (filling value is stored in place of the hashdata) */ - memset(base, (FPTR)ROM_GETHASHDATA(romp) & 0xff, numbytes); + if(skip != 0) + { + for (int i = 0; i < numbytes; i+= skip + 1) + base[i] = (FPTR)ROM_GETHASHDATA(romp) & 0xff; + } + else + memset(base, (FPTR)ROM_GETHASHDATA(romp) & 0xff, numbytes); } diff --git a/src/emu/romload.h b/src/emu/romload.h index f0553949d96..860f50cbe95 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -236,6 +236,7 @@ struct rom_entry #define ROM_CONTINUE(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS }, #define ROM_IGNORE(length) { nullptr, nullptr, 0, length, ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS }, #define ROM_FILL(offset,length,value) { nullptr, (const char *)value, offset, length, ROMENTRYTYPE_FILL }, +#define ROMX_FILL(offset,length,value,flags) { nullptr, (const char *)value, offset, length, ROMENTRYTYPE_FILL | flags }, #define ROM_COPY(srctag,srcoffs,offset,length) { srctag, (const char *)srcoffs, offset, length, ROMENTRYTYPE_COPY }, diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index 72dcb78dfcb..f9ce2dfcbf2 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -14,7 +14,8 @@ Notes: Eshb has some junk in the IO TEST screen. Maybe a bad dump? Todo: - - LD TROUBLE message pops up after each cycle in attract. NMI-related? + - LD TROUBLE message pops up after each cycle in attract. NMI-related + - Wrong overlay colors; - Convert to tilemaps (see next ToDo for feasibility). - Apparently some tiles blink (in at least two different ways). - 0xfe and 0xff are pretty obviously not NMI enables. They're likely LED's. Do the NMI right (somehow). @@ -40,27 +41,31 @@ public: esh_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_laserdisc(*this, "laserdisc") , - m_tile_ram(*this, "tile_ram"), - m_tile_control_ram(*this, "tile_ctrl_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_laserdisc(*this, "laserdisc"), + m_screen(*this, "screen"), + m_tile_ram(*this, "tile_ram"), + m_tile_control_ram(*this, "tile_ctrl_ram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } required_device<pioneer_ldv1000_device> m_laserdisc; + required_device<screen_device> m_screen; required_shared_ptr<UINT8> m_tile_ram; required_shared_ptr<UINT8> m_tile_control_ram; - UINT8 m_ld_video_visible; + bool m_ld_video_visible; DECLARE_READ8_MEMBER(ldp_read); DECLARE_WRITE8_MEMBER(ldp_write); DECLARE_WRITE8_MEMBER(misc_write); DECLARE_WRITE8_MEMBER(led_writes); DECLARE_WRITE8_MEMBER(nmi_line_w); DECLARE_DRIVER_INIT(esh); + bool m_nmi_enable; virtual void machine_start() override; DECLARE_PALETTE_INIT(esh); UINT32 screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_callback_esh); + INTERRUPT_GEN_MEMBER(ld_unk_callback); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; @@ -78,10 +83,14 @@ protected: UINT32 esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int charx, chary; + const UINT8 pal_bank = m_ld_video_visible == true ? 0x10 : 0x00; + const UINT32 trans_mask = m_ld_video_visible == true ? 0 : -1; + gfx_element *gfx;// = m_gfxdecode->gfx(0); /* clear */ bitmap.fill(0, cliprect); + /* Draw tiles */ for (charx = 0; charx < 32; charx++) { @@ -91,13 +100,20 @@ UINT32 esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, int palIndex = (m_tile_control_ram[current_screen_character] & 0x0f); int tileOffs = (m_tile_control_ram[current_screen_character] & 0x10) >> 4; - //int blinkLine = (m_tile_control_ram[current_screen_character] & 0x40) >> 6; + bool blinkLine = bool((m_tile_control_ram[current_screen_character] & 0x40) >> 6); //int blinkChar = (m_tile_control_ram[current_screen_character] & 0x80) >> 7; - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - m_tile_ram[current_screen_character] + (0x100 * tileOffs), - palIndex, - 0, 0, charx*8, chary*8, 0); + // TODO: blink timing + if(blinkLine == true && m_screen->frame_number() & 0x10) + gfx = m_gfxdecode->gfx(1); + else + gfx = m_gfxdecode->gfx(0); + + gfx->transpen(bitmap,cliprect, + m_tile_ram[current_screen_character] + (0x100 * tileOffs), + palIndex + pal_bank, + 0, 0, charx*8, chary*8, trans_mask); + } } @@ -126,7 +142,7 @@ WRITE8_MEMBER(esh_state::misc_write) logerror("BEEP!\n"); /* Bit 2 unknown */ - m_ld_video_visible = !((data & 0x08) >> 3); + m_ld_video_visible = bool(!((data & 0x08) >> 3)); /* Bits 4-7 unknown */ /* They cycle through a repeating pattern though */ @@ -165,13 +181,15 @@ WRITE8_MEMBER(esh_state::led_writes) WRITE8_MEMBER(esh_state::nmi_line_w) { - if (data == 0x00) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - if (data == 0x01) - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - - if (data != 0x00 && data != 0x01) - logerror("NMI line got a weird value!\n"); + // 0 -> 1 transition enables this, else disabled? + m_nmi_enable = (data & 1) == 1; + //if (data == 0x00) + // m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + //if (data == 0x01) + // m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + + if (data & 0xfe) + logerror("NMI line unknown bit set %02x\n",data); } @@ -206,7 +224,7 @@ static INPUT_PORTS_START( esh ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "TEST" ) PORT_CODE( KEYCODE_T ) + PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -259,25 +277,28 @@ PALETTE_INIT_MEMBER(esh_state, esh) bit0 = (color_prom[i+0x100] >> 0) & 0x01; bit1 = (color_prom[i+0x100] >> 1) & 0x01; bit2 = (color_prom[i+0x100] >> 2) & 0x01; - r = (0x97 * bit2) + (0x47 * bit1) + (0x21 * bit0); + r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* green component */ - bit0 = 0; + bit0 = 0; //(color_prom[i+0x100] >> 0) & 0x01; bit1 = (color_prom[i+0x100] >> 3) & 0x01; bit2 = (color_prom[i+0x100] >> 4) & 0x01; - g = (0x97 * bit2) + (0x47 * bit1) + (0x21 * bit0); + g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* blue component */ - bit0 = 0; - bit1 = (color_prom[i+0x100] >> 5) & 0x01; - bit2 = (color_prom[i+0x100] >> 6) & 0x01; - b = (0x97 * bit2) + (0x47 * bit1) + (0x21 * bit0); - + if((color_prom[i+0x100] >> 7) & 1) + b = 0xff; + else + { + bit0 = 0; //(color_prom[i+0x100] >> 5) & 0x01; + bit1 = (color_prom[i+0x100] >> 5) & 0x01; + bit2 = (color_prom[i+0x100] >> 6) & 0x01; + b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + } + palette.set_pen_color(i,rgb_t(r,g,b)); } - /* make color 0 transparent */ - palette.set_pen_color(0, rgb_t(0,0,0,0)); } static const gfx_layout esh_gfx_layout = @@ -285,7 +306,7 @@ static const gfx_layout esh_gfx_layout = 8,8, RGN_FRAC(1,3), 3, - { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, + { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) }, { 0,1,2,3,4,5,6,7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, 8*8 @@ -293,6 +314,7 @@ static const gfx_layout esh_gfx_layout = static GFXDECODE_START( esh ) GFXDECODE_ENTRY("gfx1", 0, esh_gfx_layout, 0x0, 0x20) + GFXDECODE_ENTRY("gfx2", 0, esh_gfx_layout, 0x0, 0x20) GFXDECODE_END void esh_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) @@ -314,6 +336,13 @@ INTERRUPT_GEN_MEMBER(esh_state::vblank_callback_esh) timer_set(attotime::from_usec(50), TIMER_IRQ_STOP); } +// TODO: 0xfe NMI enabled after writing to LD command port, NMI reads LD port. LDV needs command strobe callback? +INTERRUPT_GEN_MEMBER(esh_state::ld_unk_callback) +{ + if(m_nmi_enable) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + void esh_state::machine_start() { } @@ -327,7 +356,9 @@ static MACHINE_CONFIG_START( esh, esh_state ) MCFG_CPU_PROGRAM_MAP(z80_0_mem) MCFG_CPU_IO_MAP(z80_0_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", esh_state, vblank_callback_esh) + MCFG_CPU_PERIODIC_INT_DRIVER(esh_state, ld_unk_callback, 90) + MCFG_NVRAM_ADD_0FILL("nvram") @@ -351,6 +382,11 @@ static MACHINE_CONFIG_START( esh, esh_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END +// we just disable even lines so we can simulate line blinking +#define ROM_INTERLACED_GFX \ + ROM_REGION( 0x3000, "gfx2", 0 ) \ + ROM_COPY( "gfx1", 0, 0, 0x3000 ) \ + ROMX_FILL( 0, 0x3000, 0x00, ROM_SKIP(1) ) \ ROM_START( esh ) /* Main program CPU */ @@ -364,6 +400,8 @@ ROM_START( esh ) ROM_LOAD( "b.l3", 0x1000, 0x1000, CRC(9366dde7) SHA1(891db65384d47d13355b2eea37f57c34bc775c8f) ) ROM_LOAD( "c.k3", 0x2000, 0x1000, CRC(a936ef01) SHA1(bcacb281ccb72ceb57fb6a79380cc3a9688743c4) ) + ROM_INTERLACED_GFX + /* Color (+other) PROMs */ ROM_REGION( 0x400, "proms", 0 ) ROM_LOAD( "rgb.j1", 0x000, 0x200, CRC(1e9f795f) SHA1(61a58694929fa39b2412bc9244e5681d65a0eacb) ) @@ -371,7 +409,7 @@ ROM_START( esh ) ROM_LOAD( "v.c6", 0x300, 0x100, CRC(7157ba22) SHA1(07355f30efe46196d216356eda48a59fc622e43f) ) DISK_REGION( "laserdisc" ) - DISK_IMAGE_READONLY( "esh", 0, NO_DUMP ) + DISK_IMAGE_READONLY( "esh_ver2_en", 0, SHA1(c04709d95fd92259f013ec1cd28e3e36a163abe1) ) ROM_END ROM_START( esha ) @@ -386,6 +424,8 @@ ROM_START( esha ) ROM_LOAD( "b.l3", 0x1000, 0x1000, CRC(9366dde7) SHA1(891db65384d47d13355b2eea37f57c34bc775c8f) ) ROM_LOAD( "c.k3", 0x2000, 0x1000, CRC(a936ef01) SHA1(bcacb281ccb72ceb57fb6a79380cc3a9688743c4) ) + ROM_INTERLACED_GFX + /* Color (+other) PROMs */ ROM_REGION( 0x400, "proms", 0 ) ROM_LOAD( "rgb.j1", 0x000, 0x200, CRC(1e9f795f) SHA1(61a58694929fa39b2412bc9244e5681d65a0eacb) ) @@ -408,6 +448,8 @@ ROM_START( eshb ) ROM_LOAD( "b.l3", 0x1000, 0x1000, CRC(9366dde7) SHA1(891db65384d47d13355b2eea37f57c34bc775c8f) ) ROM_LOAD( "c.k3", 0x2000, 0x1000, CRC(a936ef01) SHA1(bcacb281ccb72ceb57fb6a79380cc3a9688743c4) ) + ROM_INTERLACED_GFX + /* Color (+other) PROMs */ ROM_REGION( 0x400, "proms", 0 ) ROM_LOAD( "rgb.j1", 0x000, 0x200, CRC(1e9f795f) SHA1(61a58694929fa39b2412bc9244e5681d65a0eacb) ) @@ -424,6 +466,6 @@ DRIVER_INIT_MEMBER(esh_state,esh) } /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS */ -GAME( 1983, esh, 0, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 1)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -GAME( 1983, esha, esh, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 2)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -GAME( 1983, eshb, esh, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 3)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME( 1983, esh, 0, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 1)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_COLORS) +GAME( 1983, esha, esh, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 2)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_COLORS) +GAME( 1983, eshb, esh, esh, esh, esh_state, esh, ROT0, "Funai/Gakken", "Esh's Aurunmilla (set 3)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_COLORS) |