Jump to content

Macintosh 128K/512K technical details: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎Timekeeping: multitasking
→‎Timekeeping: punctuation error
Line 87: Line 87:
The Macintosh featured a real-time clock counting seconds, and a countdown timer with near-microsecond resolution. The former was connected to the 6522 by a serial bus on three general-purpose I/O lines. It functioned much as a quartz watch when the machine was powered off. The latter was built into the 6522 itself. Either could generate interrupts.
The Macintosh featured a real-time clock counting seconds, and a countdown timer with near-microsecond resolution. The former was connected to the 6522 by a serial bus on three general-purpose I/O lines. It functioned much as a quartz watch when the machine was powered off. The latter was built into the 6522 itself. Either could generate interrupts.


The countdown timer provided the hardware necessary for [[preemptive multitasking]].{{Citation needed}} The Macintosh operating system did not feature multitasking until 1987 with the release of the [[MultiFinder]], unlike the Lisa, which used cooperative multitasking. Preemptive multitasking was not possible in the Macintosh operating system, only with the release of OS X, which eventually replaced it, did preemptive multitasking come to the Macintosh platform.
The countdown timer provided the hardware necessary for [[preemptive multitasking]].{{Citation needed}} The Macintosh operating system did not feature multitasking until 1987 with the release of the [[MultiFinder]], unlike the Lisa, which used cooperative multitasking. Preemptive multitasking was not possible in the Macintosh operating system; only with the release of OS X, which eventually replaced it, did preemptive multitasking come to the Macintosh platform.


==Memory Map==
==Memory Map==

Revision as of 02:52, 2 November 2010

The original Macintosh was a relatively simple machine, now of interest for its simplicity and for the fact that it was the first computer produced by Apple under the name Macintosh. The Macintosh used standard off-the-shelf components to the greatest extent possible. However, Apple did not compromise on the features which now define personal computers. The resulting design implemented an aggressive feature set at a moderate price point by mixing complex LSI chips, readily customizable programmable array logic, and off-the-shelf components.

Overall architecture

The Motorola 68000, like most microprocessors of the 1980s, was designed for ease of use as well as speed. The 68000 chip was wired directly to the other programmable components of the computer: the IWM floppy controller, the Zilog 8530 SCC, and the MOS Technology 6522 which provided miscellaneous services. The connection used by the processor to transfer information is called the bus.

The bus also connected the 68000 to the 128 or 512 KiB of main memory (DRAM), but not directly. The connection to the RAM was shared between the processor and the multimedia circuits in a direct memory access (DMA) arrangement. Either the processor or the video/sound engine could access the memory, but not both, resulting in up to a 10% loss in performance. This remains a popular way to trade performance for reduced cost. There was less trade-off in the Macintosh, however, because the DMA circuit simultaneously performed necessary maintenance on the RAM which would otherwise add overhead. Newer designs use a DRAM controller which inevitably reduces performance. The Macintosh graphics and sound engine doubles as a DRAM controller, a trick previously used in the Apple II.

Precise timing information was relayed to the 68000 by interrupts. The 68000 provides three interrupt inputs, which in the Macintosh 128K/512K were connected to the 6522, the 8530, and a human input designed for programmers, in order of increasing priority. Thus typing on the keyboard (attached to the 6522) did not reduce serial data (8530) performance, yet the program controlling the serial bus could be debugged by the programmer.

From a programmer's perspective, the Macintosh used memory-mapped I/O. The chips on the motherboard could be treated as memory locations in the computer's virtual space. Graphics and sound likewise appeared as regions inside the main memory. Given the simplicity of the hardware, most functions were also simple and efficient to program.

Components

This is a comprehensive list of the integrated circuits in the original Macintosh:

  • a Motorola MC68000 microprocessor at clock speed 7.8336 MHz
  • 64 or 128 KB of ROM in two chips containing parts of the operating system
  • 128 or 512 KB of RAM in 16 chips
  • eight TTL chips implementing a video and sound DMA controller, plus
    • two TTL chips providing a 16-bit video buffer (74166 type)
    • one PAL chip generating video timing signals (LAG)
    • two TTL chips providing an 8-bit Pulse-width modulation sound driver (74LS161 type)
    • two analog chips providing sound amplification (MC14016 switch, LF353 op-amp)
  • a Zilog 8530 chip controlling two RS-422 buses through two driver chips
  • an Integrated Woz Machine 400 KB floppy disk controller plus support PAL (ASG)
  • a MOS Technology 6522 bridge chip connecting to the keyboard and clock
  • bus control and extra logic including
    • two PAL chips to activate the other chips (BMU0/1)
    • two PAL chips to convert the 16 MHz clock to other timing signals (TSM, TSG)
    • two TTL chips buffering the RAM to the 68000 (74LS244 type)
    • some inverters (74LS04 type)

This personal computer was implemented in four special-purpose LSI chips, six MSI PALs, 19 chips of standard SSI/MSI logic and analog circuits, plus memory. Most of the simpler chips would be consolidated into a few custom chips in the next generation, much reducing cost.

Features

The above components implemented the Macintosh GUI and networking as described below.

Mouse

The centerpiece of the new interface was mouse-driven control. The mouse contained only electromechanical components: a button, and four optical encoders. The button was connected to the 6522. The encoders connected to the 8530.

The button connected to a general-purpose I/O input of the 6522. Pressing or releasing it would immediately stop the processor, and the operating system would note the new user input.

The optical encoders detected movement by quadrature. Each encoder had a wheel printed with radial stripes which would produce electrical pulses with mouse movement. A first set of pulses is enough to detect movement alone, and a second set of synchronized pulses is required to detect the direction of motion. Therefore two detectors were used for X and Y each.

