From e31ada08d65ba1509f823e243c26415f23e530c1 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 2 Jul 2009 15:58:31 +0000 Subject: [PATCH] Fixed BCD issues in Denjin Makai by porting the (unused) Raiden 2 code, don't want credit (guess that was from OG?) --- src/mame/machine/seicop.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c index 472ee85b575..a9e61e7ec7f 100644 --- a/src/mame/machine/seicop.c +++ b/src/mame/machine/seicop.c @@ -148,7 +148,7 @@ static UINT8 dma_status; static UINT32 dma_src; static UINT16 prot_data[2],dma_size; /*Number protection*//*Heated Barrel,SD Gundam,Godzilla,Denjin Makai*/ -static UINT32 prot_bcd[4]; +//static UINT32 prot_bcd[4]; /*Hit check protection*//*Legionnaire,Heated Barrel,SD Gundam*/ static UINT8 xy_check; @@ -166,6 +166,7 @@ static UINT8 xy_check; flip_screen_set(space->machine, _flip_); \ } \ +#if 0 /*TODO: numbers over 65535?*/ static UINT32 protection_bcd_jsr(UINT16 prot_data) { @@ -173,6 +174,9 @@ static UINT32 protection_bcd_jsr(UINT16 prot_data) res = 0; bcd_data = prot_data; + + popmessage("%08x",bcd_data); + while(bcd_data > 0) { if(bcd_data > 999) @@ -199,6 +203,7 @@ static UINT32 protection_bcd_jsr(UINT16 prot_data) return res & 0x0f0f0f0f; } +#endif /*TODO: -move x-axis limits,to calculate basing on the screen xy-axis values*/ /* -the second value should be end of calculation (in other words,check everything between the two values) */ @@ -1126,6 +1131,7 @@ static READ16_HANDLER( generic_cop_r ) return retvalue; /* BCD protection reads */ + #if 0 case (0x190/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } case (0x192/2): { return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; } case (0x194/2): { return ((prot_bcd[1] & 0x0000ffff) >> 0 ) + 0x3030; } @@ -1133,13 +1139,14 @@ static READ16_HANDLER( generic_cop_r ) case (0x198/2): { return ((prot_bcd[2] & 0x0000ffff) >> 0 ) + 0x3030; } case (0x19a/2): { return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; } case (0x19c/2): { return 0x3030; } - - + #endif } } static WRITE16_HANDLER( generic_cop_w ) { + static UINT32 temp32; + switch (offset) { default: @@ -1147,9 +1154,16 @@ static WRITE16_HANDLER( generic_cop_w ) break; /* BCD Protection */ - case (0x020/2): { prot_bcd[0] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } - case (0x022/2): { prot_bcd[1] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } - case (0x024/2): { prot_bcd[2] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } + case (0x020/2): + case (0x022/2): + case (0x024/2): + temp32 = (cop_mcu_ram[0x020/2]) | (cop_mcu_ram[0x022/2] << 16); + cop_mcu_ram[0x190/2] = (((temp32 / 1) % 10) + (((temp32 / 10) % 10) << 8) + 0x3030); + cop_mcu_ram[0x192/2] = (((temp32 / 100) % 10) + (((temp32 / 1000) % 10) << 8) + 0x3030); + cop_mcu_ram[0x194/2] = (((temp32 / 10000) % 10) + (((temp32 / 100000) % 10) << 8) + 0x3030); + cop_mcu_ram[0x196/2] = (((temp32 / 1000000) % 10) + (((temp32 / 10000000) % 10) << 8) + 0x3030); + cop_mcu_ram[0x198/2] = (((temp32 / 100000000) % 10) + (((temp32 / 1000000000) % 10) << 8) + 0x3030); + break; /* Command tables for 0x500 / 0x502 commands */ case (0x032/2): { copd2_set_tabledata(space->machine, data); break; }