📄 taitof2.c
字号:
/***************************************************************************
Taito F2 System
The Taito F2 system is a fairly flexible hardware platform. It supports 4
separate layers of graphics - one 64x64 tiled scrolling background plane
of 8x8 tiles, a similar foreground plane, a sprite plane capable of handling
all the video chores by itself (used in e.g. Super Space Invaders) and a text
plane which may or may not scroll. The text plane has 8x8 characters which are
generated in RAM.
Sound is handled by a Z80 with a YM2610 connected to it.
The memory map for each of the games is similar but not identical.
Memory map for Liquid Kids
CPU 1 : 68000, uses irqs 5 & 6. One of the IRQs just sets a flag which is
checked in the other IRQ routine. Could be timed to vblank...
0x000000 - 0x0fffff : ROM (not all used)
0x100000 - 0x10ffff : 64k of RAM
0x200000 - 0x201fff : palette RAM, 4096 total colors
0x300000 - 0x30000f : input ports and dipswitches (writes may be IRQ acknowledge)
0x320000 - 0x320003 : communication with sound CPU
0x800000 - 0x803fff : 64x64 background layer
0x804000 - 0x805fff : 64x64 text layer
0x806000 - 0x807fff : 256 (512?) character generator RAM
0x808000 - 0x80bfff : 64x64 foreground layer
0x80c000 - 0x80ffff : unused?
0x820000 - 0x820005 : x scroll for 3 layers (3rd is unknown)
0x820006 - 0x82000b : y scroll for 3 layers (3rd is unknown)
0x82000c - 0x82000f : unknown (leds?)
0x900000 - 0x90ffff : 64k of sprite RAM
0xb00002 - 0xb00002 : watchdog?
TODO:
* There are some occasional sprite glitches - IRQ timing issue?
* Dipswitches are wrong
* No high score save yet
* Does Growl bankswitch the sprites? $4000 total, but the sprite list
only contains tile numbers up to $1fff
F2 Game List
? Final Bout (unknown)
. Mega Blade (3)
. http://www.taito.co.jp/his/A_HIS/HTM/QUI_TORI.HTM (4)
. Liquid Kids (7)
. Super Space Invaders / Majestic 12 (8)
. Gun Frontier (9)
. Growl / Runark (10)
. Hat Trick Pro (11)
. Mahjong Quest (12)
. http://www.taito.co.jp/his/A_HIS/HTM/YOUYU.HTM (13)
. http://www.taito.co.jp/his/A_HIS/HTM/KOSHIEN.HTM (14)
. Ninja Kids (15)
. http://www.taito.co.jp/his/A_HIS/HTM/Q_QUEST.HTM (no number)
. Metal Black (no number)
. http://www.taito.co.jp/his/A_HIS/HTM/QUI_TIK.HTM (no number)
? Dinorex (no number)
? Pulirula (no number)
***************************************************************************/
#include "driver.h"
#include "M68000/M68000.h"
#include "vidhrdw/generic.h"
extern unsigned char *taitof2_scrollx;
extern unsigned char *taitof2_scrolly;
extern unsigned char *f2_backgroundram;
extern int f2_backgroundram_size;
extern unsigned char *f2_foregroundram;
extern int f2_foregroundram_size;
extern unsigned char *f2_textram;
extern int f2_textram_size;
extern unsigned char *taitof2_characterram;
extern int f2_characterram_size;
extern int f2_paletteram_size;
int taitof2_vh_start (void);
void taitof2_vh_stop (void);
int taitof2_characterram_r (int offset);
void taitof2_characterram_w (int offset,int data);
int taitof2_text_r (int offset);
void taitof2_text_w (int offset,int data);
int taitof2_background_r (int offset);
void taitof2_background_w (int offset,int data);
int taitof2_foreground_r (int offset);
void taitof2_foreground_w (int offset,int data);
void taitof2_spritebank_w (int offset,int data);
void taitof2_vh_screenrefresh (struct osd_bitmap *bitmap,int full_refresh);
int ssi_videoram_r (int offset);
void ssi_videoram_w (int offset,int data);
void rastan_sound_port_w (int offset,int data);
void rastan_sound_comm_w (int offset,int data);
int rastan_sound_comm_r (int offset);
void r_wr_a000(int offset,int data);
void r_wr_a001(int offset,int data);
int r_rd_a001(int offset);
void ssi_sound_w(int offset,int data);
int ssi_sound_r(int offset);
void cchip1_init_machine(void);
int cchip1_r (int offset);
void cchip1_w (int offset, int data);
static void bankswitch_w (int offset, int data)
{
unsigned char *RAM = Machine->memory_region[2];
int banknum = (data - 1) & 3;
cpu_setbank (2, &RAM [0x10000 + (banknum * 0x4000)]);
}
static int taitof2_input_r (int offset)
{
switch (offset)
{
case 0x00:
return readinputport(3); /* DSW A */
case 0x02:
return readinputport(4); /* DSW B */
case 0x04:
return readinputport(0); /* IN0 */
case 0x06:
return readinputport(1); /* IN1 */
case 0x0e:
return readinputport(2); /* IN2 */
}
return 0xff;
}
static int growl_dsw_r (int offset)
{
switch (offset)
{
case 0x00:
return readinputport(3); /* DSW A */
case 0x02:
return readinputport(4); /* DSW B */
}
return 0xff;
}
static int growl_input_r (int offset)
{
switch (offset)
{
case 0x00:
return readinputport(0); /* IN0 */
case 0x02:
return readinputport(1); /* IN1 */
case 0x04:
return readinputport(2); /* IN2 */
}
return 0xff;
}
int megab_input_r (int offset)
{
switch (offset)
{
case 0x00:
return readinputport (0);
case 0x02:
return readinputport (1);
case 0x04:
return readinputport (2);
case 0x06:
return readinputport (3);
default:
return 0xff;
}
}
void liquidk_interrupt5(int x)
{
cpu_cause_interrupt(0,MC68000_IRQ_5);
}
static int liquidk_interrupt(void)
{
timer_set(TIME_IN_CYCLES(200000-5000,0),0,liquidk_interrupt5);
return MC68000_IRQ_6;
}
void taitof2_sound_w(int offset,int data)
{
if (offset == 0)
rastan_sound_port_w (0, data & 0xff);
else if (offset == 2)
rastan_sound_comm_w (0, data & 0xff);
}
int taitof2_sound_r(int offset)
{
if (offset == 2)
return ((rastan_sound_comm_r (0) & 0xff));
else return 0;
}
static int sound_hack_r (int offs)
{
return YM2610_status_port_0_A_r (0) | 1;
}
static struct MemoryReadAddress liquidk_readmem[] =
{
{ 0x000000, 0x07ffff, MRA_ROM },
{ 0x100000, 0x10ffff, MRA_BANK1 },
{ 0x200000, 0x201fff, paletteram_word_r },
{ 0x300000, 0x30000f, taitof2_input_r },
{ 0x320000, 0x320003, taitof2_sound_r },
{ 0x800000, 0x803fff, taitof2_background_r },
{ 0x804000, 0x805fff, taitof2_text_r },
{ 0x806000, 0x806fff, taitof2_characterram_r },
{ 0x807000, 0x807fff, MRA_BANK3 },
{ 0x808000, 0x80bfff, taitof2_foreground_r },
{ 0x80c000, 0x80ffff, MRA_BANK4 },
{ 0x900000, 0x90ffff, ssi_videoram_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress liquidk_writemem[] =
{
{ 0x000000, 0x07ffff, MWA_ROM },
{ 0x100000, 0x10ffff, MWA_BANK1 },
{ 0x200000, 0x201fff, paletteram_RRRRGGGGBBBBxxxx_word_w, &paletteram, &f2_paletteram_size },
{ 0x300000, 0x300001, MWA_NOP }, /* irq ack? liquidk */
{ 0x320000, 0x320003, taitof2_sound_w },
{ 0x800000, 0x803fff, taitof2_background_w, &f2_backgroundram, &f2_backgroundram_size }, /* background layer */
{ 0x804000, 0x805fff, taitof2_text_w, &f2_textram, &f2_textram_size }, /* text layer */
{ 0x806000, 0x806fff, taitof2_characterram_w, &taitof2_characterram, &f2_characterram_size },
{ 0x807000, 0x807fff, MWA_BANK3 }, /* unused? */
{ 0x808000, 0x80bfff, taitof2_foreground_w, &f2_foregroundram, &f2_foregroundram_size }, /* foreground layer */
{ 0x80c000, 0x80ffff, MWA_BANK4 }, /* unused? */
{ 0x820000, 0x820005, MWA_BANK5, &taitof2_scrollx },
{ 0x820006, 0x82000b, MWA_BANK6, &taitof2_scrolly },
{ 0x900000, 0x90ffff, ssi_videoram_w, &videoram, &videoram_size },
{ 0xb00002, 0xb00003, MWA_NOP }, /* watchdog ?? liquidk */
{ -1 } /* end of table */
};
static struct MemoryReadAddress growl_readmem[] =
{
{ 0x000000, 0x0fffff, MRA_ROM },
{ 0x100000, 0x10ffff, MRA_BANK1 },
{ 0x200000, 0x201fff, paletteram_word_r },
{ 0x300000, 0x30000f, growl_dsw_r },
{ 0x320000, 0x32000f, growl_input_r },
{ 0x400000, 0x400003, ssi_sound_r },
{ 0x800000, 0x803fff, taitof2_background_r },
{ 0x804000, 0x805fff, taitof2_text_r },
{ 0x806000, 0x806fff, taitof2_characterram_r },
{ 0x807000, 0x807fff, MRA_BANK3 },
{ 0x808000, 0x80bfff, taitof2_foreground_r },
{ 0x80c000, 0x80ffff, MRA_BANK4 },
{ 0x900000, 0x90ffff, ssi_videoram_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress growl_writemem[] =
{
{ 0x000000, 0x0fffff, MWA_ROM },
{ 0x100000, 0x10ffff, MWA_BANK1 },
{ 0x200000, 0x201fff, paletteram_RRRRGGGGBBBBxxxx_word_w, &paletteram, &f2_paletteram_size },
{ 0x340000, 0x340001, MWA_NOP }, /* irq ack? growl */
{ 0x400000, 0x400003, ssi_sound_w },
{ 0x500000, 0x50000f, taitof2_spritebank_w },
{ 0x800000, 0x803fff, taitof2_background_w, &f2_backgroundram, &f2_backgroundram_size }, /* background layer */
{ 0x804000, 0x805fff, taitof2_text_w, &f2_textram, &f2_textram_size }, /* text layer */
{ 0x806000, 0x806fff, taitof2_characterram_w, &taitof2_characterram, &f2_characterram_size },
{ 0x807000, 0x807fff, MWA_BANK3 }, /* unused? */
{ 0x808000, 0x80bfff, taitof2_foreground_w, &f2_foregroundram, &f2_foregroundram_size }, /* foreground layer */
{ 0x80c000, 0x80ffff, MWA_BANK4 }, /* unused? */
{ 0x820000, 0x820005, MWA_BANK5, &taitof2_scrollx },
{ 0x820006, 0x82000b, MWA_BANK6, &taitof2_scrolly },
{ 0x900000, 0x90ffff, ssi_videoram_w, &videoram, &videoram_size },
{ 0xb00000, 0xb00001, MWA_NOP }, /* watchdog ?? growl */
{ -1 } /* end of table */
};
static struct MemoryReadAddress megab_readmem[] =
{
{ 0x000000, 0x0fffff, MRA_ROM },
{ 0x100000, 0x100003, ssi_sound_r },
{ 0x120000, 0x12000f, megab_input_r },
{ 0x180000, 0x180fff, cchip1_r },
{ 0x200000, 0x20ffff, MRA_BANK1 },
{ 0x300000, 0x301fff, paletteram_word_r },
{ 0x600000, 0x603fff, taitof2_background_r },
{ 0x604000, 0x605fff, taitof2_text_r },
{ 0x606000, 0x606fff, taitof2_characterram_r },
{ 0x607000, 0x607fff, MRA_BANK3 },
{ 0x608000, 0x60bfff, taitof2_foreground_r },
{ 0x60c000, 0x60ffff, MRA_BANK4 },
{ 0x610000, 0x61ffff, MRA_BANK7 }, /* unused? */
{ 0x800000, 0x80ffff, ssi_videoram_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress megab_writemem[] =
{
{ 0x000000, 0x0fffff, MWA_ROM },
{ 0x200000, 0x20ffff, MWA_BANK1 },
{ 0x300000, 0x301fff, paletteram_RRRRGGGGBBBBxxxx_word_w, &paletteram, &f2_paletteram_size },
{ 0x100000, 0x100003, ssi_sound_w },
{ 0x120000, 0x120001, MWA_NOP }, /* irq ack? */
{ 0x180000, 0x180fff, cchip1_w },
{ 0x400000, 0x400001, MWA_NOP }, /* watchdog ?? */
{ 0x600000, 0x603fff, taitof2_background_w, &f2_backgroundram, &f2_backgroundram_size }, /* background layer */
{ 0x604000, 0x605fff, taitof2_text_w, &f2_textram, &f2_textram_size }, /* text layer */
{ 0x606000, 0x606fff, taitof2_characterram_w, &taitof2_characterram, &f2_characterram_size },
{ 0x607000, 0x607fff, MWA_BANK3 }, /* unused? */
{ 0x608000, 0x60bfff, taitof2_foreground_w, &f2_foregroundram, &f2_foregroundram_size }, /* foreground layer */
{ 0x60c000, 0x60ffff, MWA_BANK4 }, /* unused? */
{ 0x610000, 0x61ffff, MWA_BANK7 }, /* unused? */
{ 0x620000, 0x620005, MWA_BANK5, &taitof2_scrollx },
{ 0x620006, 0x62000b, MWA_BANK6, &taitof2_scrolly },
{ 0x800000, 0x80ffff, ssi_videoram_w, &videoram, &videoram_size },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x4000, 0x7fff, MRA_BANK2 },
{ 0xc000, 0xdfff, MRA_RAM },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -