src/mess/drivers/socrates.c
| r5313 | r5314 | |
| 98 | 98 | |
| 99 | 99 | /* Devices */ |
| 100 | 100 | |
| 101 | /* stuff below belongs in machine/socrates.c */ |
| 102 | static struct |
| 103 | { |
| 104 | UINT8 data[8]; |
| 105 | UINT8 rom_bank; |
| 106 | } socrates={ {0}}; |
| 101 | 107 | |
| 108 | static void socrates_set_rom_bank( running_machine *machine ) |
| 109 | { |
| 110 | memory_set_bankptr( machine, 1, memory_region(machine, "maincpu") + ( socrates.rom_bank * 0x4000 )); |
| 111 | } |
| 112 | |
| 113 | MACHINE_RESET( socrates ) |
| 114 | { |
| 115 | socrates.rom_bank = 0; // actually set semi-randomly on real console but we need to initialize it somewhere... |
| 116 | socrates_set_rom_bank( machine ); |
| 117 | // ram bank should also be zeroed here; the actual console sets it semi randomly on power up, and the bios cleans it up. |
| 118 | } |
| 119 | |
| 120 | READ8_HANDLER( socrates_rom_bank_r ) |
| 121 | { |
| 122 | UINT8 data = 0xFF; |
| 123 | data = socrates.rom_bank; |
| 124 | return data; |
| 125 | } |
| 126 | |
| 127 | WRITE8_HANDLER( socrates_rom_bank_w ) |
| 128 | { |
| 129 | socrates.rom_bank = data; |
| 130 | socrates_set_rom_bank( space->machine ); |
| 131 | } |
| 132 | |
| 102 | 133 | /****************************************************************************** |
| 103 | 134 | Address Maps |
| 104 | 135 | ******************************************************************************/ |
| r5313 | r5314 | |
| 106 | 137 | static ADDRESS_MAP_START(z80_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 107 | 138 | ADDRESS_MAP_UNMAP_HIGH |
| 108 | 139 | AM_RANGE(0x0000, 0x3fff) AM_ROM /* system rom, bank 0 (fixed) */ |
| 109 | | AM_RANGE(0x4000, 0x7fff) AM_NOP /* banked rom space; system rom is banks 0 thru F, cartridge rom is banks 10 onward, usually banks 10 thru 17. area past the end of the cartridge, and the whole 10-ff area when no cartridge is inserted, reads as 0xF3 */ |
| 140 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) /* banked rom space; system rom is banks 0 thru F, cartridge rom is banks 10 onward, usually banks 10 thru 17. area past the end of the cartridge, and the whole 10-ff area when no cartridge is inserted, reads as 0xF3 */ |
| 110 | 141 | AM_RANGE(0x8000, 0xbfff) AM_RAM /* banked ram 'window' 0 */ |
| 111 | 142 | AM_RANGE(0xc000, 0xffff) AM_RAM /* banked ram 'window' 1 */ |
| 112 | 143 | ADDRESS_MAP_END |
| 113 | 144 | |
| 114 | 145 | static ADDRESS_MAP_START(z80_io, ADDRESS_SPACE_IO, 8) |
| 115 | 146 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 116 | | AM_RANGE(0x00, 0x00) AM_RAM AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */ |
| 147 | AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */ |
| 117 | 148 | AM_RANGE(0x08, 0x08) AM_RAM AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */ |
| 118 | 149 | AM_RANGE(0x10, 0x17) AM_NOP AM_MIRROR (0x8) /* sound section: |
| 119 | 150 | 0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low, write 0 to silence |
| r5313 | r5314 | |
| 151 | 182 | MDRV_CPU_PROGRAM_MAP(z80_mem) |
| 152 | 183 | MDRV_CPU_IO_MAP(z80_io) |
| 153 | 184 | MDRV_QUANTUM_TIME(HZ(60)) |
| 185 | MDRV_MACHINE_RESET(socrates) |
| 154 | 186 | |
| 155 | 187 | /* video hardware */ |
| 156 | 188 | MDRV_DEFAULT_LAYOUT(layout_socrates) |
| 157 | 189 | |
| 158 | 190 | /* sound hardware */ |
| 159 | 191 | //MDRV_SPEAKER_STANDARD_MONO("mono") |
| 160 | | //MDRV_SOUND_ADD("soc_snd", SOCRATES, XTAL_21_47727MHz/12) /* divider guessed */ |
| 192 | //MDRV_SOUND_ADD("soc_snd", SOCRATES, XTAL_21_47727MHz/(1024+512)) /* this is correct, as strange as it sounds. */ |
| 161 | 193 | //MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 162 | 194 | |
| 163 | 195 | |
| r5313 | r5314 | |
| 172 | 204 | ROM_START(socrates) |
| 173 | 205 | ROM_REGION(0x80000, "maincpu", 0) |
| 174 | 206 | /* Socrates US NTSC */ |
| 175 | | ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) |
| 207 | ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) |
| 208 | ROM_FILL(0x40000, 0x40000, 0xf3) /* fill empty space with 0xf3 */ |
| 176 | 209 | ROM_END |
| 177 | 210 | |
| 178 | 211 | ROM_START(socratfc) |