ROM_END /* HSC 12/02/98 */ static int hiload(void) { static int firsttime =0; unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; if (firsttime == 0) { fast_memset(&RAM[0x4014],0xff,5); /* hi score */ fast_memset(&RAM[0x417d],0xff,12); /* name */ firsttime = 1; } /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0x4014],"\x00\x00\x00\x00\x00",5) == 0 && memcmp(&RAM[0x417f],"\x11\x12\x29\x1c\x0c\x18\x1b\x0e\x00\x00",10) == 0 ) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x4014],5); osd_fread(f,&RAM[0x417d],12); osd_fclose(f); } firsttime = 0; return 1; } else return 0; /* we can't load the hi scores yet */ }
ROM_END static int gsword_hiload(void) { /* get RAM pointer (this game is multiCPU, we can't assume the global */ /* RAM pointer is pointing to the right place) */ unsigned char *RAM = Machine->memory_region[0]; /* Work RAM - 9c00 (3*10 for scores), 9c78(6*10 for names)*/ /* check if the hi score table has already been initialized */ if( memcmp(&RAM[0x9c00],"\x00\x00\x01",3) == 0) { void *f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0); if (f) { osd_fread(f,&RAM[0x9c00],3*10); osd_fread(f,&RAM[0x9c78],6*10); osd_fclose(f); } return 1; } return 0; /* we can't load the hi scores yet */ }
ROM_END static int vanguard_hiload(void) /* V.V */ { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0x0025],"\x00\x10",2) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x0025],3); osd_fread(f,&RAM[0x0220],112); osd_fread(f,&RAM[0x02a0],16); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
/*************************************************************************** Game driver(s) ***************************************************************************/ ROM_START( arkanoi2_rom ) ROM_REGION(0x10000) /* Region 0 - main cpu */ ROM_LOAD( "a2-05.rom", 0x00000, 0x10000, 0x136edf9d ) ROM_REGION_DISPOSE(0x20000*4) /* Region 1 - temporary for gfx roms */ ROM_LOAD( "a2-m04.rom", 0x00000, 0x20000, 0x548117c6 ) /* btp 0 */ ROM_LOAD( "a2-m03.rom", 0x20000, 0x20000, 0x49a21c5e ) /* btp 1 */ ROM_LOAD( "a2-m02.bin", 0x40000, 0x20000, 0x056a985f ) /* btp 2 */ ROM_LOAD( "a2-m01.rom", 0x60000, 0x20000, 0x70cc559d ) /* btp 3 */ ROM_REGION(0x10000) /* Region 2 - sound cpu */ ROM_LOAD( "a2-13.rom", 0x00000, 0x10000, 0xe8035ef1 ) ROM_REGION(0x400) /* Region 3 - color proms */ ROM_LOAD( "b08-08.bin", 0x00000, 0x200, 0xa4f7ebd9 ) /* hi bytes */ ROM_LOAD( "b08-07.bin", 0x00200, 0x200, 0xea34d9f7 ) /* lo bytes */ ROM_END ROM_START( ark2us_rom ) ROM_REGION(0x10000) /* Region 0 - main cpu */ ROM_LOAD( "b08-11.bin", 0x00000, 0x10000, 0x99555231 ) ROM_REGION_DISPOSE(0x20000*4) /* Region 1 - temporary for gfx roms */ ROM_LOAD( "a2-m04.bin", 0x00000, 0x20000, 0x9754f703 ) /* btp 0 */ ROM_LOAD( "a2-m03.bin", 0x20000, 0x20000, 0x274a795f ) /* btp 1 */ ROM_LOAD( "a2-m02.bin", 0x40000, 0x20000, 0x056a985f ) /* btp 2 */ ROM_LOAD( "a2-m01.bin", 0x60000, 0x20000, 0x2ccc86b4 ) /* btp 3 */ ROM_REGION(0x10000) /* Region 2 - sound cpu */ ROM_LOAD( "b08-12.bin", 0x00000, 0x10000, 0xdc84e27d ) ROM_REGION(0x400) /* Region 3 - color proms */ ROM_LOAD( "b08-08.bin", 0x00000, 0x200, 0xa4f7ebd9 ) /* hi bytes */ ROM_LOAD( "b08-07.bin", 0x00200, 0x200, 0xea34d9f7 ) /* lo bytes */ ROM_END static int arkanoi2_hiload(void) { unsigned char *RAM = Machine->memory_region[0]; void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f, &RAM[0xe3a8], 3); osd_fclose(f); } /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0xeca5], "\x54\x4b\x4e\xff", 4) == 0 && memcmp(&RAM[0xec81], "\x01\x00\x00\x05", 4) == 0 ) { if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f, &RAM[0xec81], 8*5); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
static int jackrabt_hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if ((memcmp(&RAM[0x73ba],"\x0a\x0a\x0a",3) == 0) && (memcmp(&RAM[0x73c2],"\x0b\x0b\x0b",3) == 0)) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x73ba],8*6); osd_fread(f,&RAM[0x73ea],8*3); RAM[0x727d] = RAM[0x73ea]; RAM[0x727e] = RAM[0x73eb]; RAM[0x727f] = RAM[0x73ec]; osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
static int turtles_hiload(void) /* V.V */ { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* same as Amidar, but the high score table is initialized with zeros */ /* a working quick-and-dirty solution is to update the top high score */ /* and the whole table at different times */ /* further study of the game code may provide a cleaner solution */ static int first_pass = 0; static unsigned char top_score[] = { 0, 0, 0 }; if (first_pass == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,top_score,3); osd_fclose(f); } first_pass = 1; } if ((memcmp(&RAM[0x80A0],"\xc0\xc0\x00",3) == 0)) { RAM[0x80a8] = top_score[0]; RAM[0x80a9] = top_score[1]; RAM[0x80aa] = top_score[2]; return 0; } /* continuously updating top high score - really dirty solution */ else if (memcmp(&RAM[0x80A0],"\xc6\xc6\x00",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x8200],3*10); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
ROM_END static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if ((memcmp(&RAM[0x0308],"\x00\x00\x21",3) == 0) && (memcmp(&RAM[0x033C],"\x0C\x1D\x0C",3) == 0)) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x0308],11*5); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; if (memcmp(&RAM[0x2163],"CBR",3) == 0 && memcmp(&RAM[0x20A6],"\x01\x98\x30",3) == 0 && memcmp(&RAM[0x3627],"\x01",1) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x2160],0x32); RAM[0x20A6] = RAM[0x2160]; RAM[0x20A7] = RAM[0x2161]; RAM[0x20A8] = RAM[0x2162]; /* Copy high score to videoram */ RAM[0x35A7] = RAM[0x2162] & 0x0F; RAM[0x35C7] = (RAM[0x2162] & 0xF0) >> 4; RAM[0x35E7] = RAM[0x2161] & 0x0F; RAM[0x3607] = (RAM[0x2161] & 0xF0) >> 4; RAM[0x3627] = RAM[0x2160] & 0x0F; if ((RAM[0x2160] & 0xF0) != 0) RAM[0x3647] = (RAM[0x2160] & 0xF0) >> 4; osd_fclose(f); }
static void hs_load (void) { void *f = osd_fopen (Machine->gamedrv->name, 0, OSD_FILETYPE_HIGHSCORE, 0); state.hiscores_have_been_loaded = 1; LOG(("hs_load\n")); if (f) { struct mem_range *mem_range = state.mem_range; LOG(("loading...\n")); while (mem_range) { UINT8 *data = (UINT8*)malloc(mem_range->num_bytes); if (data) { /* this buffer will almost certainly be small enough to be dynamically allocated, but let's avoid memory trashing just in case */ osd_fread (f, data, mem_range->num_bytes); copy_to_memory (mem_range->cpu, mem_range->addr, data, mem_range->num_bytes); free(data); } mem_range = mem_range->next; } osd_fclose (f); } }
UINT32 mame_fread(mame_file *file, void *buffer, size_t length) { /* switch off the file type */ switch (file->type) { case PLAIN_FILE: return osd_fread(file->file, buffer, length); case ZIPPED_FILE: case RAM_FILE: if (file->data) { if (file->offset + length > file->length) { length = file->length - file->offset; file->eof = 1; } memcpy(buffer, file->data + file->offset, length); file->offset += length; return length; } break; } return 0; }
ROM_END static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0xe204],"\x02\x00\x00",3) == 0 && memcmp(&RAM[0xe244],"\x01\x02\x00",3) == 0 && memcmp(&RAM[0xe012],"\x6a\x81\x00",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0xe200],16*5); memcpy(&RAM[0xe1e0],&RAM[0xe200],8); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
static int maketrax_hiload(void) { static int resetcount; void *f; unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* during a reset, leave time to the game to clear the screen */ if (++resetcount < 60) return 0; /* wait for "HI SCORE" to be on screen */ if (memcmp(&RAM[0x43d0],"\x53\x40\x49\x48",4) == 0) { resetcount = 0; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x4E40],30); RAM[0x4c80] = RAM[0x4e43]; RAM[0x4c81] = RAM[0x4e44]; RAM[0x4c82] = RAM[0x4e45]; osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
/*************************************************************************** Game driver(s) ***************************************************************************/ ROM_START( kicker_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "kikrd8.bin", 0x6000, 0x2000, 0x2598dfdd ) ROM_LOAD( "kikrd9.bin", 0x8000, 0x4000, 0x0cf0351a ) ROM_LOAD( "kikrd11.bin", 0xC000, 0x4000, 0x654037f8 ) ROM_REGION_DISPOSE(0xc000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "kikra10.bin", 0x0000, 0x2000, 0x4d156afc ) ROM_LOAD( "kikra11.bin", 0x2000, 0x2000, 0xff6ca5df ) ROM_LOAD( "kikrh14.bin", 0x4000, 0x4000, 0xb94e645b ) ROM_LOAD( "kikrh13.bin", 0x8000, 0x4000, 0x61bbf797 ) ROM_REGION(0x0500) /* color proms */ ROM_LOAD( "kicker.a12", 0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */ ROM_LOAD( "kicker.a13", 0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */ ROM_LOAD( "kicker.a14", 0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */ ROM_LOAD( "kicker.b8", 0x0300, 0x0100, 0xaa900724 ) /* character lookup table */ ROM_LOAD( "kicker.f16", 0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */ ROM_END ROM_START( shaolins_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "kikrd8.bin", 0x6000, 0x2000, 0x2598dfdd ) ROM_LOAD( "kikrd9.bin", 0x8000, 0x4000, 0x0cf0351a ) ROM_LOAD( "kikrd11.bin", 0xC000, 0x4000, 0x654037f8 ) ROM_REGION_DISPOSE(0xc000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "shaolins.6", 0x0000, 0x2000, 0xff18a7ed ) ROM_LOAD( "shaolins.7", 0x2000, 0x2000, 0x5f53ae61 ) ROM_LOAD( "kikrh14.bin", 0x4000, 0x4000, 0xb94e645b ) ROM_LOAD( "kikrh13.bin", 0x8000, 0x4000, 0x61bbf797 ) ROM_REGION(0x0500) /* color proms */ ROM_LOAD( "kicker.a12", 0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */ ROM_LOAD( "kicker.a13", 0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */ ROM_LOAD( "kicker.a14", 0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */ ROM_LOAD( "kicker.b8", 0x0300, 0x0100, 0xaa900724 ) /* character lookup table */ ROM_LOAD( "kicker.f16", 0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */ ROM_END static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0x2b00],"\x1d\x2c\x1f\x01\x00",5) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x2b00],0x40); /* top score display */ fast_memcpy(&RAM[0x2af0], &RAM[0x2b04], 4); /* 1p score display, which also displays the top score on startup */ fast_memcpy(&RAM[0x2a81], &RAM[0x2b04], 4); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
ROM_END static int amidar_hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0x8200],"\x00\x00\x01",3) == 0 && memcmp(&RAM[0x821b],"\x00\x00\x01",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x8200],3*10); RAM[0x80a8] = RAM[0x8200]; RAM[0x80a9] = RAM[0x8201]; RAM[0x80aa] = RAM[0x8202]; osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
/* all the following are banked at 0x4000-0x5fff */ ROM_LOAD( "pl1-3", 0x10000, 0x4000, 0xaa9fa739 ) ROM_LOAD( "pl1-4", 0x14000, 0x4000, 0x2b895a90 ) ROM_LOAD( "pl1-5", 0x18000, 0x4000, 0x7af66200 ) ROM_LOAD( "pl1-6", 0x1c000, 0x4000, 0xb01e59a9 ) ROM_REGION_DISPOSE(0x20000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "pl1-12", 0x00000, 0x2000, 0xc159fbce ) /* chars */ ROM_LOAD( "pl1-13", 0x02000, 0x2000, 0x6c5ed9ae ) ROM_LOAD( "pl1-9", 0x10000, 0x4000, 0xf5d5962b ) /* sprites */ ROM_LOAD( "pl1-10", 0x14000, 0x4000, 0xc7cf1904 ) ROM_LOAD( "pl1-8", 0x18000, 0x4000, 0xa2ebfa4a ) ROM_LOAD( "pl1-11", 0x1c000, 0x4000, 0x6621361a ) ROM_REGION(0x1400) /* color PROMs */ ROM_LOAD( "pl1-2.bin", 0x0000, 0x0400, 0x472885de ) /* red and green component */ ROM_LOAD( "pl1-1.bin", 0x0400, 0x0400, 0xa78ebdaf ) /* blue component */ ROM_LOAD( "pl1-3.bin", 0x0800, 0x0400, 0x80558da8 ) /* sprites lookup table */ ROM_LOAD( "pl1-5.bin", 0x0c00, 0x0400, 0x4b7ee712 ) /* foreground lookup table */ ROM_LOAD( "pl1-4.bin", 0x1000, 0x0400, 0x3a7be418 ) /* background lookup table */ ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "pl1-7", 0x8000, 0x2000, 0x8c5becae ) /* sub program for the mcu */ ROM_LOAD( "pl1-mcu.bin", 0xf000, 0x1000, 0x6ef08fb3 ) /* microcontroller */ ROM_END static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; if (memcmp(&RAM[0x2140],"\x00\x08\x00",3) == 0 && memcmp(&RAM[0x02187],"\xE6\xE6\xE6",3) == 0 ) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x2140],74); RAM[0x205D] = RAM[0x2140]; RAM[0x205E] = RAM[0x2141]; RAM[0x205F] = RAM[0x2142]; osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
static int hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; static int resetcount; /* during a reset, leave time to the game to clear the screen */ if (++resetcount < 10) return 0; if(memcmp(&RAM[0x0240],"\x20\x31\x53",3) == 0 && memcmp(&RAM[0x028D],"\x00\x77\x00",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x0240],80); osd_fclose(f); } resetcount = 0; return 1; } else return 0; /* we can't load the hi scores yet */ }
static int kingofb_hiload(void) { unsigned char *RAM1 = Machine->memory_region[Machine->drv->cpu[0].memory_region]; unsigned char *RAM2 = Machine->memory_region[Machine->drv->cpu[1].memory_region]; if (memcmp(&RAM2[0x8048],"\x00\x15\x00",3) == 0 && memcmp(&RAM2[0x80D1],"\x10\x11\x12",3) == 0 && memcmp(&RAM1[0xc22b],"\x03\x00\x05\x00\x00\x00",6) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM2[0x8048],140); osd_fclose(f); RAM1[0xc22a]=(RAM2[0x8063] >> 4 ); RAM1[0xc22b]=(RAM2[0x8063] & 0x0f ); RAM1[0xc22c]=(RAM2[0x8064] >> 4 ); RAM1[0xc22d]=(RAM2[0x8064] & 0x0f ); }
/* 0x7000 -0x7fff empty for my convinience */ ROM_REGION(0x0200) /* color proms */ ROM_LOAD( "1b.vid", 0x0000, 0x0100, 0xa2f935aa ) /* palette low 4 bits */ ROM_LOAD( "1c.vid", 0x0100, 0x0100, 0xb95421f4 ) /* palette high 4 bits */ ROM_END ROM_START( hoccer_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "hr1.cpu", 0x0000, 0x2000, 0x12e96635 ) ROM_LOAD( "hr2.cpu", 0x2000, 0x2000, 0xcf1fc328 ) ROM_LOAD( "hr3.cpu", 0x4000, 0x2000, 0x048a0659 ) ROM_LOAD( "hr4.cpu", 0x6000, 0x2000, 0x9a788a2c ) ROM_REGION_DISPOSE(0x6000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "hr.d", 0x0000, 0x2000, 0xd33aa980 ) ROM_RELOAD( 0x2000, 0x2000 ) ROM_LOAD( "hr.c", 0x4000, 0x2000, 0x02808294 ) ROM_REGION(0x0200) /* color proms */ ROM_LOAD( "hr.1b", 0x0000, 0x0100, 0x896521d7 ) /* palette low 4 bits */ ROM_LOAD( "hr.1c", 0x0100, 0x0100, 0x2efdd70b ) /* palette high 4 bits */ ROM_END ROM_START( hoccer2_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "hr.1", 0x0000, 0x2000, 0x122d159f ) ROM_LOAD( "hr.2", 0x2000, 0x2000, 0x48e1efc0 ) ROM_LOAD( "hr.3", 0x4000, 0x2000, 0x4e67b0be ) ROM_LOAD( "hr.4", 0x6000, 0x2000, 0xd2b44f58 ) ROM_REGION_DISPOSE(0x6000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "hr.d", 0x0000, 0x2000, 0xd33aa980 ) ROM_RELOAD( 0x2000, 0x2000 ) ROM_LOAD( "hr.c", 0x4000, 0x2000, 0x02808294 ) ROM_REGION(0x0200) /* color proms */ ROM_LOAD( "hr.1b", 0x0000, 0x0100, 0x896521d7 ) /* palette low 4 bits */ ROM_LOAD( "hr.1c", 0x0100, 0x0100, 0x2efdd70b ) /* palette high 4 bits */ ROM_END ROM_START( wanted_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "prg-1", 0x0000, 0x2000, 0x2dd90aed ) ROM_LOAD( "prg-2", 0x2000, 0x2000, 0x67ac0210 ) ROM_LOAD( "prg-3", 0x4000, 0x2000, 0x373c7d82 ) ROM_REGION_DISPOSE(0x8000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "vram-1", 0x0000, 0x2000, 0xc4226e54 ) ROM_LOAD( "vram-2", 0x2000, 0x2000, 0x2a9b1e36 ) ROM_LOAD( "obj-a", 0x4000, 0x2000, 0x90b60771 ) ROM_LOAD( "obj-b", 0x6000, 0x2000, 0xe14ee689 ) ROM_REGION(0x0200) /* color proms */ ROM_LOAD( "wanted.k7", 0x0000, 0x0100, 0x2ba90a00 ) /* palette low 4 bits */ ROM_LOAD( "wanted.k6", 0x0100, 0x0100, 0xa93d87cc ) /* palette high 4 bits */ ROM_END ROM_START( hopprobo_rom ) ROM_REGION(0x10000) /* 64k for code */ ROM_LOAD( "hopper01.3k", 0x0000, 0x1000, 0xfd7935c0 ) ROM_LOAD( "hopper02.3l", 0x1000, 0x1000, 0xdf1a479a ) ROM_LOAD( "hopper03.3n", 0x2000, 0x1000, 0x097ac2a7 ) ROM_LOAD( "hopper04.3p", 0x3000, 0x1000, 0x0f4f3ca8 ) ROM_LOAD( "hopper05.3r", 0x4000, 0x1000, 0x9d77a37b ) ROM_REGION_DISPOSE(0x8000) /* temporary space for graphics (disposed after conversion) */ ROM_LOAD( "hopper06.5c", 0x0000, 0x2000, 0x68f79bc8 ) ROM_LOAD( "hopper07.5d", 0x2000, 0x1000, 0x33d82411 ) ROM_RELOAD( 0x3000, 0x1000 ) ROM_LOAD( "hopper08.6f", 0x4000, 0x2000, 0x06d37e64 ) ROM_LOAD( "hopper09.6k", 0x6000, 0x2000, 0x047921c7 ) ROM_REGION(0x0200) /* color proms */ ROM_LOAD( "7052hop.1b", 0x0000, 0x0100, 0x94450775 ) /* palette low 4 bits */ ROM_LOAD( "7052hop.1c", 0x0100, 0x0100, 0xa76bbd51 ) /* palette high 4 bits */ ROM_END static int wanted_hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0x81b4],"\x00\x03\x00",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x81b4], 16*5); /* HS table */ RAM[0x81b4] = RAM[0x81b4]; /* update high score */ RAM[0x81b5] = RAM[0x81b5]; /* on top of screen */ RAM[0x81b6] = RAM[0x81b6]; RAM[0x81b7] = RAM[0x81b7]; RAM[0x81b8] = RAM[0x81b8]; RAM[0x81b9] = RAM[0x81b9]; osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
/* Seek zip->fp to compressed data return: ==0 success <0 error */ int seekcompresszip(ZIP* zip, struct zipent* ent) { char buf[ZIPNAME]; long offset; if (!zip->fp) { if (!revivezip(zip)) return -1; } if (osd_fseek(zip->fp, ent->offset_lcl_hdr_frm_frst_disk, SEEK_SET)!=0) { errormsg ("Seeking to header", ERROR_CORRUPT, zip->zip); return -1; } if (osd_fread(zip->fp, buf, ZIPNAME)!=ZIPNAME) { errormsg ("Reading header", ERROR_CORRUPT, zip->zip); return -1; } { UINT16 filename_length = read_word (buf+ZIPFNLN); UINT16 extra_field_length = read_word (buf+ZIPXTRALN); /* calculate offset to data and osd_fseek() there */ offset = ent->offset_lcl_hdr_frm_frst_disk + ZIPNAME + filename_length + extra_field_length; if (osd_fseek(zip->fp, offset, SEEK_SET) != 0) { errormsg ("Seeking to compressed data", ERROR_CORRUPT, zip->zip); return -1; } } return 0; }
ROM_END /* Ten entries, 13 bytes each: 3 bytes - score/10 (BCD) 10 bytes - name (ASCII) */ static int galivan_hiload(void) { unsigned char *RAM = Machine->memory_region[0]; /* check if the high scores table has already been initialized */ if ((memcmp(&RAM[0xe14f], "\x00\x01\x50\x4B", 4) == 0)&& (memcmp(&RAM[0xe1cd], "\x54\x45\x52\x20", 4) == 0)) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f, &RAM[0xe14f], 13*10); osd_fclose(f); } return 1; } else return 0; /* we can't load the high scores yet */ }
void mixer_read_config(void *f) { UINT8 default_levels[MIXER_MAX_CHANNELS]; UINT8 mixing_levels[MIXER_MAX_CHANNELS]; int i; memset(default_levels, 0xff, sizeof(default_levels)); memset(mixing_levels, 0xff, sizeof(mixing_levels)); osd_fread(f, default_levels, MIXER_MAX_CHANNELS); osd_fread(f, mixing_levels, MIXER_MAX_CHANNELS); for (i = 0; i < MIXER_MAX_CHANNELS; i++) { config_default_mixing_level[i] = default_levels[i]; config_mixing_level[i] = mixing_levels[i]; } config_invalid = 0; }
static void nvram_handler(void *file, int read_or_write) { if (read_or_write) osd_fwrite(file, wms_cmos_ram, 0x4000); else if (file) osd_fread(file, wms_cmos_ram, 0x4000); else memset(wms_cmos_ram, 0, 0x4000); }
static void nvram_handler(void *file,int read_or_write) { if (read_or_write) osd_fwrite(file, nvram, nvram_size); else if (file) osd_fread(file, nvram, nvram_size); else memset(nvram, 0, nvram_size); }
static void berzerk_nvram_handler(void *file,int read_or_write) { if (read_or_write) osd_fwrite(file,nvram,nvram_size); else { if (file) osd_fread(file,nvram,nvram_size); } }
static void nvram_handler(void *file, int read_or_write) { if (read_or_write) osd_fwrite(file,eeprom,eeprom_size); else { if (file) osd_fread(file,eeprom,eeprom_size); else memset(eeprom,0,eeprom_size); } }
/* Read ecd data in zip structure in: zip->fp, zip->length zip file out: zip->ecd, zip->ecd_length ecd data */ static int ecd_read(ZIP* zip) { char* buf; int buf_length = 1024; /* initial buffer length */ while (1) { int offset; if (buf_length > zip->length) buf_length = zip->length; if (osd_fseek(zip->fp, zip->length - buf_length, SEEK_SET) != 0) { return -1; } /* allocate buffer */ buf = (char*)malloc( buf_length ); if (!buf) { return -1; } if (osd_fread( zip->fp, buf, buf_length ) != buf_length) { free(buf); return -1; } if (ecd_find_sig(buf, buf_length, &offset)) { zip->ecd_length = buf_length - offset; zip->ecd = (char*)malloc( zip->ecd_length ); if (!zip->ecd) { free(buf); return -1; } memcpy(zip->ecd, buf + offset, zip->ecd_length); free(buf); return 0; } free(buf); if (buf_length < zip->length) { /* double buffer */ buf_length = 2*buf_length; logerror("Retry reading of zip ecd for %d bytes\n",buf_length); } else { return -1; } } }
/* Read compressed data out: data compressed data read return: ==0 success <0 error */ int readcompresszip(ZIP* zip, struct zipent* ent, char* data) { int err = seekcompresszip(zip,ent); if (err!=0) return err; if (osd_fread(zip->fp, data, ent->compressed_size)!=ent->compressed_size) { errormsg ("Reading compressed data", ERROR_CORRUPT, zip->zip); return -1; } return 0; }
void foodf_nvram_handler(void *file,int read_or_write) { if (read_or_write) osd_fwrite(file,nvram,128); else { if (file) osd_fread(file,nvram,128); else memset(nvram,0xff,128); } }
static int gemini_hiload(void) { unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; /* check if the hi score table has already been initialized */ if (memcmp(&RAM[0xc026],"\x00\x50\x00",3) == 0) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0xc026],3); osd_fread(f,&RAM[0xcf41],3*10+4*10); osd_fclose(f); } return 1; } else return 0; /* we can't load the hi scores yet */ }
ROM_END static int novram_load(void) { unsigned char *RAM = Machine->memory_region[0]; void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) { osd_fread(f,&RAM[0x1200],256); osd_fclose(f); } return 1; }