Previous 15994 Revisions Next

r15720 Thursday 2nd August, 2012 at 19:26:18 UTC by Curt Coder
[ABC80] Cassette loading WIP. (nw)
[src/emu/machine]z80pio.c
[src/mess/drivers]abc80.c
[src/mess/includes]abc80.h
[src/mess/machine]abc80kb.c

src/emu/machine/z80pio.c
r15719r15720
333333
334334   // clear ready line
335335   set_rdy(false);
336
337   // read port value
338   m_input = m_in_p_func(0);
336339}
337340
338341
src/mess/machine/abc80kb.c
r15719r15720
147147//-------------------------------------------------
148148 
149149static MACHINE_CONFIG_FRAGMENT( abc80_keyboard )
150    MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_5_9904MHz)
150    MCFG_CPU_ADD(I8048_TAG, I8048, 4000000)
151151    MCFG_CPU_IO_MAP(abc80_keyboard_io)
152    MCFG_DEVICE_DISABLE()
152153MACHINE_CONFIG_END
153154 
154155 
src/mess/includes/abc80.h
r15719r15720
5555
5656#define ABC80_CHAR_CURSOR      0x80
5757
58#define SCREEN_TAG      "screen"
59#define Z80_TAG         "ab67"
60#define Z80PIO_TAG      "cd67"
61#define SN76477_TAG      "g8"
62#define ABCBUS_TAG      "abcbus"
58#define SCREEN_TAG         "screen"
59#define Z80_TAG            "ab67"
60#define Z80PIO_TAG         "cd67"
61#define SN76477_TAG         "g8"
62#define ABCBUS_TAG         "abcbus"
63#define TIMER_CASSETTE_TAG   "cass"
6364
6465class abc80_state : public driver_device
6566{
r15719r15720
7172        m_psg(*this, SN76477_TAG),
7273        m_cassette(*this, CASSETTE_TAG),
7374        m_bus(*this, ABCBUS_TAG),
74        m_ram(*this, RAM_TAG)
75        m_ram(*this, RAM_TAG),
76        m_cassette_timer(*this, TIMER_CASSETTE_TAG),
77        m_tape_in(1),
78        m_tape_in_latch(1)
7579   { }
7680
7781   required_device<cpu_device> m_maincpu;
r15719r15720
8084   required_device<cassette_image_device> m_cassette;
8185   required_device<abcbus_slot_device> m_bus;
8286   required_device<ram_device> m_ram;
87   required_device<timer_device> m_cassette_timer;
8388
8489   virtual void machine_start();
8590
r15719r15720
107112   UINT8 m_latch;
108113   int m_blink;
109114
115   // cassette state
116   int m_tape_in;
117   int m_tape_in_latch;
118
110119   // memory regions
111120   const UINT8 *m_mmu_rom;         // memory mapping ROM
112121   const UINT8 *m_char_rom;      // character generator ROM
src/mess/drivers/abc80.c
r15719r15720
108108
109109    TODO:
110110
111   - cassette interrupt routine samples the latch too soon
111112    - proper keyboard controller emulation
112113    - get BASIC v1 dump
113114    - MyAB 80-column card
r15719r15720
499500{
500501   abc80_state *state = timer.machine().driver_data<abc80_state>();
501502
502   /* toggle ASTB every other video line */
503   // toggle ASTB every other video line
503504   state->m_pio_astb = !state->m_pio_astb;
504505
505506   z80pio_astb_w(state->m_pio, state->m_pio_astb);
506507}
507508
509static TIMER_DEVICE_CALLBACK( cassette_tick )
510{
511   abc80_state *state = timer.machine().driver_data<abc80_state>();
512
513   int tape_in = state->m_cassette->input() > 0;
514   //logerror("tape bit %u\n", tape_in);
515
516   if (state->m_tape_in_latch && !state->m_tape_in && tape_in)
517   {
518      //logerror("-------- set tape in latch\n");
519      state->m_tape_in_latch = 0;
520   
521      z80pio_pb_w(state->m_pio, 0, state->m_tape_in_latch << 7);
522   }
523
524   state->m_tape_in = tape_in;
525}
526
508527READ8_MEMBER( abc80_state::pio_pa_r )
509528{
510529   /*
r15719r15720
546565
547566   UINT8 data = 0;
548567
549   /* serial receive */
568   // cassette data
569   data |= m_tape_in_latch << 7;
570   
571   //logerror("read tape latch %u\n", m_tape_in_latch);
550572
551   /* clear to send */
552
553   /* data connection detect */
554
555   /* cassette data */
556   data |= ((m_cassette)->input() > +1.0) << 7;
557
558573   return data;
559574};
560575
r15719r15720
575590
576591    */
577592
578   /* transmit */
593   // cassette motor
594   if (BIT(data, 5))
595   {
596      m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
597      m_cassette_timer->enable(true);
598   }
599   else
600   {
601      m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
602      m_cassette_timer->enable(false);
603   }
579604
580   /* request to send */
605   // cassette data
606   m_cassette->output(BIT(data, 6) ? -1.0 : +1.0);
581607
582   /* cassette motor */
583   m_cassette->change_state(BIT(data,5) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
608   // cassette input latch
609   if (BIT(data, 6))
610   {
611      //logerror("clear tape in latch\n");
584612
585   /* cassette data */
586   m_cassette->output( BIT(data, 6) ? -1.0 : +1.0);
613      m_tape_in_latch = 1;
614   
615      z80pio_pb_w(m_pio, 0, m_tape_in_latch << 7);
616   }
587617};
588618
589619static Z80PIO_INTERFACE( pio_intf )
r15719r15720
670700   save_item(NAME(m_key_data));
671701   save_item(NAME(m_key_strobe));
672702   save_item(NAME(m_pio_astb));
703   save_item(NAME(m_tape_in));
704   save_item(NAME(m_tape_in_latch));
673705}
674706
675707
r15719r15720
698730   MCFG_SOUND_CONFIG(csg_intf)
699731   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
700732
701   /* keyboard */
733   /* fake keyboard */
702734   MCFG_TIMER_ADD_PERIODIC("keyboard", abc80_keyboard_tick, attotime::from_usec(2500))
703735
704736   /* devices */
705737   MCFG_TIMER_ADD_SCANLINE("pio_astb", z80pio_astb_tick, SCREEN_TAG, 0, 1)
738   MCFG_TIMER_ADD_PERIODIC(TIMER_CASSETTE_TAG, cassette_tick, attotime::from_hz(44100))
706739   MCFG_Z80PIO_ADD(Z80PIO_TAG, ABC80_XTAL/2/2, pio_intf)
707   MCFG_PRINTER_ADD("printer")
708740   MCFG_CASSETTE_ADD(CASSETTE_TAG, abc80_cassette_interface)
709741   MCFG_ABC830_ADD()
710742   MCFG_ABC80_KEYBOARD_ADD(kb_intf)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team