Previous 15994 Revisions Next

r9837 Tuesday 28th December, 2010 at 12:03:03 UTC by Robbbert
[JUPITER] Set CPU registers when loading ACE file. More games work.
[src/mess/drivers]jupiter.c
[src/mess/machine]jupiter.c

src/mess/machine/jupiter.c
r9836r9837
88***************************************************************************/
99
1010#include "emu.h"
11#include "cpu/z80/z80.h"
1112#include "devices/snapquik.h"
1213#include "includes/jupiter.h"
1314
r9836r9837
1718   and compressed as follows:
1819
1920   ED 00        : End marker
20   ED 01 ED     : 0xED
21   ED <cnt> <byt>   : repeat <byt> count <cnt:3-240> times
21   ED <cnt> <byt>   : repeat <byt> count <cnt:1-240> times
2222   <byt>        : <byt>
2323*/
2424
r9836r9837
2929
3030SNAPSHOT_LOAD(jupiter)
3131{
32   UINT8 *RAM = memory_region(image.device().machine, "maincpu");
33   running_device *cpu = image.device().machine->device("maincpu");
3234   address_space *space = cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM);
3335   unsigned char jupiter_repeat, jupiter_byte, loop;
3436   int done=0, jupiter_index=0x2000;
r9836r9837
5557               break;
5658         case 0x01:
5759               image.fread(&jupiter_byte, 1);
58               space->write_byte(jupiter_index++, jupiter_byte);
60               RAM[jupiter_index++] = jupiter_byte;
5961               break;
60         case 0x02:
61               logerror("Sequence 0xED 0x02 found in .ace file\r\n");
62               break;
6362         default:
6463               image.fread(&jupiter_repeat, 1);
6564               for (loop = 0; loop < jupiter_byte; loop++)
66                  space->write_byte(jupiter_index++, jupiter_repeat);
65                  RAM[jupiter_index++] = jupiter_repeat;
6766               break;
6867         }
6968      }
7069      else
71         space->write_byte(jupiter_index++, jupiter_byte);
70         RAM[jupiter_index++] = jupiter_byte;
7271   }
7372
7473   logerror("Decoded %X bytes.\r\n", jupiter_index-0x2000);
r9836r9837
8079      return IMAGE_INIT_FAIL;
8180   }
8281
82   /* patch CPU registers */
83   cpu_set_reg(cpu, Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8));
84   cpu_set_reg(cpu, Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8));
85   cpu_set_reg(cpu, Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8));
86   cpu_set_reg(cpu, Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8));
87   cpu_set_reg(cpu, Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8));
88   cpu_set_reg(cpu, Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8));
89   cpu_set_reg(cpu, STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8));
90   cpu_set_reg(cpu, STATE_GENPC, RAM[0x211c] | (RAM[0x211d] << 8));
91   cpu_set_reg(cpu, Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8));
92   cpu_set_reg(cpu, Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8));
93   cpu_set_reg(cpu, Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8));
94   cpu_set_reg(cpu, Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8));
95   cpu_set_reg(cpu, Z80_IM, RAM[0x2130]);
96   cpu_set_reg(cpu, Z80_IFF1, RAM[0x2134]);
97   cpu_set_reg(cpu, Z80_IFF2, RAM[0x2138]);
98   cpu_set_reg(cpu, Z80_I, RAM[0x213c]);
99   cpu_set_reg(cpu, Z80_R, RAM[0x2140]);
100
101   /* Copy data to the address space */
102   for (jupiter_index = 0x2000; jupiter_index < 0x8000; jupiter_index++)
103      space->write_byte(jupiter_index, RAM[jupiter_index]);
104
83105   return IMAGE_INIT_PASS;
84106}
85107
src/mess/drivers/jupiter.c
r9836r9837
5050static ADDRESS_MAP_START( jupiter_mem , ADDRESS_SPACE_PROGRAM, 8)
5151   AM_RANGE(0x0000, 0x1fff) AM_ROM
5252   AM_RANGE(0x2400, 0x27ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(jupiter_state, videoram)
53   AM_RANGE(0x2c00, 0x2fff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(jupiter_state, charram) AM_REGION("maincpu", 0x2c00)
53   AM_RANGE(0x2c00, 0x2fff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(jupiter_state, charram) AM_REGION("maincpu", 0xfc00)
5454   AM_RANGE(0x3c00, 0x3fff) AM_MIRROR(0x0c00) AM_RAM
5555   AM_RANGE(0x4000, 0xffff) AM_RAM_WRITE( jupiter_expram_w ) AM_BASE_MEMBER(jupiter_state, expram) /* Expansion RAM */
5656ADDRESS_MAP_END
r9836r9837
219219
220220
221221static GFXDECODE_START( jupiter )
222   GFXDECODE_ENTRY( "maincpu", 0x2c00, jupiter_charlayout, 0, 1 )
222   GFXDECODE_ENTRY( "maincpu", 0xfc00, jupiter_charlayout, 0, 1 )
223223GFXDECODE_END
224224
225225

Previous 15994 Revisions Next


© 1998-2018 The MESS Team