trunk/src/mess/drivers/force68k.c
| r249042 | r249043 | |
| 137 | 137 | , m_centronics_busy (0) |
| 138 | 138 | , m_centronics_perror (0) |
| 139 | 139 | , m_centronics_select (0) |
| 140 | | ,m_cart(*this, "exp_rom1") |
| 140 | ,m_cart(*this, "exp_rom1") |
| 141 | 141 | { |
| 142 | 142 | } |
| 143 | 143 | |
| r249042 | r249043 | |
| 157 | 157 | DECLARE_WRITE_LINE_MEMBER (centronics_perror_w); |
| 158 | 158 | DECLARE_WRITE_LINE_MEMBER (centronics_select_w); |
| 159 | 159 | // User EPROM/SRAM slot(s) |
| 160 | | //int force68k_load_cart(device_image_interface &image, generic_slot_device *slot); |
| 161 | | //DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); } |
| 160 | int force68k_load_cart(device_image_interface &image, generic_slot_device *slot); |
| 161 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); } |
| 162 | DECLARE_READ16_MEMBER (read16_rom); |
| 162 | 163 | |
| 163 | 164 | protected: |
| 164 | 165 | |
| r249042 | r249043 | |
| 178 | 179 | |
| 179 | 180 | // Pointer to System ROMs needed by bootvect_r |
| 180 | 181 | UINT16 *m_sysrom; |
| 182 | UINT16 *m_usrrom; |
| 181 | 183 | |
| 182 | 184 | required_device<generic_slot_device> m_cart; |
| 183 | 185 | |
| r249042 | r249043 | |
| 186 | 188 | static ADDRESS_MAP_START (force68k_mem, AS_PROGRAM, 16, force68k_state) |
| 187 | 189 | ADDRESS_MAP_UNMAP_HIGH |
| 188 | 190 | AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* Vectors mapped from System EPROM */ |
| 189 | | AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM */ |
| 190 | | AM_RANGE (0x080000, 0x09ffff) AM_ROM /* System EPROM Area */ |
| 191 | | //AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, mapped by a cartslot */ |
| 191 | AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM CPU-1B */ |
| 192 | //AM_RANGE (0x020000, 0x07ffff) AM_RAM /* Additional DRAM CPU-1D */ |
| 193 | AM_RANGE (0x080000, 0x083fff) AM_ROM /* System EPROM Area 16Kb DEBUGGER supplied as default on CPU-1B/D */ |
| 194 | AM_RANGE (0x084000, 0x09ffff) AM_ROM /* System EPROM Area 112Kb additional space for System ROM */ |
| 195 | //AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot */ |
| 192 | 196 | AM_RANGE (0x0c0040, 0x0c0041) AM_DEVREADWRITE8 ("aciahost", acia6850_device, status_r, control_w, 0x00ff) |
| 193 | 197 | AM_RANGE (0x0c0042, 0x0c0043) AM_DEVREADWRITE8 ("aciahost", acia6850_device, data_r, data_w, 0x00ff) |
| 194 | 198 | AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00) |
| r249042 | r249043 | |
| 292 | 296 | m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x080000); |
| 293 | 297 | |
| 294 | 298 | /* Map user ROM/RAM socket(s) */ |
| 295 | | if (m_cart->exists()) |
| 299 | if (m_cart->exists()) |
| 296 | 300 | { |
| 297 | | m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, |
| 298 | | 0xaffff, |
| 299 | | read16_delegate(FUNC(generic_slot_device::read16_rom), |
| 300 | | (generic_slot_device*)m_cart)); |
| 301 | m_usrrom = (UINT16*)m_cart->get_rom_base(); |
| 302 | #if 0 // This should be the correct way but produces odd and even bytes swapped |
| 303 | m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart)); |
| 304 | #else // So we installs a custom very ineffecient handler for now until we understand hwp to solve the problem better |
| 305 | m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(force68k_state::read16_rom), this)); |
| 306 | #endif |
| 301 | 307 | } |
| 302 | 308 | } |
| 303 | 309 | |
| 310 | /* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */ |
| 311 | READ16_MEMBER (force68k_state::read16_rom){ |
| 312 | offset = offset % m_cart->common_get_size("rom"); // Don't read outside buffer... |
| 313 | return ((m_usrrom [offset] << 8) & 0xff00) | ((m_usrrom [offset] >> 8) & 0x00ff); |
| 314 | } |
| 315 | |
| 304 | 316 | /* Boot vector handler, the PCB hardwires the first 8 bytes from 0x80000 to 0x0 */ |
| 305 | 317 | READ16_MEMBER (force68k_state::bootvect_r){ |
| 306 | 318 | return m_sysrom [offset]; |
| r249042 | r249043 | |
| 376 | 388 | 32Kx16 64 Kbyte 27256 |
| 377 | 389 | -------------------------- |
| 378 | 390 | */ |
| 379 | | // Implementation of static 64K EPROM in sockets J10/J11 as 16 bit wide cartridge for easier |
| 391 | // Implementation of static 2 x 64K EPROM in sockets J10/J11 as 16 bit wide cartridge for easier |
| 380 | 392 | // software handling. TODO: make configurable according to table above. |
| 381 | 393 | static MACHINE_CONFIG_FRAGMENT( fccpu1_eprom_sockets ) |
| 382 | | MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_linear_slot, "fccpu1_cart") |
| 383 | | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 384 | | MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) |
| 385 | | MCFG_GENERIC_ENDIAN(ENDIANNESS_LITTLE) // In generic call_load() len 12152, width 2 endianess 0 |
| 386 | | // MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) // In generic call_load() len 12152, width 2 endianess 1 |
| 387 | | // MCFG_GENERIC_LOAD(force68k_state, exp1_load) |
| 388 | | // MCFG_SOFTWARE_LIST_ADD("cart_list", "fccpu1_cart") |
| 394 | MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "fccpu1_cart") |
| 395 | MCFG_GENERIC_EXTENSIONS("bin,rom") |
| 396 | MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) |
| 397 | MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) |
| 398 | MCFG_GENERIC_LOAD(force68k_state, exp1_load) |
| 399 | // MCFG_SOFTWARE_LIST_ADD("cart_list", "fccpu1_cart") |
| 389 | 400 | MACHINE_CONFIG_END |
| 390 | 401 | |
| 391 | 402 | /*************************** |
| r249042 | r249043 | |
| 393 | 404 | ****************************/ |
| 394 | 405 | int force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot) |
| 395 | 406 | { |
| 396 | | UINT32 size = slot->common_get_size("rom"); |
| 407 | UINT32 size = slot->common_get_size("rom"); |
| 397 | 408 | |
| 398 | | printf("force68k_load_cart() loading rom at slot %s for image \n", (char *) image.device_typename); |
| 399 | | if (size > 0x10000) // Max 64Kb |
| 400 | | { |
| 401 | | LOG( printf("Cartridge size exceeding max size (64Kb): %d\n", size) ); |
| 402 | | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (64Kb)"); |
| 403 | | return IMAGE_INIT_FAIL; |
| 404 | | } |
| 409 | if (size > 0x20000) // Max 128Kb |
| 410 | { |
| 411 | LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) ); |
| 412 | image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); |
| 413 | return IMAGE_INIT_FAIL; |
| 414 | } |
| 405 | 415 | |
| 406 | 416 | slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); |
| 407 | | slot->common_load_rom(slot->get_rom_base(), size, "rom"); |
| 408 | | |
| 409 | | return IMAGE_INIT_PASS; |
| 417 | slot->common_load_rom(slot->get_rom_base(), size, "rom"); |
| 418 | |
| 419 | return IMAGE_INIT_PASS; |
| 410 | 420 | } |
| 411 | 421 | |
| 412 | 422 | /* |