Previous 15994 Revisions Next

r14985 Saturday 21st April, 2012 at 14:52:37 UTC by R. Belmont
Apple II: cards that don't take over c800 now don't have to. Fixes SoftCard compatibility with VideoTerm and IIe - CP/M now runs in 80 columns in those setups. [R. Belmont]
[src/mess/machine]a2bus.h a2softcard.c a2softcard.h apple2.c

src/mess/machine/a2softcard.c
r14984r14985
187187    }
188188}
189189
190bool a2bus_softcard_device::take_c800()
191{
192    return false;
193}
194
src/mess/machine/a2softcard.h
r14984r14985
3737
3838    // overrides of standard a2bus slot functions
3939    virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data);
40    virtual bool take_c800();
4041
4142   required_device<cpu_device> m_z80;
4243
src/mess/machine/a2bus.h
r14984r14985
132132    virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
133133    virtual UINT8 read_c800(address_space &space, UINT16 offset) { return 0; }      // C800 - /IOSTB
134134    virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { printf("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
135    virtual bool take_c800() { return true; }   // override and return false if your card doesn't take over the c800 space
135136
136137   device_a2bus_card_interface *next() const { return m_next; }
137138
src/mess/machine/apple2.c
r14984r14985
434434}
435435
436436/* returns default CnXX slotram for a slot space */
437INT8 apple2_slotram_r(running_machine &machine, int slotnum, int offset)
437INT8 apple2_slotram_r(address_space &space, int slotnum, int offset)
438438{
439   apple2_state *state = machine.driver_data<apple2_state>();
439   apple2_state *state = space.machine().driver_data<apple2_state>();
440440   UINT8 *rom, *slot_ram;
441441   UINT32 rom_length, slot_length;
442442
443443   // find slot_ram if any
444   rom = machine.root_device().memregion("maincpu")->base();
445   rom_length = machine.root_device().memregion("maincpu")->bytes() & ~0xFFF;
444   rom = space.machine().root_device().memregion("maincpu")->base();
445   rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
446446   slot_length = state->memregion("maincpu")->bytes() - rom_length;
447447   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
448448
449449   if (slot_ram)
450450   {
451        state->m_a2_cnxx_slot = -1;
452      apple2_update_memory(machine);
451      if (!space.debugger_access())
452      {
453//         printf("slotram_r: taking cnxx_slot to -1\n");
454         state->m_a2_cnxx_slot = -1;
455         apple2_update_memory(space.machine());
456      }
453457
454458      return slot_ram[offset];
455459   }
456460
457461   // else fall through to floating bus
458   return apple2_getfloatingbusvalue(machine);
462   return apple2_getfloatingbusvalue(space.machine());
459463}
460464
461465static READ8_HANDLER( apple2_c1xx_r )
r14984r14985
467471   slotnum = ((offset>>8) & 0xf) + 1;
468472    slotdevice = state->m_a2bus->get_a2bus_card(slotnum);
469473
470    state->m_a2_cnxx_slot = slotnum;
471    apple2_update_memory(space->machine());
472
473474   if (slotdevice != NULL)
474475   {
476      if (slotdevice->take_c800())
477      {
478//         printf("c1xx_r: taking cnxx_slot to %d\n", slotnum);
479         state->m_a2_cnxx_slot = slotnum;
480         apple2_update_memory(space->machine());
481      }
482
475483      return slotdevice->read_cnxx(*space, offset&0xff);
476484   }
477485   else
478486   {
479      return apple2_slotram_r(space->machine(), slotnum, offset);
487      return apple2_slotram_r(*space, slotnum, offset);
480488   }
481489
482490   // else fall through to floating bus
r14984r14985
521529   slotnum = 3;
522530    slotdevice = state->m_a2bus->get_a2bus_card(slotnum);
523531
524    state->m_a2_cnxx_slot = slotnum;
525    apple2_update_memory(space->machine());
526
527532   // is a card installed in this slot?
528533   if (slotdevice != NULL)
529534   {
535      if (slotdevice->take_c800())
536      {
537//         printf("c3xx_r: taking cnxx_slot to %d\n", slotnum);
538         state->m_a2_cnxx_slot = slotnum;
539         apple2_update_memory(space->machine());
540      }
530541      return slotdevice->read_cnxx(*space, offset&0xff);
531542   }
532543   else
533544   {
534      return apple2_slotram_r(space->machine(), slotnum, offset);
545      return apple2_slotram_r(*space, slotnum, offset);
535546   }
536547
537548   // else fall through to floating bus
r14984r14985
555566   slotnum = 3;
556567    slotdevice = state->m_a2bus->get_a2bus_card(slotnum);
557568
558    state->m_a2_cnxx_slot = slotnum;
559    apple2_update_memory(space->machine());
560
561569   if (slotdevice != NULL)
562570   {
571      if (slotdevice->take_c800())
572      {
573//         printf("c3xx_w: taking cnxx_slot to %d\n", slotnum);
574         state->m_a2_cnxx_slot = slotnum;
575         apple2_update_memory(space->machine());
576      }
563577      slotdevice->write_cnxx(*space, offset&0xff, data);
564578   }
565579   else
r14984r14985
578592   slotnum = ((offset>>8) & 0xf) + 4;
579593    slotdevice = state->m_a2bus->get_a2bus_card(slotnum);
580594
581    state->m_a2_cnxx_slot = slotnum;
582    apple2_update_memory(space->machine());
583
584595   // is a card installed in this slot?
585596   if (slotdevice != NULL)
586597   {
598      if (slotdevice->take_c800())
599      {
600//         printf("c4xx_r: taking cnxx_slot to %d\n", slotnum);
601         state->m_a2_cnxx_slot = slotnum;
602         apple2_update_memory(space->machine());
603      }
587604      return slotdevice->read_cnxx(*space, offset&0xff);
588605   }
589606   else
590607   {
591      return apple2_slotram_r(space->machine(), slotnum, offset);
608      return apple2_slotram_r(*space, slotnum, offset);
592609   }
593610
594611   // else fall through to floating bus
r14984r14985
612629   slotnum = ((offset>>8) & 0xf) + 4;
613630    slotdevice = state->m_a2bus->get_a2bus_card(slotnum);
614631
615    state->m_a2_cnxx_slot = slotnum;
616    apple2_update_memory(space->machine());
617
618632   if (slotdevice != NULL)
619633   {
634      if (slotdevice->take_c800())
635      {
636//         printf("c4xx_w: taking cnxx_slot to %d\n", slotnum);
637         state->m_a2_cnxx_slot = slotnum;
638         apple2_update_memory(space->machine());
639      }
620640      slotdevice->write_cnxx(*space, offset&0xff, data);
621641   }
622642   else
r14984r14985
632652   if (!space->debugger_access())
633653   {
634654        apple2_state *state = space->machine().driver_data<apple2_state>();
655//      printf("cfff_r: taking cnxx_slot to -1\n");
635656      state->m_a2_cnxx_slot = -1;
636657      apple2_update_memory(space->machine());
637658   }
r14984r14985
644665   if (!space->debugger_access())
645666   {
646667        apple2_state *state = space->machine().driver_data<apple2_state>();
668//      printf("cfff_w: taking cnxx_slot to -1\n");
647669        state->m_a2_cnxx_slot = -1;
648670        apple2_update_memory(space->machine());
649671    }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team