Previous 15994 Revisions Next

r4384 Wednesday 4th March, 2009 at 20:40:02 UTC by Wilbert Pol
[OSBORNE1] Updated to use the new 6821 pia device implementation
[src/mess/drivers]osborne1.c
[src/mess/includes]osborne1.h
[src/mess/machine]osborne1.c

src/mess/includes/osborne1.h
r4383r4384
77#ifndef OSBORNE1_H_
88#define OSBORNE1_H_
99
10#include "machine/6821new.h"
1011
1112/*----------- defined in machine/osborne1.c -----------*/
1213
14extern const pia6821_interface osborne1_ieee_pia_config;
15extern const pia6821_interface osborne1_video_pia_config;
16
1317WRITE8_HANDLER( osborne1_0000_w );
1418WRITE8_HANDLER( osborne1_1000_w );
1519READ8_HANDLER( osborne1_2000_r );
src/mess/machine/osborne1.c
r4383r4384
1616
1717#include "driver.h"
1818#include "cpu/z80/z80.h"
19#include "machine/6821pia.h"
19#include "machine/6821new.h"
2020#include "machine/6850acia.h"
2121#include "machine/wd17xx.h"
2222#include "devices/basicdsk.h"
r4383r4384
7474READ8_HANDLER( osborne1_2000_r )
7575{
7676   UINT8   data = 0xFF;
77   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
77   const device_config *fdc = devtag_get_device(space->machine, MB8877, "mb8877");
78   const device_config *pia_0 = devtag_get_device(space->machine, PIA6821, "pia_0" );
79   const device_config *pia_1 = devtag_get_device(space->machine, PIA6821, "pia_1" );
80
7881   /* Check whether regular RAM is enabled */
7982   if ( ! osborne1.bank2_enabled )
8083   {
r4383r4384
106109         if ( offset & 0x80 )   data &= input_port_read(space->machine, "ROW7");
107110         break;
108111      case 0x900:   /* IEEE488 PIA */
109         data = pia_0_r( space, offset & 0x03 );
112         data = pia_r( pia_0, offset & 0x03 );
110113         break;
111114      case 0xA00:   /* Serial */
112115         break;
113116      case 0xC00:   /* Video PIA */
114         data = pia_1_r( space, offset & 0x03 );
117         data = pia_r( pia_1, offset & 0x03 );
115118         break;
116119      }
117120   }
r4383r4384
121124
122125WRITE8_HANDLER( osborne1_2000_w )
123126{
124   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
127   const device_config *fdc = devtag_get_device(space->machine, MB8877, "mb8877");
128   const device_config *pia_0 = devtag_get_device(space->machine, PIA6821, "pia_0" );
129   const device_config *pia_1 = devtag_get_device(space->machine, PIA6821, "pia_1" );
130
125131   /* Check whether regular RAM is enabled */
126132   if ( ! osborne1.bank2_enabled )
127133   {
r4383r4384
140146         wd17xx_w( fdc, offset, data );
141147         break;
142148      case 0x900:   /* IEEE488 PIA */
143         pia_0_w( space, offset & 0x03, data );
149         pia_w( pia_0, offset & 0x03, data );
144150         break;
145151      case 0xA00:   /* Serial */
146152         break;
147153      case 0xC00:   /* Video PIA */
148         pia_1_w( space, offset & 0x03, data );
154         pia_w( pia_1, offset & 0x03, data );
149155         break;
150156      }
151157   }
r4383r4384
246252}
247253
248254
249static void ieee_pia_irq_a_func(running_machine *machine, int state)
255static WRITE_LINE_DEVICE_HANDLER( ieee_pia_irq_a_func )
250256{
251257   osborne1.pia_0_irq_state = state;
252   osborne1_update_irq_state(machine);
258   osborne1_update_irq_state(device->machine);
253259}
254260
255261
256static const pia6821_interface osborne1_ieee_pia_config =
262const pia6821_interface osborne1_ieee_pia_config =
257263{
258   NULL,   /* in_a_func */
259   NULL,   /* in_b_func */
260   NULL,   /* in_ca1_func */
261   NULL,   /* in_cb1_func */
262   NULL,   /* in_ca2_func */
263   NULL,   /* in_cb2_func */
264   NULL,   /* out_a_func */
265   NULL,   /* out_b_func */
266   NULL,   /* out_ca2_func */
267   NULL,   /* out_cb2_func */
268   ieee_pia_irq_a_func,   /* irq_a_func */
269   NULL   /* irq_b_func */
264   DEVCB_NULL,                     /* in_a_func */
265   DEVCB_NULL,                     /* in_b_func */
266   DEVCB_NULL,                     /* in_ca1_func */
267   DEVCB_NULL,                     /* in_cb1_func */
268   DEVCB_NULL,                     /* in_ca2_func */
269   DEVCB_NULL,                     /* in_cb2_func */
270   DEVCB_NULL,                     /* out_a_func */
271   DEVCB_NULL,                     /* out_b_func */
272   DEVCB_NULL,                     /* out_ca2_func */
273   DEVCB_NULL,                     /* out_cb2_func */
274   DEVCB_LINE(ieee_pia_irq_a_func),   /* irq_a_func */
275   DEVCB_NULL                     /* irq_b_func */
270276};
271277
272278
273static WRITE8_HANDLER( video_pia_out_cb2_dummy )
279static WRITE8_DEVICE_HANDLER( video_pia_out_cb2_dummy )
274280{
275281}
276282
277283
278static WRITE8_HANDLER( video_pia_port_a_w )
284static WRITE8_DEVICE_HANDLER( video_pia_port_a_w )
279285{
280   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
286   const device_config *fdc = devtag_get_device(device->machine, MB8877, "mb8877");
287
281288   osborne1.new_start_x = data >> 1;
282289   wd17xx_set_density(fdc, ( data & 0x01 ) ? DEN_FM_LO : DEN_FM_HI );
283290
r4383r4384
285292}
286293
287294
288static WRITE8_HANDLER( video_pia_port_b_w )
295static WRITE8_DEVICE_HANDLER( video_pia_port_b_w )
289296{
290   device_config *fdc = (device_config*)devtag_get_device(space->machine, MB8877, "mb8877");
297   const device_config *fdc = devtag_get_device(device->machine, MB8877, "mb8877");
298
291299   osborne1.new_start_y = data & 0x1F;
292300   osborne1.beep = ( data & 0x20 ) ? 1 : 0;
293301   if ( data & 0x40 )
r4383r4384
302310}
303311
304312
305static void video_pia_irq_a_func(running_machine *machine, int state)
313static WRITE_LINE_DEVICE_HANDLER( video_pia_irq_a_func )
306314{
307315   osborne1.pia_1_irq_state = state;
308   osborne1_update_irq_state(machine);
316   osborne1_update_irq_state(device->machine);
309317}
310318
311319
312static const pia6821_interface osborne1_video_pia_config =
320const pia6821_interface osborne1_video_pia_config =
313321{
314   NULL,   /* in_a_func */
315   NULL,   /* in_b_func */
316   NULL,   /* in_ca1_func */
317   NULL,   /* in_cb1_func */
318   NULL,   /* in_ca2_func */
319   NULL,   /* in_cb2_func */
320   video_pia_port_a_w,   /* out_a_func */
321   video_pia_port_b_w,   /* out_b_func */
322   NULL,   /* out_ca2_func */
323   video_pia_out_cb2_dummy,   /* out_cb2_func */
324   video_pia_irq_a_func,   /* irq_a_func */
325   NULL   /* irq_b_func */
322   DEVCB_NULL,                        /* in_a_func */
323   DEVCB_NULL,                        /* in_b_func */
324   DEVCB_NULL,                        /* in_ca1_func */
325   DEVCB_NULL,                        /* in_cb1_func */
326   DEVCB_NULL,                        /* in_ca2_func */
327   DEVCB_NULL,                        /* in_cb2_func */
328   DEVCB_HANDLER(video_pia_port_a_w),      /* out_a_func */
329   DEVCB_HANDLER(video_pia_port_b_w),      /* out_b_func */
330   DEVCB_NULL,                        /* out_ca2_func */
331   DEVCB_HANDLER(video_pia_out_cb2_dummy),   /* out_cb2_func */
332   DEVCB_LINE(video_pia_irq_a_func),      /* irq_a_func */
333   DEVCB_NULL                        /* irq_b_func */
326334};
327335
328336
r4383r4384
343351{
344352   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
345353   const device_config *speaker = devtag_get_device(space->machine, SOUND, "beep");
354   const device_config *pia_1 = devtag_get_device(space->machine, PIA6821, "pia_1");
346355   int y = video_screen_get_vpos(machine->primary_screen);
347356
348357   /* Check for start of frame */
r4383r4384
351360      /* Clear CA1 on video PIA */
352361      osborne1.start_y = ( osborne1.new_start_y - 1 ) & 0x1F;
353362      osborne1.charline = 0;
354      pia_1_ca1_w( space, 0, 0 );
363      pia_ca1_w( pia_1, 0, 0 );
355364   }
356365   if ( y == 240 )
357366   {
358367      /* Set CA1 on video PIA */
359      pia_1_ca1_w( space, 0, 0xFF );
368      pia_ca1_w( pia_1, 0, 0xFF );
360369   }
361370   if ( y < 240 )
362371   {
r4383r4384
469478}
470479
471480
472static TIMER_CALLBACK( setup_beep )
481static TIMER_CALLBACK( setup_osborne1 )
473482{
474483   const device_config *speaker = devtag_get_device(machine, SOUND, "beep");
484   const device_config *pia_1 = devtag_get_device(machine, PIA6821, "pia_1");
485
475486   beep_set_state( speaker, 0 );
476487   beep_set_frequency( speaker, 300 /* 60 * 240 / 2 */ );
488   pia_ca1_w( pia_1, 0, 0 );
477489}
478490
479491
r4383r4384
495507
496508   osborne1.video_timer = timer_alloc(machine,  osborne1_video_callback , NULL);
497509   timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0 ), 0);
498   pia_1_ca1_w( space, 0, 0 );
499510
500   timer_set(machine,  attotime_zero, NULL, 0, setup_beep );
511   timer_set(machine,  attotime_zero, NULL, 0, setup_osborne1 );
501512
502513   memory_set_direct_update_handler( space, osborne1_opbase );
503514}
r4383r4384
510521   osborne1.empty_4K = auto_malloc( 0x1000 );
511522   memset( osborne1.empty_4K, 0xFF, 0x1000 );
512523
513   /* configure the 6821 PIAs */
514   pia_config(machine, 0, &osborne1_ieee_pia_config );
515   pia_config(machine, 1, &osborne1_video_pia_config );
516
517524   /* Configure the 6850 ACIA */
518525//   acia6850_config( 0, &osborne1_6850_config );
519526}
src/mess/drivers/osborne1.c
r4383r4384
4040#include "sound/beep.h"
4141#include "devices/basicdsk.h"
4242#include "machine/wd17xx.h"
43#include "machine/6821new.h"
4344#include "includes/osborne1.h"
4445
4546
r4383r4384
186187   MDRV_SOUND_ADD( "beep", BEEP, 0 )
187188   MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
188189   
190   MDRV_PIA6821_ADD( "pia_0", osborne1_ieee_pia_config )
191   MDRV_PIA6821_ADD( "pia_1", osborne1_video_pia_config )
192
189193   MDRV_MB8877_ADD("mb8877", default_wd17xx_interface )
190194   
191195MACHINE_DRIVER_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team