Previous 15994 Revisions Next

r3776 Monday 8th December, 2008 at 09:54:11 UTC by Miodrag Milanović
Enabled rest of files.
[src/mess]mess.mak messdriv.c
[src/mess/audio]mea8000.c
[src/mess/devices]thomflop.c thomflop.h
[src/mess/drivers]thomson.c ti990_10.c tm990189.c
[src/mess/formats]thom_dsk.c
[src/mess/includes]thomson.h
[src/mess/machine]994x_ser.c 99_hsgpl.c at29040.c at29040.h geneve.c mc6854.c mc6854.h thomson.c ti99_4x.c tms9901.c tms9901.h tms9902.c tms9902.h
[src/mess/video]911_vdt.c 911_vdt.h thomson.c

src/mess/audio/mea8000.c
r3775r3776
566566      {
567567         /* got pitch byte before first frame */
568568         mea8000.pitch = 2 * data;
569         LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), mea8000.pitch ));
569         LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), mea8000.pitch ));
570570         mea8000.state = MEA8000_WAIT_FIRST;
571571         mea8000.bufpos = 0;
572572      }
573573      else if (mea8000.bufpos == 4)
574574      {
575575         /* overflow */
576         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
576         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
577577      }
578578      else
579579      {
580580         /* enqueue frame byte */
581         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
581         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
582582               data, mea8000.bufpos ));
583583         mea8000.buf[mea8000.bufpos] = data;
584584         mea8000.bufpos++;
r3775r3776
612612         mea8000_stop_frame();
613613
614614      LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n",
615            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data,
615            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data,
616616            stop, mea8000.cont, mea8000.roe ));
617617
618618      mea8000_update_req(space->machine);
r3775r3776
663663   mea8000.timer = timer_alloc(machine,  mea8000_timer_expire , NULL);
664664
665665   state_save_register_item(machine, "mea8000", NULL, 0, mea8000.state );
666   state_save_register_item_array( "mea8000", NULL, 0, mea8000.buf );
666   state_save_register_item_array(machine, "mea8000", NULL, 0, mea8000.buf );
667667   state_save_register_item(machine, "mea8000", NULL, 0, mea8000.bufpos );
668668   state_save_register_item(machine, "mea8000", NULL, 0, mea8000.cont );
669669   state_save_register_item(machine, "mea8000", NULL, 0, mea8000.roe );
src/mess/video/911_vdt.c
r3775r3776
237237/*
238238   Initialize one 911 vdt controller/terminal
239239*/
240void vdt911_init_term(int unit, const vdt911_init_params_t *params)
240void vdt911_init_term(running_machine *machine,int unit, const vdt911_init_params_t *params)
241241{
242242   vdt[unit].screen_size = params->screen_size;
243243   vdt[unit].model = params->model;
src/mess/video/911_vdt.h
r3775r3776
4343PALETTE_INIT( vdt911 );
4444
4545void vdt911_init(running_machine *machine);
46void vdt911_init_term(int unit, const vdt911_init_params_t *params);
46void vdt911_init_term(running_machine *machine,int unit, const vdt911_init_params_t *params);
4747
4848void vdt911_reset(void);
4949
src/mess/video/thomson.c
r3775r3776
201201
202202
203203/* lightpen callback function to call from timer */
204static void (*thom_lightpen_cb) ( int );
204static void (*thom_lightpen_cb) ( running_machine *machine, int );
205205
206206
207207
208void thom_set_lightpen_callback ( int nb, void (*cb) ( int step ) )
208void thom_set_lightpen_callback ( running_machine *machine, int nb, void (*cb) ( running_machine *machine, int step ) )
209209{
210210   LOG (( "%f thom_set_lightpen_callback called\n", attotime_to_double(timer_get_time(machine)) ));
211211   thom_lightpen_nb = nb;
r3775r3776
217217   int step = param;
218218
219219   if ( thom_lightpen_cb )
220      thom_lightpen_cb( step );
220      thom_lightpen_cb( machine, step );
221221
222222   if ( step < thom_lightpen_nb )
223223      timer_adjust_oneshot(thom_lightpen_timer, ATTOTIME_IN_USEC( 64 ), step + 1);
r3775r3776
911911   rectangle lrect = { 0, xbleft - 1, 0, 0 };
912912   rectangle rrect = { xbright, xright - 1, 0, 0 };
913913
914   LOG (( "%f thom: video update called\n", attotime_to_double(timer_get_time(machine)) ));
914   //LOG (( "%f thom: video update called\n", attotime_to_double(timer_get_time(machine)) ));
915915
916916   /* upper border */
917917   for ( y = 0; y < THOM_BORDER_HEIGHT - thom_bheight; y++ )
r3775r3776
10091009
10101010static emu_timer *thom_init_timer;
10111011
1012static void (*thom_init_cb) ( int );
1012static void (*thom_init_cb) ( running_machine *machine, int );
10131013
10141014
10151015
1016void thom_set_init_callback ( void (*cb) ( int init ) )
1016void thom_set_init_callback ( void (*cb) ( running_machine *machine, int init ) )
10171017{
10181018   thom_init_cb = cb;
10191019}
r3775r3776
10261026   LOG (( "%f thom_set_init: %i, at line %i col %i\n", attotime_to_double(timer_get_time(machine)), init, thom_video_elapsed() / 64, thom_video_elapsed() % 64 ));
10271027
10281028   if ( thom_init_cb )
1029      thom_init_cb( init );
1029      thom_init_cb( machine, init );
10301030   if ( ! init )
10311031      timer_adjust_oneshot(thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init);
10321032}
src/mess/includes/thomson.h
r3775r3776
7272extern MACHINE_START ( to770 );
7373extern MACHINE_RESET ( to770 );
7474
75
7675/***************************** MO5 ******************************/
7776
7877/* gate-array */
r3775r3776
254253                         int xdec2 );
255254
256255/* specify a lightpencall-back function, called nb times per frame */
257extern void thom_set_lightpen_callback ( int nb, void (*cb) ( int step ) );
256extern void thom_set_lightpen_callback ( running_machine *machine, int nb, void (*cb) ( running_machine *machine, int step ) );
258257
259258
260259/***************************** commons *****************************/
r3775r3776
265264extern VIDEO_EOF    ( thom );
266265
267266/* pass video init signal */
268extern void thom_set_init_callback ( void (*cb) ( int init ) );
267extern void thom_set_init_callback ( void (*cb) ( running_machine *machine, int init ) );
269268
270269/* TO7 TO7/70 MO5 video bank switch */
271270extern void thom_set_mode_point ( running_machine *machine, int point );
src/mess/messdriv.c
r3775r3776
517517   DRIVER( ip244415 )
518518
519519   /* TEXAS INSTRUMENTS */
520//0128u5   DRIVER( ti990_10 )   /* 1975 TI 990/10                           */
521//0128u5   DRIVER( ti990_4 )   /* 1976 TI 990/4                           */
522//0128u5   DRIVER( 990189 )   /* 1978 TM 990/189                           */
523//0128u5   DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board         */
520   DRIVER( ti990_10 )   /* 1975 TI 990/10                           */
521   DRIVER( ti990_4 )   /* 1976 TI 990/4                           */
522   DRIVER( 990189 )   /* 1978 TM 990/189                           */
523   DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board         */
524524
525//0128u5   DRIVER( ti99_224 )   /* 1983 TI 99/2 (24kb ROMs)                     */
526//0128u5   DRIVER( ti99_232 )   /* 1983 TI 99/2 (32kb ROMs)                     */
527//0128u5   DRIVER( ti99_4 )   /* 1979 TI-99/4                              */
528//0128u5   DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                  */
529//0128u5   DRIVER( ti99_4a )   /* 1981 TI-99/4A                           */
530//0128u5   DRIVER( ti99_4ae )   /* 1981 TI-99/4A with 50Hz video               */
531//0128u5   DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card            */
532//0128u5   DRIVER( ti99_8 )   /* 1983 TI-99/8                              */
533//0128u5   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
525   DRIVER( ti99_224 )   /* 1983 TI 99/2 (24kb ROMs)                     */
526   DRIVER( ti99_232 )   /* 1983 TI 99/2 (32kb ROMs)                     */
527   DRIVER( ti99_4 )   /* 1979 TI-99/4                              */
528   DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                  */
529   DRIVER( ti99_4a )   /* 1981 TI-99/4A                           */
530   DRIVER( ti99_4ae )   /* 1981 TI-99/4A with 50Hz video               */
531   DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card            */
532   DRIVER( ti99_8 )   /* 1983 TI-99/8                              */
533   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
534534
535535   /* TI 99 clones */
536//0128u5   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
537//0128u5   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
538//0128u5   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
539//0128u5   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
536   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
537   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
538   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
539   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
540540
541//0128u5   DRIVER( avigo )      /*                                       */
541   DRIVER( avigo )      /*                                       */
542542
543543   /* TEXAS INSTRUMENTS CALCULATORS */
544//0128u5   DRIVER( ti81 )      /* 1990 TI-81 (Z80 2 MHz)                     */
545//0128u5   DRIVER( ti85 )      /* 1992 TI-85 (Z80 6 MHz)                     */
546//0128u5   DRIVER( ti82 )      /* 1993 TI-82 (Z80 6 MHz)                     */
547//0128u5   DRIVER( ti83 )      /* 1996 TI-83 (Z80 6 MHz)                     */
548//0128u5   DRIVER( ti86 )      /* 1997 TI-86 (Z80 6 MHz)                     */
549//0128u5   DRIVER( ti83p )      /* 1999 TI-83 Plus (Z80 6 MHz)                  */
544   DRIVER( ti81 )      /* 1990 TI-81 (Z80 2 MHz)                     */
545   DRIVER( ti85 )      /* 1992 TI-85 (Z80 6 MHz)                     */
546   DRIVER( ti82 )      /* 1993 TI-82 (Z80 6 MHz)                     */
547   DRIVER( ti83 )      /* 1996 TI-83 (Z80 6 MHz)                     */
548   DRIVER( ti86 )      /* 1997 TI-86 (Z80 6 MHz)                     */
549   DRIVER( ti83p )      /* 1999 TI-83 Plus (Z80 6 MHz)                  */
550550//   DRIVER( ti83pse )   /* 2001 TI-83 Plus Silver Edition               */
551551//   DRIVER( ti84p )      /* 2004 TI-84 Plus                           */
552552//   DRIVER( ti84pse )   /* 2004 TI-84 Plus Silver Edition               */
r3775r3776
915915   DRIVER( gamecom )   /* Tiger Game.com                           */
916916
917917   /* Thomson */
918//0128u5   DRIVER( t9000 )      /* 1980 Thomson T9000 (TO7 prototype)            */
919//0128u5   DRIVER( to7 )      /* 1982 Thomson TO7                           */
920//0128u5   DRIVER( to770 )      /* 1984 Thomson TO7/70                        */
921//0128u5   DRIVER( to770a )   /* 198? Thomson TO7/70 arabic version            */
922//0128u5   DRIVER( mo5 )      /* 1984 Thomson MO5                           */
923//0128u5   DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)            */
924//0128u5   DRIVER( to9 )      /* 1985 Thomson T09                           */
925//0128u5   DRIVER( to8 )      /* 1986 Thomson T08                           */
926//0128u5   DRIVER( to8d )      /* 1987 Thomson T08D                        */
927//0128u5   DRIVER( to9p )      /* 1986 Thomson T09+                        */
928//0128u5   DRIVER( mo6 )      /* 1986 Thomson MO6                           */
929//0128u5   DRIVER( mo5nr )      /* 1986 Thomson MO5 NR                        */
930//0128u5   DRIVER( pro128 )   /* 1986 Olivetti Prodest PC 128                  */
918   DRIVER( t9000 )      /* 1980 Thomson T9000 (TO7 prototype)            */
919   DRIVER( to7 )      /* 1982 Thomson TO7                           */
920   DRIVER( to770 )      /* 1984 Thomson TO7/70                        */
921   DRIVER( to770a )   /* 198? Thomson TO7/70 arabic version            */
922   DRIVER( mo5 )      /* 1984 Thomson MO5                           */
923   DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)            */
924   DRIVER( to9 )      /* 1985 Thomson T09                           */
925   DRIVER( to8 )      /* 1986 Thomson T08                           */
926   DRIVER( to8d )      /* 1987 Thomson T08D                        */
927   DRIVER( to9p )      /* 1986 Thomson T09+                        */
928   DRIVER( mo6 )      /* 1986 Thomson MO6                           */
929   DRIVER( mo5nr )      /* 1986 Thomson MO5 NR                        */
930   DRIVER( pro128 )   /* 1986 Olivetti Prodest PC 128                  */
931931
932932   /* Cybiko, Inc. */
933933   DRIVER( cybikov1 )   /* Cybiko Wireless Intertainment System - Classic V1 */
src/mess/machine/mc6854.c
r3775r3776
538538
539539
540540/* CPU pops the FIFO */
541static UINT8 mc6854_rfifo_pop( void )
541static UINT8 mc6854_rfifo_pop( running_machine *machine )
542542{
543543   int i, data = mc6854->rfifo[ FIFO_SIZE - 1 ];
544544
r3775r3776
556556   /* auto-refill in frame mode */
557557   if ( mc6854->flen > 0 )
558558   {
559      mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
559      mc6854_rfifo_push( machine, mc6854->frame[ mc6854->fpos++ ] );
560560      if ( mc6854->fpos == mc6854->flen )
561561         mc6854_rfifo_terminate();
562562   }
r3775r3776
566566
567567
568568/* MC6854 makes fields from bits */
569void mc6854_set_rx( int bit )
569void mc6854_set_rx( running_machine *machine, int bit )
570570{
571571   int fieldlen = ( mc6854->rstate < 6 ) ? 8 : RWL;
572572
r3775r3776
593593      {
594594         mc6854->rsize++;
595595         if ( mc6854->rstate && mc6854->rsize >= fieldlen + 24 )
596            mc6854_rfifo_push( mc6854->rreg );
596            mc6854_rfifo_push( machine, mc6854->rreg );
597597      }
598598   }
599599   else if ( mc6854->rones == 5 )
r3775r3776
614614         mc6854->rreg >>= 1;
615615         mc6854->rsize++;
616616         if ( mc6854->rsize >= fieldlen + 24 ) /* last field */
617            mc6854_rfifo_push( mc6854->rreg );
617            mc6854_rfifo_push( machine, mc6854->rreg );
618618         mc6854_rfifo_terminate();
619619         LOG(( "%f mc6854_receive_bit: end of frame\n", attotime_to_double(timer_get_time(machine)) ));
620620      }
r3775r3776
627627      mc6854->rreg >>= 1;
628628      mc6854->rsize++;
629629      if ( mc6854->rstate && mc6854->rsize >= fieldlen + 24 )
630         mc6854_rfifo_push( mc6854->rreg );
630         mc6854_rfifo_push( machine, mc6854->rreg );
631631   }
632632}
633633
r3775r3776
645645
646646
647647
648int mc6854_send_frame( UINT8* data, int len )
648int mc6854_send_frame( running_machine *machine, UINT8* data, int len )
649649{
650650   if ( mc6854->rstate > 1 || mc6854->tstate > 1 || RTS )
651651      return -1; /* busy */
r3775r3776
665665      mc6854->sr1 |= FD;
666666   mc6854->flen = len;
667667   mc6854->fpos = 0;
668   mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
669   mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
668   mc6854_rfifo_push( machine, mc6854->frame[ mc6854->fpos++ ] );
669   mc6854_rfifo_push( machine, mc6854->frame[ mc6854->fpos++ ] );
670670   if ( mc6854->fpos == mc6854->flen )
671671      mc6854_rfifo_terminate();
672672   return 0;
r3775r3776
777777   case 0: /* status register 1 */
778778      mc6854_update_sr1();
779779      LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n",
780            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->sr1,
780            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->sr1,
781781            ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0,
782782            ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0,
783783            ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0,
r3775r3776
787787   case 1: /* status register 2 */
788788      mc6854_update_sr2();
789789      LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n",
790            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->sr2,
790            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->sr2,
791791            ( mc6854->sr2 & AP   ) ? 1 : 0, ( mc6854->sr2 & FV  ) ? 1 : 0,
792792            ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0,
793793            ( mc6854->sr2 & ERR  ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0,
r3775r3776
797797   case 2: /* receiver data register */
798798   case 3:
799799   {
800      UINT8 data = mc6854_rfifo_pop();
800      UINT8 data = mc6854_rfifo_pop(space->machine);
801801      LOG(( "%f $%04x mc6854_r: get data $%02X\n",
802            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
802            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
803803      return data;
804804   }
805805
r3775r3776
819819   case 0: /* control register 1 */
820820      mc6854->cr1 = data;
821821      LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n",
822            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->cr1,
822            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->cr1,
823823            AC ? 1 : 0,
824824            RIE ? 'r' : '-', TIE ? 't' : '-',
825825            DISCONTINUE ? "discontinue," : "",
r3775r3776
856856         /* control register 3 */
857857         mc6854->cr3 = data;
858858         LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n",
859               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->cr3,
859               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->cr3,
860860               LCF ? (CEX ? 16 : 8) : 0,  AEX ? 1 : 0,
861861               IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0,
862862               TST ? 1 : 0, DTR ? 1 : 0
r3775r3776
875875         /* control register 2 */
876876         mc6854->cr2 = data;
877877         LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n",
878               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->cr2,
878               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->cr2,
879879               PSE ? 1 : 0,  TWOBYTES ? 2 : 1,  FMIDLE ? 1 : 0,
880880               FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0,
881881               data & 0x20 ? 'r' : '-',  data & 0x40 ? 't' : '-',
r3775r3776
906906      break;
907907
908908   case 2: /* transmitter data: continue data */
909      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
910      mc6854_tfifo_push( data );
909      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
910      mc6854_tfifo_push( space->machine, data );
911911      break;
912912
913913   case 3:
r3775r3776
915915      {
916916         /* control register 4 */
917917         mc6854->cr4 = data;
918         LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), mc6854->cr4,
918         LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), mc6854->cr4,
919919               TWOINTER ? 2 : 1,
920920               TWL, RWL,
921921               ABT ? ( ABTEX ? "abort-ext," : "abort,") : "",
r3775r3776
930930      else
931931      {
932932         /* transmitter data: last data */
933         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
934         mc6854_tfifo_push( data );
933         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
934         mc6854_tfifo_push( space->machine, data );
935935         mc6854_tfifo_terminate();
936936      }
937937      break;
r3775r3776
968968
969969
970970
971void mc6854_config ( const mc6854_interface* iface )
971void mc6854_config ( running_machine *machine, const mc6854_interface* iface )
972972{
973973   assert( iface );
974974   mc6854 = auto_malloc( sizeof( * mc6854 ) );
r3775r3776
984984   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->cts );
985985   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->dcd );
986986   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->tstate );
987   state_save_register_item_array( "mc6854", NULL, 0, mc6854->tfifo );
987   state_save_register_item_array( machine, "mc6854", NULL, 0, mc6854->tfifo );
988988   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->tones );
989989   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->rstate );
990990   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->rreg );
991991   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->rones );
992992   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->rsize );
993   state_save_register_item_array( "mc6854", NULL, 0, mc6854->rfifo );
994   state_save_register_item_array( "mc6854", NULL, 0, mc6854->frame );
993   state_save_register_item_array( machine, "mc6854", NULL, 0, mc6854->rfifo );
994   state_save_register_item_array( machine, "mc6854", NULL, 0, mc6854->frame );
995995   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->flen );
996996   state_save_register_item(machine, "mc6854", NULL, 0, mc6854->fpos );
997997   mc6854_reset();
src/mess/machine/mc6854.h
r3775r3776
3939  void ( * out_tx  ) ( int state ); /* transmit bit */
4040
4141  /* high-level, frame-based interface */
42  void ( * out_frame ) ( UINT8* data, int length );
42  void ( * out_frame ) ( running_machine *machine, UINT8* data, int length );
4343
4444  /* control lines */
4545  void ( * out_rts ) ( int state ); /* 1 = transmitting, 0 = idle */
r3775r3776
4949
5050/* ---------- functions ------------ */
5151
52extern void mc6854_config ( const mc6854_interface* func );
52extern void mc6854_config ( running_machine *machine, const mc6854_interface* func );
5353
5454/* reset by external signal */
5555extern void mc6854_reset ( void );
r3775r3776
5959extern WRITE8_HANDLER ( mc6854_w );
6060
6161/* low-level, bit-based interface */
62extern void mc6854_set_rx ( int state );
62extern void mc6854_set_rx ( running_machine *machine, int state );
6363
6464/* high-level, frame-based interface */
65extern int mc6854_send_frame( UINT8* data, int length ); /* ret -1 if busy */
65extern int mc6854_send_frame( running_machine *machine, UINT8* data, int length ); /* ret -1 if busy */
6666
6767/* control lines */
6868extern void mc6854_set_cts ( int state ); /* 1 = clear-to-send, 0 = busy */
src/mess/machine/thomson.c
r3775r3776
106106         if ( bitpos >= to7_k7_bitsize )
107107            bitpos = to7_k7_bitsize -1;
108108//         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
109//            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
109//            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), state, pos, bitpos,
110110//            to7_k7_bits[ bitpos ] ));
111111         return to7_k7_bits[ bitpos ];
112112      }
r3775r3776
127127         }
128128         k = ( chg >= 13 ) ? 1 : 0;
129129//         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
130//            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
130//            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), state, pos, bitpos,
131131//            k, chg ));
132132         return k;
133133      }
r3775r3776
155155   double pos = cassette_get_position(img);
156156
157157   LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n",
158          cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ? "off" : "on",
158          cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ? "off" : "on",
159159          (int) (pos / TO7_BIT_LENGTH) ));
160160
161161   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
r3775r3776
205205      hbit = hbit >= 0;
206206
207207//      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
208//         cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), state, pos,
208//         cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), state, pos,
209209//         (int) (pos / MO5_HBIT_LENGTH), hbit ));
210210      return hbit;
211211   }
r3775r3776
230230   double pos = cassette_get_position(img);
231231
232232   LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n",
233          cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ? "off" : "on",
233          cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ? "off" : "on",
234234          (int) (pos / MO5_HBIT_LENGTH) ));
235235
236236   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
r3775r3776
308308
309309
310310
311static void thom_irq_init ( void )
311static void thom_irq_init ( running_machine *machine )
312312{
313313   state_save_register_global(machine,  thom_irq );
314314   state_save_register_global(machine,  thom_firq );
r3775r3776
618618
619619
620620
621static void to7_lightpen_cb ( int step )
621static void to7_lightpen_cb ( running_machine *machine, int step )
622622{
623623   if ( ! to7_lightpen )
624624      return;
r3775r3776
635635
636636
637637
638static void to7_set_init ( int init )
638static void to7_set_init ( running_machine *machine, int init )
639639{
640640   /* INIT signal wired to system PIA 6821 */
641641
r3775r3776
756756{
757757   /* acknowledge from centronics printer to PIA */
758758   int ack = (data & CENTRONICS_ACKNOWLEDGE) ? 1 : 0;
759   LOG (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", attotime_to_double(timer_get_time(machine)), data, ack ));
759   //LOG (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", attotime_to_double(timer_get_time(machine)), data, ack ));
760760   pia_set_input_cb1( THOM_PIA_IO, ack );
761761}
762762
r3775r3776
767767   int tx  = data & 1;
768768   int dtr = ( data & 2 ) ? 1 : 0;
769769
770   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), tx, dtr ));
770   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), tx, dtr ));
771771   if ( dtr )
772772      to7_io_line.State |=  SERIAL_STATE_DTR;
773773   else
r3775r3776
790790   else
791791      cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0;
792792
793   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), to7_io_mode(space->machine), cts, dsr, rd ));
793   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), to7_io_mode(space->machine), cts, dsr, rd ));
794794
795795   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
796796}
r3775r3776
801801{
802802   /* set 8-bit data */
803803
804   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
804   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
805805
806806   centronics_write_data( 0, data );
807807}
r3775r3776
812812{
813813   /* send STROBE to printer */
814814
815   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
815   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
816816
817817   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
818818}
r3775r3776
824824   /* our peer's state has changed */
825825   to7_io_line.input_state = state;
826826
827   LOG_IO(( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", attotime_to_double(timer_get_time(machine)), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) ));
827   //LOG_IO(( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", attotime_to_double(timer_get_time(machine)), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) ));
828828}
829829
830830
r3775r3776
916916
917917
918918
919static void to7_modem_cb( int state )
919static void to7_modem_cb(const device_config *device, int state )
920920{
921921   LOG(( "to7_modem_cb: called %i\n", state ));
922922}
r3775r3776
932932
933933
934934
935static const acia6850_interface to7_acia_modem =
935const acia6850_interface to7_acia_modem =
936936{
937937   1200, 1200, /* 1200 bauds, might be divided by 16 */
938938   &to7_modem_rx, &to7_modem_tx,
r3775r3776
953953
954954
955955
956static void to7_modem_init( void )
956static void to7_modem_init( running_machine *machine )
957957{
958958   LOG (( "to7_modem_init: MODEM not implemented!\n" ));
959959   pia_config( THOM_PIA_MODEM, &to7_pia_modem );
960   acia6850_config( 0, &to7_acia_modem );
961960   state_save_register_global(machine,  to7_modem_rx );
962961   state_save_register_global(machine,  to7_modem_tx );
963962}
r3775r3776
975974   else
976975   {
977976      switch ( offset ) {
978      case 0: return acia6850_0_stat_r( space, 0 );
979      case 1: return acia6850_0_data_r( space, 0 );
977      case 0: return acia6850_stat_r( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, ACIA6850, "acia_1"), 0 );
978      case 1: return acia6850_data_r( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, ACIA6850, "acia_1"), 0 );
980979      default: return 0;
981980      }
982981   }
r3775r3776
991990   else
992991   {
993992      switch ( offset ) {
994      case 0: acia6850_0_ctrl_w( space, 0, data ); break;
995      case 1: acia6850_0_data_w( space, 0, data ); break;
993      case 0: acia6850_ctrl_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, ACIA6850, "acia_1"), 0, data ); break;
994      case 1: acia6850_data_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, ACIA6850, "acia_1"), 0, data ); break;
996995      }
997996   }
998997}
r3775r3776
11791178
11801179
11811180
1182static void to7_game_init ( void )
1181static void to7_game_init ( running_machine *machine )
11831182{
11841183   LOG (( "to7_game_init called\n" ));
11851184   pia_config( THOM_PIA_GAME, &to7_game );
r3775r3776
12901289      /* bit 6:     parity error (ignored) */
12911290      /* bit 7:     interrupt */
12921291      LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1293           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), to7_midi_status,
1292           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), to7_midi_status,
12941293           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
12951294           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
12961295           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
r3775r3776
13081307         to7_midi_status &= ~ACIA_6850_OVRN;
13091308      to7_midi_overrun = 0;
13101309      LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n",
1311           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
1310           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
13121311      to7_midi_update_irq();
13131312      return data;
13141313   }
r3775r3776
13351334      if ( (data & 3) == 3 )
13361335      {
13371336         /* reset */
1338         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
1337         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
13391338         to7_midi_overrun = 0;
13401339         to7_midi_status = 2;
13411340         to7_midi_intr = 0;
r3775r3776
13521351            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
13531352            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
13541353            LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1355                 cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
1354                 cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
13561355                 data,
13571356                 bits[ (data >> 2) & 7 ],
13581357                 stop[ (data >> 2) & 7 ],
r3775r3776
13661365
13671366
13681367   case 1: /* output data */
1369      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
1368      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
13701369      if ( data == 0x55 )
13711370         /* cable-detect: shortcut */
13721371         chardev_fake_in( to7_midi_chardev, 0x55 );
r3775r3776
14981497   LOG (( "to7: machine start called\n" ));
14991498
15001499   /* subsystems */
1501   thom_irq_init();
1500   thom_irq_init(machine);
15021501   pia_config( THOM_PIA_SYS, &to7_sys );
15031502   mc6846_config( machine, &to7_timer );
1504   to7_game_init();
1503   to7_game_init(machine);
15051504   to7_floppy_init( machine, mem + 0x20000 );
15061505   to7_io_init();
1507   to7_modem_init();
1506   to7_modem_init(machine);
15081507   to7_midi_init();
15091508   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
15101509
r3775r3776
17481747   LOG (( "to770: machine start called\n" ));
17491748
17501749   /* subsystems */
1751   thom_irq_init();
1750   thom_irq_init(machine);
17521751   pia_config( THOM_PIA_SYS, &to770_sys );
17531752   mc6846_config( machine, &to770_timer );
1754   to7_game_init();
1753   to7_game_init(machine);
17551754   to7_floppy_init( machine, mem + 0x20000 );
17561755   to7_io_init();
1757   to7_modem_init();
1756   to7_modem_init(machine);
17581757   to7_midi_init();
17591758   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
17601759
r3775r3776
17901789
17911790
17921791
1793static void mo5_lightpen_cb ( int step )
1792static void mo5_lightpen_cb ( running_machine *machine, int step )
17941793{
17951794   /* MO5 signals ca1 (TO7 signals cb1) */
17961795   if ( ! to7_lightpen )
r3775r3776
21082107   LOG (( "mo5: machine start called\n" ));
21092108
21102109   /* subsystems */
2111   thom_irq_init();
2110   thom_irq_init(machine);
21122111   pia_config( THOM_PIA_SYS, &mo5_sys );
2113   to7_game_init();
2112   to7_game_init(machine);
21142113   to7_floppy_init( machine, mem + 0x20000 );
21152114   to7_io_init();
2116   to7_modem_init();
2115   to7_modem_init(machine);
21172116   to7_midi_init();
21182117   mo5_periodic_timer = timer_alloc(machine,  mo5_periodic_cb , NULL);
21192118   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
r3775r3776
21562155
21572156WRITE8_HANDLER ( to9_ieee_w )
21582157{
2159   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data, offset );
2158   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data, offset );
21602159}
21612160
21622161
21632162
21642163READ8_HANDLER  ( to9_ieee_r )
21652164{
2166   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), offset );
2165   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset );
21672166   return 0;
21682167}
21692168
r3775r3776
22892288
22902289WRITE8_HANDLER ( to9_vreg_w )
22912290{
2292   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), offset, 0xe7da + offset, data ));
2291   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, 0xe7da + offset, data ));
22932292
22942293   switch ( offset )
22952294   {
r3775r3776
23262325
23272326
23282327
2329static void to9_palette_init ( void )
2328static void to9_palette_init ( running_machine *machine )
23302329{
23312330   to9_palette_idx = 0;
23322331   memset( to9_palette_data, 0, sizeof( to9_palette_data ) );
r3775r3776
25842583      /* bit 7:     interrupt */
25852584
25862585      LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2587           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), to9_kbd_status,
2586           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), to9_kbd_status,
25882587           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
25892588           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
25902589           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
r3775r3776
25992598      else
26002599         to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
26012600      to9_kbd_overrun = 0;
2602      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), to9_kbd_in ));
2601      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), to9_kbd_in ));
26032602      to9_kbd_update_irq(space->machine);
26042603      return to9_kbd_in;
26052604
r3775r3776
26262625         to9_kbd_overrun = 0;
26272626         to9_kbd_status = ACIA_6850_TDRE;
26282627         to9_kbd_intr = 0;
2629         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
2628         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
26302629      }
26312630      else
26322631      {
r3775r3776
26402639         to9_kbd_intr = data >> 5;
26412640
26422641         LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2643              cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
2642              cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
26442643              data, to9_kbd_parity, to9_kbd_intr >> 2,
26452644              (to9_kbd_intr & 3) ? 1 : 0 ));
26462645      }
r3775r3776
26712670      case 0xFE: to9_kbd_periph = 0; break;
26722671
26732672      default:
2674         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data );
2673         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data );
26752674      }
26762675
26772676      thom_set_caps_led( ! to9_kbd_caps );
26782677
26792678      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
2680            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data,
2679            cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data,
26812680            to9_kbd_caps, to9_kbd_pad, to9_kbd_periph ));
26822681
26832682      break;
r3775r3776
29212920
29222921
29232922
2924static void to9_kbd_init ( void )
2923static void to9_kbd_init ( running_machine *machine )
29252924{
29262925   LOG(( "to9_kbd_init called\n" ));
29272926   to9_kbd_timer = timer_alloc(machine,  to9_kbd_timer_cb , NULL);
r3775r3776
29562955   centronics_write_handshake( 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
29572956
29582957//   LOG_IO(( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
2959//        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data,
2958//        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data,
29602959//        (b & 2) ? 1 : 0 ));
29612960}
29622961
r3775r3776
30743073   LOG (( "to9: machine start called\n" ));
30753074
30763075   /* subsystems */
3077   thom_irq_init();
3076   thom_irq_init(machine);
30783077   pia_config( THOM_PIA_SYS, &to9_sys );
30793078   centronics_config( 0, &to9_centronics );
30803079   mc6846_config( machine, &to9_timer );
3081   to7_game_init();
3080   to7_game_init(machine);
30823081   to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 );
3083   to9_kbd_init();
3084   to9_palette_init();
3085   to7_modem_init();
3082   to9_kbd_init(machine);
3083   to9_palette_init(machine);
3084   to7_modem_init(machine);
30863085   to7_midi_init();
30873086   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
30883087
r3775r3776
33503349
33513350
33523351/* cpu <-> keyboard hand-check */
3353static void to8_kbd_set_ack ( int data )
3352static void to8_kbd_set_ack ( running_machine *machine, int data )
33543353{
33553354   if ( data == to8_kbd_ack )
33563355      return;
r3775r3776
34353434
34363435
34373436
3438static void to8_kbd_init ( void )
3437static void to8_kbd_init ( running_machine *machine )
34393438{
34403439   to8_kbd_timer = timer_alloc(machine,  to8_kbd_timer_cb , NULL);
34413440   to8_kbd_signal = timer_alloc(machine,  NULL , NULL);
r3775r3776
37453744   }
37463745
37473746   LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
3748        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
3747        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
37493748        offset, 0xe7e4 + offset, res, to7_lightpen ));
37503749
37513750   return res;
r3775r3776
37563755WRITE8_HANDLER ( to8_gatearray_w )
37573756{
37583757   LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
3759        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
3758        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
37603759        offset, 0xe7e4 + offset, data ));
37613760
37623761   switch ( offset )
r3775r3776
38373836WRITE8_HANDLER ( to8_vreg_w )
38383837{
38393838   LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
3840        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
3839        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
38413840        offset, 0xe7da + offset, data ));
38423841
38433842   switch ( offset )
r3775r3776
38933892{
38943893   int ktest = to8_kbd_ktest (space->machine);
38953894
3896   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), ktest ));
3895   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), ktest ));
38973896
38983897   return ktest;
38993898}
r3775r3776
39453944   to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */
39463945   to8_update_floppy_bank(space->machine);
39473946   to8_update_cart_bank(space->machine);
3948   to8_kbd_set_ack( ack );
3947   to8_kbd_set_ack( space->machine, ack );
39493948}
39503949
39513950
r3775r3776
39733972
39743973
39753974/* direct connection to interrupt line instead of through a PIA */
3976static void to8_lightpen_cb ( int step )
3975static void to8_lightpen_cb ( running_machine *machine, int step )
39773976{
39783977   if ( ! to7_lightpen )
39793978      return;
39803979
3981   thom_firq_2( Machine, 1 );
3980   thom_firq_2( machine, 1 );
39823981   to7_lightpen_step = step;
39833982   to8_lightpen_intr = 1;
39843983}
r3775r3776
40444043   LOG (( "to8: machine start called\n" ));
40454044
40464045   /* subsystems */
4047   thom_irq_init();
4046   thom_irq_init(machine);
40484047   pia_config( THOM_PIA_SYS, &to8_sys );
40494048   centronics_config( 0, &to9_centronics );
40504049   mc6846_config( machine, &to8_timer );
4051   to7_game_init();
4050   to7_game_init(machine);
40524051   to8_floppy_init( machine );
4053   to8_kbd_init();
4054   to9_palette_init();
4055   to7_modem_init();
4052   to8_kbd_init(machine);
4053   to9_palette_init(machine);
4054   to7_modem_init(machine);
40564055   to7_midi_init();
40574056   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
40584057
r3775r3776
42104209   LOG (( "to9p: machine start called\n" ));
42114210
42124211   /* subsystems */
4213   thom_irq_init();
4212   thom_irq_init(machine);
42144213   pia_config( THOM_PIA_SYS, &to9p_sys );
42154214   centronics_config( 0, &to9_centronics );
42164215   mc6846_config( machine, &to9p_timer );
4217   to7_game_init();
4216   to7_game_init(machine);
42184217   to8_floppy_init( machine );
4219   to9_kbd_init();
4220   to9_palette_init();
4221   to7_modem_init();
4218   to9_kbd_init(machine);
4219   to9_palette_init(machine);
4220   to7_modem_init(machine);
42224221   to7_midi_init();
42234222   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
42244223
r3775r3776
44224421static WRITE8_HANDLER ( mo6_game_porta_out )
44234422{
44244423   /* centronics data */
4425   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
4424   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
44264425   centronics_write_data( 0, data );
44274426}
44284427
r3775r3776
44324431{
44334432   int dtr = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 0 : 1;
44344433   /* note: printer busy signal replaces button */
4435   LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), dtr ));
4434   LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), dtr ));
44364435   return dtr;
44374436}
44384437
r3775r3776
44414440static WRITE8_HANDLER ( mo6_game_cb2_out )
44424441{
44434442   /* centronics strobe */
4444   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data ));
4443   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data ));
44454444   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0,
44464445                CENTRONICS_STROBE );
44474446}
r3775r3776
44784477
44794478
44804479
4481static void mo6_game_init ( void )
4480static void mo6_game_init ( running_machine *machine )
44824481{
44834482   LOG (( "mo6_game_init called\n" ));
44844483   pia_config( THOM_PIA_GAME, &mo6_game );
r3775r3776
46284627   }
46294628
46304629   LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
4631        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
4630        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
46324631        offset, 0xa7e4 + offset, res, to7_lightpen ));
46334632
46344633   return res;
r3775r3776
46394638WRITE8_HANDLER ( mo6_gatearray_w )
46404639{
46414640   LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
4642        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
4641        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
46434642        offset, 0xa7e4 + offset, data ));
46444643
46454644   switch ( offset )
r3775r3776
47064705WRITE8_HANDLER ( mo6_vreg_w )
47074706{
47084707   LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
4709        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)),
4708        cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)),
47104709        offset, 0xa7da + offset, data ));
47114710
47124711   switch ( offset )
r3775r3776
47984797   LOG (( "mo6: machine start called\n" ));
47994798
48004799   /* subsystems */
4801   thom_irq_init();
4800   thom_irq_init(machine);
48024801   pia_config( THOM_PIA_SYS, &mo6_sys );
48034802   centronics_config( 0, &to9_centronics );
4804   mo6_game_init();
4803   mo6_game_init(machine);
48054804   to7_floppy_init( machine, mem + 0x30000 );
4806   to9_palette_init();
4807   to7_modem_init();
4805   to9_palette_init(machine);
4806   to7_modem_init(machine);
48084807   to7_midi_init();
48094808   mo5_periodic_timer = timer_alloc(machine,  mo5_periodic_cb , NULL);
48104809   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
r3775r3776
48644863   if ( to7_controller_type )
48654864      return to7_floppy_r ( space, offset );
48664865
4867   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), offset );
4866   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset );
48684867
48694868   if ( to7_controller_type )
48704869      return to7_floppy_r ( space, offset );
r3775r3776
48804879      to7_floppy_w ( space, offset, data );
48814880   else
48824881      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
4883           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), data, offset );
4882           cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), data, offset );
48844883}
48854884
48864885
r3775r3776
49084907         return 0x80;
49094908
49104909   default:
4911      logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), offset );
4910      logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset );
49124911      return 0;
49134912   }
49144913}
r3775r3776
49304929      break;
49314930
49324931   default:
4933      logerror( "$%04x %f mo5nr_prn_w: unhandled to reg %i (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(machine)), offset, data );
4932      logerror( "$%04x %f mo5nr_prn_w: unhandled to reg %i (data=$%02X)\n", cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, data );
49344933   }
49354934}
49364935
r3775r3776
49944993
49954994
49964995
4997static void mo5nr_game_init ( void )
4996static void mo5nr_game_init ( running_machine *machine )
49984997{
49994998   LOG (( "mo5nr_game_init called\n" ));
50004999   pia_config( THOM_PIA_GAME, &mo5nr_game );
r3775r3776
50715070   LOG (( "mo5nr: machine start called\n" ));
50725071
50735072   /* subsystems */
5074   thom_irq_init();
5073   thom_irq_init(machine);
50755074   pia_config( THOM_PIA_SYS, &mo5nr_sys );
50765075   centronics_config( 0, &to9_centronics );
5077   mo5nr_game_init();
5076   mo5nr_game_init( machine );
50785077   to7_floppy_init( machine, mem + 0x30000 );
5079   to9_palette_init();
5080   to7_modem_init();
5078   to9_palette_init(machine);
5079   to7_modem_init(machine);
50815080   to7_midi_init();
50825081   mo5_periodic_timer = timer_alloc(machine,  mo5_periodic_cb , NULL);
50835082   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
src/mess/machine/tms9901.c
r3775r3776
193193/*
194194   initialize the tms9901 core
195195*/
196void tms9901_init(int which, const tms9901reset_param *param)
196void tms9901_init(running_machine *machine,int which, const tms9901reset_param *param)
197197{
198198   int i;
199199
src/mess/machine/tms9901.h
r3775r3776
3333} tms9901reset_param;
3434
3535
36void tms9901_init(int which, const tms9901reset_param *param);
36void tms9901_init(running_machine *machine,int which, const tms9901reset_param *param);
3737void tms9901_cleanup(int which);
3838
3939void tms9901_reset(int which);
src/mess/machine/tms9902.c
r3775r3776
126126/*
127127   initialize the tms9902 core
128128*/
129void tms9902_init(int which, const tms9902reset_param *param)
129void tms9902_init(running_machine *machine,int which, const tms9902reset_param *param)
130130{
131131   tms9902[which].clock_rate = param->clock_rate;
132132
src/mess/machine/tms9902.h
r3775r3776
88} tms9902reset_param;
99
1010
11void tms9902_init(int which, const tms9902reset_param *param);
11void tms9902_init(running_machine *machine,int which, const tms9902reset_param *param);
1212void tms9902_reset(int which);
1313void tms9902_cleanup(int which);
1414
src/mess/machine/994x_ser.c
r3775r3776
164164void ti99_rs232_init(running_machine *machine)
165165{
166166   rs232_DSR = memory_region(machine, region_dsr) + offset_rs232_dsr;
167   tms9902_init(0, &tms9902_params);
168   tms9902_init(1, &tms9902_params);
167   tms9902_init(machine, 0, &tms9902_params);
168   tms9902_init(machine, 1, &tms9902_params);
169169   
170170   add_exit_callback(machine, ti99_rs232_cleanup);
171171}
src/mess/machine/at29040.c
r3775r3776
129129/*
130130   Initialize one FEEPROM chip: must be called at machine init time
131131*/
132void at29c040a_init(int id)
132void at29c040a_init(running_machine *machine,int id)
133133{
134134   at29c040a[id].programming_timer = timer_alloc(machine, at29c040a_programming_timer_callback, NULL);
135135}
src/mess/machine/at29040.h
r3775r3776
11void at29c040a_init_data_ptr(int id, UINT8 *data_ptr);
2void at29c040a_init(int id);
2void at29c040a_init(running_machine *machine,int id);
33int at29c040a_file_load(int id, mame_file *file);
44int at29c040a_file_save(int id, mame_file *file);
55UINT8 at29c040a_r(int id, offs_t offset);
src/mess/machine/geneve.c
r3775r3776
207207
208208MACHINE_START( geneve )
209209{
210   tms9901_init(0, & tms9901reset_param_ti99);
210   tms9901_init(machine, 0, & tms9901reset_param_ti99);
211211
212212   /* Initialize all. Actually, at this point, we don't know
213213      how the switches are set. Later we use the configuration switches to
r3775r3776
413413   if (! tms5220_ready_r())
414414   {
415415      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready());
416      int cycles_to_ready = ceil(cpu_attotime_to_clocks(machine->cpu[0], time_to_ready));
416      int cycles_to_ready = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready));
417417
418418      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
419419
420420      cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
421      timer_set(machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
421      timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
422422   }
423423#endif
424424
src/mess/machine/99_hsgpl.c
r3775r3776
260260   hsgpl.RAM6_ptr = rgn + offset_hsgpl_ram6;
261261
262262   at29c040a_init_data_ptr(feeprom_grom0, rgn + offset_hsgpl_grom);
263   at29c040a_init(feeprom_grom0);
263   at29c040a_init(machine,feeprom_grom0);
264264   at29c040a_init_data_ptr(feeprom_grom1, rgn + offset_hsgpl_grom + 0x80000);
265   at29c040a_init(feeprom_grom1);
265   at29c040a_init(machine,feeprom_grom1);
266266   at29c040a_init_data_ptr(feeprom_rom6, rgn + offset_hsgpl_rom6);
267   at29c040a_init(feeprom_rom6);
267   at29c040a_init(machine,feeprom_rom6);
268268   at29c040a_init_data_ptr(feeprom_dsr, rgn + offset_hsgpl_dsr);
269   at29c040a_init(feeprom_dsr);
269   at29c040a_init(machine,feeprom_dsr);
270270}
271271
272272/*
src/mess/machine/ti99_4x.c
r3775r3776
751751void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm)
752752{
753753    if (ti99_model==model_99_8) {
754        tms9901_init(0, &tms9901reset_param_ti99_8);
754        tms9901_init(machine, 0, &tms9901reset_param_ti99_8);
755755    }
756756    else {
757   tms9901_init(0,  &tms9901reset_param_ti99_4x);
757      tms9901_init(machine, 0,  &tms9901reset_param_ti99_4x);
758758    }
759759   if (gfxparm!=0) TMS9928A_configure(gfxparm);
760760
r3775r3776
12831283   if (! tms5220_ready_r())
12841284   {
12851285      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready());
1286      int cycles_to_ready = ceil(cpu_attotime_to_clocks(machine->cpu[0], time_to_ready));
1286      int cycles_to_ready = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready));
12871287
12881288      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
12891289
12901290      cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
1291      timer_set(machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
1291      timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
12921292   }
12931293#endif
12941294
r3775r3776
16441644               if (! tms5220_ready_r())
16451645               {
16461646                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready());
1647                  double d = ceil(cpu_attotime_to_clocks(machine->cpu[0], time_to_ready));
1647                  double d = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready));
16481648                  int cycles_to_ready = ((int) (d + 3)) & ~3;
16491649
16501650                  logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready)
16511651                     , (int) cycles_to_ready);
16521652
16531653                  cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
1654                  timer_set(machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
1654                  timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
16551655               }
16561656
16571657               tms5220_data_w(space, offset, data);
r3775r3776
18191819      handset_ack = data;
18201820      if (data == handset_clock)
18211821         /* I don't know what the real delay is, but 30us apears to be enough */
1822         timer_set(machine, ATTOTIME_IN_USEC(30), NULL, 0, ti99_handset_ack_callback);
1822         timer_set(Machine, ATTOTIME_IN_USEC(30), NULL, 0, ti99_handset_ack_callback);
18231823   }
18241824}
18251825
src/mess/mess.mak
r3775r3776
471471   $(MESSOBJ)/tatung.a \
472472   $(MESSOBJ)/teamconc.a \
473473   $(MESSOBJ)/telmac.a \
474   $(MESSOBJ)/thomson.a \
474475   $(MESSOBJ)/ti85.a \
476   $(MESSOBJ)/ti99.a \
475477   $(MESSOBJ)/tiger.a \
476478   $(MESSOBJ)/trs80.a \
477479   $(MESSOBJ)/tutor.a \
r3775r3776
484486   $(MESSOBJ)/vtech.a \
485487   $(MESSOBJ)/shared.a \
486488
487#   $(MESSOBJ)/thomson.a \
488#   $(MESSOBJ)/ti99.a \
489489
490
491
492490#-------------------------------------------------
493491# the following files are general components and
494492# shared across a number of drivers
src/mess/devices/thomflop.c
r3775r3776
282282   else if ( offset == 8 )
283283      return to7_5p14_select;
284284   else
285      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset );
285      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset );
286286   return 0;
287287}
288288
r3775r3776
306306      case 4: drive = 2; side = 0; break;
307307      case 5: drive = 3; side = 1; break;
308308      default:
309         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data );
309         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data );
310310      }
311311
312312      dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO;
r3775r3776
321321         wd17xx_set_drive( drive );
322322         wd17xx_set_side( side );
323323         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
324               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu),
324               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu),
325325               data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" ));
326326      }
327327   }
328328   else
329329      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
330            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset, data );
330            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset, data );
331331}
332332
333333
r3775r3776
379379   else if ( offset >= 8 && offset <= 9 )
380380      return to7_5p14sd_select;
381381   else
382      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset );
382      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset );
383383   return 0;
384384}
385385
r3775r3776
423423         mc6843_set_drive( drive );
424424         mc6843_set_side( side );
425425         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
426               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data, drive, side ));
426               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data, drive, side ));
427427      }
428428   }
429429   else
430430      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
431            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset, data );
431            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset, data );
432432}
433433
434434
r3775r3776
541541      to7qdd->data_size = 0;
542542   }
543543
544   VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", attotime_to_double(timer_get_time(machine)), state ));
544   //VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", attotime_to_double(timer_get_time(machine)), state ));
545545}
546546
547547
r3775r3776
711711   case 0: /* MC6852 status */
712712      to7_qdd_stat_update();
713713      VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n",
714             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), to7qdd->status,
714             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), to7qdd->status,
715715             to7qdd->status & QDD_S_IRQ  ? 1 : 0,
716716             to7qdd->status & QDD_S_PE   ? 1 : 0,
717717             to7qdd->status & QDD_S_OVR  ? 1 : 0,
r3775r3776
734734         data |= 0x40; /* disk present */
735735      if ( to7qdd->index_pulse )
736736         data |= 0x80; /* disk start */
737      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
737      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
738738      return data;
739739   }
740740
741741   default:
742      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset );
742      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset );
743743      return 0;
744744   }
745745}
r3775r3776
761761      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
762762      to7_qdd_stat_update();
763763      VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n",
764             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
764             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
765765             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
766766             data & QDD_C1_STRIPSYNC ? "strip-sync " : "",
767767             data & QDD_C1_CLRSYNC ? "clear-sync " : "",
r3775r3776
803803            to7qdd->status &= ~QDD_S_NCTS;
804804         to7_qdd_stat_update();
805805         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
806                attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
806                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
807807                data & QDD_C3_CLRTUF ? "clr-tuf " : "",
808808                data & QDD_C3_CLRCTS ? "clr-cts " : "",
809809                data & QDD_C3_SYNCLEN ? 1 : 2,
r3775r3776
815815         break;
816816
817817      case 3: /* MC6852 data out => does not seem to be used */
818         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
818         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
819819         break;
820820
821821      }
r3775r3776
823823
824824   case 8: /* set drive */
825825      to7qdd->drive = data;
826      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
826      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
827827      break;
828828
829829   case 12: /* motor pulse ? */
830830      thom_floppy_active( 0 );
831      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
831      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
832832      break;
833833
834834   default:
835      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset, data );
835      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset, data );
836836   }
837837}
838838
r3775r3776
865865
866866
867867
868static void to7_qdd_init( void )
868static void to7_qdd_init( running_machine *machine )
869869{
870870   LOG(( "to7_qdd_init: CQ 90-028 controller\n" ));
871871
r3775r3776
983983         thmfc1->data_raw_idx = 0;
984984   }
985985
986   VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", attotime_to_double(timer_get_time(machine)), state ));
986   //VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", attotime_to_double(timer_get_time(machine)), state ));
987987}
988988
989989
r3775r3776
10251025
10261026
10271027/* complete command (by read, write, or timeout) */
1028static void thmfc_floppy_cmd_complete(void)
1028static void thmfc_floppy_cmd_complete(running_machine *machine)
10291029{
10301030   LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n",
10311031          attotime_to_double(timer_get_time(machine)), thmfc1->op, thmfc1->data_idx,
r3775r3776
10481048
10491049static TIMER_CALLBACK( thmfc_floppy_cmd_complete_cb )
10501050{
1051   thmfc_floppy_cmd_complete();
1051   thmfc_floppy_cmd_complete(machine);
10521052}
10531053
10541054
10551055
10561056/* intelligent read: show just one field, skip header */
1057static UINT8 thmfc_floppy_read_byte ( void )
1057static UINT8 thmfc_floppy_read_byte ( running_machine *machine )
10581058{
10591059   UINT8 data = thmfc1->data[ thmfc1->data_idx ];
10601060
r3775r3776
10641064//          data ));
10651065
10661066   if ( thmfc1->data_idx >= thmfc1->data_size - 1 )
1067      thmfc_floppy_cmd_complete();
1067      thmfc_floppy_cmd_complete(machine);
10681068   else
10691069      thmfc1->data_idx++;
10701070
r3775r3776
12031203
12041204
12051205/* intelligent writing */
1206static void thmfc_floppy_write_byte ( UINT8 data )
1206static void thmfc_floppy_write_byte ( running_machine *machine, UINT8 data )
12071207{
12081208//   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
12091209//      attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu),
r3775r3776
12121212   thmfc1->data_raw_size = 0;
12131213   thmfc1->data[ thmfc1->data_idx ] = data;
12141214   if ( thmfc1->data_idx >= thmfc1->data_size - 1 )
1215      thmfc_floppy_cmd_complete();
1215      thmfc_floppy_cmd_complete(machine);
12161216   else
12171217      thmfc1->data_idx++;
12181218}
r3775r3776
12601260
12611261   case 0: /* STAT0 */
12621262      thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL;
1263      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), thmfc1->stat0 ));
1263      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), thmfc1->stat0 ));
12641264      return thmfc1->stat0;
12651265
12661266   case 1: /* STAT1 */
r3775r3776
12911291         data |= 0x10;
12921292      if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
12931293         data |= 0x04;
1294      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
1294      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
12951295      return data;
12961296   }
12971297
12981298   case 3: /* RDATA */
12991299
13001300      if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR )
1301         return thmfc_floppy_read_byte();
1301         return thmfc_floppy_read_byte(space->machine);
13021302      else
13031303         return thmfc_floppy_raw_read_byte();
13041304
r3775r3776
13091309   {
13101310      /* undocumented => emulate TO7 QDD controller ? */
13111311      UINT8 data = thmfc1->ipl << 7;
1312      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
1312      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
13131313      return data;
13141314   }
13151315
13161316   default:
1317      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset );
1317      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset );
13181318      return 0;
13191319   }
13201320}
r3775r3776
13341334      thom_floppy_set_density( dens );
13351335      thmfc1->formatting = (data >> 2) & 1;
13361336      LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
1337             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
1337             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
13381338             (dens == DEN_FM_LO) ? "MF" : "MFM",
13391339             wsync, (data >> 3) & 1,
13401340             thmfc1->formatting, data & 3 ));
r3775r3776
14241424      }
14251425
14261426      LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n",
1427             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
1427             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
14281428             thmfc1->sector_size, (data >> 1) & 7, thmfc1->side ));
14291429      break;
14301430
r3775r3776
14521452      thom_floppy_active( 0 );
14531453
14541454      LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n",
1455             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
1455             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
14561456             thmfc1->drive, seek, motor ));
14571457
14581458      if ( seek )
r3775r3776
14751475      if ( thmfc_floppy_is_qdd() )
14761476         thmfc_floppy_qdd_write_byte( data );
14771477      else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
1478         thmfc_floppy_write_byte( data );
1478         thmfc_floppy_write_byte( space->machine, data );
14791479      else if ( thmfc1->formatting )
14801480         thmfc_floppy_format_byte( data );
14811481      else
14821482      {
14831483         /* TODO: implement other forms of raw track writing */
14841484         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
1485                attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
1485                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
14861486      }
14871487      break;
14881488
r3775r3776
14901490   case 4: /* WCLK (unemulated) */
14911491      /* clock configuration: FF for data, 0A for synchro */
14921492      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
1493             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
1493             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
14941494             (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" ));
14951495      break;
14961496
14971497   case 5: /* WSECT */
14981498      thmfc1->sector = data;
14991499      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
1500             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
1500             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
15011501      break;
15021502
15031503   case 6: /* WTRCK */
15041504      thmfc1->track = data;
15051505      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
1506             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data,
1506             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data,
15071507             floppy_drive_get_current_track( thmfc_floppy_image() ) ));
15081508      break;
15091509
15101510   case 7: /* WCELL */
15111511      /* precompensation (unemulated) */
15121512      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
1513             attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), data ));
1513             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), data ));
15141514      break;
15151515
15161516   default:
15171517      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
1518            attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset, data );
1518            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset, data );
15191519   }
15201520}
15211521
r3775r3776
15541554
15551555
15561556
1557void thmfc_floppy_init( void )
1557void thmfc_floppy_init( running_machine *machine )
15581558{
15591559   LOG(( "thmfc_floppy_init: THMFC1 controller\n" ));
15601560
r3775r3776
16521652
16531653*/
16541654
1655static void to7_network_got_frame( UINT8* data, int length )
1655static void to7_network_got_frame( running_machine *machine, UINT8* data, int length )
16561656{
16571657   int i;
16581658   LOG(( "%f to7_network_got_frame:", attotime_to_double(timer_get_time(machine)) ));
r3775r3776
16901690
16911691
16921692
1693static void to7_network_init( void )
1693static void to7_network_init( running_machine *machine )
16941694{
16951695   LOG(( "to7_network_init: NR 07-005 network extension\n" ));
16961696   logerror( "to7_network_init: network not handled!\n" );
1697   mc6854_config( &network_iface  );
1697   mc6854_config( machine, &network_iface  );
16981698}
16991699
17001700
r3775r3776
17171717   {
17181718      /* network ID of the computer */
17191719      UINT8 id = input_port_read(space->machine, "fconfig") >> 3;
1720      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), id ));
1720      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), id ));
17211721      return id;
17221722   }
17231723
1724   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset );
1724   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset );
17251725   return 0;
17261726}
17271727
r3775r3776
17341734   else
17351735   {
17361736      logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n",
1737           attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(space->cpu), offset, data );
1737           attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(space->cpu), offset, data );
17381738   }
17391739}
17401740
r3775r3776
17651765   state_save_register_global(machine,  to7_floppy_bank );
17661766   to7_5p14sd_init(machine);
17671767   to7_5p14_init(machine);
1768   to7_qdd_init();
1769   thmfc_floppy_init();
1770   to7_network_init();
1768   to7_qdd_init(machine);
1769   thmfc_floppy_init(machine);
1770   to7_network_init(machine);
17711771}
17721772
17731773
src/mess/devices/thomflop.h
r3775r3776
3939extern WRITE8_HANDLER ( to9_floppy_w );
4040
4141/* TO8 internal (THMFC1) controller */
42extern void thmfc_floppy_init  ( void );
42extern void thmfc_floppy_init  ( running_machine *machine );
4343extern void thmfc_floppy_reset ( running_machine *machine );
4444extern READ8_HANDLER  ( thmfc_floppy_r );
4545extern WRITE8_HANDLER ( thmfc_floppy_w );
src/mess/formats/thom_dsk.c
r3775r3776
215215      physical_track = 0;
216216   if ( physical_track >= 80 )
217217      physical_track = 79;
218   LOG(( "%f thom_floppy_seek: dev=%d track=%i\n", attotime_to_double(timer_get_time(machine)), (int)(FPTR)(d - thom_floppy_drives), physical_track ));
218   //LOG(( "%f thom_floppy_seek: dev=%d track=%i\n", attotime_to_double(timer_get_time(machine)), (int)(FPTR)(d - thom_floppy_drives), physical_track ));
219219   d->cur_track = physical_track;
220220}
221221
src/mess/drivers/tm990189.c
r3775r3776
194194
195195   hold_load(machine);
196196
197   tms9901_init(0, &usr9901reset_param);
198   tms9901_init(1, &sys9901reset_param);
197   tms9901_init(machine, 0, &usr9901reset_param);
198   tms9901_init(machine, 1, &sys9901reset_param);
199199   tms9901_reset(0);
200200   tms9901_reset(1);
201201
202   tms9902_init(0, &tms9902_params);
202   tms9902_init(machine, 0, &tms9902_params);
203203}
204204
205205static const TMS9928a_interface tms9918_interface =
r3775r3776
226226
227227   hold_load(machine);
228228
229   tms9901_init(0, &usr9901reset_param);
230   tms9901_init(1, &sys9901reset_param);
229   tms9901_init(machine, 0, &usr9901reset_param);
230   tms9901_init(machine, 1, &sys9901reset_param);
231231   tms9901_reset(0);
232232   tms9901_reset(1);
233233
234   tms9902_init(0, &tms9902_params);
234   tms9902_init(machine, 0, &tms9902_params);
235235
236236   TMS9928A_reset();
237237}
r3775r3776
494494   rs232_fp = image;
495495
496496   tms9902_set_dsr(id, 1);
497   rs232_input_timer = timer_alloc(machine, rs232_input_callback, NULL);
497   rs232_input_timer = timer_alloc(image->machine, rs232_input_callback, NULL);
498498   timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10));
499499
500500   return INIT_PASS;
src/mess/drivers/thomson.c
r3775r3776
7676#include "includes/thomson.h"
7777#include "machine/6821pia.h"
7878#include "machine/mc6846.h"
79#include "machine/6850acia.h"
7980#include "machine/6551.h"
8081#include "audio/mea8000.h"
8182#include "devices/cartslot.h"
r3775r3776
712713     CONFIG_IMPORT_FROM ( to7 )
713714SYSTEM_CONFIG_END
714715
716extern const acia6850_interface to7_acia_modem;
715717
716718/* ------------ driver ------------ */
717719
r3775r3776
760762
761763   /* acia */
762764   MDRV_DEVICE_ADD("acia", ACIA6551)
765   MDRV_DEVICE_ADD("acia_1", ACIA6850)
766   MDRV_DEVICE_CONFIG(to7_acia_modem)   
763767MACHINE_DRIVER_END
764768
765769static MACHINE_DRIVER_START ( t9000 )
src/mess/drivers/ti990_10.c
r3775r3776
136136      ti990_set_int10
137137   };
138138
139   vdt911_init_term(0, & params);
139   vdt911_init_term(machine, 0, & params);
140140}
141141
142142static VIDEO_UPDATE( ti990_10 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team