Previous 15994 Revisions Next

r6246 Monday 2nd November, 2009 at 04:47:25 UTC by R. Belmont
[MAC] Updates
- Greatly improved ADB behavior. Mouse/button responsiveness is much better
on ADB machines (all except 128/512/Plus). Keyboard coming soon.
- Mac II and later machines now can successfully write to HDDs (be careful!)
- Various tweeks and tuneups
[src/mess/drivers]mac.c
[src/mess/includes]mac.h
[src/mess/machine]mac.c

src/mess/includes/mac.h
r6245r6246
6464DRIVER_INIT(macse);
6565DRIVER_INIT(macclassic);
6666DRIVER_INIT(maclc);
67DRIVER_INIT(macii);
6768DRIVER_INIT(maciifdhd);
6869DRIVER_INIT(maciix);
6970DRIVER_INIT(maciicx);
r6245r6246
8889WRITE16_HANDLER ( macplus_scsi_w );
8990WRITE16_HANDLER ( macii_scsi_w );
9091READ32_HANDLER (macii_scsi_drq_r);
92WRITE32_HANDLER (macii_scsi_drq_w);
9193NVRAM_HANDLER( mac );
9294void mac_scc_ack(const device_config *device);
9395void mac_scc_mouse_irq( running_machine *machine, int x, int y );
src/mess/machine/mac.c
r6245r6246
885885   return 0;
886886}
887887
888WRITE32_HANDLER (macii_scsi_drq_w)
889{
890   switch (mem_mask)
891   {
892      case 0xff000000:
893         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>24);
894         break;
895
896      case 0xffff0000:
897         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>24);
898         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>16);
899         break;
900
901      case 0xffffffff:
902         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>24);
903         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>16);
904         ncr5380_w(space, R5380_OUTDATA_DTACK, data>>8);
905         ncr5380_w(space, R5380_OUTDATA_DTACK, data&0xff);
906         break;
907
908      default:
909         logerror("macii_scsi_drq_w: unknown mem_mask %08x\n", mem_mask);
910         break;
911   }
912}
913
888914WRITE16_HANDLER ( macplus_scsi_w )
889915{
890916   int reg = (offset>>3) & 0xf;
r6245r6246
10411067{
10421068   rtc_rTCClk = 0;
10431069
1044   rtc_write_protect = TRUE;   /* Mmmmh... Should be saved with the NVRAM, actually... */
1070   rtc_write_protect = 0;
10451071   rtc_rTCEnb = 0;
10461072   rtc_write_rTCEnb(1);
10471073   rtc_state = RTC_STATE_NORMAL;
r6245r6246
11261152      {
11271153         // read command
11281154         if (LOG_RTC)
1129            logerror("RTC: Reading extended address %x\n", rtc_xpaddr);
1155            logerror("RTC: Reading extended address %x = %x\n", rtc_xpaddr, rtc_ram[rtc_xpaddr]);
11301156
11311157         rtc_data_dir = 1;
11321158         rtc_data_byte = rtc_ram[rtc_xpaddr];
r6245r6246
11811207      case 13:
11821208         /* Write-protect register  */
11831209         if (LOG_RTC)
1184            logerror("RTC write to write-protect register, data = %X\n", (int) rtc_data_byte);
1210            logerror("RTC write to write-protect register, data = %X\n", (int) rtc_data_byte&0x80);
11851211         rtc_write_protect = (rtc_data_byte & 0x80) ? TRUE : FALSE;
11861212         break;
11871213
r6245r6246
11951221         break;
11961222
11971223      default:
1198         logerror("Unknown RTC write command : %X, data = %d\n", (int) rtc_cmd, (int) rtc_data_byte);
1224         printf("Unknown RTC write command : %X, data = %d\n", (int) rtc_cmd, (int) rtc_data_byte);
11991225         break;
12001226      }
12011227   }
r6245r6246
12301256
12311257               case 8: case 9: case 10: case 11:
12321258                  if (LOG_RTC)
1233                     logerror("RTC RAM read, address = %X\n", (i & 3) + 0x10);
1259                     logerror("RTC RAM read, address = %X data = %x\n", (i & 3) + 0x10, rtc_ram[(i & 3) + 0x10]);
12341260                  rtc_data_byte = rtc_ram[(i & 3) + 0x10];
12351261                  break;
12361262
r6245r6246
12391265               case 24: case 25: case 26: case 27:
12401266               case 28: case 29: case 30: case 31:
12411267                  if (LOG_RTC)
1242                     logerror("RTC RAM read, address = %X\n", i & 15);
1268                     logerror("RTC RAM read, address = %X data = %x\n", i & 15, rtc_ram[i & 15]);
12431269                  rtc_data_byte = rtc_ram[i & 15];
12441270                  break;
12451271
r6245r6246
14461472
14471473   if (adb_waiting_cmd)
14481474   {
1449      const device_config *via_0 = devtag_get_device(machine, "via6522_0");
1450
14511475      switch ((adb_command>>2)&3)
14521476      {
14531477         case 0:
r6245r6246
14551479            switch (reg)
14561480            {
14571481               case ADB_CMD_RESET:
1482                  #if LOG_ADB
1483                  printf("ADB RESET: reg %x address %x\n", reg, addr);
1484                  #endif
14581485                  adb_direction = 0;
14591486                  adb_send = 0;
14601487                  break;
14611488
14621489               case ADB_CMD_FLUSH:
1490                  #if LOG_ADB
1491                  printf("ADB FLUSH: reg %x address %x\n", reg, addr);
1492                  #endif
1493
14631494                  adb_direction = 0;
14641495                  adb_send = 0;
14651496
1497                  #if 0
14661498                  adb_buffer[0] = 0xff;
14671499                  adb_datasize = 1;
14681500
r6245r6246
14711503                  via_cb1_w(via_0, 0, adb_extclock);
14721504                  adb_extclock ^= 1;
14731505                  via_cb1_w(via_0, 0, adb_extclock);
1506                  #endif
14741507                  break;
14751508
14761509               default:   // reserved/unused
r6245r6246
14791512            break;
14801513
14811514         case 2:   // listen
1482//              printf("ADB LISTEN: reg %x address %x\n", reg, addr);
1515            #if LOG_ADB
1516            printf("ADB LISTEN: reg %x address %x\n", reg, addr);
1517            #endif
1518
14831519            adb_direction = 1;   // input from Mac
14841520            adb_listenreg = reg;
14851521            adb_listenaddr = addr;
14861522            break;
14871523
14881524         case 3: // talk
1489//              printf("ADB TALK: reg %x address %x\n", reg, addr);
1525            #if LOG_ADB
1526            printf("ADB TALK: reg %x address %x\n", reg, addr);
1527            #endif
14901528
14911529            adb_direction = 0;       // output to Mac
14921530            if (addr == adb_mouseaddr)
14931531            {
14941532               UINT8 mouseX, mouseY;
14951533
1496//                  printf("Talking to mouse, register %x\n", reg);
1534               #if LOG_ADB
1535               printf("Talking to mouse, register %x\n", reg);
1536               #endif
14971537
14981538               switch (reg)
14991539               {
15001540                  // read mouse
15011541                  case 0:
15021542                     mac_adb_accummouse(machine, &mouseX, &mouseY);
1503                     adb_buffer[0] = (input_port_read(machine, "MOUSE0") & 0x01) ? 0x00 : 0x80;
1543                     adb_buffer[0] = (adb_lastbutton & 0x01) ? 0x00 : 0x80;
15041544                     adb_buffer[0] |= mouseX & 0x7f;
15051545                     adb_buffer[1] = mouseY & 0x7f;
15061546                     adb_datasize = 2;
r6245r6246
15211561            }
15221562            else if (addr == adb_keybaddr)
15231563            {
1524//                  printf("Talking to keyboard, register %x\n", reg);
1564               #if LOG_ADB
1565               printf("Talking to keyboard, register %x\n", reg);
1566               #endif
15251567
15261568               switch (reg)
15271569               {
r6245r6246
15531595            }
15541596            else
15551597            {
1556//               printf("talking to unconnected device\n");
1598               printf("talking to unconnected device\n");
15571599               adb_buffer[0] = adb_buffer[1] = 0xff;
15581600               adb_datasize = 0;
15591601            }
1560
1561            // if the mouse has new data and it's not what we're polling, yank SRQ
1562            if ((addr != adb_mouseaddr) && (adb_mouse_initialized))
1563            {
1564               mac_adb_pollmouse(machine);
1565            }
15661602            break;
15671603      }
15681604
r6245r6246
16611697            }
16621698            else
16631699            {
1664               adb_send = 0xff;   // try pulling up?
1700               adb_send = 0;
16651701            }
1702
16661703            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
16671704            break;
16681705
16691706         case ADB_STATE_IDLE:
1670            adb_send = 0xff;
16711707            break;
16721708      }
1673
1674      // no matter what, generate 8 clocks (should this happen on IDLE?)
1675//      timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
16761709   }
16771710}
16781711
r6245r6246
16921725
16931726      if ((adb_state == ADB_STATE_IDLE) && (adb_mouse_wanted_srq))
16941727      {
1728         // repeat last TALK to get updated data
1729         adb_waiting_cmd = 1;
1730         mac_adb_talk(machine);
1731
16951732         adb_timer_ticks = 8;
16961733         timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
16971734         adb_mouse_wanted_srq = 0;
r6245r6246
22022239
22032240DRIVER_INIT(macplus)
22042241{
2242   UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2243
2244   ROM[0x1aefc/4] = 0x6bbe709e;   // change bpl to bmi
2245
22052246   mac_driver_init(machine, MODEL_MAC_PLUS);
22062247}
22072248
r6245r6246
22552296
22562297DRIVER_INIT(maciici)
22572298{
2299   UINT32 *ROM = (UINT32 *)memory_region(machine, "user1");
2300
2301   ROM[0x4569c/4] = 0x4ed64e71;   // jmp (a6) / nop (skip FPU test)
2302   ROM[0x446b4/4] = 0x4e714e71;   // nop nop - disable ROM checksum
2303   ROM[0x446b8/4] = 0x4e714ed6;   // nop jmp (a6) - disable ROM checksum
2304
22582305   mac_driver_init(machine, MODEL_MAC_IICI);
22592306}
22602307
r6245r6246
22632310   mac_driver_init(machine, MODEL_MAC_IISI);
22642311}
22652312
2313DRIVER_INIT(macii)
2314{
2315   mac_driver_init(machine, MODEL_MAC_II);
2316}
2317
22662318DRIVER_INIT(macse30)
22672319{
22682320   patch_appletalk_iix(machine);
src/mess/drivers/mac.c
r6245r6246
288288static ADDRESS_MAP_START(macii_map, ADDRESS_SPACE_PROGRAM, 32)
289289   AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("user1", 0) AM_MIRROR(0x0ffc0000)
290290
291   // MMU remaps I/O without the F
292   AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
293   AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
294   AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
295   AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w)
296   AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r)
297   AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
298   AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r)
299   AM_RANGE(0x50014000, 0x50015fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
300   AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
301
291302   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
292303   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
293304   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
305   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
294306   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
295307
296308   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
297309   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
298310   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
299//   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
300311   AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff)
301312
302313   AM_RANGE(0x50f40000, 0x50f41fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)   // mirror
r6245r6246
329340
330341   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
331342   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
343   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
332344   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
333345
334346   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
r6245r6246
353365   AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff)
354366   AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff)
355367   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
368   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
356369   AM_RANGE(0x50f06060, 0x50f06063) AM_READ(macii_scsi_drq_r)
357370
358371   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
r6245r6246
374387   AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff)
375388
376389   AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff)
390   AM_RANGE(0x50f06000, 0x50f06003) AM_WRITE(macii_scsi_drq_w)
377391   AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r)
378392   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
379393   AM_RANGE(0x50f16000, 0x50f17fff) AM_READ(mac_swim_r) AM_WRITENOP
r6245r6246
520534   MDRV_RAM_EXTRA_OPTIONS("2M,2560K,4M")
521535MACHINE_DRIVER_END
522536
523static MACHINE_DRIVER_START( mac2fdhd )
537static MACHINE_DRIVER_START( macii )
524538   /* basic machine hardware */
525539   MDRV_CPU_ADD("maincpu", M68020_68851, 7833600*2)
526540   MDRV_CPU_PROGRAM_MAP(macii_map)
r6245r6246
578592   MDRV_RAM_EXTRA_OPTIONS("4M,6M,8M,10M")   
579593MACHINE_DRIVER_END
580594
595static MACHINE_DRIVER_START( mac2fdhd )
596   MDRV_IMPORT_FROM( macii )
597MACHINE_DRIVER_END
598
581599static MACHINE_DRIVER_START( maclc )
582600   MDRV_IMPORT_FROM( mac2fdhd )
583601
r6245r6246
881899ROM_END
882900
883901ROM_START( macclasc )
884   ROM_REGION16_BE(0x40000, "user1", 0)
885   ROM_LOAD16_WORD( "classic.rom",  0x00000, 0x40000, CRC(b14ddcde) SHA1(f710e73e8e0f99d9d0e9e79e71f67a6c3648bf06) )
902   ROM_REGION16_BE(0x80000, "user1", 0)
903        ROM_LOAD( "a49f9914.rom", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) )
886904ROM_END
887905
888906ROM_START( maclc )
r6245r6246
948966   ROM_LOAD( "35c28f5f.rom", 0x000000, 0x080000, CRC(a92145b3) SHA1(d5786182b62a8ffeeb9fd3f80b5511dba70318a0) )
949967ROM_END
950968
951/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG      COMPANY         FULLNAME */
952COMP( 1984, mac128k,  0,    0,   mac128k,  macplus,  mac128k512k, 0,      "Apple Computer",   "Macintosh 128k",  GAME_NOT_WORKING )
953COMP( 1984, mac512k,  mac128k,  0,   mac512ke, macplus,  mac128k512k, 0,      "Apple Computer",   "Macintosh 512k",  GAME_NOT_WORKING )
954COMP( 1986, mac512ke, macplus,  0,   mac512ke, macplus,  mac512ke,    0,      "Apple Computer",   "Macintosh 512ke", 0 )
955COMP( 1986, macplus,  0,   0,   macplus,  macplus,  macplus,    0,      "Apple Computer",   "Macintosh Plus",  0 )
956COMP( 1987, macse,    0,   0,   macse,    macplus,  macse,    0,      "Apple Computer",   "Macintosh SE",  0 )
957COMP( 1988, mac2fdhd, 0,   0,   mac2fdhd, macplus,  maciifdhd,    0,      "Apple Computer",   "Macintosh II (FDHD)",  GAME_NOT_WORKING )
958COMP( 1988, maciix,   mac2fdhd, 0,   maciix,   macplus,  maciix,    0,      "Apple Computer",   "Macintosh IIx",  GAME_NOT_WORKING )
959COMP( 1989, macse30,  mac2fdhd, 0,   macse30,  macplus,  macse30,    0,      "Apple Computer",   "Macintosh SE/30",  GAME_NOT_WORKING )
960COMP( 1989, maciicx,  mac2fdhd, 0,   maciix,   macplus,  maciicx,    0,      "Apple Computer",   "Macintosh IIcx",  GAME_NOT_WORKING )
961COMP( 1989, maciici,  0,      0,   maciici,  macplus,  maciici,    0,    "Apple Computer",   "Macintosh IIci",  GAME_NOT_WORKING )
962COMP( 1990, macclasc, 0,      0,   macse,    macplus,  macclassic,    0,   "Apple Computer",   "Macintosh Classic",  GAME_NOT_WORKING )
963COMP( 1990, maclc,    0,      0,   maclc,    macplus,  maclc,        0,      "Apple Computer",   "Macintosh LC",  GAME_NOT_WORKING )
964COMP( 1990, maciisi,  0,      0,   maciisi,  macplus,  maciici,    0,   "Apple Computer",   "Macintosh IIsi",  GAME_NOT_WORKING )
965COMP( 1991, macclas2, 0,      0,   macclas2, macplus,  macclassic2, 0,       "Apple Computer",   "Macintosh Classic II",  GAME_NOT_WORKING )
966COMP( 1991, maclc2,   0,      0,   maclc2,   macplus,  maclc2,        0,      "Apple Computer",   "Macintosh LC II",  GAME_NOT_WORKING )
969/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG   COMPANY        FULLNAME */
970COMP( 1984, mac128k,  0,    0,   mac128k,  macplus,  mac128k512k, 0,     "Apple Computer", "Macintosh 128k",  GAME_NOT_WORKING )
971COMP( 1984, mac512k,  mac128k,  0,   mac512ke, macplus,  mac128k512k, 0,     "Apple Computer", "Macintosh 512k",  GAME_NOT_WORKING )
972COMP( 1986, mac512ke, macplus,  0,   mac512ke, macplus,  mac512ke,    0,     "Apple Computer", "Macintosh 512ke", 0 )
973COMP( 1986, macplus,  0,   0,   macplus,  macplus,  macplus,    0,     "Apple Computer", "Macintosh Plus",  0 )
974COMP( 1987, macse,    0,   0,   macse,    macplus,  macse,    0,     "Apple Computer", "Macintosh SE",  0 )
975COMP( 1988, mac2fdhd, 0,   0,   mac2fdhd, macplus,  maciifdhd,    0,     "Apple Computer", "Macintosh II (FDHD)",  GAME_NOT_WORKING )
976COMP( 1988, maciix,   mac2fdhd, 0,   maciix,   macplus,  maciix,    0,     "Apple Computer", "Macintosh IIx",  GAME_NOT_WORKING )
977COMP( 1989, macse30,  mac2fdhd, 0,   macse30,  macplus,  macse30,    0,     "Apple Computer", "Macintosh SE/30",  GAME_NOT_WORKING )
978COMP( 1989, maciicx,  mac2fdhd, 0,   maciix,   macplus,  maciicx,    0,     "Apple Computer", "Macintosh IIcx",  GAME_NOT_WORKING )
979COMP( 1989, maciici,  0,   0,   maciici,  macplus,  maciici,    0,     "Apple Computer", "Macintosh IIci",  GAME_NOT_WORKING )
980COMP( 1990, macclasc, 0,   0,   macse,    macplus,  macclassic,    0,     "Apple Computer", "Macintosh Classic",  GAME_NOT_WORKING )
981COMP( 1990, maclc,    0,   0,   maclc,    macplus,  maclc,    0,     "Apple Computer", "Macintosh LC",  GAME_NOT_WORKING )
982COMP( 1990, maciisi,  0,   0,   maciisi,  macplus,  maciici,    0,     "Apple Computer", "Macintosh IIsi",  GAME_NOT_WORKING )
983COMP( 1991, macclas2, 0,   0,   macclas2, macplus,  macclassic2, 0,     "Apple Computer", "Macintosh Classic II",  GAME_NOT_WORKING )
984COMP( 1991, maclc2,   0,   0,   maclc2,   macplus,  maclc2,    0,     "Apple Computer", "Macintosh LC II",  GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team