コード例 #1
0
ファイル: sms.c プロジェクト: amadvance/advancemame
static void setup_banks( void ) {
	sms_banking_bios[1] = sms_banking_cart[1] = sms_banking_none[1] = memory_region(REGION_CPU1);
	sms_banking_bios[2] = sms_banking_cart[2] = sms_banking_none[2] = memory_region(REGION_CPU1) + 0x0400;
	sms_banking_bios[3] = sms_banking_cart[3] = sms_banking_none[3] = memory_region(REGION_CPU1) + 0x4000;
	sms_banking_bios[4] = sms_banking_cart[4] = sms_banking_none[4] = memory_region(REGION_CPU1) + 0x8000;

	BIOS = memory_region(REGION_USER1);
	ROM = memory_region(REGION_USER2);

	smsBiosPageCount = ( BIOS ? memory_region_length(REGION_USER1) / 0x4000 : 0 );
	smsRomPageCount = ( ROM ? memory_region_length(REGION_USER2) / 0x4000 : 0 );

	if ( ROM ) {
		sms_banking_cart[1] = ROM;
		sms_banking_cart[2] = ROM + 0x0400;
		sms_banking_cart[3] = ROM + ( ( 1 < smsRomPageCount ) ? 0x4000 : 0 );
		sms_banking_cart[4] = ROM + ( ( 2 < smsRomPageCount ) ? 0x8000 : 0 );
	}

	if ( BIOS ) {
		sms_banking_bios[1] = BIOS;
		sms_banking_bios[2] = BIOS + 0x0400;
		sms_banking_bios[3] = BIOS + ( ( 1 < smsBiosPageCount) ? 0x4000 : 0 );
		sms_banking_bios[4] = BIOS + ( ( 2 < smsBiosPageCount) ? 0x8000 : 0 );
	}
}
コード例 #2
0
ファイル: badlands.cpp プロジェクト: AlanApter/steamlink-sdk
static void rom_decode(void)
{
	int i;

	for (i = 0; i < memory_region_length(REGION_GFX1); i++)
		memory_region(REGION_GFX1)[i] ^= 0xff;
	for (i = 0; i < memory_region_length(REGION_GFX2); i++)
		memory_region(REGION_GFX2)[i] ^= 0xff;
}
コード例 #3
0
void pbillian_sh_start(void)
{
	UINT8 *src = memory_region(REGION_SOUND1);
	int i;

	/* convert 8-bit unsigned samples to 8-bit signed */
	samplebuf = auto_malloc(memory_region_length(REGION_SOUND1) * 2);
	for (i = 0;i < memory_region_length(REGION_SOUND1);i++)
		samplebuf[i] = (INT8)(src[i] ^ 0x80) * 256;
}
コード例 #4
0
ファイル: pbillian.c プロジェクト: Sunoo/nonamemame
int pbillian_sh_start(const struct MachineSound *msound)
{
	int i;
	unsigned char *ROM = memory_region(REGION_SOUND1);
	channel = mixer_allocate_channel(50);
	mixer_set_name(channel,"Samples");
	samplebuf = auto_malloc(memory_region_length(REGION_SOUND1));
	for(i=0;i<memory_region_length(REGION_SOUND1);i++)samplebuf[i]=ROM[i]-0x80;
	return 0;
}
コード例 #5
0
ファイル: suna8.c プロジェクト: cdenix/ps3-mame-0125
void suna8_sh_start(void)
{
	int i;
	UINT8 *ROM = memory_region(REGION_SOUND1);

	samplebuf = auto_malloc(memory_region_length(REGION_SOUND1) * sizeof(samplebuf[0]));

	for(i=0;i<memory_region_length(REGION_SOUND1);i++)
		samplebuf[i] = (INT8)(ROM[i] ^ 0x80) * 256;
}
コード例 #6
0
ファイル: thunderj.c プロジェクト: Way310/imame4all-libretro
static void rom_decode(void)
{
	int i;

	/* invert the graphics bits on the playfield and motion objects */
	for (i = 0; i < memory_region_length(REGION_GFX1); i++)
		memory_region(REGION_GFX1)[i] ^= 0xff;
	for (i = 0; i < memory_region_length(REGION_GFX2); i++)
		memory_region(REGION_GFX2)[i] ^= 0xff;

	/* copy the shared ROM from region 0 to region 1 */
	memcpy(&memory_region(REGION_CPU2)[0x60000], &memory_region(REGION_CPU1)[0x60000], 0x20000);
}
コード例 #7
0
ファイル: combatsc.cpp プロジェクト: AlanApter/steamlink-sdk
static void init_combascb( void )
{
	unsigned char *gfx;
	int i;

	gfx = memory_region(REGION_GFX1);
	for (i = 0;i < memory_region_length(REGION_GFX1);i++)
		gfx[i] = ~gfx[i];

	gfx = memory_region(REGION_GFX2);
	for (i = 0;i < memory_region_length(REGION_GFX2);i++)
		gfx[i] = ~gfx[i];
}
コード例 #8
0
ファイル: mustache.c プロジェクト: AltimorTASDK/shmupmametgm
	/* sound hardware */
	MDRV_SPEAKER_STANDARD_MONO("mono")

	MDRV_SOUND_ADD("ymsnd", YM2151, YM_CLOCK)
	MDRV_SOUND_CONFIG(t5182_ym2151_interface)
	MDRV_SOUND_ROUTE(0, "mono", 1.0)
	MDRV_SOUND_ROUTE(1, "mono", 1.0)
MACHINE_DRIVER_END

ROM_START( mustache )
	ROM_REGION( 0x20000, "maincpu", 0 )
	ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) )
	ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) )

	ROM_REGION( 0x10000, "t5182", 0 ) /* Toshiba T5182 module */
	ROM_LOAD( "t5182.rom",   0x0000, 0x2000, CRC(d354c8fc) SHA1(a1c9e1ac293f107f69cc5788cf6abc3db1646e33) )
	ROM_LOAD( "mustache.e5", 0x8000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )

	ROM_REGION( 0x0c000, "gfx1",0)	/* BG tiles  */
	ROM_LOAD( "mustache.a13", 0x0000,  0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
	ROM_LOAD( "mustache.a14", 0x4000,  0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
	ROM_LOAD( "mustache.a16", 0x8000,  0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )

	ROM_REGION( 0x20000, "gfx2",0 )	/* sprites */
	ROM_LOAD( "mustache.a4", 0x00000,  0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) )
	ROM_LOAD( "mustache.a7", 0x08000,  0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) )
	ROM_LOAD( "mustache.a5", 0x10000,  0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) )
	ROM_LOAD( "mustache.a8", 0x18000,  0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) )

	ROM_REGION( 0x1300, "proms",0 )	/* proms */
	ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
	ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
	ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )

	ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END

static DRIVER_INIT( mustache )
{
	int i;

	int G1 = memory_region_length(machine, "gfx1")/3;
	int G2 = memory_region_length(machine, "gfx2")/2;
	UINT8 *gfx1 = memory_region(machine, "gfx1");
	UINT8 *gfx2 = memory_region(machine, "gfx2");
	UINT8 *buf=auto_alloc_array(machine, UINT8, G2*2);

	/* BG data lines */
	for (i=0;i<G1; i++)
	{
		UINT16 w;

		buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3);

		w = (gfx1[i+G1] << 8) | gfx1[i+G1*2];
		w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);

		buf[i+G1]   = w >> 8;
		buf[i+G1*2] = w & 0xff;
	}

	/* BG address lines */
	for (i = 0; i < 3*G1; i++)
		gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];

	/* SPR data lines */
	for (i=0;i<G2; i++)
	{
		UINT16 w;

		w = (gfx2[i] << 8) | gfx2[i+G2];
		w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );

		buf[i]    = w >> 8;
		buf[i+G2] = w & 0xff;
	}

	/* SPR address lines */
	for (i = 0; i < 2*G2; i++)
		gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];

	auto_free(machine, buf);
	seibu_sound_decrypt(machine,"maincpu",0x8000);
}
コード例 #9
0
ファイル: combatsc.c プロジェクト: Ezio-PS/mame2003-libretro
static DRIVER_INIT( combascb )
{
	unsigned char *gfx;
	int i;

	gfx = memory_region(REGION_GFX1);
	for (i = 0;i < memory_region_length(REGION_GFX1);i++)
		gfx[i] = ~gfx[i];

	gfx = memory_region(REGION_GFX2);
	for (i = 0;i < memory_region_length(REGION_GFX2);i++)
		gfx[i] = ~gfx[i];

	combasc_init_common();
}
コード例 #10
0
int YM2610_sh_start(const struct MachineSound *msound)
{
	int i,j;
	int rate = Machine->sample_rate;
	char buf[YM2610_NUMBUF][40];
	const char *name[YM2610_NUMBUF];
	int mixed_vol,vol[YM2610_NUMBUF];
	void *pcmbufa[YM2610_NUMBUF],*pcmbufb[YM2610_NUMBUF];
	int  pcmsizea[YM2610_NUMBUF],pcmsizeb[YM2610_NUMBUF];

	intf = msound->sound_interface;
	if( intf->num > MAX_2610 ) return 1;

	if (AY8910_sh_start(msound)) return 1;

	/* Timer Handler set */
	FMTimerInit();

	/* stream system initialize */
	for (i = 0;i < intf->num;i++)
	{
		/* stream setup */
		mixed_vol = intf->volumeFM[i];
		/* stream setup */
		for (j = 0 ; j < YM2610_NUMBUF ; j++)
		{
			name[j]=buf[j];
			vol[j] = mixed_vol & 0xffff;
			mixed_vol>>=16;
			sprintf(buf[j],"%s #%d Ch%d",sound_name(msound),i,j+1);
		}
		stream[i] = stream_init_multi(YM2610_NUMBUF,name,vol,rate,i,YM2610UpdateOne);
		/* setup adpcm buffers */
		pcmbufa[i]  = (void *)(memory_region(intf->pcmroma[i]));
		pcmsizea[i] = memory_region_length(intf->pcmroma[i]);
		pcmbufb[i]  = (void *)(memory_region(intf->pcmromb[i]));
		pcmsizeb[i] = memory_region_length(intf->pcmromb[i]);
	}

	/**** initialize YM2610 ****/
	if (YM2610Init(intf->num,intf->baseclock,rate,
		           pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
		           TimerHandler,IRQHandler) == 0)
		return 0;

	/* error */
	return 1;
}
コード例 #11
0
ファイル: forte2.c プロジェクト: nitrologic/emu
MACHINE_DRIVER_END

static DRIVER_INIT(pesadelo)
{
	int i;
	UINT8 *mem = memory_region(machine, "maincpu");
	int memsize = memory_region_length(machine, "maincpu");
	UINT8 *buf;

	// data swap
	for ( i = 0; i < memsize; i++ )
	{
		mem[i] = BITSWAP8(mem[i],3,5,6,7,0,4,2,1);
	}

	// address line swap
	buf = alloc_array_or_die(UINT8, memsize);
	memcpy(buf, mem, memsize);
	for ( i = 0; i < memsize; i++ )
	{
		mem[BITSWAP16(i,11,9,8,13,14,15,12,7,6,5,4,3,2,1,0,10)] = buf[i];
	}
	free(buf);

}
コード例 #12
0
ファイル: cclimber.c プロジェクト: cdrr/MAME_hack
static void cclimber_play_sample(int start,int freq,int volume)
{
	int len;
	const UINT8 *rom = memory_region(REGION_SOUND1);


	if (!rom) return;

	/* decode the rom samples */
	len = 0;
	while (start + len < memory_region_length(REGION_SOUND1) && rom[start+len] != 0x70)
	{
		int sample;

		sample = (rom[start + len] & 0xf0) >> 4;
		samplebuf[2*len] = SAMPLE_CONV4(sample) * volume / 31;

		sample = rom[start + len] & 0x0f;
		samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;

		len++;
	}

	mixer_play_sample(channel,samplebuf,2 * len,freq,0);
}
コード例 #13
0
ファイル: powerins.c プロジェクト: joolswills/mameox
static WRITE8_HANDLER( powerina_okibank_w )
{
	/* The OKI6295 ROM space is divided in four banks, each one indepentently
	   controlled. The sample table at the beginning of the addressing space is
	   divided in four pages as well, banked together with the sample data. */

	#define TABLESIZE 0x100
	#define BANKSIZE 0x10000

	int chip	=	offset / 4;
	int banknum	=	offset % 4;

	unsigned char *rom	=	memory_region(REGION_SOUND1 + chip);
	int size			=	memory_region_length(REGION_SOUND1 + chip) - 0x40000;

	int bankaddr		=	data * BANKSIZE;

	if (Machine->sample_rate == 0)	return;

	if (bankaddr >= size)
	{
		bankaddr %= size;
logerror("CPU #1 - PC %06X: chip %d bank %X<-%02X\n",activecpu_get_pc(),chip,banknum,data);
	}

	/* copy the samples */
	if (banknum == 0)		/* skip table */
		memcpy(rom + banknum * BANKSIZE+0x400,rom + 0x40000 + bankaddr+0x400,BANKSIZE-0x400);
	else
		memcpy(rom + banknum * BANKSIZE,rom + 0x40000 + bankaddr,BANKSIZE);

	/* and also copy the samples address table (only for chip #1) */
	rom += banknum * TABLESIZE;
	memcpy(rom,rom + 0x40000 + bankaddr,TABLESIZE);
}
コード例 #14
0
ファイル: simpsons.c プロジェクト: cdrr/MAME_hack
int simpsons_speedup1_r( int offs )
{
	unsigned char *RAM = memory_region(REGION_CPU1);

	int data1 = RAM[0x486a];

	if ( data1 == 0 )
	{
		int data2 = ( RAM[0x4942] << 8 ) | RAM[0x4943];

		if ( data2 < memory_region_length(REGION_CPU1) )
		{
			data2 = ( RAM[data2] << 8 ) | RAM[data2 + 1];

			if ( data2 == 0xffff )
				cpu_spinuntil_int();

			return RAM[0x4942];
		}

		return RAM[0x4942];
	}

	if ( data1 == 1 )
		RAM[0x486a]--;

	return RAM[0x4942];
}
コード例 #15
0
ファイル: harddriv.c プロジェクト: broftkd/historic-mess
void hdsnd_init(void)
{
	rombase = (UINT8 *)memory_region(REGION_SOUND1);
	romsize = memory_region_length(REGION_SOUND1);
	comram = (UINT16 *)auto_malloc(0x400);
	last_bio_cycles = 0;
}
コード例 #16
0
ファイル: afega.c プロジェクト: joolswills/mameox
MACHINE_DRIVER_END

/***************************************************************************


								ROMs Loading


***************************************************************************/

/* Address lines scrambling */

