
SECTION
THREE--TESTING
THE
MBGA
Overview
Test equipnent
Test Configuration
Trouble-Shooting
a
dead
unit
ST
Diagnostic
Cartridge
Power-up
RAM test
ROM
test
Color test
Keyboard
test
MIDI test
RS232 test
Audio test
Tining test
DMA test
Floppy
Disk test
Printer/Joystick
test
High
Res
Monitor
Blitter test
Clock
test
Expansion
port
test
Error
Codes
Quick
Reference
SECTION
FOUR--DISASSBMBLY/ASSEMBLY
SECTION
FIVE-.SYMPTOM
CHECKLIST
Display
problems
Disk
Drive
Problens
Keyboard
problens
MIDI
problems
R5232
problens
Printer
Problems
Hard
Disk
Problens
Real
Time
Clock
Problens
Blitter
Problens
3.1
3.1
3.2
3.2
3.4
3.4
3.6
3.7
3.7
3.9
3.9
3.
10
3.
11
3.r7
3.r2
3.
13
3.t5
3.16
3.L6
3.L7
3.r7
3.18
5.t
5.L
5.2
5.2
5.2
5.2
5.2
5.2
5.2
í.2
Mega Service
Manual
Table of
Contents

SECTION ONE
INTRODUCTION
The Mega
2
and
Mega
4 are Motorola
MC68000 nicroprocessor based
conputers with
sinilar
architectures
to the
520ST/
1040ST line. They
are
styled as
a
nain CPU
unit
with a detached
keyboard. The Mega 2 has
2 negabytes
of RAM,
the Mega 4 contains 4 negabytes. Both the Viega
2
and
Mega
4 have
a built-in 1 Megabyte
(720K
fornatted)
3,5
inch floppy
disk
drive,
and an internal switching
power
supply with built-in
cooling fan.
Since the
onty difference between
the
Mega 2
and
Mega
4 is the
size
of its RAM,
this
nar¡ual
will
use
'
Mega
'
as a
generic
tern
which
refers
to both
products.
Power Light
Disk
Drive
Drive Busy Light
FIG. 1
COMPUTER SYSTEM
Mega
Service
Manua1
ItIEGA
1.1
Introduction

The main
components
of
the
Mega 2 and
Mega
4 are:
CPU
Main board assembly
Disk drive
Power supply
& cooling
fan
RF Shield
(upper
and
lower)
CPU
Plastic case
(upper
and
lower)
KEYBOARD
Keyboard assembly
Interface board
assembly
Keyboard
Plastics
(upper
and
lower)
MOUSE
Mouse board assembly
Mouse Plastics
(upper
and
lower)
CASE
DESIGN
shows
the
CPU
portion
and figure
7
shows the
o
o
o
o
o
o
o
o
o
o
Figures
1
thru 4
keyboard
portion,
Battery
Housing
of the
IUEGA,
5
ar¡d
6
mouse.
shows
the
Cover
--
size AA Batteries
+
Top
of
Computer
(+)(-)
FIG. 2
BATTERY COMPARTMENT
Mega
Service
Manual
r.2
Introduction

