📄 junofrst.c
字号:
/***************************************************************************
Juno First : memory map same as tutankham with some address changes
Chris Hardy (chrish@kcbbs.gen.nz)
Thanks to Rob Jarret for the original Tutankham memory map on which both the
Juno First emu and the mame driver is based on.
Juno First memory map by Chris Hardy
Read/Write memory
$0000-$7FFF = Screen RAM (only written to)
$8000-$800f = Palette RAM. BBGGGRRR (D7->D0)
$8100-$8FFF = Work RAM
Write memory
$8030 - interrupt control register D0 = interupts on or off
$8031 - unknown
$8032 - unknown
$8033 - unknown
$8034 - flip screen x
$8035 - flip screen y
$8040 - Sound CPU req/ack data
$8050 - Sound CPU command data
$8060 - Banked memory page select.
$8070/1 - Blitter source data word
$8072/3 - Blitter destination word. Write to $8073 triggers a blit
Read memory
$8010 - Dipswitch 2
$801c - Watchdog
$8020 - Start/Credit IO
D2 = Credit 1
D3 = Start 1
D4 = Start 2
$8024 - P1 IO
D0 = left
D1 = right
D2 = up
D3 = down
D4 = fire 2
D5 = fire 1
$8028 - P2 IO - same as P1 IO
$802c - Dipswitch 1
$9000->$9FFF Banked Memory - see below
$A000->$BFFF "juno\\JFA_B9.BIN",
$C000->$DFFF "juno\\JFB_B10.BIN",
$E000->$FFFF "juno\\JFC_A10.BIN",
Banked memory - Paged into $9000->$9FFF..
NOTE - In Tutankhm this only contains graphics, in Juno First it also contains code. (which
generally sets up the blitter)
"juno\\JFC1_A4.BIN", $0000->$1FFF
"juno\\JFC2_A5.BIN", $2000->$3FFF
"juno\\JFC3_A6.BIN", $4000->$5FFF
"juno\\JFC4_A7.BIN", $6000->$7FFF
"juno\\JFC5_A8.BIN", $8000->$9FFF
"juno\\JFC6_A9.BIN", $A000->$bFFF
Blitter source graphics
"juno\\JFS3_C7.BIN", $C000->$DFFF
"juno\\JFS4_D7.BIN", $E000->$FFFF
"juno\\JFS5_E7.BIN", $10000->$11FFF
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "M6809/m6809.h"
#include "I8039/I8039.h"
extern unsigned char *tutankhm_scrollx;
void tutankhm_videoram_w( int offset, int data );
void tutankhm_flipscreen_w( int offset, int data );
void tutankhm_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void tutankhm_init_machine(void);
void junofrst_blitter_w( int offset, int data );
void tutankhm_sh_irqtrigger_w(int offset,int data);
unsigned char KonamiDecode( unsigned char opcode, unsigned short address );
void junofrst_bankselect_w(int offset,int data)
{
int bankaddress;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
bankaddress = 0x10000 + (data & 0x0f) * 0x1000;
/*
This bank code SHOULD be this but it doesn't work because the opcodes
are encrypted
cpu_setbank(1,&RAM[bankaddress]);
*/
memcpy(&RAM[0x9000],&RAM[bankaddress],0x1000);
memcpy(&ROM[0x9000],&ROM[bankaddress],0x1000);
}
static unsigned char JunoNibbleSwapTable[256];
void junofrst_init_machine(void)
{
int i;
for (i=0;i<256;i++) {
JunoNibbleSwapTable[i] = (i>>4) | ((i & 0xF) << 4);
}
tutankhm_init_machine();
}
static int junofrst_portA_r(int offset)
{
#define TIMER_RATE 40
return cpu_gettotalcycles() / TIMER_RATE;
}
void junofrst_sh_irqtrigger_w(int offset,int data)
{
static int last;
if (last == 0 && data == 1)
{
/* setting bit 0 low then high triggers IRQ on the sound CPU */
cpu_cause_interrupt(1,0xff);
}
last = data;
}
void junofrst_i8039_irq_w(int offset,int data)
{
cpu_cause_interrupt(2,I8039_EXT_INT);
}
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x7fff, MRA_RAM },
{ 0x8010, 0x8010, input_port_0_r }, /* DSW2 (inverted bits) */
{ 0x801c, 0x801c, watchdog_reset_r },
{ 0x8020, 0x8020, input_port_1_r }, /* IN0 I/O: Coin slots, service, 1P/2P buttons */
{ 0x8024, 0x8024, input_port_2_r }, /* IN1: Player 1 I/O */
{ 0x8028, 0x8028, input_port_3_r }, /* IN2: Player 2 I/O */
{ 0x802c, 0x802c, input_port_4_r }, /* DSW1 (inverted bits) */
{ 0x8100, 0x8fff, MRA_RAM },
{ 0x9000, 0x9fff, MRA_BANK1 },
{ 0xa000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x7fff, tutankhm_videoram_w, &videoram, &videoram_size },
{ 0x8000, 0x800f, paletteram_BBGGGRRR_w, &paletteram },
{ 0x8030, 0x8030, interrupt_enable_w },
{ 0x8031, 0x8031, MWA_RAM }, /* ??? */
{ 0x8032, 0x8032, MWA_RAM }, /* coin counters */
{ 0x8033, 0x8033, MWA_RAM, &tutankhm_scrollx }, /* video x pan hardware reg - Not USED in Juno*/
{ 0x8034, 0x8035, tutankhm_flipscreen_w },
{ 0x8040, 0x8040, junofrst_sh_irqtrigger_w },
{ 0x8050, 0x8050, soundlatch_w },
{ 0x8060, 0x8060, junofrst_bankselect_w },
{ 0x8070, 0x8073, junofrst_blitter_w },
{ 0x8100, 0x8fff, MWA_RAM },
{ 0xa000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x0fff, MRA_ROM },
{ 0x2000, 0x23ff, MRA_RAM },
{ 0x3000, 0x3000, soundlatch_r },
{ 0x4001, 0x4001, AY8910_read_port_0_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x0000, 0x0fff, MWA_ROM },
{ 0x2000, 0x23ff, MWA_RAM },
{ 0x4000, 0x4000, AY8910_control_port_0_w },
{ 0x4002, 0x4002, AY8910_write_port_0_w },
{ 0x5000, 0x5000, soundlatch2_w },
{ 0x6000, 0x6000, junofrst_i8039_irq_w },
{ -1 } /* end of table */
};
static struct MemoryReadAddress i8039_readmem[] =
{
{ 0x0000, 0x0fff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress i8039_writemem[] =
{
{ 0x0000, 0x0fff, MWA_ROM },
{ -1 } /* end of table */
};
static struct IOReadPort i8039_readport[] =
{
{ 0x00, 0xff, soundlatch2_r },
{ 0x111,0x111, IORP_NOP },
{ -1 }
};
static struct IOWritePort i8039_writeport[] =
{
{ I8039_p1, I8039_p1, DAC_data_w },
{ I8039_p2, I8039_p2, IOWP_NOP },
{ -1 } /* end of table */
};
INPUT_PORTS_START( input_ports )
PORT_START /* DSW2 */
PORT_DIPNAME( 0x03, 0x03, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x03, "3" )
PORT_DIPSETTING( 0x02, "4" )
PORT_DIPSETTING( 0x01, "5" )
PORT_BITX( 0, 0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "256", IP_KEY_NONE, IP_JOY_NONE, 0 )
PORT_DIPNAME( 0x04, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x04, "Cocktail" )
PORT_DIPNAME( 0x08, 0x08, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x70, 0x40, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x70, "Real Easy" )
PORT_DIPSETTING( 0x60, "Not so Easy" )
PORT_DIPSETTING( 0x50, "Easy" )
PORT_DIPSETTING( 0x40, "Normal" )
PORT_DIPSETTING( 0x30, "Harder than Normal" )
PORT_DIPSETTING( 0x20, "Hard" )
PORT_DIPSETTING( 0x10, "More Harder" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_DIPNAME( 0x80, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x0f, 0x0f, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x05, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x08, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0x01, "4 Coins/3 Credits" )
PORT_DIPSETTING( 0x0f, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x03, "3 Coins/4 Credits" )
PORT_DIPSETTING( 0x07, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x0e, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x06, "2 Coins/5 Credits" )
PORT_DIPSETTING( 0x0d, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x0c, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x0b, "1 Coin/5 Credits" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -