Previous 15994 Revisions Next

r4575 Monday 27th April, 2009 at 15:00:11 UTC by Fabio Priuli
Again, number-to-tag conversions in CPU calls
[src/mess/drivers]dc.c einstein.c enterp.c ex800.c exelv.c
[src/mess/machine]dai.c dgn_beta.c electron.c europc.c
[src/mess/video]dai.c dgn_beta.c

src/mess/video/dgn_beta.c
r4574r4575
229229                 data & GCtrlHiLo      ? "Hi" : "Lo",
230230                 data & GCtrlSWChar      ? "C0" : "C1",
231231                 data & GCtrlWI      ? "Wi" : "  ",
232                 cpu_get_pc( machine->cpu[0] ));
232                 cpu_get_pc(cputag_get_cpu(machine,"maincpu")));
233233}
234234
235235// called when the 6845 changes the character row
src/mess/video/dai.c
r4574r4575
4646{
4747   int i;
4848
49   for ( i = 0; i < sizeof(dai_palette) / 3; i++ ) {
50      palette_set_color_rgb(machine, i, dai_palette[i*3], dai_palette[i*3+1], dai_palette[i*3+2]);
49   for ( i = 0; i < sizeof(dai_palette) / 3; i++ )
50   {
51      palette_set_color_rgb(machine, i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]);
5152   }
5253}
5354
r4574r4575
5859
5960VIDEO_UPDATE( dai )
6061{
61   const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
62   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
6263   int i, j, k, l;
6364
6465   UINT8* char_rom = memory_region(screen->machine, "gfx1");
src/mess/machine/dgn_beta.c
r4574r4575
268268
269269static void UpdateBanks(running_machine *machine, int first, int last)
270270{
271   const address_space *space_0 = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
272   const address_space *space_1 = cpu_get_address_space( machine->cpu[1], ADDRESS_SPACE_PROGRAM );
271   const address_space *space_0 = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
272   const address_space *space_1 = cputag_get_address_space(machine, "dma", ADDRESS_SPACE_PROGRAM);
273273   int      Page;
274274   UINT8       *readbank;
275275   write8_space_func    writebank;
r4574r4575
695695   const device_config *fdc = devtag_get_device(device->machine, "wd179x");
696696   
697697   /* Only play with halt line if halt bit changed since last write */
698   if((data & 0x80)!=d_pia1_pa_last)
698   if((data & 0x80) != d_pia1_pa_last)
699699   {
700700      /* Bit 7 of $FF24, seems to control HALT on second CPU (through an inverter) */
701701      if(data & 0x80)
702         HALT_DMA=ASSERT_LINE;
702         HALT_DMA = ASSERT_LINE;
703703      else
704         HALT_DMA=CLEAR_LINE;
704         HALT_DMA = CLEAR_LINE;
705705
706      LOG_HALT(("DMA_CPU HALT=%d\n",HALT_DMA));
707      cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_HALT, HALT_DMA);
706      LOG_HALT(("DMA_CPU HALT=%d\n", HALT_DMA));
707      cputag_set_input_line(device->machine, "dma", INPUT_LINE_HALT, HALT_DMA);
708708
709709      /* CPU un-halted let it run ! */
710      if (HALT_DMA==CLEAR_LINE)
711         cpu_yield(device->machine->cpu[0]);
710      if (HALT_DMA == CLEAR_LINE)
711         cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
712712
713      d_pia1_pa_last=data & 0x80;
713      d_pia1_pa_last = data & 0x80;
714714   }
715715
716716   /* Drive selects are binary encoded on PA0 & PA1 */
717   wd17xx_set_drive(fdc,~data & DSMask);
717   wd17xx_set_drive(fdc, ~data & DSMask);
718718
719719   /* Set density of WD2797 */
720720   if (data & DDenCtrl)
721721   {
722      wd17xx_set_density(fdc,DEN_FM_LO);
723      LOG_DISK(("Set density low %d\n",(data & DDenCtrl)));
722      wd17xx_set_density(fdc, DEN_FM_LO);
723      LOG_DISK(("Set density low %d\n", (data & DDenCtrl)));
724724   }
725725   else
726726   {
727      wd17xx_set_density(fdc,DEN_MFM_LO);
728      LOG_DISK(("Set density high %d\n",(data & DDenCtrl)));
727      wd17xx_set_density(fdc, DEN_MFM_LO);
728      LOG_DISK(("Set density high %d\n", (data & DDenCtrl)));
729729   }
730730}
731731
r4574r4575
739739   int   HALT_CPU;
740740
741741   /* Only play with halt line if halt bit changed since last write */
742   if((data & 0x02)!=d_pia1_pb_last)
742   if((data & 0x02) != d_pia1_pb_last)
743743   {
744744      /* Bit 1 of $FF26, seems to control HALT on primary CPU */
745745      if(data & 0x02)
746         HALT_CPU=CLEAR_LINE;
746         HALT_CPU = CLEAR_LINE;
747747      else
748         HALT_CPU=ASSERT_LINE;
749      LOG_HALT(("MAIN_CPU HALT=%d\n",HALT_CPU));
750      cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_HALT, HALT_CPU);
748         HALT_CPU = ASSERT_LINE;
749      LOG_HALT(("MAIN_CPU HALT=%d\n", HALT_CPU));
750      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_HALT, HALT_CPU);
751751
752      d_pia1_pb_last=data & 0x02;
752      d_pia1_pb_last = data & 0x02;
753753
754754      /* CPU un-halted let it run ! */
755      if (HALT_CPU==CLEAR_LINE)
756         cpu_yield(device->machine->cpu[1]);
755      if (HALT_CPU == CLEAR_LINE)
756         cpu_yield(cputag_get_cpu(device->machine, "dma"));
757757   }
758758}
759759
r4574r4575
787787   int OldEnableMap;
788788   int NMI;
789789
790   LOG_TASK(("FCC0 write : $%02X\n",data));
790   LOG_TASK(("FCC0 write : $%02X\n", data));
791791
792792   /* Bit 7 of $FFC0, seems to control NMI on second CPU */
793793   NMI=(data & 0x80);
794794
795795   /* only take action if NMI changed */
796   if(NMI!=DMA_NMI_LAST)
796   if(NMI != DMA_NMI_LAST)
797797   {
798      LOG_INTS(("cpu1 NMI : %d\n",NMI));
798      LOG_INTS(("cpu1 NMI : %d\n", NMI));
799799      if(!NMI)
800800      {
801         cpu_set_input_line(device->machine->cpu[1],INPUT_LINE_NMI,ASSERT_LINE);
801         cputag_set_input_line(device->machine, "dma", INPUT_LINE_NMI, ASSERT_LINE);
802802         logerror("cpu_yield()\n");
803         cpu_yield(device->machine->cpu[1]);   /* Let DMA CPU run */
803         cpu_yield(cputag_get_cpu(device->machine, "dma"));   /* Let DMA CPU run */
804804      }
805805      else
806806      {
807         cpu_set_input_line(device->machine->cpu[1],INPUT_LINE_NMI,CLEAR_LINE);
807         cputag_set_input_line(device->machine, "dma", INPUT_LINE_NMI, CLEAR_LINE);
808808      }
809809
810      DMA_NMI_LAST=NMI;   /* Save it for next time */
810      DMA_NMI_LAST = NMI;   /* Save it for next time */
811811   }
812812
813   OldEnableMap=EnableMapRegs;
813   OldEnableMap = EnableMapRegs;
814814   /* Bit 6 seems to enable memory paging */
815815   if(data & 0x40)
816      EnableMapRegs=0;
816      EnableMapRegs = 0;
817817   else
818      EnableMapRegs=1;
818      EnableMapRegs = 1;
819819
820820   /* Bits 0..3 seem to control which task register is selected */
821   OldTask=PIATaskReg;
822   PIATaskReg=data & 0x0F;
821   OldTask = PIATaskReg;
822   PIATaskReg = data & 0x0F;
823823
824   LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n",OldTask,EnableMapRegs,OldEnableMap));
824   LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n", OldTask, EnableMapRegs, OldEnableMap));
825825
826826   // Maping was enabled or disabled, select apropreate task reg
827827   // and map it in
828   if (EnableMapRegs!=OldEnableMap)
828   if (EnableMapRegs != OldEnableMap)
829829   {
830830      if(EnableMapRegs)
831831      {
832         TaskReg=PIATaskReg;
832         TaskReg = PIATaskReg;
833833      }
834834      else
835835      {
836         TaskReg=NoPagingTask;
836         TaskReg = NoPagingTask;
837837      }
838      UpdateBanks(device->machine, 0,IOPage+1);
838      UpdateBanks(device->machine, 0, IOPage + 1);
839839   }
840840   else
841841   {
842842      // Update ram banks only if task reg changed and mapping enabled
843      if ((PIATaskReg!=OldTask) && (EnableMapRegs))
843      if ((PIATaskReg != OldTask) && (EnableMapRegs))
844844      {
845         TaskReg=PIATaskReg;
846         UpdateBanks(device->machine, 0,IOPage+1);
845         TaskReg = PIATaskReg;
846         UpdateBanks(device->machine, 0, IOPage + 1);
847847      }
848848   }
849   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg));
849   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", TaskReg, PIATaskReg));
850850}
851851
852852static READ8_DEVICE_HANDLER(d_pia2_pb_r)
r4574r4575
862862
863863static WRITE_LINE_DEVICE_HANDLER( d_pia2_irq_a )
864864{
865   logerror("PIA2 IRQ1 state=%02X\n",state);
865   logerror("PIA2 IRQ1 state=%02X\n", state);
866866   cpu0_recalc_irq(device->machine, state);
867867}
868868
r4574r4575
891891   else
892892      IRQ = CLEAR_LINE;
893893
894   cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, IRQ);
895   LOG_INTS(("cpu0 IRQ : %d\n",IRQ));
894   cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, IRQ);
895   LOG_INTS(("cpu0 IRQ : %d\n", IRQ));
896896}
897897
898898static void cpu0_recalc_firq(running_machine *machine, int state)
r4574r4575
906906   else
907907      FIRQ = CLEAR_LINE;
908908
909   cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, FIRQ);
909   cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, FIRQ);
910910
911   LOG_INTS(("cpu0 FIRQ : %d\n",FIRQ));
911   LOG_INTS(("cpu0 FIRQ : %d\n", FIRQ));
912912}
913913
914914/* CPU 1 */
915915
916916static void cpu1_recalc_firq(running_machine *machine, int state)
917917{
918   cpu_set_input_line(machine->cpu[1], M6809_FIRQ_LINE, state);
918   cputag_set_input_line(machine, "dma", M6809_FIRQ_LINE, state);
919919   LOG_INTS(("cpu1 FIRQ : %d\n",state));
920920}
921921
r4574r4575
10801080   system_rom = memory_region(machine, "maincpu");
10811081
10821082   /* Make sure CPU 1 is started out halted ! */
1083   cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
1083   cputag_set_input_line(machine, "dma", INPUT_LINE_HALT, ASSERT_LINE);
10841084
10851085   /* Reset to task 0, and map banks disabled, so standard memory map */
10861086   /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */
10871087   /* and ROM at $FF00-$FFFF */
1088   TaskReg=0;
1089   PIATaskReg=0;
1090   EnableMapRegs=0;
1091   memset(PageRegs,0,sizeof(PageRegs));   /* Reset page registers to 0 */
1088   TaskReg = 0;
1089   PIATaskReg = 0;
1090   EnableMapRegs = 0;
1091   memset(PageRegs, 0, sizeof(PageRegs));   /* Reset page registers to 0 */
10921092   SetDefaultTask(machine);
10931093
10941094   /* Set pullups on all PIA port A, to match what hardware does */
1095   pia6821_set_port_a_z_mask(pia_0,0xFF);
1096   pia6821_set_port_a_z_mask(pia_1,0xFF);
1097   pia6821_set_port_a_z_mask(pia_2,0xFF);
1095   pia6821_set_port_a_z_mask(pia_0, 0xFF);
1096   pia6821_set_port_a_z_mask(pia_1, 0xFF);
1097   pia6821_set_port_a_z_mask(pia_2, 0xFF);
10981098
1099   d_pia1_pa_last=0x00;
1100   d_pia1_pb_last=0x00;
1101   RowShifter=0x00;         /* shift register to select row */
1102   Keyrow=0x00;            /* Keyboard row being shifted out */
1103   d_pia0_pb_last=0x00;         /* Last byte output to pia0 port b */
1104   d_pia0_cb2_last=0x00;         /* Last state of CB2 */
1099   d_pia1_pa_last = 0x00;
1100   d_pia1_pb_last = 0x00;
1101   RowShifter = 0x00;         /* shift register to select row */
1102   Keyrow = 0x00;            /* Keyboard row being shifted out */
1103   d_pia0_pb_last = 0x00;      /* Last byte output to pia0 port b */
1104   d_pia0_cb2_last = 0x00;      /* Last state of CB2 */
11051105
1106   KInDat_next=0x00;         /* Next data bit to input */
1107   KAny_next=0x00;            /* Next value for KAny */
1106   KInDat_next = 0x00;         /* Next data bit to input */
1107   KAny_next = 0x00;         /* Next value for KAny */
11081108
1109   DMA_NMI_LAST=0x80;         /* start with DMA NMI inactive, as pulled up */
1110//   DMA_NMI=CLEAR_LINE;         /* start with DMA NMI inactive */
1109   DMA_NMI_LAST = 0x80;      /* start with DMA NMI inactive, as pulled up */
1110//   DMA_NMI = CLEAR_LINE;      /* start with DMA NMI inactive */
11111111
1112   wd17xx_set_density(fdc,DEN_MFM_LO);
1113   wd17xx_set_drive(fdc,0);
1112   wd17xx_set_density(fdc, DEN_MFM_LO);
1113   wd17xx_set_drive(fdc, 0);
11141114
1115   videoram=mess_ram;         /* Point video ram at the start of physical ram */
1115   videoram = mess_ram;      /* Point video ram at the start of physical ram */
11161116}
11171117
11181118
r4574r4575
11201120{
11211121   dgnbeta_init_video(machine);
11221122
1123   debug_cpu_set_dasm_override(machine->cpu[0],dgnbeta_dasm_override);
1123   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), dgnbeta_dasm_override);
11241124
11251125   add_reset_callback(machine, dgnbeta_reset);
11261126   dgnbeta_reset(machine);
src/mess/machine/dai.c
r4574r4575
4747
4848static TIMER_CALLBACK(dai_bootstrap_callback)
4949{
50   cpu_set_reg(machine->cpu[0], REG_GENPC, 0xc000);
50   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC, 0xc000);
5151}
5252
5353static UINT8 dai_keyboard_scan_mask = 0;
r4574r4575
7474static void dai_interrupt_callback(const device_config *device, int intreq, UINT8 vector)
7575{
7676   if (intreq)
77      cpu_set_input_line_and_vector(device->machine->cpu[0], 0, HOLD_LINE, vector);
77      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, HOLD_LINE, vector);
7878   else
79      cpu_set_input_line(device->machine->cpu[0], 0, CLEAR_LINE);
79      cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE);
8080}
8181
8282const tms5501_interface dai_tms5501_interface =
r4574r4575
248248
249249***************************************************************************/
250250
251 READ8_HANDLER( amd9511_r )
251READ8_HANDLER( amd9511_r )
252252{
253253   /* optional and no present at this moment */
254254   return 0xff;
src/mess/machine/europc.c
r4574r4575
7676   UINT8 data[16];
7777   UINT8 state;
7878   AGA_MODE mode;
79} europc_jim= { { 0 } } ;
79} europc_jim = { { 0 } } ;
8080
8181/*
8282  250..253 write only 00 be 00 10
r4574r4575
9696*/
9797WRITE8_HANDLER ( europc_jim_w )
9898{
99   switch (offset) {
99   switch (offset)
100   {
100101   case 2:
101      if (!(data&0x80)) {
102         switch (data) {
102      if (!(data & 0x80))
103      {
104         switch (data)
105         {
103106         case 0x1f:
104         case 0x0b: europc_jim.mode=AGA_MONO; break;
107         case 0x0b: europc_jim.mode = AGA_MONO; break;
105108         case 0xe: //80 columns?
106109         case 0xd: //40 columns?
107110         case 0x18:
108         case 0x1a: europc_jim.mode=AGA_COLOR; break;
109         default: europc_jim.mode=AGA_OFF; break;
111         case 0x1a: europc_jim.mode = AGA_COLOR; break;
112         default: europc_jim.mode = AGA_OFF; break;
110113         }
111114      }
112115//      mode= data&0x10?AGA_COLOR:AGA_MONO;
113116//      mode= data&0x10?AGA_COLOR:AGA_OFF;
114      pc_aga_set_mode(space->machine,europc_jim.mode);
115      if (data&0x80) europc_jim.state=0;
117      pc_aga_set_mode(space->machine, europc_jim.mode);
118      if (data & 0x80) europc_jim.state = 0;
116119      break;
117120   case 4:
118      switch(data&0xc0) {
119      case 0x00: cpu_set_clockscale(space->machine->cpu[0], 1.0/2);break;
120      case 0x40: cpu_set_clockscale(space->machine->cpu[0], 3.0/4);break;
121      default: cpu_set_clockscale(space->machine->cpu[0], 1);break;
121      switch(data & 0xc0)
122      {
123      case 0x00: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1.0 / 2); break;
124      case 0x40: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 3.0 / 4); break;
125      default: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1); break;
122126      }
123127      break;
124128   case 0xa:
125129      europc_rtc_w(space, 0, data);
126130      return;
127131   }
128   logerror("jim write %.2x %.2x\n",offset,data);
129   europc_jim.data[offset]=data;
132   logerror("jim write %.2x %.2x\n", offset, data);
133   europc_jim.data[offset] = data;
130134}
131135
132136READ8_HANDLER ( europc_jim_r )
133137{
134   int data=0;
135   switch(offset) {
136   case 4: case 5: case 6: case 7: data=europc_jim.data[offset];break;
137   case 0: case 1: case 2: case 3: data=0;break;
138   int data = 0;
139   switch(offset)
140   {
141   case 4: case 5: case 6: case 7: data = europc_jim.data[offset]; break;
142   case 0: case 1: case 2: case 3: data = 0; break;
138143   case 0xa: return europc_rtc_r(space, 0);
139144   }
140145   return data;
r4574r4575
142147
143148READ8_HANDLER ( europc_jim2_r )
144149{
145   switch (europc_jim.state) {
150   switch (europc_jim.state)
151   {
146152   case 0: europc_jim.state++; return 0;
147153   case 1: europc_jim.state++; return 0x80;
148154   case 2:
149      europc_jim.state=0;
150      switch (europc_jim.mode) {
155      europc_jim.state = 0;
156      switch (europc_jim.mode)
157      {
151158      case AGA_COLOR: return 0x87; // for color;
152159      case AGA_MONO: return 0x90; //for mono
153160      case AGA_OFF: return 0x80; // for vram
r4574r4575
165172
166173WRITE8_HANDLER( europc_pio_w )
167174{
168   switch (offset) {
175   switch (offset)
176   {
169177   case 1:
170178      europc_pio.port61=data;
171//      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
172//      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
179//      if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4;
180//      else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf;
173181      pit8253_gate_w(devtag_get_device(space->machine, "pit8253"), 2, BIT(data, 0));
174182      pc_speaker_set_spkrdata(space->machine, BIT(data, 1));
175183      pc_keyb_set_clock(BIT(data, 6));
176184      break;
177185   }
178186
179   logerror("europc pio write %.2x %.2x\n",offset,data);
187   logerror("europc pio write %.2x %.2x\n", offset, data);
180188}
181189
182190
183191 READ8_HANDLER( europc_pio_r )
184192{
185   int data=0;
186   switch (offset) {
193   int data = 0;
194   switch (offset)
195   {
187196   case 0:
188197      if (!(europc_pio.port61&0x80))
189198         data = pc_keyb_read();
190199      break;
191200   case 1:
192      data=europc_pio.port61;
201      data = europc_pio.port61;
193202      break;
194203   case 2:
195      if (pit8253_get_output(devtag_get_device(space->machine, "pit8253"),2)) data|=0x20;
204      if (pit8253_get_output(devtag_get_device(space->machine, "pit8253"), 2))
205         data |= 0x20;
196206      break;
197207   }
198208   return data;
r4574r4575
249259{
250260   int month, year;
251261   europc_rtc.data[0]=bcd_adjust(europc_rtc.data[0]+1);
252   if (europc_rtc.data[0]>=0x60) {
262   if (europc_rtc.data[0]>=0x60)
263   {
253264      europc_rtc.data[0]=0;
254265      europc_rtc.data[1]=bcd_adjust(europc_rtc.data[1]+1);
255      if (europc_rtc.data[1]>=0x60) {
266      if (europc_rtc.data[1]>=0x60)
267      {
256268         europc_rtc.data[1]=0;
257269         europc_rtc.data[2]=bcd_adjust(europc_rtc.data[2]+1);
258         if (europc_rtc.data[2]>=0x24) {
270         if (europc_rtc.data[2]>=0x24)
271         {
259272            europc_rtc.data[2]=0;
260273            europc_rtc.data[3]=bcd_adjust(europc_rtc.data[3]+1);
261274            month=bcd_2_dec(europc_rtc.data[4]);
262275            year=bcd_2_dec(europc_rtc.data[5])+2000; // save for julian_days_in_month_calculation
263            if (europc_rtc.data[3]> gregorian_days_in_month(month, year)) {
276            if (europc_rtc.data[3]> gregorian_days_in_month(month, year))
277            {
264278               europc_rtc.data[3]=1;
265279               europc_rtc.data[4]=bcd_adjust(europc_rtc.data[4]+1);
266               if (europc_rtc.data[4]>0x12) {
280               if (europc_rtc.data[4]>0x12)
281               {
267282                  europc_rtc.data[4]=1;
268283                  europc_rtc.data[5]=bcd_adjust(europc_rtc.data[5]+1)&0xff;
269284               }
r4574r4575
285300 READ8_HANDLER( europc_rtc_r )
286301{
287302   int data=0;
288   switch (europc_rtc.state) {
303   switch (europc_rtc.state)
304   {
289305   case 1:
290306      data=(europc_rtc.data[europc_rtc.reg]&0xf0)>>4;
291307      europc_rtc.state++;
r4574r4575
301317
302318WRITE8_HANDLER( europc_rtc_w )
303319{
304   switch (europc_rtc.state) {
320   switch (europc_rtc.state)
321   {
305322   case 0:
306323      europc_rtc.reg=data;
307324      europc_rtc.state=1;
src/mess/machine/electron.c
r4574r4575
1515ULA electron_ula;
1616static emu_timer *electron_tape_timer;
1717
18static const device_config *cassette_device_image( running_machine *machine ) {
18static const device_config *cassette_device_image( running_machine *machine )
19{
1920   return devtag_get_device(machine, "cassette");
2021}
2122
22static void electron_tape_start( void ) {
23   if ( electron_ula.tape_running ) {
23static void electron_tape_start( void )
24{
25   if ( electron_ula.tape_running )
26   {
2427      return;
2528   }
2629   electron_ula.tape_steps = 0;
r4574r4575
3134   timer_adjust_periodic(electron_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800));
3235}
3336
34static void electron_tape_stop( void ) {
37static void electron_tape_stop( void )
38{
3539   electron_ula.tape_running = 0;
3640   timer_reset( electron_tape_timer, attotime_never );
3741}
r4574r4575
4145
4246static TIMER_CALLBACK(electron_tape_timer_handler)
4347{
44   if ( electron_ula.cassette_motor_mode ) {
48   if ( electron_ula.cassette_motor_mode )
49   {
4550      double tap_val;
4651      tap_val = cassette_input( cassette_device_image( machine ) );
47      if ( tap_val < -0.5 ) {
52      if ( tap_val < -0.5 )
53      {
4854         electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_LOW;
4955         electron_ula.tape_steps++;
50      } else if ( tap_val > 0.5 ) {
56      }
57      else if ( tap_val > 0.5 )
58      {
5159         electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_HIGH;
5260         electron_ula.tape_steps++;
53      } else {
61      }
62      else
63      {
5464         electron_ula.tape_steps = 0;
5565         electron_ula.bit_count = 0;
5666         electron_ula.high_tone_set = 0;
5767         electron_ula.tape_value = 0x80808080;
5868      }
59      if ( electron_ula.tape_steps > 2 && ( electron_ula.tape_value == 0x0000FFFF || electron_ula.tape_value == 0x00FF00FF ) ) {
69      if ( electron_ula.tape_steps > 2 && ( electron_ula.tape_value == 0x0000FFFF || electron_ula.tape_value == 0x00FF00FF ) )
70      {
6071         electron_ula.tape_steps = 0;
61         switch( electron_ula.bit_count ) {
72         switch( electron_ula.bit_count )
73         {
6274         case 0:   /* start bit */
6375            electron_ula.start_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 );
6476            //logerror( "++ Read start bit: %d\n", electron_ula.start_bit );
65            if ( electron_ula.start_bit ) {
66               if ( electron_ula.high_tone_set ) {
77            if ( electron_ula.start_bit )
78            {
79               if ( electron_ula.high_tone_set )
80               {
6781                  electron_ula.bit_count--;
6882               }
69            } else {
83            }
84            else
85            {
7086               electron_ula.high_tone_set = 0;
7187            }
7288            break;
r4574r4575
7894         case 9: /* stop bit */
7995            electron_ula.stop_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 );
8096            //logerror( "++ Read stop bit: %d\n", electron_ula.stop_bit );
81            if ( electron_ula.start_bit && electron_ula.stop_bit && electron_ula.tape_byte == 0xFF && ! electron_ula.high_tone_set ) {
97            if ( electron_ula.start_bit && electron_ula.stop_bit && electron_ula.tape_byte == 0xFF && ! electron_ula.high_tone_set )
98            {
8299               electron_interrupt_handler( machine, INT_SET, INT_HIGH_TONE );
83100               electron_ula.high_tone_set = 1;
84            } else if ( ! electron_ula.start_bit && electron_ula.stop_bit ) {
101            }
102            else if ( ! electron_ula.start_bit && electron_ula.stop_bit )
103            {
85104               //logerror( "-- Byte read from tape: %02x\n", electron_ula.tape_byte );
86105               electron_interrupt_handler( machine, INT_SET, INT_RECEIVE_FULL );
87            } else {
106            }
107            else
108            {
88109               logerror( "Invalid start/stop bit combination detected: %d,%d\n", electron_ula.start_bit, electron_ula.stop_bit );
89110            }
90111            break;
r4574r4575
113134   return data;
114135}
115136
116READ8_HANDLER( electron_jim_r ) {
137READ8_HANDLER( electron_jim_r )
138{
117139   return 0xff;
118140}
119141
120WRITE8_HANDLER( electron_jim_w ) {
142WRITE8_HANDLER( electron_jim_w )
143{
121144}
122145
123READ8_HANDLER( electron_1mhz_r ) {
146READ8_HANDLER( electron_1mhz_r )
147{
124148   return 0xff;
125149}
126150
127WRITE8_HANDLER( electron_1mhz_w ) {
151WRITE8_HANDLER( electron_1mhz_w )
152{
128153}
129154
130READ8_HANDLER( electron_ula_r ) {
155READ8_HANDLER( electron_ula_r )
156{
131157   UINT8 data = ((UINT8 *)memory_region(space->machine, "user1"))[0x43E00 + offset];
132   switch ( offset & 0x0f ) {
158   switch ( offset & 0x0f )
159   {
133160   case 0x00:   /* Interrupt status */
134161      data = electron_ula.interrupt_status;
135162      electron_ula.interrupt_status &= ~0x02;
r4574r4575
153180   const device_config *speaker = devtag_get_device(space->machine, "beep");
154181   int i = electron_palette_offset[(( offset >> 1 ) & 0x03)];
155182   logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data );
156   switch( offset & 0x0f ) {
183   switch( offset & 0x0f )
184   {
157185   case 0x00:   /* Interrupt control */
158186      electron_ula.interrupt_control = data;
159187      break;
r4574r4575
176204       * Rompages 10 and 11 both select the Basic ROM.
177205       * Rompages 8 and 9 both select the keyboard.
178206       */
179      if ( ( ( electron_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) ) {
207      if ( ( ( electron_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) )
208      {
180209         electron_ula.rompage = data & 0x0f;
181         if ( electron_ula.rompage == 8 || electron_ula.rompage == 9 ) {
210         if ( electron_ula.rompage == 8 || electron_ula.rompage == 9 )
211         {
182212            electron_ula.rompage = 8;
183213            memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, electron_read_keyboard );
184         } else {
214         }
215         else
216         {
185217            memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, SMH_BANK2 );
186218         }
187219         memory_set_bank(space->machine, 2, electron_ula.rompage);
188220      }
189      if ( data & 0x10 ) {
221      if ( data & 0x10 )
222      {
190223         electron_interrupt_handler( space->machine, INT_CLEAR, INT_DISPLAY_END );
191224      }
192      if ( data & 0x20 ) {
225      if ( data & 0x20 )
226      {
193227         electron_interrupt_handler( space->machine, INT_CLEAR, INT_RTC );
194228      }
195      if ( data & 0x40 ) {
229      if ( data & 0x40 )
230      {
196231         electron_interrupt_handler( space->machine, INT_CLEAR, INT_HIGH_TONE );
197232      }
198      if ( data & 0x80 ) {
233      if ( data & 0x80 )
234      {
199235      }
200236      break;
201237   case 0x06:   /* Counter divider */
202      if ( electron_ula.communication_mode == 0x01) {
238      if ( electron_ula.communication_mode == 0x01)
239      {
203240         beep_set_frequency( speaker, 1000000 / ( 16 * ( data + 1 ) ) );
204241      }
205242      break;
206243   case 0x07:   /* Misc. */
207244      electron_ula.communication_mode = ( data >> 1 ) & 0x03;
208      switch( electron_ula.communication_mode ) {
245      switch( electron_ula.communication_mode )
246      {
209247      case 0x00:   /* cassette input */
210248         beep_set_state( speaker, 0 );
211249         electron_tape_start();
r4574r4575
249287   }
250288}
251289
252void electron_interrupt_handler(running_machine *machine, int mode, int interrupt) {
253   if ( mode == INT_SET ) {
290void electron_interrupt_handler(running_machine *machine, int mode, int interrupt)
291{
292   if ( mode == INT_SET )
293   {
254294      electron_ula.interrupt_status |= interrupt;
255   } else {
295   }
296   else
297   {
256298      electron_ula.interrupt_status &= ~interrupt;
257299   }
258   if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 ) {
300   if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 )
301   {
259302      electron_ula.interrupt_status |= 0x01;
260      cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE );
261   } else {
303      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE );
304   }
305   else
306   {
262307      electron_ula.interrupt_status &= ~0x01;
263      cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE );
308      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE );
264309   }
265310}
266311
r4574r4575
289334   electron_ula.screen_size = 0x8000 - 0x3000;
290335   electron_ula.screen_addr = 0;
291336   electron_ula.tape_running = 0;
292   electron_ula.vram = memory_get_read_ptr( cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ), electron_ula.screen_base );
337   electron_ula.vram = memory_get_read_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), electron_ula.screen_base);
293338}
294339
295340MACHINE_START( electron )
src/mess/drivers/dc.c
r4574r4575
121121
122122static void aica_irq(const device_config *device, int irq)
123123{
124   cpu_set_input_line(device->machine->cpu[1], ARM7_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
124   cputag_set_input_line(device->machine, "soundcpu", ARM7_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
125125}
126126
127127static const aica_interface dc_aica_interface =
src/mess/drivers/enterp.c
r4574r4575
109109   case 0x11:
110110   case 0x12:
111111   case 0x13:
112      enterprise_update_memory_page(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset - 0x0f, data);
112      enterprise_update_memory_page(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), offset - 0x0f, data);
113113      break;
114114
115115   case 0x15:
r4574r4575
173173
174174static MACHINE_RESET( enterprise )
175175{
176   cpu_set_input_line_vector(machine->cpu[0], 0, 0xff);
176   cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0xff);
177177
178178   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
179179}
src/mess/drivers/ex800.c
r4574r4575
172172
173173   if (newval)
174174   {
175      cpu_set_input_line(field->port->machine->cpu[0], UPD7810_INTF1, state);
175      cputag_set_input_line(field->port->machine, "maincpu", UPD7810_INTF1, state);
176176      state = (state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
177177   }
178178}
src/mess/drivers/einstein.c
r4574r4575
358358   /* NPW 21-Jul-2005 - Not sure how to update this for MAME 0.98u2 */
359359/*
360360    if (einstein_int & einstein_int_mask & EINSTEIN_KEY_INT)
361        cpu_set_input_line(machine->cpu[0], Z80_INT_REQ, PULSE_LINE);
361        cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE);
362362    else
363        cpu_set_input_line(machine->cpu[0], Z80_INT_IEO, PULSE_LINE);
363        cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE);
364364
365365    if (einstein_int & einstein_int_mask & EINSTEIN_ADC_INT)
366        cpu_set_input_line(machine->cpu[0], Z80_INT_REQ, PULSE_LINE);
366        cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE);
367367    else
368        cpu_set_input_line(machine->cpu[0], Z80_INT_IEO, PULSE_LINE);
368        cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE);
369369
370370    if (einstein_int & einstein_int_mask & EINSTEIN_FIRE_INT)
371        cpu_set_input_line(machine->cpu[0], Z80_INT_REQ, PULSE_LINE);
371        cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE);
372372    else
373        cpu_set_input_line(machine->cpu[0], Z80_INT_IEO, PULSE_LINE);
373        cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE);
374374*/
375375}
376376
r4574r4575
406406/* interrupt state callback for ctc */
407407static void einstein_ctc_interrupt(const device_config *device, int state)
408408{
409   logerror("ctc irq state: %02x\n",state);
410   cpu_set_input_line(device->machine->cpu[0], 1, state);
409   logerror("ctc irq state: %02x\n", state);
410   cputag_set_input_line(device->machine, "maincpu", 1, state);
411411}
412412
413413static void einstein_pio_interrupt(const device_config *device, int state)
414414{
415   logerror("pio irq state: %02x\n",state);
416   cpu_set_input_line(device->machine->cpu[0], 3, state);
415   logerror("pio irq state: %02x\n", state);
416   cputag_set_input_line(device->machine, "maincpu", 3, state);
417417}
418418
419419static WRITE8_DEVICE_HANDLER(einstein_serial_transmit_clock)
r4574r4575
580580   int reg = offset & 0x03;
581581   const device_config *fdc = devtag_get_device(space->machine, "wd177x");
582582
583   logerror("fdc w: PC: %04x %04x %02x\n",cpu_get_pc(space->machine->cpu[0]),offset,data);
583   logerror("fdc w: PC: %04x %04x %02x\n", cpu_get_pc(cputag_get_cpu(space->machine,"maincpu")), offset, data);
584584
585585   switch (reg)
586586   {
r4574r4575
616616   int reg = offset & 0x03;
617617   const device_config *fdc = devtag_get_device(space->machine, "wd177x");
618618
619   logerror("fdc r: PC: %04x %04x\n",cpu_get_pc(space->machine->cpu[0]),offset);
619   logerror("fdc r: PC: %04x %04x\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset);
620620
621621   switch (reg)
622622   {
r4574r4575
815815   /* bit 1: select drive 1 */
816816   /* bit 0: select drive 0 */
817817
818   logerror("drive w: PC: %04x %04x %02x\n",cpu_get_pc(space->machine->cpu[0]),offset,data);
818   logerror("drive w: PC: %04x %04x %02x\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data);
819819
820   wd17xx_set_side(fdc,(data>>4) & 0x01);
820   wd17xx_set_side(fdc, (data >> 4) & 0x01);
821821
822822   if (data & 0x01)
823823   {
824      wd17xx_set_drive(fdc,0);
824      wd17xx_set_drive(fdc, 0);
825825   }
826826   else
827827   if (data & 0x02)
828828   {
829      wd17xx_set_drive(fdc,1);
829      wd17xx_set_drive(fdc, 1);
830830   }
831831   else
832832   if (data & 0x04)
833833   {
834      wd17xx_set_drive(fdc,2);
834      wd17xx_set_drive(fdc, 2);
835835   }
836836   else
837837   if (data & 0x08)
838838   {
839      wd17xx_set_drive(fdc,3);
839      wd17xx_set_drive(fdc, 3);
840840   }
841841}
842842
843843static WRITE8_HANDLER(einstein_rom_w)
844844{
845   einstein_rom_enabled^=1;
845   einstein_rom_enabled ^= 1;
846846   einstein_page_rom(space->machine);
847847}
848848
r4574r4575
13851385   einstein_int_mask = 0;
13861386   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
13871387
1388   cpu_set_irq_callback(machine->cpu[0], einstein_cpu_acknowledge_int);
1388   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), einstein_cpu_acknowledge_int);
13891389
13901390   /* the einstein keyboard can generate a interrupt */
13911391   /* the int is actually clocked at the system clock 4 MHz, but this would be too fast for our
src/mess/drivers/exelv.c
r4574r4575
207207         break;
208208      case IOS_INIT:
209209         mailbox_out = 0x08;
210         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
211         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
210         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
211         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
212212         io_state = IOS_NOP;
213213         break;
214214      case IOS_RESET:
r4574r4575
224224         break;
225225      case IOS_CHARDEF1:
226226         mailbox_out = 0x07;
227         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
228         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
227         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
228         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
229229         io_state = IOS_CHARDEF2;
230230         break;
231231      case IOS_CHARDEF2:
232232         mailbox_out = 0x04;
233         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
234         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
233         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
234         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
235235         io_state = IOS_CHARDEF3;
236236         break;
237237      case IOS_CHARDEF3:
238238         mailbox_out = 0xF5;
239         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
240         cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
239         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
240         cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
241241         io_state = IOS_CHARDEF4;
242242         io_counter = 0;
243243         break;
r4574r4575
375375               0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
376376               0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
377377            };
378            mailbox_out = fontdata[io_counter+9-2*(io_counter%10)] >> 2;
379            cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
380            cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
378            mailbox_out = fontdata[io_counter + 9 - 2 * (io_counter % 10)] >> 2;
379            cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
380            cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
381381            io_counter++;
382            if (io_counter == 127*10)
382            if (io_counter == 127 * 10)
383383               io_state = IOS_NOP;
384384         }
385385         break;
r4574r4575
395395      if (io_command_ack)
396396      {
397397         if (io_hsk) {
398            cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, ASSERT_LINE);
399            cpu_set_input_line(machine->cpu[0], TMS7000_IRQ1_LINE, CLEAR_LINE);
398            cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, ASSERT_LINE);
399            cputag_set_input_line(machine, "maincpu", TMS7000_IRQ1_LINE, CLEAR_LINE);
400400         }
401401         else
402402         {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team