<s>
MEGAlink	B-Protocol
is	O
a	O
file	B-Protocol
transfer	I-Protocol
protocol	I-Protocol
for	O
modem-equipped	O
microcomputers	B-Architecture
written	O
by	O
Paul	O
Meiners	O
in	O
1987	O
.	O
</s>
<s>
Like	O
many	O
protocols	O
of	O
the	O
era	O
,	O
MEGAlink	B-Protocol
is	O
an	O
expanded	O
version	O
of	O
the	O
seminal	O
XMODEM	B-Protocol
.	O
</s>
<s>
While	O
it	O
was	O
a	O
relatively	O
simple	O
and	O
high-performance	O
system	O
,	O
it	O
remains	O
relatively	O
obscure	O
because	O
it	O
was	O
overshadowed	O
by	O
ZMODEM	B-Device
,	O
which	O
had	O
been	O
released	O
a	O
year	O
earlier	O
and	O
saw	O
rapid	O
uptake	O
.	O
</s>
<s>
XMODEM	B-Protocol
was	O
introduced	O
in	O
1977	O
as	O
what	O
its	O
author	O
described	O
as	O
a	O
"	O
quick	O
hack	O
"	O
.	O
</s>
<s>
It	O
had	O
a	O
number	O
of	O
rather	O
obvious	O
problems	O
,	O
which	O
became	O
more	O
annoying	O
as	O
modem	B-Application
speeds	O
increased	O
during	O
the	O
early	O
1980s	O
.	O
</s>
<s>
Through	O
this	O
period	O
,	O
a	O
number	O
of	O
new	O
file	B-Protocol
transfer	I-Protocol
protocols	I-Protocol
for	O
BBS	O
users	O
appeared	O
in	O
order	O
to	O
address	O
issues	O
in	O
the	O
original	O
XMODEM	B-Protocol
.	O
</s>
<s>
XMODEM	B-Protocol
remained	O
extremely	O
popular	O
throughout	O
this	O
period	O
,	O
as	O
it	O
was	O
one	O
of	O
the	O
few	O
protocols	O
that	O
was	O
universally	O
supported	O
.	O
</s>
<s>
In	O
1986	O
,	O
Chuck	O
Forsberg	O
released	O
ZMODEM	B-Device
,	O
a	O
radically	O
improved	O
file	B-Protocol
transfer	I-Protocol
protocol	I-Protocol
that	O
offered	O
many	O
new	O
features	O
,	O
high	O
performance	O
,	O
and	O
ran	O
on	O
services	O
that	O
corrupted	O
XMODEM	B-Protocol
transfers	O
.	O
</s>
<s>
The	O
only	O
downside	O
to	O
ZMODEM	B-Device
was	O
that	O
it	O
was	O
very	O
complex	O
,	O
which	O
made	O
it	O
difficult	O
or	O
impossible	O
to	O
implement	O
on	O
some	O
machines	O
,	O
especially	O
the	O
large	O
installed	O
base	O
of	O
systems	O
like	O
the	O
Commodore	O
64	O
.	O
</s>
<s>
MEGAlink	B-Protocol
was	O
introduced	O
as	O
part	O
of	O
Meiners	O
 '	O
GT	B-Protocol
PowerComm	I-Protocol
terminal	B-Application
emulator	I-Application
to	O
address	O
this	O
issue	O
.	O
</s>
<s>
It	O
offered	O
high	O
performance	O
,	O
similar	O
to	O
that	O
of	O
ZMODEM	B-Device
,	O
while	O
being	O
much	O
simpler	O
to	O
implement	O
.	O
</s>
<s>
In	O
spite	O
of	O
this	O
attractive	O
combination	O
of	O
features	O
,	O
MEGAlink	B-Protocol
never	O
became	O
popular	O
,	O
and	O
few	O
other	O
terminal	B-Application
emulators	I-Application
appear	O
to	O
have	O
added	O
support	O
-	O
a	O
review	O
article	O
in	O
1988	O
shows	O
only	O
PowerComm	O
and	O
one	O
other	O
program	O
supporting	O
it	O
.	O
</s>
<s>
The	O
move	O
from	O
8-bit	O
to	O
16-bit	O
computers	O
was	O
taking	O
place	O
at	O
the	O
same	O
time	O
that	O
MEGAlink	B-Protocol
was	O
being	O
introduced	O
,	O
and	O
by	O
the	O
late	O
1980s	O
any	O
benefits	O
in	O
terms	O
of	O
simplicity	O
had	O
been	O
mooted	O
.	O
</s>
<s>
ZMODEM	B-Device
went	O
on	O
to	O
be	O
almost	O
universal	O
.	O
</s>
<s>
XMODEM	B-Protocol
is	O
a	O
simple	O
protocol	O
,	O
and	O
that	O
is	O
the	O
primary	O
reason	O
for	O
its	O
popularity	O
.	O
</s>
<s>
The	O
file	O
to	O
be	O
sent	O
is	O
broken	O
up	O
into	O
128-byte	O
chunks	O
that	O
form	O
the	O
payload	O
data	O
of	O
its	O
packets	B-Protocol
.	O
</s>
<s>
A	O
3-byte	O
header	O
consisting	O
of	O
the	O
SOH	O
character	O
and	O
two	O
8-bit	O
integers	O
is	O
added	O
in	O
front	O
of	O
the	O
data	O
and	O
a	O
1-byte	O
checksum	B-Algorithm
at	O
the	O
end	O
,	O
making	O
the	O
overall	O
packet	B-Protocol
132	O
bytes	O
long	O
.	O
</s>
<s>
The	O
protocol	O
is	O
triggered	O
by	O
the	O
receiver	O
,	O
who	O
sends	O
a	O
NAK	B-Protocol
character	O
to	O
start	O
the	O
transfer	O
,	O
waits	O
for	O
a	O
packet	B-Protocol
in	O
response	O
,	O
and	O
then	O
sends	O
ACK	B-Protocol
if	O
the	O
packet	B-Protocol
was	O
received	O
correctly	O
,	O
or	O
NAK	B-Protocol
if	O
it	O
was	O
n't	O
.	O
</s>
<s>
Because	O
the	O
phone	O
system	O
has	O
a	O
certain	O
amount	O
of	O
latency	O
,	O
it	O
takes	O
some	O
time	O
for	O
the	O
ACK	B-Protocol
or	O
NAK	B-Protocol
to	O
travel	O
back	O
through	O
the	O
lines	O
and	O
trigger	O
the	O
sending	O
of	O
the	O
next	O
packet	B-Protocol
.	O
</s>
<s>
At	O
300bit/s	O
this	O
represents	O
a	O
short	O
time	O
compared	O
to	O
the	O
time	O
needed	O
to	O
send	O
the	O
packet	B-Protocol
of	O
data	O
,	O
so	O
this	O
can	O
be	O
ignored	O
.	O
</s>
<s>
One	O
is	O
to	O
make	O
the	O
packet	B-Protocol
size	O
larger	O
so	O
the	O
latency	O
represents	O
a	O
smaller	O
fraction	O
of	O
the	O
time	O
needed	O
to	O
send	O
a	O
packet	B-Protocol
.	O
</s>
<s>
This	O
was	O
used	O
in	O
a	O
number	O
of	O
protocols	O
,	O
notably	O
YMODEM	B-Protocol
.	O
</s>
<s>
Another	O
solution	O
is	O
to	O
use	O
a	O
sliding	O
window	O
that	O
allows	O
multiple	O
packets	B-Protocol
to	O
be	O
sent	O
without	O
needing	O
an	O
ACK	B-Protocol
for	O
every	O
one	O
,	O
as	O
used	O
in	O
WXMODEM	O
and	O
others	O
.	O
</s>
<s>
MEGAlink	B-Protocol
is	O
essentially	O
a	O
combination	O
of	O
features	O
from	O
prior	O
attempts	O
to	O
improve	O
XMODEM	B-Protocol
performance	O
.	O
</s>
<s>
The	O
most	O
basic	O
change	O
was	O
to	O
expand	O
the	O
packet	B-Protocol
size	O
from	O
128	O
bytes	O
to	O
512	O
.	O
</s>
<s>
MEGAlink	B-Protocol
deliberately	O
avoided	O
the	O
sliding	O
window	O
solution	O
,	O
eliminating	O
the	O
need	O
to	O
send	O
an	O
ACK	B-Protocol
at	O
all	O
.	O
</s>
<s>
The	O
sender	O
would	O
simply	O
continue	O
to	O
send	O
packets	B-Protocol
until	O
,	O
if	O
ever	O
,	O
an	O
NAK	B-Protocol
was	O
received	O
.	O
</s>
<s>
The	O
NAK	B-Protocol
was	O
sent	O
with	O
two	O
following	O
bytes	O
,	O
the	O
first	O
containing	O
the	O
packet	B-Protocol
number	O
where	O
the	O
error	O
occurred	O
,	O
and	O
the	O
second	O
as	O
a	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
of	O
that	O
number	O
.	O
</s>
<s>
In	O
order	O
to	O
quickly	O
re-send	O
data	O
when	O
required	O
,	O
the	O
sender	O
had	O
to	O
maintain	O
a	O
data	B-General_Concept
buffer	I-General_Concept
of	O
the	O
file	O
's	O
data	O
so	O
it	O
could	O
rapidly	O
rewind	O
to	O
that	O
point	O
.	O
</s>
<s>
Machines	O
of	O
the	O
era	O
had	O
small	O
amounts	O
of	O
memory	O
,	O
64kB	O
was	O
not	O
uncommon	O
,	O
so	O
large	O
buffers	B-General_Concept
were	O
not	O
easily	O
arranged	O
.	O
</s>
<s>
To	O
address	O
the	O
fact	O
that	O
the	O
sender	O
might	O
not	O
have	O
enough	O
memory	O
to	O
send	O
very	O
long	O
streams	O
,	O
MEGAlink	B-Protocol
allowed	O
the	O
sender	O
to	O
request	O
an	O
ACK	B-Protocol
at	O
any	O
point	O
,	O
which	O
would	O
allow	O
it	O
to	O
clean	O
out	O
its	O
buffer	B-General_Concept
when	O
needed	O
.	O
</s>
<s>
To	O
do	O
this	O
,	O
the	O
sender	O
sent	O
an	O
ASCII	B-Protocol
RS	O
(	O
Record	O
Separator	O
)	O
character	O
.	O
</s>
<s>
If	O
the	O
receiver	O
sees	O
an	O
RS	O
instead	O
of	O
the	O
expected	O
SOH	O
at	O
the	O
start	O
of	O
the	O
next	O
packet	B-Protocol
,	O
it	O
immediately	O
sends	O
a	O
reply	O
consisting	O
of	O
an	O
ACK	B-Protocol
and	O
the	O
packet	B-Protocol
number	O
and	O
inverse	O
as	O
in	O
the	O
case	O
of	O
the	O
NAK	B-Protocol
.	O
</s>
<s>
The	O
sender	O
can	O
then	O
remove	O
any	O
data	O
prior	O
to	O
that	O
packet	B-Protocol
from	O
its	O
buffer	B-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
GT	B-Protocol
PowerComm	I-Protocol
used	O
a	O
buffer	B-General_Concept
large	O
enough	O
for	O
32	O
packets	B-Protocol
,	O
and	O
sent	O
an	O
RSs	O
request	O
every	O
16	O
packets	B-Protocol
or	O
so	O
.	O
</s>
<s>
The	O
original	O
version	O
of	O
MEGAlink	B-Protocol
used	O
16-bit	O
cyclic	O
redundancy	O
check	O
(	O
CRC	O
)	O
,	O
as	O
was	O
the	O
case	O
for	O
many	O
other	O
XMODEM	B-Protocol
offshoots	O
.	O
</s>
<s>
Like	O
those	O
versions	O
,	O
the	O
receiver	O
indicated	O
it	O
was	O
capable	O
of	O
receiving	O
CRCs	O
by	O
sending	O
an	O
initial	O
C	O
instead	O
of	O
a	O
NAK	B-Protocol
to	O
begin	O
the	O
transfer	O
.	O
</s>
<s>
MEGAlink	B-Protocol
was	O
later	O
modified	O
to	O
support	O
32-bit	O
CRCs	O
as	O
well	O
,	O
which	O
it	O
did	O
by	O
starting	O
packets	B-Protocol
with	O
an	O
EM	O
instead	O
of	O
SOH	O
.	O
</s>
<s>
The	O
"	O
zero	O
packet	B-Protocol
"	O
,	O
containing	O
file	O
information	O
,	O
was	O
always	O
sent	O
with	O
a	O
standard	O
SOH	O
and	O
16-bit	O
CRC	O
,	O
only	O
the	O
following	O
data	B-Protocol
packets	I-Protocol
used	O
the	O
EM	O
format	O
.	O
</s>
