Previous 15994 Revisions Next

r6201 Wednesday 28th October, 2009 at 03:51:02 UTC by R. Belmont
[MAC] Many updates.
- Fixed ID readbacks for all models
- Fixed SCSI handshake on Mac II and later machines
- Fixed ADB timing to specs; prevents hangs of System >6.0.3 on ADB systems
and improves mouse pointer smoothness
- Complete emulation of SE/30 on-board video and RasterOps 264 ColorBoard
[src/mess/drivers]mac.c
[src/mess/includes]mac.h
[src/mess/machine]mac.c
[src/mess/video]mac.c

src/mess/video/mac.c
r6200r6201
9797   return 0;
9898}
9999
100/*
101   RasterOps ColorBoard 264: fixed resolution 640x480 NuBus video card, 1/4/8/16/24 bit color
102   1.5? MB of VRAM (tests up to 0x1fffff), Bt473 RAMDAC, and two custom gate arrays.
103
104        - 0xfsff6004 is color depth: 0 for 1bpp, 1 for 2bpp, 2 for 4bpp, 3 for 8bpp, 4 for 24bpp (resolution is fixed 640x480)
105        - 0xfsff6014 is VBL ack: write 1 to ack
106   - 0xfsff603c is VBL disable: write 1 to disable, 0 to enable
107*/
108
109UINT32 *mac_cb264_vram;
110static UINT32 cb264_mode, cb264_vbl_disable, cb264_toggle;
111static UINT32 cb264_palette[256], cb264_colors[3], cb264_count, cb264_clutoffs;
112
113VIDEO_START( mac_cb264 )
114{
115   cb264_toggle = 0;
116   cb264_count = 0;
117   cb264_clutoffs = 0;
118   cb264_vbl_disable = 1;
119   cb264_mode = 0;
120}
121
122// we do this here because VIDEO_UPDATE is called constantly when stepping in the debugger,
123// which makes it hard to get accurate timings (or escape the VIA2 IRQ handler)
124INTERRUPT_GEN( mac_cb264_vbl )
125{
126   if (!cb264_vbl_disable)
127   {
128      mac_nubus_slot_interrupt(device->machine, 0xe, 1);
129   }
130}
131
132VIDEO_UPDATE( mac_cb264 )
133{
134   UINT32 *scanline, *base;
135   int x, y;
136
137   switch (cb264_mode)
138   {
139      case 0: // 1 bpp
140         {
141            UINT8 *vram8 = (UINT8 *)mac_cb264_vram;
142            UINT8 pixels;
143
144            for (y = 0; y < 480; y++)
145            {
146               scanline = BITMAP_ADDR32(bitmap, y, 0);
147               for (x = 0; x < 640/8; x++)
148               {
149                  pixels = vram8[(y * 1024) + (x^3)];
150
151                  *scanline++ = cb264_palette[pixels&0x80];
152                  *scanline++ = cb264_palette[(pixels<<1)&0x80];
153                  *scanline++ = cb264_palette[(pixels<<2)&0x80];
154                  *scanline++ = cb264_palette[(pixels<<3)&0x80];
155                  *scanline++ = cb264_palette[(pixels<<4)&0x80];
156                  *scanline++ = cb264_palette[(pixels<<5)&0x80];
157                  *scanline++ = cb264_palette[(pixels<<6)&0x80];
158                  *scanline++ = cb264_palette[(pixels<<7)&0x80];
159               }
160            }
161         }
162         break;
163
164      case 1: // 2 bpp (3f/7f/bf/ff)
165         {
166            UINT8 *vram8 = (UINT8 *)mac_cb264_vram;
167            UINT8 pixels;
168
169            for (y = 0; y < 480; y++)
170            {
171               scanline = BITMAP_ADDR32(bitmap, y, 0);
172               for (x = 0; x < 640/4; x++)
173               {
174                  pixels = vram8[(y * 1024) + (x^3)];
175
176                  *scanline++ = cb264_palette[pixels&0xc0];
177                  *scanline++ = cb264_palette[(pixels<<2)&0xc0];
178                  *scanline++ = cb264_palette[(pixels<<4)&0xc0];
179                  *scanline++ = cb264_palette[(pixels<<6)&0xc0];
180               }
181            }
182         }
183         break;
184
185      case 2: // 4 bpp
186         {
187            UINT8 *vram8 = (UINT8 *)mac_cb264_vram;
188            UINT8 pixels;
189
190            for (y = 0; y < 480; y++)
191            {
192               scanline = BITMAP_ADDR32(bitmap, y, 0);
193
194               for (x = 0; x < 640/2; x++)
195               {
196                  pixels = vram8[(y * 1024) + (x^3)];
197
198                  *scanline++ = cb264_palette[pixels&0xf0];
199                  *scanline++ = cb264_palette[(pixels<<4)&0xf0];
200               }
201            }
202         }
203         break;
204
205      case 3: // 8 bpp
206         {
207            UINT8 *vram8 = (UINT8 *)mac_cb264_vram;
208            UINT8 pixels;
209
210            for (y = 0; y < 480; y++)
211            {
212               scanline = BITMAP_ADDR32(bitmap, y, 0);
213
214               for (x = 0; x < 640; x++)
215               {
216                  pixels = vram8[(y * 1024) + (x^3)];
217                  *scanline++ = cb264_palette[pixels];
218               }
219            }
220         }
221         break;
222
223      case 4:   // 24 bpp
224      case 7: // ???
225         for (y = 0; y < 480; y++)
226         {
227            scanline = BITMAP_ADDR32(bitmap, y, 0);
228            base = &mac_cb264_vram[y * 1024];
229            for (x = 0; x < 640; x++)
230            {
231               *scanline++ = *base++;
232            }
233         }
234         break;
235
236      default:
237         fatalerror("cb264: unknown video mode %d\n", cb264_mode);
238         break;
239
240   }
241
242   return 0;
243}
244
245READ32_HANDLER( mac_cb264_r )
246{
247   switch (offset)
248   {
249      case 0x0c/4:
250      case 0x28/4:
251         break;
252
253      case 0x34/4:
254         cb264_toggle ^= 1;
255         return cb264_toggle;   // bit 0 is vblank?
256
257      default:
258         logerror("cb264_r: reg %x (mask %x PC %x)\n", offset*4, mem_mask, cpu_get_pc(space->cpu));
259         break;
260   }
261
262   return 0;
263}
264
265WRITE32_HANDLER( mac_cb264_w )
266{
267   switch (offset)
268   {
269      case 0x4/4:   // 0 = 1 bpp, 1 = 2bpp, 2 = 4bpp, 3 = 8bpp, 4 = 24bpp
270         cb264_mode = data;
271         break;
272
273      case 0x14/4:   // VBL ack
274         mac_nubus_slot_interrupt(space->machine, 0xe, 0);
275         break;
276
277      case 0x3c/4:   // VBL disable
278         cb264_vbl_disable = data;
279         break;
280
281      default:
282//         printf("cb264_w: %x to reg %x (mask %x PC %x)\n", data, offset*4, mem_mask, cpu_get_pc(space->cpu));
283         break;
284   }
285}
286
287WRITE32_HANDLER( mac_cb264_ramdac_w )
288{
289   switch (offset)
290   {
291      case 0:
292         cb264_clutoffs = data>>24;
293         cb264_count = 0;
294         break;
295
296      case 1:
297         cb264_colors[cb264_count++] = data>>24;
298
299         if (cb264_count == 3)
300         {
301            palette_set_color(space->machine, cb264_clutoffs, MAKE_RGB(cb264_colors[0], cb264_colors[1], cb264_colors[2]));
302            cb264_palette[cb264_clutoffs] = MAKE_RGB(cb264_colors[0], cb264_colors[1], cb264_colors[2]);
303            cb264_clutoffs++;
304            cb264_count = 0;
305         }
306         break;
307
308      default:
309//         printf("%x to unknown RAMDAC register @ %x\n", data, offset);
310         break;
311   }
312}
313
src/mess/includes/mac.h
r6200r6201
1515/* tells which model is being emulated (set by macxxx_init) */
1616typedef enum
1717{
18   MODEL_MAC_128K512K,
18   MODEL_MAC_128K512K,   // 68000 machines
1919   MODEL_MAC_512KE,
2020   MODEL_MAC_PLUS,
2121   MODEL_MAC_SE,
22   MODEL_MAC_SE_FDHD,
2322   MODEL_MAC_CLASSIC,
2423   MODEL_MAC_PORTABLE,
2524   MODEL_MAC_PB100,
r6200r6201
4039   MODEL_MAC_COLOR_CLASSIC
4140} mac_model_t;
4241
43// video parameters
42// video parameters for classic Macs
4443#define MAC_H_VIS   (512)
4544#define MAC_V_VIS   (342)
4645#define MAC_H_TOTAL   (704)      // (512+192)
r6200r6201
9493void mac_scc_mouse_irq( running_machine *machine, int x, int y );
9594void mac_fdc_set_enable_lines(const device_config *device, int enable_mask);
9695
96void mac_nubus_slot_interrupt(running_machine *machine, UINT8 slot, UINT32 state);
9797
9898/*----------- defined in video/mac.c -----------*/
9999
r6200r6201
104104
105105void mac_set_screen_buffer( int buffer );
106106
107extern UINT32 *mac_cb264_vram;
108VIDEO_START( mac_cb264 );
109VIDEO_UPDATE( mac_cb264 );
110READ32_HANDLER( mac_cb264_r );
111WRITE32_HANDLER( mac_cb264_w );
112WRITE32_HANDLER( mac_cb264_ramdac_w );
113INTERRUPT_GEN( mac_cb264_vbl );
107114
108115/*----------- defined in audio/mac.c -----------*/
109116
r6200r6201
119126
120127
121128#endif /* MAC_H_ */
129
130
src/mess/machine/mac.c
r6200r6201
5252            LC 55x, LC 57x, LC 58x, Quadra 630, Quadra 660AV, Quadra 840AV, PowerMac 6100/7100/8100,
5353            IIcx, IIci, and PowerMac 5200.
5454
55    TODO:
55`    TODO:
5656        - Mac Portable and PowerBook 100 are similar to this hardware, but we need ROMs!
5757        - Call the RTC timer
5858        - SE FDHD and Classic require SWIM support.  SWIM is IWM compatible with 800k drives, but
r6200r6201
6161          (IM-III seems to say it does not on Mac 128k, 512k, and 512ke).
6262        - What on earth are 0x700000-0x7fffff mapped to ?
6363
64
6564****************************************************************************/
6665
6766#include <time.h>
r6200r6201
165164static int mac_scsiirq_enable = 0;
166165
167166static UINT32 mac_via2_vbl = 0, mac_se30_vbl_enable = 0;
167static UINT8 mac_nubus_irq_state, via2_ca1 = 0;
168168
169169// returns non-zero if this Mac has ADB
170170static int has_adb(void)
r6200r6201
849849  scsiRd+sBSR         $580050    Bus and Status Register
850850  scsiRd+sIDR         $580060    Input Data Register
851851  scsiRd+sRESET       $580070    Reset Parity/Interrupt
852
853852             */
854853
855854READ16_HANDLER ( macplus_scsi_r )
r6200r6201
868867
869868READ32_HANDLER (macii_scsi_drq_r)
870869{
871   return ncr5380_r(space, R5380_CURDATA_DTACK)<<24;
870   switch (mem_mask)
871   {
872      case 0xff000000:
873         return ncr5380_r(space, R5380_CURDATA_DTACK)<<24;
874
875      case 0xffff0000:
876         return (ncr5380_r(space, R5380_CURDATA_DTACK)<<24) | (ncr5380_r(space, R5380_CURDATA_DTACK)<<16);
877
878      case 0xffffffff:
879         return (ncr5380_r(space, R5380_CURDATA_DTACK)<<24) | (ncr5380_r(space, R5380_CURDATA_DTACK)<<16) | (ncr5380_r(space, R5380_CURDATA_DTACK)<<8) | ncr5380_r(space, R5380_CURDATA_DTACK);
880
881      default:
882         logerror("macii_scsi_drq_r: unknown mem_mask %08x\n", mem_mask);
883   }
884
885   return 0;
872886}
873887
874888WRITE16_HANDLER ( macplus_scsi_w )
r6200r6201
11471161      case 0: case 1: case 2: case 3:   /* seconds register */
11481162      case 4: case 5: case 6: case 7:   /* ??? (not described in IM III) */
11491163         /* after various tries, I assumed rtc_seconds[4+i] is mapped to rtc_seconds[i] */
1150         if (LOG_RTC)
1164          if (LOG_RTC)
11511165            logerror("RTC clock write, address = %X, data = %X\n", i, (int) rtc_data_byte);
11521166         rtc_seconds[i & 3] = rtc_data_byte;
11531167         break;
r6200r6201
15621576   }
15631577   else
15641578   {
1565      timer_adjust_oneshot(mac_adb_timer, attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.001)), 0);
1579      timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(200)), 0);
15661580   }
15671581}
15681582
r6200r6201
16351649      }
16361650
16371651      // no matter what, generate 8 clocks (should this happen on IDLE?)
1638      timer_adjust_oneshot(mac_adb_timer, attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.001)), 0);
1652      timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
16391653   }
16401654}
16411655
r6200r6201
17081722 *
17091723 */
17101724
1725#define PA6 0x40
1726#define PA4 0x10
1727#define PA2 0x04
1728#define PA1 0x02
1729
17111730static READ8_DEVICE_HANDLER(mac_via_in_a)
17121731{
17131732//   printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
17141733
1715   if ((mac_model == MODEL_MAC_CLASSIC) || (mac_model == MODEL_MAC_LC) ||
1734   if ((mac_model == MODEL_MAC_CLASSIC) ||
17161735       (mac_model == MODEL_MAC_LC_II) || (mac_model == MODEL_MAC_II) ||
1717       (mac_model == MODEL_MAC_II_FDHD) || (mac_model == MODEL_MAC_IIX) ||
1718       (mac_model == MODEL_MAC_SE30))
1736       (mac_model == MODEL_MAC_II_FDHD) || (mac_model == MODEL_MAC_IIX))
17191737   {
17201738      return 0x81;      // bit 0 must be set to avoid attempting to boot from AppleTalk
17211739   }
17221740
1741   if (mac_model == MODEL_MAC_SE30)
1742   {
1743      return 0x81 | PA6;
1744   }
1745
1746   if (mac_model == MODEL_MAC_LC)
1747   {
1748      return 0x81 | PA6 | PA4 | PA2;
1749   }
1750
17231751   if (mac_model == MODEL_MAC_IICI)
17241752   {
1725      return 0xc7;   // 0x40 = IIcx/IIci/IIfx | 0x06 = IIci
1753      return 0xc7;   // 0x40 = IIcx/IIci/IIfx/SE30 | 0x06 = IIci
17261754   }
17271755
1756   if (mac_model == MODEL_MAC_IISI)
1757   {
1758      return 0x81 | PA4 | PA2 | PA1;
1759   }
1760
17281761   if (mac_model == MODEL_MAC_IIFX)
17291762   {
1730      return 0xc3;   // 0x40 = IIcx/IIci/IIfx | 0x02 = IIfx
1763      return 0xc3;   // 0x40 = IIcx/IIci/IIfx/SE30 | 0x02 = IIfx
17311764   }
17321765
17331766   if (mac_model == MODEL_MAC_IICX)
r6200r6201
18271860   {
18281861      // 0x40 = 0 means enable vblank on SE/30     
18291862      mac_se30_vbl_enable = (data & 0x40) ? 0 : 1;
1863
1864      // clear the interrupt if we disabled it
1865      if (!mac_se30_vbl_enable)
1866      {
1867          mac_nubus_slot_interrupt(device->machine, 0xe, 0);
1868      }
18301869   }
18311870
18321871   rtc_write_rTCEnb(data & 0x04);
r6200r6201
19051944   const device_config *via_1 = devtag_get_device(space->machine, "via6522_1");
19061945
19071946   offset >>= 8;
1908   offset &= 0x0f;
1947   offset &= 0x0f;   
19091948
19101949   if (LOG_VIA)
19111950      logerror("mac_via2_w: offset=0x%02x data=0x%08x\n", offset, data);
r6200r6201
19171956
19181957static READ8_DEVICE_HANDLER(mac_via2_in_a)
19191958{
1920   UINT8 result = 0xff;
1959   UINT8 result = 0xc0 | mac_nubus_irq_state;
19211960
1922//   logerror("VIA2 IN A (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
1923
19241961   if ((mac_model == MODEL_MAC_IICI) || (mac_model == MODEL_MAC_IISI))
19251962   {
19261963      result &= ~0x40;   // RBV wants this clear to boot
19271964   }
19281965
1929   if (mac_via2_vbl)
1930   {
1931      result &= ~0x20;   // indicate slot interrupt
1932   }
1933
19341966   return result;
19351967}
19361968
r6200r6201
19381970{
19391971//   logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
19401972
1941   return 0xff;
1973   if (mac_model == MODEL_MAC_SE30)
1974   {
1975      return 0x87;   // bits 3 and 6 are tied low on SE/30
1976   }
1977
1978   return 0xcf;      // indicate no NuBus transaction error
19421979}
19431980
19441981static WRITE8_DEVICE_HANDLER(mac_via2_out_a)
r6200r6201
19531990//   logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
19541991
19551992   // chain 60.15 Hz to VIA1
1956   if ((mac_model != MODEL_MAC_IICI) && (mac_model != MODEL_MAC_IISI))
1957   {
1958      via_ca1_w(via_0, 0, data>>7);
1959   }
1993   via_ca1_w(via_0, 0, data>>7);
19601994}
19611995
19621996/* *************************************************************************
r6200r6201
19992033   }
20002034
20012035   scsi_interrupt = 0;
2036   via2_ca1 = 0;
2037   mac_nubus_irq_state = 0xff;
20022038
20032039   mac_scanline_timer = timer_alloc(machine, mac_scanline_tick, NULL);
20042040   timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0);
r6200r6201
21072143
21082144static const SCSIConfigTable dev_table =
21092145{
2110   1,                                      /* 2 SCSI devices */
2146   2,                                      /* 2 SCSI devices */
21112147   {
2112    { SCSI_ID_5, "harddisk1", SCSI_DEVICE_HARDDISK },  /* SCSI ID 5, using CHD 1, and it's a harddisk */
2113//    { SCSI_ID_6, "harddisk2", SCSI_DEVICE_HARDDISK }   /* SCSI ID 6, using CHD 0, and it's a harddisk */
2148    { SCSI_ID_6, "harddisk1", SCSI_DEVICE_HARDDISK },  /* SCSI ID 6, using disk1, and it's a harddisk */
2149    { SCSI_ID_5, "harddisk2", SCSI_DEVICE_HARDDISK }   /* SCSI ID 5, using disk2, and it's a harddisk */
21142150   }
21152151};
2116                   // 41a868        41a5ac = data copy
2152                   
21172153static const struct NCR5380interface macplus_5380intf =
21182154{
21192155   &dev_table,   // SCSI device table
r6200r6201
21572193   mac_driver_init(machine, MODEL_MAC_LC_II);
21582194}
21592195
2196// make the appletalk init fail instead of hanging on the II FDHD/IIx/IIcx/SE30 ROM
2197void patch_appletalk_iix(running_machine *machine)
2198{
2199   UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2200
2201   ROM[0x2cc94/4] = 0x6bbe709e;   // bmi 82cc54 moveq #-$62, d0
2202   ROM[0x370c/4] = 0x4e714e71;   // nop nop - disable ROM checksum
2203   ROM[0x3710/4] = 0x4e714ed6;   // nop jmp (a6) - disable ROM checksum
2204}
2205
21602206DRIVER_INIT(maciicx)
21612207{
2208   patch_appletalk_iix(machine);
21622209   mac_driver_init(machine, MODEL_MAC_IICX);
21632210}
21642211
21652212DRIVER_INIT(maciifdhd)
21662213{
2214   patch_appletalk_iix(machine);
21672215   mac_driver_init(machine, MODEL_MAC_II_FDHD);
21682216}
21692217
21702218DRIVER_INIT(maciix)
21712219{
2220   patch_appletalk_iix(machine);
21722221   mac_driver_init(machine, MODEL_MAC_IIX);
21732222}
21742223
r6200r6201
21842233
21852234DRIVER_INIT(macse30)
21862235{
2236   patch_appletalk_iix(machine);
21872237   mac_driver_init(machine, MODEL_MAC_SE30);
21882238}
21892239
r6200r6201
21922242   mac_driver_init(machine, MODEL_MAC_CLASSIC_II);
21932243}
21942244
2245void mac_nubus_slot_interrupt(running_machine *machine, UINT8 slot, UINT32 state)
2246{
2247   UINT8 masks[6] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20 };
2248
2249   // NuBus slot must be 9 through E
2250   assert((slot < 9) || (slot > 0xe));
2251
2252   slot -= 9;
2253
2254   if (state)
2255   {
2256      mac_nubus_irq_state &= ~masks[slot];
2257   }
2258   else
2259   {
2260      mac_nubus_irq_state |= masks[slot];
2261   }
2262
2263   if ((mac_nubus_irq_state & 0x3f) != 0x3f)
2264   {
2265      const device_config *via_1 = devtag_get_device(machine, "via6522_1");
2266
2267      via2_ca1 ^= 1;
2268      via_ca1_w(via_1, 0, via2_ca1);
2269   }
2270}
2271
21952272static void mac_vblank_irq(running_machine *machine)
21962273{
21972274   static int irq_count = 0, ca1_data = 0, ca2_data = 0;
r6200r6201
22202297   }
22212298
22222299   /* signal VBlank on CA1 input on the VIA */
2223   if ((mac_model < MODEL_MAC_II) || (mac_model == MODEL_MAC_IICI) || (mac_model != MODEL_MAC_IISI))
2300   if (mac_model < MODEL_MAC_II)
22242301   {
22252302      ca1_data ^= 1;
22262303      via_ca1_w(via_0, 0, ca1_data);
r6200r6201
22372314      rtc_incticks();
22382315   }
22392316
2240   // try generating a slot interrupt every frame too
2241   if (mac_model >= MODEL_MAC_II)
2317   // handle SE/30 vblank IRQ
2318   if (mac_model == MODEL_MAC_SE30)
22422319   {
2243      const device_config *via_1 = devtag_get_device(machine, "via6522_1");
2244     
2245      if (mac_model == MODEL_MAC_SE30)
2320      if (mac_se30_vbl_enable)
22462321      {
2247         if (mac_se30_vbl_enable)
2322         mac_via2_vbl ^= 1;
2323         if (!mac_via2_vbl)
22482324         {
2249            mac_via2_vbl ^= 1;
2250            via_ca1_w(via_1, 0, mac_via2_vbl);
2325            mac_nubus_slot_interrupt(machine, 0xe, 1);
22512326         }
22522327      }
2253      else if ((mac_model != MODEL_MAC_IICI) && (mac_model != MODEL_MAC_IISI))
2254      {
2255         mac_via2_vbl ^= 1;
2256         via_ca1_w(via_1, 0, mac_via2_vbl);
2257      }
22582328   }
22592329}
22602330
2261
2262
22632331static TIMER_CALLBACK(mac_scanline_tick)
22642332{
22652333   int scanline;
src/mess/drivers/mac.c
r6200r6201
3535           PB_EXT  from mouse Y circuitry
3636           PA_EXT  from mouse X circuitry
3737
38RBV @ 43f80, alt 48000
39
3840****************************************************************************/
3941
4042#include "driver.h"
r6200r6201
138140   return 0x17171717;
139141}
140142
141/*
142   RasterOps ColorBoard 264: fixed resolution 640x480 NuBus video card, 1/4/8/16/24 bit color
143   1.5? MB of VRAM (tests up to 0x1fffff), Bt473 RAMDAC, and two custom gate arrays.
144*/
145
146static UINT32 *cb264_vram;
147static UINT32 cb264_mode = 0;    // 0 = true color, 2 = 1bpp monochrome, others unknown
148static UINT32 cb264_palette[256];
149
150static VIDEO_START( cb264 )
151{
152}
153
154static VIDEO_UPDATE( cb264 )
155{
156   UINT32 *scanline, *base;
157   int x, y;
158
159   if (cb264_mode == 0)
160   {
161      for (y = 0; y < 480; y++)
162      {
163         scanline = BITMAP_ADDR32(bitmap, y, 0);
164         base = &cb264_vram[y * 1024];
165         for (x = 0; x < 640; x++)
166         {
167            *scanline++ = *base++;
168         }
169      }
170   }
171   else if (cb264_mode == 2)
172   {
173      UINT8 *vram8 = (UINT8 *)cb264_vram; //, *base8;
174      UINT8 pixels;
175
176      for (y = 0; y < 480; y++)
177      {
178         scanline = BITMAP_ADDR32(bitmap, y, 0);
179         for (x = 0; x < 640; x+=8)
180         {
181            pixels = vram8[(y * 1024) + ((x/8)^3)];
182
183            *scanline++ = cb264_palette[(pixels>>7)^1];
184            *scanline++ = cb264_palette[((pixels>>6)&1)^1];
185            *scanline++ = cb264_palette[((pixels>>5)&1)^1];
186            *scanline++ = cb264_palette[((pixels>>4)&1)^1];
187            *scanline++ = cb264_palette[((pixels>>3)&1)^1];
188            *scanline++ = cb264_palette[((pixels>>2)&1)^1];
189            *scanline++ = cb264_palette[((pixels>>1)&1)^1];
190            *scanline++ = cb264_palette[(pixels&1)^1];
191         }
192      }
193   }
194   else
195   {
196      fatalerror("cb264: unknown video mode %d\n", cb264_mode);
197   }
198
199   return 0;
200}
201
202static WRITE32_HANDLER( cb264_mode_w )
203{
204   cb264_mode = data;
205}
206
207static UINT32 cb264_toggle = 0;
208static READ32_HANDLER( cb264_status_r )
209{
210   cb264_toggle ^= 1;
211   return cb264_toggle;   // probably bit 0 is vblank
212}
213
214static UINT32 cb264_colors[3], cb264_count, cb264_clutoffs;
215static WRITE32_HANDLER( cb264_ramdac_w )
216{
217   if (!offset)
218   {
219      cb264_clutoffs = data>>24;
220      cb264_count = 0;
221   }
222   else
223   {
224      cb264_colors[cb264_count++] = data>>24;
225
226      if (cb264_count == 3)
227      {
228         cb264_count = 0;
229         cb264_clutoffs++;
230         palette_set_color(space->machine, cb264_clutoffs, MAKE_RGB(cb264_colors[0], cb264_colors[1], cb264_colors[2]));
231         cb264_palette[cb264_clutoffs] = MAKE_RGB(cb264_colors[0], cb264_colors[1], cb264_colors[2]);
232      }
233   }
234}
235
236143// IIci/IIsi RAM-Based Video (RBV)
237144
238// 512x384x1 framebuffer at fb008000
239// 640x480x1 framebuffer at fee00000
145// 512x384x1 framebuffer at fb008000?
146// 640x480x1 framebuffer at fee00000?
240147
241148static UINT32 *rbv_vram;
242149
r6200r6201
299206   int data;
300207   const device_config *via_1 = devtag_get_device(space->machine, "via6522_1");
301208
302//   logerror("rbv_r: %x, mask %x\n", offset, mem_mask);
209   logerror("rbv_r: %x, mask %x\n", offset, mem_mask);
303210
304211   if (offset == 1)
305212   {
r6200r6201
328235{
329236   const device_config *via_1 = devtag_get_device(space->machine, "via6522_1");
330237
331//   logerror("rbv_w: %x to offset %x, mask %x\n", data, offset, mem_mask);
238   logerror("rbv_w: %x to offset %x, mask %x\n", data, offset, mem_mask);
332239
333240   offset >>= 8;
334241   offset &= 0x0f;
r6200r6201
384291   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
385292   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
386293   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
294   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
387295
388296   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
389297   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
r6200r6201
394302   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
395303
396304   // RasterOps 264 640x480 fixed-res color video card (8, 16, or 24 bit)
397   AM_RANGE(0xfe000000, 0xfe1fffff) AM_RAM   AM_BASE(&cb264_vram) // supposed to be 1.5 megs of VRAM, but every other word?
398   AM_RANGE(0xfeff6018, 0xfeff601b) AM_WRITE( cb264_mode_w )
399   AM_RANGE(0xfeff6034, 0xfeff6037) AM_READ( cb264_status_r )
400   AM_RANGE(0xfeff7000, 0xfeff7007) AM_WRITE( cb264_ramdac_w )
305   AM_RANGE(0xfe000000, 0xfe1fffff) AM_RAM   AM_BASE(&mac_cb264_vram) // supposed to be 1.5 megs of VRAM, but every other word?
306   AM_RANGE(0xfeff6000, 0xfeff60ff) AM_READWRITE( mac_cb264_r, mac_cb264_w )
307     AM_RANGE(0xfeff7000, 0xfeff7fff) AM_WRITE( mac_cb264_ramdac_w )
401308   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("rops264", 0)
402309ADDRESS_MAP_END
403310
r6200r6201
422329
423330   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
424331   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
332   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
425333
426334   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
427335   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
r6200r6201
436344
437345   // mirror video declaration ROM
438346   AM_RANGE(0xfee00000, 0xfee7ffff) AM_RAM AM_BASE(&rbv_vram)
439   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("user1", 0x78000)
347//   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("user1", 0x78000)
440348ADDRESS_MAP_END
441349
442350static ADDRESS_MAP_START(macse30_map, ADDRESS_SPACE_PROGRAM, 32)
r6200r6201
450358   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
451359   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
452360   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
453   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
361   AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
454362
455363   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
456364
r6200r6201
616524   /* basic machine hardware */
617525   MDRV_CPU_ADD("maincpu", M68020_68851, 7833600*2)
618526   MDRV_CPU_PROGRAM_MAP(macii_map)
527   MDRV_CPU_VBLANK_INT("screen", mac_cb264_vbl)
528
619529   MDRV_SCREEN_ADD("screen", RASTER)
620   MDRV_SCREEN_REFRESH_RATE(60.15)
621   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260))
622   MDRV_QUANTUM_TIME(HZ(60))
530   // dot clock, htotal, hstart, hend, vtotal, vstart, vend
531   MDRV_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
623532
624533   MDRV_MACHINE_START(macscsi)
625534   MDRV_MACHINE_RESET( mac )
r6200r6201
631540   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
632541   MDRV_PALETTE_LENGTH(256)
633542
634   MDRV_VIDEO_START(cb264)
635   MDRV_VIDEO_UPDATE(cb264)
543   MDRV_VIDEO_START(mac_cb264)
544   MDRV_VIDEO_UPDATE(mac_cb264)
636545
637546   /* sound hardware */
638547   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team