src/mess/machine/jupiter.c
| r9836 | r9837 | |
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "emu.h" |
| 11 | #include "cpu/z80/z80.h" |
| 11 | 12 | #include "devices/snapquik.h" |
| 12 | 13 | #include "includes/jupiter.h" |
| 13 | 14 | |
| r9836 | r9837 | |
| 17 | 18 | and compressed as follows: |
| 18 | 19 | |
| 19 | 20 | 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 |
| 22 | 22 | <byt> : <byt> |
| 23 | 23 | */ |
| 24 | 24 | |
| r9836 | r9837 | |
| 29 | 29 | |
| 30 | 30 | SNAPSHOT_LOAD(jupiter) |
| 31 | 31 | { |
| 32 | UINT8 *RAM = memory_region(image.device().machine, "maincpu"); |
| 33 | running_device *cpu = image.device().machine->device("maincpu"); |
| 32 | 34 | address_space *space = cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 33 | 35 | unsigned char jupiter_repeat, jupiter_byte, loop; |
| 34 | 36 | int done=0, jupiter_index=0x2000; |
| r9836 | r9837 | |
| 55 | 57 | break; |
| 56 | 58 | case 0x01: |
| 57 | 59 | image.fread(&jupiter_byte, 1); |
| 58 | | space->write_byte(jupiter_index++, jupiter_byte); |
| 60 | RAM[jupiter_index++] = jupiter_byte; |
| 59 | 61 | break; |
| 60 | | case 0x02: |
| 61 | | logerror("Sequence 0xED 0x02 found in .ace file\r\n"); |
| 62 | | break; |
| 63 | 62 | default: |
| 64 | 63 | image.fread(&jupiter_repeat, 1); |
| 65 | 64 | for (loop = 0; loop < jupiter_byte; loop++) |
| 66 | | space->write_byte(jupiter_index++, jupiter_repeat); |
| 65 | RAM[jupiter_index++] = jupiter_repeat; |
| 67 | 66 | break; |
| 68 | 67 | } |
| 69 | 68 | } |
| 70 | 69 | else |
| 71 | | space->write_byte(jupiter_index++, jupiter_byte); |
| 70 | RAM[jupiter_index++] = jupiter_byte; |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | 73 | logerror("Decoded %X bytes.\r\n", jupiter_index-0x2000); |
| r9836 | r9837 | |
| 80 | 79 | return IMAGE_INIT_FAIL; |
| 81 | 80 | } |
| 82 | 81 | |
| 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 | |
| 83 | 105 | return IMAGE_INIT_PASS; |
| 84 | 106 | } |
| 85 | 107 | |
src/mess/drivers/jupiter.c
| r9836 | r9837 | |
| 50 | 50 | static ADDRESS_MAP_START( jupiter_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 51 | 51 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 52 | 52 | 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) |
| 54 | 54 | AM_RANGE(0x3c00, 0x3fff) AM_MIRROR(0x0c00) AM_RAM |
| 55 | 55 | AM_RANGE(0x4000, 0xffff) AM_RAM_WRITE( jupiter_expram_w ) AM_BASE_MEMBER(jupiter_state, expram) /* Expansion RAM */ |
| 56 | 56 | ADDRESS_MAP_END |
| r9836 | r9837 | |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | static GFXDECODE_START( jupiter ) |
| 222 | | GFXDECODE_ENTRY( "maincpu", 0x2c00, jupiter_charlayout, 0, 1 ) |
| 222 | GFXDECODE_ENTRY( "maincpu", 0xfc00, jupiter_charlayout, 0, 1 ) |
| 223 | 223 | GFXDECODE_END |
| 224 | 224 | |
| 225 | 225 | |