📄 atarisy2.c
字号:
/***************************************************************************
Paperboy (System 2) Memory Map
------------------------------
PAPERBOY T11 MEMORY MAP
Function Address R/W DATA
-------------------------------------------------------------
Program RAM 0000-0FFF R/W D0-D15
Motion Object Color RAM 1000-107F W D0-D15 (RGBZ)
Alphanumeric Color RAM 1080-10BF W D0-D15 (RGBZ)
Playfield Color RAM 1100-11FF W D0-D15 (RGBZ)
Program Page 0 Address 1400 W D10-D15
A/D Converter Output R D0-D7
Program Page 1 Address 1402 W D10-D15
A/D Converter Output R D0-D7
A/D Converter Start Strobe 1480 W xx
Video Memory Page Select (VMMU) 1500 W D12-D13
IRQ0 Clear 1580 W xx
6502 Reset 15A0 W xx
IRQ2 Clear 15C0 W xx
IRQ3 Clear 15E0 W xx
IRQ0 Enable 6502 RD (Active High) 1600 W D0
IRQ1 Enable 6502 WT (Active High) W D1
IRQ2 Enable 32V (Active High) W D2
IRQ3 Enable VBLANK (Active High) W D3
Communications Port Write 1680 W D0-D7
Horizontal Scroll 1700 W D6-D15
Playfield Bank 0 W D0-D3
Vertical Scroll 1780 W D6-D14
Playfield Bank 1 W D0-D3
Watchdog 1800 W xx
SW 6 (Active Low) 1800 R D0
SW 5 (Active Low) R D1
SW 4 (Active Low) R D2
SW 3 (Active Low) R D3
6502 Comm Flag (Active High) R D4
T-11 Comm Flag (Active High) R D5
SW 2 (Active Low) R D6
SW 1 (Active Low) R D7
Self-Test (Active Low) R D15
Communications Port Read 1C00 R D0-D7
Alphanumerics RAM (VMMU=0) 2000-37FE R/W D0-D15
Motion Object RAM (VMMU=0) 3800-3FFF R/W D0-D15
Playfield RAM Top (VMMU=2) 2000-3FFF R/W D0-D15
Playfield RAM Bottom (VMMU=3) 2000-3FFF R/W D0-D15
Paged Program ROM (Page 0) 4000-5FFF R D0-D15
Paged Program ROM (Page 1) 6000-7FFF R D0-D15
Program ROM 8000-FFFF R D0-D15
PAPERBOY 6502 MEMORY MAP
Function Address R/W Data
---------------------------------------------------------------
Program RAM 0000-0FFF R/W D0-D7
EEROM 1000-17FF R/W D0-D7
POKEY 1 1800-180F R/W D0-D7
LETA 1810-1813 R D0-D7
POKEY 2 1830-183F R/W D0-D7
T-11 Talk (Active High) 1840 R D0
6502 Talk (Active High) R D1
TMS5220 Ready (Active High) R D2
Self-Test (Active Low) R D4
Auxiliary Coin Switch (Active Low) R D5
Left Coin Switch (Active Low) R D6
Right Coin Switch (Active Low) R D7
Music (YM-2151) 1850-1851 R/W D0-D7
Communications Port Read 1860 R D0-D7
TMS5220 Data 1870 W D0-D7
TMS5220 Write Strobe 1872-1873 W
Communications Port Write 1874 W D0-D7
Right Coin Counter (Active High) 1876 W D0
Left Coin Counter (Active High) W D1
IRQ Clear 1878 W
Yamaha Mixer 187A W D0-D2
POKEY Mixer W D3-D4
TMS5220 Mixer W D5-D7
LED1 187C W D2
LED2 W D3
LETA Resolution W D4
TMS5220 Squeak W D5
Sound Enable (Active High) 187E W D0
Program ROM (48K bytes) 4000-FFFF R D0-D7
****************************************************************************/
#include "driver.h"
#include "machine/atarigen.h"
#include "vidhrdw/generic.h"
#include "sndhrdw/pokey.h"
#include "sndhrdw/5220intf.h"
#include "sndhrdw/2151intf.h"
extern unsigned char *atarisys2_interrupt_enable;
extern unsigned char *atarisys2_bankselect;
extern unsigned char *atarisys2_slapstic_base;
int atarisys2_slapstic_r (int offset);
int atarisys2_adc_r (int offset);
int atarisys2_switch_r (int offset);
int atarisys2_videoram_r (int offset);
int atarisys2_leta_r (int offset);
int atarisys2_6502_switch_r (int offset);
void atarisys2_slapstic_w (int offset, int data);
void atarisys2_watchdog_w (int offset, int data);
void atarisys2_bankselect_w (int offset, int data);
void atarisys2_adc_strobe_w (int offset, int data);
void atarisys2_vmmu_w (int offset, int data);
void atarisys2_interrupt_ack_w (int offset, int data);
void atarisys2_vscroll_w (int offset, int data);
void atarisys2_hscroll_w (int offset, int data);
void atarisys2_videoram_w (int offset, int data);
void atarisys2_paletteram_w (int offset, int data);
void atarisys2_tms5220_w (int offset, int data);
void atarisys2_tms5220_strobe_w (int offset, int data);
void atarisys2_mixer_w (int offset, int data);
void atarisys2_sound_enable_w (int offset, int data);
void atarisys2_6502_switch_w (int offset, int data);
int atarisys2_interrupt (void);
int atarisys2_sound_interrupt (void);
void paperboy_init_machine (void);
void apb_init_machine (void);
void a720_init_machine (void);
void ssprint_init_machine (void);
void csprint_init_machine (void);
int paperboy_vh_start (void);
int apb_vh_start (void);
int a720_vh_start (void);
int ssprint_vh_start (void);
int csprint_vh_start (void);
void atarisys2_vh_stop (void);
void atarisys2_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
/*************************************
*
* Main CPU memory handlers
*
*************************************/
static struct MemoryReadAddress atarisys2_readmem[] =
{
{ 0x0000, 0x0fff, MRA_RAM },
{ 0x1000, 0x11ff, paletteram_word_r },
{ 0x1400, 0x1403, atarisys2_adc_r },
{ 0x1800, 0x1801, atarisys2_switch_r },
{ 0x1c00, 0x1c01, atarigen_sound_r },
{ 0x2000, 0x3fff, atarisys2_videoram_r },
{ 0x4000, 0x5fff, MRA_BANK1 },
{ 0x6000, 0x7fff, MRA_BANK2 },
{ 0x8000, 0x81ff, atarisys2_slapstic_r },
{ 0x8200, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress atarisys2_writemem[] =
{
{ 0x0000, 0x0fff, MWA_RAM },
{ 0x1000, 0x11ff, atarisys2_paletteram_w, &paletteram },
{ 0x1400, 0x1403, atarisys2_bankselect_w, &atarisys2_bankselect },
{ 0x1480, 0x148f, atarisys2_adc_strobe_w },
{ 0x1500, 0x1501, atarisys2_vmmu_w },
{ 0x1580, 0x15ff, atarisys2_interrupt_ack_w },
{ 0x1600, 0x1601, MWA_RAM, &atarisys2_interrupt_enable },
{ 0x1680, 0x1681, atarigen_sound_w },
{ 0x1700, 0x1701, atarisys2_hscroll_w, &atarigen_hscroll },
{ 0x1780, 0x1781, atarisys2_vscroll_w, &atarigen_vscroll },
{ 0x1800, 0x1801, atarisys2_watchdog_w },
{ 0x2000, 0x3fff, atarisys2_videoram_w },
{ 0x4000, 0x7fff, MWA_ROM },
{ 0x8000, 0x81ff, atarisys2_slapstic_w, &atarisys2_slapstic_base },
{ 0x8200, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
/*************************************
*
* Sound CPU memory handlers
*
*************************************/
static void sound_eeprom_w (int offset, int data)
{
Machine->memory_region[2][offset + 0x1000] = data;
/* {
static FILE *f;
if (!f) f = fopen ("eeprom.log", "w");
fprintf (f, "Write %02X @ %04X (PC = %04X)\n", data, offset + 0x1000, cpu_getpc ());
}*/
}
static struct MemoryReadAddress atarisys2_sound_readmem[] =
{
{ 0x0000, 0x0fff, MRA_RAM },
{ 0x1000, 0x17ff, MRA_RAM, &atarigen_eeprom, &atarigen_eeprom_size }, /* EEPROM */
{ 0x1800, 0x180f, pokey1_r },
{ 0x1810, 0x1813, atarisys2_leta_r },
{ 0x1830, 0x183f, pokey2_r },
{ 0x1840, 0x1840, atarisys2_6502_switch_r },
{ 0x1850, 0x1851, YM2151_status_port_0_r },
{ 0x1860, 0x1860, atarigen_6502_sound_r },
{ 0x4000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress atarisys2_sound_writemem[] =
{
{ 0x0000, 0x0fff, MWA_RAM },
{ 0x1000, 0x17ff, sound_eeprom_w }, /* EEPROM */
{ 0x1800, 0x180f, pokey1_w },
{ 0x1830, 0x183f, pokey2_w },
{ 0x1850, 0x1850, YM2151_register_port_0_w },
{ 0x1851, 0x1851, YM2151_data_port_0_w },
{ 0x1870, 0x1870, atarisys2_tms5220_w },
{ 0x1872, 0x1873, atarisys2_tms5220_strobe_w },
{ 0x1874, 0x1874, atarigen_6502_sound_w },
{ 0x1876, 0x1876, MWA_NOP }, /* coin counters */
{ 0x1878, 0x1878, MWA_NOP }, /* IRQ clear */
{ 0x187a, 0x187a, atarisys2_mixer_w },
{ 0x187c, 0x187c, atarisys2_6502_switch_w },
{ 0x187e, 0x187e, atarisys2_sound_enable_w },
{ 0x4000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
/*************************************
*
* Port definitions
*
*************************************/
INPUT_PORTS_START( paperboy_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_START /* IN1 */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_BITX( 0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Self Test", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x80, "Off")
PORT_DIPSETTING( 0x00, "On")
PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC0 */
PORT_ANALOG ( 0xff, 0x80, IPT_AD_STICK_X | IPF_PLAYER1, 100, 0, 0x10, 0xf0 )
PORT_START /* ADC1 */
PORT_ANALOG ( 0xff, 0x80, IPT_AD_STICK_Y | IPF_PLAYER1, 100, 0, 0x10, 0xf0 )
PORT_START /* ADC2 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC3 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA0 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA1 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA2 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA3 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
INPUT_PORTS_START( apb_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START /* IN1 */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_BITX( 0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Self Test", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x80, "Off")
PORT_DIPSETTING( 0x00, "On")
PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC0 */
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
PORT_BIT( 0x7f, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START /* ADC1 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC2 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC3 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA0 */
PORT_ANALOG ( 0xff, 0x80, IPT_AD_STICK_X | IPF_PLAYER1, 4, 8, 0x40, 0x3f )
PORT_START /* LETA1 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA2 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* LETA3 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
INPUT_PORTS_START( a720_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_START /* IN1 */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 )
PORT_START /* IN2 */
PORT_BITX( 0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Self Test", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x80, "Off")
PORT_DIPSETTING( 0x00, "On")
PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC0 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC1 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* ADC2 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -