void jmfb_device::device_start() { UINT32 slotspace; // set_nubus_device makes m_slot valid set_nubus_device(); install_declaration_rom(this, GC48_ROM_REGION); slotspace = get_slotspace(); // printf("[JMFB %p] slotspace = %x\n", this, slotspace); m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_48gc", m_vram); m_nubus->install_device(slotspace+0x200000, slotspace+0x2003ff, read32_delegate(FUNC(jmfb_device::mac_48gc_r), this), write32_delegate(FUNC(jmfb_device::mac_48gc_w), this)); }
void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref) { ui_menu_item *pitem; int index; /* only allow multiline as the first item */ if ((flags & MENU_FLAG_MULTILINE) != 0) assert(numitems == 1); /* only allow a single multi-line item */ else if (numitems >= 2) assert((item[0].flags & MENU_FLAG_MULTILINE) == 0); /* realloc the item array if necessary */ if (numitems >= allocitems) { int olditems = allocitems; allocitems += UI_MENU_ALLOC_ITEMS; ui_menu_item *newitems = auto_alloc_array(machine(), ui_menu_item, allocitems); for (int itemnum = 0; itemnum < olditems; itemnum++) newitems[itemnum] = item[itemnum]; auto_free(machine(), item); item = newitems; } index = numitems++; /* copy the previous last item to the next one */ if (index != 0) { index--; item[index + 1] = item[index]; } /* allocate a new item and populate it */ pitem = &item[index]; pitem->text = (text != NULL) ? pool_strdup(text) : NULL; pitem->subtext = (subtext != NULL) ? pool_strdup(subtext) : NULL; pitem->flags = flags; pitem->ref = ref; /* update the selection if we need to */ if (resetpos == index || (resetref != NULL && resetref == ref)) selected = index; if (resetpos == numitems - 1) selected = numitems - 1; }
ROM_END void cabal_state::seibu_sound_bootleg(const char *cpu,int length) { address_space &space = machine().device(cpu)->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, length); UINT8 *rom = memregion(cpu)->base(); space.set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt); memcpy(decrypt, rom+length, length); if (length > 0x10000) membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000); }
// fix sprite order static void decode_sprite16(running_machine &machine, const char * region) { tceptor_state *state = machine.driver_data<tceptor_state>(); static const gfx_layout spr16_layout = { 16, 16, 512, 4, { 0x00000, 0x00004, 0x40000, 0x40004 }, { 0*8, 0*8+1, 0*8+2, 0*8+3, 1*8, 1*8+1, 1*8+2, 1*8+3, 2*8, 2*8+1, 2*8+2, 2*8+3, 3*8, 3*8+1, 3*8+2, 3*8+3 }, { 0*2*16, 1*2*16, 2*2*16, 3*2*16, 4*2*16, 5*2*16, 6*2*16, 7*2*16, 8*2*16, 9*2*16, 10*2*16, 11*2*16, 12*2*16, 13*2*16, 14*2*16, 15*2*16 }, 2*16*16 }; UINT8 *src = machine.root_device().memregion(region)->base(); int len = machine.root_device().memregion(region)->bytes(); UINT8 *dst; int i, y; dst = auto_alloc_array(machine, UINT8, len); for (i = 0; i < len / (4*4*16); i++) for (y = 0; y < 16; y++) { memcpy(&dst[(i*4 + 0) * (2*16*16/8) + y * (2*16/8)], &src[i * (2*32*32/8) + y * (2*32/8)], 4); memcpy(&dst[(i*4 + 1) * (2*16*16/8) + y * (2*16/8)], &src[i * (2*32*32/8) + y * (2*32/8) + (4*8/8)], 4); memcpy(&dst[(i*4 + 2) * (2*16*16/8) + y * (2*16/8)], &src[i * (2*32*32/8) + y * (2*32/8) + (16*2*32/8)], 4); memcpy(&dst[(i*4 + 3) * (2*16*16/8) + y * (2*16/8)], &src[i * (2*32*32/8) + y * (2*32/8) + (4*8/8) + (16*2*32/8)], 4); } decode_sprite(machine, state->m_sprite16, &spr16_layout, dst); }
ADDRESS_MAP_END void xtom3d_state::machine_start() { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x10000/4); m_bios_ext1_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext2_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext3_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext4_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_isa_ram1 = auto_alloc_array(machine(), UINT32, 0x4000/4); m_isa_ram2 = auto_alloc_array(machine(), UINT32, 0x4000/4); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(xtom3d_state::irq_callback),this)); intel82439tx_init(); }
void nubus_cb264_device::device_start() { UINT32 slotspace; // set_nubus_device makes m_slot valid set_nubus_device(); install_declaration_rom(this, CB264_ROM_REGION); slotspace = get_slotspace(); // printf("[cb264 %p] slotspace = %x\n", this, slotspace); m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_cb264", m_vram); m_nubus->install_device(slotspace+0xff6000, slotspace+0xff60ff, read32_delegate(FUNC(nubus_cb264_device::cb264_r), this), write32_delegate(FUNC(nubus_cb264_device::cb264_w), this)); m_nubus->install_device(slotspace+0xff7000, slotspace+0xff70ff, read32_delegate(FUNC(nubus_cb264_device::cb264_ramdac_r), this), write32_delegate(FUNC(nubus_cb264_device::cb264_ramdac_w), this)); }
/* * D15 LNKFLAG (Game Link) * D14 PC3 " " * D13 PC2 " " * D12 PC0 " " * D11 MAINFLAG (Sound System) * D10 SOUNDFLAG " " * D9 /IDLE* (TMS320 System) * D8 */ return dsp_idle ? 0 : (1 << 9); } static READ16_HANDLER(tomcat_320bio_r) { dsp_BIO = 1; cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_SPIN, 1); return 0; } static READ16_HANDLER(dsp_BIO_r) { if ( cpu_get_pc(space->cpu) == 0x0001 ) { if ( dsp_idle == 0 ) { dsp_idle = 1; dsp_BIO = 0; } return !dsp_BIO; } else if ( cpu_get_pc(space->cpu) == 0x0003 ) { if ( dsp_BIO == 1 ) { dsp_idle = 0; dsp_BIO = 0; cputag_resume(space->machine, "maincpu", SUSPEND_REASON_SPIN ); return 0; } else { assert(0); return 0; } } else { return !dsp_BIO; } } static READ16_HANDLER(tomcat_shared_ram_r) { return tomcat_shared_ram[offset]; } static WRITE16_HANDLER(tomcat_shared_ram_w) { COMBINE_DATA(&tomcat_shared_ram[offset]); } static READ8_HANDLER(tomcat_nvram_r) { return tomcat_nvram[offset]; } static WRITE8_HANDLER(tomcat_nvram_w) { tomcat_nvram[offset] = data; } static ADDRESS_MAP_START( tomcat_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_RANGE(0x402000, 0x402001) AM_READ(tomcat_adcread_r) AM_WRITE(tomcat_adcon_w) AM_RANGE(0x404000, 0x404001) AM_READ(tomcat_inputs_r) AM_WRITE(avgdvg_go_word_w) AM_RANGE(0x406000, 0x406001) AM_WRITE(avgdvg_reset_word_w) AM_RANGE(0x408000, 0x408001) AM_READWRITE(tomcat_inputs2_r, watchdog_reset16_w) AM_RANGE(0x40a000, 0x40a001) AM_READWRITE(tomcat_320bio_r, tomcat_irqclr_w) AM_RANGE(0x40e000, 0x40e001) AM_WRITE(tomcat_led1on_w) AM_RANGE(0x40e002, 0x40e003) AM_WRITE(tomcat_led2on_w) AM_RANGE(0x40e004, 0x40e005) AM_WRITE(tomcat_mresl_w) AM_RANGE(0x40e006, 0x40e007) AM_WRITE(tomcat_sndresl_w) AM_RANGE(0x40e008, 0x40e009) AM_WRITE(tomcat_lnkmodel_w) AM_RANGE(0x40e00a, 0x40e00b) AM_WRITE(tomcat_errl_w) AM_RANGE(0x40e00c, 0x40e00d) AM_WRITE(tomcat_ackl_w) AM_RANGE(0x40e00e, 0x40e00f) AM_WRITE(tomcat_txbuffl_w) AM_RANGE(0x40e010, 0x40e011) AM_WRITE(tomcat_led1off_w) AM_RANGE(0x40e012, 0x40e013) AM_WRITE(tomcat_led2off_w) AM_RANGE(0x40e014, 0x40e015) AM_WRITE(tomcat_mresh_w) AM_RANGE(0x40e016, 0x40e017) AM_WRITE(tomcat_sndresh_w) AM_RANGE(0x40e018, 0x40e019) AM_WRITE(tomcat_lnkmodeh_w) AM_RANGE(0x40e01a, 0x40e01b) AM_WRITE(tomcat_errh_w) AM_RANGE(0x40e01c, 0x40e01d) AM_WRITE(tomcat_ackh_w) AM_RANGE(0x40e01e, 0x40e01f) AM_WRITE(tomcat_txbuffh_w) AM_RANGE(0x800000, 0x803fff) AM_RAM AM_BASE((UINT16**)&vectorram) AM_SIZE(&vectorram_size) AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE(tomcat_shared_ram_r, tomcat_shared_ram_w) AM_RANGE(0xffc000, 0xffcfff) AM_RAM AM_RANGE(0xffd000, 0xffdfff) AM_DEVREADWRITE8("m48t02", timekeeper_r, timekeeper_w, 0xff00) AM_RANGE(0xffd000, 0xffdfff) AM_READWRITE8(tomcat_nvram_r, tomcat_nvram_w, 0x00ff) ADDRESS_MAP_END static ADDRESS_MAP_START( dsp_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&tomcat_shared_ram) ADDRESS_MAP_END static ADDRESS_MAP_START( dsp_io_map, ADDRESS_SPACE_IO, 16 ) AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(dsp_BIO_r) ADDRESS_MAP_END static WRITE8_HANDLER(soundlatches_w) { switch(offset) { case 0x00: break; // XLOAD 0 Write the Sequential ROM counter Low Byte case 0x20: break; // XLOAD 1 Write the Sequential ROM counter High Byte case 0x40: break; // SOUNDWR Write to Sound Interface Latch (read by Main) case 0x60: break; // unused case 0x80: break; // XREAD Read the Sequential ROM (64K bytes) and increment the counter case 0xa0: break; // unused case 0xc0: break; // SOUNDREAD Read the Sound Interface Latch (written by Main) } } static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_RAM AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w) AM_RANGE(0x3000, 0x30df) AM_WRITE(soundlatches_w) AM_RANGE(0x30e0, 0x30e0) AM_NOP // COINRD Inputs: D7 = Coin L, D6 = Coin R, D5 = SOUNDFLAG AM_RANGE(0x5000, 0x507f) AM_RAM // 6532 ram AM_RANGE(0x5080, 0x509f) AM_DEVREADWRITE("riot", riot6532_r, riot6532_w) AM_RANGE(0x6000, 0x601f) AM_DEVREADWRITE("pokey1", pokey_r, pokey_w) AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokey_r, pokey_w) AM_RANGE(0x8000, 0xffff) AM_NOP // main sound program rom ADDRESS_MAP_END static INPUT_PORTS_START( tomcat ) PORT_START("IN0") /* INPUTS */ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // SPARE PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) // DIAGNOSTIC PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) // R FIRE PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // L FIRE PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) // R THUMB PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) // L THUMB PORT_START("STICKY") PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_START("STICKX") PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) INPUT_PORTS_END ROM_START( tomcat ) ROM_REGION( 0x10000, "maincpu", 0) ROM_LOAD16_BYTE( "rom1k.bin", 0x00001, 0x8000, CRC(5535a1ff) SHA1(b9807c749a8e6b5ddec3ff494130abda09f0baab) ) ROM_LOAD16_BYTE( "rom2k.bin", 0x00000, 0x8000, CRC(021a01d2) SHA1(01d99aab54ad57a664e8aaa91296bb879fc6e422) ) ROM_REGION( 0x100, "user1", 0 ) ROM_LOAD( "136021-105.1l", 0x0000, 0x0100, CRC(82fc3eb2) SHA1(184231c7baef598294860a7d2b8a23798c5c7da6) ) /* AVG PROM */ ROM_END static MACHINE_START(tomcat) { ((UINT16*)tomcat_shared_ram)[0x0000] = 0xf600; ((UINT16*)tomcat_shared_ram)[0x0001] = 0x0000; ((UINT16*)tomcat_shared_ram)[0x0002] = 0xf600; ((UINT16*)tomcat_shared_ram)[0x0003] = 0x0000; tomcat_nvram = auto_alloc_array(machine, UINT8, 0x800); state_save_register_global_pointer(machine, tomcat_nvram, 0x800); state_save_register_global(machine, tomcat_control_num); state_save_register_global(machine, dsp_BIO); state_save_register_global(machine, dsp_idle); dsp_BIO = 0; }
/* (from other romset - I think these are correct, they match the Starcade video) */ ROM_REGION( 0x0060, "proms", 0 ) ROM_LOAD( "dorodon.bp0", 0x0000, 0x0020, CRC(8fcf0bc8) SHA1(392d22731b3e4bc663d6e4385f6069ee2b4ee029) ) /* palette */ ROM_LOAD( "dorodon.bp1", 0x0020, 0x0020, CRC(3f209be4) SHA1(f924494eed357a15ffc11331c163af24585d4ab9) ) /* sprite color lookup table */ ROM_LOAD( "dorodon.bp2", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* timing?? */ ROM_END ROM_START( sraider ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "sraid3.r4", 0x0000, 0x2000, CRC(0f389774) SHA1(c67596e6bf00175ff0a241506cd2f88114d05933) ) ROM_LOAD( "sraid2.n4", 0x2000, 0x2000, CRC(38a48db0) SHA1(6f4f384d702fb8ee4bb2ef579638239d57e32ddd) ) ROM_LOAD( "sraid1.m4", 0x4000, 0x2000, CRC(2f302a4e) SHA1(3a902ce6858f38df88b60830bef4b1d45b09b2df) ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "sraid-s4.h6", 0x0000, 0x2000, CRC(57173a12) SHA1(6cb8fd4826e499f9a4e63621d58bc4b596cc261e) ) ROM_LOAD( "sraid-s5.j6", 0x2000, 0x2000, CRC(5a459179) SHA1(a261c8f3c7c4cd4587c003bbbe815d2c4e01ffbc) ) ROM_LOAD( "sraid-s6.l6", 0x4000, 0x2000, CRC(ea3aa25d) SHA1(353c0d075d5e0a3bc25a65e2748f5eb5212a844d) ) ROM_REGION( 0x2000, "gfx1", 0 ) ROM_LOAD( "sraid-s0.k6", 0x0000, 0x1000, CRC(a0373909) SHA1(00e3bd5dd90769d670fc3c51edd1cd4b69e6132d) ) ROM_LOAD( "sraids11.l6", 0x1000, 0x1000, CRC(ba22d949) SHA1(83762ced1df92ff594887e44d5b783826bbfb0c9) ) ROM_REGION( 0x2000, "gfx2", 0 ) ROM_LOAD( "sraid-s7.m2", 0x0000, 0x1000, CRC(299f8e07) SHA1(1de71f251286088487da7285d6f8070147002af5) ) ROM_LOAD( "sraid-s8.n2", 0x1000, 0x1000, CRC(57ba8888) SHA1(2aa1a5f682d146a55a96e471bb78e5c60da02bf9) ) ROM_REGION( 0x1000, "gfx3", 0 ) /* fixed portion of the grid */ ROM_LOAD( "sraid-s9.f6", 0x0000, 0x1000, CRC(2380b90f) SHA1(0310554e3f2ec973c2bb6e816d04e5c0c1e0a0b9) ) ROM_REGION( 0x0060, "proms", 0 ) ROM_LOAD( "srpr10-1.a2", 0x0000, 0x0020, CRC(121fdb99) SHA1(3bc092da40beb129a4df3db2f55d22bbbcf7bad8) ) ROM_LOAD( "srpr10-2.l3", 0x0020, 0x0020, CRC(88b67e70) SHA1(e21ee2939e96dffee101bd92c62ed975b6b64001) ) ROM_LOAD( "srpr10-3.c1", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* ?? */ ROM_END DRIVER_INIT_MEMBER(ladybug_state,dorodon) { /* decode the opcodes */ offs_t i; address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000); UINT8 *rom = memregion("maincpu")->base(); UINT8 *table = memregion("user1")->base(); space.set_decrypted_region(0x0000, 0x5fff, decrypted); for (i = 0; i < 0x6000; i++) decrypted[i] = table[rom[i]]; }
void naomi_m1_board::device_start() { naomi_board::device_start(); const UINT8 *key_data = machine().region(key_tag)->base(); key = (key_data[0] << 24) | (key_data[1] << 16) | (key_data[2] << 8) | key_data[3]; buffer = auto_alloc_array(machine(), UINT8, BUFFER_SIZE); save_pointer(NAME(buffer), BUFFER_SIZE); save_item(NAME(dict)); save_item(NAME(hist)); save_item(NAME(rom_cur_address)); save_item(NAME(buffer_actual_size)); save_item(NAME(avail_bits)); save_item(NAME(encryption)); save_item(NAME(stream_ended)); save_item(NAME(has_history)); }
/* (from other romset - I think these are correct, they match the Starcade video) */ ROM_REGION( 0x0060, "proms", 0 ) ROM_LOAD( "dorodon.bp0", 0x0000, 0x0020, CRC(8fcf0bc8) SHA1(392d22731b3e4bc663d6e4385f6069ee2b4ee029) ) /* palette */ ROM_LOAD( "dorodon.bp1", 0x0020, 0x0020, CRC(3f209be4) SHA1(f924494eed357a15ffc11331c163af24585d4ab9) ) /* sprite color lookup table */ ROM_LOAD( "dorodon.bp2", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* timing?? */ ROM_END ROM_START( sraider ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "sraid3.r4", 0x0000, 0x2000, CRC(0f389774) SHA1(c67596e6bf00175ff0a241506cd2f88114d05933) ) ROM_LOAD( "sraid2.n4", 0x2000, 0x2000, CRC(38a48db0) SHA1(6f4f384d702fb8ee4bb2ef579638239d57e32ddd) ) ROM_LOAD( "sraid1.m4", 0x4000, 0x2000, CRC(2f302a4e) SHA1(3a902ce6858f38df88b60830bef4b1d45b09b2df) ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "sraid-s4.h6", 0x0000, 0x2000, CRC(57173a12) SHA1(6cb8fd4826e499f9a4e63621d58bc4b596cc261e) ) ROM_LOAD( "sraid-s5.j6", 0x2000, 0x2000, CRC(5a459179) SHA1(a261c8f3c7c4cd4587c003bbbe815d2c4e01ffbc) ) ROM_LOAD( "sraid-s6.l6", 0x4000, 0x2000, CRC(ea3aa25d) SHA1(353c0d075d5e0a3bc25a65e2748f5eb5212a844d) ) ROM_REGION( 0x2000, "gfx1", 0 ) ROM_LOAD( "sraid-s0.k6", 0x0000, 0x1000, CRC(a0373909) SHA1(00e3bd5dd90769d670fc3c51edd1cd4b69e6132d) ) ROM_LOAD( "sraids11.l6", 0x1000, 0x1000, CRC(ba22d949) SHA1(83762ced1df92ff594887e44d5b783826bbfb0c9) ) ROM_REGION( 0x2000, "gfx2", 0 ) ROM_LOAD( "sraid-s7.m2", 0x0000, 0x1000, CRC(299f8e07) SHA1(1de71f251286088487da7285d6f8070147002af5) ) ROM_LOAD( "sraid-s8.n2", 0x1000, 0x1000, CRC(57ba8888) SHA1(2aa1a5f682d146a55a96e471bb78e5c60da02bf9) ) ROM_REGION( 0x1000, "gfx3", 0 ) /* fixed portion of the grid */ ROM_LOAD( "sraid-s9.f6", 0x0000, 0x1000, CRC(2380b90f) SHA1(0310554e3f2ec973c2bb6e816d04e5c0c1e0a0b9) ) ROM_REGION( 0x0060, "proms", 0 ) ROM_LOAD( "srpr10-1.a2", 0x0000, 0x0020, CRC(121fdb99) SHA1(3bc092da40beb129a4df3db2f55d22bbbcf7bad8) ) ROM_LOAD( "srpr10-2.l3", 0x0020, 0x0020, CRC(88b67e70) SHA1(e21ee2939e96dffee101bd92c62ed975b6b64001) ) ROM_LOAD( "srpr10-3.c1", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* ?? */ ROM_END static DRIVER_INIT( dorodon ) { /* decode the opcodes */ offs_t i; address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x6000); UINT8 *rom = machine.region("maincpu")->base(); UINT8 *table = machine.region("user1")->base(); space->set_decrypted_region(0x0000, 0x5fff, decrypted); for (i = 0; i < 0x6000; i++) decrypted[i] = table[rom[i]]; }
DRIVER_INIT_MEMBER(alg_state,palr3) { UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); UINT8 *original = auto_alloc_array(machine(), UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); for (srcaddr = 0; srcaddr < length; srcaddr++) { UINT32 dstaddr = srcaddr; if (srcaddr & 0x2000) dstaddr ^= 0x1000; rom[dstaddr] = original[srcaddr]; } auto_free(machine(), original); alg_init(); }
SNAPSHOT_LOAD_MEMBER( z1013_state, z1013 ) { /* header layout 0000,0001 - load address 0002,0003 - end address 0004,0005 - exec address 0006-000B - unknown 000C - Filetype (appears B=Basic, C=Machine Language, I=?, could be more) 000D-000F - bytes D3, D3, D3 0010-001F - Filename 0020 up - Program to load */ UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); UINT16 startaddr,endaddr,runaddr; image.fread( data, snapshot_size); startaddr = data[0] + data[1]*256; endaddr = data[2] + data[3]*256; runaddr = data[4] + data[5]*256; if ((data[13]==data[14]) && (data[14]==data[15])) { } else { image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); image.message(" Not a Z1013 image"); return IMAGE_INIT_FAIL; } memcpy (m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), data+0x20, endaddr - startaddr + 1); if (runaddr) m_maincpu->set_state_int(Z80_PC, runaddr); else { image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Loaded but cannot run"); image.message(" Loaded but cannot run"); } return IMAGE_INIT_PASS; }
static DRIVER_INIT( tokib ) { UINT8 *temp = auto_alloc_array(machine, UINT8, 65536 * 2); int i, offs, len; UINT8 *rom; /* invert the sprite data in the ROMs */ len = machine.region("gfx2")->bytes(); rom = machine.region("gfx2")->base(); for (i = 0; i < len; i++) rom[i] ^= 0xff; /* merge background tile graphics together */ len = machine.region("gfx3")->bytes(); rom = machine.region("gfx3")->base(); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; memcpy (temp, base, 65536 * 2); for (i = 0; i < 16; i++) { memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); } } len = machine.region("gfx4")->bytes(); rom = machine.region("gfx4")->base(); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; memcpy (temp, base, 65536 * 2); for (i = 0; i < 16; i++) { memcpy (&base[0x00000 + i * 0x800], &temp[0x0000 + i * 0x2000], 0x800); memcpy (&base[0x10000 + i * 0x800], &temp[0x0800 + i * 0x2000], 0x800); memcpy (&base[0x08000 + i * 0x800], &temp[0x1000 + i * 0x2000], 0x800); memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); } } auto_free (machine, temp); }
ROM_END /************************************* * * Driver initialization * *************************************/ DRIVER_INIT_MEMBER(cbasebal_state,cbasebal) { UINT8 *src = memregion("maincpu")->base(); int size = memregion("maincpu")->bytes(); UINT8 *dst = auto_alloc_array(machine(), UINT8, size); pang_decode(src, dst, size); membank("bank1")->configure_entries(0, 32, src + 0x10000, 0x4000); membank("bank0d")->set_base(dst); membank("bank1d")->configure_entries(0, 32, dst + 0x10000, 0x4000); }
ROM_END DRIVER_INIT_MEMBER(coinmstr_state,coinmstr) { UINT8 *rom = memregion("user1")->base(); int length = memregion("user1")->bytes(); UINT8 *buf = auto_alloc_array(machine(), UINT8, length); int i; memcpy(buf,rom,length); for(i = 0; i < length; i++) { int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4); rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7); } auto_free(machine(), buf); }
static DEVICE_START( kaneko_pandora ) { kaneko_pandora_state *pandora = get_safe_token(device); const kaneko_pandora_interface *intf = get_interface(device); pandora->screen = device->machine().device<screen_device>(intf->screen); pandora->region = intf->gfx_region; pandora->xoffset = intf->x; pandora->yoffset = intf->y; pandora->bg_pen = 0; pandora->spriteram = auto_alloc_array(device->machine(), UINT8, 0x1000); pandora->sprites_bitmap = auto_bitmap_ind16_alloc(device->machine(), pandora->screen->width(), pandora->screen->height()); device->save_item(NAME(pandora->clear_bitmap)); device->save_pointer(NAME(pandora->spriteram), 0x1000); device->save_item(NAME(*pandora->sprites_bitmap)); }
GFXDECODE_END static MACHINE_START( funybubl ) { funybubl_state *state = machine->driver_data<funybubl_state>(); UINT8 *ROM = memory_region(machine, "maincpu"); state->audiocpu = machine->device("audiocpu"); state->banked_vram = auto_alloc_array(machine, UINT8, 0x2000); state_save_register_global_pointer(machine, state->banked_vram, 0x2000); memory_configure_bank(machine, "bank1", 0, 2, &state->banked_vram[0x0000], 0x1000); memory_configure_bank(machine, "bank2", 0, 0x10, &ROM[0x10000], 0x4000); memory_set_bank(machine, "bank1", 0); }
ROM_END static DRIVER_INIT( toki ) { UINT8 *ROM = machine.region("oki")->base(); UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } auto_free(machine, buffer); seibu_sound_decrypt(machine,"audiocpu",0x2000); }
void playch10_state::machine_start() { m_vrom = memregion("gfx2")->base(); /* allocate 4K of nametable ram here */ /* move to individual boards as documentation of actual boards allows */ m_nt_ram = auto_alloc_array(machine(), UINT8, 0x1000); machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(playch10_state::pc10_chr_r),this), write8_delegate(FUNC(playch10_state::pc10_chr_w),this)); machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this),write8_delegate(FUNC(playch10_state::pc10_nt_w),this)); if (NULL != m_vram) set_videoram_bank(0, 8, 0, 8); else pc10_set_videorom_bank(0, 8, 0, 8); nvram_device *nvram = machine().device<nvram_device>("nvram"); if (nvram != NULL) nvram->set_base(memregion("cart" )->base() + 0x6000, 0x1000); }
void shadfrce_state::video_start() { m_fgtilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shadfrce_state::get_fgtile_info),this),TILEMAP_SCAN_ROWS, 8, 8,64,32); m_fgtilemap->set_transparent_pen(0); m_bg0tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shadfrce_state::get_bg0tile_info),this),TILEMAP_SCAN_ROWS, 16, 16,32,32); m_bg0tilemap->set_transparent_pen(0); m_bg1tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shadfrce_state::get_bg1tile_info),this),TILEMAP_SCAN_ROWS, 16, 16,32,32); m_spvideoram_old = auto_alloc_array(machine(), UINT16, m_spvideoram.bytes()/2); save_item(NAME(m_video_enable)); save_item(NAME(m_irqs_enable)); save_item(NAME(m_raster_scanline)); save_item(NAME(m_raster_irq_enable)); save_item(NAME(m_vblank)); save_item(NAME(m_prev_value)); }
DRIVER_INIT_MEMBER(alg_state,aplatoon) { /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */ UINT8 *rom = memregion("user2")->base(); UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x40000); int i; static const int shuffle[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 }; for (i = 0; i < 64; i++) memcpy(decrypted + i * 0x1000, rom + shuffle[i] * 0x1000, 0x1000); memcpy(rom, decrypted, 0x40000); logerror("decrypt done\n "); alg_init(); }
static MACHINE_START( cloud9 ) { cloud9_state *state = (cloud9_state *)machine->driver_data; rectangle visarea; /* initialize globals */ state->maincpu = machine->device("maincpu"); state->syncprom = memory_region(machine, "proms") + 0x000; /* find the start of VBLANK in the SYNC PROM */ for (state->vblank_start = 0; state->vblank_start < 256; state->vblank_start++) if ((state->syncprom[(state->vblank_start - 1) & 0xff] & 2) != 0 && (state->syncprom[state->vblank_start] & 2) == 0) break; if (state->vblank_start == 0) state->vblank_start = 256; /* find the end of VBLANK in the SYNC PROM */ for (state->vblank_end = 0; state->vblank_end < 256; state->vblank_end++) if ((state->syncprom[(state->vblank_end - 1) & 0xff] & 2) == 0 && (state->syncprom[state->vblank_end] & 2) != 0) break; /* can't handle the wrapping case */ assert(state->vblank_end < state->vblank_start); /* reconfigure the visible area to match */ visarea.min_x = 0; visarea.max_x = 255; visarea.min_y = state->vblank_end + 1; visarea.max_y = state->vblank_start; machine->primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* create a timer for IRQs and set up the first callback */ state->irq_timer = timer_alloc(machine, clock_irq, NULL); state->irq_state = 0; schedule_next_irq(machine, 0-64); /* allocate backing memory for the NVRAM */ machine->generic.nvram.u8 = auto_alloc_array(machine, UINT8, machine->generic.nvram_size); /* setup for save states */ state_save_register_global(machine, state->irq_state); state_save_register_global_pointer(machine, machine->generic.nvram.u8, machine->generic.nvram_size); }
ROM_END DRIVER_INIT_MEMBER(travrusa_state,motorace) { int A, j; UINT8 *rom = memregion("maincpu")->base(); UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x2000); memcpy(buffer, rom, 0x2000); /* The first CPU ROM has the address and data lines scrambled */ for (A = 0; A < 0x2000; A++) { j = BITSWAP16(A,15,14,13,9,7,5,3,1,12,10,8,6,4,2,0,11); rom[j] = BITSWAP8(buffer[A],2,7,4,1,6,3,0,5); } auto_free(machine(), buffer); }
static DRIVER_INIT( thndzone ) { const UINT8 *src = machine.region("gfx1")->base(); UINT8 *dst = machine.region("gfx2")->base(); UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx bank then the colours would be wrong). */ memcpy(tmp + 0x000000, dst + 0x80000, 0x80000); memcpy(dst + 0x090000, tmp + 0x00000, 0x80000); memcpy(dst + 0x080000, src + 0x00000, 0x10000); memcpy(dst + 0x110000, src + 0x10000, 0x10000); auto_free(machine, tmp); /* Save time waiting on vblank bit */ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3f8000, 0x3f8001, FUNC(thndzone_main_skip)); }
/* build a table to divide by the number of voices; gain is specified as gain*16 */ void flower_sound_device::make_mixer_table(int voices, int gain) { int count = voices * 128; /* allocate memory */ m_mixer_table = auto_alloc_array(machine(), INT16, 256 * voices); /* find the middle of the table */ m_mixer_lookup = m_mixer_table + (128 * voices); /* fill in the table - 16 bit case */ for (int i = 0; i < count; i++) { int val = i * gain * 16 / voices; if (val > 32767) val = 32767; m_mixer_lookup[ i] = val; m_mixer_lookup[-i] =-val; } }
static DRIVER_INIT( thndzone ) { const UINT8 *src = memory_region(machine, "gfx1"); UINT8 *dst = memory_region(machine, "gfx2"); UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx bank then the colours would be wrong). */ memcpy(tmp + 0x000000, dst + 0x80000, 0x80000); memcpy(dst + 0x090000, tmp + 0x00000, 0x80000); memcpy(dst + 0x080000, src + 0x00000, 0x10000); memcpy(dst + 0x110000, src + 0x10000, 0x10000); auto_free(machine, tmp); /* Save time waiting on vblank bit */ memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip); }
static void sdwx_gfx_decrypt(running_machine &machine) { int i; unsigned rom_size = 0x80000; UINT8 *src = (UINT8 *) (machine.root_device().memregion("gfx1")->base()); UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)]; for (i=0; i<rom_size; i+=0x200) { memcpy(src+i+0x000,result_data+i+0x000,0x80); memcpy(src+i+0x080,result_data+i+0x100,0x80); memcpy(src+i+0x100,result_data+i+0x080,0x80); memcpy(src+i+0x180,result_data+i+0x180,0x80); } auto_free(machine, result_data); }
void deco102_decrypt_cpu(running_machine &machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor) { int i; address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); UINT16 *rom = (UINT16 *)machine.root_device().memregion(cputag)->base(); int size = machine.root_device().memregion(cputag)->bytes(); UINT16 *opcodes = auto_alloc_array(machine, UINT16, size / 2); std::vector<UINT16> buf(size / 2); memcpy(&buf[0], rom, size); space.set_decrypted_region(0, size - 1, opcodes); ((m68000_base_device*)machine.device(cputag))->set_encrypted_opcode_range(0, size); for (i = 0; i < size / 2; i++) { int src; // calculate address of encrypted word in ROM src = i & 0xf0000; if (i & 0x0001) src ^= 0xbe0b; if (i & 0x0002) src ^= 0x5699; if (i & 0x0004) src ^= 0x1322; if (i & 0x0008) src ^= 0x0004; if (i & 0x0010) src ^= 0x08a0; if (i & 0x0020) src ^= 0x0089; if (i & 0x0040) src ^= 0x0408; if (i & 0x0080) src ^= 0x1212; if (i & 0x0100) src ^= 0x08e0; if (i & 0x0200) src ^= 0x5499; if (i & 0x0400) src ^= 0x9a8b; if (i & 0x0800) src ^= 0x1222; if (i & 0x1000) src ^= 0x1200; if (i & 0x2000) src ^= 0x0008; if (i & 0x4000) src ^= 0x1210; if (i & 0x8000) src ^= 0x00e0; src ^= address_xor; rom[i] = decrypt(buf[src], i, data_select_xor); opcodes[i] = decrypt(buf[src], i, opcode_select_xor); } }
void zeus2_device::device_start() { /* allocate memory for "wave" RAM */ waveram[0] = auto_alloc_array(machine(), UINT32, WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8/4); //waveram[1] = auto_alloc_array(machine(), UINT32, WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12/4); m_frameColor = std::make_unique<UINT32[]>(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 2); m_frameDepth = std::make_unique<UINT16[]>(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 2); /* initialize polygon engine */ poly = auto_alloc(machine(), zeus2_renderer(this)); //m_screen = machine().first_screen(); m_screen = downcast<screen_device *>(machine().device("screen")); m_vblank.resolve_safe(); m_irq.resolve_safe(); /* we need to cleanup on exit */ //machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(zeus2_device::exit_handler2), this)); int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::int_timer_callback), this)); vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); /* save states */ save_pointer(NAME(waveram[0]), WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8 / sizeof(waveram[0][0])); //save_pointer(NAME(waveram[1]), WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12 / sizeof(waveram[1][0])); save_pointer(m_frameColor.get(), "m_frameColor", sizeof(m_frameColor[0]) * WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 2); save_pointer(m_frameDepth.get(), "m_frameDepth", sizeof(m_frameDepth[0]) * WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 2); save_pointer(NAME(m_zeusbase), sizeof(m_zeusbase[0]) * 0x80); save_pointer(NAME(m_renderRegs), sizeof(m_renderRegs[0]) * 0x40); save_item(NAME(zeus_fifo)); save_item(NAME(zeus_fifo_words)); save_item(NAME(zeus_cliprect.min_x)); save_item(NAME(zeus_cliprect.max_x)); save_item(NAME(zeus_cliprect.min_y)); save_item(NAME(zeus_cliprect.max_y)); save_item(NAME(zeus_matrix)); save_item(NAME(zeus_point)); save_item(NAME(zeus_texbase)); save_item(NAME(m_fill_color)); save_item(NAME(m_fill_depth)); save_item(NAME(m_renderPtr)); }
void xtom3d_state::machine_start() { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x10000/4); m_bios_ext1_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext2_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext3_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_bios_ext4_ram = auto_alloc_array(machine(), UINT32, 0x4000/4); m_isa_ram1 = auto_alloc_array(machine(), UINT32, 0x4000/4); m_isa_ram2 = auto_alloc_array(machine(), UINT32, 0x4000/4); init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, xtom3d_set_keyb_int); m_maincpu->set_irq_acknowledge_callback(irq_callback); intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); }