Previous 15994 Revisions Next

r6684 Thursday 17th December, 2009 at 04:03:31 UTC by R. Belmont
[MAC] Post-u3 banking fixes, moved most state to driver data, improved ADB
responsiveness when switching between keyboard/mouse, preliminary
Portable/PB100 support, and various cleanup.
[src/mess]messdriv.c
[src/mess/drivers]mac.c
[src/mess/includes]mac.h
[src/mess/machine]mac.c

src/mess/includes/mac.h
r6683r6684
2323   MODEL_MAC_PORTABLE,
2424   MODEL_MAC_PB100,
2525
26   MODEL_MAC_II,      // Mac II class machines
26   MODEL_MAC_II,      // Mac II class 68020/030 machines
2727   MODEL_MAC_II_FDHD,
2828   MODEL_MAC_IIX,
2929   MODEL_MAC_IICX,
r6683r6684
3232   MODEL_MAC_IIFX,
3333   MODEL_MAC_SE30,
3434
35   MODEL_MAC_LC,      // LC class machines, generally all with the same memory map and the V8 gate array
35   MODEL_MAC_LC,      // LC class 68030 machines, generally using a V8 or compatible gate array
3636   MODEL_MAC_LC_II,
3737   MODEL_MAC_LC_III,
3838   MODEL_MAC_CLASSIC_II,
39   MODEL_MAC_TV,
3940   MODEL_MAC_COLOR_CLASSIC,
4041
42   MODEL_MAC_PB140,   // 68030 PowerBooks
43   MODEL_MAC_PB170,
44   MODEL_MAC_PB145,
45   MODEL_MAC_PB160,
46   MODEL_MAC_PB180,
47   MODEL_MAC_PB165c,
48   MODEL_MAC_PB180c,
49   MODEL_MAC_PB145b,
50   MODEL_MAC_PB165,
51   MODEL_MAC_PB150,
52
53   MODEL_MAC_PBDUO_210,   // 68030 PowerBook Duos
54   MODEL_MAC_PBDUO_230,
55   MODEL_MAC_PBDUO_250,
56   MODEL_MAC_PBDUO_270c,
57
58   MODEL_MAC_QUADRA_700,   // 68(LC)040 desktops
59   MODEL_MAC_QUADRA_900,
60   MODEL_MAC_QUADRA_950,
61   MODEL_MAC_QUADRA_660AV,
62   MODEL_MAC_QUADRA_840AV,
63   MODEL_MAC_QUADRA_605,
64   MODEL_MAC_QUADRA_610,
65   MODEL_MAC_QUADRA_630,
66   MODEL_MAC_QUADRA_650,
67
68   MODEL_MAC_PB550c,   // 68(LC)040 PowerBooks
69   MODEL_MAC_PB520,
70   MODEL_MAC_PB520c,
71   MODEL_MAC_PB540,
72   MODEL_MAC_PB540c,
73   MODEL_MAC_PB190,
74   MODEL_MAC_PB190cs,
75
4176   MODEL_MAC_POWERMAC_6100   // original PowerMac
4277} mac_model_t;
4378
r6683r6684
74109DRIVER_INIT(maclc2);
75110DRIVER_INIT(maclc3);
76111DRIVER_INIT(macpm6100);
112DRIVER_INIT(macprtb);
113DRIVER_INIT(macpb100);
77114
78115READ16_HANDLER ( mac_via_r );
79116WRITE16_HANDLER ( mac_via_w );
r6683r6684
129166
130167void mac_sh_updatebuffer(const device_config *device);
131168
169/* Mac driver data */
132170
171typedef struct
172{
173   mac_model_t mac_model;
174
175   UINT32 mac_overlay;
176   int mac_drive_select;
177   int mac_scsiirq_enable;
178
179   UINT32 mac_via2_vbl;
180   UINT32 mac_se30_vbl_enable;
181   UINT8 mac_nubus_irq_state;
182   UINT8 via2_ca1;
183
184   /* used to store the reply to most keyboard commands */
185   int keyboard_reply;
186
187   /* Keyboard communication in progress? */
188   int kbd_comm;
189   int kbd_receive;
190   /* timer which is used to time out inquiry */
191   emu_timer *inquiry_timeout;
192
193   int kbd_shift_reg;
194   int kbd_shift_count;
195
196   /* keyboard matrix to detect transition */
197   int key_matrix[7];
198
199   /* keycode buffer (used for keypad/arrow key transition) */
200   int keycode_buf[2];
201   int keycode_buf_index;
202
203   int mouse_bit_x;
204   int mouse_bit_y;
205
206
207   /* state of rTCEnb and rTCClk lines */
208   UINT8 rtc_rTCEnb;
209   UINT8 rtc_rTCClk;
210
211   /* serial transmit/receive register : bits are shifted in/out of this byte */
212   UINT8 rtc_data_byte;
213   /* serial transmitted/received bit count */
214   UINT8 rtc_bit_count;
215   /* direction of the current transfer (0 : VIA->RTC, 1 : RTC->VIA) */
216   UINT8 rtc_data_dir;
217   /* when rtc_data_dir == 1, state of rTCData as set by RTC (-> data bit seen by VIA) */
218   UINT8 rtc_data_out;
219
220   /* set to 1 when command in progress */
221   UINT8 rtc_cmd;
222
223   /* write protect flag */
224   UINT8 rtc_write_protect;
225
226   /* internal seconds register */
227   UINT8 rtc_seconds[/*8*/4];
228   /* 20-byte long PRAM, or 256-byte long XPRAM */
229   UINT8 rtc_ram[256];
230   /* current extended address and RTC state */
231   UINT8 rtc_xpaddr;
232   UINT8 rtc_state;
233
234   // Mac ADB state
235   INT32 adb_irq_pending, adb_waiting_cmd, adb_datasize, adb_buffer[257];
236   INT32 adb_state, adb_command, adb_send, adb_timer_ticks, adb_extclock, adb_direction;
237   INT32 adb_listenreg, adb_listenaddr, adb_last_talk, adb_srq_switch;
238
239   // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
240   UINT8 pm_data_send, pm_data_recv, pm_ack, pm_req;
241
242   // Apple Sound Chip
243   UINT8 mac_asc_regs[0x2000];
244   INT16 xfersamples[0x800];
245} mac_state;
246
133247#endif /* MAC_H_ */
134248
135249
src/mess/messdriv.c
r6683r6684
336336    DRIVER( macsefd )   /* 1988 Apple Macintosh SE (FDHD) */
337337    DRIVER( mac2fdhd )  /* 1988 Apple Macintosh II (FDHD) */
338338    DRIVER( maciix )    /* 1988 Apple Macintosh IIx */
339    DRIVER( macprtb )   /* 1989 Apple Macintosh Portable */
339340    DRIVER( macse30 )   /* 1989 Apple Macintosh SE/30 */
340341    DRIVER( maciicx )   /* 1989 Apple Macintosh IIcx */
341342    DRIVER( maciici )   /* 1989 Apple Macintosh IIci */
342343    DRIVER( macclasc )  /* 1990 Apple Macintosh Classic                     */
343344    DRIVER( maclc ) /* 1990 Apple Macintosh LC */
344345    DRIVER( maciisi )   /* 1990 Apple Macintosh IIsi */
346    DRIVER( macpb100 )  /* 1991 Apple Macintosh PowerBook 100 */
345347    DRIVER( macclas2 )  /* 1991 Apple Macintosh Classic II */
346348    DRIVER( maclc2 )    /* 1991 Apple Macintosh LC II */
347349    DRIVER( maclc3 )    /* 1993 Apple Macintosh LC III */
src/mess/machine/mac.c
r6683r6684
1010    R. Belmont
1111
1212    Mac Model Feature Summary:
13
1413                                CPU             FDC     Kbd/Mouse  PRAM   Video
1514         - Mac 128k             68k             IWM     orig       orig   Original
1615         - Mac 512k             68k             IWM     orig       orig   Original
17         - Mac 512ke        68k             IWM     orig       orig   Original
18         - Mac Plus         68k             IWM     orig       ext    Original
16         - Mac 512ke       68k             IWM     orig       orig   Original
17         - Mac Plus       68k             IWM     orig       ext    Original
1918         - Mac SE               68k             IWM     MacII ADB  ext    Original
2019         - Mac Classic          68k             SWIM    MacII ADB  ext    Original
21         - Mac Portable         68k (16 MHz)    SWIM    ADB-PMU    PMU    640x480 B&W
22         - PowerBook 100        68k (16 MHz)    SWIM    ADB-PMU    PMU    640x480 B&W
20         - Mac Portable         68k (16 MHz)    SWIM    ADB-PMU    PMU    640x400 B&W
21         - PowerBook 100        68k (16 MHz)    SWIM    ADB-PMU    PMU    640x400 B&W
2322         - Mac II               020             IWM     MacII ADB  ext    NuBus card
2423         - Mac IIx              030             SWIM    MacII ADB  ext    NuBus card
2524         - Mac IIfx             030             SWIM    ADB-IOP    ext    NuBus card
2625         - Mac SE/30            030             SWIM    MacII ADB  ext    Internal fake NuBus card
2726         - Mac IIcx             030             SWIM    ADB-CUDA   ext    NuBus card
28         - Mac IIci             030             SWIM    ADB-CUDA   ext    Internal "RBV" type
27         - Mac IIci             030             SWIM    MacII ADB  ext    Internal "RBV" type
28         - Mac IIsi             030             SWIM    Egret ADB  ext    Internal "RBV" type
29         - Mac IIvx/IIvi        030             SWIM    Egret ADB  ext    Internal "VASP" type
2930         - Mac LC               020             SWIM    Egret ADB  ext    Internal "V8" type
3031         - Mac LC II            030             SWIM    Egret ADB  ext    Internal "V8" type
31         - Mac LC III           030             SWIM    Egret ADB  ext    Internal "V8" type
32         - Mac LC III           030             SWIM    Egret ADB  ext    Internal "Sonora" type
3233
3334    Notes:
3435        - The Mac Plus boot code seems to check to see the extent of ROM
r6683r6684
7677#include "debug/debugcpu.h"
7778#include "devices/messram.h"
7879
79#define ADB_IS_BITBANG   (mac_model >= MODEL_MAC_SE && mac_model <= MODEL_MAC_CLASSIC) || (mac_model >= MODEL_MAC_II && mac_model <= MODEL_MAC_IICX) || (mac_model == MODEL_MAC_SE30)
80#define ADB_IS_EGRET   (mac_model >= MODEL_MAC_LC && mac_model <= MODEL_MAC_COLOR_CLASSIC) || (mac_model == MODEL_MAC_IICI) || (mac_model == MODEL_MAC_IISI)
80#define ADB_IS_BITBANG   (mac->mac_model >= MODEL_MAC_SE && mac->mac_model <= MODEL_MAC_CLASSIC) || (mac->mac_model >= MODEL_MAC_II && mac->mac_model <= MODEL_MAC_IICX) || (mac->mac_model == MODEL_MAC_SE30)
81#define ADB_IS_EGRET   (mac->mac_model >= MODEL_MAC_LC && mac->mac_model <= MODEL_MAC_COLOR_CLASSIC) || (mac->mac_model == MODEL_MAC_IICI) || (mac->mac_model == MODEL_MAC_IISI)
82#define ADB_IS_PM   (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
8183
8284#ifdef MAME_DEBUG
8385#define LOG_VIA         0
r6683r6684
162164   DEVCB_LINE(mac_via2_irq)
163165};
164166
165static UINT32 mac_overlay = 0;
166mac_model_t mac_model;
167static int mac_drive_select = 0;
168static int mac_scsiirq_enable = 0;
169
170static UINT32 mac_via2_vbl = 0, mac_se30_vbl_enable = 0;
171static UINT8 mac_nubus_irq_state, via2_ca1 = 0;
172
173167// returns non-zero if this Mac has ADB
174static int has_adb(void)
168static int has_adb(mac_state *mac)
175169{
176   return mac_model >= MODEL_MAC_SE;
170   return mac->mac_model >= MODEL_MAC_SE;
177171}
178172
179173// handle disk enable lines
180174void mac_fdc_set_enable_lines(const device_config *device,int enable_mask)
181175{
182   if (mac_model != MODEL_MAC_SE)
176   mac_state *mac = device->machine->driver_data;
177
178   if (mac->mac_model != MODEL_MAC_SE)
183179   {
184180      sony_set_enable_lines(device,enable_mask);
185181   }
r6683r6684
187183   {
188184      if (enable_mask)
189185      {
190         sony_set_enable_lines(device,mac_drive_select ? 1 : 2);
186         sony_set_enable_lines(device,mac->mac_drive_select ? 1 : 2);
191187      }
192188      else
193189      {
r6683r6684
197193}
198194
199195static void mac_install_memory(running_machine *machine, offs_t memory_begin, offs_t memory_end,
200   offs_t memory_size, void *memory_data, int is_rom, int bank)
196   offs_t memory_size, void *memory_data, int is_rom, const char *bank)
201197{
202198   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
203199   offs_t memory_mask;
204   char bank_name[10];
200
205201   memory_size = MIN(memory_size, (memory_end + 1 - memory_begin));
206202   memory_mask = memory_size - 1;
207203
208   sprintf(bank_name,"bank%d",bank);
209   if (is_rom) {
210      memory_install_read_bank(space, memory_begin,memory_end, memory_mask, 0, bank_name);
211      memory_unmap_write(space, memory_begin,memory_end, memory_mask, 0);
212   } else {
213      memory_install_readwrite_bank(space, memory_begin,memory_end, memory_mask, 0, bank_name);
204   if (!is_rom)
205   {
206      memory_install_readwrite_bank(space, memory_begin, memory_end, memory_mask, 0, bank);
214207   }
215   memory_set_bankptr(machine,bank_name, memory_data);
208   else
209   {
210      memory_unmap_write(space, memory_begin, memory_end, memory_mask, 0);
211      memory_install_read_bank(space, memory_begin, memory_end, memory_mask, 0, bank);
212   }
216213
214   memory_set_bankptr(machine, bank, memory_data);
215
217216   if (1) //LOG_MEMORY)
218217   {
219      logerror("mac_install_memory(): bank=%d range=[0x%06x...0x%06x] mask=0x%06x ptr=0x%p\n",
218      logerror("mac_install_memory(): bank=%s range=[0x%06x...0x%06x] mask=0x%06x ptr=0x%p\n",
220219         bank, memory_begin, memory_end, memory_mask, memory_data);
221220   }
222221}
r6683r6684
231230
232231static void mac_field_interrupts(running_machine *machine)
233232{
233   mac_state *mac = machine->driver_data;
234
234235   int take_interrupt = -1;
235236
236   if (mac_model < MODEL_MAC_II)
237   if (mac->mac_model < MODEL_MAC_II)
237238   {
238239      if ((scc_interrupt) || (scsi_interrupt))
239240      {
r6683r6684
244245         take_interrupt = 1;
245246      }
246247   }
247   else if (mac_model < MODEL_MAC_POWERMAC_6100)
248   else if (mac->mac_model < MODEL_MAC_POWERMAC_6100)
248249   {
249250      if (scc_interrupt)
250251      {
r6683r6684
330331   offs_t memory_size;
331332   UINT8 *memory_data;
332333   int is_rom;
334   mac_state *mac = machine->driver_data;
333335
334336   /* normalize overlay */
335337   overlay = overlay ? TRUE : FALSE;
336338
337   if (overlay != mac_overlay)
339   if (overlay != mac->mac_overlay)
338340   {
339341      /* set up either main RAM area or ROM mirror at 0x000000-0x3fffff */
340342      if (overlay)
341343      {
342344         /* ROM mirror */
343         memory_size = memory_region_length(machine, "user1");
344         memory_data = memory_region(machine, "user1");
345         memory_size = memory_region_length(machine, "bootrom");
346         memory_data = memory_region(machine, "bootrom");
345347         is_rom = TRUE;
346348
347349         /* HACK! - copy in the initial reset/stack */
r6683r6684
356358      }
357359
358360      /* install the memory */
359      if (((mac_model >= MODEL_MAC_LC) && (mac_model <= MODEL_MAC_COLOR_CLASSIC))|| (mac_model == MODEL_MAC_LC_II) || (mac_model == MODEL_MAC_POWERMAC_6100) || (mac_model == MODEL_MAC_CLASSIC_II))
361      if (((mac->mac_model >= MODEL_MAC_LC) && (mac->mac_model <= MODEL_MAC_COLOR_CLASSIC))|| (mac->mac_model == MODEL_MAC_LC_II) || (mac->mac_model == MODEL_MAC_POWERMAC_6100) || (mac->mac_model == MODEL_MAC_CLASSIC_II))
360362      {
361         mac_install_memory(machine, 0x00000000, memory_size-1, memory_size, memory_data, is_rom, 1);
363         mac_install_memory(machine, 0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1");
362364      }
363      else if ((mac_model == MODEL_MAC_IICI) || (mac_model == MODEL_MAC_IISI))
365      else if ((mac->mac_model == MODEL_MAC_IICI) || (mac->mac_model == MODEL_MAC_IISI))
364366      {
365367         // ROM is OK to flood to 3fffffff
366368         if (is_rom)
367369         {
368            mac_install_memory(machine, 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, 1);
370            mac_install_memory(machine, 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1");
369371         }
370372         else   // RAM: be careful not to populate ram B with a mirror or the ROM will get confused
371373         {
372            mac_install_memory(machine, 0x00000000, 0x03ffffff, memory_size, memory_data, is_rom, 1);
374            mac_install_memory(machine, 0x00000000, 0x03ffffff, memory_size, memory_data, is_rom, "bank1");
373375         }
374376      }
375      else if ((mac_model == MODEL_MAC_CLASSIC_II) || ((mac_model >= MODEL_MAC_II) && (mac_model <= MODEL_MAC_SE30)))
377      else if ((mac->mac_model == MODEL_MAC_PORTABLE) || (mac->mac_model == MODEL_MAC_PB100))
376378      {
377         mac_install_memory(machine, 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, 1);
379         mac_install_memory(machine, 0x000000, 0x8fffff, memory_size, memory_data, is_rom, "bank1");
378380      }
379      else if (mac_model == MODEL_MAC_LC_III)   // up to 36 MB
381      else if ((mac->mac_model == MODEL_MAC_CLASSIC_II) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30)))
380382      {
381         mac_install_memory(machine, 0x00000000, 0x023fffff, memory_size, memory_data, is_rom, 1);
383         mac_install_memory(machine, 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1");
382384      }
385      else if (mac->mac_model == MODEL_MAC_LC_III)   // up to 36 MB
386      {
387         mac_install_memory(machine, 0x00000000, 0x023fffff, memory_size, memory_data, is_rom, "bank1");
388      }
383389      else
384390      {
385         mac_install_memory(machine, 0x00000000, 0x003fffff, memory_size, memory_data, is_rom, 1);
391         mac_install_memory(machine, 0x00000000, 0x003fffff, memory_size, memory_data, is_rom, "bank1");
386392      }
387393
388      mac_overlay = overlay;
394      mac->mac_overlay = overlay;
389395
390396      if (LOG_GENERAL)
391397         logerror("set_memory_overlay: overlay=%i\n", overlay);
r6683r6684
417423 * * IM IV-250
418424 * *************************************************************************/
419425
420/* used to store the reply to most keyboard commands */
421static int keyboard_reply;
422
423/* Keyboard communication in progress? */
424static int kbd_comm;
425static int kbd_receive;
426/* timer which is used to time out inquiry */
427static emu_timer *inquiry_timeout;
428
429static int kbd_shift_reg;
430static int kbd_shift_count;
431
432426/*
433427    scan_keyboard()
434428
435429    scan the keyboard, and returns key transition code (or NULL ($7B) if none)
436430*/
437431
438/* keyboard matrix to detect transition */
439static int key_matrix[7];
440
441/* keycode buffer (used for keypad/arrow key transition) */
442static int keycode_buf[2];
443static int keycode_buf_index;
444
445432static int scan_keyboard(running_machine *machine)
446433{
447434   int i, j;
448435   int keybuf;
449436   int keycode;
450437   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6" };
438   mac_state *mac = machine->driver_data;
451439
452   if (keycode_buf_index)
440   if (mac->keycode_buf_index)
453441   {
454      return keycode_buf[--keycode_buf_index];
442      return mac->keycode_buf[--mac->keycode_buf_index];
455443   }
456444
457445   for (i=0; i<7; i++)
458446   {
459447      keybuf = input_port_read(machine, keynames[i]);
460448
461      if (keybuf != key_matrix[i])
449      if (keybuf != mac->key_matrix[i])
462450      {
463451         /* if state has changed, find first bit which has changed */
464452         if (LOG_KEYBOARD)
r6683r6684
466454
467455         for (j=0; j<16; j++)
468456         {
469            if (((keybuf ^ key_matrix[i]) >> j) & 1)
457            if (((keybuf ^ mac->key_matrix[i]) >> j) & 1)
470458            {
471               /* update key_matrix */
472               key_matrix[i] = (key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j));
459               /* update mac->key_matrix */
460               mac->key_matrix[i] = (mac->key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j));
473461
474462               if (i < 4)
475463               {
r6683r6684
493481                     if (keybuf & (1 << j))
494482                     {
495483                        /* key down */
496                        if (! (key_matrix[3] & 0x0100))
484                        if (! (mac->key_matrix[3] & 0x0100))
497485                        {
498486                           /* shift key is really up */
499                           keycode_buf[0] = keycode;
500                           keycode_buf[1] = 0x79;
501                           keycode_buf_index = 2;
487                           mac->keycode_buf[0] = keycode;
488                           mac->keycode_buf[1] = 0x79;
489                           mac->keycode_buf_index = 2;
502490                           return 0x71;   /* "presses" shift down */
503491                        }
504492                     }
505493                     else
506494                     {   /* key up */
507                        if (! (key_matrix[3] & 0x0100))
495                        if (! (mac->key_matrix[3] & 0x0100))
508496                        {
509497                           /* shift key is really up */
510                           keycode_buf[0] = keycode | 0x80;;
511                           keycode_buf[1] = 0x79;
512                           keycode_buf_index = 2;
498                           mac->keycode_buf[0] = keycode | 0x80;;
499                           mac->keycode_buf[1] = 0x79;
500                           mac->keycode_buf_index = 2;
513501                           return 0xF1;   /* "releases" shift */
514502                        }
515503                     }
r6683r6684
520508                     /* key up */
521509                     keycode |= 0x80;
522510                  }
523                  keycode_buf[0] = keycode;
524                  keycode_buf_index = 1;
511                  mac->keycode_buf[0] = keycode;
512                  mac->keycode_buf_index = 1;
525513                  return 0x79;
526514               }
527515               else /* i == 6 */
r6683r6684
533521                     /* key up */
534522                     keycode |= 0x80;
535523                  }
536                  keycode_buf[0] = keycode;
537                  keycode_buf_index = 1;
524                  mac->keycode_buf[0] = keycode;
525                  mac->keycode_buf_index = 1;
538526                  return 0x79;
539527               }
540528            }
r6683r6684
548536/*
549537    power-up init
550538*/
551static void keyboard_init(void)
539static void keyboard_init(mac_state *mac)
552540{
553541   int i;
554542
555543   /* init flag */
556   kbd_comm = FALSE;
557   kbd_receive = FALSE;
558   kbd_shift_reg=0;
559   kbd_shift_count=0;
544   mac->kbd_comm = FALSE;
545   mac->kbd_receive = FALSE;
546   mac->kbd_shift_reg=0;
547   mac->kbd_shift_count=0;
560548
561549   /* clear key matrix */
562550   for (i=0; i<7; i++)
563551   {
564      key_matrix[i] = 0;
552      mac->key_matrix[i] = 0;
565553   }
566554
567555   /* purge transmission buffer */
568   keycode_buf_index = 0;
556   mac->keycode_buf_index = 0;
569557}
570558
571559/******************* Keyboard <-> VIA communication ***********************/
r6683r6684
574562{
575563   int i;
576564   const device_config *via_0 = devtag_get_device(machine, "via6522_0");
565   mac_state *mac = machine->driver_data;
577566
578   if (kbd_comm == TRUE)
567   if (mac->kbd_comm == TRUE)
579568   {
580569      for (i=0; i<8; i++)
581570      {
582571         /* Put data on CB2 if we are sending*/
583         if (kbd_receive == FALSE)
584            via_cb2_w(via_0, 0, kbd_shift_reg&0x80?1:0);
585         kbd_shift_reg <<= 1;
572         if (mac->kbd_receive == FALSE)
573            via_cb2_w(via_0, 0, mac->kbd_shift_reg&0x80?1:0);
574         mac->kbd_shift_reg <<= 1;
586575         via_cb1_w(via_0, 0, 0);
587576         via_cb1_w(via_0, 0, 1);
588577      }
589      if (kbd_receive == TRUE)
578      if (mac->kbd_receive == TRUE)
590579      {
591         kbd_receive = FALSE;
580         mac->kbd_receive = FALSE;
592581         /* Process the command received from mac */
593         keyboard_receive(machine, kbd_shift_reg & 0xff);
582         keyboard_receive(machine, mac->kbd_shift_reg & 0xff);
594583      }
595584      else
596585      {
597586         /* Communication is over */
598         kbd_comm = FALSE;
587         mac->kbd_comm = FALSE;
599588      }
600589   }
601590}
602591
603592static void kbd_shift_out(running_machine *machine, int data)
604593{
605   if (kbd_comm == TRUE)
594   mac_state *mac = machine->driver_data;
595
596   if (mac->kbd_comm == TRUE)
606597   {
607      kbd_shift_reg = data;
598      mac->kbd_shift_reg = data;
608599      timer_set(machine, ATTOTIME_IN_MSEC(1), NULL, 0, kbd_clock);
609600   }
610601}
611602
612603static WRITE8_DEVICE_HANDLER(mac_via_out_cb2)
613604{
614   if (kbd_comm == FALSE && data == 0)
605   mac_state *mac = device->machine->driver_data;
606
607   if (mac->kbd_comm == FALSE && data == 0)
615608   {
616609      /* Mac pulls CB2 down to initiate communication */
617      kbd_comm = TRUE;
618      kbd_receive = TRUE;
610      mac->kbd_comm = TRUE;
611      mac->kbd_receive = TRUE;
619612      timer_set(device->machine, ATTOTIME_IN_USEC(100), NULL, 0, kbd_clock);
620613   }
621   if (kbd_comm == TRUE && kbd_receive == TRUE)
614   if (mac->kbd_comm == TRUE && mac->kbd_receive == TRUE)
622615   {
623616      /* Shift in what mac is sending */
624      kbd_shift_reg = (kbd_shift_reg & ~1) | data;
617      mac->kbd_shift_reg = (mac->kbd_shift_reg & ~1) | data;
625618   }
626619}
627620
r6683r6684
640633*/
641634static void keyboard_receive(running_machine *machine, int val)
642635{
636   mac_state *mac = machine->driver_data;
637
643638   switch (val)
644639   {
645640   case 0x10:
r6683r6684
647642      if (LOG_KEYBOARD)
648643         logerror("keyboard command : inquiry\n");
649644
650      keyboard_reply = scan_keyboard(machine);
651      if (keyboard_reply == 0x7B)
645      mac->keyboard_reply = scan_keyboard(machine);
646      if (mac->keyboard_reply == 0x7B)
652647      {
653648         /* if NULL, wait until key pressed or timeout */
654         timer_adjust_oneshot(inquiry_timeout,
649         timer_adjust_oneshot(mac->inquiry_timeout,
655650            attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0);
656651      }
657652      break;
r6683r6684
675670         /* clear key matrix */
676671         for (i=0; i<7; i++)
677672         {
678            key_matrix[i] = 0;
673            mac->key_matrix[i] = 0;
679674         }
680675
681676         /* purge transmission buffer */
682         keycode_buf_index = 0;
677         mac->keycode_buf_index = 0;
683678      }
684679
685680      /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8
r6683r6684
715710 * Mouse
716711 * *************************************************************************/
717712
718static int mouse_bit_x = 0, mouse_bit_y = 0;
719
720713static void mouse_callback(running_machine *machine)
721714{
722715   static int   last_mx = 0, last_my = 0;
723716   static int   count_x = 0, count_y = 0;
717   int      new_mx, new_my;
718   int      x_needs_update = 0, y_needs_update = 0;
719   mac_state *mac = machine->driver_data;
724720
725   int         new_mx, new_my;
726   int         x_needs_update = 0, y_needs_update = 0;
727
728721   new_mx = input_port_read(machine, "MOUSE1");
729722   new_my = input_port_read(machine, "MOUSE2");
730723
r6683r6684
765758      if (count_x < 0)
766759      {
767760         count_x++;
768         mouse_bit_x = 0;
761         mac->mouse_bit_x = 0;
769762      }
770763      else
771764      {
772765         count_x--;
773         mouse_bit_x = 1;
766         mac->mouse_bit_x = 1;
774767      }
775768      x_needs_update = 1;
776769   }
r6683r6684
779772      if (count_y < 0)
780773      {
781774         count_y++;
782         mouse_bit_y = 1;
775         mac->mouse_bit_y = 1;
783776      }
784777      else
785778      {
786779         count_y--;
787         mouse_bit_y = 0;
780         mac->mouse_bit_y = 0;
788781      }
789782      y_needs_update = 1;
790783   }
r6683r6684
848841{
849842   int reg = (offset>>3) & 0xf;
850843
851//  logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask);
844//   logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask);
852845
853846   if ((reg == 6) && (offset == 0x130))
854847   {
r6683r6684
908901{
909902   int reg = (offset>>3) & 0xf;
910903
911//  logerror("macplus_scsi_w: data %x offset %x mask %x\n", data, offset, mem_mask);
904//   logerror("macplus_scsi_w: data %x offset %x mask %x\n", data, offset, mem_mask);
912905
913906   if ((reg == 0) && (offset == 0x100))
914907   {
r6683r6684
922915{
923916   int reg = (offset>>3) & 0xf;
924917
925//  logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(space->cpu));
918//   logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(space->cpu));
926919
927920   if ((reg == 0) && (offset == 0x100))
928921   {
r6683r6684
934927
935928static void mac_scsi_irq(running_machine *machine, int state)
936929{
937   if ((mac_scsiirq_enable) && ((mac_model == MODEL_MAC_SE) || (mac_model == MODEL_MAC_CLASSIC)))
930   mac_state *mac = machine->driver_data;
931
932   if ((mac->mac_scsiirq_enable) && ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC)))
938933   {
939934      printf("SCSI IRQ -> %d\n", state);
940935      scsi_interrupt = state;
r6683r6684
10171012 * accessed through the VIA
10181013 * *************************************************************************/
10191014
1020/* state of rTCEnb and rTCClk lines */
1021static unsigned char rtc_rTCEnb;
1022static unsigned char rtc_rTCClk;
1023
1024/* serial transmit/receive register : bits are shifted in/out of this byte */
1025static unsigned char rtc_data_byte;
1026/* serial transmitted/received bit count */
1027static unsigned char rtc_bit_count;
1028/* direction of the current transfer (0 : VIA->RTC, 1 : RTC->VIA) */
1029static unsigned char rtc_data_dir;
1030/* when rtc_data_dir == 1, state of rTCData as set by RTC (-> data bit seen by VIA) */
1031static unsigned char rtc_data_out;
1032
1033/* set to 1 when command in progress */
1034static unsigned char rtc_cmd;
1035
1036/* write protect flag */
1037static unsigned char rtc_write_protect;
1038
1039/* internal seconds register */
1040static unsigned char rtc_seconds[/*8*/4];
1041/* 20-byte long PRAM, or 256-byte long XPRAM */
1042static unsigned char rtc_ram[256];
1043/* current extended address and RTC state */
1044static unsigned char rtc_xpaddr, rtc_state;
1045
10461015/* a few protos */
1047static void rtc_write_rTCEnb(int data);
1048static void rtc_execute_cmd(int data);
1016static void rtc_write_rTCEnb(mac_state *mac, int data);
1017static void rtc_execute_cmd(mac_state *mac, int data);
10491018
10501019enum
10511020{
r6683r6684
10561025};
10571026
10581027/* init the rtc core */
1059static void rtc_init(void)
1028static void rtc_init(mac_state *mac)
10601029{
1061   rtc_rTCClk = 0;
1030   mac->rtc_rTCClk = 0;
10621031
1063   rtc_write_protect = 0;
1064   rtc_rTCEnb = 0;
1065   rtc_write_rTCEnb(1);
1066   rtc_state = RTC_STATE_NORMAL;
1032   mac->rtc_write_protect = 0;
1033   mac->rtc_rTCEnb = 0;
1034   rtc_write_rTCEnb(mac, 1);
1035   mac->rtc_state = RTC_STATE_NORMAL;
10671036}
10681037
10691038/* write the rTCEnb state */
1070static void rtc_write_rTCEnb(int val)
1039static void rtc_write_rTCEnb(mac_state *mac, int val)
10711040{
1072   if (val && (! rtc_rTCEnb))
1041   if (val && (! mac->rtc_rTCEnb))
10731042   {
10741043      /* rTCEnb goes high (inactive) */
1075      rtc_rTCEnb = 1;
1044      mac->rtc_rTCEnb = 1;
10761045      /* abort current transmission */
1077      rtc_data_byte = rtc_bit_count = rtc_data_dir = rtc_data_out = 0;
1078      rtc_state = RTC_STATE_NORMAL;
1046      mac->rtc_data_byte = mac->rtc_bit_count = mac->rtc_data_dir = mac->rtc_data_out = 0;
1047      mac->rtc_state = RTC_STATE_NORMAL;
10791048   }
1080   else if ((! val) && rtc_rTCEnb)
1049   else if ((! val) && mac->rtc_rTCEnb)
10811050   {
10821051      /* rTCEnb goes low (active) */
1083      rtc_rTCEnb = 0;
1052      mac->rtc_rTCEnb = 0;
10841053      /* abort current transmission */
1085      rtc_data_byte = rtc_bit_count = rtc_data_dir = rtc_data_out = 0;
1086      rtc_state = RTC_STATE_NORMAL;
1054      mac->rtc_data_byte = mac->rtc_bit_count = mac->rtc_data_dir = mac->rtc_data_out = 0;
1055      mac->rtc_state = RTC_STATE_NORMAL;
10871056   }
10881057}
10891058
10901059/* shift data (called on rTCClk high-to-low transition (?)) */
1091static void rtc_shift_data(int data)
1060static void rtc_shift_data(mac_state *mac, int data)
10921061{
1093   if (rtc_rTCEnb)
1062   if (mac->rtc_rTCEnb)
10941063      /* if enable line inactive (high), do nothing */
10951064      return;
10961065
1097   if (rtc_data_dir)
1066   if (mac->rtc_data_dir)
10981067   {   /* RTC -> VIA transmission */
1099      rtc_data_out = (rtc_data_byte >> --rtc_bit_count) & 0x01;
1068      mac->rtc_data_out = (mac->rtc_data_byte >> --mac->rtc_bit_count) & 0x01;
11001069      if (LOG_RTC)
1101         logerror("RTC shifted new data %d\n", rtc_data_out);
1070         logerror("RTC shifted new data %d\n", mac->rtc_data_out);
11021071   }
11031072   else
11041073   {   /* VIA -> RTC transmission */
1105      rtc_data_byte = (rtc_data_byte << 1) | (data ? 1 : 0);
1074      mac->rtc_data_byte = (mac->rtc_data_byte << 1) | (data ? 1 : 0);
11061075
1107      if (++rtc_bit_count == 8)
1076      if (++mac->rtc_bit_count == 8)
11081077      {   /* if one byte received, send to command interpreter */
1109         rtc_execute_cmd(rtc_data_byte);
1078         rtc_execute_cmd(mac, mac->rtc_data_byte);
11101079      }
11111080   }
11121081}
11131082
11141083/* called every second, to increment the Clock count */
1115static void rtc_incticks(void)
1084static void rtc_incticks(mac_state *mac)
11161085{
11171086   if (LOG_RTC)
11181087      logerror("rtc_incticks called\n");
11191088
1120   if (++rtc_seconds[0] == 0)
1121      if (++rtc_seconds[1] == 0)
1122         if (++rtc_seconds[2] == 0)
1123            ++rtc_seconds[3];
1089   if (++mac->rtc_seconds[0] == 0)
1090      if (++mac->rtc_seconds[1] == 0)
1091         if (++mac->rtc_seconds[2] == 0)
1092            ++mac->rtc_seconds[3];
11241093
1125   /*if (++rtc_seconds[4] == 0)
1126        if (++rtc_seconds[5] == 0)
1127            if (++rtc_seconds[6] == 0)
1128                ++rtc_seconds[7];*/
1094   /*if (++mac->rtc_seconds[4] == 0)
1095        if (++mac->rtc_seconds[5] == 0)
1096            if (++mac->rtc_seconds[6] == 0)
1097                ++mac->rtc_seconds[7];*/
11291098}
11301099
11311100/* Executes a command.
11321101Called when the first byte after "enable" is received, and when the data byte after a write command
11331102is received. */
1134static void rtc_execute_cmd(int data)
1103static void rtc_execute_cmd(mac_state *mac, int data)
11351104{
11361105   int i;
11371106
11381107   if (LOG_RTC)
1139      logerror("rtc_execute_cmd: data=%x, state=%x\n", data, rtc_state);
1108      logerror("rtc_execute_cmd: data=%x, state=%x\n", data, mac->rtc_state);
11401109
1141   if (rtc_state == RTC_STATE_XPCOMMAND)
1110   if (mac->rtc_state == RTC_STATE_XPCOMMAND)
11421111   {
1143      rtc_xpaddr = ((rtc_cmd & 7)<<5) | ((data&0x7c)>>2);
1144      if ((rtc_cmd & 0x80) != 0)
1112      mac->rtc_xpaddr = ((mac->rtc_cmd & 7)<<5) | ((data&0x7c)>>2);
1113      if ((mac->rtc_cmd & 0x80) != 0)
11451114      {
11461115         // read command
11471116         if (LOG_RTC)
1148            logerror("RTC: Reading extended address %x = %x\n", rtc_xpaddr, rtc_ram[rtc_xpaddr]);
1117            logerror("RTC: Reading extended address %x = %x\n", mac->rtc_xpaddr, mac->rtc_ram[mac->rtc_xpaddr]);
11491118
1150         rtc_data_dir = 1;
1151         rtc_data_byte = rtc_ram[rtc_xpaddr];
1152         rtc_state = RTC_STATE_NORMAL;
1119         mac->rtc_data_dir = 1;
1120         mac->rtc_data_byte = mac->rtc_ram[mac->rtc_xpaddr];
1121         mac->rtc_state = RTC_STATE_NORMAL;
11531122      }
11541123      else
11551124      {
11561125         // write command
1157         rtc_state = RTC_STATE_XPWRITE;
1158         rtc_data_byte = 0;
1159         rtc_bit_count = 0;
1126         mac->rtc_state = RTC_STATE_XPWRITE;
1127         mac->rtc_data_byte = 0;
1128         mac->rtc_bit_count = 0;
11601129      }
11611130   }
1162   else if (rtc_state == RTC_STATE_XPWRITE)
1131   else if (mac->rtc_state == RTC_STATE_XPWRITE)
11631132   {
11641133      if (LOG_RTC)
1165         logerror("RTC: writing %x to extended address %x\n", data, rtc_xpaddr);
1166      rtc_ram[rtc_xpaddr] = data;
1167      rtc_state = RTC_STATE_NORMAL;
1134         logerror("RTC: writing %x to extended address %x\n", data, mac->rtc_xpaddr);
1135      mac->rtc_ram[mac->rtc_xpaddr] = data;
1136      mac->rtc_state = RTC_STATE_NORMAL;
11681137   }
1169   else if (rtc_state == RTC_STATE_WRITE)
1138   else if (mac->rtc_state == RTC_STATE_WRITE)
11701139   {
1171      rtc_state = RTC_STATE_NORMAL;
1140      mac->rtc_state = RTC_STATE_NORMAL;
11721141
11731142      /* Writing an RTC register */
1174      i = (rtc_cmd >> 2) & 0x1f;
1175      if (rtc_write_protect && (i != 13))
1143      i = (mac->rtc_cmd >> 2) & 0x1f;
1144      if (mac->rtc_write_protect && (i != 13))
11761145         /* write-protection : only write-protect can be written again */
11771146         return;
11781147      switch(i)
11791148      {
11801149      case 0: case 1: case 2: case 3:   /* seconds register */
11811150      case 4: case 5: case 6: case 7:   /* ??? (not described in IM III) */
1182         /* after various tries, I assumed rtc_seconds[4+i] is mapped to rtc_seconds[i] */
1151         /* after various tries, I assumed mac->rtc_seconds[4+i] is mapped to mac->rtc_seconds[i] */
11831152          if (LOG_RTC)
1184            logerror("RTC clock write, address = %X, data = %X\n", i, (int) rtc_data_byte);
1185         rtc_seconds[i & 3] = rtc_data_byte;
1153            logerror("RTC clock write, address = %X, data = %X\n", i, (int) mac->rtc_data_byte);
1154         mac->rtc_seconds[i & 3] = mac->rtc_data_byte;
11861155         break;
11871156
11881157      case 8: case 9: case 10: case 11:   /* RAM address $10-$13 */
11891158         if (LOG_RTC)
1190            logerror("RTC RAM write, address = %X, data = %X\n", (i & 3) + 0x10, (int) rtc_data_byte);
1191         rtc_ram[(i & 3) + 0x10] = rtc_data_byte;
1159            logerror("RTC RAM write, address = %X, data = %X\n", (i & 3) + 0x10, (int) mac->rtc_data_byte);
1160         mac->rtc_ram[(i & 3) + 0x10] = mac->rtc_data_byte;
11921161         break;
11931162
11941163      case 12:
11951164         /* Test register - do nothing */
11961165         if (LOG_RTC)
1197            logerror("RTC write to test register, data = %X\n", (int) rtc_data_byte);
1166            logerror("RTC write to test register, data = %X\n", (int) mac->rtc_data_byte);
11981167         break;
11991168
12001169      case 13:
12011170         /* Write-protect register  */
12021171         if (LOG_RTC)
1203            logerror("RTC write to write-protect register, data = %X\n", (int) rtc_data_byte&0x80);
1204         rtc_write_protect = (rtc_data_byte & 0x80) ? TRUE : FALSE;
1172            logerror("RTC write to write-protect register, data = %X\n", (int) mac->rtc_data_byte&0x80);
1173         mac->rtc_write_protect = (mac->rtc_data_byte & 0x80) ? TRUE : FALSE;
12051174         break;
12061175
12071176      case 16: case 17: case 18: case 19:   /* RAM address $00-$0f */
r6683r6684
12091178      case 24: case 25: case 26: case 27:
12101179      case 28: case 29: case 30: case 31:
12111180         if (LOG_RTC)
1212            logerror("RTC RAM write, address = %X, data = %X\n", i & 15, (int) rtc_data_byte);
1213         rtc_ram[i & 15] = rtc_data_byte;
1181            logerror("RTC RAM write, address = %X, data = %X\n", i & 15, (int) mac->rtc_data_byte);
1182         mac->rtc_ram[i & 15] = mac->rtc_data_byte;
12141183         break;
12151184
12161185      default:
1217         printf("Unknown RTC write command : %X, data = %d\n", (int) rtc_cmd, (int) rtc_data_byte);
1186         printf("Unknown RTC write command : %X, data = %d\n", (int) mac->rtc_cmd, (int) mac->rtc_data_byte);
12181187         break;
12191188      }
12201189   }
12211190   else
12221191   {
1223      // always save this byte to rtc_cmd
1224      rtc_cmd = rtc_data_byte;
1192      // always save this byte to mac->rtc_cmd
1193      mac->rtc_cmd = mac->rtc_data_byte;
12251194
1226      if ((rtc_cmd & 0x78) == 0x38)   // extended command
1195      if ((mac->rtc_cmd & 0x78) == 0x38)   // extended command
12271196      {
1228         rtc_state = RTC_STATE_XPCOMMAND;
1229         rtc_data_byte = 0;
1230         rtc_bit_count = 0;
1197         mac->rtc_state = RTC_STATE_XPCOMMAND;
1198         mac->rtc_data_byte = 0;
1199         mac->rtc_bit_count = 0;
12311200      }
12321201      else
12331202      {
1234         if (rtc_cmd & 0x80)
1203         if (mac->rtc_cmd & 0x80)
12351204         {
1236            rtc_state = RTC_STATE_NORMAL;
1205            mac->rtc_state = RTC_STATE_NORMAL;
12371206
12381207            /* Reading an RTC register */
1239            rtc_data_dir = 1;
1240            i = (rtc_cmd >> 2) & 0x1f;
1208            mac->rtc_data_dir = 1;
1209            i = (mac->rtc_cmd >> 2) & 0x1f;
12411210            switch(i)
12421211            {
12431212               case 0: case 1: case 2: case 3:
12441213               case 4: case 5: case 6: case 7:
1245                  rtc_data_byte = rtc_seconds[i & 3];
1214                  mac->rtc_data_byte = mac->rtc_seconds[i & 3];
12461215                  if (LOG_RTC)
1247                     logerror("RTC clock read, address = %X -> data = %X\n", i, rtc_data_byte);
1216                     logerror("RTC clock read, address = %X -> data = %X\n", i, mac->rtc_data_byte);
12481217                  break;
12491218
12501219               case 8: case 9: case 10: case 11:
12511220                  if (LOG_RTC)
1252                     logerror("RTC RAM read, address = %X data = %x\n", (i & 3) + 0x10, rtc_ram[(i & 3) + 0x10]);
1253                  rtc_data_byte = rtc_ram[(i & 3) + 0x10];
1221                     logerror("RTC RAM read, address = %X data = %x\n", (i & 3) + 0x10, mac->rtc_ram[(i & 3) + 0x10]);
1222                  mac->rtc_data_byte = mac->rtc_ram[(i & 3) + 0x10];
12541223                  break;
12551224
12561225               case 16: case 17: case 18: case 19:
r6683r6684
12581227               case 24: case 25: case 26: case 27:
12591228               case 28: case 29: case 30: case 31:
12601229                  if (LOG_RTC)
1261                     logerror("RTC RAM read, address = %X data = %x\n", i & 15, rtc_ram[i & 15]);
1262                  rtc_data_byte = rtc_ram[i & 15];
1230                     logerror("RTC RAM read, address = %X data = %x\n", i & 15, mac->rtc_ram[i & 15]);
1231                  mac->rtc_data_byte = mac->rtc_ram[i & 15];
12631232                  break;
12641233
12651234               default:
12661235                  if (LOG_RTC)
1267                     logerror("Unknown RTC read command : %X\n", (int) rtc_cmd);
1268                  rtc_data_byte = 0;
1236                     logerror("Unknown RTC read command : %X\n", (int) mac->rtc_cmd);
1237                  mac->rtc_data_byte = 0;
12691238                  break;
12701239            }
12711240         }
r6683r6684
12741243            /* Writing an RTC register */
12751244            /* wait for extra data byte */
12761245            if (LOG_RTC)
1277               logerror("RTC write, waiting for data byte : %X\n", (int) rtc_cmd);
1278            rtc_state = RTC_STATE_WRITE;
1279            rtc_data_byte = 0;
1280            rtc_bit_count = 0;
1246               logerror("RTC write, waiting for data byte : %X\n", (int) mac->rtc_cmd);
1247            mac->rtc_state = RTC_STATE_WRITE;
1248            mac->rtc_data_byte = 0;
1249            mac->rtc_bit_count = 0;
12811250         }
12821251      }
12831252   }
r6683r6684
12871256/* TODO : save write_protect flag, save time difference with host clock */
12881257NVRAM_HANDLER( mac )
12891258{
1259   mac_state *mac = machine->driver_data;
1260
12901261   if (read_or_write)
12911262   {
12921263      if (LOG_RTC)
12931264         logerror("Writing PRAM to file\n");
1294      mame_fwrite(file, rtc_ram, sizeof(rtc_ram));
1265      mame_fwrite(file, mac->rtc_ram, sizeof(mac->rtc_ram));
12951266   }
12961267   else
12971268   {
r6683r6684
12991270      {
13001271         if (LOG_RTC)
13011272            logerror("Reading PRAM from file\n");
1302         mame_fread(file, rtc_ram, sizeof(rtc_ram));
1273         mame_fread(file, mac->rtc_ram, sizeof(mac->rtc_ram));
13031274      }
13041275      else
13051276      {
13061277         if (LOG_RTC)
13071278            logerror("trashing PRAM\n");
13081279
1309         memset(rtc_ram, 0, sizeof(rtc_ram));
1280         memset(mac->rtc_ram, 0, sizeof(mac->rtc_ram));
13101281
13111282         // some Mac ROMs are buggy in the presence of
13121283         // no NVRAM, so let's initialize it right
1313         rtc_ram[0] = 0xa8;   // valid
1314         rtc_ram[4] = 0xcc;
1315         rtc_ram[5] = 0x0a;
1316         rtc_ram[6] = 0xcc;
1317         rtc_ram[7] = 0x0a;
1318         rtc_ram[0xc] = 0x42;    // XPRAM valid for Plus/SE
1319         rtc_ram[0xd] = 0x75;
1320         rtc_ram[0xe] = 0x67;
1321         rtc_ram[0xf] = 0x73;
1322         rtc_ram[0x10] = 0x18;
1323         rtc_ram[0x11] = 0x88;
1324         rtc_ram[0x12] = 0x01;
1325         rtc_ram[0x13] = 0x4c;
1284         mac->rtc_ram[0] = 0xa8;   // valid
1285         mac->rtc_ram[4] = 0xcc;
1286         mac->rtc_ram[5] = 0x0a;
1287         mac->rtc_ram[6] = 0xcc;
1288         mac->rtc_ram[7] = 0x0a;
1289         mac->rtc_ram[0xc] = 0x42;    // XPRAM valid for Plus/SE
1290         mac->rtc_ram[0xd] = 0x75;
1291         mac->rtc_ram[0xe] = 0x67;
1292         mac->rtc_ram[0xf] = 0x73;
1293         mac->rtc_ram[0x10] = 0x18;
1294         mac->rtc_ram[0x11] = 0x88;
1295         mac->rtc_ram[0x12] = 0x01;
1296         mac->rtc_ram[0x13] = 0x4c;
13261297
1327         if (mac_model >= MODEL_MAC_II)
1298         if (mac->mac_model >= MODEL_MAC_II)
13281299         {
1329            rtc_ram[0xc] = 0x4e;    // XPRAM valid is different for these
1330            rtc_ram[0xd] = 0x75;
1331            rtc_ram[0xe] = 0x4d;
1332            rtc_ram[0xf] = 0x63;
1333            rtc_ram[0x77] = 0x01;
1334            rtc_ram[0x78] = 0xff;
1335            rtc_ram[0x79] = 0xff;
1336            rtc_ram[0x7a] = 0xff;
1337            rtc_ram[0x7b] = 0xdf;
1300            mac->rtc_ram[0xc] = 0x4e;    // XPRAM valid is different for these
1301            mac->rtc_ram[0xd] = 0x75;
1302            mac->rtc_ram[0xe] = 0x4d;
1303            mac->rtc_ram[0xf] = 0x63;
1304            mac->rtc_ram[0x77] = 0x01;
1305            mac->rtc_ram[0x78] = 0xff;
1306            mac->rtc_ram[0x79] = 0xff;
1307            mac->rtc_ram[0x7a] = 0xff;
1308            mac->rtc_ram[0x7b] = 0xdf;
13381309         }
13391310      }
13401311
r6683r6684
13611332         if (LOG_RTC)
13621333            logerror("second count 0x%lX\n", (unsigned long) seconds);
13631334
1364         rtc_seconds[0] = seconds & 0xff;
1365         rtc_seconds[1] = (seconds >> 8) & 0xff;
1366         rtc_seconds[2] = (seconds >> 16) & 0xff;
1367         rtc_seconds[3] = (seconds >> 24) & 0xff;
1335         mac->rtc_seconds[0] = seconds & 0xff;
1336         mac->rtc_seconds[1] = (seconds >> 8) & 0xff;
1337         mac->rtc_seconds[2] = (seconds >> 16) & 0xff;
1338         mac->rtc_seconds[3] = (seconds >> 24) & 0xff;
13681339      }
13691340   }
13701341}
r6683r6684
14101381 * ADB (Mac II-style)
14111382 * *************************************************************************/
14121383
1413// Mac ADB state
1414static int adb_irq_pending, adb_waiting_cmd, adb_datasize, adb_buffer[257];
1415static int adb_state, adb_command, adb_send, adb_timer_ticks, adb_extclock, adb_direction;
1416static int adb_listenreg, adb_listenaddr, adb_last_talk;
1417
14181384// ADB mouse state
14191385static int adb_mouseaddr = 3;
14201386static int adb_lastmousex, adb_lastmousey, adb_lastbutton, adb_mouse_initialized;
r6683r6684
14311397{
14321398   int i, j, keybuf, report, codes[2], result;
14331399   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
1400   mac_state *mac = machine->driver_data;
14341401
14351402   codes[0] = codes[1] = 0x80;   // key up
14361403   report = result = 0;
14371404
14381405   for (i = 0; i < 6; i++)
14391406   {
1440      keybuf = input_port_read(machine, keynames[i]);
1441
1407      keybuf = input_port_read(machine, keynames[i]);
1408     
14421409      // any changes in this row?
1443      if ((keybuf != key_matrix[i]) && (report < 2))
1410      if ((keybuf != mac->key_matrix[i]) && (report < 2))
14441411      {
14451412         // check each column bit
14461413         for (j=0; j<16; j++)
14471414         {
1448            if (((keybuf ^ key_matrix[i]) >> j) & 1)
1415            if (((keybuf ^ mac->key_matrix[i]) >> j) & 1)
14491416            {
1450               // update key_matrix
1417               // update mac->key_matrix
14511418               if (update)
14521419               {
1453                  key_matrix[i] = (key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j));
1420                  mac->key_matrix[i] = (mac->key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j));
14541421               }
14551422
14561423               codes[report] = (i<<4)|j;
1457
1424               
14581425               // key up?
14591426               if (!(keybuf & (1 << j)))
14601427               {
r6683r6684
14701437                     {
14711438                        adb_modifiers &= ~0x20;
14721439                     }
1473                     else
1440                     else
14741441                     {
14751442                        adb_modifiers |= 0x20;
14761443                     }
r6683r6684
14811448                     {
14821449                        adb_modifiers &= ~0x8;
14831450                     }
1484                     else
1451                     else
14851452                     {
14861453                        adb_modifiers |= 0x08;
14871454                     }
r6683r6684
14921459                     {
14931460                        adb_modifiers &= ~0x4;
14941461                     }
1495                     else
1462                     else
14961463                     {
14971464                        adb_modifiers |= 0x04;
14981465                     }
r6683r6684
15031470                     {
15041471                        adb_modifiers &= ~0x2;
15051472                     }
1506                     else
1473                     else
15071474                     {
15081475                        adb_modifiers |= 0x02;
15091476                     }
r6683r6684
15141481                     {
15151482                        adb_modifiers &= ~0x1;
15161483                     }
1517                     else
1484                     else
15181485                     {
15191486                        adb_modifiers |= 0x01;
15201487                     }
r6683r6684
15381505      }
15391506   }
15401507
1508//   printf("ADB keyboard: update %d keys %02x %02x\n", update, codes[0], codes[1]);
1509
15411510   // figure out if there was a change
15421511   if ((adb_currentkeys[0] != codes[0]) || (adb_currentkeys[1] != codes[1]))
15431512   {
r6683r6684
16221591static void mac_adb_talk(running_machine *machine)
16231592{
16241593   int addr, reg;
1594   mac_state *mac = machine->driver_data;
16251595
1626   addr = (adb_command>>4);
1627   reg = (adb_command & 3);
1596   addr = (mac->adb_command>>4);
1597   reg = (mac->adb_command & 3);
16281598
1629//  printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", adb_command, (adb_command>>2)&3, addr, reg, adb_mouseaddr, adb_keybaddr);
1599//   printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", mac->adb_command, (mac->adb_command>>2)&3, addr, reg, adb_mouseaddr, adb_keybaddr);
16301600
1631   if (adb_waiting_cmd)
1601   if (mac->adb_waiting_cmd)
16321602   {
1633      switch ((adb_command>>2)&3)
1603      switch ((mac->adb_command>>2)&3)
16341604      {
16351605         case 0:
16361606         case 1:
r6683r6684
16401610                  #if LOG_ADB
16411611                  printf("ADB RESET: reg %x address %x\n", reg, addr);
16421612                  #endif
1643                  adb_direction = 0;
1644                  adb_send = 0;
1613                  mac->adb_direction = 0;
1614                  mac->adb_send = 0;
16451615                  break;
16461616
16471617               case ADB_CMD_FLUSH:
r6683r6684
16491619                  printf("ADB FLUSH: reg %x address %x\n", reg, addr);
16501620                  #endif
16511621
1652                  adb_direction = 0;
1653                  adb_send = 0;
1622                  mac->adb_direction = 0;
1623                  mac->adb_send = 0;
16541624                  break;
16551625
16561626               default:   // reserved/unused
r6683r6684
16631633            printf("ADB LISTEN: reg %x address %x\n", reg, addr);
16641634            #endif
16651635
1666            adb_direction = 1;   // input from Mac
1667            adb_listenreg = reg;
1668            adb_listenaddr = addr;
1669            adb_command = 0;
1636            mac->adb_direction = 1;   // input from Mac
1637            mac->adb_listenreg = reg;
1638            mac->adb_listenaddr = addr;
1639            mac->adb_command = 0;
16701640            break;
16711641
16721642         case 3: // talk
r6683r6684
16751645            #endif
16761646
16771647            // keep track of what device the Mac last TALKed to
1678            adb_last_talk = addr;
1648            mac->adb_last_talk = addr;
16791649
1680            adb_direction = 0;       // output to Mac
1650            mac->adb_direction = 0;       // output to Mac
16811651            if (addr == adb_mouseaddr)
16821652            {
16831653               UINT8 mouseX, mouseY;
r6683r6684
16901660               {
16911661                  // read mouse
16921662                  case 0:
1693                     mac_adb_accummouse(machine, &mouseX, &mouseY);
1694                     adb_buffer[0] = (adb_lastbutton & 0x01) ? 0x00 : 0x80;
1695                     adb_buffer[0] |= mouseX & 0x7f;
1696                     adb_buffer[1] = mouseY & 0x7f;
1697                     adb_datasize = 2;
1663                     if (mac->adb_srq_switch)
1664                     {
1665                        mac->adb_srq_switch = 0;
1666                        mouseX = mouseY = 0;
1667                     }
1668                     else
1669                     {
1670                        mac_adb_accummouse(machine, &mouseX, &mouseY);
1671                     }
1672                     mac->adb_buffer[0] = (adb_lastbutton & 0x01) ? 0x00 : 0x80;
1673                     mac->adb_buffer[0] |= mouseX & 0x7f;
1674                     mac->adb_buffer[1] = mouseY & 0x7f;
1675                     mac->adb_datasize = 2;
16981676                     break;
16991677
17001678                  // get ID/handler
17011679                  case 3:
1702                     adb_buffer[0] = 0x60 | ((adb_mouseaddr<<8)&0xf);   // SRQ enable, no exceptional event
1703                     adb_buffer[1] = 0x01;   // handler 1
1704                     adb_datasize = 2;
1680                     mac->adb_buffer[0] = 0x60 | ((adb_mouseaddr<<8)&0xf);   // SRQ enable, no exceptional event
1681                     mac->adb_buffer[1] = 0x01;   // handler 1
1682                     mac->adb_datasize = 2;
17051683
17061684                     adb_mouse_initialized = 1;
17071685                     break;
r6683r6684
17201698               {
17211699                  // read keyboard
17221700                  case 0:
1723                     mac_adb_pollkbd(machine, 1);
1724//                          printf("keyboard = %02x %02x\n", adb_currentkeys[0], adb_currentkeys[1]);
1725                     adb_buffer[0] = adb_currentkeys[0];
1726                     adb_buffer[1] = adb_currentkeys[1];
1727                     adb_datasize = 2;
1701                     if (mac->adb_srq_switch)
1702                     {
1703                        mac->adb_srq_switch = 0;
1704                     }
1705                     else
1706                     {
1707                        mac_adb_pollkbd(machine, 1);
1708                     }
1709//                     printf("keyboard = %02x %02x\n", adb_currentkeys[0], adb_currentkeys[1]);
1710                     mac->adb_buffer[0] = adb_currentkeys[1];
1711                     mac->adb_buffer[1] = adb_currentkeys[0];
1712                     mac->adb_datasize = 2;
17281713                     break;
17291714
17301715                  // read modifier keys
17311716                  case 2:
17321717                     mac_adb_pollkbd(machine, 1);
1733                     adb_buffer[0] = adb_modifiers;   // nothing pressed
1734                     adb_buffer[1] = 0;
1735                     adb_datasize = 2;
1718                     mac->adb_buffer[0] = adb_modifiers;   // nothing pressed
1719                     mac->adb_buffer[1] = 0;
1720                     mac->adb_datasize = 2;
17361721                     break;
17371722
17381723                  // get ID/handler
17391724                  case 3:
1740                     adb_buffer[0] = 0x60 | ((adb_keybaddr<<8)&0xf);   // SRQ enable, no exceptional event
1741                     adb_buffer[1] = 0x01;   // handler 1
1742                     adb_datasize = 2;
1725                     mac->adb_buffer[0] = 0x60 | ((adb_keybaddr<<8)&0xf);   // SRQ enable, no exceptional event
1726                     mac->adb_buffer[1] = 0x01;   // handler 1
1727                     mac->adb_datasize = 2;
17431728
17441729                     adb_keybinitialized = 1;
17451730                     break;
r6683r6684
17531738               #if LOG_ADB
17541739               printf("ADB: talking to unconnected device\n");
17551740               #endif
1756               adb_buffer[0] = adb_buffer[1] = 0;
1757               adb_datasize = 0;
1741               mac->adb_buffer[0] = mac->adb_buffer[1] = 0;
1742               mac->adb_datasize = 0;
17581743            }
17591744            break;
17601745      }
17611746
1762      adb_waiting_cmd = 0;
1747      mac->adb_waiting_cmd = 0;
17631748   }
17641749   else
17651750   {
17661751      #if LOG_ADB
1767      printf("Got LISTEN data %x for device %x reg %x\n", adb_command, adb_listenaddr, adb_listenreg);
1752      printf("Got LISTEN data %x for device %x reg %x\n", mac->adb_command, mac->adb_listenaddr, mac->adb_listenreg);
17681753      #endif
17691754
1770      if (adb_listenaddr == adb_mouseaddr)
1755      if (mac->adb_listenaddr == adb_mouseaddr)
17711756      {
1772         if ((adb_listenreg == 3) && (adb_command > 0) && (adb_command < 16))
1757         if ((mac->adb_listenreg == 3) && (mac->adb_command > 0) && (mac->adb_command < 16))
17731758         {
17741759            #if LOG_ADB
1775             printf("MOUSE: moving to address %x\n", adb_command);
1760             printf("MOUSE: moving to address %x\n", mac->adb_command);
17761761            #endif
1777            adb_mouseaddr = adb_command&0x0f;
1762            adb_mouseaddr = mac->adb_command&0x0f;
17781763         }
17791764      }
1780      else if (adb_listenaddr == adb_keybaddr)
1765      else if (mac->adb_listenaddr == adb_keybaddr)
17811766      {
1782         if ((adb_listenreg == 3) && (adb_command > 0) && (adb_command < 16))
1767         if ((mac->adb_listenreg == 3) && (mac->adb_command > 0) && (mac->adb_command < 16))
17831768         {
17841769            #if LOG_ADB
1785             printf("KEYBOARD: moving to address %x\n", adb_command);
1770             printf("KEYBOARD: moving to address %x\n", mac->adb_command);
17861771            #endif
1787            adb_keybaddr = adb_command&0x0f;
1772            adb_keybaddr = mac->adb_command&0x0f;
17881773         }
17891774      }
17901775   }
r6683r6684
17931778static TIMER_CALLBACK(mac_adb_tick)
17941779{
17951780   const device_config *via_0 = devtag_get_device(machine, "via6522_0");
1781   mac_state *mac = machine->driver_data;
17961782
17971783   // do one clock transition on CB1 to advance the VIA shifter
1798   adb_extclock ^= 1;
1799   via_cb1_w(via_0, 0, adb_extclock);
1800   adb_extclock ^= 1;
1801   via_cb1_w(via_0, 0, adb_extclock);
1784   mac->adb_extclock ^= 1;
1785   via_cb1_w(via_0, 0, mac->adb_extclock);
1786   mac->adb_extclock ^= 1;
1787   via_cb1_w(via_0, 0, mac->adb_extclock);
18021788
1803   adb_timer_ticks--;
1804   if (!adb_timer_ticks)
1789   mac->adb_timer_ticks--;
1790   if (!mac->adb_timer_ticks)
18051791   {
18061792      timer_adjust_oneshot(mac_adb_timer, attotime_never, 0);
18071793
1808      if ((adb_direction) && (ADB_IS_BITBANG))
1794      if ((mac->adb_direction) && (ADB_IS_BITBANG))
18091795      {
18101796         mac_adb_talk(machine);
18111797      }
18121798      else if (ADB_IS_EGRET)
18131799      {
18141800         // Egret sending a response to the 680x0?
1815         if (adb_state & 1)
1801         if (mac->adb_state & 1)
18161802         {
1817            adb_send = adb_buffer[adb_datasize];
1803            mac->adb_send = mac->adb_buffer[mac->adb_datasize];
18181804            #if LOG_ADB
1819            printf("Egret ADB: done sending byte %02x, %d left\n", adb_send, adb_datasize);
1805            printf("Egret ADB: done sending byte %02x, %d left\n", mac->adb_send, mac->adb_datasize);
18201806            #endif
18211807
1822            adb_datasize--;
1823            adb_timer_ticks = 8;
1808            mac->adb_datasize--;
1809            mac->adb_timer_ticks = 8;
18241810            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
18251811
1826            if (adb_datasize == 0)
1812            if (mac->adb_datasize == 0)
18271813            {
18281814               #if LOG_ADB
18291815               printf("Egret ADB: this is the last byte, dropping XS\n");
18301816               #endif
1831               adb_state &= ~1;
1817               mac->adb_state &= ~1;
18321818            }
18331819         }
18341820         else
18351821         {
18361822            #if LOG_ADB
1837            printf("Egret ADB: got command byte %02x\n", adb_command);
1823            printf("Egret ADB: got command byte %02x\n", mac->adb_command);
18381824            #endif
1839            adb_buffer[adb_datasize++] = adb_command;
1840            adb_command = 0;
1825            mac->adb_buffer[mac->adb_datasize++] = mac->adb_command;
1826            mac->adb_command = 0;
18411827         }
18421828      }
18431829   }
r6683r6684
18501836static READ8_DEVICE_HANDLER(mac_adb_via_in_cb2)
18511837{
18521838   UINT8 ret;
1839   mac_state *mac = device->machine->driver_data;
18531840
1854   ret = (adb_send & 0x80)>>7;
1855   adb_send <<= 1;
1841   ret = (mac->adb_send & 0x80)>>7;
1842   mac->adb_send <<= 1;
18561843
1857//  printf("IN CB2 = %x\n", ret);
1844//   printf("IN CB2 = %x\n", ret);
18581845
18591846   return ret;
18601847}
18611848
18621849static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2)
18631850{
1851   mac_state *mac = device->machine->driver_data;
1852
18641853//      printf("OUT CB2 = %x\n", data);
1865   adb_command <<= 1;
1866   adb_command |= data & 1;
1854   mac->adb_command <<= 1;
1855   mac->adb_command |= data & 1;
18671856}
18681857
1869static void mac_adb_newaction(int state)
1858static void mac_adb_newaction(mac_state *mac, int state)
18701859{
1871   if (state != adb_state)
1860   if (state != mac->adb_state)
18721861   {
18731862      #if LOG_ADB
18741863      printf("New ADB state: %s\n", adb_statenames[state]);
18751864      #endif
18761865
1877      adb_state = state;
1878      adb_timer_ticks = 8;
1866      mac->adb_state = state;
1867      mac->adb_timer_ticks = 8;
18791868
18801869      switch (state)
18811870      {
18821871         case ADB_STATE_NEW_COMMAND:
1883            adb_command = adb_send = 0;
1884            adb_direction = 1;   // Mac is shifting us a command
1885            adb_waiting_cmd = 1;   // we're going to get a command
1886            adb_irq_pending = 0;
1872            mac->adb_command = mac->adb_send = 0;
1873            mac->adb_direction = 1;   // Mac is shifting us a command
1874            mac->adb_waiting_cmd = 1;   // we're going to get a command
1875            mac->adb_irq_pending = 0;
18871876            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
18881877            break;
18891878
18901879         case ADB_STATE_XFER_EVEN:
18911880         case ADB_STATE_XFER_ODD:
1892            if (adb_datasize > 0)
1881            if (mac->adb_datasize > 0)
18931882            {
18941883               int i;
18951884
18961885               // is something trying to send to the Mac?
1897               if (adb_direction == 0)
1886               if (mac->adb_direction == 0)
18981887               {
18991888                  // set up the byte
1900                  adb_send = adb_buffer[0];
1901                  adb_datasize--;
1889                  mac->adb_send = mac->adb_buffer[0];
1890                  mac->adb_datasize--;
19021891
19031892                  // move down the rest of the buffer, if any
1904                  for (i = 0; i < adb_datasize; i++)
1893                  for (i = 0; i < mac->adb_datasize; i++)
19051894                  {
1906                     adb_buffer[i] = adb_buffer[i+1];
1895                     mac->adb_buffer[i] = mac->adb_buffer[i+1];
19071896                  }
19081897               }
19091898
19101899            }
19111900            else
19121901            {
1913               adb_send = 0;
1914               adb_irq_pending = 1;
1902               mac->adb_send = 0;
1903               mac->adb_irq_pending = 1;
19151904            }
19161905
19171906            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
19181907            break;
19191908
19201909         case ADB_STATE_IDLE:
1921            adb_irq_pending = 0;
1910            mac->adb_irq_pending = 0;
19221911            break;
19231912      }
19241913   }
19251914}
19261915
1927static void mac_egret_response_std(int type, int flag, int cmd)
1916static void mac_egret_response_std(mac_state *mac, int type, int flag, int cmd)
19281917{
1929   adb_send = 0xaa;
1930   adb_buffer[3] = type;
1931   adb_buffer[2] = flag;
1932   adb_buffer[1] = cmd;
1933   adb_state |= 1;
1934   adb_timer_ticks = 8;
1935   adb_datasize = 3;
1918   mac->adb_send = 0xaa;
1919   mac->adb_buffer[3] = type;
1920   mac->adb_buffer[2] = flag;
1921   mac->adb_buffer[1] = cmd;
1922   mac->adb_state |= 1;
1923   mac->adb_timer_ticks = 8;
1924   mac->adb_datasize = 3;
19361925   timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
19371926}
19381927
1939static void mac_egret_response_read_pram(int addr)
1928static void mac_egret_response_read_pram(mac_state *mac, int addr)
19401929{
1941   int count = 0x100 - addr;
1930   int count = 0x100 - addr;   
19421931
1943   adb_datasize = count+3;
1932   mac->adb_datasize = count+3;
19441933
1945   adb_buffer[count+3] = 1;
1946   adb_buffer[count+2] = 0;
1947   adb_buffer[count+1] = 7;
1934   mac->adb_buffer[count+3] = 1;
1935   mac->adb_buffer[count+2] = 0;
1936   mac->adb_buffer[count+1] = 7;
19481937   while (count)
19491938   {
1950      adb_buffer[count] = rtc_ram[addr];
1939      mac->adb_buffer[count] = mac->rtc_ram[addr];
19511940      addr++;
19521941      count--;
19531942   }
19541943
1955   adb_send = 0xaa;
1956   adb_state |= 1;
1957   adb_timer_ticks = 8;
1944   mac->adb_send = 0xaa;
1945   mac->adb_state |= 1;
1946   mac->adb_timer_ticks = 8;
19581947   timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
19591948}
19601949
1961static void mac_egret_mcu_exec(void)
1950static void mac_egret_mcu_exec(mac_state *mac)
19621951{
1963   switch (adb_buffer[1])
1952   switch (mac->adb_buffer[1])
19641953   {
19651954      case 0x01:   // enable/disable ADB auto-polling
19661955         #if LOG_ADB
1967         if (adb_buffer[2])
1956         if (mac->adb_buffer[2])
19681957         {
19691958            printf("ADB: Egret enable ADB auto-poll\n");
19701959         }
r6683r6684
19741963         }
19751964         #endif
19761965
1977         mac_egret_response_std(1, 0, 1);
1966         mac_egret_response_std(mac, 1, 0, 1);
19781967         break;
19791968
19801969      case 0x07: // read PRAM
19811970         #if LOG_ADB
1982         printf("ADB: Egret read PRAM from %x\n", adb_buffer[2]<<8 | adb_buffer[3]);
1971         printf("ADB: Egret read PRAM from %x\n", mac->adb_buffer[2]<<8 | mac->adb_buffer[3]);
19831972          #endif
19841973
1985         mac_egret_response_read_pram(adb_buffer[2]<<8 | adb_buffer[3]);
1974         mac_egret_response_read_pram(mac, mac->adb_buffer[2]<<8 | mac->adb_buffer[3]);
19861975         break;
19871976
19881977      case 0x0e: // send to DFAC
19891978         #if LOG_ADB
1990         printf("ADB: Egret send %02x to DFAC\n", adb_buffer[2]);
1979         printf("ADB: Egret send %02x to DFAC\n", mac->adb_buffer[2]);
19911980         #endif
19921981
1993         mac_egret_response_std(1, 0, 0x0e);
1982         mac_egret_response_std(mac, 1, 0, 0x0e);
19941983         break;
19951984
19961985      case 0x1b: // set one-second interrupt
19971986         #if LOG_ADB
1998         if (adb_buffer[2])
1987         if (mac->adb_buffer[2])
19991988         {
20001989            printf("ADB: Egret enable one-second IRQ\n");
20011990         }
r6683r6684
20051994         }
20061995         #endif
20071996
2008         mac_egret_response_std(1, 0, 0x1b);
1997         mac_egret_response_std(mac, 1, 0, 0x1b);
20091998         break;
20101999
20112000      case 0x1c:   // enable/disable keyboard NMI
20122001         #if LOG_ADB
2013         if (adb_buffer[2])
2002         if (mac->adb_buffer[2])
20142003         {
20152004            printf("ADB: Egret enable keyboard NMI\n");
20162005         }
r6683r6684
20202009         }
20212010         #endif
20222011
2023         mac_egret_response_std(1, 0, 0x1c);
2012         mac_egret_response_std(mac, 1, 0, 0x1c);
20242013         break;
20252014
20262015      default:
20272016         #if LOG_ADB
2028         printf("ADB: Unknown Egret MCU command %02x\n", adb_buffer[1]);
2017         printf("ADB: Unknown Egret MCU command %02x\n", mac->adb_buffer[1]);
20292018         #endif
20302019         break;
20312020   }
20322021}
20332022
2034static void mac_egret_newaction(int state)
2023static void mac_egret_newaction(mac_state *mac, int state)
20352024{
2036   if (state != adb_state)
2025   if (state != mac->adb_state)
20372026   {
20382027      #if LOG_ADB
2039      printf("ADB: New Egret state: SS %d VF %d XS %d\n", (state>>2)&1, (state>>1)&1, adb_state&1);
2028      printf("ADB: New Egret state: SS %d VF %d XS %d\n", (state>>2)&1, (state>>1)&1, mac->adb_state&1);
20402029      #endif
2041
2030     
20422031      // if bit 2 is high and stays high, the rising edge of bit 1 indicates the start of sending a command
2043      if ((state & 0x04) && (adb_state & 0x04) && (state & 0x02) && !(adb_state & 0x02))
2032      if ((state & 0x04) && (mac->adb_state & 0x04) && (state & 0x02) && !(mac->adb_state & 0x02))
20442033      {
2045         adb_command = adb_send = 0;
2046         adb_timer_ticks = 8;
2034         mac->adb_command = mac->adb_send = 0;
2035         mac->adb_timer_ticks = 8;
20472036         timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
20482037      }
20492038
20502039      // if bit 2 drops and bit 1 is zero, execute the command
2051      if (!(state & 0x02) && !(state & 0x04) && (adb_state & 0x04) && (adb_datasize))
2040      if (!(state & 0x02) && !(state & 0x04) && (mac->adb_state & 0x04) && (mac->adb_datasize))
20522041      {
20532042         #if LOG_ADB
20542043         int i;
20552044
2056         printf("ADB: Egret exec command with %d bytes: ", adb_datasize);
2045         printf("ADB: Egret exec command with %d bytes: ", mac->adb_datasize);
20572046
2058         for (i = 0; i < adb_datasize; i++)
2047         for (i = 0; i < mac->adb_datasize; i++)
20592048         {
2060            printf("%02x ", adb_buffer[i]);
2049            printf("%02x ", mac->adb_buffer[i]);
20612050         }
20622051
20632052         printf("\n");
20642053         #endif
20652054
20662055         // exec command here
2067         switch (adb_buffer[0])
2056         switch (mac->adb_buffer[0])
20682057         {
20692058            case 0:   // ADB command
2070               adb_datasize = 0;
2059               mac->adb_datasize = 0;
20712060               break;
20722061
20732062            case 1: // general Egret MCU command
2074               mac_egret_mcu_exec();
2063               mac_egret_mcu_exec(mac);
20752064               break;
20762065
20772066            case 2: // error
2078               adb_datasize = 0;
2067               mac->adb_datasize = 0;
20792068               break;
20802069
20812070            case 3: // one-second interrupt
2082               adb_datasize = 0;
2071               mac->adb_datasize = 0;
20832072               break;
20842073         }
20852074      }
20862075
2087      adb_state &= ~0x6;
2088      adb_state |= state & 0x6;
2076      mac->adb_state &= ~0x6;
2077      mac->adb_state |= state & 0x6;
20892078   }
20902079}
20912080
20922081static void adb_vblank(running_machine *machine)
20932082{
2094   if (adb_state == ADB_STATE_IDLE)
2083   mac_state *mac = machine->driver_data;
2084
2085   if (mac->adb_state == ADB_STATE_IDLE)
20952086   {
20962087      if (mac_adb_pollmouse(machine))
20972088      {
20982089         // if the mouse was the last TALK, we can just send the new data
2099         // otherwise we need to pull SRQ
2100         if (adb_last_talk == adb_mouseaddr)
2090         // otherwise we need to pull SRQ
2091         if (mac->adb_last_talk == adb_mouseaddr)
21012092         {
21022093            // repeat last TALK to get updated data
2103            adb_waiting_cmd = 1;
2094            mac->adb_waiting_cmd = 1;
21042095            mac_adb_talk(machine);
21052096
2106            adb_timer_ticks = 8;
2097            mac->adb_timer_ticks = 8;
21072098            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
21082099         }
21092100         else
21102101         {
2111            adb_irq_pending = 1;
2112            adb_command = adb_send = 0;
2113            adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
2102            mac->adb_irq_pending = 1;
2103            mac->adb_command = mac->adb_send = 0;
2104            mac->adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
21142105            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
2106            mac->adb_srq_switch = 1;
21152107         }
21162108      }
21172109      else if (mac_adb_pollkbd(machine, 0))
21182110      {
2119         if (adb_last_talk == adb_keybaddr)
2111         if (mac->adb_last_talk == adb_keybaddr)
21202112         {
21212113            // repeat last TALK to get updated data
2122            adb_waiting_cmd = 1;
2114            mac->adb_waiting_cmd = 1;
21232115            mac_adb_talk(machine);
21242116
2125            adb_timer_ticks = 8;
2117            mac->adb_timer_ticks = 8;
21262118            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
21272119         }
21282120         else
21292121         {
2130            adb_irq_pending = 1;
2131            adb_command = adb_send = 0;
2132            adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
2122            mac->adb_irq_pending = 1;
2123            mac->adb_command = mac->adb_send = 0;
2124            mac->adb_timer_ticks = 1;   // one tick should be sufficient to make it see  the IRQ
21332125            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
2126            mac->adb_srq_switch = 1;
21342127         }
21352128      }
21362129   }
21372130}
21382131
2139static void adb_reset(void)
2132static void adb_reset(mac_state *mac)
21402133{
21412134   int i;
21422135
2143   adb_irq_pending = 0;      // no interrupt
2144   adb_timer_ticks = 0;
2145   adb_command = 0;
2146   adb_extclock = 0;
2147   adb_send = 0;
2148   adb_waiting_cmd = 0;
2136   mac->adb_srq_switch = 0;
2137   mac->adb_irq_pending = 0;      // no interrupt
2138   mac->adb_timer_ticks = 0;
2139   mac->adb_command = 0;
2140   mac->adb_extclock = 0;
2141   mac->adb_send = 0;
2142   mac->adb_waiting_cmd = 0;
21492143   if (ADB_IS_BITBANG)
21502144   {
2151      adb_state = ADB_STATE_NOTINIT;
2145      mac->adb_state = ADB_STATE_NOTINIT;
21522146   }
21532147   else if (ADB_IS_EGRET)
21542148   {
2155      adb_state = 0;
2149      mac->adb_state = 0;
21562150   }
2157   adb_direction = 0;
2158   adb_datasize = 0;
2159   adb_last_talk = -1;
2160
2151   mac->adb_direction = 0;
2152   mac->adb_datasize = 0;
2153   mac->adb_last_talk = -1;
2154   
21612155   // mouse
21622156   adb_mouseaddr = 3;
21632157   adb_lastmousex = adb_lastmousey = adb_lastbutton = 0;
21642158   adb_mouse_initialized = 0;
21652159
21662160   // keyboard
2167   adb_keybaddr = 2;
2161   adb_keybaddr = 2;             
21682162   adb_keybinitialized = 0;
21692163   adb_currentkeys[0] = adb_currentkeys[1] = 0x80;
21702164   adb_modifiers = 0;
21712165   for (i=0; i<7; i++)
21722166   {
2173      key_matrix[i] = 0;
2167      mac->key_matrix[i] = 0;
21742168   }
21752169}
21762170
r6683r6684
22122206
22132207static READ8_DEVICE_HANDLER(mac_via_in_a)
22142208{
2215//  printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2209   mac_state *mac = device->machine->driver_data;
22162210
2217   if ((mac_model == MODEL_MAC_CLASSIC) ||
2218       (mac_model == MODEL_MAC_II) || (mac_model == MODEL_MAC_II_FDHD) ||
2219       (mac_model == MODEL_MAC_IIX) || (mac_model == MODEL_MAC_POWERMAC_6100))
2211//   printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2212
2213   if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
22202214   {
2215      return mac->pm_data_recv;
2216   }
2217
2218   if ((mac->mac_model == MODEL_MAC_CLASSIC) ||
2219       (mac->mac_model == MODEL_MAC_II) || (mac->mac_model == MODEL_MAC_II_FDHD) ||
2220       (mac->mac_model == MODEL_MAC_IIX) || (mac->mac_model == MODEL_MAC_POWERMAC_6100))
2221   {
22212222      return 0x81;      // bit 0 must be set to avoid attempting to boot from AppleTalk
22222223   }
22232224
2224   if (mac_model == MODEL_MAC_SE30)
2225   if (mac->mac_model == MODEL_MAC_SE30)
22252226   {
22262227      return 0x81 | PA6;
22272228   }
22282229
2229   if ((mac_model == MODEL_MAC_LC) || (mac_model == MODEL_MAC_LC_II))   // these both use the V8 ASIC and should in theory ID the same
2230   if ((mac->mac_model == MODEL_MAC_LC) || (mac->mac_model == MODEL_MAC_LC_II))   // these both use the V8 ASIC and should in theory ID the same
22302231   {
22312232      return 0x81 | PA6 | PA4 | PA2;
22322233   }
22332234
2234   if (mac_model == MODEL_MAC_IICI)
2235   if (mac->mac_model == MODEL_MAC_IICI)
22352236   {
22362237      return 0x81 | PA6 | PA2 | PA1;
22372238   }
22382239
2239   if (mac_model == MODEL_MAC_IISI)
2240   if (mac->mac_model == MODEL_MAC_IISI)
22402241   {
22412242      return 0x81 | PA4 | PA2 | PA1;
22422243   }
22432244
2244   if (mac_model == MODEL_MAC_IIFX)
2245   if (mac->mac_model == MODEL_MAC_IIFX)
22452246   {
22462247      return 0x81 | PA6 | PA1;
22472248   }
22482249
2249   if (mac_model == MODEL_MAC_IICX)
2250   if (mac->mac_model == MODEL_MAC_IICX)
22502251   {
22512252      return 0x81 | PA6;
22522253   }
r6683r6684
22572258static READ8_DEVICE_HANDLER(mac_via_in_b)
22582259{
22592260   int val = 0;
2261   mac_state *mac = device->machine->driver_data;
22602262
2261   /* video beam in display (! VBLANK && ! HBLANK basically) */
2262   if (video_screen_get_vpos(device->machine->primary_screen) >= MAC_V_VIS)
2263      val |= 0x40;
2264
2265   if (ADB_IS_BITBANG)
2263   // portable/PB100 is pretty different
2264   if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
22662265   {
2267      val |= adb_state<<4;
2266      val = 0x80 | mac->pm_ack;   // SCC wait/request
2267   }
2268   else
2269   {
2270      /* video beam in display (! VBLANK && ! HBLANK basically) */
2271      if (video_screen_get_vpos(device->machine->primary_screen) >= MAC_V_VIS)
2272         val |= 0x40;
22682273
2269      if (!adb_irq_pending)
2274      if (ADB_IS_BITBANG)
22702275      {
2271         val |= 0x08;
2276         val |= mac->adb_state<<4;
2277
2278         if (!mac->adb_irq_pending)
2279         {
2280            val |= 0x08;
2281         }
22722282      }
2283      else if (ADB_IS_EGRET)
2284      {
2285         val |= mac->adb_state<<3;
2286         val ^= 0x08;   // maybe it's reversed?
2287      }
2288      else
2289      {
2290         if (mac->mouse_bit_y)   /* Mouse Y2 */
2291            val |= 0x20;
2292         if (mac->mouse_bit_x)   /* Mouse X2 */
2293            val |= 0x10;
2294         if ((input_port_read(device->machine, "MOUSE0") & 0x01) == 0)
2295            val |= 0x08;
2296      }
2297      if (mac->rtc_data_out)
2298         val |= 1;
22732299   }
2274   else if (ADB_IS_EGRET)
2275   {
2276      val |= adb_state<<3;
2277      val ^= 0x08;   // maybe it's reversed?
2278   }
2279   else
2280   {
2281      if (mouse_bit_y)   /* Mouse Y2 */
2282         val |= 0x20;
2283      if (mouse_bit_x)   /* Mouse X2 */
2284         val |= 0x10;
2285      if ((input_port_read(device->machine, "MOUSE0") & 0x01) == 0)
2286         val |= 0x08;
2287   }
2288   if (rtc_data_out)
2289      val |= 1;
22902300
2291//  printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2301//   printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
22922302
22932303   return val;
22942304}
r6683r6684
22972307{
22982308   const device_config *sound = devtag_get_device(device->machine, "custom");
22992309   const device_config *fdc = devtag_get_device(device->machine, "fdc");
2310   mac_state *mac = device->machine->driver_data;
23002311
2301//  printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2312//   printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
23022313
2314   if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
2315   {
2316      mac->pm_data_send = data;
2317      return;
2318   }
2319
23032320   set_scc_waitrequest((data & 0x80) >> 7);
23042321   mac_set_screen_buffer((data & 0x40) >> 6);
23052322   sony_set_sel_line(fdc,(data & 0x20) >> 5);
2306   if (mac_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
2323   if (mac->mac_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
23072324   {
2308      mac_drive_select = ((data & 0x10) >> 4);
2325      mac->mac_drive_select = ((data & 0x10) >> 4);
23092326   }
23102327
2311   if (mac_model < MODEL_MAC_SE)   // SE no longer has dual buffers
2328   if (mac->mac_model < MODEL_MAC_SE)   // SE no longer has dual buffers
23122329   {
23132330      mac_set_sound_buffer(sound, (data & 0x08) >> 3);
23142331   }
23152332
2316   if (mac_model < MODEL_MAC_II)
2333   if (mac->mac_model < MODEL_MAC_II)
23172334   {
23182335      mac_set_volume(sound, data & 0x07);
23192336   }
23202337
23212338   /* Early Mac models had VIA A4 control overlaying.  In the Mac SE (and
2322     * possibly later models), overlay was set on reset, but cleared on the
2323     * first access to the ROM. */
2324   if (mac_model < MODEL_MAC_SE)
2339    * possibly later models), overlay was set on reset, but cleared on the
2340    * first access to the ROM. */
2341   if (mac->mac_model < MODEL_MAC_SE)
23252342      set_memory_overlay(device->machine, (data & 0x10) >> 4);
23262343}
23272344
r6683r6684
23292346{
23302347   const device_config *sound = devtag_get_device(device->machine, "custom");
23312348   int new_rtc_rTCClk;
2349   mac_state *mac = device->machine->driver_data;
23322350
2333//  printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2351//   printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
23342352
2335   if (mac_model < MODEL_MAC_II)
2353   if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
23362354   {
2355      const device_config *fdc = devtag_get_device(device->machine, "fdc");
2356
23372357      mac_enable_sound(sound, (data & 0x80) == 0);
2358      sony_set_sel_line(fdc,(data & 0x20) >> 5);
2359      mac->mac_drive_select = ((data & 0x10) >> 4);
2360      mac->pm_req = data & 1;
2361      return;
23382362   }
23392363
2364   if (mac->mac_model < MODEL_MAC_II)
2365   {
2366      mac_enable_sound(sound, (data & 0x80) == 0);
2367   }
2368
23402369   // SE and Classic have SCSI enable/disable here
2341   if ((mac_model == MODEL_MAC_SE) || (mac_model == MODEL_MAC_CLASSIC))
2370   if ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC))
23422371   {
2343      mac_scsiirq_enable = (data & 0x40) ? 0 : 1;
2344//      printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, mac_scsiirq_enable);
2372      mac->mac_scsiirq_enable = (data & 0x40) ? 0 : 1;
2373//      printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, mac->mac_scsiirq_enable);
23452374   }
23462375
2347   if (mac_model == MODEL_MAC_SE30)
2376   if (mac->mac_model == MODEL_MAC_SE30)
23482377   {
2349      // 0x40 = 0 means enable vblank on SE/30
2350      mac_se30_vbl_enable = (data & 0x40) ? 0 : 1;
2378      // 0x40 = 0 means enable vblank on SE/30     
2379      mac->mac_se30_vbl_enable = (data & 0x40) ? 0 : 1;
23512380
23522381      // clear the interrupt if we disabled it
2353      if (!mac_se30_vbl_enable)
2382      if (!mac->mac_se30_vbl_enable)
23542383      {
23552384          mac_nubus_slot_interrupt(device->machine, 0xe, 0);
23562385      }
23572386   }
23582387
2359   rtc_write_rTCEnb(data & 0x04);
2388   rtc_write_rTCEnb(mac, data & 0x04);
23602389   new_rtc_rTCClk = (data >> 1) & 0x01;
2361   if ((! new_rtc_rTCClk) && (rtc_rTCClk))
2362      rtc_shift_data(data & 0x01);
2363   rtc_rTCClk = new_rtc_rTCClk;
2390   if ((! new_rtc_rTCClk) && (mac->rtc_rTCClk))
2391      rtc_shift_data(mac, data & 0x01);
2392   mac->rtc_rTCClk = new_rtc_rTCClk;
23642393
23652394   if (ADB_IS_BITBANG)
23662395   {
2367      mac_adb_newaction((data & 0x30) >> 4);
2396      mac_adb_newaction(mac, (data & 0x30) >> 4);
23682397   }
23692398   else if (ADB_IS_EGRET)
23702399   {
2371      mac_egret_newaction((data & 0x30) >> 3);
2400      mac_egret_newaction(mac, (data & 0x30) >> 3);
23722401   }
23732402}
23742403
r6683r6684
24362465   const device_config *via_1 = devtag_get_device(space->machine, "via6522_1");
24372466
24382467   offset >>= 8;
2439   offset &= 0x0f;
2468   offset &= 0x0f;   
24402469
24412470   if (LOG_VIA)
24422471      logerror("mac_via2_w: offset=%x data=0x%08x\n", offset, data);
r6683r6684
24482477
24492478static READ8_DEVICE_HANDLER(mac_via2_in_a)
24502479{
2451   UINT8 result = 0xc0 | mac_nubus_irq_state;
2480   UINT8 result = 0xc0;
2481   mac_state *mac = device->machine->driver_data;
24522482
2453   if ((mac_model == MODEL_MAC_IICI) || (mac_model == MODEL_MAC_IISI))
2483   result |= mac->mac_nubus_irq_state;
2484
2485   if ((mac->mac_model == MODEL_MAC_IICI) || (mac->mac_model == MODEL_MAC_IISI))
24542486   {
24552487      result &= ~0x40;   // RBV wants this clear to boot
24562488   }
r6683r6684
24602492
24612493static READ8_DEVICE_HANDLER(mac_via2_in_b)
24622494{
2463//  logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2495   mac_state *mac = device->machine->driver_data;
24642496
2465   if ((mac_model == MODEL_MAC_LC) || (mac_model == MODEL_MAC_LC_II))
2497//   logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2498
2499   if ((mac->mac_model == MODEL_MAC_LC) || (mac->mac_model == MODEL_MAC_LC_II))
24662500   {
24672501      return 0x4f;
24682502   }
24692503
2470   if (mac_model == MODEL_MAC_SE30)
2504   if (mac->mac_model == MODEL_MAC_SE30)
24712505   {
24722506      return 0x87;   // bits 3 and 6 are tied low on SE/30
24732507   }
r6683r6684
24772511
24782512static WRITE8_DEVICE_HANDLER(mac_via2_out_a)
24792513{
2480//  logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2514//   logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
24812515}
24822516
24832517static WRITE8_DEVICE_HANDLER(mac_via2_out_b)
24842518{
24852519   const device_config *via_0 = devtag_get_device(device->machine, "via6522_0");
24862520
2487//  logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
2521//   logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu")));
24882522
2489//  printf("VIA2 OUT B: %02x (MMU = %02x)\n", data, data & 0x08);
2523//   printf("VIA2 OUT B: %02x (MMU = %02x)\n", data, data & 0x08);
24902524
24912525   // chain 60.15 Hz to VIA1
24922526   via_ca1_w(via_0, 0, data>>7);
r6683r6684
24982532
24992533MACHINE_RESET(mac)
25002534{
2535   mac_state *mac = machine->driver_data;
2536   mac_model_t model_save;
2537   emu_timer *timer_save;
2538
2539   // clear mac state struct
2540   model_save = mac->mac_model;
2541   timer_save = mac->inquiry_timeout;
2542   memset(mac, 0, sizeof(mac_state));
2543   mac->mac_model = model_save;
2544   mac->inquiry_timeout = timer_save;
2545
25012546   last_taken_interrupt = -1;
25022547
25032548   /* initialize real-time clock */
2504   rtc_init();
2549   rtc_init(mac);
25052550
25062551   /* setup the memory overlay */
2507   if (mac_model < MODEL_MAC_POWERMAC_6100)   // no overlay for PowerPC
2552   if (mac->mac_model < MODEL_MAC_POWERMAC_6100)   // no overlay for PowerPC
25082553   set_memory_overlay(machine, 1);
25092554
25102555   /* setup videoram */
25112556   mac_set_screen_buffer(1);
25122557
25132558   /* setup sound */
2514   if (mac_model < MODEL_MAC_II)
2559   if (mac->mac_model < MODEL_MAC_II)
25152560   {
25162561      mac_set_sound_buffer(devtag_get_device(machine, "custom"), 0);
25172562   }
25182563
2519   if (has_adb())
2564   if (has_adb(mac))
25202565   {
2521      adb_reset();
2566      adb_reset(mac);
25222567
25232568      mac_adb_timer = timer_alloc(machine, mac_adb_tick, NULL);
25242569      timer_adjust_oneshot(mac_adb_timer, attotime_never, 0);
25252570   }
25262571
2527   if ((mac_model == MODEL_MAC_SE) || (mac_model == MODEL_MAC_CLASSIC))
2572   if ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC))
25282573   {
25292574      mac_set_sound_buffer(devtag_get_device(machine, "custom"), 1);
25302575
r6683r6684
25332578   }
25342579
25352580   scsi_interrupt = 0;
2536   via2_ca1 = 0;
2537   mac_nubus_irq_state = 0xff;
2581   mac->via2_ca1 = 0;
2582   mac->mac_nubus_irq_state = 0xff;
25382583
25392584   mac_scanline_timer = timer_alloc(machine, mac_scanline_tick, NULL);
25402585   timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0);
r6683r6684
25462591
25472592static STATE_POSTLOAD( mac_state_load )
25482593{
2549   int overlay = mac_overlay;
2550   mac_overlay = -1;
2594   int overlay;
2595   mac_state *mac = machine->driver_data;
2596
2597   overlay = mac->mac_overlay;
2598   mac->mac_overlay = -1;
25512599   set_memory_overlay(machine, overlay);
25522600}
25532601
25542602
25552603static DIRECT_UPDATE_HANDLER (overlay_opbaseoverride)
25562604{
2557   if (mac_overlay != -1)
2605   mac_state *mac = space->machine->driver_data;
2606
2607   if (mac->mac_overlay != -1)
25582608   {
2559      if ((mac_model == MODEL_MAC_SE) || (mac_model == MODEL_MAC_CLASSIC))
2609      if ((mac->mac_model == MODEL_MAC_PORTABLE) || (mac->mac_model == MODEL_MAC_PB100))
25602610      {
2611         if ((address >= 0x900000) && (address <= 0x9fffff))
2612         {
2613            set_memory_overlay(space->machine, 0);      // kill the overlay
2614            mac->mac_overlay = -1;
2615         }
2616      }
2617      else if ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC))
2618      {
25612619         if ((address >= 0x400000) && (address <= 0x4fffff))
25622620         {
25632621            set_memory_overlay(space->machine, 0);      // kill the overlay
2564            mac_overlay = -1;
2622            mac->mac_overlay = -1;
25652623         }
25662624      }
2567      else if ((mac_model == MODEL_MAC_LC) || (mac_model == MODEL_MAC_LC_II))
2625      else if ((mac->mac_model == MODEL_MAC_LC) || (mac->mac_model == MODEL_MAC_LC_II))
25682626      {
25692627         if ((address >= 0xa00000) && (address <= 0xafffff))
25702628         {
25712629            set_memory_overlay(space->machine, 0);      // kill the overlay
2572            mac_overlay = -1;
2630            mac->mac_overlay = -1;
25732631         }
25742632      }
2575      else if ( (mac_model == MODEL_MAC_LC_III) || ((mac_model >= MODEL_MAC_II) && (mac_model <= MODEL_MAC_SE30)) || (mac_model == MODEL_MAC_CLASSIC_II))
2633      else if ( (mac->mac_model == MODEL_MAC_LC_III) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30)) || (mac->mac_model == MODEL_MAC_CLASSIC_II))
25762634      {
25772635         if ((address >= 0x40000000) && (address <= 0x4fffffff))
25782636         {
25792637            set_memory_overlay(space->machine, 0);      // kill the overlay
2580            mac_overlay = -1;
2638            mac->mac_overlay = -1;
25812639         }
25822640      }
25832641   }
r6683r6684
25872645
25882646static void mac_driver_init(running_machine *machine, mac_model_t model)
25892647{
2590   mac_overlay = -1;
2648   mac_state *mac = machine->driver_data;
2649
2650   mac->mac_overlay = -1;
25912651   scsi_interrupt = 0;
2592   mac_model = model;
2652   mac->mac_model = model;
25932653
2594   if (model < MODEL_MAC_II)
2654   if ((mac->mac_model == MODEL_MAC_PORTABLE) || (mac->mac_model == MODEL_MAC_PB100))
25952655   {
2656   }
2657   else if (model < MODEL_MAC_II)
2658   {
25962659      /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
2597      mac_install_memory(machine, 0x600000, 0x6fffff, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, 2);
2660      mac_install_memory(machine, 0x600000, 0x6fffff, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, "bank2");
25982661
25992662      /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */
26002663      mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
2601         memory_region_length(machine, "user1"), memory_region(machine, "user1"), TRUE, 3);
2664         memory_region_length(machine, "bootrom"), memory_region(machine, "bootrom"), TRUE, "bank3");
26022665   }
26032666   else if ((model == MODEL_MAC_LC) || (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III))
26042667   {
2605      mac_install_memory(machine, 0x000000, messram_get_size(devtag_get_device(machine, "messram"))-1, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, 2);
2668      mac_install_memory(machine, 0x000000, messram_get_size(devtag_get_device(machine, "messram"))-1, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, "bank2");
26062669   }
2607   else if ((mac_model == MODEL_MAC_CLASSIC_II) || ((mac_model >= MODEL_MAC_II) && (mac_model <= MODEL_MAC_SE30)))
2670   else if ((mac->mac_model == MODEL_MAC_CLASSIC_II) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30)))
26082671   {
2609      mac_install_memory(machine, 0x00000000, 0x3fffffff, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, 2);
2672      mac_install_memory(machine, 0x00000000, 0x3fffffff, messram_get_size(devtag_get_device(machine, "messram")), messram_get_ptr(devtag_get_device(machine, "messram")), FALSE, "bank2");
26102673   }
26112674
26122675   set_memory_overlay(machine, 1);
2613   mac_overlay = 1;
2676   mac->mac_overlay = 1;
26142677
26152678   memset(messram_get_ptr(devtag_get_device(machine, "messram")), 0, messram_get_size(devtag_get_device(machine, "messram")));
26162679
2617   if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) ||
2618       (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || ((mac_model >= MODEL_MAC_II) && (mac_model <= MODEL_MAC_SE30)))
2680   if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) ||
2681       (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30)) ||
2682       (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100))
26192683   {
26202684      memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), overlay_opbaseoverride);
26212685   }
26222686
26232687   /* setup keyboard */
2624   keyboard_init();
2688   keyboard_init(mac);
26252689
2626   inquiry_timeout = timer_alloc(machine, inquiry_timeout_func, NULL);
2690   mac->inquiry_timeout = timer_alloc(machine, inquiry_timeout_func, NULL);
26272691
26282692   /* save state stuff */
2629   state_save_register_global(machine, mac_overlay);
2693   state_save_register_global(machine, mac->mac_overlay);
26302694   state_save_register_postload(machine, mac_state_load, NULL);
26312695}
26322696
r6683r6684
26482712    { SCSI_ID_5, "harddisk2", SCSI_DEVICE_HARDDISK }   /* SCSI ID 5, using disk2, and it's a harddisk */
26492713   }
26502714};
2651
2715                   
26522716static const struct NCR5380interface macplus_5380intf =
26532717{
26542718   &dev_table,   // SCSI device table
r6683r6684
26692733
26702734DRIVER_INIT(macplus)
26712735{
2672//  UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2736//   UINT32 *ROM = (UINT32 *)memory_region(machine, "bootrom");
26732737
2674//  ROM[0x1aefc/4] = 0x6bbe709e;    // AppleTalk: change bpl to bmi
2738//   ROM[0x1aefc/4] = 0x6bbe709e;   // AppleTalk: change bpl to bmi
26752739
26762740   mac_driver_init(machine, MODEL_MAC_PLUS);
26772741}
r6683r6684
27042768// make the appletalk init fail instead of hanging on the II FDHD/IIx/IIcx/SE30 ROM
27052769static void patch_appletalk_iix(running_machine *machine)
27062770{
2707   UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2771   UINT32 *ROM = (UINT32 *)memory_region(machine, "bootrom");
27082772
27092773   ROM[0x2cc94/4] = 0x6bbe709e;   // bmi 82cc54 moveq #-$62, d0
27102774   ROM[0x370c/4] = 0x4e714e71;   // nop nop - disable ROM checksum
r6683r6684
27312795
27322796DRIVER_INIT(maciici)
27332797{
2734   UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2798   UINT32 *ROM = (UINT32 *)memory_region(machine, "bootrom");
27352799
27362800   ROM[0x4569c/4] = 0x4ed64e71;   // jmp (a6) / nop (skip FPU test)
27372801   ROM[0x446b4/4] = 0x4e714e71;   // nop nop - disable ROM checksum
r6683r6684
27662830   mac_driver_init(machine, MODEL_MAC_POWERMAC_6100);
27672831}
27682832
2833DRIVER_INIT(macprtb)
2834{
2835   mac_driver_init(machine, MODEL_MAC_PORTABLE);
2836}
2837
2838DRIVER_INIT(macpb100)
2839{
2840   mac_driver_init(machine, MODEL_MAC_PB100);
2841}
2842
27692843void mac_nubus_slot_interrupt(running_machine *machine, UINT8 slot, UINT32 state)
27702844{
27712845   UINT8 masks[6] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20 };
2846   mac_state *mac = machine->driver_data;
27722847
27732848   // NuBus slot must be 9 through E
27742849   assert((slot >= 9) && (slot <= 0xe));
r6683r6684
27772852
27782853   if (state)
27792854   {
2780      mac_nubus_irq_state &= ~masks[slot];
2855      mac->mac_nubus_irq_state &= ~masks[slot];
27812856   }
27822857   else
27832858   {
2784      mac_nubus_irq_state |= masks[slot];
2859      mac->mac_nubus_irq_state |= masks[slot];
27852860   }
27862861
2787   if ((mac_nubus_irq_state & 0x3f) != 0x3f)
2862   if ((mac->mac_nubus_irq_state & 0x3f) != 0x3f)
27882863   {
27892864      const device_config *via_1 = devtag_get_device(machine, "via6522_1");
27902865
2791      via2_ca1 ^= 1;
2792      via_ca1_w(via_1, 0, via2_ca1);
2866      mac->via2_ca1 ^= 1;
2867      via_ca1_w(via_1, 0, mac->via2_ca1);
27932868   }
27942869}
27952870
r6683r6684
27972872{
27982873   static int irq_count = 0, ca1_data = 0, ca2_data = 0;
27992874   const device_config *via_0 = devtag_get_device(machine, "via6522_0");
2875   mac_state *mac = machine->driver_data;
28002876
28012877   /* handle ADB keyboard/mouse */
2802   if (has_adb())
2878   if (has_adb(mac))
28032879   {
28042880      adb_vblank(machine);
28052881   }
28062882
28072883   /* handle keyboard */
2808   if (kbd_comm == TRUE)
2884   if (mac->kbd_comm == TRUE)
28092885   {
28102886      int keycode = scan_keyboard(machine);
28112887
r6683r6684
28152891
28162892         logerror("keyboard enquiry successful, keycode %X\n", keycode);
28172893
2818         timer_reset(inquiry_timeout, attotime_never);
2894         timer_reset(mac->inquiry_timeout, attotime_never);
28192895         kbd_shift_out(machine, keycode);
28202896      }
28212897   }
28222898
28232899   /* signal VBlank on CA1 input on the VIA */
2824   if (mac_model < MODEL_MAC_II)
2900   if (mac->mac_model < MODEL_MAC_II)
28252901   {
28262902      ca1_data ^= 1;
28272903      via_ca1_w(via_0, 0, ca1_data);
r6683r6684
28352911      /* signal 1 Hz irq on CA2 input on the VIA */
28362912      via_ca2_w(via_0, 0, ca2_data);
28372913
2838      rtc_incticks();
2914      rtc_incticks(mac);
28392915   }
28402916
28412917   // handle SE/30 vblank IRQ
2842   if (mac_model == MODEL_MAC_SE30)
2918   if (mac->mac_model == MODEL_MAC_SE30)
28432919   {
2844      if (mac_se30_vbl_enable)
2920      if (mac->mac_se30_vbl_enable)
28452921      {
2846         mac_via2_vbl ^= 1;
2847         if (!mac_via2_vbl)
2922         mac->mac_via2_vbl ^= 1;
2923         if (!mac->mac_via2_vbl)
28482924         {
28492925            mac_nubus_slot_interrupt(machine, 0xe, 1);
28502926         }
r6683r6684
28552931static TIMER_CALLBACK(mac_scanline_tick)
28562932{
28572933   int scanline;
2934   mac_state *mac = machine->driver_data;
28582935
2859   if (mac_model < MODEL_MAC_II)
2936   if (mac->mac_model < MODEL_MAC_II)
28602937   {
28612938      mac_sh_updatebuffer(devtag_get_device(machine, "custom"));
28622939   }
r6683r6684
28662943      mac_vblank_irq(machine);
28672944
28682945   /* check for mouse changes at 10 irqs per frame */
2869   if (mac_model <= MODEL_MAC_PLUS)
2946   if (mac->mac_model <= MODEL_MAC_PLUS)
28702947   {
28712948      if (!(scanline % 10))
28722949         mouse_callback(machine);
src/mess/drivers/mac.c
r6683r6684
11/****************************************************************************
22
3    drivers/mac.c
4    Macintosh family emulation
3   drivers/mac.c
4   Macintosh family emulation
5 
6   Nate Woods, Raphael Nabet, R. Belmont
7 
8 
9       0x000000 - 0x3fffff     RAM/ROM (switches based on overlay)
10       0x400000 - 0x4fffff     ROM
11        0x580000 - 0x5fffff     5380 NCR/Symbios SCSI peripherals chip (Mac Plus only)
12        0x600000 - 0x6fffff     RAM
13       0x800000 - 0x9fffff     Zilog 8530 SCC (Serial Control Chip) Read
14       0xa00000 - 0xbfffff     Zilog 8530 SCC (Serial Control Chip) Write
15       0xc00000 - 0xdfffff     IWM (Integrated Woz Machine; floppy)
16       0xe80000 - 0xefffff     Rockwell 6522 VIA
17       0xf00000 - 0xffffef     ??? (the ROM appears to be accessing here)
18       0xfffff0 - 0xffffff     Auto Vector
19   
20   
21   Interrupts:
22       M68K:
23           Level 1 from VIA
24           Level 2 from SCC
25           Level 4 : Interrupt switch (not implemented)
26 
27       VIA:
28           CA1 from VBLANK
29           CA2 from 1 Hz clock (RTC)
30           CB1 from Keyboard Clock
31           CB2 from Keyboard Data
32           SR  from Keyboard Data Ready
33   
34       SCC:
35           PB_EXT  from mouse Y circuitry
36           PA_EXT  from mouse X circuitry
537
6    Nate Woods, Raphael Nabet, R. Belmont
7
8
9        0x000000 - 0x3fffff     RAM/ROM (switches based on overlay)
10        0x400000 - 0x4fffff     ROM
11        0x580000 - 0x5fffff     5380 NCR/Symbios SCSI peripherals chip (Mac Plus only)
12        0x600000 - 0x6fffff     RAM
13        0x800000 - 0x9fffff     Zilog 8530 SCC (Serial Control Chip) Read
14        0xa00000 - 0xbfffff     Zilog 8530 SCC (Serial Control Chip) Write
15        0xc00000 - 0xdfffff     IWM (Integrated Woz Machine; floppy)
16        0xe80000 - 0xefffff     Rockwell 6522 VIA
17        0xf00000 - 0xffffef     ??? (the ROM appears to be accessing here)
18        0xfffff0 - 0xffffff     Auto Vector
19
20
21    Interrupts:
22        M68K:
23            Level 1 from VIA
24            Level 2 from SCC
25            Level 4 : Interrupt switch (not implemented)
26
27        VIA:
28            CA1 from VBLANK
29            CA2 from 1 Hz clock (RTC)
30            CB1 from Keyboard Clock
31            CB2 from Keyboard Data
32            SR  from Keyboard Data Ready
33
34        SCC:
35            PB_EXT  from mouse Y circuitry
36            PA_EXT  from mouse X circuitry
37
3838****************************************************************************/
3939
4040#include "driver.h"
r6683r6684
5151#include "sound/dmadac.h"
5252
5353/*
54    Apple Sound Chip
54   Apple Sound Chip
5555
56    Base is normally IOBase + 0x14000
57    First 0x800 bytes is buffer RAM
56   Base is normally IOBase + 0x14000
57   First 0x800 bytes is buffer RAM
5858
59    Verified to be only 8 bits wide by Apple documentation.
59   Verified to be only 8 bits wide by Apple documentation.
6060
61    Registers:
62    0x800: VERSION
63    0x801: MODE
64    0x802: CONTROL
65    0x803: FIFO MODE (bit 0 = half, bit 1 = full?)
66    0x804: FIFO IRQ STATUS
67    0x805: WAVETABLE CONTROL
68    0x806: VOLUME
69    0x807: CLOCK RATE (0 = 22 kHz)
70    0x80a: PLAY REC A
61   Registers:
62   0x800: VERSION
63   0x801: MODE
64   0x802: CONTROL
65   0x803: FIFO MODE (bit 0 = half, bit 1 = full?)
66   0x804: FIFO IRQ STATUS
67   0x805: WAVETABLE CONTROL
68   0x806: VOLUME
69   0x807: CLOCK RATE (0 = 22 kHz)
70   0x80a: PLAY REC A
71
72   Should become it's own device.
7173*/
7274
73static UINT8 mac_asc_regs[0x2000];
74
7575static READ8_HANDLER(mac_asc_r)
7676{
77//  logerror("ASC: Read @ %x (PC %x)\n", offset, cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")));
77   mac_state *mac = space->machine->driver_data;
7878
79//   logerror("ASC: Read @ %x (PC %x)\n", offset, cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")));
80
7981   switch (offset)
8082   {
8183      case 0:   // VERSION
r6683r6684
8688         break;
8789   }
8890
89   return mac_asc_regs[offset];
91   return mac->mac_asc_regs[offset];
9092}
9193
92static INT16 xfersamples[0x800];
93
9494static WRITE8_HANDLER(mac_asc_w)
9595{
9696   static const device_config *dacs[2];
9797   INT32 i;
98   mac_state *mac = space->machine->driver_data;
9899
99//  logerror("ASC: %02x to %x (PC %x)\n", data, offset, cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")));
100//   logerror("ASC: %02x to %x (PC %x)\n", data, offset, cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")));
100101
101   mac_asc_regs[offset] = data;
102   mac->mac_asc_regs[offset] = data;
102103
103104   switch (offset)
104105   {
r6683r6684
123124      case 0x7ff:
124125         for (i = 0; i < 0x200; i++)
125126         {
126            xfersamples[i] = (INT16)mac_asc_regs[i]<<8;
127            mac->xfersamples[i] = (INT16)mac->mac_asc_regs[i]<<8;
127128         }
128129
129         dmadac_transfer(&dacs[0], 1, 1, 1, 0x200, xfersamples);
130         dmadac_transfer(&dacs[1], 1, 1, 1, 0x200, xfersamples);
130         dmadac_transfer(&dacs[0], 1, 1, 1, 0x200, mac->xfersamples);
131         dmadac_transfer(&dacs[1], 1, 1, 1, 0x200, mac->xfersamples);
131132         break;
132133   }
133134}
r6683r6684
432433   return 0xa55a0001;   // 25 MHz LC III
433434}
434435
436// Portable/PB100 video
437static VIDEO_START( mac_prtb )
438{
439}
440
441static VIDEO_UPDATE( mac_prtb )
442{
443   return 0;
444}
445
435446/***************************************************************************
436447    ADDRESS MAPS
437448***************************************************************************/
r6683r6684
453464   AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w)
454465ADDRESS_MAP_END
455466
467static ADDRESS_MAP_START(macprtb_map, ADDRESS_SPACE_PROGRAM, 16)
468   AM_RANGE(0x900000, 0x93ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0c0000)
469   AM_RANGE(0xf60000, 0xf6ffff) AM_READWRITE(mac_iwm_r, mac_iwm_w)
470   AM_RANGE(0xf70000, 0xf7ffff) AM_READWRITE(mac_via_r, mac_via_w)
471   AM_RANGE(0xf90000, 0xf9ffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w)
472//   AM_RANGE(0xfa0000, 0xfaffff) AM_RAM   // video RAM? registers?
473   AM_RANGE(0xfb0000, 0xfbffff) AM_READWRITE8(mac_asc_r, mac_asc_w, 0xffff)
474   AM_RANGE(0xfd0000, 0xfdffff) AM_READWRITE(mac_scc_r, mac_scc_2_w)
475   AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w)
476ADDRESS_MAP_END
477
456478static ADDRESS_MAP_START(maclc_map, ADDRESS_SPACE_PROGRAM, 32)
457   AM_RANGE(0x00a00000, 0x00a7ffff) AM_ROM AM_REGION("user1", 0)   // ROM (in 32-bit mode)
479   AM_RANGE(0x00a00000, 0x00a7ffff) AM_ROM AM_REGION("bootrom", 0)   // ROM (in 32-bit mode)
458480
459481   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
460482   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
r6683r6684
474496ADDRESS_MAP_END
475497
476498static ADDRESS_MAP_START(maclc3_map, ADDRESS_SPACE_PROGRAM, 32)
477   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ffc0000)
499   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000)
478500
479   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
480   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
481   // 50f06000-7fff = SCSI handshake
501   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
502   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000)
503   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff) AM_MIRROR(0x00f00000)
504   AM_RANGE(0x50016000, 0x50017fff) AM_READ(mac_swim_r) AM_WRITENOP AM_MIRROR(0x00f00000)
505   AM_RANGE(0x50024000, 0x50024003) AM_WRITE(mac_sonora_ramdac_w) AM_MIRROR(0x00f00000)
506   AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_sonora_r, mac_sonora_w, 0xffffffff)    AM_MIRROR(0x00f00000)// VIA2 (Sonora)
482507
483   // 50f10000-1fff = SCSI
484   // 50f12000-3fff = SCSI DMA
485   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
486   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
487   // 50f18000-9fff = PWMs
488
489   // 50f24000-5fff = VDAC (palette)
490   AM_RANGE(0x50f24000, 0x50f24003) AM_WRITE(mac_sonora_ramdac_w)
491   AM_RANGE(0x50f26000, 0x50f27fff) AM_READWRITE16(mac_sonora_r, mac_sonora_w, 0xffffffff)   // VIA2 (Sonora)
492
493508   AM_RANGE(0x5ffffffc, 0x5fffffff) AM_READ(mac_lc3_id)
494509
495   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("user1", 0x78000)
510   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("bootrom", 0x78000)
496511ADDRESS_MAP_END
497512
498513static ADDRESS_MAP_START(macii_map, ADDRESS_SPACE_PROGRAM, 32)
499   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ffc0000)
514   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000)
500515
501516   // MMU remaps I/O without the F
502   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
503   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
504   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
505   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w)
506   AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r)
507   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
508   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r)
509   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
510   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
517   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
518   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000)
519   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000)
520   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000)             
521   AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
522   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000)
523   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
524   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff) AM_MIRROR(0x00f00000)
525   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000)
526   AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
511527
512   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
513   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
514   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
515   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
516   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
517
518   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
519   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
520   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
521   AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
522
523   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
524
525528   // RasterOps 264 640x480 fixed-res color video card (8, 16, or 24 bit)
526529   AM_RANGE(0xfe000000, 0xfe1fffff) AM_RAM   AM_BASE(&mac_cb264_vram) // supposed to be 1.5 megs of VRAM, but every other word?
527530   AM_RANGE(0xfeff6000, 0xfeff60ff) AM_READWRITE( mac_cb264_r, mac_cb264_w )
r6683r6684
530533ADDRESS_MAP_END
531534
532535static ADDRESS_MAP_START(maciici_map, ADDRESS_SPACE_PROGRAM, 32)
533   AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ff80000)
536   AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000)
534537
535   // MMU remaps I/O without the F
536   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
537   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
538   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
539   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000)
540   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000)
541   AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
542   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000)
543   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
544   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff) AM_MIRROR(0x00f00000)
545   AM_RANGE(0x50016000, 0x50017fff) AM_READ(mac_swim_r) AM_WRITENOP AM_MIRROR(0x00f00000)
546   AM_RANGE(0x50024000, 0x50024007) AM_WRITE( rbv_ramdac_w ) AM_MIRROR(0x00f00000)
547   AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_rbv_r, mac_rbv_w, 0xffffffff) AM_MIRROR(0x00f00000)
548   AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
538549
539   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
540   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r)
541   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
542   AM_RANGE(0x50016000, 0x50017fff) AM_READ(mac_swim_r) AM_WRITENOP
543
544   AM_RANGE(0x50024000, 0x50024007) AM_WRITE( rbv_ramdac_w )
545   AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_rbv_r, mac_rbv_w, 0xffffffff)
546
547   AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
548
549   // upper (need to use AM_MIRROR for this)
550
551   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
552   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
553   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
554   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
555
556   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
557   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
558   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
559   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
560
561   // 50f24000 = VDAC
562   AM_RANGE(0x50f26000, 0x50f27fff) AM_READWRITE16(mac_rbv_r, mac_rbv_w, 0xffffffff)
563   // 51000000-51ffffff = RBV (framebuffer?)
564
565   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
566
567550   // mirror video declaration ROM
568551   AM_RANGE(0xfee00000, 0xfee7ffff) AM_RAM AM_BASE(&rbv_vram)
569//  AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("user1", 0x78000)
552//   AM_RANGE(0xfeff8000, 0xfeffffff) AM_ROM AM_REGION("bootrom", 0x78000)
570553ADDRESS_MAP_END
571554
572555static ADDRESS_MAP_START(macse30_map, ADDRESS_SPACE_PROGRAM, 32)
573   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ffc0000)
556   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000)
574557
575   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
576   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
577   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
578   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
579   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
558   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
559   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000)
560   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000)
561   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000)
562   AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
563   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000)
564   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
565   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff) AM_MIRROR(0x00f00000)
566   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000)
567   AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)   // mirror
580568
581   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
582   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
583   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
584   AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
585
586   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
587
588569   AM_RANGE(0xfe000000, 0xfe00ffff) AM_RAM   AM_BASE(&mac_se30_vram)
589570   AM_RANGE(0xfeffe000, 0xfeffffff) AM_ROM AM_REGION("se30vrom", 0x0)
590571ADDRESS_MAP_END
591572
592573static ADDRESS_MAP_START(macclas2_map, ADDRESS_SPACE_PROGRAM, 32)
593   AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ff80000)
574   AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000)
594575
595   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
596   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
597   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
598
599   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
600   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
601   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
602   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
603   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
604
605   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
576   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)
577   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000)
578   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000)
579   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000)
580   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000)
581   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000)
582   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff) AM_MIRROR(0x00f00000)
583   AM_RANGE(0x50016000, 0x50017fff) AM_READ(mac_swim_r) AM_WRITENOP AM_MIRROR(0x00f00000)
584   AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000)   // mirror
606585ADDRESS_MAP_END
607586
608587static ADDRESS_MAP_START(pwrmac_map, ADDRESS_SPACE_PROGRAM, 64)
609   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ffc0000)
588   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000)
610589
611   // MMU remaps I/O without the F
612   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff))
613   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff))
614   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff))
615   AM_RANGE(0x50006000, 0x50006007) AM_WRITE32(macii_scsi_drq_w,U64(0xffffffffffffffff))
616   AM_RANGE(0x50006060, 0x50006067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff))
617   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff))
618   AM_RANGE(0x50012060, 0x50012067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff))
619   AM_RANGE(0x50014000, 0x50015fff) AM_READWRITE8(mac_asc_r, mac_asc_w, U64(0xffffffffffffffff))
620   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff))
590   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
591   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
592   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
593   AM_RANGE(0x50006000, 0x50006007) AM_WRITE32(macii_scsi_drq_w,U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
594   AM_RANGE(0x50006060, 0x50006067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
595   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
596   AM_RANGE(0x50012060, 0x50012067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
597   AM_RANGE(0x50014000, 0x50015fff) AM_READWRITE8(mac_asc_r, mac_asc_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
598   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000)
621599
622   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff))
623   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff))
624   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff))
625   AM_RANGE(0x50f06000, 0x50f06007) AM_WRITE32(macii_scsi_drq_w,U64(0xffffffffffffffff))
626   AM_RANGE(0x50f06060, 0x50f06067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff))
627
628   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff))
629   AM_RANGE(0x50f12060, 0x50f12067) AM_READ32(macii_scsi_drq_r,U64(0xffffffffffffffff))
630   AM_RANGE(0x50f14000, 0x50f15fff) AM_READWRITE8(mac_asc_r, mac_asc_w, U64(0xffffffffffffffff))
631   AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff))
632
633   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff))   // mirror
634
635//  AM_RANGE(0xff000000, 0xff3fffff) AM_ROM AM_REGION("user1", 0)
636//  AM_RANGE(0xff400000, 0xff7fffff) AM_ROM AM_REGION("user1", 0)
637//  AM_RANGE(0xff800000, 0xffbfffff) AM_ROM AM_REGION("user1", 0)
638   AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
600   AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom", 0)
639601ADDRESS_MAP_END
640602
641603/***************************************************************************
r6683r6684
683645};
684646
685647static MACHINE_DRIVER_START( mac512ke )
648   MDRV_DRIVER_DATA(mac_state)
649
686650   /* basic machine hardware */
687651   MDRV_CPU_ADD("maincpu", M68000, 7833600)        /* 7.8336 MHz */
688652   MDRV_CPU_PROGRAM_MAP(mac512ke_map)
r6683r6684
715679   /* devices */
716680   MDRV_IWM_ADD("fdc", mac_iwm_interface)
717681   MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac128512_floppy_config)
718
682   
719683   MDRV_SCC8530_ADD("scc")
720684   MDRV_SCC8530_ACK(mac_scc_ack)
721685   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
722
686   
723687   /* internal ram */
724688   MDRV_RAM_ADD("messram")
725689   MDRV_RAM_DEFAULT_SIZE("512K")
r6683r6684
727691
728692static MACHINE_DRIVER_START( mac128k )
729693   MDRV_IMPORT_FROM( mac512ke )
730
694   
731695   /* internal ram */
732696   MDRV_RAM_MODIFY("messram")
733697   MDRV_RAM_DEFAULT_SIZE("128K")
r6683r6684
742706
743707   MDRV_HARDDISK_ADD( "harddisk1" )
744708   MDRV_HARDDISK_ADD( "harddisk2" )
745
709   
746710   MDRV_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_config)
747
711   
748712   /* internal ram */
749713   MDRV_RAM_MODIFY("messram")
750714   MDRV_RAM_DEFAULT_SIZE("4M")
751715   MDRV_RAM_EXTRA_OPTIONS("512K,2M,2560K,4M")
752716MACHINE_DRIVER_END
753717
754
755718static MACHINE_DRIVER_START( macse )
756719   MDRV_IMPORT_FROM( macplus )
757720
758721   MDRV_DEVICE_REMOVE("via6522_0")
759722   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf)
760
723   
761724   /* internal ram */
762725   MDRV_RAM_MODIFY("messram")
763726   MDRV_RAM_DEFAULT_SIZE("4M")
764727   MDRV_RAM_EXTRA_OPTIONS("2M,2560K,4M")
765728MACHINE_DRIVER_END
766729
730static MACHINE_DRIVER_START( macprtb )
731   MDRV_IMPORT_FROM( macplus )
732
733   MDRV_CPU_MODIFY( "maincpu" )
734   MDRV_CPU_PROGRAM_MAP(macprtb_map)
735
736   MDRV_DEVICE_REMOVE("via6522_0")
737   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf)
738
739   MDRV_SCREEN_MODIFY("screen")
740   MDRV_SCREEN_SIZE(640, 400)
741   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
742   MDRV_PALETTE_LENGTH(256)
743
744   MDRV_VIDEO_START(mac_prtb)
745   MDRV_VIDEO_UPDATE(mac_prtb)
746   
747   /* internal ram */
748   MDRV_RAM_MODIFY("messram")
749   MDRV_RAM_DEFAULT_SIZE("2M")
750   MDRV_RAM_EXTRA_OPTIONS("2M,4M,6M,8M")
751
752   MDRV_SOUND_ADD("ascal", DMADAC, 0)
753   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
754   MDRV_SOUND_ADD("ascar", DMADAC, 0)
755   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
756   MDRV_SOUND_ADD("ascbl", DMADAC, 0)
757   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
758   MDRV_SOUND_ADD("ascbr", DMADAC, 0)
759   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
760MACHINE_DRIVER_END
761
767762static MACHINE_DRIVER_START( macii )
763   MDRV_DRIVER_DATA(mac_state)
764
768765   /* basic machine hardware */
769766   MDRV_CPU_ADD("maincpu", M68020_68851, 7833600*2)
770767   MDRV_CPU_PROGRAM_MAP(macii_map)
r6683r6684
804801   /* devices */
805802   MDRV_IWM_ADD("fdc", mac_iwm_interface)
806803   MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_config)
807
804   
808805   MDRV_SCC8530_ADD("scc")
809806   MDRV_SCC8530_ACK(mac_scc_ack)
810807   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
r6683r6684
815812
816813   MDRV_HARDDISK_ADD( "harddisk1" )
817814   MDRV_HARDDISK_ADD( "harddisk2" )
818
815   
819816   /* internal ram */
820817   MDRV_RAM_ADD("messram")
821818   MDRV_RAM_DEFAULT_SIZE("2M")
r6683r6684
835832
836833   MDRV_RAM_MODIFY("messram")
837834   MDRV_RAM_DEFAULT_SIZE("2M")
838   MDRV_RAM_EXTRA_OPTIONS("4M,6M,8M,10M")
835   MDRV_RAM_EXTRA_OPTIONS("4M,6M,8M,10M")   
839836MACHINE_DRIVER_END
840837
841838static MACHINE_DRIVER_START( maclc2 )
r6683r6684
846843
847844   MDRV_RAM_MODIFY("messram")
848845   MDRV_RAM_DEFAULT_SIZE("4M")
849   MDRV_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M")
846   MDRV_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M")   
850847MACHINE_DRIVER_END
851848
852849static MACHINE_DRIVER_START( maclc3 )
r6683r6684
860857
861858   MDRV_RAM_MODIFY("messram")
862859   MDRV_RAM_DEFAULT_SIZE("4M")
863   MDRV_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M")
860   MDRV_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M")   
864861MACHINE_DRIVER_END
865862
866863static MACHINE_DRIVER_START( maciix )
r6683r6684
875872MACHINE_DRIVER_END
876873
877874static MACHINE_DRIVER_START( macse30 )
875   MDRV_DRIVER_DATA(mac_state)
876
878877   MDRV_CPU_ADD("maincpu", M68030, 7833600*2)
879878   MDRV_CPU_PROGRAM_MAP(macse30_map)
880879
r6683r6684
896895
897896   MDRV_VIDEO_START(mac)
898897   MDRV_VIDEO_UPDATE(macse30)
899
898             
900899   /* sound hardware */
901900   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
902901   MDRV_SOUND_ADD("ascal", DMADAC, 0)
r6683r6684
914913   /* devices */
915914   MDRV_IWM_ADD("fdc", mac_iwm_interface)
916915   MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_config)
917
916   
918917   MDRV_SCC8530_ADD("scc")
919918   MDRV_SCC8530_ACK(mac_scc_ack)
920919   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
r6683r6684
925924
926925   MDRV_HARDDISK_ADD( "harddisk1" )
927926   MDRV_HARDDISK_ADD( "harddisk2" )
928
927   
929928   /* internal ram */
930929   MDRV_RAM_ADD("messram")
931930   MDRV_RAM_DEFAULT_SIZE("2M")
r6683r6684
952951
953952   MDRV_VIDEO_START(maclc)
954953   MDRV_VIDEO_UPDATE(macrbv)
955
954   
956955   /* internal ram */
957956   MDRV_RAM_MODIFY("messram")
958957   MDRV_RAM_DEFAULT_SIZE("2M")
r6683r6684
969968
970969   MDRV_VIDEO_START(maclc)
971970   MDRV_VIDEO_UPDATE(macrbv)
972
971   
973972   /* internal ram */
974973   MDRV_RAM_MODIFY("messram")
975974   MDRV_RAM_DEFAULT_SIZE("2M")
r6683r6684
977976MACHINE_DRIVER_END
978977
979978static MACHINE_DRIVER_START( pwrmac )
979   MDRV_DRIVER_DATA(mac_state)
980
980981   /* basic machine hardware */
981982   MDRV_CPU_ADD("maincpu", PPC601, 66000000)
982983   MDRV_CPU_PROGRAM_MAP(pwrmac_map)
r6683r6684
10151016   /* devices */
10161017   MDRV_IWM_ADD("fdc", mac_iwm_interface)
10171018   MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_config)
1018
1019   
10191020   MDRV_SCC8530_ADD("scc")
10201021   MDRV_SCC8530_ACK(mac_scc_ack)
10211022   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
r6683r6684
10261027
10271028   MDRV_HARDDISK_ADD( "harddisk1" )
10281029   MDRV_HARDDISK_ADD( "harddisk2" )
1029
1030   
10301031   /* internal ram */
10311032   MDRV_RAM_ADD("messram")
10321033   MDRV_RAM_DEFAULT_SIZE("8M")
r6683r6684
12361237   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)         PORT_CHAR('`') PORT_CHAR('~')
12371238   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE)      PORT_CHAR(8)
12381239   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED)   /* keyboard Enter : */
1239   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc")      PORT_CODE(KEYCODE_ESC)      PORT_CHAR(27)
1240   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL)
1240   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc")      PORT_CODE(KEYCODE_ESC)      PORT_CHAR(27)                     
1241   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL)   
12411242   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command / Open Apple") PORT_CODE(KEYCODE_LALT)
12421243   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
12431244   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
r6683r6684
12521253   PORT_START("KEY4")
12531254   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED)   // 0x40
12541255   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD)         PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))   // 0x41
1255   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED)   // 0x42
1256   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED)   // 0x42
12561257   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK)         PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))   // 0x43
12571258   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED)   // 0x44
12581259   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD)         PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 0x45
r6683r6684
12871288
12881289  Game driver(s)
12891290
1290  The Mac driver uses a convention of placing the BIOS in "user1"
1291  The Mac driver uses a convention of placing the BIOS in "bootrom"
12911292
12921293***************************************************************************/
12931294
12941295ROM_START( mac128k )
1295   ROM_REGION16_BE(0x20000, "user1", 0)
1296   ROM_REGION16_BE(0x20000, "bootrom", 0)
12961297   ROM_LOAD16_WORD( "mac128k.rom",  0x00000, 0x10000, CRC(6d0c8a28) SHA1(9d86c883aa09f7ef5f086d9e32330ef85f1bc93b) )
12971298ROM_END
12981299
12991300ROM_START( mac512k )
1300   ROM_REGION16_BE(0x20000, "user1", 0)
1301   ROM_REGION16_BE(0x20000, "bootrom", 0)
13011302   ROM_LOAD16_WORD( "mac512k.rom",  0x00000, 0x10000, CRC(cf759e0d) SHA1(5b1ced181b74cecd3834c49c2a4aa1d7ffe944d7) )
13021303ROM_END
13031304
13041305ROM_START( mac512ke )
1305   ROM_REGION16_BE(0x20000, "user1", 0)
1306   ROM_REGION16_BE(0x20000, "bootrom", 0)
13061307   ROM_LOAD16_WORD( "macplus.rom",  0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f))
13071308ROM_END
13081309
13091310
13101311ROM_START( macplus )
1311   ROM_REGION16_BE(0x20000, "user1", 0)
1312   ROM_REGION16_BE(0x20000, "bootrom", 0)
13121313   ROM_LOAD16_WORD( "macplus.rom",  0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f))
13131314ROM_END
13141315
13151316
13161317ROM_START( macse )
1317   ROM_REGION16_BE(0x40000, "user1", 0)
1318   ROM_REGION16_BE(0x40000, "bootrom", 0)
13181319   ROM_LOAD16_WORD( "macse.rom",  0x00000, 0x40000, CRC(0f7ff80c) SHA1(58532b7d0d49659fd5228ac334a1b094f0241968))
13191320ROM_END
13201321
13211322ROM_START( macsefd )
1322   ROM_REGION16_BE(0x40000, "user1", 0)
1323   ROM_REGION16_BE(0x40000, "bootrom", 0)
13231324        ROM_LOAD( "be06e171.rom", 0x000000, 0x040000, CRC(f530cb10) SHA1(d3670a90273d12e53d86d1228c068cb660b8c9d1) )
13241325ROM_END
13251326
13261327ROM_START( macclasc )
1327   ROM_REGION16_BE(0x80000, "user1", 0)
1328   ROM_REGION16_BE(0x80000, "bootrom", 0)
13281329        ROM_LOAD( "a49f9914.rom", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) )
13291330ROM_END
13301331
13311332ROM_START( maclc )
1332   ROM_REGION32_BE(0x80000, "user1", 0)
1333   ROM_REGION32_BE(0x80000, "bootrom", 0)
13331334        ROM_LOAD("350eacf0.rom", 0x000000, 0x080000, CRC(71681726) SHA1(6bef5853ae736f3f06c2b4e79772f65910c3b7d4))
13341335ROM_END
13351336
13361337ROM_START( macii )
1337   ROM_REGION32_BE(0x40000, "user1", 0)
1338   ROM_REGION32_BE(0x40000, "bootrom", 0)
13381339   ROM_LOAD( "9779d2c4.rom", 0x000000, 0x040000, CRC(4df6d054) SHA1(db6b504744281369794e26ba71a6e385cf6227fa) )
13391340
13401341   // RasterOps "ColorBoard 264" NuBus video card
r6683r6684
13441345ROM_END
13451346
13461347ROM_START( mac2fdhd )   // same ROM for II FDHD, IIx, IIcx, and SE/30
1347   ROM_REGION32_BE(0x40000, "user1", 0)
1348   ROM_REGION32_BE(0x40000, "bootrom", 0)
13481349        ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) )
13491350
13501351   // RasterOps "ColorBoard 264" NuBus video card
r6683r6684
13541355ROM_END
13551356
13561357ROM_START( maciix )
1357   ROM_REGION32_BE(0x40000, "user1", 0)
1358   ROM_REGION32_BE(0x40000, "bootrom", 0)
13581359        ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) )
13591360
13601361   // RasterOps "ColorBoard 264" NuBus video card
r6683r6684
13641365ROM_END
13651366
13661367ROM_START( maciicx )
1367   ROM_REGION32_BE(0x40000, "user1", 0)
1368   ROM_REGION32_BE(0x40000, "bootrom", 0)
13681369        ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) )
13691370
13701371   // RasterOps "ColorBoard 264" NuBus video card
r6683r6684
13741375ROM_END
13751376
13761377ROM_START( macse30 )
1377   ROM_REGION32_BE(0x40000, "user1", 0)
1378   ROM_REGION32_BE(0x40000, "bootrom", 0)
13781379        ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) )
13791380
13801381   ROM_REGION32_BE(0x2000, "se30vrom", 0)
r6683r6684
13821383ROM_END
13831384
13841385ROM_START( maciici )
1385   ROM_REGION32_BE(0x80000, "user1", 0)
1386   ROM_REGION32_BE(0x80000, "bootrom", 0)
13861387        ROM_LOAD( "368cadfe.rom", 0x000000, 0x080000, CRC(46adbf74) SHA1(b54f9d2ed16b63c49ed55adbe4685ebe73eb6e80) )
13871388ROM_END
13881389
13891390ROM_START( maciisi )
1390   ROM_REGION32_BE(0x80000, "user1", 0)
1391   ROM_REGION32_BE(0x80000, "bootrom", 0)
13911392        ROM_LOAD( "36b7fb6c.rom", 0x000000, 0x080000, CRC(f304d973) SHA1(f923de4125aae810796527ff6e25364cf1d54eec) )
13921393ROM_END
13931394
13941395ROM_START( macclas2 )
1395   ROM_REGION32_BE(0x80000, "user1", 0)
1396   ROM_REGION32_BE(0x80000, "bootrom", 0)
13961397        ROM_LOAD( "3193670e.rom", 0x000000, 0x080000, CRC(96d2e1fd) SHA1(50df69c1b6e805e12a405dc610bc2a1471b2eac2) )
13971398ROM_END
13981399
13991400ROM_START( maclc2 )
1400   ROM_REGION32_BE(0x80000, "user1", 0)
1401   ROM_REGION32_BE(0x80000, "bootrom", 0)
14011402   ROM_LOAD( "35c28f5f.rom", 0x000000, 0x080000, CRC(a92145b3) SHA1(d5786182b62a8ffeeb9fd3f80b5511dba70318a0) )
14021403ROM_END
14031404
14041405ROM_START( maclc3 )
1405   ROM_REGION32_BE(0x100000, "user1", 0)
1406   ROM_REGION32_BE(0x100000, "bootrom", 0)
14061407        ROM_LOAD( "ecbbc41c.rom", 0x000000, 0x100000, CRC(e578f5f3) SHA1(c77df3220c861f37a2c553b6ee9241b202dfdffc) )
14071408ROM_END
14081409
14091410ROM_START( pmac6100 )
1410   ROM_REGION64_BE(0x400000, "user1", 0)
1411   ROM_REGION64_BE(0x400000, "bootrom", 0)
14111412        ROM_LOAD( "9feb69b3.rom", 0x000000, 0x400000, CRC(a43fadbc) SHA1(6fac1c4e920a077c077b03902fef9199d5e8f2c3) )
14121413ROM_END
14131414
1414/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT     CONFIG COMPANY       FULLNAME */
1415ROM_START( macprtb )
1416   ROM_REGION16_BE(0x40000, "bootrom", 0)
1417        ROM_LOAD16_WORD( "93ca3846.rom", 0x000000, 0x040000, CRC(497348f8) SHA1(79b468b33fc53f11e87e2e4b195aac981bf0c0a6) )
1418ROM_END
1419
1420ROM_START( macpb100 )
1421   ROM_REGION16_BE(0x40000, "bootrom", 0)
1422        ROM_LOAD16_WORD( "96645f9c.rom", 0x000000, 0x040000, CRC(29ac7ee9) SHA1(7f3acf40b1f63612de2314a2e9fcfeafca0711fc) )
1423ROM_END
1424
1425/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG   COMPANY        FULLNAME */
14151426COMP( 1984, mac128k,  0,    0,   mac128k,  macplus,  mac128k512k, 0,     "Apple Computer", "Macintosh 128k",  GAME_NOT_WORKING )
14161427COMP( 1984, mac512k,  mac128k,  0,   mac512ke, macplus,  mac128k512k, 0,     "Apple Computer", "Macintosh 512k",  GAME_NOT_WORKING )
14171428COMP( 1986, mac512ke, macplus,  0,   mac512ke, macplus,  mac512ke,    0,     "Apple Computer", "Macintosh 512ke", 0 )
r6683r6684
14211432COMP( 1987, macii,    0,   0,   macii,    macadb,   macii,    0,     "Apple Computer", "Macintosh II",  GAME_NOT_WORKING )
14221433COMP( 1988, mac2fdhd, 0,   0,   macii,    macadb,   maciifdhd,    0,     "Apple Computer", "Macintosh II (FDHD)",  GAME_NOT_WORKING )
14231434COMP( 1988, maciix,   mac2fdhd, 0,   maciix,   macadb,   maciix,    0,     "Apple Computer", "Macintosh IIx",  0 )
1435COMP( 1989, macprtb,  0,        0,      macprtb,  macadb,   macprtb,     0,     "Apple Computer", "Macintosh Portable", GAME_NOT_WORKING )
14241436COMP( 1989, macse30,  mac2fdhd, 0,   macse30,  macadb,   macse30,    0,     "Apple Computer", "Macintosh SE/30",  0 )
14251437COMP( 1989, maciicx,  mac2fdhd, 0,   maciix,   macadb,   maciicx,    0,     "Apple Computer", "Macintosh IIcx",  0 )
14261438COMP( 1989, maciici,  0,   0,   maciici,  macadb,   maciici,    0,     "Apple Computer", "Macintosh IIci",  GAME_NOT_WORKING )
14271439COMP( 1990, macclasc, 0,   0,   macse,    macadb,   macclassic,    0,     "Apple Computer", "Macintosh Classic",  GAME_NOT_WORKING )
14281440COMP( 1990, maclc,    0,   0,   maclc,    macadb,   maclc,    0,     "Apple Computer", "Macintosh LC",  GAME_NOT_WORKING )
14291441COMP( 1990, maciisi,  0,   0,   maciisi,  macadb,   maciici,    0,     "Apple Computer", "Macintosh IIsi",  GAME_NOT_WORKING )
1442COMP( 1991, macpb100, 0,        0,      macprtb,  macadb,   macprtb,     0,     "Apple Computer", "Macintosh PowerBook 100", GAME_NOT_WORKING )
14301443COMP( 1991, macclas2, 0,   0,   macclas2, macadb,   macclassic2, 0,     "Apple Computer", "Macintosh Classic II",  GAME_NOT_WORKING )
14311444COMP( 1991, maclc2,   0,   0,   maclc2,   macadb,   maclc2,    0,     "Apple Computer", "Macintosh LC II",  GAME_NOT_WORKING )
14321445COMP( 1993, maclc3,   0,   0,   maclc3,   macadb,   maclc3,    0,     "Apple Computer", "Macintosh LC III",  GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team