Previous 199869 Revisions Next

r40531 Friday 28th August, 2015 at 07:26:01 UTC by Joakim Larsson Edström
Fixed user expansion socket cart support through very ugly byteswap in read handler, must be fixed better later
[src/emu/bus/vme]vme.c vme.h
[src/mess/drivers]force68k.c

trunk/src/mess/drivers/force68k.c
r249042r249043
137137        , m_centronics_busy (0)
138138        , m_centronics_perror (0)
139139        , m_centronics_select (0)
140   ,m_cart(*this, "exp_rom1")
140        ,m_cart(*this, "exp_rom1")
141141{
142142}
143143
r249042r249043
157157DECLARE_WRITE_LINE_MEMBER (centronics_perror_w);
158158DECLARE_WRITE_LINE_MEMBER (centronics_select_w);
159159// 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); }
160int force68k_load_cart(device_image_interface &image, generic_slot_device *slot);
161DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); }
162DECLARE_READ16_MEMBER (read16_rom);
162163
163164protected:
164165
r249042r249043
178179
179180// Pointer to System ROMs needed by bootvect_r
180181UINT16  *m_sysrom;
182UINT16  *m_usrrom;
181183
182184required_device<generic_slot_device> m_cart;
183185
r249042r249043
186188static ADDRESS_MAP_START (force68k_mem, AS_PROGRAM, 16, force68k_state)
187189ADDRESS_MAP_UNMAP_HIGH
188190AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r)       /* Vectors mapped from System EPROM */
189AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM */
190AM_RANGE (0x080000, 0x09ffff) AM_ROM /* System EPROM Area      */
191//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, mapped by a cartslot  */
191AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM CPU-1B */
192//AM_RANGE (0x020000, 0x07ffff) AM_RAM /* Additional DRAM CPU-1D */
193AM_RANGE (0x080000, 0x083fff) AM_ROM /* System EPROM Area 16Kb DEBUGGER supplied as default on CPU-1B/D     */
194AM_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  */
192196AM_RANGE (0x0c0040, 0x0c0041) AM_DEVREADWRITE8 ("aciahost", acia6850_device, status_r, control_w, 0x00ff)
193197AM_RANGE (0x0c0042, 0x0c0043) AM_DEVREADWRITE8 ("aciahost", acia6850_device, data_r, data_w, 0x00ff)
194198AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00)
r249042r249043
292296        m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x080000);
293297
294298        /* Map user ROM/RAM socket(s) */
295   if (m_cart->exists())
299        if (m_cart->exists())
296300        {
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
301307        }
302308}
303309
310/* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */
311READ16_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
304316/* Boot vector handler, the PCB hardwires the first 8 bytes from 0x80000 to 0x0 */
305317READ16_MEMBER (force68k_state::bootvect_r){
306318        return m_sysrom [offset];
r249042r249043
376388   32Kx16 64 Kbyte 27256
377389   --------------------------
378390*/
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
380392// software handling. TODO: make configurable according to table above.
381393static 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")
389400MACHINE_CONFIG_END
390401
391402/***************************
r249042r249043
393404****************************/
394405int force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot)
395406{
396   UINT32 size = slot->common_get_size("rom");
407        UINT32 size = slot->common_get_size("rom");
397408
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        }
405415
406416        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;
410420}
411421
412422/*


Previous 199869 Revisions Next


© 1997-2024 The MAME Team