Previous 15994 Revisions Next

r14136 Monday 23rd January, 2012 at 11:17:22 UTC by Robbbert
AIM65: added cassette interface (but it doesn't work)
[src/mess/drivers]aim65.c
[src/mess/includes]aim65.h
[src/mess/video]aim65.c

src/mess/video/aim65.c
r14135r14136
9191}
9292
9393
94WRITE8_MEMBER( aim65_state::aim65_printer_data_a )
94WRITE8_MEMBER( aim65_state::aim65_pa_w )
9595{
96// All bits are for printer data (not emulated)
9697#if 0
9798   if (m_flag_a == 0)
9899   {
r14135r14136
102103#endif
103104}
104105
105WRITE8_MEMBER( aim65_state::aim65_printer_data_b )
106WRITE8_MEMBER( aim65_state::aim65_pb_w )
106107{
108/*
109   d7 = cass out (both decks)
110   d5 = cass2 motor
111   d4 = cass1 motor
112   d2 = tty out (not emulated)
113   d0/1 = printer data (not emulated)
114*/
115
116   UINT8 bits = data ^ m_pb_save;
117   m_pb_save = data;
118
119   if (BIT(bits, 7))
120   {
121      m_cass1->output(BIT(data, 7) ? -1.0 : +1.0);
122      m_cass2->output(BIT(data, 7) ? -1.0 : +1.0);
123   }
124
125   if (BIT(bits, 5))
126   {
127      if (BIT(data, 5))
128         m_cass2->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
129      else
130         m_cass2->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
131   }
132
133   if (BIT(bits, 4))
134   {
135      if (BIT(data, 4))
136         m_cass1->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
137      else
138         m_cass1->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
139   }
140
141
107142#if 0
108143   data &= 0x03;
109144
r14135r14136
132167   state->m_flag_a = 0;
133168   state->m_flag_b = 0;
134169   state->m_printer_level = 0;
170   state->m_pb_save = 0;
135171}
136172
137173
r14135r14136
168204   return 0;
169205}
170206#endif
207
208
209READ8_MEMBER( aim65_state::aim65_pb_r )
210{
211/*
212   d7 = cassette in (deck 1)
213   d6 = tty in (not emulated)
214   d3 = kb/tty switch
215*/
216
217   UINT8 data = input_port_read(machine(), "switches");
218   data |= (m_cass1->input() > +0.03) ? 0x80 : 0;
219   data |= 0x40; // TTY must be H if not used.
220   data |= m_pb_save & 0x37;
221   return data;
222}
223
src/mess/includes/aim65.h
r14135r14136
1515#include "machine/6522via.h"
1616#include "machine/6532riot.h"
1717#include "machine/6821pia.h"
18#include "machine/ram.h"
1819#include "imagedev/cartslot.h"
19#include "machine/ram.h"
20#include "imagedev/cassette.h"
21#include "sound/wave.h"
2022
23
2124/** R6502 Clock.
2225 *
2326 * The R6502 on AIM65 operates at 1 MHz. The frequency reference is a 4 MHz
r14135r14136
3134{
3235public:
3336   aim65_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag) { }
37      : driver_device(mconfig, type, tag),
38   m_maincpu(*this, "maincpu"),
39   m_cass1(*this, CASSETTE_TAG),
40   m_cass2(*this, CASSETTE2_TAG)
41   { }
3542
3643   DECLARE_WRITE8_MEMBER(aim65_pia_a_w);
3744   DECLARE_WRITE8_MEMBER(aim65_pia_b_w);
3845   DECLARE_READ8_MEMBER(aim65_riot_b_r);
3946   DECLARE_WRITE8_MEMBER(aim65_riot_a_w);
40   DECLARE_WRITE8_MEMBER(aim65_printer_data_a);
41   DECLARE_WRITE8_MEMBER(aim65_printer_data_b);
47   DECLARE_WRITE8_MEMBER(aim65_pa_w);
48   DECLARE_WRITE8_MEMBER(aim65_pb_w);
4249   DECLARE_WRITE8_MEMBER(aim65_printer_on);
50   DECLARE_READ8_MEMBER(aim65_pb_r);
4351   UINT8 m_pia_a;
4452   UINT8 m_pia_b;
4553   UINT8 m_riot_port_a;
54   UINT8 m_pb_save;
4655   emu_timer *m_print_timer;
4756   int m_printer_x;
4857   int m_printer_y;
r14135r14136
5059   bool m_flag_a;
5160   bool m_flag_b;
5261   bool m_printer_level;
62
63   required_device<cpu_device> m_maincpu;
64   required_device<cassette_image_device> m_cass1;
65   required_device<cassette_image_device> m_cass2;
5366};
5467
5568
src/mess/drivers/aim65.c
r14135r14136
55
66ToDo:
77    - Printer. Tried to implement this but it was not working, currently disabled.
8    - Dual tape interface
8    - Dual tape interface (done, but see bugs below)
99    - Implement punchtape reader/writer and TTY keyboard
1010    - Front panel Reset switch (switch S1)
1111    - Front panel Run/Step switch (switch S2)
1212
13Bugs
14    - Cassette should output data on PB7, but the bit stays High.
15    - At the end of saving, both motors sometimes get turned on!
16    - CA2 should switch the cassette circuits between input and output.
17      It goes High on Read (correct) but doesn't go Low for Write.
18    - Read of CA1 is to check the printer, but it never happens.
19    - Write to CB1 should occur to activate printer's Start line, but it
20      also never happens.
21    - The common factor is the 6522, maybe it has problems..
22
1323******************************************************************************/
1424#define ADDRESS_MAP_MODERN
1525
r14135r14136
133143    DEVICE INTERFACES
134144***************************************************************************/
135145
146
136147/* Riot interface Z33 */
137148static const riot6532_interface aim65_riot_interface =
138149{
r14135r14136
146157/* system via interface Z32 */
147158static const via6522_interface aim65_system_via =
148159{
149   DEVCB_NULL,
150   DEVCB_INPUT_PORT("switches"),
151   DEVCB_NULL,
152   DEVCB_NULL,
153   DEVCB_NULL,
154   DEVCB_NULL,
155   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_data_a),
156   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_data_b),
157   DEVCB_NULL,
158   DEVCB_NULL,
159   DEVCB_NULL,
160   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_on),
161   DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE)
160   DEVCB_NULL, // in port A
161   DEVCB_DRIVER_MEMBER(aim65_state, aim65_pb_r), // in port B
162   DEVCB_NULL, // in CA1 printer ready?
163   DEVCB_NULL, // in CB1
164   DEVCB_NULL, // in CA2
165   DEVCB_NULL, // in CB2
166   DEVCB_DRIVER_MEMBER(aim65_state, aim65_pa_w), // out port A
167   DEVCB_DRIVER_MEMBER(aim65_state, aim65_pb_w), // out port B
168   DEVCB_NULL, // out CA1
169   DEVCB_NULL, // out CB1 printer start
170   DEVCB_NULL, // out CA2 cass control (H=in)
171   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2
172   DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE) //IRQ
162173};
163174
164175/* user via interface Z1 */
r14135r14136
196207   DEVCB_NULL
197208};
198209
210// Deck 1 can play and record
211static const cassette_interface aim65_1_cassette_interface =
212{
213   cassette_default_formats,
214   NULL,
215   (cassette_state)(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED),
216   NULL,
217   NULL
218};
199219
220// Deck 2 can only record
221static const cassette_interface aim65_2_cassette_interface =
222{
223   cassette_default_formats,
224   NULL,
225   (cassette_state)(CASSETTE_RECORD | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED),
226   NULL,
227   NULL
228};
229
230
200231/***************************************************************************
201232    MACHINE DRIVERS
202233***************************************************************************/
r14135r14136
219250
220251   MCFG_VIDEO_START(aim65)
221252
253   /* Sound - wave sound only */
254   MCFG_SPEAKER_STANDARD_MONO("mono")
255   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
256   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
257
222258   /* other devices */
223259   MCFG_RIOT6532_ADD("riot", AIM65_CLOCK, aim65_riot_interface)
224260   MCFG_VIA6522_ADD("via6522_0", 0, aim65_system_via)
225261   MCFG_VIA6522_ADD("via6522_1", 0, aim65_user_via)
226262   MCFG_PIA6821_ADD("pia6821", aim65_pia_config)
227263
264   MCFG_CASSETTE_ADD( CASSETTE_TAG, aim65_1_cassette_interface )
265   MCFG_CASSETTE_ADD( CASSETTE2_TAG, aim65_2_cassette_interface )
266
228267   MCFG_CARTSLOT_ADD("cart1")
229268   MCFG_CARTSLOT_EXTENSION_LIST("z26")
230269   MCFG_CARTSLOT_NOT_MANDATORY

Previous 15994 Revisions Next


© 1998-2018 The MESS Team