Previous 199869 Revisions Next

r20582 Monday 28th January, 2013 at 14:49:55 UTC by Curt Coder
(MESS) pet: Added datassette slot interface. [Curt Coder]
[src/mess/drivers]pet.c
[src/mess/includes]pet.h
[src/mess/machine]c2n.c c2n.h pet.c petcass.h

trunk/src/mess/drivers/pet.c
r20581r20582
653653   DEVCB_NULL
654654};
655655
656//-------------------------------------------------
657//  PET_DATASSETTE_PORT_INTERFACE( datassette_intf )
658//-------------------------------------------------
656659
660static PET_DATASSETTE_PORT_INTERFACE( datassette_intf )
661{
662   DEVCB_DEVICE_LINE_MEMBER("pia_0", pia6821_device, cb1_w)
663};
664
665//-------------------------------------------------
666//  PET_DATASSETTE_PORT_INTERFACE( datassette2_intf )
667//-------------------------------------------------
668
669static PET_DATASSETTE_PORT_INTERFACE( datassette2_intf )
670{
671   DEVCB_DEVICE_LINE_MEMBER("via6522_0", via6522_device, write_cb1)
672};
673
674
657675/*************************************
658676 *
659677 *  Machine driver
r20581r20582
679697   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(pet_palette) / 3)
680698
681699   /* cassette */
682   MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface )
683   MCFG_CASSETTE_ADD( CASSETTE2_TAG, cbm_cassette_interface )
700   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, "c1530", NULL)
701   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, datassette2_intf, cbm_datassette_devices, NULL, NULL)
684702
685703   /* via */
686704   MCFG_VIA6522_ADD( "via6522_0", 0, pet_via)
trunk/src/mess/machine/petcass.h
r20581r20582
3030//**************************************************************************
3131
3232#define PET_DATASSETTE_PORT_TAG     "tape"
33#define PET_DATASSETTE_PORT2_TAG     "tape2"
3334
3435
3536
trunk/src/mess/machine/pet.c
r20581r20582
1515#include "includes/pet.h"
1616
1717#include "imagedev/cartslot.h"
18#include "imagedev/cassette.h"
1918#include "machine/ram.h"
2019
2120#define VERBOSE_LEVEL 0
r20581r20582
6867   data |= m_keyline_select;
6968
7069   /* #1 cassette switch */
71   data |= ((machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 4;
70   data |= m_cassette->sense_r() << 4;
7271
7372   /* #2 cassette switch */
74   data |= ((machine().device<cassette_image_device>(CASSETTE2_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 5;
73   data |= m_cassette2->sense_r() << 5;
7574
7675   /* end or identify in */
7776   data |= m_ieee->eoi_r() << 6;
r20581r20582
169168READ8_MEMBER(pet_state::cass1_r)
170169{
171170   // cassette 1 read
172   return (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0;
171   return m_cassette->read();
173172}
174173
175174WRITE8_MEMBER(pet_state::cass1_motor_w)
176175{
177   if (!data)
178   {
179      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
180      m_datasette1_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));    // I put 48000 because I was given some .wav with this freq
181   }
182   else
183   {
184      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
185      m_datasette1_timer->reset();
186   }
176   m_cassette->motor_w(data);
187177}
188178
189179WRITE_LINE_MEMBER(pet_state::pia0_irq_w)
r20581r20582
238228WRITE_LINE_MEMBER(pet_state::pia1_irq_w)
239229{
240230   m_pia1_irq = state;
241   int level = (m_pia0_irq | m_pia1_irq | m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
231   int level = (m_pia0_irq || m_pia1_irq || m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
242232
243233   machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
244234}
r20581r20582
311301
312302READ_LINE_MEMBER(pet_state::cass2_r)
313303{
314   // cassette 2 read
315   return (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0;
304   return m_cassette2->read();
316305}
317306
318307WRITE8_MEMBER(pet_state::via_pb_w)
r20581r20582
339328   m_ieee->atn_w(BIT(data, 2));
340329
341330   /* cassette write */
342   machine().device<cassette_image_device>(CASSETTE_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
343   machine().device<cassette_image_device>(CASSETTE2_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
331   m_cassette->write(BIT(data, 3));
332   m_cassette2->write(BIT(data, 3));
344333
345334   /* #2 cassette motor */
346   if (BIT(data, 4))
347   {
348      machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
349      m_datasette2_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));    // I put 48000 because I was given some .wav with this freq
350   }
351   else
352   {
353      machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
354      m_datasette2_timer->reset();
355   }
335   m_cassette2->motor_w(BIT(data, 4));
356336}
357337
358338WRITE_LINE_MEMBER(pet_state::gb_w)
r20581r20582
612592}
613593
614594
615TIMER_CALLBACK_MEMBER(pet_state::pet_tape1_timer)
616{
617   pia6821_device *pia_0 = machine().device<pia6821_device>("pia_0");
618//  cassette 1
619   UINT8 data = (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0;
620   pia_0->ca1_w(data);
621}
622
623TIMER_CALLBACK_MEMBER(pet_state::pet_tape2_timer)
624{
625   via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
626//  cassette 2
627   UINT8 data = (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0;
628   via_0->write_cb1(data);
629}
630
631
632595static void pet_common_driver_init( running_machine &machine )
633596{
634597   int i;
r20581r20582
656619
657620   /* pet clock */
658621   machine.scheduler().timer_pulse(attotime::from_msec(10), timer_expired_delegate(FUNC(pet_state::pet_interrupt),state));
659
660   /* datasette */
661   state->m_datasette1_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape1_timer),state));
662   state->m_datasette2_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape2_timer),state));
663622}
664623
665624
trunk/src/mess/machine/c2n.c
r20581r20582
2828
2929
3030//-------------------------------------------------
31//  cassette_interface cbm_cassette_interface
32//-------------------------------------------------
33
34const cassette_interface cbm_cassette_interface =
35{
36   cbm_cassette_formats,
37   NULL,
38   (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED),
39   NULL,
40   NULL
41};
42
43
44//-------------------------------------------------
3145//  MACHINE_CONFIG( c2n )
3246//-------------------------------------------------
3347
trunk/src/mess/machine/c2n.h
r20581r20582
1414
1515
1616#include "emu.h"
17#include "includes/cbm.h"
17#include "formats/cbm_tap.h"
18#include "imagedev/cassette.h"
1819#include "machine/petcass.h"
1920
2021
trunk/src/mess/includes/pet.h
r20581r20582
1212#include "machine/6522via.h"
1313#include "machine/ieee488.h"
1414#include "imagedev/cartslot.h"
15#include "machine/petcass.h"
1516
1617struct spet_t
1718{
r20581r20582
2627   pet_state(const machine_config &mconfig, device_type type, const char *tag)
2728      : driver_device(mconfig, type, tag),
2829         m_ieee(*this, IEEE488_TAG),
30         m_cassette(*this, PET_DATASSETTE_PORT_TAG),
31         m_cassette2(*this, PET_DATASSETTE_PORT2_TAG),
2932      m_videoram(*this, "videoram"),
30      m_memory(*this, "memory"){ }
33      m_memory(*this, "memory")
34   { }
3135
3236   required_device<ieee488_device> m_ieee;
37   required_device<pet_datassette_port_device> m_cassette;
38   required_device<pet_datassette_port_device> m_cassette2;
3339
3440   int m_pet_basic1; /* basic version 1 for quickloader */
3541   int m_superpet;
r20581r20582
4450   UINT8 *m_supermemory;
4551   UINT8 *m_pet80_bank1_base;
4652   int m_keyline_select;
47   emu_timer *m_datasette1_timer;
48   emu_timer *m_datasette2_timer;
4953   spet_t m_spet;
5054   int m_pia_level;
5155   DECLARE_DRIVER_INIT(superpet);
r20581r20582
5862   UINT32 screen_update_pet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5963   INTERRUPT_GEN_MEMBER(pet_frame_interrupt);
6064   TIMER_CALLBACK_MEMBER(pet_interrupt);
61   TIMER_CALLBACK_MEMBER(pet_tape1_timer);
62   TIMER_CALLBACK_MEMBER(pet_tape2_timer);
6365   DECLARE_READ8_MEMBER(pia0_pa_r);
6466   DECLARE_WRITE8_MEMBER(pia0_pa_w);
6567   DECLARE_READ8_MEMBER(kin_r);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team