SECTION
T!{O
THEORY OF OPERATION
OVERVIEW
The Mega 2 and
Mega 4 share a coruDon architecture,
using the sa.ne
LSI
chip set,
and case styling.
Ttre only difference
is the addition
of
one
ba¡rk of
2 Mega-bytes of
RAM, for a total of 4
Mega-bytes of
RAM
on
the Mega 4.
Ttre hardware can be considered
as consisting of
a
nain
systen
(central processing
unit ar¡d
support chips)
a¡rd several
Input/Output subsystens
.
Main
System
o
Mc680o0 running at SMltz
o
192 Kbyte Read Only
Memory
o
2
or 4
Mega-byte
Randon Access Menory
o
Direct Menory
Access
support
o Systen
tining and
Bus control
o
Interrupt control
Audio/Video Subsystem
o
Bit Mapped video display,
using
l2k
bytes of
RAM, relocatable
anywhere
in nenory.
There
are
three display
nodes available:
a.
32O
x 200
pixel,
16
color
palette
îron
jL2
selectÍons
b. 640
x 200
pixel,
4
color
palette
fron
!12
selections
c. 640
x
400
pixet,
nonochrone
o
BITBLiT
support
o
Monitor
interface analog:
RGB, Monochrone
o
Audio output:
programmable
sound chip
with
J
voices
Input/Output Subsystens
o
Intelligent
Keyboard
with
2
button
mouse/ioystick interface
o
Parallel
printer
interface
(Centronics)
o
RS-232C serial
interface
o
DMA
Port & connector
for
external
drive
o
Hard disk
drive
interface &
Laser
Printer
o
Musical
instrunent
network connunication
:
Musical
Instrunent
Digital
Interface
(MIDI).
o
ReaI
Time Clock with
battery
backup
o
ROM
Port
Mega
Service
ManuaL
2.7
Theory of Operation

MAIN
SYSTEM
The
main system
includes
the
microprocessing
unit,
main
nemory
(ROM
and
RAM)
,
systen
control,
intepupt
control,
and
general
purpose
DMA controller.
MicroProcessing
Unit
The
Mega uses
the
Motorola
MC68000
16 bit
external/32
bj-t
internal
data
bus,
Z4 Uit
address
bus
nicroprocessor,
running
at
I
Mflz.
Glue
Glue
(naned
because
it holds
the
systen
together)
is
such an
important
component
that
it
is
involved
in nearly
every
operation
in
thè
computer.
The
functions
nay be
sumnarÍzed
as
follows:
Clock
dividers--
takes
ttre
I
Mtlz clock
and outputs
2
Mllz and
500
KHz clocks.
Video
tining--
B-Lank,
DE
(Display
Enable),
Jlsync:
gnd Hsync
are
use¿
to
generãtlsignals
for
the
video
display.
There
is a
Ìead/Write
register
in Gtue
wfrich
nay be
written
to
configUre
for
50
or
60 Hz
operation
(done
by
the
Operating
System).
Interrupt
priority--
interrupts
fron the
MFP
and video
tining
are
codeffisofpriorityonoutputsIP11andÍPL2tothe
68000.
These
leve1s
correspond
to
no
interrupts,
MFP
interrupts,
VSYNC
interrupt,
HSYNC
interruPt.
Signa]
and
Bus
qlbitration--
Glue
decodes
addresses
to
generate
crrip
,
DMA
Controller,
Progranmable
Sound
Genàrator,
Memory
Controller,
and
ROMs.
It
receives
signals
from the
MFP,
DMA,
Menory
Controller,
to
synchronize
data
transfer.
It arbitrates
the
bus
during
DMA transfers
to
prevent
CPU and
DMA
devices
from
interfering
with
each
other
(see
DMA
below)
'
IlleEal
condition
detectiq4--Glue
asserts
Bus
Error
(BERR)
if
writing
to
ROM,
writing
byte
writing
to
system
DeII¡ory
when
the
processor
is
in user
mode.
AIso occurs
if a
device
does
not
respond within
the
required tine
linit.
For example,
the
CPU
tries to
read
from
nemory
and
the
Memory
Controller
does
not
assert
DTACK.
certain
conditions
are
violated,
such
as
sized
data
to
a word sized
register,
or
Mega Service
Ma¡rual
2.2
Theory
of
Operation

