diff options
author | 2018-10-24 17:29:13 +1100 | |
---|---|---|
committer | 2018-10-24 17:29:13 +1100 | |
commit | ada980907de21955e2dfb38c481d1d7e9518a250 (patch) | |
tree | 56ba3aaab8acf06f37fd8d058b50f8aadbad27db | |
parent | bcb672ce32cbd74c0ccd5dc4fa2138cb3f54a9bb (diff) |
gamecom improvements
- Henry works now
- Fixed dma regression
- Improved logging of unknown opcodes
-rw-r--r-- | src/devices/cpu/sm8500/sm85ops.h | 38 | ||||
-rw-r--r-- | src/mame/drivers/gamecom.cpp | 15 | ||||
-rw-r--r-- | src/mame/machine/gamecom.cpp | 7 |
3 files changed, 39 insertions, 21 deletions
diff --git a/src/devices/cpu/sm8500/sm85ops.h b/src/devices/cpu/sm8500/sm85ops.h index 7b934837bd6..37cddbe6513 100644 --- a/src/devices/cpu/sm8500/sm85ops.h +++ b/src/devices/cpu/sm8500/sm85ops.h @@ -903,7 +903,7 @@ case 0x2C: /* EXTS Rr - 6 cycles - Flags affected: -------- */ mycycles += 6; break; case 0x2D: /* unk2D - 4 cycles */ -logerror( "%04X: unk%02x\n", m_PC-1,op ); + logerror( "%04X: unk%02x\n", m_PC-1,op ); mycycles += 4; break; case 0x2E: /* MOV PS0,#00 - 4 cycles - Flags affected: -------- */ @@ -1054,7 +1054,7 @@ case 0x3C: /* MOVW RRr,RRs - 7 cycles - Flags affected: -------- */ mycycles += 7; break; case 0x3D: /* unk3D DM??? 3D 0E -> DM R0Eh ?? - 4,4 cycles */ -logerror( "%04X: unk%02x\n", m_PC-1,op ); + logerror( "%04X: unk%02x\n", m_PC-1,op ); mycycles += 4; break; case 0x3E: /* JMP RRr/@ww/ww(RRr) - 7/15/19 cycles - Flags affected: -------- */ @@ -1149,6 +1149,7 @@ case 0x4B: /* MOVW RRr,ww - 9 cycles - Flags affected: -------- */ case 0x4C: /* MULT Rrr,Rs - 24 cycles - Flags affected: -Z-0---- */ // operation is not known if r1 is odd, assuming same as even for now ARG_RR; + if (r1 & 1) logerror( "%04X: %02x odd register used\n", m_PC-1,op ); res = mem_readbyte( r1 | 1 ) * mem_readbyte( r2 ); mem_writeword( r1 & 0xfe, res & 0xFFFF ); m_PS1 = m_PS1 & ~ ( FLAG_Z | FLAG_V ); @@ -1158,6 +1159,7 @@ case 0x4C: /* MULT Rrr,Rs - 24 cycles - Flags affected: -Z-0---- */ case 0x4D: /* MULT RRr,i - 24 cycles - Flags affected: -Z-0---- */ // operation is not known if r1 is odd, assuming same as even for now ARG_iR; + if (r1 & 1) logerror( "%04X: %02x odd register used\n", m_PC-1,op ); res = mem_readbyte( r1 | 1 ) * r2; mem_writeword( r1 & 0xfe, res & 0xFFFF ); m_PS1 = m_PS1 & ~ ( FLAG_Z | FLAG_V ); @@ -1165,6 +1167,7 @@ case 0x4D: /* MULT RRr,i - 24 cycles - Flags affected: -Z-0---- */ mycycles += 24; break; case 0x4E: /* BMOV Rr,#b,BF/BF,Rr,#b - 6 cycles - Flags affected: --------/-Z-0--B- */ + // unconfirmed if V or Z are affected. It seems no games depend on it. r2 = mem_readbyte( m_PC++ ); r1 = mem_readbyte( m_PC++ ); switch( r2 & 0xC0 ) { @@ -1192,6 +1195,7 @@ case 0x4E: /* BMOV Rr,#b,BF/BF,Rr,#b - 6 cycles - Flags affected: --------/-Z-0 mycycles += 6; break; case 0x4F: /* BCMP/BAND/BOR/BXOR BF,Rr,#b - 6 cycles - Flags affected: -Z-0---- / -Z-0--B- */ + // unconfirmed if V or Z are affected. It seems no games depend on it. r2 = mem_readbyte( m_PC++ ); r1 = mem_readbyte( m_PC++ ); s1 = mem_readbyte( r1 ) & ( 1 << ( r2 & 0x07 ) ); @@ -1271,7 +1275,7 @@ case 0x58: /* MOV Rr,i - 6 cycles - Flags affected: -------- */ mycycles += 6; break; case 0x59: /* Invalid - 2? cycles - Flags affected: --------? */ - logerror( "%04X: 59h: Invalid instruction\n", m_PC-1 ); + logerror( "%04X: unk%02x\n", m_PC-1,op ); mycycles += 2; break; case 0x5A: /* unk5A - 7,8,12,9,8 cycles */ @@ -1285,24 +1289,34 @@ case 0x5A: /* unk5A - 7,8,12,9,8 cycles */ Arcade Classics) uses it at 6DC9. */ ARG_iR; s2 = mem_readbyte(r2); - logerror( "%04X: unk%02x (cmp r%02X->(%02X)->%02X to %02X)\n", - m_PC-3,op,r2,s2,mem_readbyte(s2),r1 ); + logerror( "%04X: unk%02x (cmp r%02X->(%02X)->%02X to %02X)\n", m_PC-3,op,r2,s2,mem_readbyte(s2),r1 ); OP_CMP8( mem_readbyte(s2), r1 ); mycycles += 7; break; case 0x5B: /* unk5B - 6,7,11,8,7 cycles */ - logerror( "%04X: unk%02x\n", m_PC-1,op ); -/* NOTE: This unknown command is used in several carts, the code below allows those carts to boot */ +/* NOTE: This unknown command appears to have several variants, but all the games that use it only + use one specific instruction. We code for that here, and log anything else that may turn up. + It appears to move a literal to a register pointed to by another register. + Example: + move r02, E9 + unk 5b 42 00 (move 00 into register E9, then increment r02) +*/ ARG_iR; - r1 = r2 & 7; - res = mem_readbyte( r1 ) + 1; - mem_writebyte( r1, res ); + if (r2 == 0x42) // only code used is 5B 42 00. This code allows those games to boot. + { // MOV (Rr)+,i -- or maybe -- AND (Rr)+,i + s1 = r2 & 7; + res = mem_readbyte( s1 ); + mem_writebyte( res, r1 ); + mem_writebyte( s1, res + 1 ); + } + else + logerror( "%04X: unk%02X %02X %02X\n", m_PC-1,op,r2,r1 ); + mycycles += 6; break; case 0x5C: /* DIV RRr,RRs - 47 cycles - Flags affected: -Z-V---- */ /* lower 8 bits of RRs is used to divide */ /* remainder in stored upper 8 bits of RRs */ -// logerror( "%04X: DIV RRr,Rs!\n", m_PC-1 ); ARG_RR; m_PS1 = m_PS1 & ~ ( FLAG_Z | FLAG_V ); s1 = mem_readbyte( r2 + 1 ); @@ -1647,6 +1661,7 @@ case 0xF0: /* STOP - 2 cycles - Flags affected: -------- */ /* TODO: Add a bunch of additional cycles */ m_clock_changed = 0; } + logerror( "%04X: unk%02x\n", m_PC-1,op ); break; case 0xF1: /* HALT - 2 cycles - Flags affected: -------- */ m_halted = 1; @@ -1658,6 +1673,7 @@ case 0xF4: case 0xF5: case 0xF6: case 0xF7: + logerror( "%04X: unk%02x\n", m_PC-1,op ); mycycles += 2; break; case 0xF8: /* RET - 10,8 cycles - Flags affected: -------- */ diff --git a/src/mame/drivers/gamecom.cpp b/src/mame/drivers/gamecom.cpp index afc4175eec9..8bd6c52c96c 100644 --- a/src/mame/drivers/gamecom.cpp +++ b/src/mame/drivers/gamecom.cpp @@ -10,16 +10,21 @@ Todo: - RS232 port - Sound ports 1,2 do not sound anything like the real thing - Sound port 3 (noise channel) -- Sound dac port (mostly works but is the wrong speed in some places) +- Sound dac port (mostly works but is the wrong speed in some places). + dac pitch is controlled by how often TIM1_INT occurs. This same + interrupt also controls the seconds countdown in some games, such as + Quiz Wiz and Scrabble. Currently this countdown goes twice as fast + as it should. If the INT is slowed down to compensate, the dac sound + is so slow as to be unintelligible. Need to find a way to keep both happy. +- System seems slower than it should. Probably wrong cycle count in the CPU. + What we have there is a guess as the real info has not been found. + -speed 1.2 makes the sound more natural + -speed 1.7 if TIM1_INT is slowed to fix the countdown. Game Status: - Inbuilt ROM and PDA functions all work - Due to an irritating message, the NVRAM is commented out in the machine config - All carts appear to work except: -- - Henry: misbehaviour just after "HENRY" button clicked. -- --- You can still click where the invisible HENRY button is, and have one - turn. After that, it's game over, and you can't play any more until - you cold boot the emulation. - - Lost World: freeze just after entering Stage 2 (the nest). - --- If you do nothing it freezes at the point where the stegasaurus should turn around. So, straight away start moving to the right diff --git a/src/mame/machine/gamecom.cpp b/src/mame/machine/gamecom.cpp index 231227c3a19..48f08ee9d59 100644 --- a/src/mame/machine/gamecom.cpp +++ b/src/mame/machine/gamecom.cpp @@ -397,7 +397,7 @@ WRITE8_MEMBER( gamecom_state::gamecom_internal_w ) break; case SM8521_SGDA: m_sound.sgda = data; - if((m_sound.sgc & 0x88) == 0x88) + if((m_sound.sgc & 0x8f) == 0x88) m_dac->write(data); break; @@ -538,10 +538,7 @@ WRITE8_MEMBER( gamecom_state::gamecom_handle_dma ) // Get 4 pixels and remove the one about to be replaced u8 other_pixels = m_dma.dest_bank[dst_addr] & ~(3 << dst_adj); // Get palette of new pixel and place into the hole - if (m_dma.transfer_mode == 6 || m_dma.transfer_mode == 0) - m_dma.dest_bank[dst_addr] = other_pixels | (source_pixel << dst_adj); - else - m_dma.dest_bank[dst_addr] = other_pixels | (((m_dma.palette >> (source_pixel << 1)) & 3) << dst_adj); + m_dma.dest_bank[dst_addr] = other_pixels | (((m_dma.palette >> (source_pixel << 1)) & 3) << dst_adj); } /* Advance a pixel */ |