static void decryptcode( int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12,
	int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 )
{
	int i;
	data8_t *RAM = memory_region( REGION_CPU1 );
	size_t  size = memory_region_length( REGION_CPU1 );
	data8_t *buffer = osd_malloc( size );

	if( buffer )
	{
		memcpy( buffer, RAM, size );
		for( i = 0; i < size; i++ )
		{
			RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
				a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0 ) ];
		}
		free( buffer );
	}
}
コード例 #17
0
ファイル: romload.c プロジェクト: broftkd/historic-mess
static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
{
	UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
	int srcregion = ROM_GETFLAGS(romp) >> 24;
	UINT32 numbytes = ROM_GETLENGTH(romp);
	UINT32 srcoffs = (UINT32)ROM_GETHASHDATA(romp);  /* srcoffset in place of hashdata */
	UINT8 *srcbase;

	/* make sure we copy within the region space */
	if (ROM_GETOFFSET(romp) + numbytes > romdata->regionlength)
		fatalerror("Error in RomModule definition: COPY out of target memory region space\n");

	/* make sure the length was valid */
	if (numbytes == 0)
		fatalerror("Error in RomModule definition: COPY has an invalid length\n");

	/* make sure the source was valid */
	srcbase = memory_region(srcregion);
	if (!srcbase)
		fatalerror("Error in RomModule definition: COPY from an invalid region\n");

	/* make sure we find within the region space */
	if (srcoffs + numbytes > memory_region_length(srcregion))
		fatalerror("Error in RomModule definition: COPY out of source memory region space\n");

	/* fill the data */
	memcpy(base, srcbase + srcoffs, numbytes);
}
コード例 #18
0
ファイル: namco52.c プロジェクト: Sunoo/nonamemame
int namco_52xx_sh_start(const struct MachineSound *msound)
{
	int i;
	unsigned char bits;

	intf = msound->sound_interface;
	rom     = memory_region(intf->region);
	rom_len = memory_region_length(intf->region);

	channel = mixer_allocate_channel(intf->mixing_level);
	mixer_set_name(channel,sound_name(msound));

	samples = auto_malloc(2*rom_len);
	if (!samples)
		return 1;

	/* decode the rom samples */
	for (i = 0;i < rom_len;i++)
	{
		bits = rom[i] & 0x0f;
		samples[2*i] = SAMPLE_CONV4(bits);

		bits = (rom[i] & 0xf0) >> 4;
		samples[2*i + 1] = SAMPLE_CONV4(bits);
	}

	return 0;
}
コード例 #19
0
static void init_turbo(void)
{
	static const UINT8 led_number_data[] =
	{
		0x3e,0x41,0x41,0x41,0x00,0x41,0x41,0x41,0x3e,0x00,
		0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x00,
		0x3e,0x01,0x01,0x01,0x3e,0x40,0x40,0x40,0x3e,0x00,
		0x3e,0x01,0x01,0x01,0x3e,0x01,0x01,0x01,0x3e,0x00,
		0x00,0x41,0x41,0x41,0x3e,0x01,0x01,0x01,0x00,0x00,
		0x3e,0x40,0x40,0x40,0x3e,0x01,0x01,0x01,0x3e,0x00,
		0x3e,0x40,0x40,0x40,0x3e,0x41,0x41,0x41,0x3e,0x00,
		0x3e,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x00,
		0x3e,0x41,0x41,0x41,0x3e,0x41,0x41,0x41,0x3e,0x00,
		0x3e,0x41,0x41,0x41,0x3e,0x01,0x01,0x01,0x3e,0x00
	};

	static const UINT8 led_tach_data[] =
	{
		0xff,0x00
	};

	memset(memory_region(REGION_GFX4), 0, memory_region_length(REGION_GFX4));
	memcpy(memory_region(REGION_GFX4), led_number_data, sizeof(led_number_data));
	memcpy(memory_region(REGION_GFX4)+0x100, led_tach_data, sizeof(led_tach_data));
}
コード例 #20
0
void irem_cpu_decrypt(int cpu,const UINT8 *decryption_table)
{
	int A,size;
	UINT8 *rom;
/*  int t[256]; */
#ifdef MAME_DEBUG
/*    extern char *opmap1[]; */
#endif

	rom = memory_region(cpu+REGION_CPU1);
	size = memory_region_length(cpu+REGION_CPU1);
	irem_cpu_decrypted = auto_malloc(size);

	memory_set_decrypted_region(cpu,0,size-1,irem_cpu_decrypted);
	for (A = 0;A < size;A++)
		irem_cpu_decrypted[A] = decryption_table[rom[A]];

/*
    for (A=0; A<256; A++) {
        t[A]=0;
        for (diff=0; diff<256; diff++)
            if (decryption_table[diff]==A) {
                t[A]++;
            }
#ifdef MAME_DEBUG
//        if (t[A]==0) logerror("Unused: [%d] %02x\t%s\n",byte_count_table[A],A,opmap1[A]);
//        if (t[A]>1) logerror("DUPLICATE: %02x\t%s\n",A,opmap1[A]);
#else
        if (t[A]==0) logerror("Unused: [%d] %02x\n",byte_count_table[A],A);
        if (t[A]>1) logerror("DUPLICATE: %02x\n",A);
#endif
    }
*/
}
コード例 #21
0
ファイル: policetr.c プロジェクト: Sunoo/nonamemame
static DRIVER_INIT( sshooter )
{
	speedup_data = memory_install_write32_handler(0, ADDRESS_SPACE_PROGRAM, 0x00018fd8, 0x00018fdb, 0, 0, speedup_w);
	speedup_pc = 0x1fc03470;

	memcpy(rom_base, memory_region(REGION_USER1), memory_region_length(REGION_USER1));
}
コード例 #22
0
ファイル: nmk112.c プロジェクト: DarrenBranford/MAME4iOS
static DEVICE_START( nmk112 )
{
	nmk112_state *nmk112 = get_safe_token(device);
	const nmk112_interface *intf = get_interface(device);

	nmk112->rom0 = memory_region(device->machine, intf->rgn0);
	nmk112->size0 = memory_region_length(device->machine, intf->rgn0) - 0x40000;
	nmk112->rom1 = memory_region(device->machine, intf->rgn1);
	nmk112->size1 = memory_region_length(device->machine, intf->rgn1) - 0x40000;

	nmk112->page_mask = ~intf->disable_page_mask;

	state_save_register_device_item_array(device, 0, nmk112->current_bank);
	state_save_register_device_item_array(device, 0, nmk112->last_bank);
	state_save_register_postload(device->machine, nmk112_postload_bankswitch, nmk112);
}
コード例 #23
0
ファイル: kangaroo.c プロジェクト: nitrologic/emu
static void blitter_execute(running_machine *machine)
{
	UINT32 gfxhalfsize = memory_region_length(machine, "gfx1") / 2;
	const UINT8 *gfxbase = memory_region(machine, "gfx1");
	UINT16 src = kangaroo_video_control[0] + 256 * kangaroo_video_control[1];
	UINT16 dst = kangaroo_video_control[2] + 256 * kangaroo_video_control[3];
	UINT8 height = kangaroo_video_control[5];
	UINT8 width = kangaroo_video_control[4];
	UINT8 mask = kangaroo_video_control[8];
	int x, y;

	/* during DMA operations, the top 2 bits are ORed together, as well as the bottom 2 bits */
	/* adjust the mask to account for this */
	if (mask & 0x0c) mask |= 0x0c;
	if (mask & 0x03) mask |= 0x03;

	/* loop over height, then width */
	for (y = 0; y <= height; y++, dst += 256)
		for (x = 0; x <= width; x++)
		{
			UINT16 effdst = (dst + x) & 0x3fff;
			UINT16 effsrc = src++ & (gfxhalfsize - 1);
			videoram_write(effdst, gfxbase[0*gfxhalfsize + effsrc], mask & 0x05);
			videoram_write(effdst, gfxbase[1*gfxhalfsize + effsrc], mask & 0x0a);
		}
}
コード例 #24
0
ファイル: hnayayoi.c プロジェクト: AltimorTASDK/shmupmametgm
ROM_END


