Previous 15994 Revisions Next

r4792 Friday 22nd May, 2009 at 15:01:53 UTC by Miodrag Milanović
[POLY88] Some cassette code
[src/mess/drivers]poly88.c
[src/mess/includes]poly88.h
[src/mess/machine]poly88.c

src/mess/includes/poly88.h
r4791r4792
1111
1212/*----------- defined in machine/poly88.c -----------*/
1313
14DRIVER_INIT(poly88);
1415MACHINE_RESET(poly88);
1516INTERRUPT_GEN( poly88_interrupt );
1617READ8_HANDLER(poly_keyboard_r);
src/mess/machine/poly88.c
r4791r4792
99#include "driver.h"
1010#include "includes/poly88.h"
1111#include "cpu/i8085/i8085.h"
12#include "devices/cassette.h"
13#include "includes/serial.h"
1214
1315static UINT8 intr = 0;
1416static UINT8 last_code = 0;
1517static UINT8 int_vector = 0;
18static emu_timer * poly88_cassette_timer;
1619
1720WRITE8_HANDLER(poly_baud_rate_w)
1821{
r4791r4792
121124   return int_vector;
122125}
123126
127
128static struct serial_connection poly88_cassette_serial_connection;
129
130static void poly88_cassette_write(running_machine *machine, int id, unsigned long state)
131{
132   poly88_cassette_serial_connection.input_state = state;
133}
134
135static TIMER_CALLBACK(poly88_cassette_timer_callback)
136{
137   int data;
138//   int current_level;
139//   static int previous_level = 0;
140   static int clk_level = 1;
141   static int clk_level_tape = 1;
142
143   //int_vector = 0xe7;
144   //cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), 0, HOLD_LINE);   
145
146//   if (!(input_port_read(machine, "DSW0") & 0x02))   /* V.24 / Tape Switch */
147   //{
148      /* tape reading */
149/*      if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_PLAY)
150      {
151               if (clk_level_tape)
152               {
153                  previous_level = (cassette_input(devtag_get_device(machine, "cassette")) > 0.038) ? 1 : 0;
154                  clk_level_tape = 0;
155               }
156               else
157               {
158                  current_level = (cassette_input(devtag_get_device(machine, "cassette")) > 0.038) ? 1 : 0;
159
160                  if (previous_level!=current_level)
161                  {
162                     data = (!previous_level && current_level) ? 1 : 0;
163
164                     set_out_data_bit(pmd85_cassette_serial_connection.State, data);
165                     serial_connection_out(machine, &pmd85_cassette_serial_connection);
166                     msm8251_receive_clock(devtag_get_device(machine, "uart"));
167
168                     clk_level_tape = 1;
169                  }
170               }
171      }
172      */
173      /* tape writing */
174      if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_RECORD)
175      {
176         data = get_in_data_bit(poly88_cassette_serial_connection.input_state);
177         data ^= clk_level_tape;
178         cassette_output(devtag_get_device(machine, "cassette"), data&0x01 ? 1 : -1);
179
180         if (!clk_level_tape)
181            msm8251_transmit_clock(devtag_get_device(machine, "uart"));
182
183         clk_level_tape = clk_level_tape ? 0 : 1;
184
185         return;
186      }
187
188      clk_level_tape = 1;
189
190      if (!clk_level)
191         msm8251_transmit_clock(devtag_get_device(machine, "uart"));
192      clk_level = clk_level ? 0 : 1;
193//   }
194}
195
196
197static TIMER_CALLBACK( setup_machine_state )
198{
199   msm8251_connect(devtag_get_device(machine, "uart"), &poly88_cassette_serial_connection);
200}
201
202DRIVER_INIT ( poly88 )
203{
204   poly88_cassette_timer = timer_alloc(machine, poly88_cassette_timer_callback, NULL);
205   timer_adjust_periodic(poly88_cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2400));
206
207   serial_connection_init(machine, &poly88_cassette_serial_connection);
208   serial_connection_set_in_callback(machine, &poly88_cassette_serial_connection, poly88_cassette_write);
209}
210
124211MACHINE_RESET(poly88)
125212{   
126213   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), poly88_irq_callback);
127   timer_pulse(machine, ATTOTIME_IN_HZ(2400), NULL, 0, keyboard_callback);
214   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
128215   intr = 0;
129216   last_code = 0;
217     
218   timer_set(machine,  attotime_zero, NULL, 0, setup_machine_state );
130219}
131220
132221INTERRUPT_GEN( poly88_interrupt )
r4791r4792
136225}
137226static void poly88_usart_rxready (const device_config *device, int state)
138227{
139   int_vector = 0xe7;
228   //int_vector = 0xe7;
140229   //cpu_set_input_line(device, 0, HOLD_LINE);   
141230}
142231const msm8251_interface poly88_usart_interface=
src/mess/drivers/poly88.c
r4791r4792
88
99#include "driver.h"
1010#include "cpu/i8085/i8085.h"
11#include "devices/cassette.h"
1112#include "includes/poly88.h"
1213
1314static ADDRESS_MAP_START(poly88_mem, ADDRESS_SPACE_PROGRAM, 8)
r4791r4792
113114   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT)   
114115INPUT_PORTS_END
115116
117static const struct CassetteOptions poly88_cassette_options =
118{
119   1,      /* channels */
120   16,      /* bits per sample */
121   7200   /* sample frequency */
122};
123
124static const cassette_config poly88_cassette_config =
125{
126   cassette_default_formats,
127   &poly88_cassette_options,
128   CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED
129};
130
131
116132static MACHINE_DRIVER_START( poly88 )
117133    /* basic machine hardware */
118134    MDRV_CPU_ADD("maincpu",8080, 1853000)
r4791r4792
135151    MDRV_VIDEO_START(poly88)
136152    MDRV_VIDEO_UPDATE(poly88)
137153   
154    /* cassette */
155   MDRV_CASSETTE_ADD( "cassette", poly88_cassette_config )
156   
138157    /* uart */
139158   MDRV_MSM8251_ADD("uart", poly88_usart_interface)
140159   
r4791r4792
156175/* Driver */
157176
158177/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY                 FULLNAME       FLAGS */
159COMP( 1976, poly88,  0,     0,        poly88,    poly88,  0,      poly88,"PolyMorphic Systems",   "Poly-88",    GAME_NOT_WORKING)
178COMP( 1976, poly88,  0,     0,        poly88,    poly88,  poly88, poly88,"PolyMorphic Systems",   "Poly-88",    GAME_NOT_WORKING)
160179

Previous 15994 Revisions Next


© 1998-2018 The MESS Team