📄 kchamp.c
字号:
ROM_LOAD( "bs04", 0x10000, 0x2000, 0x7346db8a ) /* top, plane1 */ /* sprites */
ROM_LOAD( "bs10", 0x12000, 0x2000, 0xb78714fc ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "bs05", 0x14000, 0x2000, 0xb2557102 ) /* top, plane1 */ /* sprites */
ROM_LOAD( "bs11", 0x16000, 0x2000, 0xc85aba0e ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "bs12", 0x18000, 0x2000, 0x4c574ecd ) /* plane0 */ /* tiles */
ROM_LOAD( "bs13", 0x1A000, 0x2000, 0x750b66af ) /* plane0 */ /* tiles */
ROM_LOAD( "bs14", 0x1C000, 0x2000, 0x9ad6227c ) /* plane1 */ /* tiles */
ROM_LOAD( "bs15", 0x1E000, 0x2000, 0x3b6d5de5 ) /* plane1 */ /* tiles */
ROM_REGION(0x0300) /* color proms */
ROM_LOAD( "br27", 0x0000, 0x0100, 0xf683c54a ) /* red */
ROM_LOAD( "br26", 0x0100, 0x0100, 0x3ddbb6c4 ) /* green */
ROM_LOAD( "br25", 0x0200, 0x0100, 0xba4a5651 ) /* blue */
ROM_REGION(0x10000) /* Sound CPU */ /* 64k for code */
ROM_LOAD( "bs18", 0x0000, 0x2000, 0xeaa646eb )
ROM_LOAD( "bs17", 0x2000, 0x2000, 0xd71031ad ) /* adpcm */
ROM_LOAD( "bs16", 0x4000, 0x2000, 0x6f811c43 ) /* adpcm */
ROM_END
ROM_START( karatedo_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "br24", 0x0000, 0x2000, 0xea9cda49 )
ROM_LOAD( "br23", 0x2000, 0x2000, 0x46074489 )
ROM_LOAD( "br22", 0x4000, 0x2000, 0x294f67ba )
ROM_LOAD( "br21", 0x6000, 0x2000, 0x934ea874 )
ROM_LOAD( "br20", 0x8000, 0x2000, 0x97d7816a )
ROM_LOAD( "br19", 0xa000, 0x4000, 0xdd2239d2 )
ROM_REGION_DISPOSE(0x20000)
ROM_LOAD( "br00", 0x00000, 0x2000, 0xc46a8b88 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "br06", 0x02000, 0x2000, 0xcf8982ff ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "bs01", 0x04000, 0x2000, 0xb4842ea9 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "bs07", 0x06000, 0x2000, 0x8cd166a5 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "bs02", 0x08000, 0x2000, 0x4cbd3aa3 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "bs08", 0x0A000, 0x2000, 0x6be342a6 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "br03", 0x0C000, 0x2000, 0xbde8a52b ) /* top, plane1 */ /* sprites */
ROM_LOAD( "br09", 0x0E000, 0x2000, 0xe9a5f945 ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "bs04", 0x10000, 0x2000, 0x7346db8a ) /* top, plane1 */ /* sprites */
ROM_LOAD( "bs10", 0x12000, 0x2000, 0xb78714fc ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "bs05", 0x14000, 0x2000, 0xb2557102 ) /* top, plane1 */ /* sprites */
ROM_LOAD( "bs11", 0x16000, 0x2000, 0xc85aba0e ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "br12", 0x18000, 0x2000, 0x9ed6f00d ) /* plane0 */ /* tiles */
ROM_LOAD( "bs13", 0x1A000, 0x2000, 0x750b66af ) /* plane0 */ /* tiles */
ROM_LOAD( "br14", 0x1C000, 0x2000, 0xfc399229 ) /* plane1 */ /* tiles */
ROM_LOAD( "bs15", 0x1E000, 0x2000, 0x3b6d5de5 ) /* plane1 */ /* tiles */
ROM_REGION(0x0300) /* color proms */
ROM_LOAD( "br27", 0x0000, 0x0100, 0xf683c54a ) /* red */
ROM_LOAD( "br26", 0x0100, 0x0100, 0x3ddbb6c4 ) /* green */
ROM_LOAD( "br25", 0x0200, 0x0100, 0xba4a5651 ) /* blue */
ROM_REGION(0x10000) /* Sound CPU */ /* 64k for code */
ROM_LOAD( "br18", 0x0000, 0x2000, 0x00ccb8ea )
ROM_LOAD( "bs17", 0x2000, 0x2000, 0xd71031ad ) /* adpcm */
ROM_LOAD( "br16", 0x4000, 0x2000, 0x2512d961 ) /* adpcm */
ROM_END
/********************
* 1 Player Version *
********************/
ROM_START( kchamp_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "B014.BIN", 0x0000, 0x2000, 0x0000d1a0 )
ROM_LOAD( "B015.BIN", 0x2000, 0x2000, 0x03fae67e )
ROM_LOAD( "B016.BIN", 0x4000, 0x2000, 0x3b6e1d08 )
ROM_LOAD( "B017.BIN", 0x6000, 0x2000, 0xc1848d1a )
ROM_LOAD( "B018.BIN", 0x8000, 0x2000, 0xb824abc7 )
ROM_LOAD( "B019.BIN", 0xa000, 0x2000, 0x3b487a46 )
ROM_REGION_DISPOSE(0x20000)
ROM_LOAD( "B013.BIN", 0x00000, 0x2000, 0xeaad4168 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "B004.BIN", 0x02000, 0x2000, 0x10a47e2d ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "B012.BIN", 0x04000, 0x2000, 0xb4842ea9 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "B003.BIN", 0x06000, 0x2000, 0x8cd166a5 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "B011.BIN", 0x08000, 0x2000, 0x4cbd3aa3 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "B002.BIN", 0x0A000, 0x2000, 0x6be342a6 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "B007.BIN", 0x0C000, 0x2000, 0xcb91d16b ) /* top, plane1 */ /* sprites */
ROM_LOAD( "B010.BIN", 0x0E000, 0x2000, 0x489c9c04 ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "B006.BIN", 0x10000, 0x2000, 0x7346db8a ) /* top, plane1 */ /* sprites */
ROM_LOAD( "B009.BIN", 0x12000, 0x2000, 0xb78714fc ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "B005.BIN", 0x14000, 0x2000, 0xb2557102 ) /* top, plane1 */ /* sprites */
ROM_LOAD( "B008.BIN", 0x16000, 0x2000, 0xc85aba0e ) /* bot, plane1 */ /* sprites */
ROM_LOAD( "B000.BIN", 0x18000, 0x2000, 0xa4fa98a1 ) /* plane0 */ /* tiles */
ROM_LOAD( "B001.BIN", 0x1C000, 0x2000, 0xfea09f7c ) /* plane1 */ /* tiles */
ROM_REGION(0x0300) /* color proms */
ROM_LOAD( "BR27", 0x0000, 0x0100, 0xf683c54a ) /* red */
ROM_LOAD( "BR26", 0x0100, 0x0100, 0x3ddbb6c4 ) /* green */
ROM_LOAD( "BR25", 0x0200, 0x0100, 0xba4a5651 ) /* blue */
ROM_REGION(0x10000) /* Sound CPU */ /* 64k for code */
ROM_LOAD( "B026.BIN", 0x0000, 0x2000, 0x999ed2c7 )
ROM_LOAD( "B025.BIN", 0x2000, 0x2000, 0x33171e07 ) /* adpcm */
ROM_LOAD( "B024.BIN", 0x4000, 0x2000, 0x910b48b9 ) /* adpcm */
ROM_LOAD( "B023.BIN", 0x6000, 0x2000, 0x47f66aac )
ROM_LOAD( "B022.BIN", 0x8000, 0x2000, 0x5928e749 )
ROM_LOAD( "B021.BIN", 0xa000, 0x2000, 0xca17e3ba )
ROM_LOAD( "B020.BIN", 0xc000, 0x2000, 0xada4f2cd )
ROM_END
static void kchamp_decode( void ) {
/*
Encryption consists of data lines scrambling
bits have to be converted from 67852341 to 87654321
Notice that the very first 2 opcodes that the program
executes aint encrypted for some obscure reason.
*/
static int encrypt_table_hi[] = {
0x00, 0x10, 0x80, 0x90, 0x40, 0x50, 0xC0, 0xD0,
0x20, 0x30, 0xA0, 0xB0, 0x60, 0x70, 0xE0, 0xF0
};
static int encrypt_table_lo[] = {
0x00, 0x01, 0x08, 0x09, 0x04, 0x05, 0x0C, 0x0D,
0x02, 0x03, 0x0A, 0x0B, 0x06, 0x07, 0x0E, 0x0F
};
unsigned char *RAM = Machine->memory_region[0];
int A;
for (A = 1;A < 0xE000;A++)
ROM[A] = ( encrypt_table_hi[RAM[A] >> 4] ) | encrypt_table_lo[RAM[A] & 0x0f];
/* Move the upper part of bs19 into $e000 */
for (A = 0xC000;A < 0xE000;A++) {
ROM[A+0x2000] = ( encrypt_table_hi[RAM[A] >> 4] ) | encrypt_table_lo[RAM[A] & 0x0f];
RAM[A+0x2000] = RAM[A];
}
}
static void kchampvs_decode( void ) {
unsigned char *RAM = Machine ->memory_region[0];
ROM[0] = RAM[0];
RAM[1] = 0x6e;
RAM[2] = 0xb4;
kchamp_decode();
}
static void karatedo_decode( void ){
unsigned char *RAM = Machine ->memory_region[0];
ROM[0] = RAM[0];
RAM[1] = 0x5f;
RAM[2] = 0xb4;
kchamp_decode();
}
static int kchampvs_hiload(void)
{
unsigned char *RAM = Machine->memory_region[0];
void *f;
/* Wait for hiscore table initialization to be done. */
if ( RAM[0xc0a8] != 0x2f )
return 0;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) {
/* Load and set hiscore table. */
osd_fread(f,&RAM[0xc040],0x6f);
RAM[0xc0c0] = RAM[0xc040];
RAM[0xc0c1] = RAM[0xc041];
RAM[0xc0c2] = RAM[0xc042];
osd_fclose(f);
}
return 1;
}
static void kchampvs_hisave(void)
{
unsigned char *RAM = Machine->memory_region[0];
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0) {
/* Write hiscore table. */
osd_fwrite(f,&RAM[0xc040],0x6f);
osd_fclose(f);
}
}
/********************
* 1 Player Version *
********************/
static int kchamp_hiload(void)
{
unsigned char *RAM = Machine->memory_region[0];
void *f;
/* Wait for hiscore table initialization to be done. */
if ( RAM[0xc0ab] != 0x01 )
return 0;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0) {
/* Load and set hiscore table. */
osd_fread(f,&RAM[0xc040],0x6c);
RAM[0xc0c0] = RAM[0xc040];
RAM[0xc0c1] = RAM[0xc041];
RAM[0xc0c2] = RAM[0xc042];
osd_fclose(f);
}
return 1;
}
static void kchamp_hisave(void)
{
unsigned char *RAM = Machine->memory_region[0];
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0) {
/* Write hiscore table. */
osd_fwrite(f,&RAM[0xc040],0x6c);
osd_fclose(f);
}
}
struct GameDriver kchamp_driver =
{
__FILE__,
0,
"kchamp",
"Karate Champ",
"1984",
"Data East USA",
"Ernesto Corvi\nGareth Hall\nCarlos Lozano\nHowie Cohen\nFrank Palazzolo",
0,
&kchamp_machine_driver,
0,
kchamp_rom,
0, 0,
0,
0,
kc_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
kchamp_hiload, kchamp_hisave
};
struct GameDriver kchampvs_driver =
{
__FILE__,
0,
"kchampvs",
"Karate Champ (VS version)",
"1984",
"Data East USA",
"Ernesto Corvi\nGareth Hall\nCarlos Lozano\nHowie Cohen\nFrank Palazzolo",
0,
&kchampvs_machine_driver,
0,
kchampvs_rom,
0, kchampvs_decode,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
kchampvs_hiload, kchampvs_hisave
};
struct GameDriver karatedo_driver =
{
__FILE__,
&kchampvs_driver,
"karatedo",
"Taisen Karate Dou (VS version)",
"1984",
"Data East Corporation",
"Ernesto Corvi\nGareth Hall\nCarlos Lozano\nHowie Cohen\nFrank Palazzolo",
0,
&kchampvs_machine_driver,
0,
karatedo_rom,
0, karatedo_decode,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
kchampvs_hiload, kchampvs_hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -