Previous 15994 Revisions Next

r1958 Tuesday 11th March, 2008 at 23:50:43 UTC by Wilbert Pol
Updated WD17xx implementation to pass running_machine around.
[src/mess/devices]coco_fdc.c thomflop.c thomflop.h
[src/mess/drivers]a310.c apf.c atarist.c einstein.c enterp.c exidy.c spectrum.c
[src/mess/machine]99_dsk.c bbc.c cgenie.c coco.c concept.c coupe.c dgn_beta.c mbee.c msx.c nascom1.c oric.c osborne1.c svi318.c thomson.c trs80.c wd17xx.c wd17xx.h

src/mess/devices/coco_fdc.c
r1957r1958
109109    fdc_callback - callback from the FDC
110110-------------------------------------------------*/
111111
112static void fdc_callback(wd17xx_state_t state, void *param)
112static void fdc_callback(running_machine *machine, wd17xx_state_t state, void *param)
113113{
114114   coco_cartridge *cartridge = (coco_cartridge *) param;
115115   fdc_info *info = fdc_get_info(cartridge);
r1957r1958
155155   info->drq = initial_drq ? 1 : 0;
156156
157157   /* initialize FDC */
158   wd17xx_init(type, fdc_callback, (void *) cartridge);
158   wd17xx_init(Machine, type, fdc_callback, (void *) cartridge);
159159}
160160
161161
src/mess/devices/thomflop.c
r1957r1958
349349
350350
351351
352static void to7_5p14_init( void )
352static void to7_5p14_init( running_machine *machine )
353353{
354354   LOG(( "to7_5p14_init: CD 90-640 controller\n" ));
355   wd17xx_init( WD_TYPE_2793, NULL, NULL );
355   wd17xx_init( machine, WD_TYPE_2793, NULL, NULL );
356356   state_save_register_global( to7_5p14_select );
357357}
358358
r1957r1958
17581758UINT8 to7_floppy_bank;
17591759
17601760
1761void to7_floppy_init ( void* base )
1761void to7_floppy_init ( running_machine *machine, void* base )
17621762{
17631763   memory_configure_bank( THOM_FLOP_BANK, 0, TO7_NB_FLOP_BANK, base, 0x800 );
17641764   state_save_register_global( to7_controller_type );
17651765   state_save_register_global( to7_floppy_bank );
17661766   to7_5p14sd_init();
1767   to7_5p14_init();
1767   to7_5p14_init(machine);
17681768   to7_qdd_init();
17691769   thmfc_floppy_init();
17701770   to7_network_init();
r1957r1958
18841884
18851885
18861886
1887void to9_floppy_init( void* int_base, void* ext_base )
1887void to9_floppy_init( running_machine *machine, void* int_base, void* ext_base )
18881888{
1889   to7_floppy_init( ext_base );
1889   to7_floppy_init( machine, ext_base );
18901890   memory_configure_bank( THOM_FLOP_BANK, TO7_NB_FLOP_BANK, 1, int_base, 0x800 );
18911891}
18921892
src/mess/devices/thomflop.h
r1957r1958
2727
2828
2929/* external controllers */
30extern void to7_floppy_init  ( void* base );
30extern void to7_floppy_init  ( running_machine *machine, void* base );
3131extern void to7_floppy_reset ( void );
3232extern READ8_HANDLER  ( to7_floppy_r );
3333extern WRITE8_HANDLER ( to7_floppy_w );
3434
3535/* TO9 internal (WD2793) & external controllers */
36extern void to9_floppy_init  ( void* int_base, void* ext_base );
36extern void to9_floppy_init  ( running_machine *machine, void* int_base, void* ext_base );
3737extern void to9_floppy_reset ( void );
3838extern READ8_HANDLER  ( to9_floppy_r );
3939extern WRITE8_HANDLER ( to9_floppy_w );
src/mess/machine/dgn_beta.c
r1957r1958
901901/* Dragon Beta onboard FDC */
902902/********************************************************************************************/
903903
904static void dgnbeta_fdc_callback(wd17xx_state_t event, void *param)
904static void dgnbeta_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
905905{
906   running_machine *machine = Machine;
907906   /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */
908907   /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */
909908
r1957r1958
11001099
11011100   init_video(machine);
11021101
1103   wd17xx_init(WD_TYPE_179X,dgnbeta_fdc_callback, NULL);
1102   wd17xx_init(machine, WD_TYPE_179X,dgnbeta_fdc_callback, NULL);
11041103#ifdef ENABLE_DEBUGGER
11051104   cpuintrf_set_dasm_override(0,dgnbeta_dasm_override);
11061105#endif /* ENABLE_DEBUGGER */
src/mess/machine/mbee.c
r1957r1958
3131static UINT8 fdc_den = 0;
3232static UINT8 fdc_status = 0;
3333static void pio_interrupt(int state);
34static void mbee_fdc_callback(wd17xx_state_t event, void *param);
34static void mbee_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param);
3535
3636UINT8 *mbee_workram;
3737
r1957r1958
6969
7070MACHINE_START( mbee )
7171{
72   wd17xx_init(WD_TYPE_179X,mbee_fdc_callback, NULL);
72   wd17xx_init(machine, WD_TYPE_179X,mbee_fdc_callback, NULL);
7373}
7474
7575static mess_image *cassette_device_image(void)
r1957r1958
114114   }
115115}
116116
117static void mbee_fdc_callback(wd17xx_state_t state, void *param)
117static void mbee_fdc_callback(running_machine *machine, wd17xx_state_t state, void *param)
118118{
119119   switch( state )
120120   {
src/mess/machine/coco.c
r1957r1958
15741574/* Dragon Alpha onboard FDC */
15751575/********************************************************************************************/
15761576
1577static void   dgnalpha_fdc_callback(wd17xx_state_t event, void *param)
1577static void   dgnalpha_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
15781578{
1579   running_machine *machine = Machine;
1580
15811579   /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2  */
15821580   /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */
15831581   /* for pia1 cb1 */
r1957r1958
29472945   /* by the WD2797, it is reset to 0 after the first inurrupt */
29482946   dgnalpha_just_reset=1;
29492947
2950   wd17xx_init(WD_TYPE_179X, dgnalpha_fdc_callback, NULL);
2948   wd17xx_init(machine, WD_TYPE_179X, dgnalpha_fdc_callback, NULL);
29512949}
29522950
29532951/******* Machine Setups CoCos **********/
src/mess/machine/concept.c
r1957r1958
568568   LC_FMMFM_mask   = (1 << LC_FMMFM_bit)
569569};
570570
571static void fdc_callback(wd17xx_state_t event, void *param);
571static void fdc_callback(running_machine *machine, wd17xx_state_t event, void *param);
572572
573573static  READ8_HANDLER(concept_fdc_reg_r);
574574static WRITE8_HANDLER(concept_fdc_reg_w);
r1957r1958
579579   fdc_local_status = 0;
580580   fdc_local_command = 0;
581581
582   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);
582   wd17xx_init(Machine, WD_TYPE_179X, fdc_callback, NULL);
583583
584584   install_expansion_slot(slot, concept_fdc_reg_r, concept_fdc_reg_w, concept_fdc_rom_r, NULL);
585585}
586586
587static void fdc_callback(wd17xx_state_t event, void *param)
587static void fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
588588{
589589   switch (event)
590590   {
src/mess/machine/99_dsk.c
r1957r1958
368368/*
369369   callback called whenever DRQ/IRQ state change
370370*/
371static void fdc_callback(wd17xx_state_t event, void *param)
371static void fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
372372{
373373   switch (event)
374374   {
r1957r1958
399399void ti99_floppy_controllers_init_all(void)
400400{
401401   /* initialize the controller chip for TI FDC, CC, BwG */
402   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);
402   wd17xx_init(Machine, WD_TYPE_179X, fdc_callback, NULL);
403403
404404   /* initialize the controller chip for HFDC */
405405   smc92x4_init(0, & hfdc_intf);
r1957r1958
418418*/
419419
420420/* prototypes */
421static void fdc_callback(wd17xx_state_t event, void *param);
421static void fdc_callback(running_machine *machine, wd17xx_state_t event, void *param);
422422static TIMER_CALLBACK(motor_on_timer_callback);
423423static int fdc_cru_r(running_machine *machine, int offset);
424424static void fdc_cru_w(running_machine *machine, int offset, int data);
src/mess/machine/msx.c
r1957r1958
313313   msx_ch_reset_core ();
314314}
315315
316static void msx_wd179x_int (wd17xx_state_t state, void *param);
316static void msx_wd179x_int (running_machine *machine, wd17xx_state_t state, void *param);
317317
318318static WRITE8_HANDLER ( msx_ppi_port_a_w );
319319static WRITE8_HANDLER ( msx_ppi_port_c_w );
r1957r1958
349349      msx1.cart_state[i] = cart_state[i];
350350   }
351351
352   wd17xx_init (WD_TYPE_179X, msx_wd179x_int, NULL);
352   wd17xx_init (Machine, WD_TYPE_179X, msx_wd179x_int, NULL);
353353   wd17xx_set_density (DEN_FM_HI);
354354   msx1.dsk_stat = 0x7f;
355355
r1957r1958
644644
645645*/
646646
647static void msx_wd179x_int (wd17xx_state_t state, void *param)
647static void msx_wd179x_int (running_machine *machine, wd17xx_state_t state, void *param)
648648{
649649   switch (state)
650650   {
src/mess/machine/thomson.c
r1957r1958
12931293   pia_config( THOM_PIA_SYS, &to7_sys );
12941294   mc6846_config( &to7_timer );
12951295   to7_game_init();
1296   to7_floppy_init( mem + 0x20000 );
1296   to7_floppy_init( machine, mem + 0x20000 );
12971297   to7_io_init();
12981298   to7_modem_init();
12991299   to7_midi_init();
r1957r1958
15261526   pia_config( THOM_PIA_SYS, &to770_sys );
15271527   mc6846_config( &to770_timer );
15281528   to7_game_init();
1529   to7_floppy_init( mem + 0x20000 );
1529   to7_floppy_init( machine, mem + 0x20000 );
15301530   to7_io_init();
15311531   to7_modem_init();
15321532   to7_midi_init();
r1957r1958
18731873   thom_irq_init();
18741874   pia_config( THOM_PIA_SYS, &mo5_sys );
18751875   to7_game_init();
1876   to7_floppy_init( mem + 0x20000 );
1876   to7_floppy_init( machine, mem + 0x20000 );
18771877   to7_io_init();
18781878   to7_modem_init();
18791879   to7_midi_init();
r1957r1958
28142814   centronics_config( 0, &to9_centronics );
28152815   mc6846_config( &to9_timer );
28162816   to7_game_init();
2817   to9_floppy_init( mem + 0xe000, mem + 0x40000 );
2817   to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 );
28182818   to9_kbd_init();
28192819   to9_palette_init();
28202820   to7_modem_init();
r1957r1958
33433343
33443344
33453345
3346static void to8_floppy_init( void )
3346static void to8_floppy_init( running_machine *machine )
33473347{
33483348   UINT8* mem = memory_region(REGION_CPU1);
3349   to7_floppy_init( mem + 0x34000 );
3349   to7_floppy_init( machine, mem + 0x34000 );
33503350}
33513351
33523352
r1957r1958
37503750   centronics_config( 0, &to9_centronics );
37513751   mc6846_config( &to8_timer );
37523752   to7_game_init();
3753   to8_floppy_init();
3753   to8_floppy_init( machine );
37543754   to8_kbd_init();
37553755   to9_palette_init();
37563756   to7_modem_init();
r1957r1958
39123912   centronics_config( 0, &to9_centronics );
39133913   mc6846_config( &to9p_timer );
39143914   to7_game_init();
3915   to8_floppy_init();
3915   to8_floppy_init( machine );
39163916   to9_kbd_init();
39173917   to9_palette_init();
39183918   to7_modem_init();
r1957r1958
44794479   pia_config( THOM_PIA_SYS, &mo6_sys );
44804480   centronics_config( 0, &to9_centronics );
44814481   mo6_game_init();
4482   to7_floppy_init( mem + 0x30000 );
4482   to7_floppy_init( machine, mem + 0x30000 );
44834483   to9_palette_init();
44844484   to7_modem_init();
44854485   to7_midi_init();
r1957r1958
47464746   pia_config( THOM_PIA_SYS, &mo5nr_sys );
47474747   centronics_config( 0, &to9_centronics );
47484748   mo5nr_game_init();
4749   to7_floppy_init( mem + 0x30000 );
4749   to7_floppy_init( machine, mem + 0x30000 );
47504750   to9_palette_init();
47514751   to7_modem_init();
47524752   to7_midi_init();
src/mess/machine/cgenie.c
r1957r1958
212212   return address;
213213}
214214
215static void cgenie_fdc_callback(wd17xx_state_t event, void *param);
215static void cgenie_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param);
216216
217217MACHINE_RESET( cgenie )
218218{
r1957r1958
332332   memory_set_bankptr(1, mess_ram);
333333
334334   /* set up FDC */
335   wd17xx_init(WD_TYPE_179X, cgenie_fdc_callback, NULL);
335   wd17xx_init(machine, WD_TYPE_179X, cgenie_fdc_callback, NULL);
336336
337337   add_exit_callback(machine, tape_put_close);
338338}
r1957r1958
984984   }
985985}
986986
987void cgenie_fdc_callback(wd17xx_state_t event, void *param)
987void cgenie_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
988988{
989989   /* if disc hardware is not enabled, do not cause an int */
990990   if (!( readinputport(0) & 0x80 ))
r1957r1958
996996         irq_status &= ~IRQ_FDC;
997997         break;
998998      case WD17XX_IRQ_SET:
999         cgenie_fdc_interrupt(Machine, 0);
999         cgenie_fdc_interrupt(machine, 0);
10001000         break;
10011001      case WD17XX_DRQ_CLR:
10021002      case WD17XX_DRQ_SET:
src/mess/machine/oric.c
r1957r1958
3535
3636UINT8 *oric_ram;
3737
38static int enable_logging = 0;
38static int enable_logging = 1;
3939/* static int save_done = 0; */
4040
4141
r1957r1958
10601060/*********************************************************/
10611061
10621062
1063static void oric_wd179x_callback(wd17xx_state_t State, void *param)
1063static void oric_wd179x_callback(running_machine *machine, wd17xx_state_t State, void *param)
10641064{
10651065   switch (readinputport(9) &  0x07)
10661066   {
r1957r1958
11311131
11321132   oric_ram_0x0c000 = auto_malloc(16384);
11331133
1134   wd17xx_init(WD_TYPE_179X,oric_wd179x_callback, NULL);
1134   wd17xx_init(machine, WD_TYPE_179X,oric_wd179x_callback, NULL);
11351135}
11361136
11371137
r1957r1958
15211521   via_config(1, &telestrat_via2_interface);
15221522   via_set_clock(1,1000000);
15231523
1524   wd17xx_init(WD_TYPE_179X,oric_wd179x_callback, NULL);
1524   wd17xx_init(machine, WD_TYPE_179X,oric_wd179x_callback, NULL);
15251525}
src/mess/machine/nascom1.c
r1957r1958
5555 *
5656 *************************************/
5757
58static void nascom2_fdc_callback(wd17xx_state_t event, void *param)
58static void nascom2_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
5959{
6060   switch (event)
6161   {
r1957r1958
302302      break;
303303   }
304304
305   wd17xx_init(WD_TYPE_1793, nascom2_fdc_callback, NULL);
305   wd17xx_init(machine, WD_TYPE_1793, nascom2_fdc_callback, NULL);
306306}
src/mess/machine/osborne1.c
r1957r1958
456456//   acia6850_config( 0, &osborne1_6850_config );
457457
458458   /* Configure the floppy disk interface */
459   wd17xx_init( WD_TYPE_MB8877, NULL, NULL );
459   wd17xx_init( machine, WD_TYPE_MB8877, NULL, NULL );
460460}
461461
src/mess/machine/wd17xx.c
r1957r1958
142142typedef struct _wd17xx_info wd17xx_info;
143143struct _wd17xx_info
144144{
145   void   (*callback)(wd17xx_state_t event, void *param);   /* callback for IRQ status */
145   void   (*callback)(running_machine *, wd17xx_state_t event, void *param);   /* callback for IRQ status */
146146   void   *callback_param;
147147   DENSITY   density;            /* FM/MFM, single / double density */
148148   wd17xx_type_t type;
r1957r1958
242242***************************************************************************/
243243
244244static void wd17xx_complete_command(wd17xx_info *, int delay);
245static void wd17xx_clear_data_request(void);
246static void wd17xx_set_data_request(void);
245static void wd17xx_clear_data_request(running_machine *);
246static void wd17xx_set_data_request(running_machine *);
247247static void wd17xx_timed_data_request(void);
248static void wd17xx_set_irq(wd17xx_info *);
248static void wd17xx_set_irq(running_machine *, wd17xx_info *);
249249static emu_timer *busy_timer = NULL;
250250
251251/* one wd controlling multiple drives */
r1957r1958
304304static TIMER_CALLBACK(wd17xx_busy_callback)
305305{
306306   wd17xx_info *info = (wd17xx_info *) ptr;
307   wd17xx_set_irq(info);
307   wd17xx_set_irq(machine, info);
308308   timer_reset(busy_timer, attotime_never);
309309}
310310
r1957r1958
387387
388388
389389
390void wd17xx_init(wd17xx_type_t type, void (*callback)(wd17xx_state_t, void *), void *param)
390void wd17xx_init(running_machine *machine, wd17xx_type_t type, void (*callback)(running_machine *, wd17xx_state_t, void *), void *param)
391391{
392   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call wd17xx_init at init time!");
392   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call wd17xx_init at init time!");
393393
394394   memset(&wd, 0, sizeof(wd));
395395   wd.status = STA_1_TRACK0;
r1957r1958
436436
437437
438438/* read an entire track */
439static void read_track(wd17xx_info * w)
439static void read_track(running_machine *machine, wd17xx_info * w)
440440{
441441#if 0
442442   UINT8 *psrc;      /* pointer to track format structure */
r1957r1958
563563
564564   w->data_offset = 0;
565565
566   wd17xx_set_data_request();
566   wd17xx_set_data_request(machine);
567567   w->status |= STA_2_BUSY;
568568   w->busy_count = 0;
569569}
r1957r1958
596596
597597
598598/* read the next data address mark */
599static void wd17xx_read_id(wd17xx_info * w)
599static void wd17xx_read_id(running_machine *machine, wd17xx_info * w)
600600{
601601   chrn_id id;
602602
r1957r1958
634634      w->status |= STA_2_BUSY;
635635      w->busy_count = 0;
636636
637      wd17xx_set_data_request();
637      wd17xx_set_data_request(machine);
638638
639639      logerror("read id succeeded.\n");
640640   }
r1957r1958
761761
762762
763763
764static void wd17xx_callback(wd17xx_info *w, wd17xx_state_t state)
764static void wd17xx_callback(running_machine *machine, wd17xx_info *w, wd17xx_state_t state)
765765{
766766   if (w->callback)
767      (*w->callback)(state, w->callback_param);
767      (*w->callback)(machine, state, w->callback_param);
768768}
769769
770770
771771
772static void   wd17xx_set_irq(wd17xx_info *w)
772static void   wd17xx_set_irq(running_machine *machine, wd17xx_info *w)
773773{
774774   w->status &= ~STA_2_BUSY;
775775   /* generate an IRQ */
776   wd17xx_callback(w, WD17XX_IRQ_SET);
776   wd17xx_callback(machine, w, WD17XX_IRQ_SET);
777777}
778778
779779
r1957r1958
795795   switch(callback_type) {
796796   case MISCCALLBACK_COMMAND:
797797      /* command callback */
798      wd17xx_set_irq(w);
798      wd17xx_set_irq(machine, w);
799799      break;
800800
801801   case MISCCALLBACK_DATA:
802802      /* data callback */
803803      /* ok, trigger data request now */
804      wd17xx_set_data_request();
804      wd17xx_set_data_request(machine);
805805      break;
806806   }
807807
r1957r1958
902902
903903
904904/* clear a data request */
905static void wd17xx_clear_data_request(void)
905static void wd17xx_clear_data_request(running_machine *machine)
906906{
907907   wd17xx_info *w = &wd;
908908
909909//   w->status_drq = 0;
910   wd17xx_callback(w, WD17XX_DRQ_CLR);
910   wd17xx_callback(machine, w, WD17XX_DRQ_CLR);
911911   w->status &= ~STA_2_DRQ;
912912}
913913
914914
915915
916916/* set data request */
917static void wd17xx_set_data_request(void)
917static void wd17xx_set_data_request(running_machine *machine)
918918{
919919   wd17xx_info *w = &wd;
920920
r1957r1958
926926
927927   /* set drq */
928928//   w->status_drq = STA_2_DRQ;
929   wd17xx_callback(w, WD17XX_DRQ_SET);
929   wd17xx_callback(machine, w, WD17XX_DRQ_SET);
930930   w->status |= STA_2_DRQ;
931931}
932932
r1957r1958
990990            w->data_offset = 0;
991991            w->data_count = w->sector_length;
992992
993            wd17xx_set_data_request();
993            wd17xx_set_data_request(machine);
994994
995995            w->status |= STA_2_BUSY;
996996            w->busy_count = 0;
r1957r1958
10521052   wd17xx_info *w = &wd;
10531053   int result = w->status;
10541054
1055   wd17xx_callback(w, WD17XX_IRQ_CLR);
1055   wd17xx_callback(machine, w, WD17XX_IRQ_CLR);
10561056//   if (w->busy_count)
10571057//   {
10581058//      if (!--w->busy_count)
r1957r1958
11351135   if (w->data_count >= 1)
11361136   {
11371137      /* clear data request */
1138      wd17xx_clear_data_request();
1138      wd17xx_clear_data_request(machine);
11391139
11401140      /* yes */
11411141      w->data = w->buffer[w->data_offset++];
r1957r1958
12101210   floppy_drive_set_motor_state(wd17xx_current_image(), 1);
12111211   floppy_drive_set_ready_state(wd17xx_current_image(), 1,0);
12121212   /* also cleared by writing command */
1213   wd17xx_callback(w, WD17XX_IRQ_CLR);
1213   wd17xx_callback(machine, w, WD17XX_IRQ_CLR);
12141214
12151215   /* clear write protected. On read sector, read track and read dam, write protected bit is clear */
12161216   w->status &= ~((1<<6) | (1<<5) | (1<<4));
r1957r1958
12241224      w->data_offset = 0;
12251225      w->status &= ~(STA_2_BUSY);
12261226
1227      wd17xx_clear_data_request();
1227      wd17xx_clear_data_request(machine);
12281228
12291229      if (data & 0x0f)
12301230      {
r1957r1958
12551255         w->command = data & ~FDC_MASK_TYPE_II;
12561256         w->command_type = TYPE_II;
12571257         w->status &= ~STA_2_LOST_DAT;
1258         wd17xx_clear_data_request();
1258         wd17xx_clear_data_request(machine);
12591259
12601260         wd17xx_timed_read_sector_request();
12611261
r1957r1958
12711271         w->command = data & ~FDC_MASK_TYPE_II;
12721272         w->command_type = TYPE_II;
12731273         w->status &= ~STA_2_LOST_DAT;
1274         wd17xx_clear_data_request();
1274         wd17xx_clear_data_request(machine);
12751275
12761276         wd17xx_timed_write_sector_request();
12771277
r1957r1958
12861286         w->command = data & ~FDC_MASK_TYPE_III;
12871287         w->command_type = TYPE_III;
12881288         w->status &= ~STA_2_LOST_DAT;
1289         wd17xx_clear_data_request();
1289         wd17xx_clear_data_request(machine);
12901290#if 1
12911291//         w->status = seek(w, w->track, w->head, w->sector);
12921292         if (w->status == 0)
1293            read_track(w);
1293            read_track(machine, w);
12941294#endif
12951295         return;
12961296      }
r1957r1958
13021302
13031303         w->command_type = TYPE_III;
13041304         w->status &= ~STA_2_LOST_DAT;
1305         wd17xx_clear_data_request();
1305         wd17xx_clear_data_request(machine);
13061306
13071307         if (!floppy_drive_get_flag_state(wd17xx_current_image(), FLOPPY_DRIVE_READY))
13081308            {
r1957r1958
13241324                    w->command = data & ~FDC_MASK_TYPE_III;
13251325                    w->data_offset = 0;
13261326                    w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD;
1327                    wd17xx_set_data_request();
1327                    wd17xx_set_data_request(machine);
13281328
13291329                    w->status |= STA_2_BUSY;
13301330                    w->busy_count = 0;
r1957r1958
13401340
13411341         w->command_type = TYPE_III;
13421342         w->status &= ~STA_2_LOST_DAT;
1343           wd17xx_clear_data_request();
1343           wd17xx_clear_data_request(machine);
13441344
13451345         if (!floppy_drive_get_flag_state(wd17xx_current_image(), FLOPPY_DRIVE_READY))
13461346            {
r1957r1958
13481348            }
13491349            else
13501350            {
1351                wd17xx_read_id(w);
1351                wd17xx_read_id(machine, w);
13521352            }
13531353         return;
13541354      }
r1957r1958
15401540   if (w->data_count > 0)
15411541   {
15421542      /* clear data request */
1543      wd17xx_clear_data_request();
1543      wd17xx_clear_data_request(machine);
15441544
15451545      /* put byte into buffer */
15461546      if (VERBOSE_DATA)
src/mess/machine/wd17xx.h
r1957r1958
5151
5252***************************************************************************/
5353
54void wd17xx_init(wd17xx_type_t type, void (*callback)(wd17xx_state_t, void *), void *param);
54void wd17xx_init(running_machine *machine, wd17xx_type_t type, void (*callback)(running_machine *, wd17xx_state_t, void *), void *param);
5555void wd17xx_reset(void);
5656
5757/* the following are not strictly part of the wd179x hardware/emulation
src/mess/machine/coupe.c
r1957r1958
136136
137137MACHINE_START( coupe )
138138{
139    wd17xx_init(WD_TYPE_177X,NULL, NULL);
139    wd17xx_init(machine, WD_TYPE_177X,NULL, NULL);
140140   add_reset_callback(machine, coupe_reset);
141141}
src/mess/machine/trs80.c
r1957r1958
281281    return INIT_PASS;
282282}
283283
284static void trs80_fdc_callback(wd17xx_state_t event, void *param);
284static void trs80_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param);
285285
286286MACHINE_RESET( trs80 )
287287{
r1957r1958
353353
354354MACHINE_START( trs80 )
355355{
356   wd17xx_init(WD_TYPE_179X,trs80_fdc_callback, NULL);
356   wd17xx_init(machine, WD_TYPE_179X,trs80_fdc_callback, NULL);
357357   add_exit_callback(machine, tape_put_close);
358358}
359359
r1957r1958
651651   }
652652}
653653
654void trs80_fdc_callback(wd17xx_state_t event, void *param)
654void trs80_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
655655{
656656   switch (event)
657657   {
r1957r1958
659659         irq_status &= ~IRQ_FDC;
660660         break;
661661      case WD17XX_IRQ_SET:
662         trs80_fdc_interrupt(Machine, 0);
662         trs80_fdc_interrupt(machine, 0);
663663         break;
664664      case WD17XX_DRQ_CLR:
665665      case WD17XX_DRQ_SET:
src/mess/machine/svi318.c
r1957r1958
326326
327327static SVI318_FDC_STRUCT svi318_fdc;
328328
329static void svi_fdc_callback(wd17xx_state_t state, void *param)
329static void svi_fdc_callback(running_machine *machine, wd17xx_state_t state, void *param)
330330{
331331   switch( state )
332332   {
r1957r1958
591591   }
592592
593593   /* floppy */
594   wd17xx_init(WD_TYPE_179X, svi_fdc_callback, NULL);
594   wd17xx_init(machine, WD_TYPE_179X, svi_fdc_callback, NULL);
595595
596596   /* serial */
597597   uart8250_init(0, svi318_uart8250_interface);
src/mess/machine/bbc.c
r1957r1958
16131613
16141614static int bbc_1770_IntEnabled;
16151615
1616static void bbc_wd177x_callback(wd17xx_state_t event, void *param)
1616static void bbc_wd177x_callback(running_machine *machine, wd17xx_state_t event, void *param)
16171617{
16181618   int state;
16191619   /* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together
r1957r1958
16791679      {
16801680         /* I'll pulse it because if I used hold-line I'm not sure
16811681         it would clear - to be checked */
1682         cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI,PULSE_LINE);
1682         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI,PULSE_LINE);
16831683      }
16841684   }
16851685
r1957r1958
21422142   //   break;
21432143   //case 4: case 5: case 6:
21442144      previous_wd177x_int_state=1;
2145       wd17xx_init(WD_TYPE_177X,bbc_wd177x_callback, NULL);
2145       wd17xx_init(machine, WD_TYPE_177X,bbc_wd177x_callback, NULL);
21462146   //   break;
21472147   //}
21482148}
r1957r1958
22012201   via_config(1, &bbcb_user_via);
22022202   via_set_clock(1,1000000);
22032203
2204   wd17xx_init(WD_TYPE_177X,bbc_wd177x_callback, NULL);
2204   wd17xx_init(machine, WD_TYPE_177X,bbc_wd177x_callback, NULL);
22052205}
22062206
22072207MACHINE_RESET( bbcbp )
r1957r1958
22382238   via_config(1, &bbcb_user_via);
22392239   via_set_clock(1,1000000);
22402240
2241   wd17xx_init(WD_TYPE_177X,bbc_wd177x_callback, NULL);
2241   wd17xx_init(machine, WD_TYPE_177X,bbc_wd177x_callback, NULL);
22422242}
22432243
22442244MACHINE_RESET( bbcm )
src/mess/drivers/spectrum.c
r1957r1958
14191419}
14201420#endif
14211421
1422static void betadisk_wd179x_callback(wd17xx_state_t state, void *param)
1422static void betadisk_wd179x_callback(running_machine *machine, wd17xx_state_t state, void *param)
14231423{
14241424   switch (state)
14251425   {
r1957r1958
14801480}
14811481#endif
14821482
1483static void    betadisk_init(void)
1483static void    betadisk_init(running_machine *machine)
14841484{
14851485   betadisk_active = 0;
14861486   betadisk_status = 0x03f;
1487   wd17xx_init(WD_TYPE_179X, betadisk_wd179x_callback, NULL);
1487   wd17xx_init(machine, WD_TYPE_179X, betadisk_wd179x_callback, NULL);
14881488}
14891489
14901490/****************************************************************************************************/
r1957r1958
17211721
17221722   scorpion_update_memory();
17231723
1724   betadisk_init();
1724   betadisk_init(machine);
17251725}
17261726
17271727/****************************************************************************************************/
r1957r1958
17571757   memory_set_bankptr(3, spectrum_ram + (2<<14));
17581758   memory_set_bankptr(7, spectrum_ram + (2<<14));
17591759
1760   betadisk_init();
1760   betadisk_init(machine);
17611761}
17621762
17631763/****************************************************************************************************/
src/mess/drivers/atarist.c
r1957r1958
125125   }
126126}
127127
128static void atarist_fdc_callback(wd17xx_state_t event, void *param)
128static void atarist_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
129129{
130130   switch (event)
131131   {
r1957r1958
15281528   atarist_state_save();
15291529
15301530   centronics_config(0, atarist_centronics_config);
1531   wd17xx_init(WD_TYPE_1772, atarist_fdc_callback, NULL);
1531   wd17xx_init(machine, WD_TYPE_1772, atarist_fdc_callback, NULL);
15321532   acia6850_config(0, &acia_ikbd_intf);
15331533   acia6850_config(1, &acia_midi_intf);
15341534   state->mfp = devtag_get_token(machine, MC68901, "mfp");
r1957r1958
16181618   atariste_state_save();
16191619
16201620   centronics_config(0, atarist_centronics_config);
1621   wd17xx_init(WD_TYPE_1772, atarist_fdc_callback, NULL);
1621   wd17xx_init(machine, WD_TYPE_1772, atarist_fdc_callback, NULL);
16221622   acia6850_config(0, &acia_ikbd_intf);
16231623   acia6850_config(1, &acia_midi_intf);
16241624   state->mfp = devtag_get_token(machine, MC68901, "mfp");
r1957r1958
17571757   state_save_register_global(ktxd);
17581758
17591759   centronics_config(0, atarist_centronics_config);
1760   wd17xx_init(WD_TYPE_1772, atarist_fdc_callback, NULL);
1760   wd17xx_init(machine, WD_TYPE_1772, atarist_fdc_callback, NULL);
17611761   acia6850_config(0, &stbook_acia_ikbd_intf);
17621762   acia6850_config(1, &acia_midi_intf);
17631763   state->mfp = devtag_get_token(machine, MC68901, "mfp");
src/mess/drivers/exidy.c
r1957r1958
258258   serial_timer = timer_alloc(exidy_serial_timer_callback, NULL);
259259   cassette_timer = timer_alloc(exidy_cassette_timer_callback, NULL);
260260
261   wd17xx_init(WD_TYPE_179X, NULL, NULL);
261   wd17xx_init(machine, WD_TYPE_179X, NULL, NULL);
262262}
263263
264264static MACHINE_RESET( exidy )
src/mess/drivers/enterp.c
r1957r1958
174174};
175175
176176
177static void enterp_wd177x_callback(wd17xx_state_t event, void *param);
177static void enterp_wd177x_callback(running_machine *machine, wd17xx_state_t event, void *param);
178178
179179static void enterprise_reset(running_machine *machine)
180180{
r1957r1958
236236
237237static MACHINE_START(enterprise)
238238{
239   wd17xx_init(WD_TYPE_177X, enterp_wd177x_callback, NULL);
239   wd17xx_init(machine, WD_TYPE_177X, enterp_wd177x_callback, NULL);
240240   add_reset_callback(machine, enterprise_reset);
241241}
242242
r1957r1958
318318
319319static char EXDOS_CARD_R = 0;
320320
321static void enterp_wd177x_callback(wd17xx_state_t State, void *param)
321static void enterp_wd177x_callback(running_machine *machine, wd17xx_state_t State, void *param)
322322{
323323   if (State==WD17XX_IRQ_CLR)
324324   {
src/mess/drivers/apf.c
r1957r1958
333333{
334334   pia_config(1,&apf_imagination_pia_interface);
335335   apf_common_init();
336   wd17xx_init(WD_TYPE_179X, NULL, NULL);
336   wd17xx_init(machine, WD_TYPE_179X, NULL, NULL);
337337}
338338
339339static MACHINE_START( apf_m1000 )
src/mess/drivers/einstein.c
r1957r1958
14221422static MACHINE_START( einstein )
14231423{
14241424   TMS9928A_configure(&tms9928a_interface);
1425   wd17xx_init(WD_TYPE_177X, NULL, NULL);
1425   wd17xx_init(machine, WD_TYPE_177X, NULL, NULL);
14261426}
14271427
14281428static MACHINE_RESET( einstein )
src/mess/drivers/a310.c
r1957r1958
178178   a310_memc_reset();
179179}
180180
181static void a310_wd177x_callback(wd17xx_state_t event, void *param)
181static void a310_wd177x_callback(running_machine *machine, wd17xx_state_t event, void *param)
182182{
183183   switch (event)
184184   {
r1957r1958
204204static MACHINE_START( a310 )
205205{
206206   a310_pagesize = 0;
207   wd17xx_init(WD_TYPE_1772, a310_wd177x_callback, NULL);
207   wd17xx_init(machine, WD_TYPE_1772, a310_wd177x_callback, NULL);
208208
209209   vbl_timer = timer_alloc(a310_vblank, NULL);
210210   timer_adjust_oneshot(vbl_timer, attotime_never, 0);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team