Main
Menory
Main
menory
consists
of L92 kbytes
of ROM
and
one
or
two
banks
(2
Mega-byte
each) of d¡manic RAM.
rn
addition,
the
cartridge
sLot alrows
access
to 128 Kbytes
of
ROM.
All
nenory is
directly
addressable.
The
components
of
the
ne¡nory
systen
are:
ROM,
RAM,
RAM
buffers, Menory
controller,
a¡¡d
Glue. Tt¡e
Operating
System resides
nostly
in
ROM,
wíth
optional
segnents loaded
fron
disk into RAM.
R.{M is
organized
as
16
bit
words
and
nay
be
accessed 16
bits
at a
tine
or
8 bits
at a tine.
Even nunbered
addresses refer
to the high
I
bits
of a word
and odd addresses
refer
to the low
I bits. RAIII
ís made
up
of
1 Megabit
X 1
chips; in
the Mega 2
there
are 16
chips,
giving
z
Mbytes,
while in
the Mega
4 there is
a¡r additional
bank
of L6
chips,
giving
two tines
the
nemory,
or 4 Mbytes.
BAM menory
nap:
000008-000800
Systen nenory
(priveliged
access)
000800-1FFFFF
low
bank
200000-3FFFFF
high
bank
(Mega
4 only)
Note:
the
first
8 bytes
of ROM are napped
into
addresses
O-7.
These
are reset
vectors
which the
68000 uses
on start-up.
The
Operating
Systen is located
in
two
lMeg
x
I
ROM
chips
in
current
versions
(192k).
Menory
Controller--takes
addresses fron
the address
bus and
converts
to Row Address
Strobe
(RAS)
and Column
Address
Strobe
(CAS).
All
RAIì|
accesses
are controlled
by this Atari
proprietary
chip,
which
is
progrannable
for
up to 4
Megabytes
of
nenory.
Tt¡e
Operating
System
determines how
nuch Eernory
is
present
and
prograns
the
Menory
Controller
at
poner-up.
Ttre Memory
Controller refreshes
the
dynanic
RAMs,
loads
the Video Shifter
with display
data,
and
gives
or
receives
data
during direct nernory
access
(DMA).
Glue--decodes
addresses for RAM
a¡rd ROM
a¡rd asserts
output
signals
to
enable these devices
(also
decodes
addresses for
nost
hardware
registers
to
provide
chip selects,
as well as nany
other
functions.
See Glue
description
above.
).
Direct Menory Access
Direct
menory
access is
provided
to
support both low
speed
(25O
to
500
Kilobits/sec)
and
high
speed
(up
to 8
Megabits/sec)
Sbit device
controllers.
The floppy
disks transfer
data via low
speed
DMA
and the
hard
disk
(or
other devices on the hard
disk
port)
transfer
at high
speed.
For DlvlA
to take
place,
the
Menory
Controller
is
given
the
address
of
where to tal<e data
fron
or
put
data
in
RAM,
the
DMA
Controller
is
set up
(which
channel,
high
speed or low
speed, and how
many
bytes)
and the
peripheral
is
given
a
comnand to send
or
receive
data. The
entire block of data
(the
size
must
be
given
to
the
DMA
Controller
and
the
peripheral
before the
operation
starts)
is
then
transferred
to or
from menory
without intervention
by the CPU.
Mega
Service Manual
2.3
Theory
of Operation

AUDIO/VIDEO
SUBSYSTEM
The
video
subsysten
consists
of
the video display nenory,
the
Menory
controller,
Glue,
a
graphics
control chip
(video
shifter),
a
graphics
processing
unit
(BImLiT)
,
and a discrete
section
to drive
the
video
output.
The audio
subsysten
consists
of
a
Progra.mnable
Sound
Generator
chip with a transistor
output
anplifier.
Video
Shifter
There
are 16
color
palette
registers
Ín
the shifter.
AII 16
are
nay
be used in
row resorution,
4
nay
be used
in
high
resolution,
a¡¡d
only
one
is
used in high resorution
(actuarly,
onry bit
0
of
register
0
is
used
for inverse/nornal
video). Each
palette
is
progr¡mmed
for
8
Ievels
of intensity
of red,
blue,
and
green,
so
there
are 8 x
I x I
=
112
colors
possible.
For
a
given
pixel,
the coror
which is
displayed
is
taken fron
the
palette
referred
to by
getting
infornation
from
each
logical
plane (see
description
of
video
dispray menory
betow). The
shifter
will
output the red,
green,
and
blue
levers
specified
by
that
palette;
note
there are three
outputs for
each color. Each
output is
either
on or off. Thus,
the nu¡nber
of
possible
output levels
is
Z to
the
lrd
power
=
$. The
three
outputs
are sr¡nmed
through
a resistor
network
to
proportion
the voltage level
to
give
I equal
steps. In
monochrome
node,
the
color
palettes
are bypassed
a¡rd there is
a
separate
output.
Video Display
Menory
Display
nemory
is
part
of nain nenory
with
the
physical
screen
origin
located
at the top left
corner
of the
screen.
Display
Eenory
is
configured as 1, 2,
or
4
(nigh,
nediun,
or
1ow
resolution)
Iogical
planes
interwoven
by 16 bit
words into
contiguous
nemory
to forn
one
32
Kilobyte
physical
plane
starting
at a 256 byte
half
page
boundary. The
starting address of display
Eer¡ory is
placed
in
the Menory
Controller's
Video
Base
Address
register
by
the Operating
Systen
or
application. The Menory
Controller
will load
display
infornation
into
the video
Shifter 16
uits
at a tine,
and the Video
Shifter
wirl
decode this infornation
to
generate
a seriar
dispray
strean. rn
nonochrone
mode,
each bit represents
1
pixer
on or off. rn
color,
bits
are conbined fron
each
plane
to
generate
the comect level
of red,
green,
and blue.
For
exanple, in
low resolution
(4
ptanes)
4 words
are
loaded
into
the
Video Shifter for
each
word
(16
pixels
displayed
on the
screen. Tt¡e
Video
Shifter
conbines
bit 0 from
each word
to forn
a four
bit
nunber
(0-15),
and takes the
color
from
the
palette
referenced
by that
nunber
(e.s.
0101=5,
use color from
palette
register
!)
a¡rd
outputs
those revers,
then takes
bit
1 fron
each
plane
and outputs
the coror
from
the
palette
referenced
by those four
bits,
etc.
Mega
Service ManuaÌ 2.5
Theory
of Operation

Real
Tine
Clock
with
Battery Backup
Ttris
device has
counters for
Time
and Calendar
buÍIt-in. Clock
data
are expressed with BCD
code. The
lower four
address
and data
Iines
are
used to
program
the device
and access
the clock
through
signal lines
RTCCS, RTCRD, RTCh¡R
which
generated
fron
a decoder. A
RESET
line is
also
provided
to reset
the chip when
the system is reset.
The
naín clock supplied to
the devÍce is
a
32.768
l<hz
oscillator
which
will
be adjusted by a trimmer condenser
so that it
will output
through
the CLKOIJII
line
a standard
clock signal
of
16.384 Xfrz.
In
addition, a
JV
battery backup ca¡¡ be used
to
keep
the clock running
during
power
down.
For nore
detail,
please
refer
to
the application na¡rual
fron
the
nanufacturer
(RICOH
part
number RP5C15)
Mega
Service Manual 2.7
Theory
of Operation

Intelligent Keyboard
The
keyboard
trarismits
nake/break
key scan codes,
ASCII
codes,
nouse data,
joystick
data,
in response
to external
events, and
tine-
of-day data
(year,
month, day,
hour, minute,
second)
in response
to
requests by the
CPU. Comnunication is
controlled
on the
nain
board by
a
6850 device
a¡rd
on
the keyboard assenbly by the
lMHz
8 bit
HD6301
Microconputer Unit.
The HD6301 has internal RAM
and
RoM. Included in
ROM are self-test diagnostics which are
perforned
at
poh'er-up
and
whenever the
RESET
connand
is
sent over
the serial connunication
line
by the CPU.
The MC6850 is read
a¡¡d written to
by the CPU in response to
interrupts
which are
passed
to
the
CPU by Èhe
MFP interrupt
controller.
The 2 Button Mouse is
a¡r opto-mechanical
device with the
following
characteristics: a resolution of
100
counts/inch,
a
mæ<imun
velocity of
10 inches/second
and a
naxinum
pulse phase
error of
50
percent.
The
joystick/nouse
port
has inputs
for
up, down,
left, ríght, right
button,
Ieft
button.
The right
button
equals the
joystick
trigger, a.nd the
left
button
is
wired to the second
joystick
port
trigger.
The
joystick
has
four
directions
(up,
down, etc. ) and
one trigger.
Mouse/Joystick
1
-
Up/XB
2
-
Down/XA
3 - Left/YA
4 - Right/YB
5
-
Not
Connected
6
-
Fire/Left
Bulton
7-
+sVDC
I
-
Ground
9
-
Joyl
Fire/Right
Bulton
1-up
2
-
Down
3 - Lefl
4
-
Right
5
-
Reserved
6
-
Fire
Button
7-
+SVDC
8
-
Ground
9
-
Not
Connected
FIG.
10
MOusE/JoY
PoRT
v
Joystick
3
Mega
Service Manual
2.ro
Theory
of
Operation

Disk Drive
Interface
The Mega
conputers
have
a
built-in floppy
disk controller
(a
lrJestern
Digital
L772) and
logic for
selecting
up to
trr¡o single
or
double sided drives. The Mega has one built-in
floppy disk
drive a¡rd
provision
for
one external disk drive. The hlestern Digital WDt772
Controller
services both drives. Drive
and side selection
is
done
by
outputs
on the
YM2149 PSG
chip. The CPU reads
a¡rd writes
to the
L772
through
the
DMA
Controller,
Tl:e 1772
Ínterrupts
the CPU on
the
INTR
Iine, via
the
MFP interrupt
controller. Tl:re L772
accepts
high
level
comnands, such as
seek,
fornat
track,
write
sector,
read
sector,
etc.
and
passes
data to the
DMA Controller
(see
DMA
controller under
Main
Systen,
above,
for
details
on DMA
tra¡rsfer).
The L772 ínbemupts the
CPU
when the operation
is
conplete.
The
CPU
is
freed fron
nuch
of the
overhead of disk I/0.
I
Floppy
tlsk
1 - Read Dala
2-Side0Select
3
-
Logic Ground
4 - lndex
Pulse
5-Drive0Select
6-DrivelSelect
7 - Logic
Ground
I
-
Motor
On
9 - Direction
ln
10
-
Step
FrG.
L3
EXTERNAL
FLOPPY
11
-
Write Data
12
-
Write
Gale
13
-
Track
00
14
-
Write
Protecl
PORT
Mega
Service Manual
2.13 Theory of Operation

DMA
Port;
Hard
Disk
Interface
The
hard
disk
drive
interface
is
provided through
the
DMA
controller;
the
hard
disk
controller
is off-board
and is
board
a¡rd
is sent
conna¡¡ds
via an
SCSI-like
(SnaII
Conputer
System
Interface)
command
paraneter
block.
Data
is transferred
via
DMA.
l,Jriting
to
the externâI
controller
causes
HDCS
(Hard
Disk
Chip
Se]ect)
to
go
low and
CAl
to
go
high.
DMA tra¡¡sfers
are
controlled
by
the
external
device.
fJhen
data
is available,
or
the
device
is
ready to
accept
data,
HDRQ will
be
driven
high by
the
external
controller.
The
DMA chip
nust
respond
within
2!0
nanoseconds
with
ACK
(}ow)
to
acknowledge
that
data
is on the
bus
or
has
been
read
fron the bus-
The
Memory
Cóntroller
feeds
data
to
or accepts
data
fron the
DMA
Controller.
Transfers
can
take
place
at
up
to
1 Mbyte/second.
a
Had
Disk
1-Data0
2-Dala1
3-Data2
4-Data3
5-Data4
6-Data5
7-Data6
8-Data7
9
-
Chip
Select
10
-
lnterruPt
Request
11 - Ground
1
2
-
Reset
FIG. 14
EXTERNAL
HARD DISK
aaaaaaaaaa
aaaaaaaaa
13
-
Ground
14
-
Acknowledge
'15
-
Ground
16
-
A1
17
-
Ground
18
-
Read/Write
19
-
Data
Request
PORT
Mega
Service
Manual
2.r4
Theory of
Operation