static DRIVER_INIT( hnfubuki )
{
	UINT8 *rom = memory_region(machine, "gfx1");
	int len = memory_region_length(machine, "gfx1");
	int i, j;

	/* interestingly, the blitter data has a slight encryption */

	/* swap address bits 4 and 5 */
	for (i = 0; i < len; i += 0x40)
	{
		for (j = 0; j < 0x10; j++)
		{
			UINT8 t = rom[i + j + 0x10];
			rom[i + j + 0x10] = rom[i + j + 0x20];
			rom[i + j + 0x20] = t;
		}
	}

	/* swap data bits 0 and 1 */
	for (i = 0; i < len; i++)
	{
		rom[i] = BITSWAP8(rom[i],7,6,5,4,3,2,0,1);
	}
}
コード例 #25
0
ファイル: harddriv.c プロジェクト: Paulodx/sdl-mame-wii
void hdsnd_init(running_machine *machine)
{
	rombase = (UINT8 *)memory_region(machine, "serialroms");
	romsize = memory_region_length(machine, "serialroms");
	comram = auto_alloc_array(machine, UINT16, 0x400/2);
	last_bio_cycles = 0;
}
コード例 #26
0
ファイル: igs009.c プロジェクト: nitrologic/emu
ROM_END

static DRIVER_INIT( jingbell )
{
	int i;
	UINT8 *rom  = (UINT8 *)memory_region(machine, "maincpu");
	size_t size = memory_region_length(machine, "maincpu");

	for (i=0; i<size; i++)
	{
		UINT8 x = rom[i];
		if (i & 0x0080)
		{
			if ((i & 0x0420) == 0x0420)	x ^= 0x20;
			else						x ^= 0x22;
		}
		else
		{
			if (i & 0x0200)	x ^= 0x02;
			else			x ^= 0x22;
		}

		if ((i & 0x1208) == 0x1208)	x ^= 0x01;

		rom[i] = x;
	}

	// protection patch
	rom[0x01f19] = 0x18;
}
コード例 #27
0
ファイル: dreamwld.c プロジェクト: broftkd/historic-mess
static READ32_HANDLER( dreamwld_protdata_r )
{
	static int protindex = 0;
	UINT8 *protdata    = memory_region( REGION_USER1 );
	size_t  protsize = memory_region_length( REGION_USER1 );
	UINT8 dat = protdata[(protindex++)%protsize];
	return dat<<24;
}
コード例 #28
0
ファイル: circus.cpp プロジェクト: Nebuleon/mame4all
static void init_robotbwl(void)
{
    int i;

    /* PROM is reversed, fix it! */

    for (i = 0; i < memory_region_length(REGION_GFX2); i++)
        memory_region(REGION_GFX2)[i] ^= 0xFF;
}
コード例 #29
0
ファイル: 2610intf.c プロジェクト: broftkd/mess-cvs
static void *ym2610_start(int sndindex, int clock, const void *config)
{
	static const struct YM2610interface generic_2610 = { 0 };
	const struct YM2610interface *intf = config ? config : &generic_2610;
	int rate = Machine->sample_rate;
	void *pcmbufa,*pcmbufb;
	int  pcmsizea,pcmsizeb;
	struct ym2610_info *info;

	sound_type = SOUND_YM2610;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));

	info->intf = intf;
	info->psg = ay8910_start_ym(SOUND_YM2610, sndindex, clock, 1, NULL, NULL, NULL, NULL);
	if (!info->psg) return NULL;

	/* Timer Handler set */
	info->timer[0] =timer_alloc_ptr(timer_callback_0, info);
	info->timer[1] =timer_alloc_ptr(timer_callback_1, info);

	/* stream system initialize */
	info->stream = stream_create(0,2,rate,info,ym2610_stream_update);
	/* setup adpcm buffers */
	pcmbufa  = (void *)(memory_region(info->intf->pcmroma));
	pcmsizea = memory_region_length(info->intf->pcmroma);
	pcmbufb  = (void *)(memory_region(info->intf->pcmromb));
	pcmsizeb = memory_region_length(info->intf->pcmromb);

	/**** initialize YM2610 ****/
	info->chip = YM2610Init(info,sndindex,clock,rate,
		           pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
		           TimerHandler,IRQHandler,&psgintf);

	state_save_register_func_postload_ptr(ym2610_postload, info);

	if (info->chip)
		return info;

	/* error */
	return NULL;
}
コード例 #30
0
ファイル: deco156.c プロジェクト: Paulodx/sdl-mame-wii
void deco156_decrypt(running_machine *machine)
{
	UINT32 *rom = (UINT32 *)memory_region(machine, "maincpu");
	int length = memory_region_length(machine, "maincpu");
	UINT32 *buf = alloc_array_or_die(UINT32, length/4);

		memcpy(buf, rom, length);
		decrypt(buf, rom, length);
		free(buf);
}