Previous 199869 Revisions Next

r23768 Tuesday 18th June, 2013 at 10:29:07 UTC by Robbbert
(MESS) Acorn System 1: added cassette [Robbbert]
[src/mess/drivers]acrnsys1.c

trunk/src/mess/drivers/acrnsys1.c
r23767r23768
2727        -0100^11^22^33^44^55^66^77^88^99^-0100^
2828        Now press up-arrow to confirm the data has been entered.
2929
30ToDo:
31- Artwork
32- Cassette
3330
3431Example usage: Turn on. Press -. Mode letter will show 'A'. Type in an address
3532               (example FE00). Press - (or any command key). Contents will show
3633               on the right. Use Up & Down keys to cycle through addresses.
3734
35To save a tape, press S then enter start address, press S, enter end address+1,
36               start recording and press S. The save only takes a few seconds.
37
38To load a tape, the display must just have dots, (reset if necessary), start
39               playing tape and immediately press L. The last digit will flicker
40               as the bytes load. At the end, the dots will show again. There's
41               no error checking, so if it doesn't work, reset and try again.
42
3843Note that left-most digit is not wired up, and therefore will always be blank.
3944
4045******************************************************************************/
r23767r23768
4348#include "cpu/m6502/m6502.h"
4449#include "machine/ins8154.h"
4550#include "machine/74145.h"
51#include "imagedev/cassette.h"
52#include "sound/wave.h"
4653#include "acrnsys1.lh"
4754
4855
r23767r23768
5158public:
5259   acrnsys1_state(const machine_config &mconfig, device_type type, const char *tag)
5360      : driver_device(mconfig, type, tag),
54   m_maincpu(*this, "maincpu"),
55   m_ttl74145(*this, "ic8_7445"),
56   m_digit(0)
61      m_maincpu(*this, "maincpu"),
62      m_ttl74145(*this, "ic8_7445"),
63      m_cass(*this, "cassette"),
64      m_digit(0)
5765   { }
5866
59   required_device<cpu_device> m_maincpu;
60   required_device<ttl74145_device> m_ttl74145;
6167   DECLARE_READ8_MEMBER(ins8154_b1_port_a_r);
6268   DECLARE_WRITE8_MEMBER(ins8154_b1_port_a_w);
6369   DECLARE_WRITE8_MEMBER(acrnsys1_led_segment_w);
70   TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_c);
71   TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_p);
72private:
73   required_device<cpu_device> m_maincpu;
74   required_device<ttl74145_device> m_ttl74145;
75   required_device<cassette_image_device> m_cass;
6476   UINT8 m_digit;
77   UINT8 m_cass_data[4];
78   bool m_cass_state;
6579};
6680
6781
r23767r23768
7286// bit 7 is cassin
7387READ8_MEMBER( acrnsys1_state::ins8154_b1_port_a_r )
7488{
75   UINT8 data = 0xff, i, key_line = m_ttl74145->read();
89   UINT8 data = 0x7f, i, key_line = m_ttl74145->read();
7690
7791   for (i = 0; i < 8; i++)
7892   {
r23767r23768
8498         break;
8599      }
86100   }
87
101   data |= m_cass_data[2];
88102   return data;
89103}
90104
91105// bit 6 is cassout
92106WRITE8_MEMBER( acrnsys1_state::ins8154_b1_port_a_w )
93107{
94   m_digit = data & 0xc7;
108   m_digit = data & 0x47;
95109   m_ttl74145->write(m_digit & 7);
110   m_cass_state = BIT(data, 6);
96111}
97112
113TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_c)
114{
115   m_cass_data[3]++;
98116
117   if (m_cass_state)
118      m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz
119   else
120      m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz
121}
122
123TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_p)
124{
125   /* cassette - turn 1200/2400Hz to a bit */
126   m_cass_data[1]++;
127   UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0;
128
129   if (cass_ws != m_cass_data[0])
130   {
131      m_cass_data[0] = cass_ws;
132      m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0);
133      m_cass_data[1] = 0;
134   }
135}
136
99137/***************************************************************************
100138    LED DISPLAY
101139***************************************************************************/
r23767r23768
209247
210248   MCFG_DEFAULT_LAYOUT(layout_acrnsys1)
211249
250   /* sound hardware */
251   MCFG_SPEAKER_STANDARD_MONO("mono")
252   MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
253   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
254
212255   /* devices */
213256   MCFG_INS8154_ADD("b1", ins8154_b1)
214257   MCFG_TTL74145_ADD("ic8_7445", default_ttl74145)
258   MCFG_CASSETTE_ADD( "cassette", default_cassette_interface )
259   MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_c", acrnsys1_state, acrnsys1_c, attotime::from_hz(4800))
260   MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_p", acrnsys1_state, acrnsys1_p, attotime::from_hz(40000))
215261MACHINE_CONFIG_END
216262
217263
r23767r23768
230276***************************************************************************/
231277
232278/*    YEAR  NAME      PARENT COMPAT MACHINE   INPUT     INIT  COMPANY  FULLNAME    FLAGS */
233COMP( 1978, acrnsys1, 0,     0,     acrnsys1, acrnsys1, driver_device, 0,    "Acorn", "Acorn System 1", GAME_NO_SOUND_HW )
279COMP( 1978, acrnsys1, 0,     0,     acrnsys1, acrnsys1, driver_device, 0,    "Acorn", "Acorn System 1", 0 )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team