Previous 15994 Revisions Next

r822 Tuesday 14th August, 2007 at 07:58:04 UTC by Curt Coder
[ATARIST] Now boots to TOS!
[src/mess/drivers]atarist.c
[src/mess/machine]68901mfp.c
[src/mess/video]atarist.c atarist.h

src/mess/video/atarist.c
r821r822
2828   UINT8 pixelofs; // STe
2929   UINT16 rr[4];
3030   UINT16 ir[4];
31   int vcount;
32   int hcount;
3331   int bitplane;
3432   int shift;
3533   int h, v;
r821r822
5048   case 0: // 320 x 200, 4 Plane
5149      color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
5250     
53      //logerror("y %u x %u color %u mode %u de %u h %u v %u hc %u\n", y, x, color, shifter.mode, shifter.h&&shifter.v, shifter.h, shifter.v, shifter.hcount);
54     
5551      *BITMAP_ADDR16(atarist_bitmap, y, x) = Machine->pens[color];
5652
5753      shifter.rr[0] <<= 1;
5854      shifter.rr[1] <<= 1;
5955      shifter.rr[2] <<= 1;
6056      shifter.rr[3] <<= 1;
61
6257      break;
6358
6459   case 1: // 640 x 200, 2 Plane
r821r822
8782
8883static TIMER_CALLBACK(atarist_glue_tick)
8984{
90   int de;
91   UINT8 *RAM = memory_region(REGION_CPU1) + shifter.base + shifter.ofs;
85   UINT8 *RAM = memory_region(REGION_CPU1) + shifter.ofs;
9286
93   shifter.hcount = video_screen_get_hpos(0) / 4;
94   shifter.vcount = video_screen_get_vpos(0);
87   int hcount = video_screen_get_hpos(0) / 4;
88   int vcount = video_screen_get_vpos(0);
9589
90   int de;
91
9692   if (shifter.sync & 0x02)
9793   {
9894      // 50 Hz
9995
100      switch (shifter.hcount)
96      switch (hcount)
10197      {
10298      case ATARIST_HBDEND_PAL:
10399         shifter.h = ASSERT_LINE;
r821r822
105101      case ATARIST_HBDSTART_PAL:
106102         shifter.h = CLEAR_LINE;
107103         break;
108      case 128:
104      case ATARIST_HBSTART_PAL/4:
109105         cpunum_set_input_line(0, MC68000_IRQ_2, ASSERT_LINE);
110106         break;
111107      }
112108
113      switch (shifter.vcount)
109      switch (vcount)
114110      {
115111      case ATARIST_VBDEND_PAL:
116112         shifter.v = ASSERT_LINE;
r821r822
120116         break;
121117      case ATARIST_VBSTART_PAL:
122118         cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
123         shifter.ofs = 0;
119         shifter.ofs = shifter.base;
124120         break;
125121      }
126122   }
127123   else
128124   {
129125      // 60 Hz
130      switch (shifter.hcount)
126
127      switch (hcount)
131128      {
132129      case ATARIST_HBDEND_NTSC:
133130         shifter.h = ASSERT_LINE;
r821r822
135132      case ATARIST_HBDSTART_NTSC:
136133         shifter.h = CLEAR_LINE;
137134         break;
138      case 127:
135      case ATARIST_HBSTART_NTSC/4:
139136         cpunum_set_input_line(0, MC68000_IRQ_2, ASSERT_LINE);
140137         break;
141138      }
142139
143      switch (shifter.vcount)
140      switch (vcount)
144141      {
145142      case ATARIST_VBDEND_NTSC:
146143         shifter.v = ASSERT_LINE;
r821r822
150147         break;
151148      case ATARIST_VBSTART_NTSC:
152149         cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
153         shifter.ofs = 0;
150         shifter.ofs = shifter.base;
154151         break;
155152      }
156153   }
r821r822
161158   
162159   if (de)
163160   {
164      shifter.ir[shifter.bitplane] = (RAM[0] << 8) | RAM[1];
165      shifter.ofs += 2;
161      shifter.ir[shifter.bitplane] = (RAM[1] << 8) | RAM[0];
166162      shifter.bitplane++;
163      shifter.ofs += 2;
167164     
168165      if (shifter.bitplane == 4)
169166      {
r821r822
173170         shifter.rr[1] = shifter.ir[1];
174171         shifter.rr[2] = shifter.ir[2];
175172         shifter.rr[3] = shifter.ir[3];
176
177         shifter.ir[0] = shifter.ir[1] = shifter.ir[2] = shifter.ir[3] = 0;
178173      }
179174   }
180175}
181176
182READ16_HANDLER( atarist_shifter_r )
177READ16_HANDLER( atarist_shifter_base_r )
183178{
184179   switch (offset)
185180   {
186181   case 0x00:
187      return (shifter.base >> 16) & 0xff;
188   case 0x02:
182      return (shifter.base >> 16) & 0x3f;
183   case 0x01:
189184      return (shifter.base >> 8) & 0xff;
190
191   case 0x04:
192      return (shifter.ofs >> 16) & 0xff;
193   case 0x06:
194      return (shifter.ofs >> 8) & 0xff;
195   case 0x08:
196      return shifter.ofs & 0xff;
197
198   case 0x0a:
199      return shifter.sync;
200   case 0x60:
201      return shifter.mode << 8;
202
203   default:
204      if ((offset & 0xe0) == 0x40)
205      {
206         return shifter.palette[offset & 0x1f];
207      }
208185   }
209
186   
210187   return 0;
211188}
212189
213WRITE16_HANDLER( atarist_shifter_w )
190READ16_HANDLER( atarist_shifter_counter_r )
214191{
215192   switch (offset)
216193   {
217194   case 0x00:
218      shifter.base = (shifter.base & 0x00ff00) | (data & 0x3f) << 16;
219      logerror("shifter base %x\n", shifter.base);
220      break;
195      return (shifter.ofs >> 16) & 0x3f;
196   case 0x01:
197      return (shifter.ofs >> 8) & 0xff;
221198   case 0x02:
222      shifter.base = (shifter.base & 0xff0000) | (data & 0xff) << 8;
223      logerror("shifter base %x\n", shifter.base);
224      break;
199      return shifter.ofs & 0xff;
200   }
225201
226   case 0x0a:
227      shifter.sync = data >> 8;
228      logerror("shifter sync %x\n", shifter.sync);
229      break;
202   return 0;
203}
230204
231   case 0x60:
232      shifter.mode = data >> 8;
233      logerror("shifter mode %x\n", shifter.mode);
234      break;
235
236   default:
237      if ((offset & 0xe0) == 0x40)
238      {
239         int i = offset & 0x1f;
240         shifter.palette[i] = data;
241         logerror("shifter base %x\n", shifter.palette[i]);
242         palette_set_color_rgb(Machine, offset, pal3bit(data >> 8), pal3bit(data >> 4), pal2bit(data >> 0));
243      }
244   }
205READ16_HANDLER( atarist_shifter_sync_r )
206{
207   return shifter.sync;
245208}
246209
247READ16_HANDLER( atariste_shifter_r )
210READ16_HANDLER( atarist_shifter_mode_r )
248211{
249   switch (offset)
250   {
251   case 0x00:
252      return (shifter.base >> 16) & 0x3f;
253   case 0x02:
254      return (shifter.base >> 8) & 0xff;
255   case 0x0c:
256      return shifter.base & 0xfe;
212   return shifter.mode << 8;
213}
257214
258   case 0x04:
259      return (shifter.ofs >> 16) & 0x3f;
260   case 0x06:
261      return (shifter.ofs >> 8) & 0xff;
262   case 0x08:
263      return shifter.ofs & 0xfe;
264
265   case 0x0a:
266      return shifter.sync << 8;
267   case 0x60:
268      return shifter.mode << 8;
269
270   case 0x0e:
271      return shifter.lineofs << 8;
272   case 0x64:
273      return shifter.pixelofs << 8;
274
275   default:
276      if ((offset & 0xe0) == 0x40)
277      {
278         return shifter.palette[offset & 0x1f];
279      }
280   }
281
282   return 0;
215READ16_HANDLER( atarist_shifter_palette_r )
216{
217   return shifter.palette[offset];
283218}
284219
285WRITE16_HANDLER( atariste_shifter_w )
220WRITE16_HANDLER( atarist_shifter_base_w )
286221{
287222   switch (offset)
288223   {
289224   case 0x00:
290225      shifter.base = (shifter.base & 0x00ff00) | (data & 0x3f) << 16;
226      logerror("SHIFTER base %06x\n", shifter.base);
291227      break;
292   case 0x02:
293      shifter.base = (shifter.base & 0xff0000) | (data & 0xff) << 8;
228   case 0x01:
229      shifter.base = (shifter.base & 0x3f0000) | (data & 0xff) << 8;
230      logerror("SHIFTER base %06x\n", shifter.base);
294231      break;
295   case 0x0c:
296      shifter.base = (shifter.base & 0xffff00) | (data & 0xfe) << 8;
297      break;
232   }
233}
298234
299   case 0x04:
300      shifter.ofs = (shifter.ofs & 0x00ffff) | (data & 0x3f) << 16;
301      break;
302   case 0x06:
303      shifter.ofs = (shifter.ofs & 0xff00ff) | (data & 0xff) << 8;
304      break;
305   case 0x08:
306      shifter.ofs = (shifter.ofs & 0xffff00) | (data & 0xfe);
307      break;
235WRITE16_HANDLER( atarist_shifter_sync_w )
236{
237   shifter.sync = data >> 8;
238   logerror("SHIFTER sync %x\n", shifter.sync);
239}
240     
241WRITE16_HANDLER( atarist_shifter_mode_w )
242{
243   shifter.mode = data >> 8;
244   logerror("SHIFTER mode %x\n", shifter.mode);
245}
308246
309   case 0x0a:
310      shifter.sync = data >> 8;
311      break;
312   case 0x60:
313      shifter.mode = data >> 8;
314      break;
247WRITE16_HANDLER( atarist_shifter_palette_w )
248{
249   shifter.palette[offset] = data;
250   logerror("SHIFTER palette %x = %x\n", offset, data);
315251
316   case 0x0e:
317      shifter.lineofs = data & 0xff;
318      break;
319   case 0x64:
320      shifter.pixelofs = data & 0x0f;
321      break;
252   palette_set_color_rgb(Machine, offset, pal3bit(data >> 8), pal3bit(data >> 4), pal3bit(data));
253}
322254
323   default:
324      if ((offset & 0xe0) == 0x40)
325      {
326         int i = offset & 0x1f;
327         int r = ((data >> 7) & 0x0e) | ((data >> 11) & 0x01);
328         int g = ((data >> 3) & 0x0e) | ((data >> 4) & 0x01);
329         int b = ((data << 1) & 0x0e) | ((data >> 3) & 0x01);
330         shifter.palette[i] = data;
331         palette_set_color_rgb(Machine, i, r, g, b);
332      }
333   }
255WRITE16_HANDLER( atariste_shifter_palette_w )
256{
257   int r = ((data >> 7) & 0x0e) | ((data >> 11) & 0x01);
258   int g = ((data >> 3) & 0x0e) | ((data >> 4) & 0x01);
259   int b = ((data << 1) & 0x0e) | ((data >> 3) & 0x01);
260
261   shifter.palette[offset] = data;
262   logerror("STe SHIFTER palette %x = %x\n", offset, data);
263
264   palette_set_color_rgb(Machine, offset, r, g, b);
334265}
335266
336267VIDEO_START( atarist )
r821r822
338269   atarist_shifter_timer = mame_timer_alloc(atarist_shifter_tick);
339270   atarist_glue_timer = mame_timer_alloc(atarist_glue_tick);
340271
341   mame_timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,0), 0, MAME_TIME_IN_HZ(Y2/16)); // 500 ns
272   mame_timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,4), 0, MAME_TIME_IN_HZ(Y2/16)); // 500 ns
342273   mame_timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, MAME_TIME_IN_HZ(Y2/4)); // 125 ns
343274
344275   atarist_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format);
src/mess/video/atarist.h
r821r822
2828#define ATARIST_VBDEND_NTSC      34
2929#define ATARIST_VBDSTART_NTSC   234
3030
31READ16_HANDLER( atarist_shifter_r );
32WRITE16_HANDLER( atarist_shifter_w );
33READ16_HANDLER( atariste_shifter_r );
34WRITE16_HANDLER( atariste_shifter_w );
31READ16_HANDLER( atarist_shifter_base_r );
32WRITE16_HANDLER( atarist_shifter_base_w );
33READ16_HANDLER( atarist_shifter_counter_r );
34READ16_HANDLER( atarist_shifter_sync_r );
35WRITE16_HANDLER( atarist_shifter_sync_w );
36READ16_HANDLER( atarist_shifter_palette_r );
37WRITE16_HANDLER( atarist_shifter_palette_w );
38READ16_HANDLER( atarist_shifter_mode_r );
39WRITE16_HANDLER( atarist_shifter_mode_w );
3540
41READ16_HANDLER( atariste_palette_r );
42WRITE16_HANDLER( atariste_palette_w );
43
3644VIDEO_START( atarist );
3745VIDEO_UPDATE( atarist );
3846
src/mess/machine/68901mfp.c
r821r822
110110   {
111111   case MFP68901_REGISTER_GPIP:
112112      {
113      UINT8 gpio = 0x80;
113      UINT8 gpio = 0;
114114
115115      if (mfp_p->gpio_r)
116116      {
r821r822
120120      gpio |= (mfp_p->gpip & mfp_p->ddr);
121121
122122      // signal interrupts if necessary
123      return gpio;
123      return 0x80;
124124      }
125125   case MFP68901_REGISTER_AER:   return mfp_p->aer;
126126   case MFP68901_REGISTER_DDR:   return mfp_p->ddr;
r821r822
10401040   }
10411041}
10421042
1043static int GPIO_MASK[] =  { MFP68901_IPRB_GPIP_0, MFP68901_IPRB_GPIP_1, MFP68901_IPRB_GPIP_2, MFP68901_IPRB_GPIP_3,
1044                     MFP68901_IPRB_GPIP_4, MFP68901_IPRB_GPIP_5, MFP68901_IPRA_GPIP_6, MFP68901_IPRA_GPIP_7 };
1043static const int GPIO_MASK[] =
1044{
1045   MFP68901_IPRB_GPIP_0, MFP68901_IPRB_GPIP_1, MFP68901_IPRB_GPIP_2, MFP68901_IPRB_GPIP_3,
1046   MFP68901_IPRB_GPIP_4, MFP68901_IPRB_GPIP_5, MFP68901_IPRA_GPIP_6, MFP68901_IPRA_GPIP_7
1047};
10451048
1046static int GPIO_VECTOR[] = { MFP68901_INT_GPI0, MFP68901_INT_GPI1, MFP68901_INT_GPI2, MFP68901_INT_GPI3,
1047                      MFP68901_INT_GPI4, MFP68901_INT_GPI5, MFP68901_INT_GPI6, MFP68901_INT_GPI7 };
1049static const int GPIO_VECTOR[] =
1050{
1051   MFP68901_INT_GPI0, MFP68901_INT_GPI1, MFP68901_INT_GPI2, MFP68901_INT_GPI3,
1052   MFP68901_INT_GPI4, MFP68901_INT_GPI5, MFP68901_INT_GPI6, MFP68901_INT_GPI7
1053};
10481054
10491055void mfp68901_gpio_w(int which, int line, int value)
10501056{
src/mess/drivers/atarist.c
r821r822
2727   - fdc.dma_int ?
2828   - save states
2929   - memory shadow
30   - proper UK TOS roms
3031
3132*/
3233
r821r822
221222static UINT8 ikbd_mouse_x0, ikbd_mouse_y0;
222223static UINT8 ikbd_mouse_x_phase, ikbd_mouse_y_phase, ikbd_mouse_phase_counter;
223224
224static int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
225static int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
225static const int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
226static const int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
226227
227228enum
228229{
r821r822
427428   AM_RANGE(0xfa0000, 0xfbffff) AM_ROMBANK(3)
428429   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM
429430   AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
430   AM_RANGE(0xff8200, 0xff82ff) AM_READWRITE(atarist_shifter_r, atarist_shifter_w)
431   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
432   AM_RANGE(0xff8204, 0xff8209) AM_READ(atarist_shifter_counter_r)
433   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE(atarist_shifter_sync_r, atarist_shifter_sync_w)
434   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atarist_shifter_palette_w)
435   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE(atarist_shifter_mode_r, atarist_shifter_mode_w)
431436   AM_RANGE(0xff8600, 0xff860f) AM_READWRITE(atarist_fdc_r, atarist_fdc_w)
432437   AM_RANGE(0xff8800, 0xff8801) AM_READWRITE(AY8910_read_port_0_msb_r, AY8910_control_port_0_msb_w)
433438   AM_RANGE(0xff8802, 0xff8803) AM_WRITE(AY8910_write_port_0_msb_w)
r821r822
445450   AM_RANGE(0xfa0000, 0xfbffff) AM_ROMBANK(3)
446451   AM_RANGE(0xfc0000, 0xfeffff) AM_ROM
447452   AM_RANGE(0xff8000, 0xff8007) AM_READWRITE(atarist_mmu_r, atarist_mmu_w)
448   AM_RANGE(0xff8200, 0xff82ff) AM_READWRITE(atarist_shifter_r, atarist_shifter_w)
453   AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(atarist_shifter_base_r, atarist_shifter_base_w)
454   AM_RANGE(0xff8204, 0xff8209) AM_READ(atarist_shifter_counter_r)
455   AM_RANGE(0xff820a, 0xff820b) AM_READWRITE(atarist_shifter_sync_r, atarist_shifter_sync_w)
456   AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(atarist_shifter_palette_r, atarist_shifter_palette_w)
457   AM_RANGE(0xff8260, 0xff8261) AM_READWRITE(atarist_shifter_mode_r, atarist_shifter_mode_w)
449458   AM_RANGE(0xff8600, 0xff860f) AM_READWRITE(atarist_fdc_r, atarist_fdc_w)
450459   AM_RANGE(0xff8800, 0xff8801) AM_READWRITE(AY8910_read_port_0_msb_r, AY8910_control_port_0_msb_w)
451460   AM_RANGE(0xff8802, 0xff8803) AM_WRITE(AY8910_write_port_0_msb_w)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team