void nvram_save(running_machine &machine) { if (machine.config().m_nvram_handler != NULL) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE) { (*machine.config().m_nvram_handler)(machine, &file, TRUE); file.close(); } } nvram_interface_iterator iter(machine.root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next()) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) { nvram->nvram_save(file); file.close(); } } }
void nvram_load(running_machine &machine) { if (machine.config().m_nvram_handler != NULL) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); if (file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE) { (*machine.config().m_nvram_handler)(machine, &file, FALSE); file.close(); } else { (*machine.config().m_nvram_handler)(machine, NULL, FALSE); } } nvram_interface_iterator iter(machine.root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next()) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) { nvram->nvram_load(file); file.close(); } else nvram->nvram_reset(); } }
ROM_END /*************************************************************************** Split even/odd bytes from ROMs in 16 bit mode to different memory areas ***************************************************************************/ static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ) { int i; /* get a pointer to the source data */ UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); /* get a pointer to the destination data */ UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); /* fill destination areas with the proper data */ for (i = 0; i < length / 2; i++) { dst[dest1 + i] = src[start + i * 2 + 0]; dst[dest2 + i] = src[start + i * 2 + 1]; } }
static void decode_bg(running_machine &machine, const char * region) { tceptor_state *state = machine.driver_data<tceptor_state>(); static const gfx_layout bg_layout = { 8, 8, 2048, 3, { 0x40000+4, 0, 4 }, { 0, 1, 2, 3, 8, 9, 10, 11 }, { 0, 16, 32, 48, 64, 80, 96, 112 }, 128 }; int gfx_index = state->m_bg; UINT8 *src = machine.root_device().memregion(region)->base() + 0x8000; UINT8 *buffer; int len = 0x8000; int i; buffer = auto_alloc_array(machine, UINT8, len); /* expand rom tc2-19.10d */ for (i = 0; i < len / 2; i++) { buffer[i*2+1] = src[i] & 0x0f; buffer[i*2] = (src[i] & 0xf0) >> 4; } memcpy(src, buffer, len); auto_free(machine, buffer); /* decode the graphics */ machine.gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, machine.root_device().memregion(region)->base(), 64, 2048); }
static void smpc_mouse(running_machine &machine, UINT8 pad_num, UINT8 offset, UINT8 id) { saturn_state *state = machine.driver_data<saturn_state>(); static const char *const mousenames[2][3] = { { "MOUSEB1", "MOUSEX1", "MOUSEY1" }, { "MOUSEB2", "MOUSEX2", "MOUSEY2" }}; UINT8 mouse_ctrl; INT16 mouse_x, mouse_y; mouse_ctrl = machine.root_device().ioport(mousenames[pad_num][0])->read(); mouse_x = machine.root_device().ioport(mousenames[pad_num][1])->read(); mouse_y = machine.root_device().ioport(mousenames[pad_num][2])->read(); if(mouse_x < 0) mouse_ctrl |= 0x10; if(mouse_y < 0) mouse_ctrl |= 0x20; if((mouse_x & 0xff00) != 0xff00 && (mouse_x & 0xff00) != 0x0000) mouse_ctrl |= 0x40; if((mouse_y & 0xff00) != 0xff00 && (mouse_y & 0xff00) != 0x0000) mouse_ctrl |= 0x80; state->m_smpc.OREG[0+pad_num*offset] = 0xf1; state->m_smpc.OREG[1+pad_num*offset] = id; // 0x23 / 0xe3 state->m_smpc.OREG[2+pad_num*offset] = mouse_ctrl; state->m_smpc.OREG[3+pad_num*offset] = mouse_x & 0xff; state->m_smpc.OREG[4+pad_num*offset] = mouse_y & 0xff; }
static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state) { // count the palette devices state.palette.devcount = palette_device_iterator(machine.root_device()).count(); // set the pointer to the first palette if (state.palette.devcount > 0) palette_set_device(machine, state); // count the gfx devices state.gfxset.devcount = 0; for (device_gfx_interface &interface : gfx_interface_iterator(machine.root_device())) { // count the gfx sets in each device, skipping devices with none UINT8 count = 0; while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr) count++; // count = index of first nullptr if (count > 0) { state.gfxdev[state.gfxset.devcount].interface = &interface; state.gfxdev[state.gfxset.devcount].setcount = count; if (++state.gfxset.devcount == MAX_GFX_DECODERS) break; } } state.started = true; }
static void arcadia_init(running_machine &machine) { arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>(); static const amiga_machine_interface arcadia_intf = { ANGUS_CHIP_RAM_MASK, NULL, NULL, NULL, NULL, NULL, arcadia_reset_coins, NULL, 0 }; UINT16 *biosrom; /* configure our Amiga setup */ amiga_machine_config(machine, &arcadia_intf); /* set up memory */ state->membank("bank1")->configure_entry(0, state->m_chip_ram); state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base()); /* OnePlay bios is encrypted, TenPlay is not */ biosrom = (UINT16 *)machine.root_device().memregion("user2")->base(); if (biosrom[0] != 0x4afc) generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); }
/* This is based on code by Niclas Karlsson Mate, who figured out the encryption method! The technique is a combination of a XOR table plus bit-swapping */ static void common_decrypt(running_machine &machine) { UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base(); int i; for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x0f]; data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0); RAM[0xc0000/2 + i] = data; } RAM = (UINT16 *)machine.root_device().memregion("sub")->base(); for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x07]; data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6); RAM[0xc0000/2 + i] = data; } }
// ROM_REGION( 0x80, "user1", 0 ) /* eeprom */ // ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) ) ROM_END /**********************************************************************************/ static void descramble_sound( running_machine &machine, const char *tag ) { UINT8 *rom = machine.root_device().memregion(tag)->base(); int length = machine.root_device().memregion(tag)->bytes(); UINT8 *buf1 = auto_alloc_array(machine, UINT8, length); UINT32 x; for (x = 0; x < length; x++) { UINT32 addr; addr = BITSWAP24 (x,23,22,21,0, 20, 19,18,17,16, 15,14,13,12, 11,10,9, 8, 7, 6, 5, 4, 3, 2, 1 ); buf1[addr] = rom[x]; } memcpy(rom,buf1,length); auto_free(machine, buf1); }
void deco156_decrypt(running_machine &machine) { uint32_t *rom = (uint32_t *)machine.root_device().memregion("maincpu")->base(); int length = machine.root_device().memregion("maincpu")->bytes(); std::vector<uint32_t> buf(length/4); memcpy(&buf[0], rom, length); decrypt(&buf[0], rom, length); }
void deco156_decrypt(running_machine &machine) { UINT32 *rom = (UINT32 *)machine.root_device().memregion("maincpu")->base(); int length = machine.root_device().memregion("maincpu")->bytes(); UINT32 *buf = auto_alloc_array(machine, UINT32, length/4); memcpy(buf, rom, length); decrypt(buf, rom, length); auto_free(machine, buf); }
INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *y) { static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; const rectangle &visarea = machine.primary_screen->visible_area(); int width = visarea.width(); int height = visarea.height(); *x = ((machine.root_device().ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255; *y = ((machine.root_device().ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255; }
static void set_videorom_bank(running_machine& machine, int start, int count, int bank, int bank_size_in_kb) { int i; int offset = bank * (bank_size_in_kb * 0x400); /* bank_size_in_kb is used to determine how large the "bank" parameter is */ /* count determines the size of the area mapped in KB */ for (i = 0; i < count; i++, offset += 0x400) { machine.root_device().membank(banknames[i + start])->set_base(machine.root_device().memregion("gfx1")->base() + offset); } }
UINT16 pb1000_state::read_touchscreen(running_machine &machine, UINT8 line) { UINT8 x = machine.root_device().ioport("POSX")->read()/0x40; UINT8 y = machine.root_device().ioport("POSY")->read()/0x40; if (machine.root_device().ioport("TOUCH")->read()) { if (x == line-7) return (0x1000<<y); } return 0x0000; }
static UINT16 amiga_read_joy1dat(running_machine &machine) { if ( machine.root_device().ioport("input")->read() & 0x10 ) { /* Joystick */ return machine.root_device().ioport("JOY1DAT")->read_safe(0xffff); } else { /* Mouse */ int input; input = ( machine.root_device().ioport("P1MOUSEX")->read() & 0xff ); input |= ( machine.root_device().ioport("P1MOUSEY")->read() & 0xff ) << 8; return input; } }
// fix sprite order static void decode_sprite32(running_machine &machine, const char * region) { tceptor_state *state = machine.driver_data<tceptor_state>(); static const gfx_layout spr32_layout = { 32, 32, 1024, 4, { 0x000000, 0x000004, 0x200000, 0x200004 }, { 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, 4*8, 4*8+1, 4*8+2, 4*8+3, 5*8, 5*8+1, 5*8+2, 5*8+3, 6*8, 6*8+1, 6*8+2, 6*8+3, 7*8, 7*8+1, 7*8+2, 7*8+3 }, { 0*2*32, 1*2*32, 2*2*32, 3*2*32, 4*2*32, 5*2*32, 6*2*32, 7*2*32, 8*2*32, 9*2*32, 10*2*32, 11*2*32, 12*2*32, 13*2*32, 14*2*32, 15*2*32, 16*2*32, 17*2*32, 18*2*32, 19*2*32, 20*2*32, 21*2*32, 22*2*32, 23*2*32, 24*2*32, 25*2*32, 26*2*32, 27*2*32, 28*2*32, 29*2*32, 30*2*32, 31*2*32 }, 2*32*32 }; UINT8 *src = machine.root_device().memregion(region)->base(); int len = machine.root_device().memregion(region)->bytes(); int total = spr32_layout.total; int size = spr32_layout.charincrement / 8; UINT8 *dst; int i; dst = auto_alloc_array(machine, UINT8, len); memset(dst, 0, len); for (i = 0; i < total; i++) { int code; code = (i & 0x07f) | ((i & 0x180) << 1) | 0x80; code &= ~((i & 0x200) >> 2); memcpy(&dst[size * (i + 0)], &src[size * (code + 0)], size); memcpy(&dst[size * (i + total)], &src[size * (code + total)], size); } decode_sprite(machine, state->m_sprite32, &spr32_layout, dst); }
void nvram_load(running_machine &machine) { int overrideNVram = 0; if(netCommon) { if(nvram_size(machine)>=32*1024*1024) { overrideNVram=1; ui_popup_time(3, "The NVRAM for this game is too big, not loading NVRAM."); } } if (machine.config().m_nvram_handler != NULL) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); if (!overrideNVram && file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE) { (*machine.config().m_nvram_handler)(machine, &file, FALSE); file.close(); } else { (*machine.config().m_nvram_handler)(machine, NULL, FALSE); } } nvram_interface_iterator iter(machine.root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next()) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) { astring filename; emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); if (!overrideNVram && file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE) { nvram->nvram_load(file); file.close(); } else { nvram->nvram_reset(); } } else nvram->nvram_reset(); } }
void favorite_manager::apply_running_machine(running_machine &machine, T &&action) { bool done(false); // TODO: this should be changed - it interacts poorly with cartslots on arcade systems if ((machine.system().flags & machine_flags::MASK_TYPE) == machine_flags::TYPE_ARCADE) { action(machine.system(), nullptr, nullptr, done); } else { bool have_software(false); for (device_image_interface &image_dev : image_interface_iterator(machine.root_device())) { software_info const *const sw(image_dev.software_entry()); if (image_dev.exists() && image_dev.loaded_through_softlist() && sw) { assert(image_dev.software_list_name()); have_software = true; action(machine.system(), &image_dev, sw, done); if (done) return; } } if (!have_software) action(machine.system(), nullptr, nullptr, done); } }
void image_postdevice_init(running_machine &machine) { /* make sure that any required devices have been allocated */ image_interface_iterator iter(machine.root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { int result = image->finish_load(); /* did the image load fail? */ if (result) { /* retrieve image error message */ astring image_err = astring(image->error()); /* unload all images */ image_unload_all(machine); fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load failed: %s", image->device().name(), image_err.cstr()); } } /* add a callback for when we shut down */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_unload_all), &machine)); }
machine_info::machine_info(running_machine &machine) : m_machine(machine) { // calculate "has..." values m_has_configs = false; m_has_analog = false; m_has_dips = false; m_has_bioses = false; // scan the input port array to see what options we need to enable for (auto &port : machine.ioport().ports()) for (ioport_field &field : port.second->fields()) { if (field.type() == IPT_DIPSWITCH) m_has_dips = true; if (field.type() == IPT_CONFIG) m_has_configs = true; if (field.is_analog()) m_has_analog = true; } for (device_t &device : device_iterator(machine.root_device())) for (const rom_entry &rom : device.rom_region_vector()) if (ROMENTRY_ISSYSTEM_BIOS(&rom)) { m_has_bioses = true; break; } }
void a600xl_mmu(running_machine &machine, UINT8 new_mmu) { /* check if self-test ROM changed */ if ( new_mmu & 0x80 ) { logerror("%s MMU SELFTEST RAM\n", machine.system().name); machine.device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x5000, 0x57ff); } else { logerror("%s MMU SELFTEST ROM\n", machine.system().name); machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2"); machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5000, 0x57ff); machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5000); } }
ROM_END static void pgm_create_dummy_internal_arm_region(running_machine &machine) { UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("maincpu")->base(); // fill with RX 14 int i; for (i=0;i<0x4000/2;i+=2) { temp16[i] = 0xff1e; temp16[i+1] = 0xe12f; } // jump straight to external area temp16[(0x0000)/2] = 0xd088; temp16[(0x0002)/2] = 0xe59f; temp16[(0x0004)/2] = 0x0680; temp16[(0x0006)/2] = 0xe3a0; temp16[(0x0008)/2] = 0xff10; temp16[(0x000a)/2] = 0xe12f; temp16[(0x0090)/2] = 0x0400; temp16[(0x0092)/2] = 0x1000; }
ROM_END /************************************* * * Generic driver init * *************************************/ static void alg_init(running_machine &machine) { alg_state *state = machine.driver_data<alg_state>(); static const amiga_machine_interface alg_intf = { ANGUS_CHIP_RAM_MASK, NULL, NULL, alg_potgo_w, serial_w, vsync_callback, NULL, NULL, 0 }; amiga_machine_config(machine, &alg_intf); /* set up memory */ state->membank("bank1")->configure_entry(0, state->m_chip_ram); state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base()); }
void ui_menu_image_info::image_info_astring(running_machine &machine, astring &string) { string.printf("%s\n\n", machine.system().description); #if 0 if (mess_ram_size > 0) { char buf2[RAM_STRING_BUFLEN]; string.catprintf("RAM: %s\n\n", ram_string(buf2, mess_ram_size)); } #endif image_interface_iterator iter(machine.root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { const char *name = image->filename(); if (name != NULL) { const char *base_filename; const char *info; char *base_filename_noextension; base_filename = image->basename(); base_filename_noextension = strip_extension(base_filename); // display device type and filename string.catprintf("%s: %s\n", image->device().name(), base_filename); // display long filename, if present and doesn't correspond to name info = image->longname(); if (info && (!base_filename_noextension || core_stricmp(info, base_filename_noextension))) string.catprintf("%s\n", info); // display manufacturer, if available info = image->manufacturer(); if (info != NULL) { string.catprintf("%s", info); info = stripspace(image->year()); if (info && *info) string.catprintf(", %s", info); string.catprintf("\n"); } // display supported information, if available switch(image->supported()) { case SOFTWARE_SUPPORTED_NO : string.catprintf("Not supported\n"); break; case SOFTWARE_SUPPORTED_PARTIAL : string.catprintf("Partially supported\n"); break; default : break; } if (base_filename_noextension != NULL) free(base_filename_noextension); } else { string.catprintf("%s: ---\n", image->device().name()); } } }
static void gaelco2_ROM16_split_gfx(running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2) { int i; /* get a pointer to the source data */ UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); /* get a pointer to the destination data */ UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); /* fill destination areas with the proper data */ for (i = 0; i < length/2; i++){ dst[dest1 + i] = src[start + i*2 + 0]; dst[dest2 + i] = src[start + i*2 + 1]; } }
static void image_dirs_load(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; const char *dev_instance; const char *working_directory; if ((config_type == CONFIG_TYPE_GAME) && (parentnode != NULL)) { for (node = xml_get_sibling(parentnode->child, "device"); node; node = xml_get_sibling(node->next, "device")) { dev_instance = xml_get_attribute_string(node, "instance", NULL); if ((dev_instance != NULL) && (dev_instance[0] != '\0')) { image_interface_iterator iter(machine.root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { if (!strcmp(dev_instance, image->instance_name())) { working_directory = xml_get_attribute_string(node, "directory", NULL); if (working_directory != NULL) image->set_working_directory(working_directory); } } } } } }
static void ssystem3_playfield_read(running_machine &machine, int *on, int *ready) { //ssystem3_state *state = machine.driver_data<ssystem3_state>(); *on=!(machine.root_device().ioport("Configuration")->read()&1); // *on=!state->m_playfield.on; *ready=FALSE; }
UINT8 read_input_matrix(running_machine &machine, int row) { static const char *const portnames[16] = { "IN-0", "IN-1", "IN-2", "IN-3", "IN-4", "IN-5", "IN-6", "IN-7", "IN-8", "IN-9", "IN-A", "IN-B" }; UINT8 value; if (row<4) { value = (machine.root_device().ioport(portnames[row])->read_safe(0x00) & 0x1f) + ((machine.root_device().ioport(portnames[row+8])->read_safe(0x00) & 0x07) << 5); } else { value = (machine.root_device().ioport(portnames[row])->read_safe(0x00) & 0x1f) + ((machine.root_device().ioport(portnames[row+4])->read_safe(0x00) & 0x18) << 2); } return value; }
static UINT8 amspdwy_wheel_r( running_machine &machine, int index ) { amspdwy_state *state = machine.driver_data<amspdwy_state>(); static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" }; UINT8 wheel = machine.root_device().ioport(portnames[2 + index])->read(); if (wheel != state->m_wheel_old[index]) { wheel = (wheel & 0x7fff) - (wheel & 0x8000); if (wheel > state->m_wheel_old[index]) state->m_wheel_return[index] = ((+wheel) & 0xf) | 0x00; else state->m_wheel_return[index] = ((-wheel) & 0xf) | 0x10; state->m_wheel_old[index] = wheel; } return state->m_wheel_return[index] | machine.root_device().ioport(portnames[index])->read(); }
static void deco_decrypt(running_machine &machine,const char *rgntag,const UINT8 *xor_table,const UINT16 *address_table,const UINT8 *swap_table,int remap_only) { UINT16 *rom = (UINT16 *)machine.root_device().memregion(rgntag)->base(); int len = machine.root_device().memregion(rgntag)->bytes()/2; std::vector<UINT16> buffer(len); int i; /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) rom[i] = BIG_ENDIANIZE_INT16(rom[i]); memcpy(&buffer[0],rom,len*2); for (i = 0;i < len;i++) { int addr = (i & ~0x7ff) | address_table[i & 0x7ff]; int pat = swap_table[i & 0x7ff]; if (remap_only) rom[i] = buffer[addr]; else rom[i] = BITSWAP16(buffer[addr] ^ xor_masks[xor_table[addr & 0x7ff]], swap_patterns[pat][0], swap_patterns[pat][1], swap_patterns[pat][2], swap_patterns[pat][3], swap_patterns[pat][4], swap_patterns[pat][5], swap_patterns[pat][6], swap_patterns[pat][7], swap_patterns[pat][8], swap_patterns[pat][9], swap_patterns[pat][10], swap_patterns[pat][11], swap_patterns[pat][12], swap_patterns[pat][13], swap_patterns[pat][14], swap_patterns[pat][15]); } /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) for (i = 0;i < len;i++) rom[i] = BIG_ENDIANIZE_INT16(rom[i]); }