📄 taito.c
字号:
/***************************************************************************
Taito games memory map (preliminary)
MAIN CPU:
0000-7fff ROM (6000-7fff banked in two banks, controlled by bit 7 of d50e)
8000-87ff RAM
9000-bfff Character generator RAM
c400-c7ff Video RAM: front playfield
c800-cbff Video RAM: middle playfield
cc00-cfff Video RAM: back playfield
d100-d17f Sprites
d200-d27f Palette (64 pairs: xxxxxxxR RRGGGBBB. bits are inverted, i.e. 0x01ff = black)
e000-efff ROM (on the protection board with the 68705)
read:
8800 68705 data read
8801 68705 status read
bit 0 = the 68705 has read data from the Z80
bit 1 = the 68705 has written data for the Z80
d400-d403 hardware collision detection registers
d400 ?
d401 ?
d402 ?
d403 bit0 = obj/pf1
bit1 = obj/pf2
bit2 = obj/pf3
bit3 = pf1/pf2
bit4 = pf1/pf3
bit5 = pf2/pf3
bit6 = nc
bit7 = nc
d404 returns contents of graphic ROM, pointed by d509-d50a
d408 IN0
bit 5 = jump player 1
bit 4 = fire player 1
bit 3 = up player 1
bit 2 = down player 1
bit 1 = right player 1
bit 0 = left player 1
d409 IN1
bit 5 = jump player 2 (COCKTAIL only)
bit 4 = fire player 2 (COCKTAIL only)
bit 3 = up player 2 (COCKTAIL only)
bit 2 = down player 2 (COCKTAIL only)
bit 1 = right player 2 (COCKTAIL only)
bit 0 = left player 2 (COCKTAIL only)
d40a DSW1
elevator:
bit 7 = cocktail / upright (0 = upright)
bit 6 = flip screen
bit 5 = ?
bit 3-4 = lives
bit 2 = free play
bit 0-1 = bonus
jungle:
bit 7 = cocktail / upright (0 = upright)
bit 6 = flip screen
bit 5 = RAM check
bit 3-4 = lives
bit 2 = ?
bit 0-1 = finish bonus
d40b IN2 - can come from a ROM or PAL chip
bit 7 = start 2
bit 6 = start 1
bit 5 = coin 1
bit 4 = coin 2 (except Alpine Ski Set 1, where it is used for protection)
bit 0-3 = protection (Alpine Ski); written at d50f (Set 1) or d50e (Set 2)
d40c COIN
bit 5 = tilt
bit 4 = coin
d40d another input port (use in Front Line for player 2 dial)
d40f 8910 #0 read
port A DSW2
port B DSW3
write
8800 68705 data write
d000-d01f front playfield column scroll
d020-d03f middle playfield column scroll
d040-d05f back playfield column scroll
d300 playfield priority control
bits 0-3 go to A4-A7 of a 256x4 PROM
bit 4 selects D0/D1 or D2/D3 of the PROM
bit 5-7 n.c.
A0-A3 of the PROM is fed with a mask of the inactive planes
(i.e. all-zero) in the order sprites-front-middle-back
the 2-bit code which comes out from the PROM selects the plane
to display.
d40e 8910 #0 control
d40f 8910 #0 write
d500 front playfield horizontal scroll
d501 front playfield vertical scroll
d502 middle playfield horizontal scroll
d503 middle playfield vertical scroll
d504 back playfield horizontal scroll
d505 back playfield vertical scroll
d506 bits 0-2 = front playfield color code
bit 3 = front playfield character bank
bits 4-6 = middle playfield color code
bit 7 = middle playfield character bank
d507 bits 0-2 = back playfield color code
bit 3 = back playfield character bank
bits 4-5 = sprite color bank (1 bank = 2 color codes)
d508 clear hardware collision detection registers
d509-d50a pointer to graphic ROM to read from d404
d50b command for the audio CPU
d50d watchdog reset
d50e bit 7 = ROM bank selector
bit 0-4 = protection write (Alpine Ski); result is read from d40b bits 0-3
d50f can go to a ROM or PAL; the result is read from d40b
==> used in Alpine Ski (Set 1) for protection
d600 bit 0 horizontal screen flip
bit 1 vertical screen flip
bit 2 ? sprite related, called OBJEX. It looks like there are 256
bytes of sprite RAM, but only 128 can be acessed by the video
hardware at a time. This select the high or low bank. The CPU
can access all the memory linearly. I don't know if this is
ever used.
bit 3 n.c.
bit 4 front playfield enable
bit 5 middle playfield enable
bit 6 back playfield enable
bit 7 sprites enable
SOUND CPU:
0000-3fff ROM (none of the games has this fully populated)
4000-43ff RAM
e000-efff space for diagnostics ROM?
read:
5000 command from CPU board
8101 ?
write:
4800 8910 #1 control
4801 8910 #1 write
PORT A digital sound out
4802 8910 #2 control
4803 8910 #2 write
4804 8910 #3 control
4805 8910 #3 write
port B bit 0 SOUND CPU NMI disable
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "Z80/Z80.h"
extern unsigned char *alpine1_protection;
extern unsigned char *alpine2_protection;
void taito_init_machine(void);
void alpine1_protection_w(int offset,int data);
void taito_bankswitch_w(int offset,int data);
int taito_port_2_r(int offset);
int taito_fake_data_r(int offset);
int taito_fake_status_r(int offset);
void taito_fake_data_w(int offset,int data);
int taito_mcu_data_r(int offset);
int taito_mcu_status_r(int offset);
void taito_mcu_data_w(int offset,int data);
int taito_68705_portA_r(int offset);
int taito_68705_portB_r(int offset);
int taito_68705_portC_r(int offset);
void taito_68705_portA_w(int offset,int data);
void taito_68705_portB_w(int offset,int data);
extern unsigned char *taito_videoram2,*taito_videoram3;
extern unsigned char *taito_characterram;
extern unsigned char *taito_scrollx1,*taito_scrollx2,*taito_scrollx3;
extern unsigned char *taito_scrolly1,*taito_scrolly2,*taito_scrolly3;
extern unsigned char *taito_colscrolly1,*taito_colscrolly2,*taito_colscrolly3;
extern unsigned char *taito_gfxpointer;
extern unsigned char *taito_colorbank,*taito_video_priority;
void taito_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
int taito_gfxrom_r(int offset);
void taito_videoram2_w(int offset,int data);
void taito_videoram3_w(int offset,int data);
void taito_paletteram_w(int offset,int data);
void taito_colorbank_w(int offset,int data);
void taito_videoenable_w(int offset,int data);
void taito_characterram_w(int offset,int data);
int taito_collision_detection_r(int offset);
void taito_collision_detection_w(int offset,int data);
int taito_vh_start(void);
void taito_vh_stop(void);
void taito_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static int sndnmi_disable = 1;
static void taito_sndnmi_msk(int offset,int data)
{
sndnmi_disable = data & 0x01;
}
static void taito_soundcommand_w(int offset,int data)
{
soundlatch_w(offset,data);
if (!sndnmi_disable) cpu_cause_interrupt(1,Z80_NMI_INT);
}
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x5fff, MRA_ROM },
{ 0x6000, 0x7fff, MRA_BANK1 },
{ 0x8000, 0x87ff, MRA_RAM },
{ 0x8800, 0x8800, taito_fake_data_r },
{ 0x8801, 0x8801, taito_fake_status_r },
{ 0xc400, 0xcfff, MRA_RAM },
{ 0xd100, 0xd17f, MRA_RAM },
{ 0xd400, 0xd403, taito_collision_detection_r },
{ 0xd404, 0xd404, taito_gfxrom_r },
{ 0xd408, 0xd408, input_port_0_r }, /* IN0 */
{ 0xd409, 0xd409, input_port_1_r }, /* IN1 */
{ 0xd40a, 0xd40a, input_port_5_r }, /* DSW1 */
{ 0xd40b, 0xd40b, taito_port_2_r }, /* IN2 */
{ 0xd40c, 0xd40c, input_port_3_r }, /* Service */
{ 0xd40d, 0xd40d, input_port_4_r },
{ 0xd40f, 0xd40f, AY8910_read_port_0_r }, /* DSW2 and DSW3 */
{ 0xe000, 0xefff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x7fff, MWA_ROM },
{ 0x8000, 0x87ff, MWA_RAM },
{ 0x8800, 0x8800, taito_fake_data_w },
{ 0x9000, 0xbfff, taito_characterram_w, &taito_characterram },
{ 0xc400, 0xc7ff, videoram_w, &videoram, &videoram_size },
{ 0xc800, 0xcbff, taito_videoram2_w, &taito_videoram2 },
{ 0xcc00, 0xcfff, taito_videoram3_w, &taito_videoram3 },
{ 0xd000, 0xd01f, MWA_RAM, &taito_colscrolly1 },
{ 0xd020, 0xd03f, MWA_RAM, &taito_colscrolly2 },
{ 0xd040, 0xd05f, MWA_RAM, &taito_colscrolly3 },
{ 0xd100, 0xd17f, MWA_RAM, &spriteram, &spriteram_size },
{ 0xd200, 0xd27f, taito_paletteram_w, &paletteram },
{ 0xd300, 0xd300, MWA_RAM, &taito_video_priority },
{ 0xd40e, 0xd40e, AY8910_control_port_0_w },
{ 0xd40f, 0xd40f, AY8910_write_port_0_w },
{ 0xd500, 0xd500, MWA_RAM, &taito_scrollx1 },
{ 0xd501, 0xd501, MWA_RAM, &taito_scrolly1 },
{ 0xd502, 0xd502, MWA_RAM, &taito_scrollx2 },
{ 0xd503, 0xd503, MWA_RAM, &taito_scrolly2 },
{ 0xd504, 0xd504, MWA_RAM, &taito_scrollx3 },
{ 0xd505, 0xd505, MWA_RAM, &taito_scrolly3 },
{ 0xd506, 0xd507, taito_colorbank_w, &taito_colorbank },
{ 0xd508, 0xd508, taito_collision_detection_w },
{ 0xd509, 0xd50a, MWA_RAM, &taito_gfxpointer },
{ 0xd50b, 0xd50b, taito_soundcommand_w },
{ 0xd50d, 0xd50d, watchdog_reset_w },
{ 0xd50e, 0xd50e, taito_bankswitch_w, &alpine2_protection },
{ 0xd50f, 0xd50f, alpine1_protection_w, &alpine1_protection },
{ 0xd600, 0xd600, taito_videoenable_w },
{ 0xe000, 0xefff, MWA_ROM },
{ -1 } /* end of table */
};
/* only difference is taito_fake_ replaced with taito_mcu_ */
static struct MemoryReadAddress mcu_readmem[] =
{
{ 0x0000, 0x5fff, MRA_ROM },
{ 0x6000, 0x7fff, MRA_BANK1 },
{ 0x8000, 0x87ff, MRA_RAM },
{ 0x8800, 0x8800, taito_mcu_data_r },
{ 0x8801, 0x8801, taito_mcu_status_r },
{ 0xc400, 0xcfff, MRA_RAM },
{ 0xd100, 0xd17f, MRA_RAM },
{ 0xd400, 0xd403, taito_collision_detection_r },
{ 0xd404, 0xd404, taito_gfxrom_r },
{ 0xd408, 0xd408, input_port_0_r }, /* IN0 */
{ 0xd409, 0xd409, input_port_1_r }, /* IN1 */
{ 0xd40a, 0xd40a, input_port_5_r }, /* DSW1 */
{ 0xd40b, 0xd40b, input_port_2_r }, /* IN2 */
{ 0xd40c, 0xd40c, input_port_3_r }, /* Service */
{ 0xd40d, 0xd40d, input_port_4_r },
{ 0xd40f, 0xd40f, AY8910_read_port_0_r }, /* DSW2 and DSW3 */
{ 0xe000, 0xefff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress mcu_writemem[] =
{
{ 0x0000, 0x7fff, MWA_ROM },
{ 0x8000, 0x87ff, MWA_RAM },
{ 0x8800, 0x8800, taito_mcu_data_w },
{ 0x9000, 0xbfff, taito_characterram_w, &taito_characterram },
{ 0xc400, 0xc7ff, videoram_w, &videoram, &videoram_size },
{ 0xc800, 0xcbff, taito_videoram2_w, &taito_videoram2 },
{ 0xcc00, 0xcfff, taito_videoram3_w, &taito_videoram3 },
{ 0xd000, 0xd01f, MWA_RAM, &taito_colscrolly1 },
{ 0xd020, 0xd03f, MWA_RAM, &taito_colscrolly2 },
{ 0xd040, 0xd05f, MWA_RAM, &taito_colscrolly3 },
{ 0xd100, 0xd17f, MWA_RAM, &spriteram, &spriteram_size },
{ 0xd200, 0xd27f, taito_paletteram_w, &paletteram },
{ 0xd300, 0xd300, MWA_RAM, &taito_video_priority },
{ 0xd40e, 0xd40e, AY8910_control_port_0_w },
{ 0xd40f, 0xd40f, AY8910_write_port_0_w },
{ 0xd500, 0xd500, MWA_RAM, &taito_scrollx1 },
{ 0xd501, 0xd501, MWA_RAM, &taito_scrolly1 },
{ 0xd502, 0xd502, MWA_RAM, &taito_scrollx2 },
{ 0xd503, 0xd503, MWA_RAM, &taito_scrolly2 },
{ 0xd504, 0xd504, MWA_RAM, &taito_scrollx3 },
{ 0xd505, 0xd505, MWA_RAM, &taito_scrolly3 },
{ 0xd506, 0xd507, taito_colorbank_w, &taito_colorbank },
{ 0xd508, 0xd508, taito_collision_detection_w },
{ 0xd509, 0xd50a, MWA_RAM, &taito_gfxpointer },
{ 0xd50b, 0xd50b, taito_soundcommand_w },
{ 0xd50d, 0xd50d, watchdog_reset_w },
{ 0xd50e, 0xd50e, taito_bankswitch_w },
{ 0xd600, 0xd600, taito_videoenable_w },
{ 0xe000, 0xefff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x4000, 0x43ff, MRA_RAM },
{ 0x4801, 0x4801, AY8910_read_port_1_r },
{ 0x4803, 0x4803, AY8910_read_port_2_r },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -