Previous 199869 Revisions Next

r31181 Friday 4th July, 2014 at 01:44:26 UTC by R. Belmont
(MESS) apple3: now using the cycle-accurate floppy emulation. [R. Belmont]
[src/emu/machine]wozfdc.c
[src/lib/formats]ap2_dsk.c
[src/mess/drivers]apple3.c
[src/mess/includes]apple3.h
[src/mess/machine]apple3.c

trunk/src/emu/machine/wozfdc.c
r31180r31181
341341   // Clock is falling edges of the ~2Mhz clock
342342   // The 1021800 must be the controlling 6502's speed
343343
344   UINT64 cycles = tm.as_ticks(1021800*2*2);
344   UINT64 cycles = tm.as_ticks(clock()*2);
345345   cycles = (cycles+1) >> 1;
346346   return cycles;
347347}
348348
349349attotime wozfdc_device::cycles_to_time(UINT64 cycles)
350350{
351   return attotime::from_ticks(cycles*2+1, 1021800*2*2);
351   return attotime::from_ticks(cycles*2+1, clock()*2);
352352}
353353
354354void wozfdc_device::lss_start()
trunk/src/lib/formats/ap2_dsk.c
r31180r31181
612612      int offset = 0;
613613      static const unsigned char pascal_block1[4] = { 0x08, 0xa5, 0x0f, 0x29 };
614614      static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
615      static const unsigned char sos_block1[4] = { 0xc9, 0x20, 0xf0, 0x3e };
616      static const unsigned char a3a2emul_block1[6] = { 0x8d, 0xd0, 0x03, 0x4c, 0xc7, 0xa4 };
615617
616618      io_generic_read(io, sector_data, fpos, 256*16);
617619
r31180r31181
621623         if (!memcmp("PRODOS", &sector_data[0x103], 6))
622624         {
623625            m_prodos_order = true;
624         }   // check SOS boot block
625         else if (!memcmp("SOS BOOT", &sector_data[0x3], 8))
626         }   // check for ProDOS order SOS disk
627         else if (!memcmp(sos_block1, &sector_data[0x100], 4))
626628         {
627629            m_prodos_order = true;
628         }   // check Apple II Pascal
630         }   // check for Apple III A2 emulator disk in ProDOS order
631         else if (!memcmp(a3a2emul_block1, &sector_data[0x100], 6))
632         {
633            m_prodos_order = true;
634         }   // check for PCPI Applicard software in ProDOS order
635         else if (!memcmp("COPYRIGHT (C) 1979, DIGITAL RESEARCH", &sector_data[0x118], 36))
636         {
637            printf("PCPI detected\n");
638            m_prodos_order = true;
639         }   // check Apple II Pascal
629640         else if (!memcmp("SYSTEM.APPLE", &sector_data[0xd7], 12))
630641         {
631642            // Pascal discs can still be DOS order.
r31180r31181
795806                        hb = 0;
796807
797808                  if(hb == 4) {
798                        printf("hb = 4\n");
799809                        UINT8 h[11];
800810                        for(int i=0; i<11; i++)
801811                              h[i] = gb(buf, ts, pos, wrap);
trunk/src/mess/drivers/apple3.c
r31180r31181
1818#include "bus/rs232/rs232.h"
1919#include "includes/apple3.h"
2020#include "includes/apple2.h"
21#include "imagedev/flopdrv.h"
2221#include "formats/ap2_dsk.h"
23#include "machine/appldriv.h"
2422
2523#include "bus/a2bus/a2cffa.h"
2624#include "bus/a2bus/a2applicard.h"
r31180r31181
2927   AM_RANGE(0x0000, 0xffff) AM_READWRITE(apple3_memory_r, apple3_memory_w)
3028ADDRESS_MAP_END
3129
32static const floppy_interface apple3_floppy_interface =
33{
34   FLOPPY_STANDARD_5_25_DSHD,
35   LEGACY_FLOPPY_OPTIONS_NAME(apple2),
36   NULL
37};
38
3930static SLOT_INTERFACE_START(apple3_cards)
4031   SLOT_INTERFACE("cffa2", A2BUS_CFFA2_6502)  /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */
4132   SLOT_INTERFACE("applicard", A2BUS_APPLICARD)    /* PCPI Applicard */
4233SLOT_INTERFACE_END
4334
35static SLOT_INTERFACE_START( a3_floppies )
36   SLOT_INTERFACE( "525", FLOPPY_525_SD )
37SLOT_INTERFACE_END
4438
39FLOPPY_FORMATS_MEMBER( apple3_state::floppy_formats )
40   FLOPPY_A216S_FORMAT, FLOPPY_RWTS18_FORMAT
41FLOPPY_FORMATS_END
42
4543static MACHINE_CONFIG_START( apple3, apple3_state )
4644   /* basic machine hardware */
4745   MCFG_CPU_ADD("maincpu", M6502, 2000000)        /* 2 MHz */
r31180r31181
9492   MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple3_cards, NULL)
9593
9694   /* fdc */
97   MCFG_APPLEFDC_ADD("fdc", apple3_fdc_interface)
98   MCFG_LEGACY_FLOPPY_APPLE_4_DRIVES_ADD(apple3_floppy_interface,1,4)
95   MCFG_DEVICE_ADD("fdc", APPLEIII_FDC, 1021800*2)
96   MCFG_FLOPPY_DRIVE_ADD("0", a3_floppies, "525", apple3_state::floppy_formats)
97   MCFG_FLOPPY_DRIVE_ADD("1", a3_floppies, "525", apple3_state::floppy_formats)
98   MCFG_FLOPPY_DRIVE_ADD("2", a3_floppies, "525", apple3_state::floppy_formats)
99   MCFG_FLOPPY_DRIVE_ADD("3", a3_floppies, "525", apple3_state::floppy_formats)
99100
100101   /* acia */
101102   MCFG_DEVICE_ADD("acia", MOS6551, 0)
trunk/src/mess/machine/apple3.c
r31180r31181
4545#include "emu.h"
4646#include "includes/apple3.h"
4747#include "includes/apple2.h"
48#include "machine/applefdc.h"
49#include "machine/appldriv.h"
5048
51static void apple3_update_drives(device_t *device);
52
5349#define LOG_MEMORY      1
5450#define LOG_INDXADDR    1
5551
r31180r31181
240236      case 0xD0: case 0xD1: case 0xD2: case 0xD3:
241237      case 0xD4: case 0xD5: case 0xD6: case 0xD7:
242238         /* external drive stuff */
243         if (offset & 1)
244            m_flags |= VAR_EXTA0 << ((offset - 0xD0) / 2);
245         else
246            m_flags &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
247         apple3_update_drives(machine().device("fdc"));
239         m_fdc->read_c0dx(space, offset&0xf);
248240         result = 0x00;
249241         break;
250242
r31180r31181
256248      case 0xE4: case 0xE5: case 0xE6: case 0xE7:
257249      case 0xE8: case 0xE9: case 0xEA: case 0xEB:
258250      case 0xEC: case 0xED: case 0xEE: case 0xEF:
259         result = m_fdc->read(offset);
251         result = m_fdc->read(space, offset&0xf);
260252         break;
261253
262254      case 0xF0:
r31180r31181
381373      case 0xD0: case 0xD1: case 0xD2: case 0xD3:
382374      case 0xD4: case 0xD5: case 0xD6: case 0xD7:
383375         /* external drive stuff */
384         if (offset & 1)
385            m_flags |= VAR_EXTA0 << ((offset - 0xD0) / 2);
386         else
387            m_flags &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2));
388         apple3_update_drives(machine().device("fdc"));
376         m_fdc->write_c0dx(space, offset&0xf, data);
389377         break;
390378
391379      case 0xDB:
r31180r31181
396384      case 0xE4: case 0xE5: case 0xE6: case 0xE7:
397385      case 0xE8: case 0xE9: case 0xEA: case 0xEB:
398386      case 0xEC: case 0xED: case 0xEE: case 0xEF:
399         m_fdc->write(offset, data);
387         m_fdc->write(space, offset&0xf, data);
400388         break;
401389
402390      case 0xF0:
r31180r31181
412400{
413401   m_via_1->write_cb1(machine().first_screen()->vblank());
414402   m_via_1->write_cb2(machine().first_screen()->vblank());
415
416   // check reset
417   if (m_kbspecial->read() & 0x80)   // reset is pressed
418   {
419      // control-reset?
420      if (m_kbspecial->read() & 0x08)
421      {
422         m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
423         m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
424      }
425      else   // plain reset is an NMI, if it's allowed
426      {
427         if (m_via_0_a & ENV_NMIENABLE)
428         {
429            m_maincpu->set_input_line(m6502_device::NMI_LINE, ASSERT_LINE);
430            m_maincpu->set_input_line(m6502_device::NMI_LINE, CLEAR_LINE);
431         }
432      }
433   }
434403}
435404
436405UINT8 *apple3_state::apple3_bankaddr(UINT16 bank, offs_t offset)
r31180r31181
641610   m_cnxx_slot = -1;
642611   m_analog_sel = 0;
643612   m_ramp_active = false;
613
614   m_fdc->set_floppies_4(floppy0, floppy1, floppy2, floppy3);
644615}
645616
646617
r31180r31181
670641   return result;
671642}
672643
673static void apple3_update_drives(device_t *device)
674{
675   apple3_state *state = device->machine().driver_data<apple3_state>();
676   int enable_mask = 0x00;
677
678   if (state->m_enable_mask & 0x01)
679      enable_mask |= 0x01;
680
681   if (state->m_enable_mask & 0x02)
682   {
683      switch(state->m_flags & (VAR_EXTA0 | VAR_EXTA1))
684      {
685         case VAR_EXTA0:
686            enable_mask |= 0x02;
687            break;
688         case VAR_EXTA1:
689            enable_mask |= 0x04;
690            break;
691         case VAR_EXTA1|VAR_EXTA0:
692            enable_mask |= 0x08;
693            break;
694      }
695   }
696
697   apple525_set_enable_lines(device,enable_mask);
698}
699
700
701
702static void apple3_set_enable_lines(device_t *device,int enable_mask)
703{
704   apple3_state *state = device->machine().driver_data<apple3_state>();
705   state->m_enable_mask = enable_mask;
706   apple3_update_drives(device);
707}
708
709
710
711const applefdc_interface apple3_fdc_interface =
712{
713   apple525_set_lines,
714   apple3_set_enable_lines,
715   apple525_read_data,
716   apple525_write_data
717};
718
719
720
721644DRIVER_INIT_MEMBER(apple3_state,apple3)
722645{
723646   m_enable_mask = 0;
724   apple3_update_drives(machine().device("fdc"));
725647
726648   m_flags = 0;
727649   m_acia_irq = 0;
trunk/src/mess/includes/apple3.h
r31180r31181
1313#include "includes/apple2.h"
1414#include "machine/ram.h"
1515#include "bus/a2bus/a2bus.h"
16#include "machine/applefdc.h"
1716#include "machine/mos6551.h"
1817#include "machine/6522via.h"
1918#include "machine/kb3600.h"
2019#include "machine/mm58167.h"
2120#include "sound/speaker.h"
2221#include "sound/dac.h"
22#include "machine/wozfdc.h"
23#include "imagedev/floppy.h"
24#include "formats/flopimg.h"
2325
2426#define VAR_VM0         0x0001
2527#define VAR_VM1         0x0002
r31180r31181
5658      m_joy2x(*this, "joy_2_x"),
5759      m_joy2y(*this, "joy_2_y"),
5860      m_joybuttons(*this, "joy_buttons"),
59      m_pdltimer(*this, "pdltimer")
61      m_pdltimer(*this, "pdltimer"),
62      floppy0(*this, "0"),
63      floppy1(*this, "1"),
64      floppy2(*this, "2"),
65      floppy3(*this, "3")
6066   {
6167   }
6268
r31180r31181
6571   required_device<via6522_device> m_via_0;
6672   required_device<via6522_device> m_via_1;
6773   required_device<mos6551_device> m_acia;
68   required_device<applefdc_base_device> m_fdc;
74   required_device<appleiii_fdc> m_fdc;
6975   required_device<ay3600_device> m_ay3600;
7076   required_device<a2bus_device> m_a2bus;
7177   required_device<mm58167_device> m_rtc;
r31180r31181
7581   required_device<palette_device> m_palette;
7682   required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons;
7783   required_device<timer_device> m_pdltimer;
84   required_device<floppy_connector> floppy0;
85   required_device<floppy_connector> floppy1;
86   required_device<floppy_connector> floppy2;
87   required_device<floppy_connector> floppy3;
7888
7989   DECLARE_READ8_MEMBER(apple3_memory_r);
8090   DECLARE_WRITE8_MEMBER(apple3_memory_w);
r31180r31181
117127   void apple3_postload();
118128   TIMER_DEVICE_CALLBACK_MEMBER(paddle_timer);
119129   void pdl_handler(int offset);
130   DECLARE_FLOPPY_FORMATS( floppy_formats );
120131
121132   // these need to be public for now
122133   UINT32 m_flags;
r31180r31181
153164   int m_pdl_charge;
154165};
155166
156
157/*----------- defined in machine/apple3.c -----------*/
158
159extern const applefdc_interface apple3_fdc_interface;
160
161167#endif /* APPLE3_H_ */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team