Previous 15994 Revisions Next

r3910 Saturday 20th December, 2008 at 13:31:00 UTC by Nathan Woods
Widened some callbacks to pass machine* parameters [Atari Ace]
[src/mess/drivers]ti990_10.c ti990_4.c
[src/mess/machine]990_dk.c 990_dk.h 990_hd.c 990_hd.h 990_tap.c 990_tap.h 994x_ser.c 99_dsk.c 99_ide.c 99_ide.h 99_peb.c 99_peb.h ti990.c ti990.h
[src/mess/video]733_asr.c 733_asr.h 911_vdt.c 911_vdt.h

src/mess/video/911_vdt.c
r3909r3910
8383{
8484   vdt911_screen_size_t screen_size;   /* char_960 for 960-char, 12-line model; char_1920 for 1920-char, 24-line model */
8585   vdt911_model_t model;            /* country code */
86   void (*int_callback)(int state);   /* interrupt callback, called when the state of irq changes */
86   void (*int_callback)(running_machine *machine, int state);   /* interrupt callback, called when the state of irq changes */
8787
8888   UINT8 data_reg;                  /* vdt911 write buffer */
8989   UINT8 display_RAM[2048];         /* vdt911 char buffer (1kbyte for 960-char model, 2kbytes for 1920-char model) */
r3909r3910
285285/*
286286   CRU interface read
287287*/
288int vdt911_cru_r(int offset, int unit)
288static int vdt911_cru_r(int offset, int unit)
289289{
290290   int reply=0;
291291
r3909r3910
336336/*
337337   CRU interface write
338338*/
339void vdt911_cru_w(int offset, int data, int unit)
339static void vdt911_cru_w(const address_space *space, int offset, int data, int unit)
340340{
341341   offset &= 0xf;
342342
r3909r3910
386386      case 0xc:
387387         /* keyboard interrupt enable */
388388         vdt[unit].keyboard_interrupt_enable = data;
389         (*vdt[unit].int_callback)(vdt[unit].keyboard_interrupt_enable && vdt[unit].keyboard_data_ready);
389         (*vdt[unit].int_callback)(space->machine, vdt[unit].keyboard_interrupt_enable && vdt[unit].keyboard_data_ready);
390390         break;
391391
392392      case 0xd:
r3909r3910
444444         {
445445            vdt[unit].keyboard_data_ready = 0;
446446            if (vdt[unit].keyboard_interrupt_enable)
447               (*vdt[unit].int_callback)(0);
447               (*vdt[unit].int_callback)(space->machine, 0);
448448         }
449449         /*vdt[unit].keyboard_parity_error = 0;*/
450450         break;
r3909r3910
472472
473473WRITE8_HANDLER(vdt911_0_cru_w)
474474{
475   vdt911_cru_w(offset, data, 0);
475   vdt911_cru_w(space, offset, data, 0);
476476}
477477
478478/*
r3909r3910
681681                  vdt[unit].keyboard_data = (int)key_translate[vdt[unit].model][modifier_state][last_key_pressed];
682682                  vdt[unit].keyboard_data_ready = 1;
683683                  if (vdt[unit].keyboard_interrupt_enable)
684                     (*vdt[unit].int_callback)(1);
684                     (*vdt[unit].int_callback)(machine, 1);
685685                  return;
686686               }
687687            }
src/mess/video/911_vdt.h
r3909r3910
3737{
3838   vdt911_screen_size_t screen_size;
3939   vdt911_model_t model;
40   void (*int_callback)(int state);
40   void (*int_callback)(running_machine *machine, int state);
4141} vdt911_init_params_t;
4242
4343PALETTE_INIT( vdt911 );
r3909r3910
4747
4848void vdt911_reset(void);
4949
50int vdt911_cru_r(int offset, int unit);
51void vdt911_cru_w(int offset, int data, int unit);
52
5350 READ8_HANDLER(vdt911_0_cru_r);
5451WRITE8_HANDLER(vdt911_0_cru_w);
5552
src/mess/video/733_asr.c
r3909r3910
6060
6161   int x;
6262
63   void (*int_callback)(int state);
63   void (*int_callback)(running_machine *, int state);
6464
6565   bitmap_t *bitmap;
6666} asr[MAX_ASR];
r3909r3910
167167   memcpy(dst, fontdata6x8, asrfontdata_size);
168168}
169169
170int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(int state))
170int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(running_machine *, int state))
171171{
172172   const device_config *screen = video_screen_first(machine->config);
173173   int width = video_screen_get_width(screen);
r3909r3910
183183   return 0;
184184}
185185
186static void asr_field_interrupt(int unit)
186static void asr_field_interrupt(running_machine *machine, int unit)
187187{
188188   if ((asr[unit].mode & AM_enint_mask) && (asr[unit].new_status_flag))   /* right??? */
189189   {
190190      asr[unit].status |= AS_int_mask;
191191      if (asr[unit].int_callback)
192         (*asr[unit].int_callback)(1);
192         (*asr[unit].int_callback)(machine, 1);
193193   }
194194   else
195195   {
196196      asr[unit].status &= ~AS_int_mask;
197197      if (asr[unit].int_callback)
198         (*asr[unit].int_callback)(0);
198         (*asr[unit].int_callback)(machine, 0);
199199   }
200200}
201201
202void asr733_reset(int unit)
202void asr733_reset(running_machine *machine, int unit)
203203{
204204   /*asr[unit].OutQueueLen = 0;*/
205205
206206   asr[unit].status = AS_dsr_mask | AS_wrq_mask;
207207   asr[unit].mode = 0;
208208
209   asr_field_interrupt(unit);
209   asr_field_interrupt(machine, unit);
210210}
211211
212212/* write a single char on screen */
r3909r3910
295295
296296   asr[unit].status |= AS_wrq_mask;
297297   asr[unit].new_status_flag = 1;   /* right??? */
298   asr_field_interrupt(unit);
298   asr_field_interrupt(machine, unit);
299299}
300300
301301#if 0
r3909r3910
309309
310310   ASR.status |= AS_rrq_mask;
311311   ASR.new_status_flag = 1;   /* right??? */
312   asr_field_interrupt();
312   asr_field_interrupt(machine, 0);
313313}
314314#endif
315315
r3909r3910
389389      else
390390         asr[unit].mode &= ~ (1 << (offset - 8));
391391      if (offset == 14)
392         asr_field_interrupt(unit);
392         asr_field_interrupt(machine, unit);
393393      break;
394394
395395   case 11:   /* clear write request (write any value to execute) */
396396   case 12:   /* clear read request (write any value to execute) */
397397      asr[unit].status &= ~ (1 << (offset - 8));
398      asr_field_interrupt(unit);
398      asr_field_interrupt(machine, unit);
399399      break;
400400
401401   case 13:   /* clear new status flag - whatever it means (write any value to execute) */
402402      asr[unit].new_status_flag = 0;
403      asr_field_interrupt(unit);
403      asr_field_interrupt(machine, unit);
404404      break;
405405   }
406406}
r3909r3910
671671            {   /* repeat current key */
672672               asr[unit].status |= AS_rrq_mask;
673673               asr[unit].new_status_flag = 1;   /* right??? */
674               asr_field_interrupt(unit);
674               asr_field_interrupt(machine, unit);
675675               repeat_timer = 0;
676676            }
677677         }
r3909r3910
704704                  asr[unit].recv_buf = (int)key_translate[modifier_state][last_key_pressed];
705705                  asr[unit].status |= AS_rrq_mask;
706706                  asr[unit].new_status_flag = 1;   /* right??? */
707                  asr_field_interrupt(unit);
707                  asr_field_interrupt(machine, unit);
708708                  return;
709709               }
710710            }
src/mess/video/733_asr.h
r3909r3910
1414extern PALETTE_INIT ( asr733 ) ;
1515
1616void asr733_init(running_machine *machine);
17int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(int state));
17int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(running_machine *machine, int state));
1818
19void asr733_reset(int unit);
19void asr733_reset(running_machine *machine, int unit);
2020
21int asr733_cru_r(int offset, int unit);
22void asr733_cru_w(running_machine *machine, int offset, int data, int unit);
23
2421READ8_HANDLER(asr733_0_cru_r);
2522WRITE8_HANDLER(asr733_0_cru_w);
2623
src/mess/machine/990_hd.c
r3909r3910
2323#include "harddisk.h"
2424#include "devices/harddriv.h"
2525
26static void update_interrupt(void);
26static void update_interrupt(running_machine *machine);
2727
2828/* max disk units per controller: 4 is the protocol limit, but it may be
2929overriden if more than one controller is used */
r3909r3910
9090{
9191   UINT16 w[8];
9292
93   void (*interrupt_callback)(int state);
93   void (*interrupt_callback)(running_machine *machine, int state);
9494
9595   hd_unit_t d[MAX_DISK_UNIT];
9696} hdc_t;
r3909r3910
326326}
327327
328328
329void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(int state))
329void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state))
330330{
331331   memset(hdc.w, 0, sizeof(hdc.w));
332332   hdc.w[7] = w7_idle;
r3909r3910
339339
340340   hdc.interrupt_callback = interrupt_callback;
341341
342   update_interrupt();
342   update_interrupt(machine);
343343}
344344
345345
r3909r3910
372372/*
373373   Update interrupt state
374374*/
375static void update_interrupt(void)
375static void update_interrupt(running_machine *machine)
376376{
377377   if (hdc.interrupt_callback)
378      (*hdc.interrupt_callback)((hdc.w[7] & w7_idle)
378      (*hdc.interrupt_callback)(machine, (hdc.w[7] & w7_idle)
379379                           && (((hdc.w[7] & w7_int_enable) && (hdc.w[7] & (w7_complete | w7_error)))
380380                              || ((hdc.w[0] & (hdc.w[0] >> 4)) & w0_attn_mask)));
381381}
r3909r3910
385385
386386   Terminate current command and return non-zero if the address is invalid.
387387*/
388static int check_sector_address(int unit, unsigned int cylinder, unsigned int head, unsigned int sector)
388static int check_sector_address(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector)
389389{
390390   if ((cylinder > hdc.d[unit].cylinders) || (head > hdc.d[unit].heads) || (sector > hdc.d[unit].sectors_per_track))
391391   {   /* invalid address */
r3909r3910
401401      }
402402      else if (sector > hdc.d[unit].sectors_per_track)
403403         hdc.w[7] |= w7_idle | w7_error | w7_command_time_out_err;
404      update_interrupt();
404      update_interrupt(machine);
405405      return 1;
406406   }
407407
r3909r3910
411411/*
412412   Seek to sector whose address is given
413413*/
414static int sector_to_lba(int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba)
414static int sector_to_lba(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba)
415415{
416   if (check_sector_address(unit, cylinder, head, sector))
416   if (check_sector_address(machine, unit, cylinder, head, sector))
417417      return 1;
418418
419419   * lba = (cylinder*hdc.d[unit].heads + head)*hdc.d[unit].sectors_per_track + sector;
r3909r3910
499499   {
500500      /* No idea what to report... */
501501      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
502      update_interrupt();
502      update_interrupt(machine);
503503      return;
504504   }
505505   else if (! is_unit_loaded(dsk_sel))
506506   {   /* offline */
507507      hdc.w[0] |= w0_offline | w0_not_ready;
508508      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
509      update_interrupt();
509      update_interrupt(machine);
510510      return;
511511   }
512512
r3909r3910
535535      }
536536
537537   hdc.w[7] |= w7_idle | w7_complete;
538   update_interrupt();
538   update_interrupt(machine);
539539}
540540
541541/*
r3909r3910
543543
544544   The emulation just clears the track data in the disk image.
545545*/
546static void write_format(void)
546static void write_format(running_machine *machine)
547547{
548548   unsigned int cylinder, head, sector;
549549   unsigned int lba;
r3909r3910
558558   {
559559      /* No idea what to report... */
560560      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
561      update_interrupt();
561      update_interrupt(machine);
562562      return;
563563   }
564564   else if (! is_unit_loaded(dsk_sel))
565565   {   /* offline */
566566      hdc.w[0] |= w0_offline | w0_not_ready;
567567      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
568      update_interrupt();
568      update_interrupt(machine);
569569      return;
570570   }
571571   else if (hdc.d[dsk_sel].unsafe)
572572   {   /* disk in unsafe condition */
573573      hdc.w[0] |= w0_unsafe | w0_pack_change;
574574      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
575      update_interrupt();
575      update_interrupt(machine);
576576      return;
577577   }
578578   else if (hdc.d[dsk_sel].wp)
579579   {   /* disk write-protected */
580580      hdc.w[0] |= w0_write_protect;
581581      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
582      update_interrupt();
582      update_interrupt(machine);
583583      return;
584584   }
585585
586586   cylinder = hdc.w[3];
587587   head = hdc.w[1] & w1_head_address;
588588
589   if (sector_to_lba(dsk_sel, cylinder, head, 0, &lba))
589   if (sector_to_lba(machine, dsk_sel, cylinder, head, 0, &lba))
590590      return;
591591
592592   memset(buffer, 0, hdc.d[dsk_sel].bytes_per_sector);
r3909r3910
599599      {
600600         hdc.w[0] |= w0_offline | w0_not_ready;
601601         hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
602         update_interrupt();
602         update_interrupt(machine);
603603         return;
604604      }
605605
r3909r3910
607607   }
608608
609609   hdc.w[7] |= w7_idle | w7_complete;
610   update_interrupt();
610   update_interrupt(machine);
611611}
612612
613613/*
r3909r3910
633633   {
634634      /* No idea what to report... */
635635      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
636      update_interrupt();
636      update_interrupt(machine);
637637      return;
638638   }
639639   else if (! is_unit_loaded(dsk_sel))
640640   {   /* offline */
641641      hdc.w[0] |= w0_offline | w0_not_ready;
642642      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
643      update_interrupt();
643      update_interrupt(machine);
644644      return;
645645   }
646646   else if (hdc.d[dsk_sel].unsafe)
647647   {   /* disk in unsafe condition */
648648      hdc.w[0] |= w0_unsafe | w0_pack_change;
649649      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
650      update_interrupt();
650      update_interrupt(machine);
651651      return;
652652   }
653653
r3909r3910
658658   head = hdc.w[1] & w1_head_address;
659659   sector = hdc.w[2] & 0xff;
660660
661   if (sector_to_lba(dsk_sel, cylinder, head, sector, &lba))
661   if (sector_to_lba(machine, dsk_sel, cylinder, head, sector, &lba))
662662      return;
663663
664664   while (byte_count)
r3909r3910
667667      {
668668         hdc.w[0] |= w0_seek_incomplete;
669669         hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
670         update_interrupt();
670         update_interrupt(machine);
671671         return;
672672      }
673673
r3909r3910
677677      if (bytes_read != bytes_to_read)
678678      {   /* behave as if the controller could not found the sector ID mark */
679679         hdc.w[7] |= w7_idle | w7_error | w7_command_time_out_err;
680         update_interrupt();
680         update_interrupt(machine);
681681         return;
682682      }
683683
r3909r3910
707707   }
708708
709709   hdc.w[7] |= w7_idle | w7_complete;
710   update_interrupt();
710   update_interrupt(machine);
711711}
712712
713713/*
r3909r3910
733733   {
734734      /* No idea what to report... */
735735      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
736      update_interrupt();
736      update_interrupt(machine);
737737      return;
738738   }
739739   else if (! is_unit_loaded(dsk_sel))
740740   {   /* offline */
741741      hdc.w[0] |= w0_offline | w0_not_ready;
742742      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
743      update_interrupt();
743      update_interrupt(machine);
744744      return;
745745   }
746746   else if (hdc.d[dsk_sel].unsafe)
747747   {   /* disk in unsafe condition */
748748      hdc.w[0] |= w0_unsafe | w0_pack_change;
749749      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
750      update_interrupt();
750      update_interrupt(machine);
751751      return;
752752   }
753753   else if (hdc.d[dsk_sel].wp)
754754   {   /* disk write-protected */
755755      hdc.w[0] |= w0_write_protect;
756756      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
757      update_interrupt();
757      update_interrupt(machine);
758758      return;
759759   }
760760
r3909r3910
765765   head = hdc.w[1] & w1_head_address;
766766   sector = hdc.w[2] & 0xff;
767767
768   if (sector_to_lba(dsk_sel, cylinder, head, sector, &lba))
768   if (sector_to_lba(machine, dsk_sel, cylinder, head, sector, &lba))
769769      return;
770770
771771   while (byte_count > 0)
r3909r3910
774774      {
775775         hdc.w[0] |= w0_seek_incomplete;
776776         hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
777         update_interrupt();
777         update_interrupt(machine);
778778         return;
779779      }
780780
r3909r3910
797797      {
798798         hdc.w[0] |= w0_offline | w0_not_ready;
799799         hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
800         update_interrupt();
800         update_interrupt(machine);
801801         return;
802802      }
803803
r3909r3910
819819   }
820820
821821   hdc.w[7] |= w7_idle | w7_complete;
822   update_interrupt();
822   update_interrupt(machine);
823823}
824824
825825/*
r3909r3910
842842   {
843843      /* No idea what to report... */
844844      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
845      update_interrupt();
845      update_interrupt(machine);
846846      return;
847847   }
848848   else if (! is_unit_loaded(dsk_sel))
849849   {   /* offline */
850850      hdc.w[0] |= w0_offline | w0_not_ready;
851851      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
852      update_interrupt();
852      update_interrupt(machine);
853853      return;
854854   }
855855   else if (hdc.d[dsk_sel].unsafe)
856856   {   /* disk in unsafe condition */
857857      hdc.w[0] |= w0_unsafe | w0_pack_change;
858858      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
859      update_interrupt();
859      update_interrupt(machine);
860860      return;
861861   }
862862
r3909r3910
867867   head = hdc.w[1] & w1_head_address;
868868   sector = hdc.w[2] & 0xff;
869869
870   if (check_sector_address(dsk_sel, cylinder, head, sector))
870   if (check_sector_address(machine, dsk_sel, cylinder, head, sector))
871871      return;
872872
873873   dma_address = ((((int) hdc.w[6]) << 16) | hdc.w[5]) & 0x1ffffe;
r3909r3910
893893      }
894894
895895   hdc.w[7] |= w7_idle | w7_complete;
896   update_interrupt();
896   update_interrupt(machine);
897897}
898898
899899/*
900900   Handle the restore command: return to track 0.
901901*/
902static void restore(void)
902static void restore(running_machine *machine)
903903{
904904   int dsk_sel = cur_disk_unit();
905905
r3909r3910
908908   {
909909      /* No idea what to report... */
910910      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
911      update_interrupt();
911      update_interrupt(machine);
912912      return;
913913   }
914914   else if (! is_unit_loaded(dsk_sel))
915915   {   /* offline */
916916      hdc.w[0] |= w0_offline | w0_not_ready;
917917      hdc.w[7] |= w7_idle | w7_error | w7_unit_err;
918      update_interrupt();
918      update_interrupt(machine);
919919      return;
920920   }
921921
r3909r3910
925925      return;*/
926926
927927   hdc.w[7] |= w7_idle | w7_complete;
928   update_interrupt();
928   update_interrupt(machine);
929929}
930930
931931/*
r3909r3910
949949   case 0x01: //0b001:
950950      /* write format */
951951      logerror("write format\n");
952      write_format();
952      write_format(machine);
953953      break;
954954   case 0x02: //0b010:
955955      /* read data */
r3909r3910
971971      logerror("unformatted write\n");
972972      /* ... */
973973      hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion;
974      update_interrupt();
974      update_interrupt(machine);
975975      break;
976976   case 0x06: //0b110:
977977      /* seek */
978978      logerror("seek\n");
979979      /* This command can (almost) safely be ignored */
980980      hdc.w[7] |= w7_idle | w7_complete;
981      update_interrupt();
981      update_interrupt(machine);
982982      break;
983983   case 0x07: //0b111:
984984      /* restore */
985985      logerror("restore\n");
986      restore();
986      restore(machine);
987987      break;
988988   }
989989}
r3909r3910
10151015         hdc.w[offset] = (hdc.w[offset] & ((~w_mask[offset]) | mem_mask)) | (data & w_mask[offset] & ~mem_mask);
10161016
10171017         if ((offset == 0) || (offset == 7))
1018            update_interrupt();
1018            update_interrupt(space->machine);
10191019
10201020         if ((offset == 7) && (old_data & w7_idle) && ! (data & w7_idle))
10211021         {   /* idle has been cleared: start command execution */
src/mess/machine/990_hd.h
r3909r3910
88
99MACHINE_START( ti990_hdc );
1010
11void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(int state));
11void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state));
1212
1313READ16_HANDLER(ti990_hdc_r);
1414WRITE16_HANDLER(ti990_hdc_w);
src/mess/machine/99_dsk.c
r3909r3910
373373   {
374374   case WD17XX_IRQ_CLR:
375375      DRQ_IRQ_status &= ~fdc_IRQ;
376      ti99_peb_set_ilb_bit(intb_fdc_bit, 0);
376      ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 0);
377377      break;
378378   case WD17XX_IRQ_SET:
379379      DRQ_IRQ_status |= fdc_IRQ;
380      ti99_peb_set_ilb_bit(intb_fdc_bit, 1);
380      ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 1);
381381      break;
382382   case WD17XX_DRQ_CLR:
383383      DRQ_IRQ_status &= ~fdc_DRQ;
src/mess/machine/ti990.c
r3909r3910
55*/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "ti990.h"
109
1110/*
r3909r3910
4342   ti990_set_int_line(device->machine, 2, state);
4443}
4544
46void ti990_set_int3(int state)
45void ti990_set_int3(running_machine *machine, int state)
4746{
48   ti990_set_int_line(Machine, 3, state);
47   ti990_set_int_line(machine, 3, state);
4948}
5049
51void ti990_set_int6(int state)
50void ti990_set_int6(running_machine *machine, int state)
5251{
53   ti990_set_int_line(Machine, 6, state);
52   ti990_set_int_line(machine, 6, state);
5453}
5554
56void ti990_set_int7(int state)
55void ti990_set_int7(running_machine *machine, int state)
5756{
58   ti990_set_int_line(Machine, 7, state);
57   ti990_set_int_line(machine, 7, state);
5958}
6059
61void ti990_set_int9(int state)
60void ti990_set_int9(running_machine *machine, int state)
6261{
63   ti990_set_int_line(Machine, 9, state);
62   ti990_set_int_line(machine, 9, state);
6463}
6564
66void ti990_set_int10(int state)
65void ti990_set_int10(running_machine *machine, int state)
6766{
68   ti990_set_int_line(Machine, 10, state);
67   ti990_set_int_line(machine, 10, state);
6968}
7069
71void ti990_set_int13(int state)
70void ti990_set_int13(running_machine *machine, int state)
7271{
73   ti990_set_int_line(Machine, 13, state);
72   ti990_set_int_line(machine, 13, state);
7473}
7574
7675/*
r3909r3910
9695SMI sheet 4) */
9796static char ckon_state;
9897
99void ti990_line_interrupt(void)
98void ti990_line_interrupt(running_machine *machine)
10099{
101100   if (ckon_state)
102      ti990_set_int_line(Machine, 5, 1);
101      ti990_set_int_line(machine, 5, 1);
103102}
104103
105104void ti990_ckon_ckof_callback(const device_config *device, int state)
src/mess/machine/ti990.h
r3909r3910
55void ti990_reset_int(void);
66void ti990_set_int_line(running_machine *machine, int line, int state);
77void ti990_set_int2(const device_config *device, int state);
8void ti990_set_int3(int state);
9void ti990_set_int6(int state);
10void ti990_set_int7(int state);
11void ti990_set_int9(int state);
12void ti990_set_int10(int state);
13void ti990_set_int13(int state);
8void ti990_set_int3(running_machine *machine, int state);
9void ti990_set_int6(running_machine *machine, int state);
10void ti990_set_int7(running_machine *machine, int state);
11void ti990_set_int9(running_machine *machine, int state);
12void ti990_set_int10(running_machine *machine, int state);
13void ti990_set_int13(running_machine *machine, int state);
1414
1515void ti990_hold_load(running_machine *machine);
1616
1717 READ8_HANDLER ( ti990_panel_read );
1818WRITE8_HANDLER ( ti990_panel_write );
1919
20void ti990_line_interrupt(void);
20void ti990_line_interrupt(running_machine *machine);
2121void ti990_ckon_ckof_callback(const device_config *device, int state);
2222
2323void ti990_cpuboard_reset(void);
src/mess/machine/990_dk.c
r3909r3910
1818
1919static struct
2020{
21   running_machine *machine;
2122   UINT16 recv_buf;
2223   UINT16 stat_reg;
2324   UINT16 xmit_buf;
2425   UINT16 cmd_reg;
2526
2627   int interrupt_f_f;
27   void (*interrupt_callback)(int state);
28   void (*interrupt_callback)(running_machine *, int state);
2829
2930   UINT8 buf[128];
3031   int buf_pos;
r3909r3910
8889static void fd800_field_interrupt(void)
8990{
9091   if (fd800.interrupt_callback)
91      (*fd800.interrupt_callback)((fd800.stat_reg & status_interrupt) && ! fd800.interrupt_f_f);
92      (*fd800.interrupt_callback)(fd800.machine, (fd800.stat_reg & status_interrupt) && ! fd800.interrupt_f_f);
9293}
9394
9495static void fd800_unload_proc(const device_config *image)
r3909r3910
9899   fd800.drv[unit].log_cylinder[0] = fd800.drv[unit].log_cylinder[1] = -1;
99100}
100101
101void fd800_machine_init(void (*interrupt_callback)(int state))
102void fd800_machine_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state))
102103{
103104   int i;
104105
105
106   fd800.machine = machine;
106107   fd800.interrupt_callback = interrupt_callback;
107108
108109   fd800.stat_reg = 0;
src/mess/machine/990_dk.h
r3909r3910
44
55FLOPPY_OPTIONS_EXTERN(fd800);
66
7void fd800_machine_init(void (*interrupt_callback)(int state));
7void fd800_machine_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state));
88
99extern  READ8_HANDLER(fd800_cru_r);
1010extern WRITE8_HANDLER(fd800_cru_w);
src/mess/machine/99_peb.c
r3909r3910
101101*/
102102
103103#include "driver.h"
104#include "deprecat.h"
105104#include "99_peb.h"
106105
107106/* TRUE if we are using the snug sgcpu 99/4p 16-bit extensions */
r3909r3910
281280      bit of the ILA register)
282281   state: 1 to assert bit, 0 to clear
283282*/
284void ti99_peb_set_ila_bit(int bit, int state)
283void ti99_peb_set_ila_bit(running_machine *machine, int bit, int state)
285284{
286285   if (state)
287286   {
288287      ila |= 1 << bit;
289288      if (inta_callback)
290         (*inta_callback)(Machine, 1);
289         (*inta_callback)(machine, 1);
291290   }
292291   else
293292   {
294293      ila &= ~(1 << bit);
295294      if ((! ila) && inta_callback)
296         (*inta_callback)(Machine, 0);
295         (*inta_callback)(machine, 0);
297296   }
298297}
299298
r3909r3910
306305      bit of the ILB register)
307306   state: 1 to assert bit, 0 to clear
308307*/
309void ti99_peb_set_ilb_bit(int bit, int state)
308void ti99_peb_set_ilb_bit(running_machine *machine, int bit, int state)
310309{
311310   if (state)
312311   {
313312      ilb |= 1 << bit;
314313      if (intb_callback)
315         (*intb_callback)(Machine, 1);
314         (*intb_callback)(machine, 1);
316315   }
317316   else
318317   {
319318      ilb &= ~(1 << bit);
320319      if ((! ilb) && intb_callback)
321         (*intb_callback)(Machine, 0);
320         (*intb_callback)(machine, 0);
322321   }
323322}
324323
src/mess/machine/99_peb.h
r3909r3910
5858
5959void ti99_peb_set_card_handlers(int cru_base, const ti99_peb_card_handlers_t *handler);
6060void ti99_peb_set_16bit_card_handlers(int cru_base, const ti99_peb_16bit_card_handlers_t *handler);
61void ti99_peb_set_ila_bit(int bit, int state);
62void ti99_peb_set_ilb_bit(int bit, int state);
61void ti99_peb_set_ila_bit(running_machine *machine, int bit, int state);
62void ti99_peb_set_ilb_bit(running_machine *machine, int bit, int state);
6363
6464 READ8_HANDLER ( ti99_4x_peb_cru_r );
6565WRITE8_HANDLER ( ti99_4x_peb_cru_w );
src/mess/machine/994x_ser.c
r3909r3910
184184*/
185185static TMS9902_INT_CALLBACK( int_callback_0 )
186186{
187   ti99_peb_set_ila_bit(inta_rs232_1_bit, INT);
187   ti99_peb_set_ila_bit(device->machine, inta_rs232_1_bit, INT);
188188}
189189
190190static TMS9902_INT_CALLBACK( int_callback_1 )
191191{
192   ti99_peb_set_ila_bit(inta_rs232_2_bit, INT);
192   ti99_peb_set_ila_bit(device->machine, inta_rs232_2_bit, INT);
193193}
194194
195195static TMS9902_XMIT_CALLBACK( xmit_callback_0 )
src/mess/machine/990_tap.c
r3909r3910
3333#include "990_tap.h"
3434#include "image.h"
3535
36static void update_interrupt(void);
36static void update_interrupt(running_machine *machine);
3737
3838#define MAX_TAPE_UNIT 4
3939
r3909r3910
4949{
5050   UINT16 w[8];
5151
52   void (*interrupt_callback)(int state);
52   void (*interrupt_callback)(running_machine *machine, int state);
5353
5454   tape_unit_t t[MAX_TAPE_UNIT];
5555} tpc_t;
r3909r3910
171171/*
172172   Init the tape controller core
173173*/
174void ti990_tpc_init(void (*interrupt_callback)(int state))
174void ti990_tpc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state))
175175{
176176   memset(tpc.w, 0, sizeof(tpc.w));
177177   /* The PE bit is always set for the MT3200 (but not MT1600) */
r3909r3910
180180
181181   tpc.interrupt_callback = interrupt_callback;
182182
183   update_interrupt();
183   update_interrupt(machine);
184184}
185185
186186/*
r3909r3910
212212/*
213213   Update interrupt state
214214*/
215static void update_interrupt(void)
215static void update_interrupt(running_machine *machine)
216216{
217217   if (tpc.interrupt_callback)
218      (*tpc.interrupt_callback)((tpc.w[7] & w7_idle)
218      (*tpc.interrupt_callback)(machine, (tpc.w[7] & w7_idle)
219219                           && (((tpc.w[7] & w7_int_enable) && (tpc.w[7] & (w7_complete | w7_error)))
220220                              || ((tpc.w[0] & ~(tpc.w[0] >> 4)) & w0_rewind_mask)));
221221}
r3909r3910
244244   {
245245      /* No idea what to report... */
246246      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
247      update_interrupt();
247      update_interrupt(machine);
248248      return;
249249   }
250250   else if (! image_exists(tpc.t[tap_sel].img))
251251   {   /* offline */
252252      tpc.w[0] |= w0_offline;
253253      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
254      update_interrupt();
254      update_interrupt(machine);
255255      return;
256256   }
257257#if 0
r3909r3910
259259   {   /* rewind in progress */
260260      tpc.w[0] |= 0x80 >> tap_sel;
261261      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
262      update_interrupt();
262      update_interrupt(machine);
263263      return;
264264   }
265265#endif
r3909r3910
278278         tpc.t[tap_sel].eot = 1;
279279         tpc.w[0] |= w0_EOT;   /* or should it be w0_command_timeout? */
280280         tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
281         update_interrupt();
281         update_interrupt(machine);
282282         goto update_registers;
283283      }
284284      else
r3909r3910
289289         image_unload(tpc.t[tap_sel].img);
290290         tpc.w[0] |= w0_offline;
291291         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
292         update_interrupt();
292         update_interrupt(machine);
293293         goto update_registers;
294294      }
295295   }
r3909r3910
302302      image_unload(tpc.t[tap_sel].img);
303303      tpc.w[0] |= w0_offline;
304304      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
305      update_interrupt();
305      update_interrupt(machine);
306306      goto update_registers;
307307   }
308308
r3909r3910
312312      logerror("read binary forward: found EOF, requested %d\n", char_count);
313313      tpc.w[0] |= w0_EOF;
314314      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
315      update_interrupt();
315      update_interrupt(machine);
316316      goto update_registers;
317317   }
318318
r3909r3910
329329      image_unload(tpc.t[tap_sel].img);
330330      tpc.w[0] |= w0_offline;
331331      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
332      update_interrupt();
332      update_interrupt(machine);
333333      goto update_registers;
334334   }
335335
r3909r3910
339339   {
340340      tpc.w[0] |= w0_EOR;
341341      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
342      update_interrupt();
342      update_interrupt(machine);
343343      goto skip_trailer;
344344   }
345345
r3909r3910
373373         image_unload(tpc.t[tap_sel].img);
374374         tpc.w[0] |= w0_offline;
375375         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
376         update_interrupt();
376         update_interrupt(machine);
377377         goto update_registers;
378378      }
379379   }
r3909r3910
382382   {
383383      tpc.w[0] |= w0_EOR;
384384      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
385      update_interrupt();
385      update_interrupt(machine);
386386      goto skip_trailer;
387387   }
388388
r3909r3910
394394         image_unload(tpc.t[tap_sel].img);
395395         tpc.w[0] |= w0_offline;
396396         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
397         update_interrupt();
397         update_interrupt(machine);
398398         goto update_registers;
399399      }
400400   }
r3909r3910
406406      image_unload(tpc.t[tap_sel].img);
407407      tpc.w[0] |= w0_offline;
408408      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
409      update_interrupt();
409      update_interrupt(machine);
410410      goto update_registers;
411411   }
412412
r3909r3910
416416      image_unload(tpc.t[tap_sel].img);
417417      tpc.w[0] |= w0_offline;
418418      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
419      update_interrupt();
419      update_interrupt(machine);
420420      goto update_registers;
421421   }
422422   if (buffer[2] || buffer[3])
r3909r3910
427427      image_unload(tpc.t[tap_sel].img);
428428      tpc.w[0] |= w0_offline;
429429      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
430      update_interrupt();
430      update_interrupt(machine);
431431      goto update_registers;
432432   }
433433
434434   if (! (tpc.w[7] & w7_error))
435435   {
436436      tpc.w[7] |= w7_idle | w7_complete;
437      update_interrupt();
437      update_interrupt(machine);
438438   }
439439
440440update_registers:
r3909r3910
449449/*
450450   Handle the record skip forward command: skip a specified number of records.
451451*/
452static void cmd_record_skip_forward(void)
452static void cmd_record_skip_forward(running_machine *machine)
453453{
454454   UINT8 buffer[4];
455455   int reclen;
r3909r3910
463463   {
464464      /* No idea what to report... */
465465      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
466      update_interrupt();
466      update_interrupt(machine);
467467      return;
468468   }
469469   else if (! image_exists(tpc.t[tap_sel].img))
470470   {   /* offline */
471471      tpc.w[0] |= w0_offline;
472472      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
473      update_interrupt();
473      update_interrupt(machine);
474474      return;
475475   }
476476#if 0
r3909r3910
478478   {   /* rewind in progress */
479479      tpc.w[0] |= 0x80 >> tap_sel;
480480      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
481      update_interrupt();
481      update_interrupt(machine);
482482      return;
483483   }
484484#endif
r3909r3910
498498            tpc.t[tap_sel].eot = 1;
499499            tpc.w[0] |= w0_EOT;   /* or should it be w0_command_timeout? */
500500            tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
501            update_interrupt();
501            update_interrupt(machine);
502502            goto update_registers;
503503         }
504504         else
r3909r3910
508508            image_unload(tpc.t[tap_sel].img);
509509            tpc.w[0] |= w0_offline;
510510            tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
511            update_interrupt();
511            update_interrupt(machine);
512512            goto update_registers;
513513         }
514514      }
r3909r3910
520520         image_unload(tpc.t[tap_sel].img);
521521         tpc.w[0] |= w0_offline;
522522         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
523         update_interrupt();
523         update_interrupt(machine);
524524         goto update_registers;
525525      }
526526
r3909r3910
530530         logerror("record skip forward: found EOF\n");
531531         tpc.w[0] |= w0_EOF;
532532         tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
533         update_interrupt();
533         update_interrupt(machine);
534534         goto update_registers;
535535      }
536536
r3909r3910
540540         image_unload(tpc.t[tap_sel].img);
541541         tpc.w[0] |= w0_offline;
542542         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
543         update_interrupt();
543         update_interrupt(machine);
544544         goto update_registers;
545545      }
546546
r3909r3910
549549         image_unload(tpc.t[tap_sel].img);
550550         tpc.w[0] |= w0_offline;
551551         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
552         update_interrupt();
552         update_interrupt(machine);
553553         goto update_registers;
554554      }
555555
r3909r3910
558558         image_unload(tpc.t[tap_sel].img);
559559         tpc.w[0] |= w0_offline;
560560         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
561         update_interrupt();
561         update_interrupt(machine);
562562         goto update_registers;
563563      }
564564      if (buffer[2] || buffer[3])
r3909r3910
568568         image_unload(tpc.t[tap_sel].img);
569569         tpc.w[0] |= w0_offline;
570570         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
571         update_interrupt();
571         update_interrupt(machine);
572572         goto update_registers;
573573      }
574574
r3909r3910
576576   }
577577
578578   tpc.w[7] |= w7_idle | w7_complete;
579   update_interrupt();
579   update_interrupt(machine);
580580
581581update_registers:
582582   tpc.w[4] = record_count;
r3909r3910
585585/*
586586   Handle the record skip reverse command: skip a specified number of records backwards.
587587*/
588static void cmd_record_skip_reverse(void)
588static void cmd_record_skip_reverse(running_machine *machine)
589589{
590590   UINT8 buffer[4];
591591   int reclen;
r3909r3910
600600   {
601601      /* No idea what to report... */
602602      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
603      update_interrupt();
603      update_interrupt(machine);
604604      return;
605605   }
606606   else if (! image_exists(tpc.t[tap_sel].img))
607607   {   /* offline */
608608      tpc.w[0] |= w0_offline;
609609      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
610      update_interrupt();
610      update_interrupt(machine);
611611      return;
612612   }
613613#if 0
r3909r3910
615615   {   /* rewind in progress */
616616      tpc.w[0] |= 0x80 >> tap_sel;
617617      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
618      update_interrupt();
618      update_interrupt(machine);
619619      return;
620620   }
621621#endif
r3909r3910
632632         tpc.t[tap_sel].bot = 1;
633633         tpc.w[0] |= w0_BOT;
634634         tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
635         update_interrupt();
635         update_interrupt(machine);
636636         goto update_registers;
637637      }
638638      if (image_fseek(tpc.t[tap_sel].img, -4, SEEK_CUR))
r3909r3910
640640         image_unload(tpc.t[tap_sel].img);
641641         tpc.w[0] |= w0_offline;
642642         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
643         update_interrupt();
643         update_interrupt(machine);
644644         goto update_registers;
645645      }
646646      bytes_read = image_fread(tpc.t[tap_sel].img, buffer, 4);
r3909r3910
652652         image_unload(tpc.t[tap_sel].img);
653653         tpc.w[0] |= w0_offline;
654654         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
655         update_interrupt();
655         update_interrupt(machine);
656656         goto update_registers;
657657      }
658658      reclen = (((int) buffer[1]) << 8) | buffer[0];
r3909r3910
663663         image_unload(tpc.t[tap_sel].img);
664664         tpc.w[0] |= w0_offline;
665665         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
666         update_interrupt();
666         update_interrupt(machine);
667667         goto update_registers;
668668      }
669669
r3909r3910
676676            image_unload(tpc.t[tap_sel].img);
677677            tpc.w[0] |= w0_offline;
678678            tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
679            update_interrupt();
679            update_interrupt(machine);
680680            goto update_registers;
681681         }
682682         tpc.w[0] |= w0_EOF;
683683         tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
684         update_interrupt();
684         update_interrupt(machine);
685685         goto update_registers;
686686      }
687687
r3909r3910
690690         image_unload(tpc.t[tap_sel].img);
691691         tpc.w[0] |= w0_offline;
692692         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
693         update_interrupt();
693         update_interrupt(machine);
694694         goto update_registers;
695695      }
696696
r3909r3910
699699         image_unload(tpc.t[tap_sel].img);
700700         tpc.w[0] |= w0_offline;
701701         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
702         update_interrupt();
702         update_interrupt(machine);
703703         goto update_registers;
704704      }
705705      if (reclen != ((((int) buffer[1]) << 8) | buffer[0]))
r3909r3910
707707         image_unload(tpc.t[tap_sel].img);
708708         tpc.w[0] |= w0_offline;
709709         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
710         update_interrupt();
710         update_interrupt(machine);
711711         goto update_registers;
712712      }
713713      if (buffer[2] || buffer[3])
r3909r3910
717717         image_unload(tpc.t[tap_sel].img);
718718         tpc.w[0] |= w0_offline;
719719         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
720         update_interrupt();
720         update_interrupt(machine);
721721         goto update_registers;
722722      }
723723
r3909r3910
726726         image_unload(tpc.t[tap_sel].img);
727727         tpc.w[0] |= w0_offline;
728728         tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
729         update_interrupt();
729         update_interrupt(machine);
730730         goto update_registers;
731731      }
732732
r3909r3910
734734   }
735735
736736   tpc.w[7] |= w7_idle | w7_complete;
737   update_interrupt();
737   update_interrupt(machine);
738738
739739update_registers:
740740   tpc.w[4] = record_count;
r3909r3910
743743/*
744744   Handle the rewind command: rewind to BOT.
745745*/
746static void cmd_rewind(void)
746static void cmd_rewind(running_machine *machine)
747747{
748748   int tap_sel = cur_tape_unit();
749749
r3909r3910
751751   {
752752      /* No idea what to report... */
753753      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
754      update_interrupt();
754      update_interrupt(machine);
755755      return;
756756   }
757757   else if (! image_exists(tpc.t[tap_sel].img))
758758   {   /* offline */
759759      tpc.w[0] |= w0_offline;
760760      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
761      update_interrupt();
761      update_interrupt(machine);
762762      return;
763763   }
764764#if 0
r3909r3910
766766   {   /* rewind in progress */
767767      tpc.w[0] |= 0x80 >> tap_sel;
768768      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
769      update_interrupt();
769      update_interrupt(machine);
770770      return;
771771   }
772772#endif
r3909r3910
778778      image_unload(tpc.t[tap_sel].img);
779779      tpc.w[0] |= w0_offline;
780780      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
781      update_interrupt();
781      update_interrupt(machine);
782782      return;
783783   }
784784   tpc.t[tap_sel].bot = 1;
785785
786786   tpc.w[7] |= w7_idle | w7_complete;
787   update_interrupt();
787   update_interrupt(machine);
788788}
789789
790790/*
791791   Handle the rewind and offline command: disable the tape unit.
792792*/
793static void cmd_rewind_and_offline(void)
793static void cmd_rewind_and_offline(running_machine *machine)
794794{
795795   int tap_sel = cur_tape_unit();
796796
r3909r3910
798798   {
799799      /* No idea what to report... */
800800      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
801      update_interrupt();
801      update_interrupt(machine);
802802      return;
803803   }
804804   else if (! image_exists(tpc.t[tap_sel].img))
805805   {   /* offline */
806806      tpc.w[0] |= w0_offline;
807807      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
808      update_interrupt();
808      update_interrupt(machine);
809809      return;
810810   }
811811#if 0
r3909r3910
813813   {   /* rewind in progress */
814814      tpc.w[0] |= 0x80 >> tap_sel;
815815      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
816      update_interrupt();
816      update_interrupt(machine);
817817      return;
818818   }
819819#endif
r3909r3910
822822   image_unload(tpc.t[tap_sel].img);
823823
824824   tpc.w[7] |= w7_idle | w7_complete;
825   update_interrupt();
825   update_interrupt(machine);
826826}
827827
828828/*
829829   Handle the read transport status command: return the current tape status.
830830*/
831static void read_transport_status(void)
831static void read_transport_status(running_machine *machine)
832832{
833833   int tap_sel = cur_tape_unit();
834834
r3909r3910
836836   {
837837      /* No idea what to report... */
838838      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
839      update_interrupt();
839      update_interrupt(machine);
840840   }
841841   else if (! image_exists(tpc.t[tap_sel].img))
842842   {   /* offline */
843843      tpc.w[0] |= w0_offline;
844844      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
845      update_interrupt();
845      update_interrupt(machine);
846846   }
847847#if 0
848848   else if (0)
849849   {   /* rewind in progress */
850850      tpc.w[0] |= /*...*/;
851851      tpc.w[7] |= w7_idle | w7_error | w7_tape_error;
852      update_interrupt();
852      update_interrupt(machine);
853853   }
854854#endif
855855   else
r3909r3910
861861      if (tpc.t[tap_sel].wp)
862862         tpc.w[0] |= w0_write_ring;
863863      tpc.w[7] |= w7_idle | w7_complete;
864      update_interrupt();
864      update_interrupt(machine);
865865   }
866866}
867867
r3909r3910
881881      /* NOP */
882882      logerror("NOP\n");
883883      tpc.w[7] |= w7_idle | w7_complete;
884      update_interrupt();
884      update_interrupt(machine);
885885      break;
886886   case 0x01:
887887      /* buffer sync: means nothing under emulation */
888888      logerror("buffer sync\n");
889889      tpc.w[7] |= w7_idle | w7_complete;
890      update_interrupt();
890      update_interrupt(machine);
891891      break;
892892   case 0x02:
893893      /* write EOF - not emulated */
894894      logerror("write EOF\n");
895895      /* ... */
896896      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
897      update_interrupt();
897      update_interrupt(machine);
898898      break;
899899   case 0x03:
900900      /* record skip reverse - not fully tested */
901901      logerror("record skip reverse\n");
902      cmd_record_skip_reverse();
902      cmd_record_skip_reverse(machine);
903903      break;
904904   case 0x04:
905905      /* read binary forward */
r3909r3910
909909   case 0x05:
910910      /* record skip forward - not tested */
911911      logerror("record skip forward\n");
912      cmd_record_skip_forward();
912      cmd_record_skip_forward(machine);
913913      break;
914914   case 0x06:
915915      /* write binary forward - not emulated */
916916      logerror("write binary forward\n");
917917      /* ... */
918918      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
919      update_interrupt();
919      update_interrupt(machine);
920920      break;
921921   case 0x07:
922922      /* erase - not emulated */
923923      logerror("erase\n");
924924      /* ... */
925925      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
926      update_interrupt();
926      update_interrupt(machine);
927927      break;
928928   case 0x08:
929929   case 0x09:
930930      /* read transport status */
931931      logerror("read transport status\n");
932      read_transport_status();
932      read_transport_status(machine);
933933      break;
934934   case 0x0A:
935935      /* rewind - not tested */
936936      logerror("rewind\n");
937      cmd_rewind();
937      cmd_rewind(machine);
938938      break;
939939   case 0x0B:
940940      /* rewind and offline - not tested */
941941      logerror("rewind and offline\n");
942      cmd_rewind_and_offline();
942      cmd_rewind_and_offline(machine);
943943      break;
944944   case 0x0F:
945945      /* extended control and status - not emulated */
946946      logerror("extended control and status\n");
947947      /* ... */
948948      tpc.w[7] |= w7_idle | w7_error | w7_hard_error;
949      update_interrupt();
949      update_interrupt(machine);
950950      break;
951951   }
952952}
r3909r3910
979979         tpc.w[offset] = (tpc.w[offset] & ((~w_mask[offset]) | mem_mask)) | (data & w_mask[offset] & ~mem_mask);
980980
981981         if ((offset == 0) || (offset == 7))
982            update_interrupt();
982            update_interrupt(space->machine);
983983
984984         if ((offset == 7) && (old_data & w7_idle) && ! (data & w7_idle))
985985         {   /* idle has been cleared: start command execution */
src/mess/machine/990_tap.h
r3909r3910
66DEVICE_IMAGE_LOAD( ti990_tape );
77DEVICE_IMAGE_UNLOAD( ti990_tape );
88
9void ti990_tpc_init(void (*interrupt_callback)(int state));
9void ti990_tpc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state));
1010
1111extern READ16_HANDLER(ti990_tpc_r);
1212extern WRITE16_HANDLER(ti990_tpc_w);
src/mess/machine/99_ide.c
r3909r3910
1818*/
1919
2020#include "driver.h"
21#include "deprecat.h"
2122#include "machine/idectrl.h"
2223#include "machine/rtc65271.h"
2324#include "ti99_4x.h"
r3909r3910
7576
7677   IDE interrupt callback
7778*/
78void ti99_ide_interrupt(int state)
79void ti99_ide_interrupt(running_machine *machine, int state)
7980{
8081   ide_irq = state;
8182   if (cru_register & cru_reg_int_en)
82      ti99_peb_set_ila_bit(inta_ide_bit, state);
83      ti99_peb_set_ila_bit(machine, inta_ide_bit, state);
8384}
8485
8586/*
r3909r3910
9091static void clk_interrupt_callback(int state)
9192{
9293   clk_irq = state;
93   ti99_peb_set_ila_bit(inta_ide_clk_bit, state);
94   ti99_peb_set_ila_bit(Machine, inta_ide_clk_bit, state);
9495}
9596
9697/*
r3909r3910
209210         cru_register &= ~ (1 << offset);
210211
211212      if (offset == 6)
212         ti99_peb_set_ila_bit(inta_ide_bit, (cru_register & cru_reg_int_en) && ide_irq);
213         ti99_peb_set_ila_bit(machine, inta_ide_bit, (cru_register & cru_reg_int_en) && ide_irq);
213214
214215      if ((offset == 6) || (offset == 7))
215216         if ((cru_register & cru_reg_int_en) && !(cru_register & cru_reg_reset))
src/mess/machine/99_ide.h
r3909r3910
44void ti99_ide_init(running_machine *machine);
55void ti99_ide_reset(running_machine *machine, int in_tms9995_mode);
66
7void ti99_ide_interrupt(int state);
7void ti99_ide_interrupt(running_machine *machine, int state);
src/mess/drivers/ti990_4.c
r3909r3910
5353   ti990_reset_int();
5454
5555#if !VIDEO_911
56   asr733_reset(0);
56   asr733_reset(machine, 0);
5757#endif
5858
59   fd800_machine_init(ti990_set_int7);
59   fd800_machine_init(machine, ti990_set_int7);
6060}
6161
6262
r3909r3910
6868   asr733_keyboard(device->machine, 0);
6969#endif
7070
71   ti990_line_interrupt();
71   ti990_line_interrupt(device->machine);
7272}
7373
7474/*static void idle_callback(int state)
src/mess/drivers/ti990_10.c
r3909r3910
8787
8888   ti990_reset_int();
8989
90   ti990_tpc_init(ti990_set_int9);
90   ti990_tpc_init(machine, ti990_set_int9);
9191   ti990_hdc_init(machine, ti990_set_int13);
9292}
9393
r3909r3910
9595{
9696   vdt911_keyboard(device->machine, 0);
9797
98   ti990_line_interrupt();
98   ti990_line_interrupt(device->machine);
9999}
100100
101101/*static void idle_callback(int state)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team