SYSTEM
STARTUP
After
a
RESET
(power-up
or reset
button) the
68000 will
start
executÍng at
the address
pointed
to by
locations
4-J, which is RoM
(GIue
maps
8 bytes of ROM
at
FC0000-J
into
the addresses
0-7).
Location
000004
points
to the start
of the operating
systen code in ROM
(FCOOOO-
FEFFFF).
The following
sequence is
then executed:
1. Perforn
a
reset instruction
(outputs
a
reset
pulse).
2. Read
the
longword
at cartridge
address
F40000. If
the
data
read
is a
"nagic
nunber",
execute fron
the cartridge
(diagnostic
cartridge tal<es over here). If not,
continue.
3.
Check for
a warn start
(see
if RAM locations
vrere
previ.ously
written), initialÍze
the nenory
controller,
and continue
running
the application which
was
running
before
the reset if
it
was a warm start.
Initialize
the
PSG
chip, deselect
disk drives.
Initialize
color
palettes
a¡rd set screen
address.
If not
a
h,arn start, zero De[¡ory.
Set up operating system variables in RAM.
Set up exception
vectors.
Initialize MFP.
Set screen
resolutÍon.
11. Attempt
to boot
floppy;
attenpt to boot
hard
disk;
run
progran
if
succeeded.
SYSTEM
ERRORS
The 68000 has a feature calted
exception
processing,
which takes
place
when an Ínterrupt or bus error is indicated
by external
logic,
or
when the CPU detects an emor
internally,
or
when certain
types of
instrtrctions
are executed.
An exception
wiII cause the CPU to fetch a
vector
(address
to a
routine)
fron
RAM
and start
processing
at the
routine
pointed
to by
the vector. E:<ception vectors
are
initialized
by
the
operating system.
Those exceptions whích
do
not have legitimate
occurrences
(interrupts
being legitimate) have
vectors
pointing
to a
general purpose
routine which wiII
display some
nunber
of bonbs
showing
on
the screen
(nushroon
clouds in
older versions of disk loaded
operating
systen).
The number of
bonbs equals the
nunber
of the
exception
which occurred.
4.
5.
6.
7.
8.
9.
10.
Mega
Service
ManuaL 2.15 Theory
of Operation

System
errors
nay or ¡nay
files
from disk wiII cause the
Verify the diskette and
disk
computer.
not
be
recoverable.
Errors
in
loading
system to crash,
necessitating
a
reset.
drive before
attempting
to repair
the
NUMBER OF BOMBS
AND MEANINGS
(No.
26,28,30, ana 64-79 wiII
not bomb, as
they are
legitinate.
)
2 Bus
Error.
Glue asserted bus error
or
CPU detected an error.
]
Address Error. Processor attenpted
to access word or
long word
sized data on an odd
address.
IIIegaI
Instruction.
Processor fetched an
instruction from
ROM
or
RAM which nas not a
legal instruction.
Zero
Divide. Processor was asked
to
perforn
a
division by zeto.
Chk
Instruction. This is a
legal instruction,
if
software uses
this,
it nust
install
a
handler.
Trapv
Instruction.
See
Chk
instruction.
Privilege Víolation. CPU
was in user
mode, tried to
access
a
location in
supervisor
address space.
Trace. If
trace
bit
is
set
in
the
status
register, the CPU will
execute
this exception after every
instruction. Used to debug
sofuware.
10 Line 1010 Ernulator.
CPU read
pattern
1010 as an
instruction.
Provided to allow user to
emulate
his own
instructions.
11 Line 1111 Emu1ator. See
Line 1010
Emulator.
12-23 Unassigned, shouLd
be
no
occurrence.
24
Spurious
Interrupt.
Bus
error
during
interrupt
processing.
25-3L Autovector
Interrupt.
Even nunbered
vectors are used, others
should
have
no
occurrence.
32-63
TRAP
Instruction.
The CPU read
instruction
which forced except-
ion
processing.
64-lg MFP
interrupts.
BO-255 User
interrupts.
Note: If
you
have an emor
nessage such
as
"T0S
ERROR
35",
then the
possible
errors are:
1- The
file in
progress
is
bad.
2- The
total
number of
folders
in
the sysLem
has
exceeded
the 4O-folder
linit. However, there
is
a
program
which
can be used to
extend this
limitation on
folders.
3-
No ha¡rdles left or
too
nany
open
files.
5
6
7
B
9
Mega
Service
Manual
2.L6
Theory of Operation