📄 cclimber.c
字号:
/***************************************************************************
Crazy Climber memory map (preliminary)
as described by Lionel Theunissen (lionelth@ozemail.com.au)
Crazy Kong is very similar to Crazy Climber, there is an additional ROM at
5000-5fff and RAM is at 6000-6bff. Dip switches and input connections are
different as well.
Swimmer is similar but also different (e.g. it has two CPUs and two 8910,
graphics are 3bpp instead of 2)
0000h-4fffh ;20k program ROMs. ROM11=0000h
ROM10=1000h
ROM09=2000h
ROM08=3000h
ROM07=4000h
8000h-83ffh ;1k scratchpad RAM.
8800h-88ffh ;256 bytes Bigsprite RAM.
9000h-93ffh ;1k screen RAM.
9800h-981fh ;Column smooth scroll position. Corresponds to each char
column.
9880h-989fh ;Sprite controls. 8 groups of 4 bytes:
1st byte; code/attribute.
Bits 0-5: sprite code.
Bit 6: x invert.
Bit 7: y invert.
2nd byte ;color.
Bits 0-3: colour. (palette scheme 0-15)
Bit 4: 0=charset1, 1 =charset 2.
3rd byte ;y position
4th byte ;x position
98dc bit 0 big sprite priority over sprites? (1 = less priority)
98ddh ;Bigsprite colour/attribute.
Bit 0-2: Big sprite colour.
bit 3 ??
Bit 4: x invert.
Bit 5: y invert.
98deh ;Bigsprite y position.
98dfh ;Bigsprite x position.
9c00h-9fffh ;1/2k colour RAM: Bits 0-3: colour. (palette scheme 0-15)
Bit 4: 0=charset1, 1=charset2.
Bit 5: (not used by CC)
Bit 6: x invert.
Bit 7: y invert. (not used by CC)
a000h ;RD: Player 1 controls.
Bit 0: Left up
1: Left down
2: Left left
3: Left right
4: Right up
5: Right down
6: Right left
7: Right right
a000h ;WR: Non Maskable interrupt.
Bit 0: 0=NMI disable, 1=NMI enable.
a001h ;WR: Horizontal video direction (Crazy Kong sets it to 1).
Bit 0: 0=Normal, 1=invert.
a002h ;WR: Vertical video direction (Crazy Kong sets it to 1).
Bit 0: 0=Normal, 1=invert.
a004h ;WR: Sample trigger.
Bit 0: 0=Trigger.
a800h ;RD: Player 2 controls (table model only).
Bit 0: Left up
1: Left down
2: Left left
3: Left right
4: Right up
5: Right down
6: Right left
7: Right right
a800h ;WR: Sample rate speed.
Full byte value (0-255).
b000h ;RD: DIP switches.
Bit 1,0: Number of climbers.
00=3, 01=4, 10=5, 11=6.
Bit 2: Extra climber bonus.
0=30000, 1=50000.
Bit 3: 1=Test Pattern
Bit 5,4: Coins per credit.
00=1, 01=2, 10=3 11=4.
Bit 7,6: Plays per credit.
00=1, 01=2, 10=3, 11=Freeplay.
b000h ;WR: Sample volume.
Bits 0-5: Volume (0-31).
b800h ;RD: Machine switches.
Bit 0: Coin 1.
Bit 1: Coin 2.
Bit 2: 1 Player start.
Bit 3: 2 Player start.
Bit 4: Upright/table select.
0=table, 1=upright.
I/O 8 ;AY-3-8910 Control Reg.
I/O 9 ;AY-3-8910 Data Write Reg.
I/O C ;AY-3-8910 Data Read Reg.
Port A of the 8910 selects the digital sample to play
Changes:
25 Jan 98 LBO
* Added support for the real Swimmer bigsprite ROMs, courtesy of Gary Walton.
* Increased the IRQs for the Swimmer audio CPU to 4 to make it more "jaunty".
Not sure if this is accurate, but it should be closer.
3 Mar 98 LBO
* Added alternate version of Swimmer.
TODO:
* Verify timings of sound/music on Swimmer.
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
extern unsigned char *cclimber_bsvideoram;
extern int cclimber_bsvideoram_size;
extern unsigned char *cclimber_bigspriteram;
extern unsigned char *cclimber_column_scroll;
void cclimber_flipscreen_w(int offset,int data);
void cclimber_colorram_w(int offset,int data);
void cclimber_bigsprite_videoram_w(int offset,int data);
void cclimber_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
int cclimber_vh_start(void);
void cclimber_vh_stop(void);
void cclimber_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void cclimber_portA_w(int offset,int data);
void cclimber_sample_trigger_w(int offset,int data);
void cclimber_sample_rate_w(int offset,int data);
void cclimber_sample_volume_w(int offset,int data);
int cclimber_sh_start(void);
void cclimber_sh_stop(void);
static void cclimber_init_machine (void)
{
/* Disable interrupts, River Patrol / Silver Land needs this */
interrupt_enable_w(0, 0);
}
/* Note that River Patrol reads/writes to a000-a4f0. This is a bug in the code.
The instruction at 0x0593 should say LD DE,$8000 */
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x5fff, MRA_ROM },
{ 0x6000, 0x6bff, MRA_RAM }, /* Crazy Kong only */
{ 0x8000, 0x83ff, MRA_RAM },
{ 0x8800, 0x8bff, MRA_RAM },
{ 0x9000, 0x93ff, MRA_RAM }, /* video RAM */
{ 0x9800, 0x9bff, MRA_RAM }, /* column scroll registers */
{ 0x9c00, 0x9fff, MRA_RAM }, /* color RAM */
{ 0xa000, 0xa000, input_port_0_r }, /* IN0 */
{ 0xa800, 0xa800, input_port_1_r }, /* IN1 */
{ 0xb000, 0xb000, input_port_2_r }, /* DSW */
{ 0xb800, 0xb800, input_port_3_r }, /* IN2 */
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x5fff, MWA_ROM },
{ 0x6000, 0x6bff, MWA_RAM }, /* Crazy Kong only */
{ 0x8000, 0x83ff, MWA_RAM },
{ 0x8800, 0x88ff, cclimber_bigsprite_videoram_w, &cclimber_bsvideoram, &cclimber_bsvideoram_size },
{ 0x8900, 0x8bff, MWA_RAM }, /* not used, but initialized */
{ 0x9000, 0x93ff, videoram_w, &videoram, &videoram_size },
{ 0x9400, 0x97ff, videoram_w }, /* mirror address, used by Crazy Climber to draw windows */
/* 9800-9bff and 9c00-9fff share the same RAM, interleaved */
/* (9800-981f for scroll, 9c20-9c3f for color RAM, and so on) */
{ 0x9800, 0x981f, MWA_RAM, &cclimber_column_scroll },
{ 0x9880, 0x989f, MWA_RAM, &spriteram, &spriteram_size },
{ 0x98dc, 0x98df, MWA_RAM, &cclimber_bigspriteram },
{ 0x9800, 0x9bff, MWA_RAM }, /* not used, but initialized */
{ 0x9c00, 0x9fff, cclimber_colorram_w, &colorram },
{ 0xa000, 0xa000, interrupt_enable_w },
{ 0xa001, 0xa002, cclimber_flipscreen_w },
{ 0xa004, 0xa004, cclimber_sample_trigger_w },
{ 0xa800, 0xa800, cclimber_sample_rate_w },
{ 0xb000, 0xb000, cclimber_sample_volume_w },
{ -1 } /* end of table */
};
static struct IOReadPort readport[] =
{
{ 0x0c, 0x0c, AY8910_read_port_0_r },
{ -1 } /* end of table */
};
static struct IOWritePort writeport[] =
{
{ 0x08, 0x08, AY8910_control_port_0_w },
{ 0x09, 0x09, AY8910_write_port_0_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( cclimber_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP | IPF_8WAY )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN | IPF_8WAY )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT | IPF_8WAY )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT | IPF_8WAY )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_START /* DSW */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_DIPSETTING( 0x03, "6" )
PORT_DIPNAME( 0x04, 0x00, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "30000" )
PORT_DIPSETTING( 0x04, "50000" )
PORT_BITX( 0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", OSD_KEY_F1, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x08, "On" )
PORT_DIPNAME( 0x30, 0x00, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x30, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x20, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x10, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPNAME( 0xc0, 0x00, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x40, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x80, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0xc0, "Free Play" )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
PORT_DIPNAME( 0x10, 0x10, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Upright" )
PORT_DIPSETTING( 0x00, "Cocktail" )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
/* several differences with cclimber: note that IN2 bits are ACTIVE_LOW, while in */
/* cclimber they are ACTIVE_HIGH. */
INPUT_PORTS_START( ckong_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
PORT_START /* IN1 */
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
PORT_START /* DSW */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_DIPSETTING( 0x03, "6" )
PORT_DIPNAME( 0x0c, 0x00, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "7000" )
PORT_DIPSETTING( 0x04, "10000" )
PORT_DIPSETTING( 0x08, "15000" )
PORT_DIPSETTING( 0x0c, "20000" )
PORT_DIPNAME( 0x70, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x70, "5 Coins/1 Credit" )
PORT_DIPSETTING( 0x50, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x30, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x10, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x20, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x40, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x60, "1 Coin/4 Credits" )
PORT_DIPNAME( 0x80, 0x80, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Upright" )
PORT_DIPSETTING( 0x00, "Cocktail" )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
INPUT_PORTS_START( rpatrolb_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x3e, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_COCKTAIL | IPF_2WAY )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL | IPF_2WAY )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x3e, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_START /* DSW */
PORT_DIPNAME( 0x03, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x01, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x03, "Free Play" )
PORT_DIPNAME( 0x0c, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x04, "4" )
PORT_DIPSETTING( 0x08, "5" )
PORT_DIPSETTING( 0x0c, "6" )
PORT_DIPNAME( 0x10, 0x10, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Upright" )
PORT_DIPSETTING( 0x00, "Cocktail" )
PORT_DIPNAME( 0x20, 0x00, "Unknown 1", IP_KEY_NONE ) /* Probably unused */
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x20, "On" )
PORT_DIPNAME( 0x40, 0x00, "Unknown 2", IP_KEY_NONE ) /* Probably unused */
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x40, "On" )
PORT_DIPNAME( 0x80, 0x80, "Memory Test", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Retry on Error" )
PORT_DIPSETTING( 0x80, "Stop on Error" )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
512, /* 512 characters (256 in Crazy Climber) */
2, /* 2 bits per pixel */
{ 0, 512*8*8 }, /* the two bitplanes are separated */
{ 0, 1, 2, 3, 4, 5, 6, 7 }, /* pretty straightforward layout */
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8 /* every char takes 8 consecutive bytes */
};
static struct GfxLayout bscharlayout =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -