�
Mimeo Cassette Interface Assembly
and Operations GuideBy Mike Willegal
www.willegal.net
version 0.18
CAUTION!!!Incorrect assembly or connecting of the Mimeo Cassette Interface can cause fatal damage to the interface and/or the motherboard. Double and triple check your connections before powering on. Pay special attention to orien-tation of the card when you plug it into the motherboard’s expansion slot. Plugging it in backwards will result in damage to the card and/or motherboard.
ForwardIn the mid �970’s, around the time the Apple � was developed, the only reasonably affordable interface for home computer hobbyist was repurposing an ordinary cassette recorder as a data storage device. Soon after the introduction of the Apple �, Apple Computer released the Apple Cassette Interface (ACI) for the Apple �. This small card had a list price of $75 and turned out to be the only peripheral card that Apple ever released for the Apple 1. The Mimeo Cassette Interface is a clone of Apple’s original ACI, duplicating the form, fit and function of the original ACI in exacting detail. This manual refers to the board as the ACI, since that is the name Apple used and for all intents and purposes the implementations and operation are identical.
�
ReliabilityReliability of the ACI card, in it’s stock form, is not very good by ��st century standards. Apple made improve-ments to the cassette interface circuit when it came out with the Apple II. I have spent considerable effort look-ing for improvements in reliability, without altering the design of the original ACI printed circuit board. In the end, I have found two items that can help with reliability,
One of these involve changing the value of the input coupling capacitor. I am providing parts that can used to build the board with either original component value or with a component that will improve reliability. Because of the reliability problems with the original design, I recommend building this kit with the components that improve reliability. Look and feel of the board is not affected but reliability is improved quite a bit. Even with these changes, reliability is not perfect, but the system will be more reliable.
The second reliability improvement I recommend, is using an Apple recommended cassette recorder. I have had great difficulty with a different vintage cassette recorder that works quite well with an Apple II. The good news is that a modern variation of the original Apple recommended recorder happens to remain on the market. This is a Panasonic RQ-��0�. There may be other cassette recorders that perform as well or better than the RQ��0�, but I don’t have the time or resources to investigate the possibilities.
Chapter 1 – Assemble Components, Tools, and Equipment
1. Recommended Tools and EquipmentQuality soldering station - I use a Weller WES51. Whatever you use, I recommend that it has some kind of temperature controlled tip. This will help prevent damage to the PCB when soldering. Soldering irons that do not have a temperature controlled tip can overheat and damage the PCB or component being solderedSolder - use quality solder - thinner solder is vastly easier to work with than fat solder. The fat stuff sold at hardware stores is not suitable for these sort of electronics projectsWire cutters – for trimming component leads and cutting wire to length Wire strippers - for stripping ends of jumper wireYour favorite PCB cleaning agent - Isopropyl Alcohol will dissolve many kinds of soldering resin. Windex will also help with cleaning PCBsOhm meter - to check for good connections and shortsLogic probe or oscilloscope – handy if you are having trouble with bring upYour host computer schematics or hardware interfacing guide – Direction for connecting to Mimeo 1 computers are provided in this manual
2. Additional Components (not included)Cassette Recorder - I strongly recommend the Panasonic RQ-2102Cassette Tapes - ordinary 30 or 60 minute tapes work wellTwo mono to mono 1/8” audio cables. One end plugs into the ACI, the other into jacks on the cassette recorder
•
•
•••
•••
•••
�
3. Compare Received Components With Parts ListExamine and identify all parts provided with the kit.
PART DESCRIPTION QUANTITY PRESENT
16 pin socket For PROMs 2
14 pin socket For 74LS parts 3
8 pin socket For LM311 1
LM311 Voltage comparator 1
74LS02 Quad 2 input nor gate 1
74LS10 Triple 3 input nand gate 1
74LS74 Dual D type flip flop 1
7474 no longer supplied - original 74LS74 works better 1
6301 - APPLE-A3 256x4 PROM - location A3 1
6301 - APPLE-A4 256x4 PROM - location A4 1
.01uF capacitor Input coupling capacitor 1
.1uF capacitor Reliability improvement replacement for .01uF 1
100 ohmbrown-black-brown Low part of voltage divider for tape output & current limiter for LED input monitor
2
3K resistor orange-black-red Voltage comparator feedback 1
10K resistorbrown-black-orange-gold High part of voltage divider for tape output
1
10K 1% resistorbrown-black-orange-black-brown Voltage dividers for in-puts to voltage comparator
4
47K resistor yellow-violet-orange Voltage comparator feedback 1
100K resistorbrown-black-yellow Sense resistor for input monitor LED
1
PCB Printed circuit board 1
MPS3704 Sense transistors for input monitor LED 2
RED LED Read level indicator 1
Audio Jacks Switchcraft #41 2
Jumper wire for jacks Apple used bare wire - use cut lead from a resistor 1
PARTS COUNT 32
COUNT OF TYPES 23
�
Chapter 2 – Solder In Components
1. OverviewThe key thing here is to check orientation and make sure that you don’t put the sockets or transistors in wrong. For the IC sockets, make sure that the parts are oriented correctly with pin � of the socket or chip near the edge of the PCB that contains the gold fingers. All components go on the front of the board (the side with the words “Apple Cassette Interface �” etched in copper.
Make sure the socket or chip is fully seated. I accomplish this by resting the socket upside down on a small object with the board on top. The weight of the board should keep the socket or chip completely seated. Then tack down a couple of corner pins and recheck orientation and seating. Then finish soldering the rest of the pins.
Take your time and enjoy the process, double checking orientation of devices as you go. The red or blue arrows indicate places to pay special attention when placing components.
back side of board
2. Check for Power and Ground Shorts on PCBEasiest way to do this is to use an ohm-meter to make sure that there is no connection between +5 volts, -�� volts and ground. The Ohm meter should show no connections between any of these nets. A convenient place to use to check for shorts, is this area on the back of the board (red arrows above).
5
3. Solder in All Components Except 1/8” Phono Jacks
front view of board (components are mounted on front side of board)
PART DESCRIPTION QUANTITY COMPLETE
16 pin socket A-3 and A-4 - pin 1 toward gold finger edge 2
14 pin socket A-2, A-5, A-6 - pin 1 toward gold finger edge 3
8 pin socket A-1 - pin 1 toward gold finger edge 1
capacitor
Input coupling capacitor - topmost device in row of components at A-1. Use .1uF (104) capacitor for better read reliability. Use .01uF (103) capacitor to exactly replicate original design.
1
100 ohm brown-black-brown Top of row at A4 2
100 ohm brown-black-brown Next to gold fingers in row A1
3K ohmorange-black-red Vertically mounted - left of 8 pin dip in row A-1
1
10K resistor brown-black-orange-gold Top of row at A-3 1
10K 1% resistorbrown-black-orange-black-brown Four in a row below cap in row A-1
4
47K resistor yellow-violet-orange Just above 8 pin dip in row A-1. 1
100K resistor brown-black-yellow just below two 1/8” jacks 1
MPS3704Below two 1/8” jacks - flat side toward top of board (middle pin goes in hole closer to top of board)
2
RED LED Long lead (anode) on right 1
�
4. Install 1/8” Phono JacksAfter mounting the jacks, a short wire must be connected from tab on jack to PCB hole to connect read and write circuits to the jacks. See the illustrations above for locations.
PART DESCRIPTION QUANTITY COMPLETE
Read and Write Jacks
The jack is mounted with the receptacle facing the front of the board (the same side as the components). Firmly tighten the nut, but not so tight that you risk damaging the PCB. Ground is through this connection. Use two short lengths of wire left over from cutting off resistor leads. They only need to be long enough to reach from the tab on jack to the hole in the PCB. Original ACIs had no insulation on these short lengths of wire. From the back of the board, solder one end to tab on jack and the other to the appropriate hole in the PCB. There are two tabs. Be sure to connect the wire to the tab that connects to the tip of the plug.
2
5. Recheck for Power and Ground Shorts on PCBEasiest way to do this is to use an ohm-meter to make sure that there is no direct connection between +5 volts, -�� volts and ground. With the resistors now soldered in, you should note about 9.�K ohms resistance between +5 volts and ground. -�� volts should have no connectivity with either +5 volts or ground.
7
6. Install ICsPART DESCRIPTION QUANTITY COMPLETE
LM311 8 Pin Socket at A-1. Pin 1 toward gold fingers 2
74LS74 14 Pin Socket at A-2. Pin 1 toward gold fingers.
PROM A-316 Pin Socket at A-3. Pin 1 toward gold fingers. Prom is printed with “APPLE A-3” on top of the package and has an A3 label on the bottom.
PROM A-416 Pin Socket at A-4. Pin 1 toward gold fingers. Prom is printed with “APPLE A-4” on top of the package and has an A4 label on the bottom.
74LS02 14 Pin Socket at A-5. Pin 1 toward gold fingers.
74LS10 14 Pin Socket at A-6. Pin 1 toward gold fingers.
7. Clean PCB of Rosin and By-products of SolderingOnce soldering is complete, clean the back of PCB of excess flux and rosin. 90% or higher isopropyl alcohol. IPA will dissolve soldering resin. Note that the IPA will also remove the APPLE-AX printing on the PROMs so keep it away from these parts. Spray it on the back of the board and lightly scrub with a very soft brush that will not scratch the surface of the PCB. Soak up the IPA and contaminates with a clean soft cloth before the IPA evaporates in order to remove the by products of soldering. I have also discovered that “Windex” window cleaner can help remove the by-products from the soldering job. Removing contaminates is important as many kinds of rosins are corrosive. Let dry overnight. Position a fan to blow over the board to make sure that all remaining moisture evaporates.
8. Check Board for Solder Bridges and Cold Solder JointsWhile the board is drying, you should carefully check your work for bad solder joints and solder bridges.
Chapter 3 – Installation, Operation and Help
1. Installation and OperationCompletely read and understand the original Apple Cassette Interface Manual reproduced in appendix C for installation and operation instructions.
2. Troubleshooting and HelpA good job of soldering the components into place should eliminate most if not all trouble. First step, in case of trouble, should be to check for bad solder joints or bridges.
Refer to my Apple II repair page at www.willegal.net for some general troubleshooting hints.
Feel free to send email to: [email protected] if you run into difficulties.
A-�
Appendix A - Using an iPod With the ACI
An iPod may be used in place of a cassette player with the ACI. Almost any iPod can be used for loading programs with the same cable that is used for reading from a cassette player. Programs must be put into AIFF format prior to loading. I have listed several programs already in that format on this web page:http://www.willegal.net/appleii/apple�-software.htmThis same page has the source code for a UNIX shell program that will convert programs in Apple monitor for-mat into AIFF files, so that you can convert your own programs to be loaded from a iPod.
Writing to the iPod requires an iPod that supports microphone input, a special cable and an iPad application that uses a lossless recording format. A detailed write up on the process can be found here.http://www.apple�notes.com/Home/Notes.html
Appendix B Replica 1 Notes
At the time of this printing, the ACI has not been tested with a Briel Computer Systems Replica �. Watch my blog at www.willegal.net/blog for updates on the results of this planned testing. I do not expect issues with this testing. If you do try it before I get the chance, remember that because the ACI requires -��volts, the Replica � must be powered by an ATX power supply.
The Achatz replica does not have a provision for -�� volts, so the ACI will not work with that system.
Appendix C - Apple’s Original ACI Manual
Appendix C is a digitized reproduction of the original eight page Apple Cassette Interface manual. Fonts and layout are similar to the original, but not exact reproductions. Disregard warranty, address, phone number information - this data is left in place, so the complete manual is preserved.
Unlike what the manual indicates, performance with various cassette recorders can vary from not functional to works pretty well. I use and recommend a Panasonic RQ-��0�. The best volume setting for read operations on my recent production Panasonic RQ-��0� is around a �.
The LED circuit is configured to turn on at about 1.2 volts, which I have found, is too high a level for reliable data recovery. Don’t rely on the LED to set your playback volume.
Finally, it is my opinion is that the reliability of the ACI is not as good as the manual suggests. In fact, with the stock .0�uF capacitor in place, I have experienced very unreliable operation. Operation improves substantially with the .�uF capacitor, which is why I have included it in the kit. This is not unique to reproductions, as I know of an owner of an original Apple � that had to resort to bridging the existing .0�uF cap with a .�uF cap before he could read files from an cassette player during his efforts to restore the unit to operation.
Except for these points, the manual contains accurate and useful information for installation and operation of the ACI and should be read and understood prior to installing and operating your ACI.
Appendix D – ACI Source Code Listing
Appendix D is the source code listing for the �5� byte PROM bank that exists on the ACI card.
C-�
APP
LE
-1C
ASS
ET
TE
INT
ER
FAC
E
C-�
C-�
INTR
OD
UC
TIO
NTh
e A
pple
Cas
sett
e In
terf
ace
[AC
I] i
s a
peri
pher
alde
vice
for
the
App
le C
ompu
ter
whi
ch e
nabl
es t
he u
ser
to s
tore
and
ret
riev
e in
form
atio
n (d
ata
and
prog
ram
s)us
ing
a st
anda
rd a
udio
gra
de c
asse
tte
reco
rder
. The
AC
Iat
tach
es d
irect
ly t
o th
e A
pple
Com
pute
r an
d ja
cks
are
prov
ided
on
the
AC
I bo
ard
to c
onne
ct t
o th
e ca
sset
tere
cord
er.
The
AC
I re
ads
and
writ
es d
ata
at t
he r
ate
ofap
prox
imat
ely
1500
bau
d (d
epen
ding
upo
n th
e da
ta),
All
the
AC
I tim
ing
is do
ne in
soft
war
e, r
esul
ting
in e
xtre
me
accu
racy
, no
ad
just
men
ts,
and
cons
isten
cy
betw
een
units
. TAPE
REC
OR
DER
S &
TA
PEA
lmos
t an
y ca
sset
te r
ecor
der
will
wor
k w
ell
with
the
AC
I. A
s a
reco
mm
enda
tion,
we
have
fou
nd t
he l
east
expe
nsiv
e (u
nder
$40
) Pa
naso
nic
to b
e ve
ry r
elia
ble
and
of g
ood
qual
ity, a
lthou
gh it
is n
ot e
quip
ped
with
a t
ape
coun
ter.
whi
ch is
use
ful (
thou
gh n
ot e
ssen
tial)
for
loca
t-in
g fil
es w
ithin
a t
ape.
(A
n al
tern
ativ
e m
etho
d of
dis-
cern
ing
files
is
to r
ecor
d a
voic
e id
entifi
catio
n be
twee
nfil
es.)
Am
ong
the
‘und
er $
25’ c
asse
tte
reco
rder
s th
ere
may
be
vari
atio
ns i
n he
ad a
lignm
ent
and
inte
rnal
ele
ctro
nics
,
resu
lting
in
the
inab
ility
to
accu
rate
ly r
ead
a ta
pe t
hat
has
been
rec
orde
d on
a d
iffer
ent
mac
hine
. H
owev
er,
ifth
e sa
me
unit
is us
ed f
or b
oth
reco
rdin
g an
d re
adin
g,ev
en
the
chea
pest
of
ca
sset
te
reco
rder
s w
ill
wor
kre
liabl
y.M
ost
tape
s av
aila
ble
in t
he $
2-$4
cat
egor
y w
ork
wel
lfo
r da
ta s
tora
ge. Y
ou m
ay e
xper
ienc
e an
occ
asio
nal t
ape
whi
ch ‘l
oses
bits
’ whi
ch is
cau
sed
by s
ever
e ox
ide
thic
k-ne
ss v
aria
tions
on
the
tape
and
can
not
be c
orre
cted
.Sp
ecia
l le
ader
less
tap
es n
eed
not
be u
sed
as t
he A
CI
auto
mat
ical
ly t
rans
mits
a t
en s
econ
d ‘h
eade
r’ of
all
ones
befo
re t
rans
mitt
ing
the
data
, w
hich
ins
ures
tha
t th
ele
ader
will
hav
e pas
sed. JU
MPE
RS
For
oper
atio
n of
the
AC
I, a
perm
anen
t jum
pcr
mus
t be
plac
ed b
etw
een
‘R’ a
nd ‘C
’ in
the
bloc
k se
lect
are
a of
the
mai
n bo
ard
(B9,
10).
This
jum
per
from
‘R’ w
hich
is c
on-
nect
cd to
enab
le th
e AC
I, to
‘C’ s
e1ec
ts th
e AC
I whe
n th
e12
th 4
K b
lock
(‘C
’) is
addr
esse
d.A
lso, f
or r
unni
ng A
pple
Bas
ic i
n th
e 2n
d 4K
ban
d of
on-b
oard
mem
ory,
it
is ne
cess
ary
to b
reak
the
sol
der
jum
per
betw
een
‘W’ a
nd ‘1
’ and
then
jum
per
‘W’ t
o ‘E
.’ Th
is m
oves
the
2nd
4K b
ank
from
the
‘1’ b
lock
to th
e ‘E
’bl
ock,
whi
ch is
whe
re A
pple
Bas
ic re
sides
.
C-�
INST
ALL
ATIO
NIn
stal
l the
AC
I bo
ard
into
the
con
nect
or o
n th
e m
ain
boar
d w
ith
the
com
pone
nts
on t
he A
CI
boar
d fa
cing
away
from
the m
ain
boar
d (t
he ja
cks t
o th
e edg
e of t
hem
ain
boar
d). S
EE F
IGU
RE
1. Th
e sy
stem
pow
er sh
ould
be O
FF w
hene
ver
inst
allin
g or
rem
ovin
g th
e A
CI
boar
d.In
stal
l cab
les
from
the
AC
I ja
ck m
arke
d “T
O T
APE
”to
the
reco
rder
mic
roph
one
inpu
t and
from
the
AC
I jac
km
arke
d “F
RO
M T
APE
” to
the r
ecor
der e
arph
one o
utpu
t.O
ne c
able
can
be
appr
opri
atel
y sw
itche
d be
twee
n th
etw
o pa
ths i
f nec
essa
ry.
USI
NG
TH
E A
CI
The
Cas
sett
e pr
ogra
m is
con
tain
ed in
tw
o PR
OM
S on
th
e A
CI
boar
d an
d ru
ns a
t C
100.
Whe
n en
tere
d, t
hepr
ogra
m s
houl
d ec
ho a
n “*
.” Th
e fo
rmat
for
spe
cify
ing
the
mem
ory
addr
ess
rang
es to
be
eith
er s
tore
d (w
rite)
or
depo
sited
into
(rea
d) is
iden
tical
to th
e st
anda
rd m
onito
rfo
rmat
: B
egin
ning
. E
nd ,
suffi
xed
with
eith
er a
‘W
’(w
rite)
or
an ‘R
’ (re
ad).
Exec
utio
n w
ill s
tart
fol
low
ing
aca
rria
ge r
etur
n (C
R).
The
cass
ette
pro
gram
will
ret
urn
cont
rol t
o th
e sy
stem
mon
itor u
pon
com
plet
ion
of a
read
or w
rite.
Ille
gal c
hara
cter
s (o
r th
e ab
senc
e of
cha
ract
ers)
in t
he a
ddre
ss l
ine
will
ret
urn
cont
rol
to t
he s
yste
mm
onito
r with
out e
xecu
tion,
follo
win
g a c
arri
age r
etur
n.
MU
LTIP
LE R
AN
GES
The
AC
I is
capa
ble
of r
eadi
ng a
nd w
ritin
g m
ultip
lead
dres
s ran
ges.
The
form
at is
: A.B
W C
.DW
(R fo
r rea
d).
Aga
in,
spac
es a
re i
gnor
ed.
The
AC
I w
ill w
rite
a t
ense
cond
hea
der,
the
first
ran
ge,
anot
her
head
er a
nd t
hese
cond
rang
e. 1
00.2
00W
300
.500
W w
ill w
rite
a h
eade
r,10
0 in
200
, a
seco
nd h
eade
r, an
d 30
0 to
500
. W
hen
read
ing
a m
ultip
le r
ange
tap
e. Y
OU
MU
ST U
SE T
HE
SAM
E A
DD
RES
S IN
CR
EMEN
TS
AS
WER
E U
SED
INW
RIT
ING
TH
E TA
PE. Th
is do
es n
ot m
ean
the
sam
eab
solu
te ad
dres
ses,
but r
athe
r the
sam
e inc
rem
ents
.
C-5The
proc
edur
e fo
r re
adin
g fr
om a
tape
into
mem
ory
is:
C10
0R (
RET
) Th
is en
ters
the
cas
sett
e pr
ogra
m a
nd
shou
ld ec
ho an
‘*’
E00
0 . E
FFFR
Th
is w
ill lo
ad t
he t
ape
data
into
mem
-
ory
loca
tions
E00
0.EF
FF .
‘R’ d
enot
es
a re
ad,
and
spac
es a
re i
gnor
ed.
[Don
’t
hit ‘
retu
rn’ y
et.)
Star
t the
Tap
eH
it ‘R
ETU
RN
’A c
arri
age
retu
rn w
ill s
tart
exe
cutio
n
of
a re
ad.
The
‘retu
rn’
can
be
hit
im
med
iate
ly,
how
ever
, it
mus
t be
hit
w
ithin
5 s
econ
ds a
fter
the
star
t of
tap
e
mot
ion.
Whe
n th
e la
st lo
catio
n (E
FFF
in th
is ex
ampl
e) h
as b
een
load
ed, t
he p
rogr
am w
ill p
rint a
‘/’ a
nd re
turn
con
trol
toth
e mon
itor.
The
proc
edur
e fo
r a
writ
e is
iden
tical
exc
ept
the
suffi
x’W
’ is
subs
titut
ed f
or ‘R
’ in
the
addr
ess
line.
For
bot
hre
ad a
nd w
rite,
the
tape
sho
uld
alw
ays
be m
ovin
g be
fore
hitt
ing
the R
ETU
RN
.
LEV
ELTh
e C
asse
tte
reco
rder
out
put
leve
l sh
ould
be
set
tow
here
the
LED
on
the
AC
I is
just
ful
ly li
t. In
crea
se t
hele
vel f
rom
zer
o un
til t
he L
ED g
low
s fu
lly. I
f yo
u ex
per-
ienc
e a
bad
read
, try
it a
LIT
TLE
hig
her.
The
LED
indi
-ca
tor
is op
erat
iona
l ev
en w
hen
the
cass
ette
pro
gram
is
not e
xecu
ting.
and
the
leve
l sho
uld
be se
t pri
or to
read
ing
a tap
e, N
OT
dur
ing
the r
eadi
ng o
f a ta
pe.
SPEE
DTh
e A
CI
uses
the
tech
niqu
e of
rec
ordi
ng a
who
le c
ycle
of e
ither
a 1
kHz
cycl
e (r
epre
sent
ing
a ‘o
ne’ d
ata
bit)
or
a2
kHz
cycl
e (r
epre
sent
ing
a ‘z
ero’
dat
a bi
t).
Ther
efor
e,w
ith a
n av
erag
e da
ta m
ix o
f on
e’s a
nd z
ero`
s, da
ta w
illbe
rec
orde
d at
150
0 ba
ud.
A t
en s
econ
d he
ader
of
all
ones
will
aut
omat
ical
ly b
e re
cord
ed o
n th
e ta
pe p
rior
to
mem
ory
data
. Th
is is
to i
nsur
e th
at t
he c
lear
lea
der
port
ion
of t
he t
ape
will
hav
e pa
ssed
. Se
e sc
hem
atic
for
furt
her d
etai
ls.
C-�
C-7
WA
RR
AN
TYA
pple
Com
pute
r C
ompa
ny h
ereb
y w
arra
nts
each
of
its p
rodu
cts,
and
all
com
pone
nts
ther
ein
cont
aine
d, t
o be
fre
e fr
omde
fect
s in
mat
eria
ls an
d/or
wor
kman
ship
for
a p
erio
d of
thi
rty
(30)
day
s fr
om d
ate
of p
urch
ase.
In
the
even
t of
the
occ
urre
nce
ofm
alfu
nctio
n, o
r ot
her
indi
catio
n of
fai
lure
att
ribu
tabl
e di
rect
ly t
o fa
ulty
wor
kman
ship
and
/or
mat
eria
l, th
en,
upon
ret
urn
of t
hepr
oduc
t to
the
App
le C
ompu
ter
Com
pany
at
770
Wel
ch R
oad,
Pal
o A
lto, C
alifo
rnia
943
04 (
post
age
prep
aid)
, the
App
le C
ompu
ter
Com
pany
will
, at
its
opt
ion,
rep
air
or r
epla
ce s
aid
prod
ucts
or
com
pone
nts
ther
eof,
to w
hate
ver
exte
nt A
pple
Com
pute
r C
ompa
nysh
all
deem
nec
essa
ry,
to r
esto
re s
aid
prod
uct
to p
rope
r op
erat
ing
cond
ition
. A
ll su
ch r
epai
rs o
r re
plac
emen
ts s
hall
he r
ende
red
by A
pple
Com
pute
r Com
pany
with
out c
harg
e to
the c
usto
mer
. Th
e re
spon
sibilt
y fo
r th
e fa
ilure
of
any
App
le C
ompu
ter
prod
uct,
or c
ompo
nent
the
reof
, w
hich
, at
the
disc
retio
n of
the
App
leC
ompu
ter
Com
pany
, s
hall
have
res
ulte
d ei
ther
dire
ctly
or
indi
rect
ly f
rom
acc
iden
t, ab
use,
or
misa
pplic
atio
n of
the
pro
duct
, sh
all
be a
ssum
ed b
y th
e cu
tom
er a
nd t
he A
pple
Com
pute
r C
ompa
ny s
hall
assu
me
no l
iabi
lity
as a
con
sequ
ence
of
such
eve
nts
unde
rth
e ter
ms o
f thi
s war
rant
y.W
hile
eve
ry e
ffort
, on
the
par
t of
App
le C
ompu
ter
Com
pany
, is
mad
e to
pro
vide
cle
ar a
nd a
ccur
ate
tech
nica
l in
stru
ctio
n on
the
use,
im
plem
enta
tion,
and
app
licat
ion
of i
ts p
rodu
cts,
the
App
le C
ompu
ter
Com
pany
sha
ll as
sum
e no
lia
bilit
y in
eve
nts
whi
char
ise f
rom
the
app
licat
ion
of s
uch
tech
nica
l in
stru
ctio
n, n
or s
hall
the
App
le C
ompu
ter
Com
pany
be
held
lia
ble
for
the
qual
ity,
inte
rcon
nect
ion,
or
appl
icat
ion
of p
erife
ral
prod
ucts
, w
hich
may
hav
e be
en r
ecom
men
ded
by A
pple
Com
pute
r C
ompa
ny,
but
whi
ch h
ave n
ot b
een
supp
lied
as p
art o
f the
pro
duct
.Th
is w
arra
nty
cont
ains
and
em
bodi
es t
he l
imits
of
resp
onsib
ility
of
the
App
le C
ompu
ter
Com
pany
with
reg
ard
to i
ts p
rodu
cts,
and
no o
ther
lia
bilit
y is
expr
esse
d, i
mpl
ied,
or
shou
ld b
e as
sum
ed b
y th
e pu
rcha
ser,
and
in n
o ev
ent
shal
l th
e A
pple
Com
pute
rC
ompa
ny b
e he
ld l
iabl
e fo
r th
e lo
ss o
f tim
e, e
ffort
, or
tra
nspo
rtat
ion
cost
s, no
r fo
r lo
ss o
f po
tent
ial
profi
ts o
r ot
her
cons
eque
ntia
llo
sses
whi
ch m
ight
ari
se f
rom
the
pur
chas
e, a
ssem
bly,
use
, ap
plic
atio
n, o
r su
bseq
uent
sal
e of
the
pro
duct
s of
App
le C
ompu
ter
Com
pany
, nor
from
any i
nstr
uctio
ns an
d/or
mec
hani
cal i
nfor
mat
ion
ther
eto
rela
ted.
C-8
APPLE C
OM
PUTER
CO
MPA
NY
770 Welch R
oad, Suite 154Palo A
lto, California 94304
Phone:(415) 326-4248
D-�
------- FILE wozaci.asm LEVEL � PASS � � c�00 PROCESSOR �50� � c�00 ???? LIST ON � c�00 ???? ;------------------------------------------------------------------------- � c�00 ???? ; 5 c�00 ???? ; The WOZ Apple Cassette Interface for the Apple � � c�00 ???? ; Written by Steve Wozniak somewhere around �97� 7 c�00 ???? ; 8 c�00 ???? ;------------------------------------------------------------------------- 9 c�00 ???? �0 c�00 ORG $C�00 �� c�00 �� c�00 ;------------------------------------------------------------------------- �� c�00 ; Memory declaration �� c�00 ;------------------------------------------------------------------------- �5 c�00 �� c�00 00 �� HEX�L EQU $�� ;End address of dump block �7 c�00 00 �5 HEX�H EQU $�5 �8 c�00 00 �� HEX�L EQU $�� ;Begin address of dump block �9 c�00 00 �7 HEX�H EQU $�7 �0 c�00 00 �8 SAVEINDEX EQU $�8 ;Save index in input buffer �� c�00 00 �9 LASTSTATE EQU $�9 ;Last input state �� c�00 �� c�00 0� 00 IN EQU $0�00 ;Input buffer 24 c100 c0 00 FLIP EQU $C000 ;Output flip-flop �5 c�00 c0 8� TAPEIN EQU $C08� ;Tape input �� c�00 d0 �0 KBD EQU $D0�0 ;PIA.A keyboard input �7 c�00 d0 �� KBDCR EQU $D0�� ;PIA.A keyboard control register �8 c�00 ff �a ESCAPE EQU $FF�A ;Escape back to monitor �9 c�00 ff ef ECHO EQU $FFEF ;Echo character to terminal �0 c�00 �� c�00 ;------------------------------------------------------------------------- �� c�00 ; Constants �� c�00 ;------------------------------------------------------------------------- �� c�00 �5 c�00 00 8d CR EQU $8D ;Carriage Return �� c�00 00 9b ESC EQU $9B ;ASCII ESC �7 c�00 �8 c�00 ;------------------------------------------------------------------------- �9 c�00 ; Let’s get started �0 c�00 ;------------------------------------------------------------------------- �� c�00 �� c�00 a9 aa WOZACI LDA #$AA ;Print the Tape prompt “*” �� c�0� �0 ef ff JSR ECHO �� c�05 a9 8d LDA #CR ;And drop the cursor one line �5 c�07 �0 ef ff JSR ECHO �� c�0a �7 c�0a a0 ff LDY #-� ;Reset the input buffer index �8 c�0c c8 NEXTCHAR INY �9 c�0d ad �� d0 KBDWAIT LDA KBDCR ;Wait for a key 50 c��0 �0 fb BPL KBDWAIT ;Still no key! 5� c��� 5� c��� ad �0 d0 LDA KBD ;Read key from keyboard 5� c��5 99 00 0� STA IN,Y ;Save it into buffer 5� c��8 �0 ef ff JSR ECHO ;And type it on the screen 55 c��b c9 9b CMP #ESC 5� c��d f0 e� BEQ WOZACI ;Start from scratch if ESC! 57 c��f c9 8d CMP #CR 58 c��� d0 e9 BNE NEXTCHAR ;Read keys until CR 59 c��� �0 c��� a� ff LDX #-� ;Initialize parse buffer pointer �� c��5
D-�
�� c��5 ;------------------------------------------------------------------------- 63 c125 ; Start parsing first or a new tape command �� c��5 ;------------------------------------------------------------------------- �5 c��5 �� c��5 a9 00 NEXTCMD LDA #0 ;Clear begin and end values �7 c��7 85 �� STA HEX�L �8 c��9 85 �5 STA HEX�H �9 c��b 85 �� STA HEX�L 70 c��d 85 �7 STA HEX�H 7� c��f 7� c��f e8 NEXTCHR INX ;Increment input pointer 7� c��0 bd 00 0� LDA IN,X ;Get next char from input line 7� c��� c9 d� CMP #$D� ;Read command? “R” 75 c��5 f0 5� BEQ READ ;Yes! 7� c��7 c9 d7 CMP #$D7 ;Write command? “W” 77 c��9 f0 �5 BEQ WRITE ;Yes! (note: CY=�) 78 c��b c9 ae CMP #$AE ;Separator?”.” 79 c��d f0 �7 BEQ SEP ;Yes! 80 c��f c9 8d CMP #CR ;End of line? 8� c��� f0 �0 BEQ GOESC ;Escape to monitor! We’re done 8� c��� c9 a0 CMP #$A0 ;Ignore spaces: ” “ 8� c��5 f0 e8 BEQ NEXTCHR 8� c��7 �9 b0 EOR #$B0 ;Map digits to 0-9 “0” 85 c��9 c9 0a CMP #9+� ;Is it a decimal digit? 8� c��b 90 0� BCC DIG ;Yes! 87 c��d �9 88 ADC #$88 ;Map letter “A”-”F” to $FA-$FF 88 c��f c9 fa CMP #$FA ;Hex letter? 89 c�5� 90 ad BCC WOZACI ;No! Character not hex! 90 c�5� 9� c�5� 0a DIG ASL ;Hex digit to MSD of A 9� c�5� 0a ASL 9� c�55 0a ASL 9� c�5� 0a ASL 95 c�57 9� c�57 a0 0� LDY #� ;Shift count 97 c�59 0a HEXSHIFT ASL ;Hex digit left, MSB to carry 98 c�5a �� �� ROL HEX�L ;Rotate into LSD 99 c�5c �� �5 ROL HEX�H ;Rotate into MSD �00 c�5e 88 DEY ;Done � shifts? �0� c�5f d0 f8 BNE HEXSHIFT ;No! Loop �0� c��� f0 cc BEQ NEXTCHR ;Handle next character �0� c��� �0� c��� ;------------------------------------------------------------------------- 105 c163 ; Return to monitor, prints \ first �0� c��� ;------------------------------------------------------------------------- �07 c��� �08 c��� �c �a ff GOESC JMP ESCAPE ;Escape back to monitor �09 c��� ��0 c��� ;------------------------------------------------------------------------- ��� c��� ; Separating . found. Copy HEX� to Hex�. Doesn’t clear HEX�!!! ��� c��� ;------------------------------------------------------------------------- ��� c��� ��� c��� a5 �� SEP LDA HEX�L ;Copy hex value � to hex value � ��5 c��8 85 �� STA HEX�L ��� c��a a5 �5 LDA HEX�H ��7 c��c 85 �7 STA HEX�H ��8 c��e b0 bf BCS NEXTCHR ;Always taken! ��9 c�70
D-�
��0 c�70 ;------------------------------------------------------------------------- ��� c�70 ; Write a block of memory to tape ��� c�70 ;------------------------------------------------------------------------- ��� c�70 ��� c�70 a9 �0 WRITE LDA #�� ;Write �0 second header ��5 c�7� �0 cc c� JSR WHEADER ��� c�75 ��7 c�75 88 WRNEXT DEY ;Compensate timing for extra work ��8 c�7� a� 00 LDX #0 ;Get next byte to write ��9 c�78 a� �� LDA (HEX�L,X) ��0 c�7a ��� c�7a a� �0 LDX #8*� ;Shift 8 bits (decremented twice) ��� c�7c 0a WBITLOOP ASL ;Shift MSB to carry ��� c�7d �0 db c� JSR WRITEBIT ;Write this bit ��� c�80 d0 fa BNE WBITLOOP ;Do all 8 bits! ��5 c�8� ��� c�8� �0 f� c� JSR INCADDR ;Increment address ��7 c�85 a0 �e LDY #�0 ;Compensate timer for extra work ��8 c�87 90 ec BCC WRNEXT ;Not done yet! Write next byte ��9 c�89 ��0 c�89 a� �8 RESTIDX LDX SAVEINDEX ;Restore index in input line ��� c�8b b0 98 BCS NEXTCMD ;Always taken! ��� c�8d ��� c�8d ;------------------------------------------------------------------------- ��� c�8d ; Read from tape ��5 c�8d ;------------------------------------------------------------------------- ��� c�8d ��7 c�8d �0 bc c� READ JSR FULLCYCLE ;Wait until full cycle is detected ��8 c�90 a9 �� LDA #�� ;Introduce some delay to allow ��9 c�9� �0 cc c� JSR WHEADER ; the tape speed to stabilize �50 c�95 �0 bc c� JSR FULLCYCLE ;Synchronize with full cycle �5� c�98 �5� c�98 a0 �f NOTSTART LDY #�� ;Try to detect the much shorter �5� c�9a �0 bf c� JSR CMPLEVEL ; start bit �5� c�9d b0 f9 BCS NOTSTART ;Start bit not detected yet! �55 c�9f �5� c�9f �0 bf c� JSR CMPLEVEL ;Wait for �nd phase of start bit �57 c�a� �58 c�a� a0 �a LDY #58 ;Set threshold value in middle �59 c�a� a� 08 RDBYTE LDX #8 ;Receiver 8 bits ��0 c�a� �8 RDBIT PHA ��� c�a7 �0 bc c� JSR FULLCYCLE ;Detect a full cycle ��� c�aa �8 PLA ��� c�ab �a ROL ;Roll new bit into result ��� c�ac a0 �9 LDY #57 ;Set threshold value in middle ��5 c�ae ca DEX ;Decrement bit counter ��� c�af d0 f5 BNE RDBIT ;Read next bit! ��7 c�b� 8� �� STA (HEX�L,X) ;Save new byte ��8 c�b� ��9 c�b� �0 f� c� JSR INCADDR ;Increment address �70 c�b� a0 �5 LDY #5� ;Compensate threshold with workload �7� c�b8 90 ea BCC RDBYTE ;Do next byte if not done yet! �7� c�ba b0 cd BCS RESTIDX ;Always taken! Restore parse index �7� c�bc �7� c�bc �0 bf c� FULLCYCLE JSR CMPLEVEL ;Wait for two level changes �75 c�bf 88 CMPLEVEL DEY ;Decrement time counter �7� c�c0 ad 8� c0 LDA TAPEIN ;Get Tape In data �77 c�c� c5 �9 CMP LASTSTATE ;Same as before? �78 c�c5 f0 f8 BEQ CMPLEVEL ;Yes! �79 c�c7 85 �9 STA LASTSTATE ;Save new data �80 c�c9 �8� c�c9 c0 80 CPY #��8 ;Compare threshold �8� c�cb �0 RTS �8� c�cc
D-�
�8� c�cc ;------------------------------------------------------------------------- �85 c�cc ; Write header to tape �8� c�cc ; �87 c�cc ; The header consists of an asymmetric cycle, starting with one phase of �88 c�cc ; approximately (��+�7)x5=5�5us, followed by a second phase of �89 c�cc ; approximately (��+�7)x5=�55us. �90 c�cc ; Total cycle duration is approximately �0�0us ~ �kHz. The actual �9� c�cc ; frequencywill be a bit lower because of the additional workload between �9� c�cc ; the twoloops. �9� c�cc ; The header ends with a short phase of (�0+�7)x5=�85us and a normal �9� c�cc ; phase of (��+�7)x5=�55us. This start bit must be detected by the read �95 c�cc ; routine to trigger the reading of the actual data. �9� c�cc ;------------------------------------------------------------------------- �97 c�cc �98 c�cc 8� �8 WHEADER STX SAVEINDEX ;Save index in input line �99 c�ce a0 �� HCOUNT LDY #�� ;Extra long delay �00 c�d0 �0 e0 c� JSR WDELAY ;CY is constantly �, writing a � �0� c�d� d0 f9 BNE HCOUNT ;Do this �� * �5� time! �0� c�d5 �9 fe ADC #-� ;Decrement A (CY=� all the time) �0� c�d7 b0 f5 BCS HCOUNT ;Not all done! 204 c1d9 a0 1e LDY #30 ;Write a final short bit (start) �05 c�db ; �0� c�db ;------------------------------------------------------------------------- �07 c�db ; Write a full bit cycle �08 c�db ; 209 c1db ; Upon entry Y contains a compensated value for the first phase of 0 ��0 c�db ; bit length. All subsequent loops don’t have to be time compensated. ��� c�db ;------------------------------------------------------------------------- ��� c�db ��� c�db �0 e0 c� WRITEBIT JSR WDELAY ;Do two equal phases ��� c�de a0 �c LDY #�� ;Load �50us counter - compensation ��5 c�e0 ��� c�e0 88 WDELAY DEY ;Delay �50us (one phase of �kHz) ��7 c�e� d0 fd BNE WDELAY ��8 c�e� 90 05 BCC WRITE� ;Write a ‘�’ (�kHz) ��9 c�e5 ��0 c�e5 a0 �f LDY #�7 ;Additional delay for ‘0’ (�kHz) ��� c�e7 88 WDELAY0 DEY ; (delay �50us) ��� c�e8 d0 fd BNE WDELAY0 ��� c�ea ��� c�ea bc 00 c0 WRITE� LDY FLIP,X ;Flip the output bit ��5 c�ed a0 �9 LDY #�� ;Reload �50us cntr (compensation) ��� c�ef ca DEX ;Decrement bit counter ��7 c�f0 �0 RTS ��8 c�f� ��9 c�f� ;------------------------------------------------------------------------- ��0 c�f� ; Increment current address and compare with last address ��� c�f� ;------------------------------------------------------------------------- ��� c�f� ��� c�f� a5 �� INCADDR LDA HEX�L ;Compare current address with ��� c�f� c5 �� CMP HEX�L ; end address ��5 c�f5 a5 �7 LDA HEX�H ��� c�f7 e5 �5 SBC HEX�H ��7 c�f9 e� �� INC HEX�L ;And increment current address ��8 c�fb d0 0� BNE NOCARRY ;No carry to MSB! ��9 c�fd e� �7 INC HEX�H ��0 c�ff �0 NOCARRY RTS ��� c�00 ��� c�00 ;------------------------------------------------------------------------- ��� c�00