Previous 15994 Revisions Next

r3944 Saturday 20th December, 2008 at 23:27:55 UTC by R. Belmont
[MAC] Started to fill out Mac II and LC-class hardware. Checking in primarily due to repeated heinous merge conflicts, not because it's really ready :)
[src/mess/drivers]mac.c
[src/mess/includes]mac.h
[src/mess/machine]mac.c

src/mess/includes/mac.h
r3943r3944
2525
2626extern const scc8530_interface mac_scc8530_interface;
2727extern const via6522_interface mac_via6522_intf;
28extern const via6522_interface mac_via6522_2_intf;
2829extern const via6522_interface mac_via6522_adb_intf;
2930
3031MACHINE_START( macscsi );
r3943r3944
3536DRIVER_INIT(macplus);
3637DRIVER_INIT(macse);
3738DRIVER_INIT(macclassic);
39DRIVER_INIT(maclc);
3840
3941READ16_HANDLER ( mac_via_r );
4042WRITE16_HANDLER ( mac_via_w );
43READ16_HANDLER ( mac_via2_r );
44WRITE16_HANDLER ( mac_via2_w );
4145READ16_HANDLER ( mac_autovector_r );
4246WRITE16_HANDLER ( mac_autovector_w );
4347READ16_HANDLER ( mac_iwm_r );
4448WRITE16_HANDLER ( mac_iwm_w );
4549READ16_HANDLER ( mac_scc_r );
4650WRITE16_HANDLER ( mac_scc_w );
51WRITE16_HANDLER ( mac_scc_2_w );
4752READ16_HANDLER ( macplus_scsi_r );
4853WRITE16_HANDLER ( macplus_scsi_w );
4954NVRAM_HANDLER( mac );
src/mess/machine/mac.c
r3943r3944
1717                 - Mac 512ke   68k             IWM   orig       orig   Original
1818                 - Mac Plus   68k             IWM   orig       ext    Original
1919                 - Mac SE   68k             IWM   MacII ADB  ext    Original
20                 - Mac Classic   68k             SWIM   ADB-???    ext    Original
20                 - Mac Classic   68k             SWIM   MacII ADB  ext    Original
2121                 - Mac Portable   68k (16 MHz)    SWIM   ADB-PMU    PMU    640x480 B&W
2222                 - PwrBook 100  68k (16 MHz)    SWIM   ADB-PMU    PMU    640x480 B&W
2323       - Mac II       020             IWM   MacII ADB  ext    NuBus card
r3943r3944
2626       - Mac SE/30    030             SWIM    MacII ADB  ext    Internal fake NuBus card (need video declaration ROM!)
2727       - Mac IIcx     030             SWIM   ADB-CUDA   ext    NuBus card
2828       - Mac IIci     030             SWIM   ADB-CUDA   ext    Internal "RBV" type
29       - Mac LC   020      SWIM   Egret ADB  ext    Internal "V8" type
30       - Mac LC II   030      SWIM   Egret ADB  ext    Internal "V8" type
31       - Mac LC III   030      SWIM   Egret ADB  ext    Internal "V8" type
2932
3033   Notes:
3134      - The Mac Plus boot code seems to check to see the extent of ROM
r3943r3944
3336        then SCSI is not available.  Thanks to R. Belmont for making this
3437        discovery.
3538      - On the SE and most later Macs, the first access to 4xxxxx turns off the overlay.
36        However, the Mac II has the old-style VIA overlay control bit!
39        However, the Mac II/IIx/IIcx (and others?) have the old-style VIA overlay control bit!
3740      - The Mac II can have either a 68551 PMMU fitted or an Apple custom that handles 24 vs. 32
3841        bit addressing mode.  The ROM is *not* 32-bit clean so Mac OS normally runs in 24 bit mode,
3942        but A/UX can run 32.
r3943r3944
5861        (IM-III seems to say it does not on Mac 128k, 512k, and 512ke).
5962      - What on earth are 0x700000-0x7fffff mapped to ?
6063
64
65   Mac LC notes:
66      IOBase is 50f00000 in 32-bit mode and f00000 in 24-bit
67      VIA1 is at IOBase
68      IWM is at IOBase + 0x16000
69
70
6171****************************************************************************/
6272
6373#include <time.h>
r3943r3944
113123static WRITE8_DEVICE_HANDLER(mac_via_out_b);
114124static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2);
115125static WRITE8_DEVICE_HANDLER(mac_via_out_cb2);
126static READ8_DEVICE_HANDLER(mac_via2_in_a);
127static READ8_DEVICE_HANDLER(mac_via2_in_b);
128static WRITE8_DEVICE_HANDLER(mac_via2_out_a);
129static WRITE8_DEVICE_HANDLER(mac_via2_out_b);
116130static void mac_via_irq(const device_config *device, int state);
131static void mac_via2_irq(const device_config *device, int state);
117132static offs_t mac_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
118133
119134const via6522_interface mac_via6522_intf =
r3943r3944
138153   mac_via_irq
139154};
140155
156const via6522_interface mac_via6522_2_intf =
157{
158   mac_via2_in_a, mac_via2_in_b,
159   NULL, NULL,
160   NULL, NULL,
161   mac_via2_out_a, mac_via2_out_b,
162   NULL, NULL,
163   NULL, NULL,
164   mac_via2_irq
165};
166
141167/* tells which model is being emulated (set by macxxx_init) */
142168typedef enum
143169{
r3943r3944
145171   MODEL_MAC_512KE,
146172   MODEL_MAC_PLUS,
147173   MODEL_MAC_SE,
148   MODEL_MAC_CLASSIC
174   MODEL_MAC_SE_FDHD,
175   MODEL_MAC_CLASSIC,
176   MODEL_MAC_PORTABLE,
177   MODEL_MAC_PB100,
178
179   MODEL_MAC_II,      // Mac II class machines
180   MODEL_MAC_II_FDHD,
181   MODEL_MAC_IIX,
182   MODEL_MAC_IICX,
183   MODEL_MAC_IICI,
184   MODEL_MAC_IIFX,
185   MODEL_MAC_SE30,
186
187   MODEL_MAC_LC,      // LC class machines, generally all with the same memory map and the V8 gate array
188   MODEL_MAC_LC_II,
189   MODEL_MAC_LC_III,
190   MODEL_MAC_CLASSIC_II,
191   MODEL_MAC_COLOR_CLASSIC
149192} mac_model_t;
150193
151194static UINT32 mac_overlay = 0;
r3943r3944
186229   offs_t memory_mask;
187230   read16_space_func rh;
188231   write16_space_func wh;
232   read32_space_func rh32;
233   write32_space_func wh32;
189234
190235   memory_size = MIN(memory_size, (memory_end + 1 - memory_begin));
191236   memory_mask = memory_size - 1;
192237
193   rh = (read16_space_func) (FPTR)bank;
194   wh = is_rom ? SMH_UNMAP : (write16_space_func) (FPTR)bank;
238   if (mac_model < MODEL_MAC_II)
239   {
240      rh = (read16_space_func) (FPTR)bank;
241      wh = is_rom ? SMH_UNMAP : (write16_space_func) (FPTR)bank;
195242
196   memory_install_read16_handler(space, memory_begin,
197      memory_end, memory_mask, 0, rh);
198   memory_install_write16_handler(space, memory_begin,
199      memory_end, memory_mask, 0, wh);
243      memory_install_read16_handler(space, memory_begin,
244         memory_end, memory_mask, 0, rh);
245      memory_install_write16_handler(space, memory_begin,
246         memory_end, memory_mask, 0, wh);
247   }
248   else
249   {
250      rh32 = (read32_space_func) (FPTR)bank;
251      wh32 = is_rom ? SMH_UNMAP : (write32_space_func) (FPTR)bank;
200252
253      memory_install_read32_handler(space, memory_begin,
254         memory_end, memory_mask, 0, rh32);
255      memory_install_write32_handler(space, memory_begin,
256         memory_end, memory_mask, 0, wh32);
257
258   }
259
201260   memory_set_bankptr(machine,bank, memory_data);
202261
203262   if (LOG_MEMORY)
r3943r3944
283342   /* Not Yet Implemented */
284343}
285344
286
287
288345static void set_memory_overlay(running_machine *machine, int overlay)
289346{
290347   offs_t memory_size;
r3943r3944
316373      }
317374
318375      /* install the memory */
319      mac_install_memory(machine, 0x000000, 0x3fffff, memory_size, memory_data, is_rom, 1);
376      if (mac_model == MODEL_MAC_LC)
377      {
378         mac_install_memory(machine, 0x000000, 0x9fffff, memory_size, memory_data, is_rom, 1);
379      }
380      else
381      {
382         mac_install_memory(machine, 0x000000, 0x3fffff, memory_size, memory_data, is_rom, 1);
383      }
320384
321385      mac_overlay = overlay;
322386
r3943r3944
868932   scc_w(scc, offset, (UINT8) data);
869933}
870934
935WRITE16_HANDLER ( mac_scc_2_w )
936{
937   const device_config *scc = device_list_find_by_tag(space->machine->config->devicelist, SCC8530, "scc");
938   UINT8 wdata = data>>8;
871939
940   scc_w(scc, offset, wdata);
941}
872942
873943const scc8530_interface mac_scc8530_interface =
874944{
r3943r3944
17371807      via_w(via_0, offset, (data >> 8) & 0xff);
17381808}
17391809
1810/* *************************************************************************
1811 * VIA 2 (on Mac IIs and PowerMacs)
1812 * *************************************************************************/
17401813
1814static void mac_via2_irq(const device_config *device, int state)
1815{
1816}
17411817
1818READ16_HANDLER ( mac_via2_r )
1819{
1820   int data;
1821   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
1822
1823   offset >>= 8;
1824   offset &= 0x0f;
1825
1826   if (LOG_VIA)
1827      logerror("mac_via2_r: offset=0x%02x\n", offset);
1828   data = via_r(via_1, offset);
1829
1830   return (data & 0xff) | (data << 8);
1831}
1832
1833WRITE16_HANDLER ( mac_via2_w )
1834{
1835   const device_config *via_1 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_1");
1836
1837   offset >>= 8;
1838   offset &= 0x0f;
1839
1840   if (LOG_VIA)
1841      logerror("mac_via2_w: offset=0x%02x data=0x%08x\n", offset, data);
1842
1843   if (ACCESSING_BITS_8_15)
1844      via_w(via_1, offset, (data >> 8) & 0xff);
1845}
1846
1847
1848static READ8_DEVICE_HANDLER(mac_via2_in_a)
1849{
1850   logerror("VIA2 IN A (PC %x)\n", cpu_get_pc(device->machine->cpu[0]));
1851
1852   return 0;
1853}
1854
1855static READ8_DEVICE_HANDLER(mac_via2_in_b)
1856{
1857   logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(device->machine->cpu[0]));
1858
1859   return 0;
1860}
1861
1862static WRITE8_DEVICE_HANDLER(mac_via2_out_a)
1863{
1864   logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(device->machine->cpu[0]));
1865}
1866
1867static WRITE8_DEVICE_HANDLER(mac_via2_out_b)
1868{
1869   logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(device->machine->cpu[0]));
1870}
1871
17421872/* *************************************************************************
17431873 * Main
17441874 * *************************************************************************/
r3943r3944
18111941   scsi_interrupt = 0;
18121942   mac_model = model;
18131943
1814   /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
1815   mac_install_memory(machine, 0x600000, 0x6fffff, mess_ram_size, mess_ram, FALSE, 2);
1944   if (model < MODEL_MAC_II)
1945   {
1946      /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
1947      mac_install_memory(machine, 0x600000, 0x6fffff, mess_ram_size, mess_ram, FALSE, 2);
18161948
1817   /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */
1818   mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
1819      memory_region_length(machine, "user1"), memory_region(machine, "user1"), TRUE, 3);
1949      /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */
1950      mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
1951         memory_region_length(machine, "user1"), memory_region(machine, "user1"), TRUE, 3);
1952   }
1953   else if (model == MODEL_MAC_LC)
1954   {
1955      mac_install_memory(machine, 0x000000, 0x9fffff, mess_ram_size, mess_ram, FALSE, 2);
18201956
1957      // ROM mapping is handled elsewhere for now
1958   }
1959
18211960   set_memory_overlay(machine, 1);
18221961
18231962   if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC))
r3943r3944
18952034   mac_driver_init(machine, MODEL_MAC_CLASSIC);
18962035}
18972036
2037DRIVER_INIT(maclc)
2038{
2039   mac_driver_init(machine, MODEL_MAC_LC);
2040}
2041
18982042static void mac_vblank_irq(running_machine *machine)
18992043{
19002044   static int irq_count = 0, ca1_data = 0, ca2_data = 0;
src/mess/drivers/mac.c
r3943r3944
4646#include "devices/sonydriv.h"
4747#include "devices/harddriv.h"
4848
49// LC: boot needs 50f04000 bit 0 to go "1" at a49f00.  SCC.
4950
51/*
52   Apple Sound Chip
53
54   Base is normally IOBase + 0x14000
55   First 0x800 bytes is buffer RAM
56
57   Verified to be only 8 bits wide by Apple documentation.
58
59   Registers:
60   0x800: CONTROL
61   0x801: ENABLE
62   0x802: MODE
63   0x806: VOLUME
64   0x807: CHAN
65*/
66
67static UINT8 mac_asc_regs[0x2000];
68
69static READ8_HANDLER(mac_asc_r)
70{
71   logerror("ASC: Read @ %x (PC %x)\n", offset, cpu_get_pc(space->machine->cpu[0]));
72
73   return mac_asc_regs[offset];
74}
75
76static WRITE8_HANDLER(mac_asc_w)
77{
78   logerror("ASC: %02x to %x (PC %x)\n", data, offset, cpu_get_pc(space->machine->cpu[0]));
79
80   mac_asc_regs[offset] = data;
81}
82
5083/***************************************************************************
5184    ADDRESS MAPS
5285***************************************************************************/
r3943r3944
68101   AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w)
69102ADDRESS_MAP_END
70103
104static ADDRESS_MAP_START(maclc_map, ADDRESS_SPACE_PROGRAM, 32)
105   AM_RANGE(0x00fc0000, 0x00ffffff) AM_RAM   AM_SHARE(1)   // VRAM framebuffer
106   AM_RANGE(0x00a00000, 0x00a7ffff) AM_ROM AM_REGION("user1", 0)   // ROM (in 24-bit mode)
107   AM_RANGE(0x40a00000, 0x40a7ffff) AM_ROM AM_REGION("user1", 0)   // ROM (in 32-bit mode)
108   AM_RANGE(0x50f00000, 0x50f01fff) AM_READ16(mac_via_r, 0xffffffff)
109   AM_RANGE(0x50f00000, 0x50f01fff) AM_WRITE16(mac_via_w, 0xffffffff)
110   AM_RANGE(0x50f04000, 0x50f05fff) AM_READ16(mac_scc_r, 0xffffffff) AM_WRITE16(mac_scc_2_w, 0xffffffff)
111   AM_RANGE(0x50f14000, 0x50f15fff) AM_READ8(mac_asc_r, 0xffffffff) AM_WRITE8(mac_asc_w, 0xffffffff)
112   AM_RANGE(0x50f26000, 0x50f27fff) AM_READ16(mac_via2_r, 0xffffffff)   // VIA2
113   AM_RANGE(0x50f26000, 0x50f27fff) AM_WRITE16(mac_via2_w, 0xffffffff)
114   AM_RANGE(0x50fc0000, 0x50ffffff) AM_RAM   AM_SHARE(1)
115ADDRESS_MAP_END
71116
72117
73118/***************************************************************************
r3943r3944
153198   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf)
154199MACHINE_DRIVER_END
155200
201static MACHINE_DRIVER_START( maclc )
202   MDRV_IMPORT_FROM( macplus )
203
204   MDRV_CPU_REPLACE("main", M68020, 7833600*2)
205   MDRV_CPU_PROGRAM_MAP(maclc_map, 0)
206
207   MDRV_VIA6522_REMOVE("via6522_0")
208   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf)
209   MDRV_VIA6522_ADD("via6522_1", 1000000, mac_via6522_2_intf)
210MACHINE_DRIVER_END
211
156212static INPUT_PORTS_START( macplus )
157213   PORT_START("MOUSE0") /* Mouse - button */
158214   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
r3943r3944
325381   ROM_LOAD16_WORD( "classic.rom",  0x00000, 0x40000, CRC(b14ddcde) SHA1(f710e73e8e0f99d9d0e9e79e71f67a6c3648bf06) )
326382ROM_END
327383
384ROM_START( maclc )
385   ROM_REGION32_BE(0x100000, "user1", 0)
386        ROM_LOAD("350eacf0.rom", 0x000000, 0x080000, CRC(71681726) SHA1(6bef5853ae736f3f06c2b4e79772f65910c3b7d4))
387ROM_END
388
328389static void mac128512_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
329390{
330391   /* floppy */
r3943r3944
376437   CONFIG_RAM         (0x400000)
377438SYSTEM_CONFIG_END
378439
440static SYSTEM_CONFIG_START(maclc)
441   CONFIG_DEVICE(mac_floppy_getinfo)
442   CONFIG_RAM_DEFAULT   (0x200000)   // 2 MB RAM default
443   CONFIG_RAM         (0x400000)
444   CONFIG_RAM         (0x600000)
445   CONFIG_RAM         (0x800000)
446   CONFIG_RAM         (0xa00000)   // up to 10 MB
447SYSTEM_CONFIG_END
379448
380449
381
382450/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT        CONFIG      COMPANY             FULLNAME */
383451COMP( 1984,   mac128k,  0,       0,   mac512ke, macplus,  mac128k512k,   mac128k,   "Apple Computer",   "Macintosh 128k",  GAME_NOT_WORKING )
384452COMP( 1984,   mac512k,  mac128k,   0,   mac512ke, macplus,  mac128k512k,   mac512k,   "Apple Computer",   "Macintosh 512k",  GAME_NOT_WORKING )
r3943r3944
386454COMP( 1986,   macplus,  0,      0,   macplus,  macplus,  macplus,      macplus,   "Apple Computer",   "Macintosh Plus",  0 )
387455COMP( 1987,   macse,    0,      0,   macse,  macplus,  macse,          macse,      "Apple Computer",   "Macintosh SE",  0 )
388456COMP( 1990,   macclasc, 0,      0,   macse,  macplus,  macclassic,          macse,      "Apple Computer",   "Macintosh Classic",  GAME_NOT_WORKING )
457COMP( 1990,   maclc,    0,      0,  maclc,    macplus,  maclc,      maclc,      "Apple Computer",   "Macintosh LC",  GAME_NOT_WORKING )
389458
390
391
392/* ----------------------------------------------------------------------- */
393
394#if 0
395
396/* Early Mac2 driver - does not work at all, but enabled me to disassemble the ROMs */
397
398static ADDRESS_MAP_START (mac2_mem, ADDRESS_SPACE_PROGRAM, 16)
399
400   AM_RANGE( 0x00000000, 0x007fffff) AM_RAM
401   AM_RANGE( 0x00800000, 0x008fffff) AM_ROM
402   AM_RANGE( 0x00900000, 0x00ffffff) AM_NOP
403
404ADDRESS_MAP_END
405
406static void mac2_init_machine( void )
407{
408   memset(memory_region(machine, "main"), 0, 0x800000);
409}
410
411
412static const struct MachineDriver machine_driver_mac2 =
413{
414   /* basic machine hardware */
415   {
416      {
417         CPU_M68020,
418         16000000,         /* +/- 16 MHz */
419         mac2_mem,0,0,0,
420         0,0,
421      }
422   },
423   60, ATTOSECONDS_IN_USEC(2500) /* not accurate */,      /* frames per second, vblank duration */
424   1,
425   mac2_init_machine,
426   0,
427
428   /* video hardware */
429   640, 480, /* screen width, screen height */
430   { 0, 640-1, 0, 480-1 },       /* visible_area */
431
432   0,               /* graphics decode info */
433   2, 2,                  /* number of colors, colortable size */
434   mac_init_palette,            /* convert color prom */
435
436   VIDEO_UPDATE_BEFORE_VBLANK,
437   0,
438   mac_vh_start,
439   mac_vh_stop,
440   mac_vh_screenrefresh,
441
442   /* sound hardware */
443   0,0,0,0,
444   {
445
446   },
447
448   mac_nvram_handler
449};
450
451//#define input_ports_mac2 NULL
452
453static INPUT_PORTS_START( mac2 )
454
455INPUT_PORTS_END
456
457ROM_START( mac2 )
458   ROM_REGION(0x00900000,"main",0) /* for ram, etc */
459   ROM_LOAD_WIDE( "256k.rom",  0x800000, 0x40000, NO_DUMP)
460ROM_END
461
462COMPX( 1987, mac2,      0,       mac2,      mac2,    0/*mac2*/,  "Apple Computer",    "Macintosh II",  GAME_NOT_WORKING )
463
464#endif
465

Previous 15994 Revisions Next


© 1998-2018 The MESS Team