The motion detection signals connected to the 8530 chip using two non-essential pins used for obsolete modems. Originally these signaled modem connection or disconnection. When the mouse moved by a certain amount, the 8530 would interrupt the processor. The operating system would detect "modem activity" and act to move the cursor.

The direction signals connected to two more general-purpose I/O inputs of the 6522. When the operating system detected the mouse movement, these inputs differentiated left from right, and up from down.

Cursor and video

The mouse cursor was drawn on the screen by software, and moreover the Macintosh supported real-time animation. The screen timing PAL circuit sent a pulse to the 6522 once per refresh. This was the basis for an operating system service called the VBL (vertical blanking) Manager. When the screen was to be redrawn, the cursor would be moved and games had an opportunity to update the display.

It could sometimes be difficult to avoid a race condition between the game and the raster display. Flicker could result from the processor writing to the image while it was being sent to the CRT. Therefore the Macintosh provided a choice of two images in memory, so one could be read while the other was written. The "page" was selected by a general-purpose I/O output connected from the 6522 to the video DMA. As the images together took 42.75 KiB of precious RAM, however, this feature was ultimately unpopular.

As described above, the DMA graphics controller operated independently. One-bit pixels were fetched over a 16-bit data bus and output at 16 MHz, necessitating one million fetches per second. Each fetch took two cycles out of eight per microsecond, implying a memory bandwidth tax of 25%. This was mitigated to 17% by disabling DMA while the CRT scanned right to left.

Keyboard

The 6522 provided general-purpose serial bus. The keyboard contained an Intel 8021 microprocessor which transmitted user input to the 6522 over standard phone patch cable. A new keystroke resulted in a processor interrupt.

Sound

The sampled sound engine piggybacked on the video circuit. As the raster scan returned from the right side of the screen to the left, one byte of data was placed into a PWM generator instead of the screen. This provided 8-bit sampled monaural sound sampled at the 22.25 kHz horizontal blanking rate. A general-purpose 6522 output could mute the sampled sound.

A square wave generator was included on the 6522. One of its two timer circuits could be set to toggle the mute output periodically. This could produce frequencies higher than 11 kHz.

The sound volume was controlled by an analog circuit providing 8 levels of attenuation, controlled by three general-purpose outputs. The user controlled this through software.

Communication

The Zilog 8530 SCC was clocked at 3.7 MHz. At this speed each serial channel was nearly half as fast as the main memory. The RS-422 protocol was implemented except for the connection-established line, which was used to support the mouse. Apple later changed to an 8-pin connector which dropped it entirely.

Storage

The main persistent storage was Sony microfloppy drive, which replaced the less reliable but more storage dense Apple Twiggy minifloppy drive used in the Lisa and Macintosh prototypes. The single-sided 3.5 inch floppy stored 400 KB by spinning the disk slower when the outer edge was used. A separate microcontroller, the IWM, was dedicated to disk control. The floppy operated by polled I/O. Disk access was not seamless as in today's computers, and loading and saving files were operations that stopped the entire machine.

Twenty bytes of memory were included in the real-time clock counter chip. This data was retained using a nickel-cadmium battery.

Timekeeping

The Macintosh featured a real-time clock counting seconds, and a countdown timer with near-microsecond resolution. The former was connected to the 6522 by a serial bus on three general-purpose I/O lines. It functioned much as a quartz watch when the machine was powered off. The latter was built into the 6522 itself. Either could generate interrupts.

The countdown timer provided the hardware necessary for preemptive multitasking.[citation needed] The Macintosh operating system did not feature multitasking until 1987 with the release of the MultiFinder, unlike the Lisa, which used cooperative multitasking. Preemptive multitasking was not possible in the Macintosh operating system; only with the release of OS X, which eventually replaced it, did preemptive multitasking come to the Macintosh platform.

Memory Map

  • RAM ($000000 - $07FFFF) is divided up into a series of different functional areas:
    • System globals ($000000 - $000AFF)
    • System heap ($000B00). SysZone points to start, ApplZone points to end + 1
    • Application heap (ApplZone; grows upwards. HeapEnd points to its end; ApplLimit sets maximum)
    • Stack. Grows downwards from CurStackBase; SP = A7 points to top of stack.
    • QuickDraw globals. (206 bytes) A5 points to boundary between QD globals and App globals (the "A5 world").
    • Application globals
    • Application parameters (32 bytes)
    • Jump table
    • Alternate screen buffer, 21,888 bytes (BufPtr)
    • 9344 bytes of undocumented space
    • 740 bytes alternate sound buffer
    • 796 bytes undocumented
    • Screen buffer, 21,888 bytes (ScrnBase = $01A700)
    • System Error handler, 128 bytes
    • Main sound buffer, 740 bytes
    • 28 bytes undocumented, MemTop points to the end of RAM, +1
  • ROM ($400000 - $41FFFF)
  • sccRBase - SCC read operations - $9FFFF8
  • sccWBase - SCC write operations - $BFFFF9
  • IWM (dBase) $DFE1FF
  • VIA (vBase) $EFE1FE
    • aVBufB - register B base - $EFE1FE
    • aVBufA - register A base - $EFFFFE
    • aVIFR - interrupt flag register - $EFFBFE
    • aVIER - interrupt enable register - $EFFDFE

Note that the RAM map is organised so that the system globals, system and application heaps grow upwards from low memory, everything else grows downwards from MemTop, from high memory towards low memory. On the 512K Macintosh, the "extra" RAM thus appears as a wider gap between the application heap and the stack, where it is available for application use.