h8: PC and CCR are packed into one longword. Fixes coinmvga games. [O. Galibert, R. Belmont]

This commit is contained in:
R. Belmont 2013-02-22 02:12:04 +00:00
parent ffa0f7b714
commit c46b63f218
3 changed files with 7 additions and 31 deletions

View File

@ -312,10 +312,7 @@ static void h8_GenException(h83xx_state *h8, UINT8 vectornr)
// push PC on stack
// extended mode stack push!
h8_setreg32(h8, H8_SP, h8_getreg32(h8, H8_SP)-4);
h8_mem_write32(h8, h8_getreg32(h8, H8_SP), h8->pc);
// push ccr
h8_setreg32(h8, H8_SP, h8_getreg32(h8, H8_SP)-2);
h8_mem_write16(h8, h8_getreg32(h8, H8_SP), h8_get_ccr(h8));
h8_mem_write32(h8, h8_getreg32(h8, H8_SP), h8->pc | (h8_get_ccr(h8)<<24));
// generate address from vector
h8_set_ccr(h8, h8_get_ccr(h8) | 0x80);

View File

@ -1652,13 +1652,13 @@ static void h8_group5(h83xx_state *h8, UINT16 opcode)
// rte
if(opcode == 0x5670)
{
// restore CCR
udata8 = (UINT8)h8_mem_read16(h8, h8_getreg32(h8, H8_SP));
h8_setreg32(h8, H8_SP, h8_getreg32(h8, H8_SP)+2);
// check if PC is 16 or 24/32 bits wide
if (h8->mode_8bit)
{
// restore CCR
udata8 = (UINT8)h8_mem_read16(h8, h8_getreg32(h8, H8_SP));
h8_setreg32(h8, H8_SP, h8_getreg32(h8, H8_SP)+2);
udata16 = h8_mem_read16(h8, h8_getreg16(h8, H8_SP));
h8_setreg16(h8, H8_SP, h8_getreg16(h8, H8_SP)+2);
@ -1672,6 +1672,8 @@ static void h8_group5(h83xx_state *h8, UINT16 opcode)
// extended mode
h8->pc = udata32 & H8_ADDR_MASK;
udata8 = (udata32>>24) & 0xff;
}
// must do this last, because set_ccr() does a check_irq()
h8_set_ccr(h8, udata8);

View File

@ -875,33 +875,10 @@ ROM_END
DRIVER_INIT_MEMBER(coinmvga_state,colorama)
{
UINT16 *ROM;
ROM = (UINT16 *)memregion("maincpu")->base();
// rte in non-irq routines? wtf? patch them to rts...
ROM[0x02B476/2] = 0x5470;
ROM[0x02AE3A/2] = 0x5470;
ROM[0x02A9FC/2] = 0x5470;
ROM[0x02AA3A/2] = 0x5470;
ROM[0x02729e/2] = 0x5470;
ROM[0x029fb4/2] = 0x5470;
ROM[0x02a224/2] = 0x5470;
ROM[0x02a94e/2] = 0x5470;
}
DRIVER_INIT_MEMBER(coinmvga_state,cmrltv75)
{
UINT16 *ROM;
ROM = (UINT16 *)memregion("maincpu")->base();
// rte in non-irq routines? wtf? patch them to rts...
ROM[0x056fd6/2] = 0x5470;
ROM[0x05655c/2] = 0x5470;
ROM[0x05659a/2] = 0x5470;
ROM[0x05699a/2] = 0x5470;
//...
}