Previous 199869 Revisions Next

r33383 Saturday 15th November, 2014 at 10:44:55 UTC by Alex W. Jackson
lethal.c: sanify palette size and bankdev address map; add placeholder for gfx ROM read (nw)
[src/mame/drivers]lethal.c
[src/mame/includes]lethal.h
[src/mame/video]lethal.c

trunk/src/mame/drivers/lethal.c
r241894r241895
109109---------------- --- -------- --------- -----------------------
110110000xxxxxxxxxxxxx R   xxxxxxxx PROM      program ROM (banked)
111111001xxxxxxxxxxxxx R/W xxxxxxxx WRAM      work RAM
112010000--00xxxxxx   W xxxxxxxx VREG      056832 control
113010000--01--xxxx   W xxxxxxxx VSCG      056832 control
112010000--00xxxxxx   W xxxxxxxx VREG      054156 control
113010000--01--xxxx   W xxxxxxxx VSCG      054157 control
114114010000--1000---- R/W -------- AFR       watchdog reset
115115010000--1001----   W          SDON      sound enable?
116116010000--1010                  CCLR      ?
r241894r241895
121121010000--11-000--   W --x----- CRDB      /
122122010000--11-001--   W -----xxx EEP       EEPROM DI, CS, CLK
123123010000--11-001--   W ----x--- MUT       sound mute?
124010000--11-001--   W ---x---- CBNK      bank switch 4800-7FFF region between palette and 053245/056832
124010000--11-001--   W ---x---- CBNK      bank switch 4400-7FFF region between palette and 053245/054156
125125010000--11-001--   W --x----- n.c.
126126010000--11-001--   W xx------ SHD0/1    shadow control
127127010000--11-010--   W -----xxx PCU1/XBA  palette bank (tilemap A)
r241894r241895
138138010000--11-11011 R   -------x NCPU      ?
139139010000--11-111--   W --xxxxxx BREG      ROM bank select
140140010010--00------              n.c.
141010010--01---xxx R/W xxxxxxxx OREG      053244
141010010--01---xxx R/W xxxxxxxx OREG      053244/053245 control
142142010010--10-xxxxx R/W xxxxxxxx HIP       054000
143143010010--11       R/W xxxxxxxx PAR       sound communication
144010100xxxxxxxxxx R/W xxxxxxxx OBJ       053245
145011xxxxxxxxxxxxx R/W xxxxxxxx VRAM      056832
144010100xxxxxxxxxx R/W xxxxxxxx OBJ       053245 sprite RAM
145011xxxxxxxxxxxxx R/W xxxxxxxx VRAM      054156 video RAM
1461461xxxxxxxxxxxxxxx R   xxxxxxxx PROM      program ROM
147147
148148
r241894r241895
231231
232232note:
233233
234lethal enforcers has 2 sprite rendering chips working in parallel mixing
235data together to give 6bpp.. we cheat by using a custom function in
236konamiic.c and a fixed 6bpp decode.
234Lethal Enforcers has two sprite rendering chips working in parallel with their
235output mixed to give 6bpp, and two tilemap rendering chips working in parallel
236to give 8bpp. We currently cheat, using just one of each device but using
237alternate gfx layouts. Emulating it accurately will require separating the
238"front end" chips (053245, 054156) from the "back end" chips (053244, 054157)
239as only the latter are doubled.
237240
238241mirror not set up correctly
239242
r241894r241895
265268   /* bit 1 is cs (active low) */
266269   /* bit 2 is clock (active high) */
267270   /* bit 3 is "MUT" on the schematics (audio mute?) */
268   /* bit 4 bankswitches the 4800-7fff region: 0 = registers, 1 = RAM ("CBNK" on schematics) */
271   /* bit 4 bankswitches the 4400-7fff region: 0 = registers, 1 = palette RAM ("CBNK" on schematics) */
269272   /* bit 6 is "SHD0" (some kind of shadow control) */
270273   /* bit 7 is "SHD1" (ditto) */
271274
272275   m_cur_control2 = data;
273276
274   m_bank4800->set_bank((m_cur_control2 >> 4) & 1);
277   m_bank4000->set_bank(BIT(m_cur_control2, 4));
275278
276279   ioport("EEPROMOUT")->write(m_cur_control2, 0xff);
277280}
r241894r241895
302305   membank("bank1")->set_entry(data);
303306}
304307
305// use one more palette entry for the BG color
306WRITE8_MEMBER(lethal_state::le_bgcolor_w)
307{
308   m_palette->write(space, 0x3800 + offset, data);
309}
310
311308READ8_MEMBER(lethal_state::guns_r)
312309{
313310   switch (offset)
r241894r241895
356353   AM_RANGE(0x40d9, 0x40d9) AM_READ_PORT("INPUTS")
357354   AM_RANGE(0x40db, 0x40db) AM_READ(gunsaux_r)     // top X bit of guns
358355   AM_RANGE(0x40dc, 0x40dc) AM_WRITE(le_bankswitch_w)
359   AM_RANGE(0x47fe, 0x47ff) AM_WRITE(le_bgcolor_w)     // BG color
360   AM_RANGE(0x4800, 0x7fff) AM_DEVICE("bank4800", address_map_bank_device, amap8)
356   AM_RANGE(0x4000, 0x43ff) AM_UNMAP // first 0x400 bytes of palette RAM are inaccessible
357   AM_RANGE(0x4000, 0x7fff) AM_DEVICE("bank4000", address_map_bank_device, amap8)
361358   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x38000)
362359ADDRESS_MAP_END
363360
364static ADDRESS_MAP_START( bank4800_map, AS_PROGRAM, 8, lethal_state )
365   AM_RANGE(0x0040, 0x004f) AM_DEVREADWRITE("k053244", k05324x_device, k053244_r, k053244_w)
366   AM_RANGE(0x0080, 0x009f) AM_DEVREADWRITE("k054000", k054000_device, read, write)
367   AM_RANGE(0x00c6, 0x00c6) AM_WRITE(sound_cmd_w)
368   AM_RANGE(0x00c7, 0x00c7) AM_WRITE(sound_irq_w)
369   AM_RANGE(0x00ca, 0x00ca) AM_READ(sound_status_r)
370   AM_RANGE(0x0800, 0x17ff) AM_MASK(0x07ff) AM_DEVREADWRITE("k053244", k05324x_device, k053245_r, k053245_w)
371   AM_RANGE(0x1800, 0x1fff) AM_DEVREADWRITE("k056832", k056832_device, ram_code_lo_r, ram_code_lo_w)
372   AM_RANGE(0x2000, 0x27ff) AM_DEVREADWRITE("k056832", k056832_device, ram_code_hi_r, ram_code_hi_w)
373   AM_RANGE(0x2800, 0x2fff) AM_DEVREADWRITE("k056832", k056832_device, ram_attr_lo_r, ram_attr_lo_w)
374   AM_RANGE(0x3000, 0x37ff) AM_DEVREADWRITE("k056832", k056832_device, ram_attr_hi_r, ram_attr_hi_w)
375   AM_RANGE(0x3800, 0x7001) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // 2 extra bytes for the BG color
361static ADDRESS_MAP_START( bank4000_map, AS_PROGRAM, 8, lethal_state )
362    // VRD = 0 or 1, CBNK = 0
363   AM_RANGE(0x0840, 0x084f) AM_MIRROR(0x8000) AM_DEVREADWRITE("k053244", k05324x_device, k053244_r, k053244_w)
364   AM_RANGE(0x0880, 0x089f) AM_MIRROR(0x8000) AM_DEVREADWRITE("k054000", k054000_device, read, write)
365   AM_RANGE(0x08c6, 0x08c6) AM_MIRROR(0x8000) AM_WRITE(sound_cmd_w)
366   AM_RANGE(0x08c7, 0x08c7) AM_MIRROR(0x8000) AM_WRITE(sound_irq_w)
367   AM_RANGE(0x08ca, 0x08ca) AM_MIRROR(0x8000) AM_READ(sound_status_r)
368   AM_RANGE(0x1000, 0x17ff) AM_MIRROR(0x8000) AM_DEVREADWRITE("k053244", k05324x_device, k053245_r, k053245_w)
369
370   // VRD = 0, CBNK = 0
371   AM_RANGE(0x2000, 0x27ff) AM_DEVREADWRITE("k056832", k056832_device, ram_code_lo_r, ram_code_lo_w)
372   AM_RANGE(0x2800, 0x2fff) AM_DEVREADWRITE("k056832", k056832_device, ram_code_hi_r, ram_code_hi_w)
373   AM_RANGE(0x3000, 0x37ff) AM_DEVREADWRITE("k056832", k056832_device, ram_attr_lo_r, ram_attr_lo_w)
374   AM_RANGE(0x3800, 0x3fff) AM_DEVREADWRITE("k056832", k056832_device, ram_attr_hi_r, ram_attr_hi_w)
375
376   // VRD = 1, CBNK = 0 or 1
377   AM_RANGE(0xa000, 0xbfff) AM_MIRROR(0x4000) AM_UNMAP // AM_DEVREAD("k056832", k056832_device, rom_byte_r)
378
379   // CBNK = 1; partially overlaid when VRD = 1
380   AM_RANGE(0x4000, 0x7fff) AM_MIRROR(0x8000) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
376381ADDRESS_MAP_END
377382
378383static ADDRESS_MAP_START( le_sound, AS_PROGRAM, 8, lethal_state )
r241894r241895
467472   membank("bank1")->set_entry(0);
468473
469474   save_item(NAME(m_cur_control2));
475   save_item(NAME(m_layer_colorbase));
470476   save_item(NAME(m_sprite_colorbase));
471   save_item(NAME(m_layer_colorbase));
477   save_item(NAME(m_back_colorbase));
472478}
473479
474480void lethal_state::machine_reset()
r241894r241895
477483      m_layer_colorbase[i] = 0;
478484
479485   m_sprite_colorbase = 0;
486   m_back_colorbase = 0;
480487   m_cur_control2 = 0;
481   m_bank4800->set_bank(0);
488   m_bank4000->set_bank(0);
482489}
483490
484491static MACHINE_CONFIG_START( lethalen, lethal_state )
r241894r241895
491498   MCFG_CPU_ADD("soundcpu", Z80, MAIN_CLOCK/4)  /* verified on pcb */
492499   MCFG_CPU_PROGRAM_MAP(le_sound)
493500
494   MCFG_DEVICE_ADD("bank4800", ADDRESS_MAP_BANK, 0)
495   MCFG_DEVICE_PROGRAM_MAP(bank4800_map)
501   MCFG_DEVICE_ADD("bank4000", ADDRESS_MAP_BANK, 0)
502   MCFG_DEVICE_PROGRAM_MAP(bank4000_map)
496503   MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG)
497504   MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
498   MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(15)
499   MCFG_ADDRESS_MAP_BANK_STRIDE(0x3800)
505   MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(16)
506   MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000)
500507
501508   MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom")
502509
r241894r241895
511518   MCFG_SCREEN_UPDATE_DRIVER(lethal_state, screen_update_lethalen)
512519   MCFG_SCREEN_PALETTE("palette")
513520
514   MCFG_PALETTE_ADD("palette", 7168+1)
521   MCFG_PALETTE_ADD("palette", 8192)
515522   MCFG_PALETTE_ENABLE_SHADOWS()
516523   MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
517524
trunk/src/mame/includes/lethal.h
r241894r241895
1818      : driver_device(mconfig, type, tag),
1919      m_maincpu(*this, "maincpu"),
2020      m_soundcpu(*this, "soundcpu"),
21      m_bank4800(*this, "bank4800"),
21      m_bank4000(*this, "bank4000"),
2222      m_k056832(*this, "k056832"),
2323      m_k053244(*this, "k053244"),
2424      m_palette(*this, "palette") { }
r241894r241895
2626   /* video-related */
2727   int        m_layer_colorbase[4];
2828   int        m_sprite_colorbase;
29   int        m_back_colorbase;
2930
3031   /* misc */
3132   UINT8      m_cur_control2;
r241894r241895
3334   /* devices */
3435   required_device<cpu_device> m_maincpu;
3536   required_device<cpu_device> m_soundcpu;
36   required_device<address_map_bank_device> m_bank4800;
37   required_device<address_map_bank_device> m_bank4000;
3738   required_device<k056832_device> m_k056832;
3839   required_device<k05324x_device> m_k053244;
3940   required_device<palette_device> m_palette;
r241894r241895
4344   DECLARE_WRITE8_MEMBER(sound_irq_w);
4445   DECLARE_READ8_MEMBER(sound_status_r);
4546   DECLARE_WRITE8_MEMBER(le_bankswitch_w);
46   DECLARE_WRITE8_MEMBER(le_bgcolor_w);
4747   DECLARE_READ8_MEMBER(guns_r);
4848   DECLARE_READ8_MEMBER(gunsaux_r);
4949   DECLARE_WRITE8_MEMBER(lethalen_palette_control);
trunk/src/mame/video/lethal.c
r241894r241895
1414{
1515   int pri = (*color & 0xfff0);
1616   *color = *color & 0x000f;
17   *color += 0x400 / 64; // colourbase?
17   *color += m_sprite_colorbase;
1818
1919   /* this isn't ideal.. shouldn't need to hardcode it? not 100% sure about it anyway*/
2020   if (pri == 0x10)
r241894r241895
6565      m_k056832->set_layer_offs(2, 192, 0);
6666      m_k056832->set_layer_offs(3, 194, 0);
6767   }
68
69   m_layer_colorbase[0] = 0x00;
70   m_layer_colorbase[1] = 0x40;
71   m_layer_colorbase[2] = 0x80;
72   m_layer_colorbase[3] = 0xc0;
7368}
7469
7570WRITE8_MEMBER(lethal_state::lethalen_palette_control)
r241894r241895
7772   switch (offset)
7873   {
7974      case 0: // 40c8 - PCU1 from schematics
80         m_layer_colorbase[0] = ((data & 0x7) - 1) * 0x40;
81         m_layer_colorbase[1] = (((data >> 4) & 0x7) - 1) * 0x40;
75         m_layer_colorbase[0] = (data & 0x7) * 1024 / 16;
76         m_layer_colorbase[1] = ((data >> 4) & 0x7) * 1024 / 16;
8277         m_k056832->mark_plane_dirty( 0);
8378         m_k056832->mark_plane_dirty( 1);
8479         break;
8580
8681      case 4: // 40cc - PCU2 from schematics
87         m_layer_colorbase[2] = ((data & 0x7) - 1) * 0x40;
88         m_layer_colorbase[3] = (((data >> 4) & 0x7) - 1) * 0x40;
82         m_layer_colorbase[2] = (data & 0x7) * 1024 / 16;
83         m_layer_colorbase[3] = ((data >> 4) & 0x7) * 1024 / 16;
8984         m_k056832->mark_plane_dirty( 2);
9085         m_k056832->mark_plane_dirty( 3);
9186         break;
9287
9388      case 8: // 40d0 - PCU3 from schematics
94         m_sprite_colorbase = ((data & 0x7) - 1) * 0x40;
89         m_sprite_colorbase = (data & 0x7) * 1024 / 64;
90         m_back_colorbase = ((data >> 4) & 0x7) * 1024 + 1023;
9591         break;
9692   }
9793}
9894
9995UINT32 lethal_state::screen_update_lethalen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
10096{
101   bitmap.fill(7168, cliprect);
97   bitmap.fill(m_back_colorbase, cliprect);
10298   screen.priority().fill(0, cliprect);
10399
104100   m_k056832->tilemap_draw(screen, bitmap, cliprect, 3, K056832_DRAW_FLAG_MIRROR, 1);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team