summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/konmedal68k.cpp
diff options
context:
space:
mode:
authorGravatarGravatar arbee <rb6502@users.noreply.github.com>2018-02-03 21:14:45 -0500
committerGravatarGravatar arbee <rb6502@users.noreply.github.com>2018-02-03 21:14:45 -0500
commit68335d80ecd8fda68bef649232507a790890231a (patch) (github)
tree42ca97fdc7c7a6f0ad0d9cc5db25fc2947ab5fb7 /src/mame/drivers/konmedal68k.cpp
parent5051f3c3f7ec45204836eae8ad0bab4bf4a04c01 (diff)
downloadmame-68335d80ecd8fda68bef649232507a790890231a.tar.bz2
mame-68335d80ecd8fda68bef649232507a790890231a.zip
kzaurus: pass POST, add IRQs, inputs, and sound. [R. Belmont]
Diffstat (limited to 'src/mame/drivers/konmedal68k.cpp')
-rw-r--r--src/mame/drivers/konmedal68k.cpp195
1 files changed, 174 insertions, 21 deletions
diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp
index cbd5aa22bf0..2afa0a73818 100644
--- a/src/mame/drivers/konmedal68k.cpp
+++ b/src/mame/drivers/konmedal68k.cpp
@@ -49,66 +49,218 @@ public:
void kzaurus(machine_config &config);
K056832_CB_MEMBER(tile_callback);
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline);
+
+ DECLARE_WRITE16_MEMBER(control_w)
+ {
+ m_control = data & 0xff;
+
+ if (!(data & 0x8))
+ {
+ m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
+ }
+
+ if (!(data & 0x10))
+ {
+ m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
+ }
+ }
+ DECLARE_WRITE16_MEMBER(control2_w) { m_control2 = data & 0xff; }
+
+ DECLARE_READ16_MEMBER(vrom_r)
+ {
+ if (m_control2 & 0x10)
+ {
+ offset |= 0x1000;
+ }
+
+ return m_k056832->piratesh_rom_r(space, offset, mem_mask);
+ }
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
+ static constexpr int NUM_LAYERS = 4;
+
private:
required_device<cpu_device> m_maincpu;
required_device<k056832_device> m_k056832;
required_device<k055555_device> m_k055555;
required_device<palette_device> m_palette;
required_device<ymz280b_device> m_ymz;
+
+ u8 m_control, m_control2;
};
void konmedal68k_state::video_start()
{
+ m_k056832->set_layer_offs(0, -12, -8); // title on title screen
+ m_k056832->set_layer_offs(1, 20, 8); // konami logo on title screen
+ m_k056832->set_layer_offs(2, 4, -8);
+ m_k056832->set_layer_offs(3, 6, -16);
}
-K056832_CB_MEMBER(konmedal68k_state::tile_callback)
+TIMER_DEVICE_CALLBACK_MEMBER(konmedal68k_state::scanline)
{
- int codebits = *code;
-// int mode, data; //, bank;
+ int scanline = param;
-// m_k056832->read_avac(&mode, &data);
+ if ((scanline == 240) && (m_control & 0x8))
+ {
+ m_maincpu->set_input_line(M68K_IRQ_3, ASSERT_LINE);
- *color = 1;
- *code = codebits; // | (bank << 10);
+ }
+
+ if ((scanline == 255) && (m_control & 0x10))
+ {
+ m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE);
+ }
+}
+
+K056832_CB_MEMBER(konmedal68k_state::tile_callback)
+{
}
uint32_t konmedal68k_state::screen_update_konmedal68k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
+ int enables = m_k055555->K055555_read_register(K55_INPUT_ENABLES);
+ int pri[NUM_LAYERS];
+ int order[NUM_LAYERS];
+ int i, j;
+
bitmap.fill(0, cliprect);
screen.priority().fill(0, cliprect);
- // game only draws on this layer, apparently
- m_k056832->tilemap_draw(screen, bitmap, cliprect, 0, 0, 1);
- m_k056832->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1);
- m_k056832->tilemap_draw(screen, bitmap, cliprect, 2, 0, 1);
- m_k056832->tilemap_draw(screen, bitmap, cliprect, 3, 0, 1);
+ for (i = 0; i < NUM_LAYERS; i++)
+ {
+ pri[i] = m_k055555->K055555_read_register(K55_PRIINP_0 + i * 3);
+ }
+
+ for (i = 0; i < NUM_LAYERS + 1; i++)
+ {
+ order[i] = i;
+ }
+
+ for (i = 0; i < NUM_LAYERS; i++)
+ {
+ for (j = i; j < NUM_LAYERS; j++)
+ {
+ if (pri[order[i]] > pri[order[j]])
+ {
+ int temp = order[i];
+
+ order[i] = order[j];
+ order[j] = temp;
+ }
+ }
+ }
+
+ for (i = 0; i < NUM_LAYERS; i++)
+ {
+ int layer = order[i];
+
+ if (enables & (K55_INP_VRAM_A << layer))
+ {
+ m_k056832->tilemap_draw(screen, bitmap, cliprect, layer, 0, 1 << i);
+ }
+ }
-// for (int i = 0; i < 5; i++)
-// printf("idx %d %x ", i, m_k055555->K055555_get_palette_index(0));
-// printf("\n");
return 0;
}
static ADDRESS_MAP_START( kzaurus_main, AS_PROGRAM, 16, konmedal68k_state )
AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_REGION("maincpu", 0)
AM_RANGE(0x400000, 0x403fff) AM_RAM
- AM_RANGE(0x800000, 0x800001) AM_WRITENOP // watchdog? control?
- AM_RANGE(0x810000, 0x810001) AM_WRITENOP
- AM_RANGE(0x830000, 0x83003f) AM_DEVWRITE("k056832", k056832_device, word_w)
+ AM_RANGE(0x800000, 0x800001) AM_WRITE(control_w)
+ AM_RANGE(0x800004, 0x800005) AM_READ_PORT("DSW")
+ AM_RANGE(0x800006, 0x800007) AM_READ_PORT("IN1")
+ AM_RANGE(0x800008, 0x800009) AM_READ_PORT("IN0")
+ AM_RANGE(0x810000, 0x810001) AM_WRITE(control2_w)
+ AM_RANGE(0x830000, 0x83003f) AM_DEVWRITE("k056832", k056832_device, word_w) // this game does read these registers, but does the chip allow it?
AM_RANGE(0x840000, 0x84000f) AM_DEVWRITE("k056832", k056832_device, b_word_w)
+ AM_RANGE(0x85001c, 0x85001f) AM_WRITENOP
AM_RANGE(0x870000, 0x87005f) AM_DEVWRITE("k055555", k055555_device, K055555_word_w)
+ AM_RANGE(0x880000, 0x880003) AM_DEVREADWRITE8("ymz", ymz280b_device, read, write, 0xff00)
AM_RANGE(0xa00000, 0xa01fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w)
+ AM_RANGE(0xa02000, 0xa03fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w)
AM_RANGE(0xb00000, 0xb01fff) AM_RAM_DEVWRITE("palette", palette_device, write16) AM_SHARE("palette")
- AM_RANGE(0xc00000, 0xc01fff) AM_DEVREAD("k056832", k056832_device, piratesh_rom_r)
+ AM_RANGE(0xc00000, 0xc01fff) AM_READ(vrom_r)
ADDRESS_MAP_END
static INPUT_PORTS_START( kzaurus )
+ PORT_START("IN0")
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 )
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test") PORT_CODE(KEYCODE_F2)
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SERVICE1 )
+ PORT_BIT( 0xff1f, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("IN1")
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) // medal ack
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN3 ) // medal
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN2 )
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN1 )
+ PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x07, 0x00, "Coin Slot 1" ) PORT_DIPLOCATION("SW1:1,2,3")
+ PORT_DIPSETTING( 0x00, "5 Coins/2 Credits" )
+ PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0x03, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
+ PORT_DIPNAME( 0x78, 0x00, "Coin Slot 2" ) PORT_DIPLOCATION("SW1:4,5,6,7")
+ PORT_DIPSETTING( 0x00, "16 Medals" )
+ PORT_DIPSETTING( 0x08, "15 Medals" )
+ PORT_DIPSETTING( 0x10, "14 Medals" )
+ PORT_DIPSETTING( 0x18, "13 Medals" )
+ PORT_DIPSETTING( 0x20, "12 Medals" )
+ PORT_DIPSETTING( 0x28, "11 Medals" )
+ PORT_DIPSETTING( 0x30, "10 Medals" )
+ PORT_DIPSETTING( 0x38, "9 Medals" )
+ PORT_DIPSETTING( 0x40, "8 Medals" )
+ PORT_DIPSETTING( 0x48, "7 Medals" )
+ PORT_DIPSETTING( 0x50, "6 Medals" )
+ PORT_DIPSETTING( 0x58, "5 Medals" )
+ PORT_DIPSETTING( 0x60, "4 Medals" )
+ PORT_DIPSETTING( 0x68, "3 Medals" )
+ PORT_DIPSETTING( 0x70, "2 Medals" )
+ // PORT_DIPSETTING( 0x78, "2 Medals" )
+ PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPSETTING( 0x80, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+
+ PORT_DIPNAME( 0x0f00, 0x0000, "Standard of Payout" ) PORT_DIPLOCATION("SW2:1,2,3,4")
+ PORT_DIPSETTING( 0x0000, "90%" )
+ PORT_DIPSETTING( 0x0100, "85%" )
+ PORT_DIPSETTING( 0x0200, "80%" )
+ PORT_DIPSETTING( 0x0300, "75%" )
+ PORT_DIPSETTING( 0x0400, "70%" )
+ PORT_DIPSETTING( 0x0500, "65%" )
+ PORT_DIPSETTING( 0x0600, "60%" )
+ PORT_DIPSETTING( 0x0700, "55%" )
+ PORT_DIPSETTING( 0x0800, "50%" )
+ PORT_DIPSETTING( 0x0900, "45%" )
+ PORT_DIPSETTING( 0x0a00, "40%" )
+ PORT_DIPSETTING( 0x0b00, "35%" )
+ PORT_DIPSETTING( 0x0c00, "30%" )
+ PORT_DIPSETTING( 0x0d00, "25%" )
+ PORT_DIPSETTING( 0x0e00, "20%" )
+ PORT_DIPSETTING( 0x0f00, "15%" )
+ PORT_DIPNAME( 0x3000, 0x0000, "Play Timer" ) PORT_DIPLOCATION("SW2:5,6")
+ PORT_DIPSETTING( 0x0000, "30 sec" )
+ PORT_DIPSETTING( 0x1000, "24 sec" )
+ PORT_DIPSETTING( 0x2000, "18 sec" )
+ PORT_DIPSETTING( 0x3000, "12 sec" )
+ PORT_DIPNAME( 0x4000, 0x0000, "Backup Memory" ) PORT_DIPLOCATION("SW2:7")
+ PORT_DIPSETTING( 0x4000, "Keep" )
+ PORT_DIPSETTING( 0x0000, "Clear" )
+ PORT_DIPNAME( 0x8000, 0x0000, "Demo Sound" ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
void konmedal68k_state::machine_start()
@@ -117,26 +269,27 @@ void konmedal68k_state::machine_start()
void konmedal68k_state::machine_reset()
{
+ m_control = m_control2 = 0;
}
MACHINE_CONFIG_START(konmedal68k_state::kzaurus)
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, XTAL(33'868'800)/4 ) // 33.8688 MHz crystal verified on PCB
MCFG_CPU_PROGRAM_MAP(kzaurus_main)
+ MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", konmedal68k_state, scanline, "screen", 0, 1)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(59.62) /* verified on pcb */
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
- MCFG_SCREEN_VISIBLE_AREA(80, 400-1, 16, 240-1)
+ MCFG_SCREEN_VISIBLE_AREA(40, 360-1, 16, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(konmedal68k_state, screen_update_konmedal68k)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 8192)
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(XBGR)
- //MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(konmedal68k_state, tile_callback)
@@ -165,4 +318,4 @@ ROM_START( kzaurus )
ROM_LOAD( "540-a01-2f.bin", 0x000000, 0x080000, CRC(391c6ee6) SHA1(a345934687a8abf818350d0597843a1159395fc0) )
ROM_END
-GAME( 1995, kzaurus, 0, kzaurus, kzaurus, konmedal68k_state, 0, ROT0, "Konami", "Pittanko Zaurus", MACHINE_NOT_WORKING)
+GAME( 1995, kzaurus, 0, kzaurus, kzaurus, konmedal68k_state, 0, ROT0, "Konami", "Pittanko Zaurus", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )