Micro_Cornucopia_#49_Sep89 Micro Cornucopia #49 Sep89

Micro_Cornucopia_#49_Sep89 Micro_Cornucopia_%2349_Sep89

User Manual: Micro_Cornucopia_#49_Sep89

Open the PDF directly: View PDF PDF.
Page Count: 100

DownloadMicro_Cornucopia_#49_Sep89 Micro Cornucopia #49 Sep89
Open PDF In BrowserView PDF
No. 49

September-October 1989

THE

$3.95

TECHNICAL

M

JOURNAL
r

ORNUCOPIA
liD, liD,
It's Off To
Work We· Go
Want to know where the hackers are?
They're busy automating industrial
processes. It's easy. Very easy.

Building A Controller
The Easy Way

page 8

Motorola's 6805 contains everything you
heed for I/O control - except the A / D
convertor.

Programmable Logic
Controllers

page 23

Driving Steppers

page 28

Low Cost 110
For The PC

page 42

Bruce looks at off-the-shelf I/O boards.

And More

• • •

PostScripta1.S

page 16

How Larry produced this cover.

Writing TSR Programs
Interfacing 16-Bit Devices
Much, Much, More ...

09

a

7447019388

3

page 33
page 83

I

(lw

I

LIMITED OFFER

~rndill~
0

0

dill

0

Q

cmE
mB0@
udJ UD dJcnm LD

Twelve function
Erasable template
keys for increased
automatic
to label )flUr function
operation.
key assignments.
Switch allows
itJsitive
)flU to swap
tactileposition of Ctrl
feedback,
and Caps Lock.
"click" keys.

Q

rJ Separate numeric keypad that switches to
a multifunction business calculator
with tilt-up LCD display. Includes memory,
square root and percent keys.
Solar panel
Keyboard and
to power the
cakulator status
cakulatorindicator lights.
even when
the computeris
turned

Switch-selectable
for all IBM XT,
AT, PSI2 and
compatible
systems.

off!

$149:5 buys you both

charge your spreadsheet and typing
board would be an inspired idea at
send them back within 30 days and
this price even if you didn't get
performance.
we'll cheerfully refund your $149.95.
Like our famous tactile, positiveQuattro in the bargain.
No questions asked.
After all, as InfoWor/d says, "if you
response keys that give
How, you ask, can you take advanhaven't looked at Datadesk's keyyou a much better feel for
tage of this remarkable offer? Just fill
boards, you ought to~'
the road. So you can type
out the coupon and send it in.
According to the Washington Post,
faster with fewer mistakes
Better yet, call us toll-free.
'p,
"for ingenuity of design and sheer
than ever before.
And tell us to step on it.
dollar value, Datadesk can't be beae'
And the new, enhanced
And when it comes to your peace
For just $149.95-less
ffiM"lOl-key layout with
..•..
. ".' i
than Quattro's street
of mind, nothing beats our two-year
some logical improve.~
price, and a lot less
ments-including separate
warranty.
than its $247.50 sugWhat's more, if Quattro and Turbonumeric and cursor keys
gested retail price, you
Calc-ill don't blow the doors off the
that let you cruise through
can now get both BorAll individual trademarks and copyrights are acknowledged.
spreadsheet data entry
vehicles you're currently drlvillg,just
land's best-seller and
"fe",:;,!!}""";,.;""";",:,'!':!!,:"""""",,,,
without ever having to
-l ,;}§t~ Jr,:
the keyboard you need
"MlJre than 1-2-3" at
shift Num Lock.
to drive it at top speed.
less than half the cost"
'<,
Get better mileage
Bundle includes Datadesk's ThrboCalc-111
Namely, the TurboThats what PC M@azine
';
from your desktop.
Keyboard/Calculator for mw and compatibles and
Ca1c-llr Keyboard!
says about Quattro," the
In case you haven't noticed ,.'
Borland's Quattro sllreadsheet. Add $10 s~ing and handling
Calculator from
lwt-seiling spreadsheet
per
urut
(Continental
U.S.
only). CA reSidents please add $9.75 es tax per unit.
already, the keypad
Datadesk.
from B!YrlaruJ. Imagine
doubles as a full-function
Amount Enclosed:
# of Units:
Boost your
what theyU say about
business calculator comDisk Size: D3W' o 5lA"
Com~uter Type*:
overall perfonnance.
this e:cf:r,deam;,dinary
*1£ p 12, include additional $5 for cable adapter.
plete with its own pop-up
Me
Payment: 0 VISA DMC o AMEX 0 CHECK
With its built-in,
au
LCD display. Which saves
Exp.Date:
Card No:
presentation-quality graphics, intellispace on your desktop and lets you
gent recalcs, unlimited macros, easy
perform any calculation with a single
Na_
installation and compatibility with
keystroke-no matter what software
leading spreadsheet and database
you're driving.
Company Name
software, Quattro is made to order
What's more, the keypad packs a .......
Daytime Teleplume
Addms
for your business.
solar panel, so you can start up the "\
And ThrboCalc-ill is made to
calculator even when your computer. :,
State
Zip
City
order for Quattro. Or for any other
is idle.
Mail to: Datadesk, 7651 Haskell Ave., Van Nuys, CA 91406. FAX: (818) 780·7307
••';:
software you like to drive.
We wouldn't steer
Or Call: (800) 826-5398. In CA, Call: (800) 592-9602
Because, as you can see, it's loaded
you wrong.
......
t.=
I
with features d~signed to turboFrankly, getting into a Datadesk key-\ 'II}@AW~~r~,~'l~'
1_'::
'
._....::
curses libraries. The communica,~; .",_~:..J >~I! ,~~, tions library supports XMODEM,
0 ANTSl
YMODEM, KERMIT and ASCII
Pcrfonnancc
1-)'br'lfl'cs"
. (',
protoco1s. Th e graph'ICS l'b
I rary
provides a graphic windowing
model. Curses provides a UNIX
compatible screen manager.
S OW I •
Lattice is the library leader.
II.

_.,

II

II

'I

The Leader in Compatibility
Lattice C is fully comwliant with
the ANSI standard. e pass not
only the Computer Language ANSI
Test Suite but 100% of the
Plum Hall Test Suite Version 1.09.
Lattice is the compatibility leader.

1 ... __

And the benchmarks
h et

The Leader in Debugging

The Leader in OS/2

The Leader in Convenience

Lattice C includes CodePRobe™, a
new full-screen symbolic debugger
for DOS and OS/2. CodePRobe fias
the familiar look of the CodeView,
and can be used with a mouse. It also
enables you to easily debug family
mode prosrams, Presentation Manager applIcations, and OS/2 multithreao applications. And, for those
humongous programs and system
killer bugs, CodePRobe can be used
remotely from a different PC. Lattice
is the leader in debugging.

Lattice C includes bindings and
header files so that you do not need
to buy an expensive OS/2 development kit. Tne library also supports
multithread programming with no
built-in limits to the number of
threads. The Lattice linker, librarian,
editor, debugger and utilities run in
DOS, OS/2 and family mode. Lattice
is the OS/2 leader.

Lattice C uses an automated installation procedure that has been praised
by reviewers.Thecompiler automatically configures itself so that you do
not need to specify complicated
options. Yet, a full set of options is
available to the professional who
needs to customize to a particular
environment. Lattice is tlie convenience leader.

The Leader in Productivity

The Leader in Documentation

The Lattice C Development System
now includes the utilities that
our customers-professional C programmers-use most often. Of course,
the system is based upon our C compiler, editor, linker, librarian, and debugger. In addition, we now include
our powerful project maintenance

LatticeC includes over 1500 pages of
high quality documentation in ring
binders. It contains all the information that professional programmers
need in a tboroughly ina.exed format.
Lattice is the documentation leader.

The Leader in Innovation

Lattice has long supported popular
language extensions such as near, far,
and pascal. In our previous version,
we Introduced align, chip, volatile,
interrupt, nopad, and pad to handle
imEortant memory management
Eroblemsin DOS, OS/2,and embedoed systems. Version 6 continues
this evolution with critical and
private. Critical defines a function
~~<>
that must run as a critical section,
O~<>
andprivatedefinesdatathatmustbe
0
replIcated for each execution thread.
Future versions will continue to
~
improve the language for use in
cutting-edge environments such as Professional Programming Tools Since 1981
OS/2 and AmigaDOS. Lattice is the 2500 S. Highland Avenue, Lombard,IL 60148
innovation leader.

La1t;,ce

~

The Leader in Support
Best of all, Lattice support comes free
with Lattice C. Lattice's bulletin
board and telephone support are the
best in the business. Lattice is the
support leader.

30 Day Money Back Guarantee
Lattice C 6.0 is available for $250. To
order, send check or money order to:
Lattice, Inc., 2500 S. Highland Avenue, Suite 300, Lombard, IL 60148.
Or order by credit card at (800) 4444309. FAX # (312) 916-1190, TELEX
532253.

*Send to Lattice for a free complete report on the benchmark analysis.
Reader Service Number 153

MICRO CORNUCOPIA, #49, Sept-Oct 1989

5

Letters
Large Video Characters
Regarding large characters for those
with vision impairments: a big monitor
would be ideal, of course. On my
Zenith lap-top, and probably most
CGA-compatible machines, "MOPE
BW40" or "MODE C040" makes the
characters double width. Not double
height, but considerably bigger.
This works for all DOS commands
(more or less) and probably some application programs, older ones more likely.
A modern text editor which seems to
work acceptably in this mode (scrolls
the line horizontally and so forth) is my
copy of the estimable QEdit. I think it's
still available as shareware.

J. G. Owen
21 Glenview Ave.
Fort Salonga, NY 11768
Talking Amigas
Issue #48 was very interesting (as
usual). I have a comment on Debee
Norling's article, "Selecting a Talking
Computer for a Blind Friend."
Although the IBM PC family is the
business computer family, I was surprised to see no (zero, nada) references
to the Amiga computer. Every Amiga
can talk, right out of the box-no
special hardware or software required.
At a command line prompt, just typesay {string to speak}

The general purpose text-to-speech algorithm seems pretty good, at least to
me. If it isn't, you can send it phonemes
instead. This speech capability is also
available as a system level device, just
like a printer or a serial port. You control the volume, speed, voice type
(male, female, robotic), pitch/frequency,
and rate.
Some Amiga applications take
advantage of this ability to talk. If these
do not meet your needs, there are a
number of programmable text editors

6

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Kurt Wessels
917 N. 87th
Seattle, WA 98103
Letters From The Editor
Debee's articles in Issue #48
generated lots of interest. One thing we
didn't tell you: the products mentioned
are available through Debee and
Christy at their company, Grassroots
Computing. Obviously, they can support the products from the perspective
of experienced users. Or you can contact the manufacturers directly.

and applications that might work.
The widespread adoption of the
ARexx language, with its interprocess
communications ports, also facilitates
linking applications together in novel
ways. At a programmer's level, it's relatively simple to insert a task into the
chain of event handlers (e.g., to speak
keystrokes, including ctrl/ alt/ shift) and
to access the speech libraries from
within a program. The Amiga's true
multitasking and ability to play high
quality sampled sounds without any
extra hardware are bonuses.
The Amiga has capabilities for the
sight-impaired as well. It has become
the standard computer for "Desktop
Video." Its standard NTSC (or PAL)
output and low-cost GenLoc options
mean it can interface to a wide variety
of video equipment. Its standard analog
RGB output will drive the newer large
analog monitors (or TV/monitors).
The bit-mapped display and system
fonts mean you can select larger fonts
for many applications. There's even a
little public domain "magnifying glass"
tool that lets you enlarge any portion of
the screen.
In conclusion, the Amiga is a very
capable machine and certainly in the
running as a blind or disabled person's
"window to the world."

DECtalk-Digital Equipment Corp.
Contact: Bill Metcalf
2525 Augustine Dr.
Santa Clara, CA 95054
(415) 651-5474
Echo PC-Street Electronics Corp.
Contact: Mark Pfeffer
6420 Via Real
Carpinteria, CA 93013
(805) 684-4593
Video Voice-Grassroots Computing
P.O. Box 460
Berkeley, CA 94701
(415) 644-1855
BBS Phone # Correction
In the list of alternative BBSes for
downloading Micro C's issue listings,
published last issue, we embedded an
incorrect phone number for the Generation 5 BBS in Washington, D.C. The correct number isGeneration 5 BBS
(301) 495-2932
This is a subscription board, but you
don't have to be a subscriber to
download Micro C code.
Good Magazine, But. ...
I've really appreciated your magazine for the past few years. You have
Continued on page 75

Introducing .••

The 1st Family of
Low Cost, Powerful
Text Editors
$ 29
VEDIT Jr.
VEDIT
$ 69
VEDIT PLUS $185
Finally, you can choose the best editor for your needs without
compromising performance or paying too much. And organizations that want the "same" editor for everyone can pick VEDIT®
for most users a"nd VEDIT PLUS for their power users.
The new family of VEDIT text editors are upwards compatible,
easy to use and offer exceptional performance, flexibility and
stunning speed. (3 to 30 times faster than the competition on
large files where speed really counts.)
Call for your free evaluation copy today. See why VEDIT has
been the #1 choice of programmers, writers and engineers
since 1980.

VEDIT Jr.- Unmatched performance for only $29.
All VEDIT editors include a pull-down menu system with "hot
keys:' context sensitive on-line help, pop-up status and ASCII
table, a configurable keyboard layout and flexible, unlimited
keystroke macros. Edit files of any size and any line length.
Perform block operations bycharacter, line, fileorcolumn. Undo
up to 1000 keystrokes- keystroke by keystroke, line by line, or
deletion by deletion. Automatic indent, block indent and parentheses matching speed program development. Word wrap,
paragraph formatting, justification, centering, adjustable margins and printing for word processing. Run DOS programs.
VEDIT-A best value atonly $69.
Simultaneously edit up to 36 files and split the screen into windows. Search/replace with regular expressions. Includes the
best compiler support available- menu driven, easy selection
of compiler options, supports "Include" files and MAKE utilities.
VEDIT PLUS-Ultimate programmer's tool for only $185.
VEDIT PLUS adds the most powerful macro programming
language of any editor. It eliminates repetitive editing tasks and
permits creating your own editing functions. The macro
language includes testing, branching, looping, user prompts,
keyboard input, string and numeric variables and control over
the size, pOSition and color of windows. Source level macro
debugging with breakpoints and tracing. Macros developed
with VEDIT PLUS also run under VEDIT.
30 day money-back guarantee. Call for pricing of XENIX, OS/2
and FlexOS versions. Very attractive quantity pricing is available for schools, hardware and software vendors.

FREE Evaluation Copy*
Call1·800·45·VEDIT
Compare Features and Speed
Pull-Down menus
Pop-Up ASCII table
Keystroke macros
Regular Expressions
"Cut and Paste" buffers
Text (book) markers
Undo keystroke by keystroke
Undo line by line
Normal/max Undo levels
Variable tab positions
Configurable keyboard
Integrated mouse support
FILE LIMITS
Edit files larger memory
Maximum line length
Maximum lines/file
COMPILER SUPPORT
Menu driven
Select Compiler options
Support "Include" files
BENCHMARKS 5DK FILE
Simple search
Save and continue
1000 replacements
BENCHMARKS 3 MEG FILE
Simple search
Save and continue
60,000 replacements
Block-column copy (40 x 200)
Insert 1 Meg file in
middle of 1 Meg file
PRICE

Difficult
65,535
>65,535
None

No
Difficult
No

-

No
512
20,000
None

0.2 sec
1 sec
3 sec

1 sec
2 sec
19 sec

1 sec
2 sec
17 sec

0.3 sec
1 sec
2.5 sec

1:40 min
1:05 min
3:18 min
2 sec

1:36 min
3:23 min
1:44 hour
30 sec

Cannot
Cannot
Cannot
Cannot

Cannot
Cannot
Cannot
2 sec

1:11 min
$69

15:13 min
$195

Cannot
$75

Cannot
$54.95

Yes
>8096
8,388,607

Yes
512
65,535

Yes
Menu
Yes

-

CompuView

VEDIT and CompuView are registered trademarks of CompuView Products, Inc. BRIEF is a
trademark of UnderWare, Inc. Norton Editor is a trademark of Peter Norton Computing Inc. OEdit
is a trademark of SemWare.
"Supports IBM PC, XT, AT, PS/2 and clones with CGA, MGA, EGA, VGA, Wyse 700, Amdek 1280
and other displays. Also supports Concurrent DOS, DESOview, Microsoft Windows,
PC-MOS/38G and most networks.
"Also available for MS-DOS (CRT terminals), TI Professional and others.
"Free evaluation disk is fully functional and can edit small files.
Reader Service

BRIEF 2.10 Norton 1.3 QEdit 2.07
VEDIT
No
Yes
Yes
No
No
Yes
No
No
1
No
100+
100+
No
Yes
Yes
No
100
1
36
1
No
No
10
10
No
No
Yes
Yes
No
No
Yes
No
500/1000
30/300
No
Yes
Yes
No
Difficult
Yes
Yes
No
Yes
Yes
No
No

Number 7

1955 Pauline Blvd., Ann Arbor, MI 48103
(313) 996-1299, Fax (313) 996-1308
MICRO CORNUCOPIA, #49, Sept-Oct 1989

7

8 MICRO CORNUCOPIA, #49, Sept-Oct 1989
-------

-----------------

By Karl Lunt
4730 W. Menadota Dr.
Glendale, AZ 85308
(602) 869-6146 (work)
(602) 582-5863 (home)

Not satisfied with undocumented 68000
systems, Karl switches to a very well documented, very low power, low chip count
controller. Sounds like Motorola has a real
winner.

•
"

:.!

~6~'fl

~

.~

.
'

'.£(1:(
(.ffC'fli

..• .• .• .• .• .• .• .• .•
.f'(C

..

The Chip's Hardware
The 'HC705 MCU is the latest addition to Motorola's line of 6805 micro-controllers. Being CMOS, it typically draws
about 4.7 rnA at 5.0 volts, making it ideal
for low-power (e.g., remote) projects. The
on-board 7.7K EPROM and 176 bytes of
RAM provide room for surprisingly
powerful programs. Since each of the 24
bidirectional I/O pins can drain up to 25
rnA, the 'HC705 interfaces directly to
LEDs, beepers, LCD displays, and other
low-current devices.
You can run this chip with an external
crystal of up to 4.2 MHz (Vdd = 5.0 volts);
the internal bus runs at half the crystal
frequency. I/O and option registers
(special-purpose addresses) give you
CPU's
software control
of
the
RAM/EPROM layout, I/O ports,
counter / timer, and communication systems.

...... ..

~(I(C('C

II

T

•••• ••

~

fl(Clte'
I)

he Motorola 68HC705 micro-controller unit (MCU) contains
enough EPROM, RAM, and I/O
power to solve many controller problems. Use it with the Motorola
68HC05PGMR development board to
build single-chip projects such as burglar alarms, robotics sensors, data acquisition units ... just about anything you
can dream up.
Take a look at the example design,
complete with assembly language source
code. The project provides 11 channels of
A/D, maintains an internal time-of-day
clock, controls three LEDs, consumes just
30 rnA from a battery supply, and uses
only two ICs!

e. • • • • • • • • • e • • • • • • • • • • •

C

~

•
•

·
•
•
•
•

(

••

f

•
•••••••••

"

Proto Board for Example Project-Small, Right?
The on-board Serial Communication
Interface (SCI) handles asynchronous serial I/O, though you must provide your
own RS-232 level shifting (+12 V to -12
V). You control baud rate and port setup
through I/O registers. A Serial Peripheral
Interface (SPI) adds high-speed synchronous I/O, up to 1.05 Mbit/sec.
You can use the internal 16-bit
counter / timer system as part of a realtime clock, frequency counter, or
waveform generator. You can select from
a wide variety of interrupts on the
counter / timer.
For those really critical functions, the
chip contains a Computer Operating
Properly (COP) timer. When enabled,
this feature will force a reset should your
program fail to periodically refresh the
COP register. Additionally, the chip can
provide a reset if the system clock falls
below 200 KHz.
The 'HC705 also offers two ~dditional
low-power modes (as if 4.7 rnA isn't low
enough!). WAIT suspends CPU operation

but keeps the timer, SCI and SPI running.
Any of these three systems can bring the
CPU back to full RUN mode.
WAIT consumes about 1.7 rnA; the
STOP mode typically uses only 2.8 JlA
(no, that's not a typo). STOP shuts down
all internal processing; only an external
interrupt or reset can bring the CPU back
to life.
The on-chip EPROM erases with a
standard shortwave UV lamp. If you
bum your program into the MCU and
find it doesn't work, just erase the MCU,
change the software and try again.
When it comes time to ship your final
product, Motorola also offers the MCU as
a one-time programmable device (OTPROM). This plastic package does not
have a UV erasing window-once
you've programmed it, you've programmed it.
Inside The Programming Model
At first glance, the 'HC705 programming model seemed like a cruel joke. The
MICRO CORNUCOPIA, #49, Sept-Oct 1989

9

Figure l-PGMR Board Schematic Diagram.

-=~

~

~'S~
'+I2V

'-12V

12

-}

1:5 , ~

~

1

;~ RXD

J

111 9
../I

,
,

(OpnOHAl)
'oR!

,,
I
I

rl=E

R2

..

R!I

U2
46-PIN
DIP

C4

22I:F

SOQ(ET

)

-12V

c~

!

mET~
1RlJ2

ml

;i
20

@]

Rl
11K

[§J

cr

~
+5V

~

'RESET'

~~3

j--+4I
PD7

2

+~V

R11

_'II<

t ~
@J

@}f ffi]f f ffilr ...

~----+-----~~~~

PCII

POl ~----------~--~--_+--~~------------~_+--~+_r_--------r_+__b~----------------~~~++~
:""

~----+-----~~~~
------+-----~~~32

~

'1 r,,-,

PB3 I
PB4 i

•

":1

5 PAS

F-____...:.PC5.:::-"I

1=-----...:.~:::;3:;JJ

(All)

r,w

I

:1It:
113

(021

"'I

r~

D4~~~

~:~

"'I

~~

(0&)

"'I

r..u

I

~~

PAZ I

~_ _..;.;PD1;;..;......,.

PAl

~.
'-"8

14 PS2

PM ; ..
PAIi I

17 PS5
18 PSII

P"7

l!!.__~LI-~:...::..:..
__---,II· PB7
C07l
't
"'I

PAS ,
I '

I

D711t

-p

III

: ' II

E-_ _PD2~.J

D~f1S
(OJ)
15 PB3
;~~..1E~+-'4i"'lr.=---;,iA1,
PB4

::,8

15
1&
17
18

PBS'
PBII I
PB7 i

'I r~'
4 PA7
'r
"'I
D.ft1
(Ill)
12 PSI
,t:L!1-~!L+-~-=::---;'~3
PHI
112
(D1)

~:f3 (A7)

12

~I :

;~~~L....~.l~'~---~'PA5

Alil4
)1"':'

• CENtnES CPl10NAL

• ,38

~35

:;

-:-:

liIlm.

~;w

11K

31
P04
POl 32

~(~

OND

H
~3e

PCI

'1 PAl
PAl
AI 0 -:-~~"",,,,,,,,;:,=----:;,'ilO
(AI)
,., 8
(A2)
PAZ
"2 17
(Al)
;~~~~~~_____~8 PAl
AJ III
(A4)
7PM
A4rs-- (Ali)

~tlE

P2

~

~{

+~V

UI
2764

+5V

.,.
I

•

TCMP~
po~ 34-

D.2!,

YI..LCl
211Hz
22pF

m

RQ

+SV

J2

TCAP,:n

~

DI~
J
J

11K

.II

Vpp

_

14- - .

RI
2.7K

1+C1
~lnl""

OSC2

01
tl48et

~+5V
PI

U4

,,

111<

CONvtRlER

l,

L..........I

MCI464I11

l'

r--,, NI,IAO~1Z~
oc-oc
I
I

+12V

+5V

I

~5

[§J

~

~28
~27
PC2 I

PC7.n.--

v.

1

_211

3

~25
~24

T COMMAND ONLY

I

PD1 I

.• 311

,

~20

~

I..:

(ER;Qn)

~I

pee

!::

~21

~211

0'\
00

~

~

~
Q)

(J)

0\
~
}

"<" and ">" tell the interpreter that it's
dealing with hex values. I used this
method at first and it worked fine until I
got into larger images. It turns out that a
hexadecimal string cannot exceed 64K.
This wasn't obvious to me, so I went
whining to Adobe's developer's hotline
and had the answer in seconds. Good
outfit.
Generating The Hex Data
I won't bore you with the specifics of
the Mandelbrot code again; it's been
covered in Micro C before (issues #39 and
#42). Log onto our BB5 or get the issue
disk for a look at the complete program.
Figure 2, a mixture of pseudo-code
and C, shows the steps necessary to fill a
byte with 8 points of the image, and print
the byte to a file. fprintfO conveniently

•• This small, blazing-fast editor
lets program instructions, memos,
letters, and assorted text databases flow easily between brain
and computer. ~ ~

•• The editor's speed, windows,
and other features make it among
the best text editors I've ever
used. ~ ~
George F. Goley IV,

David M. Kalman,
Editor-in-Chief, Data Based
Advisor (September, 1988)

Contributing Editor, Data Based
Advisor (September, 1988)

• QEdit supports 101 key keyboards, EGA 43-line mode, and
VGA 50-line mode
• Great for use with laptopsQEdit edits files entirely in memory,
saving drain on laptop batteries
• Compact-Even with all these
features, QEdit requires less than
sOk of disk space

Full 30 day
money-back guarantee
System Requirements _ _ _ __
QEdit requires on IBM PS/2, PC/AT, PC/XT,
PC, PC/Jr, or compatible. Minimum system
requirements are 64 KB of memory, PC-DOS
2.0 or MS-DOS 2.0 or greater, 50 KB of disk
space. QEdit runs GREAT on floppy based
systems and laptops.

"I

To order direct call , ;

404·428·64161

fIii!Pl·. •Cards)'.l
.. . ~ II!!iiiiiIIl
'

.

eR''''''.

~

"

""Rm

;

.

.

:",~

; Add $3.00 for shipping~$10.qO.J
for overseaS .shipping. UPS 2nd J
~. DAY AIR available.withhi

j

. the U.S. for ONLY $5.00 'I
, COD's ~ccepted-please~dq $3.00' i

rGeorgia residents odd~o/~~~!:~.t?~J
SEMWARE™
730 Elk Cove Ct. • Kennesaw,GA 30144
QEdit and SemWare are trademarks of
Applied Systems Technologies, Inc.
© 1989 Applied Systems Technologies, Inc.

Reader Service Number 127

MICRO CORNUCOPIA, #49, Sept-Oct 1989

19

translates buffer into its ASCII hexadecimal equivalent. But watch out for single
digit hex numbers; PostScript's image
operator demands two digits for each
hex byte. So any number less than OxlO
gets a leading zero.
Color Printing
" ... under suitable conditions, full
color can be represented as three color
separations each defined by a gray-scale
image. Such image processing is beyond
the scope of this manual." (From p. 72 of
the Postscript Language Reference Manual.)
I just love it when they talk like that.
It's a challenge, a gauntlet thrown. We've
done monochrome, but color's a must for
the cover.
We print Micro C on a four-color
press: yellow, magenta, cyan, and black.
By laying down different amounts of
each of the four colors, we can build a
staggering number of new colors. But we
can't do any color. Complications arise
due to factors like the color printing
order, and the discrete, rather than continuous, values for color intensities. Sixcolor presses exist that can print the normal four-color options we have, plus two
custom mixed colors. But that's another
story.
If you look at a printed page closely
(use a magnifying glass), you'll see that it
contains an array of dots, just like a video
image. A square inch of image always
has the same number of dots. But if each
of those dots increases in size, the square
inch becomes darker.
The array defining the dot locations is
called a screen. A 0% screen has dots of
zero size and gives a totally light (blank)
image. The dots of a 100% screen are full
size and give the darkest image. Screens
between these extremes produce shades
of color. To build a new color, we just
specify a percentage for each of the four
press colors.
Creating Halftone Images
Typesetters and laser printers print
dots, that's all. On or off. And they print
one size dot only. (Not quite true. The
L300 has two modes: single density at
1270 dpi, and double density at 2540 dpi.
But within each mode only. one size dot
exists.) In order to simulate shades of
grey, PostScript uses halftone cells. Each
of these cells contains some number of
output device dots. By varying the number of dots printed within a cell, we can
vary the darkness of the cell.
Earlier, I mentioned discrete levels of
color; we could call this part the quan-

20

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Figure 3-Generation of Four-color Separation for PostScriptal
void mandel(), file header (), file tailer (),
drawyoints () -:- get_layers ():FILE *fpl, *fp2, *fp3, *fp4;
main()
{

fpl
fopen ("fracl.ps", "w"):
1* open yellow layer file
fp2 = fopen ("frac2 .ps", "w"):
1* open magenta layer file
fp3 = fopen ("frac3 .ps", "w"):
1* open cyan layer file
fp4 = fopen ("frac4 .ps", "w"):
1* open black layer file
file header (fpl): file header (fp2):
1* defs and procedures
file-header (fp3): file-header (fp4);
mandel ():
1* ge~erate hex data defining Mandelbrot image
file_tailer (fpl): file tailer (fp2): 1* finish main part of ...
file tailer (fp3); file-tailer (fp4): 1* .. . PostScript programs
fClose (fp1): fclose (fp2);
1* close files
fclose (fp3): fclose (fp4):
1* main *1

*1
*1
*1
*1
*1
*1
*1
*1
*1

void mandel ()
{

int column, iterations:
int point1, point2:
for (each point in the 750x1200 image)
{

find iterations (Mandelbrot code provides this)
if «column % 2)
0) 1* this is the first of a pair of points
point1
iter:
else
1* this is the second of the pair

==

*1
*1

{

pOint2 = iter;
drawyoints (point1, point2);

1* draw the pair *1

}

1* mandel *1
void drawyoints (pt1, pt2)
int pt1, pt2;
{

unsigned char color:
unsigned char yellow, magenta, cyan, black:
unsigned char y_temp, m_temp, c_temp, b_temp:

=

yellow = magenta
cyan = black = 0:
y temp = m temp = c temp = b temp = 0;
if (pt1 ==-maximum iterations)
1* it's in the Mandelbrot set
{ 1* these color assignments draw the point in a deep black color
magenta = Ox90:1* assignments made to high order nybble for pt1
cyan = Ox30:
black = OxfO;
else

*1
*1
*1

1* point not in Mandelbrot set *1

{

get color (from 0-81)
1* according to number of iterations
get layers (color, &y temp, &m temp, &c temp, &b temp);
yellow = y temp « 4:-1* shift-assignme~ts to high order nybble
magenta = in_temp « 4;
cyan = c_temp « 4;
black = b_temp « 4:
y temp = m temp = c temp = b temp = 0;
if (pt2 ==-maximum it~rations)
1* it's in the Mandelbrot set
{ 1* make it black
magenta += Ox09;
1* pt2 goes in the low order nybble
cyan += Ox03:
black += OxOf:
else

*1
*1

*1
*1
*1

1* not in the set *1

{

get color (from 0-81)
get layers (color, &y temp, &m_temp, &c_temp, &b_temp):
yellow += y temp:
magenta += in_temp:
cyan += c temp:
black += b_temp:
}

if (yellow < Ox10)
fprintf (fp1, "0");

1* pad single digit (hexit?) numbers with 0 *1

BORLAND PROGRAMMERS!
if (magenta < Ox10)
fprintf (fp2, "0");
if (cyan < Ox10)
fprintf (fp3, "0");
if (black < Ox10)
fprintf (fp4, "0");
fprintf (fp1, "%X", yellow);
fprintf (fp2, "%X", magenta);
fprintf (fp3, "%X", cyan);
fprintf (fp4, "%X", black);
1* draw-points *1

1* write the values to the 4 files *1

void file_header (f)
FILE *f;
{

fprintf
fprintf
fprintf
fprintf
fprintf
fprintf

(f,
(f,
(f,
(f,
(f,
(f,

"/inch {72 mull def\n");
1* define "inch"
"/picstr 375 string def\n"); 1* bytes per image line
"/fractal\n");
1* fractal procedure
(750 1200 4 [75000 1200 0 O]\n"); 1* build image
{currentfile picstr readhexstring pop}\n");
"image\n}def\n");
II

*1
*1
*1
*1

II

fprintf (f, "150 ");
i f (f == fp1)

1* set 150 line screen *1
1* yellow layer - 90 degree screen angle *1

fprintf (f, "90 ");

1* magenta - 75 degree screen angle *1

i f (f == fp2)

fprintf (f, "75 ");
i f (f == fp3)
fprintf (f, "105 ");
i f (f == fp4)
fprintf (f, "45 ");

1* cyan - 105 degree screen angle *1
1* black -

45 degree screen angle

*1

1* obscure spot function
fprintf (f,
{dup mul exch dup mul add 1 exch sub} setscreen\n") ;
fprintf (f, "1.75 inch 1.5 inch translate\n");I* center the image
fprintf (f, "5 inch 8 inch scale\n");
1* make it S"x8"
fprintf (f, "fractal\n");
1* call fractal procedure
1* file_header *1

*1

II

*1
*1
*1

void file_tailer (f)
FILE *f;

the
simplest
most
complex
tools
you
vvill
ever
use

{

1* print the page *1
1* AD EOF for PostScript *1

fprintf (f, "showpage\n");
putc (Ox04, f);
1* file_tailer *1

to create a user-friendly interface between
your program and the computer operator.

void get layers (clr, y, m, c, b)
unsigned-char clr;
unsigned char *y, *m, *c, *b;

Thirty functions provide for the design and
control of menus in either a text or graphic

{

switch (clr)
{

=
=
=

case 0: *m
OxOf; *c
break;
OxOd; *c
case 1: *m
break;
case 2: *m
OxOc; *c
break;

OxOb; *b

= Ox06;

screen and the number of menus is limited

OxOb; *b

=

Ox06;

only by your computer memory. Menus sup-

Ox06;

port only C & Pascal. Create bit-mapped

OxOb; *b

screen fonts, icons & graphic mouse cursors.

1* etc. *1

=
=
=

case 79: *y
Ox02; *m
break;
case 80: *y
Ox01; *m
break;
case 81: *y
OXOO; *m
break;

= OxOf;
= OxOf;
= OxOf;

*c

OxOc;

*c

OxOc;

*c

OxOc;

The keyboard or mouse will control the program flow. CREATIVE INTERFACE TOOLS is
yours for only

}

$69.95

1* get_layers *1

•••
1126 S. CEDAR RIDGE. SUITE 115 DUNCANVILLE. TX 75137

tum theory of color printing. Since each
cell contains a finite number of dots, the
cell can take on only a finite number of
shades of grey-not a continuous spectrum. I wouldn't worry about it though.
Even if we can do only 16 shades in each
of the four colors, we still have 164

possible combinations, or colors; 64K
different colors should be enough to
please anyone.
PostScript does the halftoning work
for us. In the image operator example
above, we specified one bit per image
element for a monochrome image. Let's

1-800-622-8366 214-298-1384 FAX 214-709-7674

~

~

~

All USBr modules furnished a. source code No run-time system No royalty
fees System requirements: PC. XT. AT. CGA. EGA. VGA. OOS 2.1 or
greater. 3&4K RAM. Output routines provided for TurbO C 1.5 & 2.0. Turbo
Pascal •. O & 5.0. TurbO Prolog 2.0 & TurbO Basic 1.1. MAXX OATA and
CREATIVE INTERFACE TOOLS are trademarks of Maxx Oata Systems. Inc.
Olher brand or product names arB trademarks or registered trademarks of
their respective holders. Copyright C 1989 by Maxx Oat8 Systems. Inc.

Reader Service Number 151

MICRO CORNUCOPIA, #49, Sept-Oct 1989

21

go to four bits per element. Two differences arise in the code. (Figure 3 shows
the important program segments interspersed with pseudo-code.) First, each
byte of hexadecimal image data now
contains two points instead of eight. No
real problem-we just shift left by four
bits after loading a point into the data
byte, instead of by one.
The second difference makes life interesting. Instead of creating one file, we
need four, one for each layer of the color
separation. But how do we choose the
color intensity for each layer?
Color Assignments
I would have liked to treat the color
assignment a little more intelligently, but
it's an inherently stupid process. Shift
gears and think about character generation for a moment. Once you've defined
a matrix of dots for the letter "A," you
can't just add one and get "B." I don't
think you can say "puce + 1" either, so I
opted for brute force.
Carol and I sat down with a color
guide and picked out a bunch of good
lookin' colors, arranged in a more or less
continuous spectrum. Then, for every
color, I approximated the percentages for
each of the four layers of the separation
(by choosing the 1-digit hexadecimal
number closest to the percentage required). Then I added a bunch of new
colors (since I had 16 levels to chose from
instead of the 11 shown in the color
guide), and plugged the values into that
big, ugly switch statement in get_IayersO.

Finally, setscreen requires a spot function. The spot function describes how
halftone cells fill in as they get bigger. I
lifted the version in file_headerO directly
from Adobe's documentation. (Have I no
shame?) It grows from the middle of the
cell out. I don't have the slightest idea
how the function works.
Confession Time
The more astute (awake) among you
will be grousing, "Hey! He said we'd be
looking at 2540 dpi stuff. Where'd this
150 dpi ca-ca come from?" It's not my
fault. I thought the presses could print
anything we sent them. Not so; 150 line
screens alread y push the mechanical
limits of initial alignment and subsequent
drift of the four layers.
So we're limited (in print) to 150 cells
per inch-still better than most displays.
If you want to see the unprintable 2540
dpi marvels, you'll just have to come by
the Micro C World Headquarters in Bend
and ask for a tour (open daily, more or
less, unless the weather's nice).
Execution Speed
I pruned all the video stuff from Harlan Stockman's '386, 32-bit, fixed-point
Mandelbrot code (see Micro C issue #43)
to do the dirty work for these PostScriptals. Harlan used DeSmet C88, with assembly for the number crunching. The
results were nothing short of amazing. A
few statistics on the generation of the
coverPmax

Odds And Ends
A few dangling mysteries and we'll
be in good shape. In file_headerO, there's
a new operator called setscreen. The L300
defaults to an 80 line screen, or 80 halftone cells per inch. But we print Micro C
at 150 lines. So the first of setscreen's
operands forces the L300 to a 150 line
screen setting. And here's where we finally muck up the program's device independence. Here at Micro C, 150 line
screens look truly awful on the laser
printer. A 300 dpi device works best with
60 line screens and doesn't appreciate
being asked to do the impossible.
We also have to consider how the
four layers of regularly spaced halftone
cells might interfere with each other. If
we don't rotate the layers correctly, wild
moire patterns appear. These separate rotations for each layer, called screen angles, minimize interference problems.
Give the screen angle to setscreen as its
second parameter.

22

MICRO CORNUCOPIA, #49, Sept-Oct 1989

= -0.7408

Pmin

= -0.7504

Qmax

=

0.12036

Qmin

=

0.105

maximum iterations = 2000;
switch point = 200;
pOints in image - 750x1200
system - 20 MHz 80386
execution time

= 2~

hours

To place this in perspective, a standard 4.77 MHz XT, running Turbo C floating point code with no 8087, would take
87 days to do the same PostScriptal. I'd
call that progress. Thanks, Harlan.
Early on I thought it would be nice to
zoom way in for a PostScriptal. Harlan's
fixed point representation can't deal with
numbers smaller than 0.00001. So I
switched over to the Turbo C floating
point code and Dave picked up a 20
MHz '387 math coprocessor. The fixed
point code was still five times faster.
You can see that I really couldn't have
done this without Harlan's code and a

handy '386. Although, I had to wonder
about the hardware. Our '386 has a mind
of its own-sometimes no mind of its
own. At one point, it favored locking up
during program compilation. The problem seemed to go away after the machine
had been on for a while.
Aha, a heat-related hardware problem. But it only happened while using
Turbo C. Perhaps the compiler needs to
warm up, opined Dave. I had visions of a
nice corduroy jacket to keep all the files
on the hard drive toasty warm during
the cool northwest eves; a compiler cozy
if you will. But the problem actually
came from our EMS management software. With that software removed, PostScriptal development went on unhindered.
Fini
As I pound these words into my keyboard and try to stay awake, our coverto-be cruises the Cascades on its way
over from Salem Type; nestled in a UPS
semi, oblivious to the full midsummer
moon.
It's passing strange to write about a
cover that doesn't exist yet. If this really
works, the result will be beautiful. If not,
the cover will probably be blank (except
for a "This page intentionally left blank"
message), and I'll be on permanent vacation.
Plenty of folks lent a helping hand on
this project.. Thanks to Dan at Salem
Type, and Stan and Patty at Bettis and
Associates. But especially to Carol at
Micro C: ostensibly our graphic design
person, but better known internationally
for her early morning sludge (excuse me,
coffee).
Well, saddle pals, I didn't get around
to discussing flow control operators, recursion, or a host of other PostScript
capabilities. Do I smell a sequel? Stay
tuned to Issue #50 to find out.
References

PostScript Language Tutorial and Cookbook, by Adobe Systems, Addison-Wesley, 1985, ISBN 0-201-10179-3. (Includes
further references.)

PostScript Language Reference Manual,
by Adobe Systems, Addison-Wesley,
1985, ISBN 0-201-10174-2.
PostScript Language Program Design, by
Adobe Systems, Addison Wesley, 1988,
ISBN 0-201-14396-8.

•••

By Ron Hicks
819 S. 21 st St.
Sheboygan, VVI53081

Programmable Logic Cont~ollers
Itld'ustrial ConJrol Is No Longer A Relay Race

In many ways this feels like "Bits From
Your Past." Just a few months ago I
watched a pressman cussing the relay panel
on his press. Actually I didn't know it was a
relay panel until I looked inside.
That box contained a hellish mess of
color-coded wires (long ago coated a uniform black) and relays clacking and sparking as they connected and disconnected 220
V AC. The hearts of these ancient machines
aren't the motors or the fancy rollers;
they're the relays, the cussed, nasty, grimy,
indispensable relays. Read on for information on new hearts.
OU may think this article seems
out of place in a micro computer
magazine, but it's not. You see,
Programmable Controllers are nothing
more than micro computers interfaced
to "real world" inputs and outputs.
In its simplest form, a programmable
controller consists of a central processing
unit (CPU) attached to inputs and outputs. The CPU has a program that tells it
to energize or de-energize outputs according to the state of its inputs.

Y

PLC Uses
Industry uses programmable logic
controllers (PLCs) for a variety of tasks.
You'll find small PLCs built into electronic motor controllers, machine control
panels, and even vehicles! They oversee
current draw, speed, and load factors;
they monitor limit switches and operator
inputs. The typical small PLC will have
from 16 to 200 I/O points.
Larger PLCs can control whole assembly lines or entire factories. Industrial
robots and their support equipment (conveyors, tool holders, power units, etc.) are
also major users of PLCs.
Not only do they control equipment,
but they also report system faults to the

central computer so technicians can be
dispatched. Many of these units also log
data and generate production or maintenance reports. These larger PLCs typically have 200-2400 I/O points.
Of course, PLCs can be networked via
mainframes. This way, any machine (or
human) on the network shares the I/O
and data of all the units. And, software
developed on the mainframe can
download to one or more controllers.
A Brief History of PLCs
One of the early marvels of electrical
engineering was the relay. Using a relay,
an engineer could control electrical
processes using logic.
Relay logic is nothing more than a
hard-wired program. You can control the
relay that starts the drill motor by
another relay that monitors table position. If the table isn't in position, the
motor won't start.
This approach worked fine until machines started becoming more sophisticated. Imagine using relays to also sense
drill speed, part positioning, tool positioning, coolant pump operation, motor
overload, and spindle position!
Soon the relay panel necessary to
operate a machine becomes more complicated than the machine. Where I work,
we have panels containing over 500 relays, each! I've spent many hours trying
to find bad relays by substituting good
ones for the suspects. It isn't much fun.

magnetic core memory. In its heyday,
this unit sold for $24,000!
As microprocessors came on the
scene, most manufacturers moved on to
the 8080 (and later the Z80) and many
PLCs still use these chips. The other
main chip family used is the INTEL
8088/80188. These machines fall into the
second generation.
As with other computers, newer PLCs
have vastly increased computing power
and much lower prices. Small systems go
for $200 and up, while large systems
start at about $3,500.
Ladder Diagram Programming
A problem arose when PLCs replaced
relay panels. Plant maintenance personnel and electricians were the main installers and operators of this new technology. It was easy enough to follow the
installation drawings since they continued to be standard electrical ladder diagrams. Programming was another
thing. Many of the early machines were
programmed in boolean algebraic equations, hardly the forte of the average
maintenance mechanic!
The obvious answer was to use the already familiar ladder diagrams. Ladder
diagram programming (LDP) uses
graphic images of contacts and coils representing the familiar relay circuits.
Within a ladder diagram, an individualline of code is called a rung.
LDPRung

Computers Enter The Scene
As computer equipment became
cheaper, electrical engineers started replacing relay logic with CPU logic. Many
of the early PLCs were based on discrete
minicomputers.
Modcomp was one of the premier
names during the first generation of industrial computers. I have one of their
early machines complete with 32K of

-[ ]-[/]--0A

B

c

The above example shows a normally
open contact (A), a normally closed contact (B), and a coil (C). The contacts can
be assigned to real inputs so an energized input (A) and a non-energized
input (B) will cause coil (C) to energize.
Coil (C) can be assigned to a real outMICRO CORNUCOPIA, #49, Sept-Oct 1989

23

put as a motor starter or other electrical
signal.

aquarium with fish swimming around
the EGA monitor!

- [ ]--i-o--O-

System Setup
Typically, they'll bring in a PLC, connect the I/O, and then use a PC compatible to generate the program. This may
seem opposite of normal wisdom (wiring
before programming); but once the I/O
is connected, you can do all reconfiguration through the LDP program.
Once the program has been
downloaded to the controller, you can
disconnect the PC: However, for maxi-

A

C

-[]-+
B

The above rung shows the coil (C)
energizing when either Contact A or B
energizes. Using these simple elements,
service people can generate complex
logic statements.
In an LDP program, power always
flows from left to right. Although these
examples are very simple, LDP programs
can have up to 100 elements in each programming screen and programs may
have up to 100 screens.
Each PLC's manufacturer has its own
proprietary LDP. Some implementations
have added features such as subroutines
and advanced mathematical features. The
best of the LDP languages support a
BASIC-like language composed of keywords that can be used in the same networks as the relay contacts. I've shown
an example of an advanced ladder language below.
-[ ]-[TSEC]-[COND]-[SUB50]A

TSEC

=A

second timer.

COND

=A

conditional statement

ie. TSEC=lO
SUB50 = Goto

~ubnetwork

number 50

When contact A closes, TSEC will
start timing. When TSEC equals 10,
COND will pass power to SUB50. This'
will transfer program execution to subnetwork number 50.
Programming And Control Computers
Many different machines are used as
programming and control computers.
CP /M-based Kaypro machines were
very' popular for a while, as were VAX
computers. However, with the popularity
of the IBM PC, most companies have
switched to the PC standard for their
programming and control computers.
Many companies make "hardened"
IBM-PC/ AT compatibles for industrial
users. They have sealed cases, shockmounted hard disks, and super heavyduty power supplies (to support extra
expansion cards). In dirty or wet environments they use membrane keyboards. At a recent trade show, one vendor had his AT compatible running in an

24

MICRO CORNUCOPIA, #49, Sept-Oct 1989

M

any companies
make "hardened"
IBM-PC/AT
compatibles for
industrial users ...
sealed cases,
shock-mounted hard
disks, and super
heavy-duty power
supplies (to support
extra expansion
cards). In dirty or wet
environments they
use membrane
keyboards.
mum control, you can leave the PC connected and let it serve as a gateway into
a network.
When the programmable logic controller is running, you can use the IBMPC to monitor its activities. The IBM-PC
can force I/O on or off, which really
helps during troubleshooting. It can also
examine and change the PLC registers.
PLC Hardware
Let's examine a typical PLC CPU and
its method of operation.

The CPU designates a block of
memory as the I/O image area. This
block holds the status of all the inputs
and outputs. The I/O image is checked
at the beginning of each program scan.
When the program needs to energize
an output, for instance, it loads the new
status into a reserved section of memory
called the output image area. At the end
of the scan, the processor checks output
image area and turns on the output.
The PLC's ROM contains the executive operating program. In many ways,
this executive can be compared to CP/M
or MS-DOS. It handles communications
between the user program and the hardware. The executive program also handles math and timer functions, and translates ASCII text.
Digital Inputs
The most common industrial input to
a PLC is 120 VAC. Other common inputs
are 24 VDC and 5 V TTL. All these inputs are handled the same way, only the
components change.
The circuit drawing in Figure 1 shows
a common way of interfacing process signals to the PLC bus.
As the 115 VAC signal comes into the
card, resistors R1 + R2 lower the voltage.
Then the AC signal goes to full wave
bridge D1 for conversion to DC. Next R3
and C1 filter the signal and D2, a Zener
diode, limits the voltage to the relay.
The operation of the LED confirms the
relay coil is energized. A set of contacts
on the relay allows a signal to flow to the
input of a quad bilateral switch.
A typical input card will have 16 of
these inputs. It will have 4 of the quad
bilateral gates, which the CPU will scan
as a 16 bit word. Energized inputs will
read as 1 and unenergized inputs will
read as O.
Output Cards
Take a look at Figure 2. When an output is required, the CPU will send a signal to the card. This signal drives the
base of T1 and energizes the relay coil.
The LED confirms that the relay coil is
energized.
D2 bleeds off the reverse voltage
generated when the relay'S field collapses. A set of contacts on the relay controls the external device.
Analog Inputs
The card also converts analog signals
to binary. In this way the CPU can read
an analog input as 16 bits-the same way
it read the 16 inputs above. The LDP pro-

Rack &Desk
PC/AT Chassis

Fig1l;re l-PLC Bus/Process Signal Interface.

LED

02

Rl
L1----·nn~~AC

+~--~~~---.--~~--~

(01)

R3

~SIGNAL

C1

R2
COM ----.I\I\,f\---I AC

LCOMMON

Integrand's new Chassis/System is not
another IBM mechanical and electrical
clone. An entirely fresh packaging design
approach has been taken using modular
construction. At present, over 40 optional
stock modules allow you to customize our
standard chassis to nearly any requirement.
Integrand offers high quality, advanced
design hardware along with applications
and technical support all at prices competitive with imports. Why settle for less?

Figure 2-PLC Output Drives.

vcc---------------------------~------.-----~

F

AC

FUSE

02

LED

-LLOAD
SIG. -----.I\f1lf1---..f::lI.--__--+-I

COM.----------------~----~

Figure 3-Analog to Digital Conversion.

r-----------------.--SYSlEM CLOCK
INPUT1+----+---~~~-4~~--~~------~

Rl
INPUT1-----~--~~~-4------~~----~

+
AID
CONVERlER

INPUT 2+ ----___--+-..H...+~..;,,;....-=-------__i::...---l
Rl

INPUT 2- ---*---~-I ~-4--------------~

Accepts PC, XT, A T Motherboards
and Passive Backplanes
Doesn't Look Like IBM
Rugged, Modular Construction
Excellent Air Flow & Cooling
Optional Card Cage Fan
Designed to meet FCC
204 Watt Supply, UL Recognized
145W & 85Walso available
Reasonably Priced

TO
BUS

- - --.
.--- -----.....
-- - ......

• • - ._-~-----.• ...--. .-~
._
.......... a _

=~~~~~~ ~~~

Call or write for descriptive brochure and prices:
8620 Roosevelt Ave. • Visalia, CA 93291

209/651-1203

TELEX 5106012830 (INTEGRAND UD)
FAX 209/651-1353
We accept Bank AmericardlVlSA and MasterCard
IBM, pc. XT, AT trademarks of International Business Machines.
Drives and computer boards not included.

Reader Service Number 22

MICRO CORNUCOPIA, #49, Sept-Oct 1989

25

gram tells the CPU what to do with the
data. The program can convert it to a binary coded decimal, integer, or floating
point number before storing it in a user
register.
In Figure 3, the signal is input
through a reed relay. A multiplexer then
selects which input to channel to the
AID converter by turning on a relay. The
typical analog card will have 8 inputs,
each input capable of handling a current
or voltage (or thermocouple) input.
Analog Outputs
In Figure 4, the analog output operates in the reverse of the analog input.
Each output has a dedicated DI A convertor. This 01 A converter drives a current source, thus outputting an analog
signal in proportion to the digital information from the CPU.
A register on the 01 A converter
stores the digital signal so the output will
remain constant until the CPU tells it to
change or shut up.
Servo Controller Cards
A servo motor controller is one major
PLC use. Servo motors are used for
robots, part positioning, machine control,
and a plethora of other uses. Servo control consists of two separate functions:
Sensing motor position and changing
motor position.
Servo controller cards have an output
driver and an input (connected to servo
motor's encoder). The encoder reads the
motor's spindle position. (See Figure 5.)
The LOP program decides where the
motor should be. The CPU sends a signal
to the output section of the controller,
which sends the output to the servo
motor. The encoder then verifies the
motor's new position.
If the motor's shaft hasn't reached the
correct position, the controller card detects the error and sends a correction (via
the output) to the motor. This way, the
CPU doesn't need to check for proper
position.
Conclusion
I've just covered the basics of PLC use
in industry. There are over one hundred
companies making programmable controllers, and every day I get literature
from new companies.
Although PLCs have been around for
20 years, it seems 1988 was the year they
came into dominance of industrial control. Perhaps the long promised pushbutton world is finally here, thanks to
programmable controllers.

26

Computer Jobs In Industry
Many computer users take their
knowledge for granted. We assume that
everybody knows how to use a computer. This is not the case. In most industrial plants, they look upon computers as a necessary evil. Many senior
maintenance men, who think nothing of

Figure 4-Digital to Analog Conversion.

VCC
0-1 VOLT
SIGNAL OUT
BUS
SIGNAL
IN

I

-

FUSE

+

O/A

CURRENT

CONVERTER

SOURCE

CURR ENT
OUTP UT

-

1
Figure 5-Servo Controller Block Diagram.

LOAD

~7

SERVO
CONTROLLER

ERROR AMP

FEEDBACK

pulling apart a steam turbine, freeze
when they're called upon to touch a
computer. Some have never had the
chance to use computers, and some just
aren't interested. This gives computer
users a real opportunity for employment.
Industry requires some skills that
seem trivial to us. Simple things like
copying a disk or changing a hard drive
directory appear insurmountable to an
untrained user. More advanced tasks,
such as batch file writing or 123 work
sheet configuration, are other common
problems. I found a user who turned off
the computer each time he wanted to
change programs. That was the only way
he could get back to the root directory!
When you fill out an application at an
industrial plant, be sure you include any

MICRO CORNUCOPIA, #49, Sept-Oct 1989

---~---.---

computer courses you've taken. If you
haven't taken any courses, still include
computer use in your application. Applications usually have an "other experience" category.
For instance, if you can't think of anything else to write, at least write in "Extensive Computer Experience." This line

-------------

is enough to pique the interest of an interviewer. However, be sure you're ready
with a short, concise explanation of your
experience. Include any programming
languages you know and the different
types of equipment you've used.
One final benefit of industrial employment is training. Industry knows that
most industrial equipment is a long way
from the computer mainstream. So they
look for people who have a basic understanding and the willingness to learn.
When they find this kind of person,
they'll spare no expense for training.

•••

at
tool~ ltcP~
.l.WO gre
~. 4~~~~t~

~

~.i4'()~~

SAYWHAT?!

The breakthrough
r,/
DBMS toolkit for Pascal

Whether you're a novice
programmer longing for
simplicity, or a seasoned
pro searching for higher
productivity, you owe it
to yourself to check out
1/'."/
Saywhat. You see, with
\ \
:/";; Saywhat, you can build
(beautiful,elaborate, color'coded screens in minutes!
rc A ~~
/
That's right. Trulyfantastic
\'-\
~ screens for menus, data
----entry, data display, and
help-panels that can be
displayed with as little as one
line of code in any language.
'\.

I

J

)/

j~ ~
Here's what you get:

• Easy-to-use, powerful editor lets
you create screens in a jiffy.
• Pop up your screens and menus
with one line of code in dBASE,
all the dBASE compilers, your
favorite BASIC, Pascal, or any
other language!
• Screen Library Manager.
• Generates runtime code.

I

Software Science. Inc_
The Research Group
100 Valley Drive. Brisbane. CA 94005
,~) T) ) ") ) ) \)

• Open up to 10 DBF files. with up to
7 indexes with USE, SELECT,
SKIP, APPEND, PACK, INDEX
ON, SET INDEX TO, and FIND.
• No need to buy dBASE. CREATE,
BROWSE and REPORT utilities
included.
• Easily implement Saywhat and
Lotus-style moving bar menus.

i.

"-l-l-;\

3
Ct

• BROWSE any DBF file with just
one line of code! Programmable
and windowed too.
• Pick from windowed data or filenames with one line of code.
•

),")"")J"""\")

I\..,- \ I
~ A~~/ ; MONE'yBACKG:U~EE.
-~
I
v
/ I' orIfyouarentcompletelydehghtedWlthSaywhat
(
f ((
Topaz. for any reason. return them within

I
O_'-fj:

D /-

o Over 200 routines all with easy-touse. dBASE-like syntax.
• Data entry routines like SAY, GET,
PICTURE, RANGE, color selection. unlimited data validation.

In California: 800-231-7849
International: 415-571-5019

• Comes with a 100 page manual,
plus dozens of sample programs
and free utilities.

"","'./11
I

U\l

800-468-9273

• No runtime license or royalty fees.

~3

'fi

If you'd like to combine the raw power
and speed of Turbo Pascal or MicroCt>Y
soft's QuickPascal with thesimplicity£~ ~~'lGY"./
and elegance of dBASE. Topaz is L~:<'~Z. /
just what you're looking for.
?~
That's because Topaz was
~
specially created to let you
y"~
enjoy the best of both worlds./.~~ )
The result? You create com-d~/-"'''plete, truly dazzling applicat- / ' .
(/-"
ionsina veryshorttime.And nowonder. ,\~,......!)
Topaz is a comprehensive toolkit of
\J~~\
dB~SE--like commands and functions.
1\ \ \\
deSIgned to help you produce
outstanding. polished programs. fast.
Check out these powerful features:

ORDER NOW.
YOU RISK NOTHING.
Thousands of satisfied customers
have already ordered from us. Why
not visit your dealer or call toll-free.
right nowandput SaywhatandTopaz
to the test yourself? They're fully
guaranteed. You don't risk a penny.
Special limited-time otTer! Save $26.
Buy Saywhat?! and Topaz together
for just $99 (plus $5 shipping
and handling).
Visit your nearest dealer
or call toll-free:

• Design screens, windows, and
moving bar menus!

Q;:;

~cP~.f~

TOPAZ

The lightning-fast
screen generator.

30 days for a prompt. friendly refund.
~
~"
Dealers: SAYWHAT?! and TOPAZ are
available from Kenfil Distribution.
and in Europe from

•

Comprehensive Time & Date
math in 7 international formats.

Powerful code and report generators
. 1 d d'
Inc u e .
Comes with a complete 250 page
manual, plus sample programs to
get you started.

-....-comFiiiiieed!
SOFTWARE

SCI.ENCE

INC.

Reader Service Number 129

MICRO CORNUCOPIA, #49, Sept-Oct 1989

27

Driving Stepper Motors
Do It Yourself Stepper Motor Controller

If you're interested in controlling something mechanical, then you're in the right
place. Steppers give you a great way to
translate the electrical into the physical, and
this is a quick (and clean) way to do it.
ne day, my artist friend John
called and said, "I'm building a
computerized wood embossing
machine run by my VIC-20."
''That sounds neat," I replied, somewhat bewildered.
"U's going to use stepper motors to XY scan a pen and ink drawing optically.
Then fire a solenoid to punch holes in the
wood when it sees a line."
Now things were getting interesting. I
had only the vaguest idea what a stepper
motor was, so I said, "Steppers, eh?"
"Yeah. They're great; I can get them
from Jerryco for $5 a piece. Can you design me some driver circuits? The ICs for
powering these things would cost $20 a
shot if I could find them."
Twenty bucks! For some silly reason, I
still think les should cost less than the
socket to plug them into. The next day
John mailed me the excellent Airpax
stepper application manual. So there I
was, a new project.

Figure l-Unipolar Winding Stepper Motor Sequencing.

O

Another Project Startsl
I had four design goals: (1) low cost;
(2) directional control; (3) some degree of
direct speed control by the computer;
and (4) the use of as few lines from the
parallel port as possible.
After a little experimentation, I found
I could do the job with cheap, easily
available CMOS ICs, though the design is
a bit more complex than with dedicated
driver chips.
But you save a lot! The driver uses
three lines direct! y from your parallel
port. Lines one and two control the speed

28 MICRO CORNUCOPIA, #49, Sept-Oct 1989

NORMAL
4 SlIP
SEQUENCE

1/2 SlIP
8 SlIP
SEQUENCE

step

Q1

Q2

Q3

Q4

1

ON

OFF

ON

OfF'

2

ON

OfF

OfF'

ON

3

OfF

ON

OfF'

ON

4

OFF

ON

ON

OfF'

1

ON

OFF

ON

OfF'

1

ON

OFF

ON

OfF

2

ON

OFF

OfF'

OfF'

3

ON

OFF

OfF'

ON

4

OFF

OFF

OfF'

ON

5

OFF

ON

OfF

eN

8

OFF

ON

OfF

OfF

7

OFF

ON

ON

OFF

8

OFF

OFF

ON

OfF

1

ON

OFF

ON

OFF

OfF

1

ON

OFF

OfF

WAVE DRIVE

2

OFF

OFF

OFF'

ON

4 SlIP
SEQUENCE

3

OFF

ON

OfF'

OfF

4

OFF

OFF

ON

OFF

1

ON

OFF

OfF

OfF

!1

By David Metz
Metz Electronics
725 Climer
Muscatine, IA 52761

of the stepper. Line three controls the
direction of rotation. The logic runs off
the computer's 5-volt supply. I recommend you run the stepper off a separate
supply. (Don't torture your computer
any more than you have to.)
John used 12-volt steppers on his machine. With the transistors specified, he
could have run 5 to 24-volt motors with
no problems.
How Do Steppers Work?
A stepper is a permanent magnet
motor with two sets of stator (nonmoving) windings. The two windings are
mechanically offset by 1/2 a pole pitcha pole being either the north or south end
of one of the rotor's permanent magnets.
Each time a winding energizes, interaction between the winding· and the
magnet causes movement. The opposite
poles attract, and the like poles repel. By
controlling the timing (phase) and direction (polarity) of the electricity flowing to
the coils, you control both speed and
direction of rotation.
Figure 1 shows a unipolar (center
tapped) winding motor and the order its

Figure 2-CD4001B Clock.

JOhn and I chose
the center tapped
motors because
they required only
four driver
transistors ...
windings must be driven. John and I
chose the center tapped motors because
they required only four driver transistors.
Bipolar steppers require eight driver
transistors; not good when you're trying
to keep costs down.
Steppers are available in a range of
0.72° to 90° rotation per step. The most
common are 7.5° to 18° per step. A 7.5°
stepper requires 48 steps per revolution.

The Break Down
The driver consists of four sections:
Clock: Supplies the pulses that determine the speed of the motor.
Phase shifter: Produces the 90° phase
shift between the drive coils.
Reversing circuit: Produces a selectable
180° phase reversal on one drive coil to
set direction of rotation.
Motor coil drivers: Transistors which
take their control from CMOS outputs
and in turn control high-current motor
coils.
Speed Control
I offer two methods of supplying the
clock pulses to the phase shifter. One, a
fixed frequency clock that uses 1/2 of the
CD4001 B NOR gate that you already
have (see Figure 2). The other uses the
ever popular 555 timer (see Figure 3).
In either case, I need a clock that runs
between 10 and 70 Hertz. From that you
can infer that Mr. Woodpecker didn't
move too fast at first. Later he got much
faster, but that's another story.
Your application and the capabilities
of the stepper motor you're driving will

Figure 3-555 Clock.
Rl
LINE

Vee

0.1

~

l°--vV}V'---,/V\f'-----,

R2

7
LI NE 2 o--IIVA/'----'\Jrvv'---e---I

3

I---~OUT

555

4.7K

5

6

ON/OFF
HIGH=OFF 0 - - - - - - - - - - - '

+

I

Cl
0.5 ~F

':"

MICRO CORNUCOPIA, #49, Sept-Oct 1989 29

determine the frequency range you need.
Some can move faster than others. The
advantage of the 4001 clock is simplicity.
The disadvantage is that an on board
potentiometer sets the speed. The 555 allows a simple means of software speed
control at the cost of a few more parts.
Why speed control? Your robotics
project might appear to work just fine at
one speed. Ours did until John speeded it
up. It turned out that the Woodpecker's
mechanical parts did not like being
slammed around by sudden starts and
stops.
By incorporating one additional bit, I
could select three different speeds. Thus
the Woodpecker could accelerate or stop
smoothly.
The RC time constant of R1, R2, and
C1 determines the 555' s frequency of
oscillation. When C1 reaches ~3 of Vee,
the capacitor discharges and another
cycle begins.
Since this fixed internal voltage ratio
determines the frequency of oscillation,
changes in supply voltage will not affect
the clock frequency. Once you determine
the vahies for R1, R2, and C1, the supply
voltage can be anything between 5 and
15 volts.
The 555 circuit's speed (frequency)
control works by simple parallel resistance. With lines one and two low, no
charge current flows to C1 and no oscillation occurs. The stepper sits idle, the
current passing through its coils acting as
a brake. (Yes, I know what you're thinking, I'll handle that problem later.)
We now make the time-honored prin-

ciple of parallel resistance work for us.
R1 gives one charge rate. R2 gives one
that's faster. Thus, if line two is high, the
motor will revolve faster than if line one
(R1) is high. If both are high, the charge
rate is much faster since the combined resistance of R1 and R2 is lower.
For example:

R2 (Line two)

= 68,000
= 33,000

Line one high

= 34

Rl (Line one)

Line two high
Both high

= 62
= 84

ohms
ohms

Hz
Hz
Hz

I would use small ten-turn (screw
driver) adjustable pots for R1 and R2.
This makes the inevitable after-construction fine-tuning much easier.
The 555s have one other peculiarity
that bears watching. When the output
pin 3 goes from high to low, the totem
pole can short momentarily. This can
send a nasty glitch back through the
supply line.
There are two ways around this problem. First, try the 7555 CMOS version of
the 555 timer (Intersil makes them, DigiKey sells them, 90~ each). Or use a large
bypass capacitor. I added a 220 IlF cap
across the power supply pins of the 555.
A value that large might be overkill.
Note: if you have several 555s on a
board, normally you need only one big
bypass.
Watch Your Parts Quality!
There are some components that you
just can't goof around with. Timing resis-

tors and capacitors are very important.
The leakage of the capacitor determines the upper value of C. Too
large/too leaky capacitors just never
seem to charge up! Save yourself some
grief. Use a good quality capacitor for C1
like a Panasonic type NHE or HFS if you
need a value above 0.22 1lF. Below 0.22
IlF, use high quality mylar or polystyrene.
Be sure to bypass Vee with good
mylar or disk ceramic capacitors in
several locations. And keep the leads
short! The high current square waves
from the stepper drivers could induce
spikes in the Vee supply bus.
The Phase Shifter
The phase shifter uses a single
CD4013B dual D type flip flop to produce the 90° shift. Note that it divides the
clock frequency by four. The input to the
D line tells the flip flop what to do. If D
is high, clocking makes Q high and not Q
low.
Grounding D does the reverse. Note
how the two flip flops are cross connected.
Reversing Circuit
The reverser consists of 1;2 of a quad
CD4070B exclusive NOR gate used as a
controllable inverter (see Figure 4).
When line three is high, the gate inverts. When three is low, the gate does
not invert. The extra inverter in front of
the second section makes it produce the
complement of what the first section is
doing.

Figure 4-Reversing Circuit Using CD4070B.
Vee

RED
LINE 3
)
(
ROTATION
100K
Vee

14

5
IN

:5

0

Q

C

"0

Vee

-=
9

0

Q

Q

13
12

RED

7

-=
TlP120 (4)
Co41ZJ1:58

30

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Driver Transistors
The 10,000 ohm resistor in the base
circuit limits base current to something
safe. This value is not critical. The transistor is the Texas Instruments TIP-120
darlington.
A darlington is two transistors in one
case with one driving the other. This allows the device to switch large currents
despite very low drive currents.
The TIP-120 can switch voltages of up
to 60 volts and currents of up to 5 amps.
Since in this application they are either
on or off, the only heat dissipation comes
from their own internal resistance. The 12
volt Airpax steppers we used have 65
ohm coils. These draw only 220 milliamps from a 13.8 volt supply. The TIP120 transistors don't even get warm.
At less than a dollar a transistor, I saw
little point in using smaller or cheaper
transistors. If you have the room, use the
TIP-120s or equivalent for the reliability
an oversized component gives you.
Now, about those diodes across the
coils. These are called snubber diodes (or
at least, that's what I've always called
them). They clip the reverse voltage spike
generated when the magnetic field collapses in the stepper coil. Leave these out
only at your computer's peril.
Windings
The color code shown here is for the
Airpax steppers John used. Others may
have different connections. Remember to
look for steppers with six leads. They're
the bipolar ones that are easy to drive. A
few minutes tracing with an ohm meter
will give you the connections. Just remember that the center tap has half the
resistance of the entire winding. Making
a little drawing with the leads' colors and
resistances will make the job easy.
Suppliers
Many of the suppliers that advertise
in Micro Cornucopia have steppers. The
ones I've listed may be new to you. I've
used them all on a regular basis, and the
service has been excellent.
Digi-Key has an excellent selection of
new components with very fast service.
They have the best selection of computer
type components of any mail order firm I
know. They send out an updated catalog
every two months.
Jerryco often has steppers and some
of the darnedest oddball stuff you've
ever seen in your entire life. Don't laugh
when you check out their catalog. You
never know what weird items you'll
need to build your dream project.

Small Parts Unlimited is a robotics
builder's dream. They have a fantastic
collection of structural material and small
mechanical components. A great source
of gears, shafting, cams, and drive chain.

sections of a spare CD4001 B to first NOR,
then invert the NORed signal.
This keeps you from having to add
another device (a CD4071B) to the parts
list. Leftover gates always seem to have a
way of getting used.
Q. Shouldn't I isolate my computer's port
from the drivers to protect it?
A. If it lets you sleep nights, by all
means do it. Opto-isolators such as the
GE Hll L2GE work perfectly (see Figure
6). The HllL2 needs a current limiting
resistor for the LED inside (about 220
ohms for five volts). Its output comes
from an on board schmitt trigger.
It not only isolates and cleans up your
data, you can also use it as a level translator. The HllL2 can run from 3 to 16
volts. That means if you have 12 volt
steppers, you can run your steppers and
logic from the same supply. That would
save drain on your computer and eliminate the regulator for the driver logic.
The Hll L2 has an open collector transistor for an output. So you have to connect it to an inverter and use a lOOK
pullup resister. That arrangement will
give a logic one output from the inverter
with a logic one into the opto-isolator.

Questions:
Q. Can I generate the clock pulses in soft-

ware so I could do away with the clock?
A. Absolutely! I didn't, simply to keep
the size of the software down. You can
do it with timing loops to synthesize the
pulses. Or you could use a programmable divider to divide down the
system clock.
Q. Can I shut off the current flowing

through the coils when the clock is off to save
power on my super battery-operated toy I
just designed?
A. Yup! (See Figure 5.) We OR together lines one and two. If both are low,
the CD4066B analog switch removes
drive from the bases of the driver transistors. I left this out of the Woodpecker in
order to get some dynamic braking.
There are two ways of doing this. One
uses two diodes with a lOOK pull down
resistor to OR lines one and two together.
A little better way would be to use two

:""'-'_-,,- .-::-.. . -;-.. --,;--...,--. "'7-. r;:=-~'; /_: ~ "L;;~:::::.J-...:::-:.-j

. ,/'

j! :,! '!i~:,~ :'; : ~ft~i~~::~~~~;::~7q~~c~~):~
:~;:;;<:~;~~::.

easily through the popular PCX file format. Why reinvent the
wheel? Make your programs immediately compatible with
hundreds of packages from Aldus PageMaker to ZSoft's PC
Paintbrush with these linkable graphic libraries.

"A Professional Class Product" - DBAdvisor, Jan '89
NEW! Version 3.5 of the PCX Programmer's Toolkit gives you over 60
powerful functions to manipulate bitmapped graphics, Use Virtual screens,
Super VGA modes, LIM 4.0 support, a 300 page manual, 9 utilities including
screen capture and display, and the fastest routines on the market. $195

Need Special Effects, but caught in a GRASP?
Why create a demo when you can create the real thing? Don't be trapped in
a slideshow editor or demo program when you can use PCX Effects and
your favorite programming language. A complete Music Language and
$99
spectacular special effects for exploding your graphics!

Blazing Graphics Text
With PCX Text you can display text with graphics as fast as it always should
have been. Display characters, strings, input fields, font scaling, background
transparency, and more. Includes a font editor, fonts, and conversion utility
for blazing graphics bitmapped text.
$99
All packages support 12 compilers for C, Pascal, Basic,
Fortran, Assembly, and Clipper. All modes of the Hercules,
CGA, EGA, VGA, and Super VGA adapters are supported, up
through 800x600x256 (22 modes in all). Assembly Language
source code is optionally available. Trademarks are property
of their respective holders.

MICROPROGRAMMING

11315 Meadol'llake. Houston. Texas 77077. (713) 87cr0737

No Royalties! 30-day Money Back Guarantee.
VISAIMC/AMEX/COO/PO accepted.

MICRO CORNUCOPIA, #49, Sept-Oct 1989

31

Suppliers

Figure 5-Motor Off Switching (No Braking).

DIGI-KEY, Inc.
Box 677
Thief River Falls, MN 56701
(800) 344-4539

R1
UNE 1
SPEED
R2

Vee
14-

}ro~

UNE 2

JERRYCO, Inc.
601 Linden Place
Evanston, IL 60202
(312) 475-8440

IN9t4 (OR GATE)

UJK

3

4-

tel<

a

9

tel<

t9

11

tel<

5. 6. 12. 13

tOOK
PULL DOWN

Small Parts Unlimited
6891 N .E. 3rd Ave.
P.O. Box 381966
Miami, FL 33238-1736
(305) 751-0856

2

CD4GJ66B
np12S
MOTOR
DRIVERS

7

':"

':"

Figure 6-Stepper Motor Interface.

AIRPAX, Inc.
A Div. of North America
Philips Controls Corp.
Cheshire Division
Cheshire Industrial Park
Cheshire, CT 06410
(203) 271-6000

FROM
COMPUTER

220

Call Airpax for the name of your local
distributor and ask for a copy of their
stepper motor handbook.

•••
286 or 386SX?
CAN'T MAKE UP YOUR MIND?
WHAT SUITS YOUR NEEDS NOW MAY NOT BE
RIGHT FOR YOU IN THE FUTURE. TAKE ADVANTAGE OF THE SPEED AND POWER OF A PT286
SYSTEMANDRETAINTHEOPTIONOFUPGRADING
LATERTOA386SXWITHAPLUG INCPU MODULE.
ALL PRODUCTS ARE COMPATIBLE WITH DOS,
UNIX, XENIX, OS/2, AND MAY CONTAIN UP TO 5
MEGABYTES OF ON-BOARD MEMORY.

Mandelbrot Explorer 3.0

2861386SX KITS ARE AVAILABLE

.PT386SX

Assembled board, 16MHZ, 512K RAM,
FDC, 2 serial, 1 parallel port $795.00
.PT286
Assembled board, 16MHZ, OK RAM, FDC,
2 serial, 1 parallel port
$475.00
·PT386SX Optional upgrade to PT286
$325.00
CPU Module Only

[lJeJ6Ig!:t·I1$1'.ilRlij'CI·i,tWl
CATALOG AVAILABLE UPON REQUEST

PERIPHERAL TECHNOLOGY
1710 CUMBERLAND PT. DR. SUITE 8,
MARIETTA, GEORGIA 30067
404/984-0742/FAX ORDER LINE: 404/984-8248
AU. TRADEMARKS ARE THE PROPERTY OF THEIR RESP,fCTIVEOWNERS.

Reader Service Number 119

32

MICRO CORNUCOPIA, #49, Sept-Oct 1989

---------------.-

--------------

Fantastic fractal grapntcs on 16-color EGA/VGA to 8Ofrc600.
Magnifies up to 16.5 trillion times. Stop and start at wil~ save and
retrieve, collage, full control over color boundaries, ''zoom box, "
display ofperiodic orbits, auto-backup, all optimizations for speed
including pixel interpolation and 386 integer support. Comes with
seven ready-made pictures for immediate gratification.

$30
Peter Garrison
1613 Altivo Way
Los Angeles, CA 90026
2136651397
When ordering please specify EGA/VGA and disk format
Overseas orders please add $4
Reader Service Number 112

By Edwin Thall
Wayne General and Technical College
Orrville, OH 44667

Writing TSR Programs

Dr. Edwin Thall, Professor of Chemistry
at Wayne General and Technical College of
The University of Akron, teaches chemistry
and computer programming. (I understand
that he has not been terminated, though he
is definitely resident.)
BM and Microsoft ushered in a new
approach to writing programs when
they introduced the terminate-butstay-resident (TSR) function call with
DOS version 1.1. Software developers
quickly caught on, and now they make
just about every conceivable utility into
a resident program. Preassigned hot
keys pop up such applications as calculators, calendars, address books, and
notepads.
As the name suggests, resident programs remain in computer memory
while other programs execute. But resident programs are also potential disasters
since, without warning, they can corrupt
data, scramble the screen, or crash the
system.
Usually systems crash because OOS
doesn't provide the controls needed to
maintain peaceful coexistence between
two or more TSRs. Users seem to be
divided into two camps: those who swear
by TSRs and those who swear at TSRs.
The intention of this article is neither
to defend nor attack the widespread use
of TSRs, but rather to explain thoroughly
how they work. I'll present two examples, one well-behaved and the other a
''bully.'' We'll also explore removing a
resident program without rebooting the
system.

I

Resident Versus Transient Memory
COMMAND.COM is divided into
three components: the resident, initialization, and transient portions. The resident
portion is loaded in lower memory immediately following IBMDOS.COM. In-

terrupt vectors 21-24H point to routines
within the resident portion. This portion
also contains the bulk of the error recovery messages. Once loaded, the resident portion remains in memory.
The initialization portion of COMMAND.COM loads immediately above
the resident portion when the system
boots. This portion initially takes control
and displays the prompts for the date
and time. It also runs the AUTOEXEC
batch file, if one is present. The first program from disk overlays this section of
memory.
The transient portion loads in the high
end of COMMAND. COM and can overlay one interim program with another.
As resident connotes permanency, transient implies temporary. The responsibilities of the transient portion include displaying the OOS prompt and reading, as
well as executing, commands. The transient portion also contains the routines to
load .COM and .EXE files into the appropriate memory location for execution.
When you request execution of a program, the transient portion constructs a
program segment prefix directly above
COMthe
resident
portion
of
MAND.COM. It then loads the program
immediately following the program segment prefix, sets the exit addresses, and
transfers control to your program.
When execution is complete, COMMAND.COM regains control and assigns
the same memory locations to your next
application. However, if you terminate
with one of the TSR functions, the program becomes an extension of the resident portion of COMMAND.COM.
The area of memory occupied by the
program is reserved in the same manner
as memory is reserved for DOS. Future
applications will not overwrite this section. The only way to eliminate' such a
program, without the benefit of a resident memory manager utility, is to reboot.

Establishing Residency
Let's install a simple program directly
above the resident portion of COMMAND.COM. After installation, we'll use
the DEBUG utility to locate and examine
the program. Let's begin by calling Interrupt 27H to incorporate the message
"STAY RESIDENT" in the resident portion of memory.
Interrupt 27H terminates the currently
executing program and reserves part or
all of its memory so that the next transient program will not overlay it. The
maximum quantity of memory this interrupt can reserve is 64K bytes. From OOS,
load DEBUG and enter the following
program (omit comments):
A>DEBUG
-A100
DS:0100

JMP 0110

DS:0102

DB 'STAY RESIDENT' ;DATA

DS:0110

MOV DX,0110;PROT TO HERE

DS: 0113

INT 27

DS:0115



;BY-PASS DATA

;TSR

The program takes up 21 bytes (offsets
01 00-0114H) and can be viewed by typing:
-D100,114
DS:0100

EB OE 53 54 41 59 20 52

-45 53 49 44 45 4E 54 20
DS:0110 BA 10 01 CD 27

Later, you can search resident
memory to locate this, code. The 256-byte
program segment prefix (PSP) precedes
the code. The PSP occupies offsets 00FFH and is made resident along with the
code. You can display the PSP with:
-DO,FF

Here's how the program works. The
first instruction OMP 0100) bypasses the
data (DB statement). The next instruction
(MOV DX,OllO) specifies that the pro-

MICRO CORNUCOPIA, #49, Sept-Oct 1989

33

gram be protected up to, but not including, offset 0110H. When the program terminates with the last instruction (INT
27H), the PSP (offsets OOOO-OOFFH) and
code (offsets 0100-01OFH) become an extension of the resident portion of COMMAND.COM. Save the program as
RES27H.COM:
-NRES27H.COM
-RCX
CX ????
:0015
-REX
BX ????
:0000

also instructs DOS to install the next TSR
here.
Bytes 2 and 3 of the memory control
block hold the PSP segment (060EH) of
the program to follow. If the PSP segment number is zero, then the memory
defined by the memory control block is
free. Bytes 4 and S specify the size (in
paragraphs) of the pending memory
block. Notice the value is OOllH, or 17
paragraphs.
Memory control blocks chain from
one to the next, and DOS is notified that
the next memory control block is 17 plus
one, or 18, paragraphs above. Between
these memory control blocks are the PSP

(0011H) specifies that 17 paragraphs are
to be protected. Before entering the program with the DEBUG "A" command,
secure a new OS designation by returning to DOS and reloading DEBUG:
-Q
A>OEBUG
-A100
;BY-I?ASS OATA

OS:0100

J'MP

110

OS:0102

OB

'STAY RESIOENT ';OATA

OS:0110

MOV

AH,31

;TSR

OS:0112

MOV

AL,Ol

;RETURN COOE

OS:0114

MOV

OX, 0011 ;SAVE 17 I?GI?H

OS: 0117

INT

21

OS: 0119



;CALL DOS

-w
Since DEBUG cannot invoke Interrupt
27H, return to DOS and execute the program.
Reload DEBUG and use the "S" command to search the first 64K bytes of
memory for the program's code. When
searching the initial 64K bytes of computer memory, you must set the data
segment (OS) to zero.
A>OEBUG
-RDS

os ????
:0000

-s

Users seem to
be divided into two
camps: those who
swear by TS Rs
and those who
swear at TSRs.

0 L FFFF EB OE 53 54 41 59 20 52

0000:61EO
0000:8F6F

Ignore the last address retieved by the
search command. If you're using DOS
2.10, the program's code begins at
0:61EOH with the PSP 100H bytes below
at 0:60EOH. To display the PSP and code,
enter:
-00:60EO,61EF

How is DOS able to keep track of resident memory allocations? The paragraph
directly below the PSP (0:60DOH) is a
memory control block. Paragraphs originate at an offset ending in zero and are
16 bytes in length. Let's explore the first
five locations of this block:
-06000,6004
0000:6000

40 OE 06 11 00

The first location of a memory control
block, called the identifier byte, contains
either 4DH or SAH. The value 4DH indicates that the memory directly above
belongs to a program ·or DOS, while SAH
verifies that no more memory control
blocks succeed this one. The value SAH

34 MICRO CORNUCOPIA, #49, Sept-Oct 1989

(16 paragraphs) and the program's code
(1 paragraph). Current DOS versions
don't use the last 11 bytes in a memory
control block so these might contain remnants of other programs.
To predict the location of the next
resident program, search above the PSP
for the memory control block beginning
with SAH. The first occurrence here is at
0:6220H. Look at the initial five bytes of
this paragraph:

When this program terminates, 16
paragraphs of PSP and one paragraph of
code will emerge as part of resident
memory. Save the program as
RES31H.COM:
-NRES31H.COM
-RCX
CX ????
:0019
-REX
BX ????
:0000

-w
Return to DOS and execute
RES31H.COM.
To determine the location of the second resident program, search with the
Debug "S" command:
A>OEBUG
-RDS
OS ????
:0000

-s

0 L FFFF EB OE 53 54 41 59 20 52

0000:61EO
0000:6330
0000:90BF

-06220,6224
0000:6220

SA 23 06 00 79

The information tells us to expect the
PSP of the next resident program to load
at segment 0623H (address 0000:6230H).
Let's install the same program a second time in resident memory, but this
time by invoking the other TSR function.
DOS version 2.00 introduced function
31H. IBM prefers this function because it
passes a return code and allows more
than 64K bytes to remain resident.
When using DOS function 31H, the
number of bytes made resident is declared (by paragraph) in the OX register.
The value stored in the OX register

As anticipated, the new resident code
begins at 0:6330H with the PSP at
0:6230H. The memory control block is located at the paragraph preceding the PSP
(0:6220H). Display the initial five bytes of
this block:
-06220,6224
0000:6220

40 23 06 11 00

The identifier byte (4DH) indicates
that a PSP follows at segment 0623H. The
length of the PSP /code is OOllH, or 17
paragraphs. Every time you execute a
TSR function, the protected memory is
"stacked" directly above the previous

~DO:O

OOO(hOOOO
0000 :'0010
0000:0020
0000;0030
0000:0040
0000:0050
0000:0060
0000:0070

7230 EB 00 47 0170 00;"C3 E2
47017000 54 FF 00 FO";23 FF
ASFEOOF087E900FO-23 FF
23FFOO.FO SS 0700 C8";S7.EF
65 FO 00 F040,F8 00FO-41F8
39E700FO 59 F800FO-2E E8
0000 00F6 92. 01·· 00 C8 .. 6E FE
49FFOOFOMFOOOFO-22 05

resident program. You can continue
stacking resident programs until you've
filled RAM.
By now, you have probably realized
how easy it is to install a program or
data in the resident portion of the computer's memory. The not-so-easy part involves activating it after it's resident. This
takes us to the subject of interrupt-handlers.
Interrupt Handlers
Interrupts tell the computer's central
processing unit to suspend what it's
doing and transfer to an interrupt handler program. The handler quickly takes
the appropriate action and then returns
control to the suspended program. The
8086/8088/80286 family supports up to
256 interrupts, classified as internal hardware, external hardware, or software interrupts.
Certain events encountered during
program operation, such as division by
zero, generate internal hardware interrupts. Peripherals, such as the keyboard,
generate external hardware interrupts.
Any program can request a software interrupt.
The initial 1,024 bytes of computer
memory are known as the interrupt vector table. Each table entry consists of four
bytes pointing to the address of its handler. Figure 1 provides the first 128 bytes
of this table for OOS version 2.10.
Each four-byte position in the table
corresponds to one interrupt type (00FFH) and contains the segment and offset of its interrupt handler. To find a particular interrupt in the table, multiply the
interrupt type by four. For example, INT
9H is stored in offsets 36-39 (0024-0027H)
and points to address FOOO:E987H in
ROM.
Our main programming interest in interrupt vectors is not to read them, but to
change them so they point to a new interrupt handling routine.
Writing interrupt handlers has the

00 F047 017000
00 FO 23 FFOO FO
00 F023 FF 00 FO
OOFO 47 017000
OOFO 5~ 0200 C8
00 FO 02 EF 00 FO
00 F0400170 00
0000 000000,00

Before you attempt to take control of
these interrupts, there are a few things
you should know. The handler can call
DOS, and DOS will perform the function,
but the handler cannot be reentered from
DOS. The last instruction of a handler
must be IRET OP, CS, and flag registers
popped). When an interrupt is invoked,
the trap flag is suspended so that you
cannot trace through a handler to locate
errors.
Each time you press or release a key,
the action reports to the ROM-BIOS via
INT 9H. The ROM routine reads port
60H to find out the selected keystroke.
The scan code and ASCII value are
stored until you press the next key.

reputation of being difficult and best left
to experts. Actually, the procedure is
straightforward. When an interrupt is invoked, the CPU pushes the flag register,
the segment register (CS), and the instruction pointer (lP) onto the stack and
disables interrupts. It then uses the interrupt number to fetch the address of the
handler from the vector table and begins
execution at that address.
The handler will enable interrupts,
save registers, and process the interrupt.
You can easily activate a resident program by modifying an interrupt vector.
Two interrupts especially qualified for
this task are the keyboard interrupt (9H)
and the user timer interrupt (lCH).

A leader in quality electronics for the
technically sophisticated customer.
When you need kit or assembled
electronic products for work, home or
hobby, you can be sure Heathkit products
are designed to perform reliably and
effectively ... year after year.
See what we have to offer. To get your
FREE Heathkit Catalog, fill out and mail
the coupon below or call toll-free today!

1-800-44-HEATH
(1-800-444-3284)

r;-----------,
Vt:S,Please send me a
copy
FREE

I ' CI • of the H~athkit Catalog.
Company, Dept. 027-814
I Send To: Heath
Benton Harbor, Michigan 49022
I ~~
II Address
Apt.
I City
Zip
I State
L _ ~b~ry~e~EI~n~02:at~
_

I
I
I
II
I
I

~8~

~.
Skill-Enhancing
Educational
Courses
and Trainers

Reader Service Number 156

MICRO CORNUCOPIA, #49, Sept-Oct 1989

35

Organize, Query,
& Make Connections
Between Files of Information

MICRO EINSTEIN
The Expert System Shell

* Create expert systems
easily In minutes
* With pulldown menus and
windows
* Automatic rule generator
.. Context-sensitive help
* Free example expert
systems
* Interactive full-screen
text editor
* DOS access from shell
.. Turbo fast execution
(NOW 5 times faster!)
For Diagnosing ...
Monitoring ...
Indexing ...
Organizing .. .
Classifying .. .
& Discovering links
between files of information.

Only $100! (Plus $5 S/H)
Reader Service Number 72

ACQUIRED INTELLIGENCE
P.O. BOX 2091 • OI\VIS.CA95617. 191617534704

36 MICRO CORNUCOPIA, #49, Sept-Oct 1989

When you take control of INT 9H,
every keystroke gets routed through
your program before being passed onto
the ROM. Most programmers select
special keystrokes to activate their resident programs.
The special control keys are ideally
suited for this role because they do not
produce characters of their own, but
change the codes generated by other
keys. The keyboard I/O interrupt (INT
16H, function 02) returns the status of the
eight keys listed in Figure 2.
For example, if you press both shift
keys, the AL register returns the value 3.
When you press all eight keys simultaneously, it returns the value 255. Testing for a definite value can activate a
resident program. Otherwise, keystrokes
are treated in the usual manner.
The user timer interrupt is taken 18.2
times per second and is invoked by the
timer interrupt (INT 8H). The vector for
Interrupt 1CH points to address
FOOO:FF49H in ROM. Use the DEBUG
"U" command to look at the first instruction of this handler:
-UFOOO:FF49,FF49
FOOO:FF49

CF

lRET

This is a dummy handler which does
nothing but execute an interrupt return.
However, control of this interrupt allows
you to continuously run a procedure in
resident memory.
TSR programs typically include an initialization procedure, a portion to redefine the interrupt vector table, and the
code that remains resident.
Normally, a program will want to
leave only part of itself resident, discarding the initialization code. Therefore,
you should organize a TSR so that the
resident portion comes at the beginning
of the program.
To demonstrate how resident programs work, I've introduced POPUP and
RENEGADE. These programs store tpe
current screen in resident memory, but
RENEGADE exerts absolute control over
the keyboard interrupt. Once the keyboard is in its grasp, RENEGADE does
not relinquish control and excludes all
other resident programs from using this
interrupt.
Introducing POPUP
Figure 3 lists the assembly language
source code for POPUP. After its installation in resident memory, activate the program by hitting both shift keys simultaneously. The first entry stores the cur-

rent screen in resident memory, while
subsequent activations pop up the stored
screen. This program assembles with
MASM.
Here's how POPUP works. The first
instruction in the code segment (JMP
INIT) bypasses the MAIN procedure and
skips to the INIT procedure. The INIT
procedure saves the old keyboard vector
and then chains INT 9H to the MAIN
procedure.
The last instruction of the INIT procedure (INT 27H) makes the ultimate sacrifice by allowing itself to be erased. It terminates the entire operation but protects
code from the start of the PSP to the end
of the MAIN procedure. Note how the
OX register points to the start of INIT
(the offset one byte beyond the protected
code).
Once installed, the MAIN procedure
becomes our interrupt handler. Every
keystroke gets intercepted by this handler and redirected to the old INT 9H in
ROM for processing. Our handler then
calls INT 16H to determine the latest
keystroke(s).
If you press both shift keys simultaneously, the processor branches to the
routine that stores the current screen.
Then, escape returns you to the current
program. The screen you just stored will
now pop up whenever you press both
shift keys. When you finish viewing the
stored screen, escape restores the current
screen.
To store a new screen, press the Alt
and right shift keys. Again, the escape
key returns control to the parent program.
POPUP saves two screens: the current
application screen you'll return to and
the stored screen. Storing a complete
screen demands a significant block of
computer memory. The storing of a color
graphic screen consumes 4000 bytes (as
configured, POPUP works with CGA
systems), whereas the entire POPUP program requires about 8200 bytes. As you
can see, the two stored screens account
for 98% of the memory allocated to
POPUP.
POPUP is an example of a well-behaved resident program; it does not attempt to sabotage other programs. But
what if you install a second resident program, and it also seeks control of the keyboard interrupt? The last program loaded
will intercept the keystrokes first, and
then chain them to the previously-loaded
TSR. A problem would arise if both programs attempted to use the same hot
keys.

VOICE MASTERKEY®
VOICE RECOGNITION
SYSTEM
FOR PC/COMPATIBLES &
TANDY 1000 SERIES
A FULL FEATURED VPICE 110 SYSTEM
GIVE A NEW DIMENSION TO PERSONAL COMPUTING ... The amazing Voice Master Key System adds
voice recognition to just about any program or
application. Voice command up to 256 keyboard macros
from within CAD, desktop publishing, word processing, spread sheet, or game programs. Fully TSR and
occupies less than 64K. Instant response time and high
recognition accuracy. Voice recognition tool-box utilities are included. A genuine productivity enhancerl
SPEECH RECORDING SOFTWARE ... Digitally record
your own speech, sound, or music to put into your own
software programs. Software provides sampling rate
variations, graphics-based editing, and data compression utilities. Create software sound files you can add
to macros for voice recognition verification response. A
complete, superior speech and sound development tool.
SOFTWARE CONVERSION CODES. . . The Voice
Master Key System operates a growing list of third
party talking software titles using synthesized phonetics (text-to-speech) or digitized PCM, ADPCM, and
CVSDM encoded sound files. Voice Master Key System
does it alii

EVERYTHING INCLUDED. . .Voice Master Key
System consists of a plug-in card, durable lightweight
microphone headset, software, and manual. Card fits
iily available slot. External ports consist of mic inputs
and volume controlled output sockets. High quality
throughout, easy and fun to use.

ON LY $149.95 COM PLETE
ONLY $89.95 FOR TANDY 1000 SUTL MODELSSOFTWARE PACKAGE ONLY.
Requires Tandy Brand Electret microphone.

ORDER HOTLINE: (503) 342-1271
Monday-Friday, BAM to 5PM Pacific Time
Visa/MasterCard, company checks, money orders,
CODs (with prior approval) accepted. Personal checks
subject to 3 week shipping delay. Specify computer
type and disk format (3W' or 5W') when ordering.
Add $5 shipping charge for delivery in USA and
Canada. Foreign inquiries contact Covox for C & F
quotes. JODAYMONEY BACK GUARANTEE IF NOT
COMPLETELY SATISFIED. ONE YEAR WARRANTY
ON HARDWARE.

CALL OR WRITE FOR FREE PRODUCT CATALOG

@

.

CO\IOX INC.

675-D Conger St.
Eugene, Oregon 97402 U.S.A.
TEL: 503-342-1271 • FAX 503-342-1283
Reader Service Number 143

MICRO CORNUCOPIA, #49, Sept-Oct 1989

37

Introducing RENEGADE
Not all resident programs are as wellmannered as POPUP. Some have been
labelled thugs, bullies, and outlaws.
What have these programs done to warrant such a reputation? When some commercial programs replace the table
address of INT 9H, they exclude all
others and do not allow concurrent use
of a resident program like POPUP. Let's
take POPUP and turn it into a bully.
Figure 4 lists the assembly language
source for RENEGADE. The MAIN procedure of this program, not presented in
its entirety in the figure, is identical to
POPUP. RENEGADE performs the same
operations as POPUP but it takes over
both INT 1CH and !NT 9H.
As mentioned previously, INT 1CH
occurs 18.2 times per second and does
nothing except return from ROM. You
can use this interrupt to monitor the vector table continuously.
The initialization portion of RENEGADE takes control of INT 1CH and
directs it to the CHECK procedure in
resident memory. You need not save the
old INT 1CH vector since it merely executes an interrupt return.
The CHECK procedure, invoked 18.2
times a second, determines whether the
keyboard interrupt is chaining directly to
the MAIN procedure in resident
memory. If another program has taken
over the INT 9H vector, the CHECK procedure recaptures it.
RENEGADE is an example of a selfish
resident program. It doesn't permit
chaining from one resident program to
another. The consequence is that it
doesn't allow other resident programs to
run. Its lack of compatibility diminishes
the worth of RENEGADE. This program
works only with computers storing their
keyboard interrupt routines at address
FOOO:E987H.
To observe RENEGADE in action,
load the program and display the vector
for INT 9H. Before executing, reboot the
system to purge any previously installed
resident programs.
A>RENEGADE
A>OEBUG

-00:24,27
0000:0024

40 20 OE 06

The vector points to the MAIN procedure at 060E:204DH. This is the address
if RENEGADE is the first TSR loaded
and you are using the DOS 2.10 version.
Now install POPUP and display the INT
9H vector again:

38

MICRO CORNUCOPIA, #49, Sept-Oct 1989

;Sanieoperation as
IVT
KEYBD

CODE
BEGIN:
OLOe

NEWKEY
SCREEN
SHIFT
STATUS
POPUP

POl?UP~ASM

but. takes over tNT lCH

SEGMENTATOH
ORG9H*4
OW 2 DUP (?)
ORG lCH*4
DW.2.DUP(?)
ENDS

;INTER.R.UPT TABLE SEGMENT
;INT 9H VECTOR
; INT . lCH VECTOR

;CODE SEGMENT
SEGMENT·PARAPUBLIC 'CODE'
ASSUMECS:CODE
ORG 100H
:GOTO INITIALIZATION ROUTINE
JMPINIT
:INT 9H ADDRESS IN ROM
LABEL DWORD
DB
87H,OE9H,OOH,OFOH ; STORE tNT 9H VECTOR
; CURRENT INT 9H VECTOR
OW 2 DUP (?)
DB 4000DUP ('S')
i STORE ORIGINAL SCREEN
DB a
iSAVESHIFT STATUS CODE
DB a
i CHECK NEW SCREEN STATUS
:POP-UP SCREEN
DB 4000DUP ('P')

,--~--------------~------

;MAIN is made resident and every keystroke routed here.
MAIN
;*****
MAIN

PMC NEAR
;NEW INT 9H VECTOR POINTS HERE
IDENTICAL TO MAIN PROC IN POPUP.ASM
*****
ENDl?

;Once installed, CHECK is invoked lB.2 times/sec.
: INT.· lCH.· vector· point here.
NEAR
PROC
;ENABLE INTERRUPTS
STl
; SAVE REGISTERS
PUSH
AX
l?USH
BX
l?USH
CX
OX
PUSH
J:'IUSH
SI
01
J:'IUSH
DS
J:'IUSH
ES
J:'IUSH
PUSH
CS
os
iSOURCE SEGMENT
J:'I0P
; DEltenruLne if .INT· 9H vector was changed
MOV
SI,OFFSET NEWKEY ;SOURCE OFFSET
MOV
AX, a
MOV
ES,AX
;DEST. SEGMENT
;DEST. OFFSET
MOV
OI,9H*4
iCOMPARE 2 WORDS
MOV
CX,2
CMPSW
REJ:'IE
; IF. MATCH, EXIT
SKIP
JE
9H.vector

MOV
STl

;DISABLE INTERRUPTS
KEYBD,OFFSETMAIN ;RElNSTATE KEYBDVECTOR
KEYBD[2],CS

JMP

MOV
MOV
MOV
MOV
STI
MOV
tNIT
CODE

KEYBD, OFFSET MAIN
KEYBD[2],CS
TIMER,OFFSET . CHECK
TIMER[2];CS

-Q
A>POPUP
A>DEBUG
-00:24,27
0000:0024

40 20 OE 06

Interrupt 9H should still point to
060E:204DH. Once loaded, RENEGADE
assures that its handler has first claim to
all keystrokes. It not only recaptures the
keyboard interrupt vector, but denies
POPUP any opportunity for activation.
What happens if two resident programs attempt similar strategies to take
over INT 1CH? The last program loaded
is the one whose handler is invoked 18.2
times per second. In this game, the program loaded last has the advantage.
Now you can appreciate why memory
resident utilities such as SideKick, SuperKey, and Prokey insist they must be
loaded last.
I tried loading SideKick, an aggressive
user of five interrupts, followed by RENEGADE. The result was chaos, with the
hot keys gIVing unpredictable and
strange screens, even though, interestingly enough, the system didn't crash.
Evicting RENEGADE
Software packages are available which
allow you to manipulate resident programs. These utilities, often referred to as
managers or organizers, are designed to
remove other programs from resident
memory without rebooting the system.
I've
included
a short
program
(EVICT. COM) to demonstrate how to
eliminate RENEGADE's grip on the keyboard interrupt.
Resident programs are distinct from
normal ones in two ways: they don't release memory blocks when terminated;
and they chain one or more interrupt
vectors to themselves. To remove RENEGADE from resident memory, you must
restore the interrupt vectors as they existed prior to its installation, and then release all its memory blocks. OOS function
49H releases memory blocks.
The ES register specifies the segment
to be released, while bytes 4 and 5 of the
memory block already contain the length
of the block. Display the following resident memory locations:
-DO:60AO,60EF
0000:60AO 40
A3
0000:60BO 50
40
0000:60CO 5C
2E

OE
BD
41
53
43
43

06
OB
54
50
4F
4F

02
Al
4B
45
40
40

00
02
3D
43
40
00

05
00
00
3D
41
00

CB
BC
43
43
4E
FF

001E
4F3A
44FF

MICRO CORNUCOPIA, #49, Sept-Oct 1989

39

0000:6000

40 OE 06 14 02 03 E8 8COA 03 C2 A3 1C OB B8 00

• SEE HOW PROGRAMS WORK
• EASILY MODIFY PROGRAMS
SOURCER ™ creates detailed commented sou·~ce code and listings from memory
and executable files. Built in data analyzer and simulator resolves data across
multiple segments and provides d.E1tailed comments on interrupts and subfunctions,
I/O ports and much more. Determines necessary assembler directives for reassembly. Includes a definition file facility to include your own remarks and descriptive
labels, force data types, and more. Complete support for 8088/87 through 80286/287
and V20!V30 instruction sets. We welcome comparisons with any other product,
because no product comes close to the ease of use and output clarity of SOURCER.

Sourcer is the best disassembler we've ever seen!
-PC Magazine, January 17, 1989, page 101

SAMPLE

resetprn.1st

Fully
automatic
Program
header

Detailed
comments

Simulator
follows
segment
changes

Easy to
read
format

28-Jun-89

2: 34 pm

Page I

PAC[ 60.132
RESETPRN
Created:
Version:
Passes:
• 0008

15.Apr.88
1.01
3
Analys15 flags on: H
: (0040:0008.37811)

equ

: •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• seg_a •••••
seg_a
segment para public
assume cs:seg_a, ds:seg_", ss:stack_seg_b

Assembler
directives

Determines
data areas
and type

Sourcer L15 t I ng

ResetPRN vl.OI

OUTPUT

658£:0000
658£:0000
6S8E:0002
658£:0008
658£: OOOE
658E :0011
658E :0013
658£:0019
658£:00IF
6S8E:0025
6S8E:0025
658E:0026
658£:0027
658E: 002A
658E:002C

resetprn
start:
EB 23
52 65
52 4E
30 31
0040
00 OA
74 20
74 65

far

j""

short loc I
'ResetPRN-vl:Ol', OOh

db

73 65 74 50
20 76 31 2E
00
52 65 73 65
50 72 69 6E
72 3F 20 24

proc

data 2
data)

40h
OOh, OAh, 'Reset Printer? S'

dw

db

push
POP.
IIIlV
Int

cs
ds
d.,offset data_3
ah,9
21h

658£:002E B4 01
658£:0030 CO 21

IIIlV
Int

ah,l
21h

658£:0032
658£:0034
658£: 0036
658£ :OOlA
6S8E:003£
6S8E: 0041
658£:0043

Cq>

al,79h
loc 3
ds,data_2
dx,ds:data_Ie
dx,2
al,8
dx,al

6S8E:0044
658£:0047
658£:0047
. 658£:0049
658£:0048

OE
IF
.BA 0013
B4 09
CO 21

3C
75
8£
88
83
BO
££

79
16
1£ 0011
16 0008
C2 02
08

Jne
IIIlv
add
IIIlV
out

B98000

cX,8000h

: (6S8E:0013.00h)
: OOS Serv Ices ah·functlon 09h

: display char string at ds:dx
: OOS Services ah·functlon Olh
get keybd char aI, with echo
: 'y'

: J""" If not equal
: (6S8E:00n.40h)
: (0040:0008.37811)
: port 37M, prlnter-2 control

: al ·8, Initialize printer

10cloop_2:
£2 F£
BO OC
££

loop
mv
out

10clooP_2
al,OCh
dX,al

mv
tnt

ah,4Ch
21h

10c_3:

658£:004C
658£:004C B4 4C
6S8E:004£ CO 21

resetprn
seg_,

: Loop If cx

>

0

: port 37M, prlnter·2 control
: al ·OCh, In It & strobe off
: 'L'
: 005 Services ah·lunetlon 4Ch

: terml na te with al·return code

endp
ends

end

CD 20 22 08 00 9A FO FF00 FO 8C 02 42 05 99 02

The memory locations beginning at
O:60DOH represent the memory control
block for RENEGADE's PSP / code.
Another memory control block appears
three paragraphs below. It begins at
O:60AOH and also points to RENEGADE's PSP segment at 060EH. This
memory control block identifies the environment.
The information stored here includes
the path and file name used to load RENEGADE. Removing a resident program
requires the release of memory blocks
belonging to the environment and the
PSP/code.
We're ready to execute EVICT (Figure
5), the program to purge RENEGADE
from resident memory. EVICT is an unsophisticated program and its sole purpose is to demonstrate how to remove a
single resident program from DOS 2.10.
For EVICT to work properly, RENEGADE must be the only TSR installed. If
necessary, reboot the system. Use the
DEBUG "A" command to enter EVICT.
The program restores the original vectors
for Interrupts 9H and lCH, then releases
the two memory blocks. Save the program, execute from DOS, and return to
DEBUG to display the two memory control blocks:
-NEVICT.COM
-RCX
CX ????

: ••••••••••••••••••••••••••••••••••••••••••••••••••••••• stack_seLb ., ••
stack_seg_b segment para stack
db
192 dup (OFFh)
stack_seg_b ends

6593:0000 OOCO[FF]

0000:60EO

:0036
-RBX
BX ????

start

:0000
(Source code output and inline cross reference can also be selected)

-w
-Q

BIOS SOURCE

• CHANGE AND ADD FEATURES
• CLARIFY INTERFACES

The BIOS Pre-Processor™ with SOURCER provides the first means to obtain
accurate legal source listings for any BIOS! Identifies entry points with full explanations. Resolves PS/2's multiple jumps for improved clarity. Provides highly
descriptive labels such as "video_mode" and much more, Fully automatic.

UN PACKER T" Unpack packed EXE files and more
ASMtooP" Assemb~ source analyzer and flowcharter

A>OEBUG
-00:60AO,60EF

for PS/2, AT, XT, PC, and Clones

SOURCER Commenting disassembler $99.95
SOURCER with BIOS Pre·Processor 139.95

A>EVICT

$39.95
89.95

0000:60AO
0000:60BO

50 41 54 48 30 00 43 4F-

0000:60CO

5C 43 4F 40 40 41 4E 44-

40 53 50 45 43 30 43 3A
2E 43 4F 40 00 00 FF FF
0000:6000

Shipping & Handling: USA $3; Canada/Mexico $10; Other $15; CA Res. add sales tax; PS/2 trademark of IBM Corp.

All our products come with a 30 day money back satisfaction guarantee. Not copy
protected. To order or receive additional information just call!

1-800-662-8266
V COMMUNICATIONS, INC.
303 t Tisch Way, Suite 802, Dept. M3, San Jose, CA 95 t 28 (408) 296·4224
Reader Service Number 62

40

MICRO CORNUCOPIA, #49, Sept-Oct 1989

40 OE 06 02 00 05 C8 00A3 BO OB A1 02 00 8C 1E

5A OE 06 F2 79 03 E8 8COA 03 C2 A3 1C OB B8 00

0000:60EO

CD 20 22 08 00 9A FO FF00 FO 8C 02 42 05 99 02

Note the identifier byte at O:60DOH
contains the value 5AH, the designation
that the next memory block is free. If you

~A100

OS:0100
OS:0101
OS:0104

os: 0106

0$:0109
OS:010C
O$.;OlOF
OS: 0110

0$:0111

os: 0114

OS:0117
OS: 0118
OS: 0119
OS:Ol1A
OS: 0110
OS:Ol1F
OS:0121
OS:0123
OS:0126
OS:0128
OS:012A
OS:012C
OS:012E
OS:0132

eLI
MOV
MOV
MOV
MOV
MOV
REPZ

MOVSB
MOV
MOV
REPZ

MOVSB
STI

MOV
MOV
MOV
1NT
MOV
MOV
MOV
1NT
tNT
OB
OB

install a new TSR, it will be stored at segment 060EH.
EVICT was a very easy program to
create. We know exactly where RENEGADE is located in resident memory and
which interrupts it controls. For DOS
2.10, EVICT removes the first TSR installed, providing Interrupts 9H and 1CH
were the only ones taken over.
The difficult assignment of writing a
general utility is to keep track of where
each TSR is loaded and the interrupt vector table prior to installation.
Consider the scenario of installing RENEGADE followed by POPUP, and then
executing EVICT to remove RENEGADE:
A>RENEGADE
A>popup
A>EV1CT

The memory control block defining
RENEGADE's PSP is modified and can
be viewed with DEBUG:
A>OEBUG
-00000:6000,6004
0000:6000

40 00 00 14 02

The identifier byte prevails as 4DH;
however, bytes 2 and 3 are filled with
zeros. RENEGADE has been purged
from resident memory and its memory
blocks. released. The next TSR is not
stored in this vacated area, but immediately following the memory control block
containing SAH. A "hole" develops in
resident memory and all newly-installed
TSRs are placed above POPUP.

Software packages are available that
can disable, and later enable, a resident
program. These utilities are resident programs that save entire interrupt vector tables prior to the installation of every TSR.
To disable a resident program, all interrupt vector tables, except one, are
loaded in the same order they were
saved. The address of the disabled program will be excluded from the chaining
of one handler to the next. Although the
code remains in resident memory, the
program has no mechanism for activation.
Reenable the dormant TSR by reinstating, in the proper order, the excluded
interrupt vector table.
In Closing
As the number of TSRs continues to
multiply, a set of guidelines would be
helpful. Since IBM and Microsoft are not
providing leadership in setting standards, the major software developers
should. Some suggestions for guidelines
include the assignment of hot keys, designation of interrupts to be taken over,
chaining strategies from one handler to
another, and procedure for removal of
resident programs.
Will it ever work? It seems unlikely.
The technology is changing too fast. By
the time a set of standards are proposed
and accepted, they'll probably be outdated. Until all TSRs can coexist peacefully, the best hope is for all of us to stay
informed.

•••

CAN
Print PostScript
Language
Text and Graphics
On~~o~ANY Printer

GoScript Software, the Low-Cost
PostScript Language Printing Solution
Choose the one that fits YOUR needs:
GoScript - $195 - With 13 Fonts!
GoScript Plus - $395 - With 35 Fonts!
Both Include our High Quality, Scalable Outline Fonts

*Includes Drivers for: NEC Pinwriter;
HP LaserJet, DeskJet, PaintJet;
Canon LBP-811, BubbleJet BJ130;
Epson LQ and FX; Toshiba 24-Pin;
Fujitsu DL 24-Pin; Panasonic KX 24-Pin;
IBM Pro Printer, Quickwriter, Quietwriter

ORDER TODAY!

Contact Your Local Dealer
or call the LaserGo Order Line
(800) 451-0088 (outside Calif.)
In Canada, Contact: COP Communications,
Toronto, ON, TEL: (416) 323·9666 FAX: (416) 323-3878
Exclusive European Distributors: Graphic Sciences Ltd.,
Surrey, England TEL: (01) 940-9480; FAX: (01) 948-2851

LLaserGo, Inc

(~

V

TEL: (619) 530-2400
FAX: (619) 530-0099

9235 Trade Place, Suite A, San Diego, CA 92126

laserGo. GoScnpl arelrademarks of laserGo, Inc. PostScript® IS a registered trademark of
Adobe Systems, Inc. All other product names are trademarks of their manufacturers.

144

MICRO CORNUCOPIA, #49, Sept-Oct 1989

41

Low Cost 1/0 For The PC
A/D Boards Hit The Cheap Seats

Bruce checks out three inexpensive multipurpose I/O boards to see if they measure
up (and if so, how fast they do it). PIllS he
covers signal conditioning and board testing.
n past issues, I've tried to show you
how to build your own hardware
from chips, boards, wires, and solder.
If no one makes what you need, or if
you're trying to save money, or if you
want to learn how to build circuits, then
"rolling your own" is a great method.
Often, though, it's almost impossible
to justify building it yourself. "If they
make it in Taiwan," a saying goes,
"chances are you can buy the board built
and debugged for less than the cost of
parts."
Low-cost data acquisition boards for
the PC are a recent addition to the "it's
cheaper to buy it than build it" phenomenon. Over the years, I've watched the ads
for analog-to-digital (A/D) cards, and
I've suddenly started seeing products in
the $300 range which are too impressive
to pass up.
In the first part of this article, I'll discuss some of the features of the boards
I've tested. In the second part, I'll
complete the demystification of the
boards (and the electronics) you'll need
to interface them to the real world.

I

What You Get
Most of these A/D boards begin with,
but contain much more than, just an A/D
converter. They try to solve everyone's
problems, which can be an obnoxious
trait in some people, but an ideal feature
for a computer. In general, look for
boards which provide• multiple channels of A/D input
(usually a single multiplexed converter),

• several channels of digital-toanalog (D / A) conversion,
• and a number of digital I/O lines.
Often these boards will come with one
or more counter/timers. For many situations, you'll only need one of these
boards, your PC, and some simple electronics (described later).
The boards I'll talk about represent
what's available in the $300 price range.
I've tested three different products from
four different companies (I'll explain
shortly). All three can convert A/D, but
beyond that they differ widely.
Real Time Devices, a company in
Pennsylvania, builds and markets the
AD1000 (along with several other interesting, very low-cost cards). The AD1000
has 8 channels of 12-bit A/D with a 20
microsecond conversion time.
Take the inverse to convert that to
speed. A microsecond is 10-6, so 1
divided by a microsecond is 106, or a
megahertz. 20 microseconds translates to
1/20 megahertz; or 50 kilohertz. The
AD1000 contains 24 lines of digital I/O
and 3 counter / timers, and comes in
faster versions (for more money).
While snooping around for boards, I
found two companies (and I'm sure there
are more) that market the same board. Bo
Ray at Rapid Systems (in Seattle) made
no bones about it-"It's a good board,"
he said, "but the key to customer success
isn't just selling the board, it's helping the
customer solve the problem."
Advantech (in Taiwan) manufactures
the PCL-712 (soon to be the new, improved PCL-812). Both Rapid Systems
($395) and Halted Specialties ($295) sell
it.
Rapid Systems has a larger array of
products, some they designed and built
themselves. And their technical support
seems top notch, which might explain the
higher price. Halted Specialties, though,
seems friendly and competent.

42 MICRO CORNUCOPIA, #49, Sept-Oct 1989
--------

-------------

I'd probably opt for Halted if I were
counting dollars and building a simple
application. For bigger, more complex
projects, 1'd consider Rapid Systems (for
more thorough technical su pport and
slightly better documentation).
The PCL-712 has 16 12-bit A/D channels, two D / A channels, 16 separate digital input lines and 16 output lines, and 3
counter/timer channels (only one of
which is available to the user). The other
two channels are used for something
called a pacer, which isn't explained very
well but seems to be a way to trigger
A/D conversions automatically. You'll
need to talk to someone's tech support if
you want to figure out exactly how this
works.
The third product I looked at was the
Lawson Labs Model 140 IS-bit Analog
Interface (for $265). This doesn't have all
the digital I/O or counter/timers that the
other boards do, but it does have a much
higher resolution (15 bits vs. 12). It's a
differential A/D while the others are
single-ended. (I'll explain the terms
shortly.) With this board you get more
accurate, albeit much slower, readings
(7.5 or 15 readings per second, instead of
30,000 or 50,000 readings per second).
A Complaint

In past years, I've worked with
several A/D converter boards and I'm always playing sleuth just to figure out
how to use the boards. That's because I
never get complete documentation. I assume the person who created the documentation is the same engineer who designed the board. "Here are the data
sheets, the rest is left to the student."
It's disappointing to see that boards
for the PC follow the same traditions as
those for more obscure busses. Some
packages provide key information from
the data sheets for the chips on their
boards; some reproduce the data sheets.

By Bruce Eckel
Revolution2
501 N. 36th Street, Suite 163
Seattle, WA 98103

Unfortunately, none of the three boards
I'm taking a look at in this article come
with a schematic!
All the boards I've worked with in the
past had crummy documentation, but at
least they had schematics so I could
puzzle out what was going on (although
I would prefer lucid prose). If these companies provided better documentation
with the boards, they'd have more (and
happier) customers.
The "best" documentation comes with
the Real Time Devices board. Although
the printed material only consists of data
sheets for the chips (which are hard to
use without a schematic), the disk contains quite a bit of useful information. It
includes sample programs in BASIC, Pascal and C, and a special programming
language based on FORTH. The other
boards had drivers or examples in BASIC
only.
Board Applications
The four sections of the board (A/D,
0/ A, digital I/O, counter/timer) serve
four purposes. The A/D converter accepts a voltage from the outside world
and digitizes it (converts it into a number). The 0/ A converter converts a number into a voltage.
A digital control system uses both
AID and 0/ A: the AID measures a
voltage which represents something
about the device being monitored (for instance, its temperature); the 0/ A sets a
voltage that controls the device. The programmer must write an algorithm which
performs the control but doesn't make
the system unstable.
A/D and 0/ A conversion are commonly used alone, without being in a
control system. You may simply want to
monitor some values in an experiment or
process with your A/D. Or you might
replace a level control with a 0/ A so you
can change the level with your computer
instead of by hand.

You can't just
hook a wire
between the
monitored device
and the lID board.

You can use the counter/timer (as the
name suggests) as a counter or as a
timer. You'll use a counter (usually) to
count some outside event, such as the
number of times a beam of light is
broken. Use a timer to set up a PC interrupt so that you can do something at
predetermined intervals. In a control system, it's usually very important that you
take samples or apply the control signals
at regular intervals.
Use the digital I/O to read thresholds
and to throw switches. If you just want
to tum something on or off, or see if a

value is above or below a certain level,
digital I/O is the way to go.
All the above functions sound great,
but a lot of people become confused
when they realize they aren't just hooking up a stereo. You can't just hook a
wire between the monitored device and
the I/O board. You have to perform
something called signal conditioning
first, so you give the board a value it's
capable of measuring (that won't fry a
chip).
Digital Inputs
All digital inputs and signals to the
counter must be TTL signals unless the
documentation
specifies
otherwise.
Roughly, this means that voltages between a volts and 0.8 volts will be interpreted as a logical zero. Voltages between 2.4 volts and 5 volts will be interpreted as a logical one. (Between 0.8 and
2.4V is undetermined.) If the inputs
exceed 5 volts or drop below a volts, you
can damage the hardware.
The challenge of conditioning the digital input signals is to take the voltage
from the outside world and tum it into
something the board can make sense of
(and which won't do damage). We can
do this easily with a voltage divider (see
Figure 1).
A voltage divider is simply two resistors in series. We connect the bottom resistor to ground, and the top to the input
voltage. The center point will be somewhere between the input voltage and
ground. You can adjust its value by
changing the values of the resistors.
Either check it with a voltmeter or use
the equation:
Vout

= Vin *

(R2 /

(Rl

+

R2»

A voltage divider only works if the
input voltage doesn't go below zero,
since it only reduces the magnitude of
the input voltage. The voltage divider
MICRO CORNUCOPIA, #49, Sept-Oct 1989 43

doesn't prevent the input voltage from
going negative.
If the input signal goes below ground,
you can fix it with a simple op-amp circuit called a differencial amplifier (see
Figure 2). Op-amps, or operational amplifiers, are inexpensive amplifiers on a
chip which are indispensable for all types
of signal conditioning. (I've introduced
op-amps in my book Computer Interfacing
with Pascal & C, available from Micro
Cornucopia for $30.)
Digital Outputs
The signals from digital output lines
are also usually TTL signals. This means
that whatever device you tum on and off

relay or a TRIAC or solid-state relay (see
Chapter 6 in Computer Interfacing with
Pascal & C).
Measurements Versus Signals
To understand analog signal conditioning, you must know whether you
want to simply take a measurement (for
example, getting the temperature) or capture a signal (as in capturing the
waveform of someone's voice).
Taking a measurement is a simple
process to manage-filter out as much
noise as possible from the input signal
and then take a measurement whenever
you want. The speed of the AID converter usually isn't critical when you're

there's any appreciable change. However, if the signal changes quickly (for a
fast or noisy waveform), it may change
between bits, messing things up appreciably. To prevent this, you must: (1) filter
the input signal to remove noise; and (2)
use a sample-and-hold before your AID
converter. Luckily, both the ADI000 and
the PCL-712 (which use successive-approximation) have a built-in sample-andhold. I'll go into filtering shortly.
The Lawson Labs board uses a dualslope AID conversion technique. This
charges a capacitor with the input voltage for a known period of time, then discharges it with a known voltage while
counting the discharge time. When the

AVAlLA8t.£ .IN .... SINGLE

PACI(Act (e.g. l1P 120)

r--:----"'---:~......--+-..,

I

I

with the digital output must not only
react properly to TTL voltage levels, it
must also not require more current than
the digital output can provide.
If you're driving some other TTL or
CMOS chip, things will usually work just
fine. If you try to power a relay or some
other piece of hardware which requires
more current or more voltage, you'll
have to amplify the output.
You can change both the maximum
vol tage and the maximum current to be
switched by the output line. A common
approach uses a Darlington transistor
(i.e., two transistors ganged together to
provide high current throughput) and a
diode (which allows inductive currents to
flow in the other direction when the transistor shuts off-see Figure 3).
You can obtain inexpensive Darlington transistors with both transistors in a
single package (the TIP120 is common),
or with a gang of Darlingtons in a single
IC package. Siliconix makes a device to
replace the Darlington and the diode
called a FETlington, part 2N7000.
Notice that both Darlingtons and
FETlingtons only allow current flow in
one direction (which is okay, since you're
usually just using DC). If you're switching an AC signal, you'll have to use a

44

MICRO CORNUCOPIA, #49, Sept-Oct 1989

taking measurements, and the time between measurements may not be too important.
Capturing a waveform is a whole
different can of sine waves. For one, you
must sample the waveform at regular intervals (thus the need for the timer on the
I/O board). Also, the sampling rate must
be at least twice the highest signal
frequency (this is the "Nyquist
frequency"; even higher sampling rates
are usually better). This means that for a
voice signal, most of which is less than 10
KHz, your sampling rate would be at
least 20 KHz.
High-speed AID converters usually
use a "successive-approximation" technique. They test the signal to see if it's
above or below the halfway point of the
full voltage range (which establishes the
most significant bit of the result). If the
input is above the halfway point, the
value of the halfway point is subtracted
and the remainder tested to see if it's
above or below the quarter-way point
(which establishes the penultimate bit).
This goes on until it establishes all the
bits, at which time the conversion is
complete.
If the input signal changes very
slowly, the conversion occurs before

capacitor is empty, the discharge time is
proportional to the input voltage. This
method is also called integrating.
Because it integrates, it ignores noise
and doesn't have the problems associated
with the successive-approximation converters. So you don't need a sample-andhold, and you often don't need a filter.
However, a dual-slope converter is slow,
though you get much greater resolution
(number of bits). The Lawson Labs board
is appropriate for taking high-accuracy
measurements, but not for capturing
waveforms.
Filtering
If you use a successive-approximation
converter with a built-in sample-andhold, you only need to worry about: (1)
voltage level adjustments; and (2) filtering out noise and frequencies higher than
those you wish to capture.
Common filters are high-pass, which
pass frequencies above a certain point,
low-pass, which pass frequencies below a
certain point, and band-pass, which only
pass frequencies within a specified range.
Generally we describe the quality of the
filter by the "sharpness" of the corner(s)
between the pass band and the stop
band.

C CODE FOR THE PC
source code, of course

NEW!
NEW!
NEW!
Updated!
NEW!
NEW!
Updated!

MS-DOS File Compatibility Package (create, read, & write MS-DOS file systems on non-MS-DOS computers)
Bluestreak Plus Communications (two ports, programmer's interlace, terminal emulation) . . . . . . . . .
C+O Data Structures Libra~ (multiple inh.eritance, messaging, excpetion handling, call-back) . . . . . . .
dB2c (dBase-to-C translator; mcludes dB_FlIes for C anddB_Thols for C). . . . . . . . . . . . . . . . .
pBase (relational DBMS with ~ebugging cal1s and spa.rse table & repeated field support)
CQL Query System (SQL retnevals on B-trees plus wmdows) . . . . . . . . . . .
GraphiC 5.0 (high-resolution, DISSPLA-style scientific plots in color & hardcopy) . . . . . . . . . . . . . . . . . . . . . .
PC Curses (Aspen, Software, System V compatible, extensive documentation) . . . . . . . . . . . . . . . . . . . . . . . .
Code Base (database manager, dBase and Clipper compatibile indes & data nles; Version 4.0). . . . . . . . . . . . . . . . . .
MEWEL (extensible window and even~ library by Magma Software; message-passing & object-oriented; SAA~compatible; dialog editor)
Thrbo1EX gRelease 2.0; HP, PS, dot dnvers; CM fonts; La1BX; MetaFont) . • . . . . . . . . . . . . . . . . . . . . . . . .
Greenleaf ata Windows (windows, menus, data entry, interactive form design; specify compiler) . . . . . . . . . . .
Greenleaf Communications Ubrary (interrupt mode, modem control, XON-XOFF; specify compiler) . . . . . . . . .

NEW! ~~rl~<;0C~~buu~~a~Mr~e ~~le~ti~n. o~.~at.h~m~ti.cs,. g~a~hi.cs: d~s~la: ~ ~~.su.br~u.ti~e~ r~r ?-:n:~/CAE/CNC)

~+tree y§~

NEW!
Updated!
Updated!
Updated!
NEW!

Updated!

Updated!
NEW!

NEW!

CB'free
dnver, multIple vanable-Iength keys) . . . . . . . . . . . . . . . . . . . .
AT BIOSDKit (rol1 your own BIOS with this complete set of basic inl?ut/output functions for ATs) . . . . .
Greenleaf Functions (296 useful C functions, al1 DOS services; specIfy compiler) . . . . . . . . . . . .
WKS Ubrary Version 2.0 (C program interface to Lotus 1-2-3, dBase, Supercalc 4, Quatro, & Clipper) . . .
OS/88 (U •• x-like operating system, many tools, cross-development from MS-DOS) . . . . . . . . . . .
ME Version 2.1 (programmer's editor wIth C-like macro language by Magma Software; Version 1.31 stilI $75)
VTEK 4.3 (termmal emulator; VT102/100/52 & 'll:k 4010/14/15; LIM 4.0; 26 printers; Kermit & XMODEM)
Vmem/C (virtual memory manager; least-recently used pager; dynamic expansion of swap file) . . . . . .
Thrbo G Graphics Ubrary (al1 popular adapters, hidden line removal) . . . . . . . . . . . . . . . . .
ThrboGeometry (library of routines for computational geometry) . . . . . . . . . . . . . . . . . . . .
Install 2.3 (automatic installation program; user-selected partial mstallation; CRC checking) . . . . . . . .
TE Editor beveloper's Kit (ful1 screen editor, undo command, multiple windows) . . . . . . . . . . . . .
Minix Operating System (Version 1.3; U ..x-like operating system, includes manual) . . . . . . . . . . . .
Hyper'Thxt Viewer (simple hypertext system; multi-file documents; includes Tiny Curses) . . . . . . . . . .
PC7IP (CMU/MITTCP/lP for PCS; Ethernet, Al?pletalk & NETBIOS drivers, RVD, update by Dan Lanciani) .
B-1l"ee Library & ISAM Driver (file system utilitIes by Softfocus) . . . . . . . . . . . . . . . . . . .
The Profiler (program execution profile tool) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
QC88 C compiler (ASM output, small model, no longs, floats or bit fields, 80+ function library) . . . . . . . .
Otter 1.0 (beautiful theorem-prover by Bill McCune; includes manual & two books by Wos; complete starter kit) .
C Windows Tholkit (pop-up, pul1-down, spreadsheet, CGA/EGA/Hercules) . . . . . . . . . . . . . . . .
lATE Async Terminal Emulator (includes file transfer and menu subsystem) . . . . . . . . . . . . . . . .
Polyglot Usp-to-C 1ranslator (includes Us\, interpreter, Prolog, and simple calculus prover)
MultiDOS Plus (DOS-based mu~tit~sking, mtertask messaging, semaphores) . . . . . . . . .
Mak~ ~macros, all languages, bUJIt-m rules) . . . . . . . . . . . . . . . . . . . . . . .
eval() C function to evaluate ASCII infix expression string; 17 built-in functions) . . . . . . .
XT BI S Kit (roll your own BIOS with this complete set of basic input/output functions for XTs)
Professional C Windows (lean & mean window and keyboard handler). . . . . . . . . . . .
Heap Expander (use LIM-standard expanded memory as an extension of the heap) . . . . . .
Ip (flexible printer driver; most popular I?rinters supported) . . . . . . . . . . . . . . . .
SYSKIT (rommable or TSR debug/momtor; easily expanded) . . . . . . .
Quincy (interactive C interpreter) . . . . . . . . . . . . . . . . . . .
Symtab (general-purpose symbol table construction and management package)
P1ree (general-purpose parse tree construction and management package) . . . . . . . . . . .
Coder's Prolog (Version 3.0; inference engine for use with C programs) . . . . . . . . . . . .
Async-'ll:rmio (Unix-compatible general terminal interface for MS-DOS . . . . . . . . . . . .
Backup & Restore Utility by Blake McBride (multiple volumes, file compression & encryption) . . . .
SuperGrep (exception~l1y fast, revolutionary tex~ searching algorit~m; also searches sub-directories) . .
OBlASM (convert .0bJ files to .asm files; output IS MASM compatIble) . . . . . . . . . . . . . .
Polyglot TSR Package (includes reminder, bOokmark, virus catcher, cache manager, & speech generator)
Multi-User BBS (chat, mail, menus, sysop displays; does not include modem driver) . . . . . . . . .
Fortran-to-C 'll"anslator by Polyglot . . . . . . . . . . . . . . . . . . . . . . . . .
Virtual Memory Manager by Blake McBride (LRU pager, dynamic swap file, image save/restore) . . . . . . . .
H.eap I/O (~reat al1 or part of a d,isk fil~ as ~eap storage) . '. . . . . . . . . . . . . . . . . . . . . . . . .
BIggerstaff s System Thols (multi-tasking wmdow manager kIt) . . . . . . . . . . . . . . . . . . . . . . .
OOPS (collection of handy C+ + classes by Keith Gorlen of NIH; Version 2.2) . . . . . . . . . . . . . . . .
Bison & PREP (YACCworkalike parser generator & attribute grammar preprocessor; now includes documentation)
PC-XJNU (Comer's XINU operatmg system for PC) . . . . . . . . . .
CLIPS (rule-based expert system generator, Version 4.2) . . . . . . . .
Tiny Curses (Berkeley curses package) . . . . . . . . . . . . . . . .
Polyglot RAM Disk (change disk size on the fly; includes utilities) . . . . .
Clisp (Usp interpreter with extensive internals documentation) . . . . . .
'll"anslate Rules to C (YACC-like function generator for rule-based systems)
6-Pack of Editors (six public domain editors for use, study & hacking) . . .
Crunch Pack (14 file compression & expansion programs) . . . . . . . . . . . . .
Pascal P-Code Compiler & Interpreter or Pascal-to-C 1hmslator (Wirth standard Pascal)
ICON (string and list processing language, Version 7.5) . . . . . . . . . . . . . .
FLEX (fast lexical analyzer generator; new, improved LEX; Version 1.1) . . . . . . .
LEX (lexical analyzer generator; an oldie but a goodie) . . . . . . . . . . . . . . . .
Auto'1race (program tracer and memory trasher catcher) . . . . . . . . . . . . . . .
Data Handhng Utilities in C (data entry, validation & display; specify Thrbo C or Microsoft)
Arrays for C (macro package to ease handling of arrays). . . . . . . . . . . . . . . .
A68 (68000 cross-assembler) . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ust-Pac (C functions for lists, stacks, and queues) . . . . . . . . . . . . . . . . . .
XLT Macro Processor (general purpose text translator)

Data

NEW!

.
.
.
.

$500
$400
$375
$325
$325
$325
$325
$290
$260
$250
$250
$220
$175
$170
$170
$165
$160
$160
$155
$150
$140
$135
$140
$135
$125
$120
$105
$105
$100
$100
$100
$100
$90
$80
$80
$80
$80
$80
$75
$75
$75
$70
$65
$65
$60
$60
$60
$60
$60
$55
$50
$50
$50
$50
$50
$40
$40
$40
$40
$35
$35
$35
$35
$35
$30
$30
$30
$30
$30
$25
$25
$25
$25
$25
$25
$25
$20
$20
$20

Protein Sequences (over 10,000 sequences; includes demo disk of Pearson FAST/A programs) . . . . . .
Smithsonian Astronomical Observatory Subset (right ascension, declination, & magnitude of 258,997 stars)
Moby Words (500,000 words & phrases, 9,000 stars, 15,000 names) . . . . . . . . . . . .
U. S. Cities (names & longitude/latitude of 32,000 U.S. cities and 6,000 state boundary points) .
The World Digitized (100,000 longitude/latitude of world country boundaries) . . . . . . .
KST Fonts (13,200 characters in 139 mixed fonts: specify 'lEX or bitmap format) . . . . . .
USNO Interactive Computer Ephemeris (high-precision moon, sun, planet & star positions)
NBS Hershey Fonts (1,377 stroke characters in 14 fonts). . . . . . . . . . . . . . .
U. S. Map (15,701 points of state boundaries) . . . . . . . . . . . . . . . . . . .

$60
$60
$55
$35
$30
$30
$30
$15
. . . . . . . . . . $15

The Austin Code Works
acwlinfo@uunet.uu.net
11100 Leafwood Lane
Austin, Texas 78750-3409 USA
Free surface shipping for cash in advance
For delivery in Texas add 7%

Voice: (512) 258-0785
BBS: (512) 258-8831
FAX: (512) 258-1342
MasterCard/VISA

Reader Service Number 4

MICRO CORNUCOPIA, #49, Sept-Oct 1989

45

There are two common ways to build
filters. Passive filters consist of resistors,
capacitors, and (in some situations) inductors. Simple low-pass filters are cheap
and easy to make from resistors and
capacitors (see Figure 4), but they don't
have very sharp comers and are thus appropriate only when the frequency elements you want to remove are far into
the stop band.
For example, if you want to sample a
DC signal you'd commonly use a lowpass RC filter to remove 60 Hz noise
generated by household AC power. The
optional connector boards which come
with both the AD1000 and PCL-712 have
spaces on the circuit board where you
can solder resistors and capacitors to
form low-pass filters.
Active filters use op-amps, resistors,
and capacitors. Active filters are much
more precise and have much sharper
comers than passive filters, so the
frequency elements you want to remove
can be much closer to the frequency elements you want to keep.
Op-amps are fairly cheap, so an active
filter isn't much more expensive than a
passive filter, although the design of an
active filter is slightly more complex. An
excellent tutorial on both passive and active filter design is Introduction to Filter
Theory by Johnson, Hilburn and Johnson.
You can now buy a switched-capacitor filter, which fits on a single chip.
Since it's less susceptible to the drift
found in ordinary components, it's more
accurate over long periods of time.
Single Vs. Double-ended Converters
Both the AD1000 and the PCL-712
have "single-ended" inputs, while the
Lawson Labs board has "differential" inputs. Single-ended inputs are signals referenced to a common ground. The Real
Time Devices board, for example, has 8
single-ended inputs, which means that
all the input signals must have their
grounds tied together.
In many situations, this works just
fine-you may have a group of signals
which already have their grounds connected. Here, you simply take the ground
from these signals and tie it to the
ground on the I/O board.
In some situations, however, you
might be measuring a signal between
two points, neither of which is ground.
Or, you may not be able to tie grounds
together. Here you'll need to use a differential converter, which measures the
voltage between two points. A singleended converter also measures the volt-

46

MICRO CORNUCOPIA, #49, Sept-Oct 1989

age between two points, but one of those
points is always the common ground.
Common-mode Signals
The ideal differential converter will
measure the precise voltage between two
points.
However, even though neither of the
converter's inputs connects to ground,
the converter itself has a connection to
ground. Let's say that you're measuring
a signal that's 6V and 5.8V. The converter
will output 0.2V, the difference. But
there's another voltage to deal with, the
common-mode voltage. It's the average
voltage between ground and the two inputs (5.9V here).
Common-mode voltage causes errors
in the digital value of the converter. This
error is specified (in both differential converters and differential amplifiers) as the
. common-mode rejection ratio (CMRR). A
CMRR of 106 means that the device
processes one volt of common mode as
though it were a differential signal of 1
microvolt at the input.
Often, instrumentation amplifiers (opamps designed for use in a differential
configuration for instrumentation) have a
much better CMRR than an A/D converter. In addition, they'll take a differential signal and turn it into a voltage with
respect to ground. Thus, with one device
you reduce the common-mode error and
allow a single-ended board to read a
differential signal.
Input Impedance
There's another reason you may want
to use an instrumentation amplifier at the
front end of your system. An instrumentation amplifier has an especially high
input impedance. The input impedance
is what the amplifier looks like to the circuit it measures.
In effect, when you measure something, you attach a resistor to ground at
the point you're measuring. If the value
of the resistor is low, a lot of current will
be drawn from the circuit and the behavior of the circuit will change. This
means you won't see the real behavior of
the circuit while you're measuring it.
It also means that the ideal input impedance of the system you use to perform measurements should be infinite so
you don't draw any current from the circuit being measured~
Practically, however, no amplifier has
an infinite input impedance, and many
circuits aren't affected if you remove a
little current. In a circuit where current
drawn by the measuring system causes

significant errors, you should use an instrumentation amplifier to maximize
your input impedance.
I

Dynamic Range
Dynamic range refers to the largest
and smallest values a system can
measure. If you have a 12-bit converter
and the largest value. you want to
measure is 100 volts (obviously this signal would have to be conditioned before
handing it to the converter), and you
want to resolve values down to 0.01 volt,
then you have a dynamic range problem.
Your converter will need 10,000
counts to measure up to 100 volts in 0.01
volt increments, and a 12-bit converter
only has 212, or 4096, counts. To solve the
dynamic range problem, some boards
allow you to change the gain of the input
amplifier; you use a lower gain for
higher voltages, and increase the gain
when the voltage is lower.
Some boards require you to use a
jumper to set the gain (which isn't a very
flexible solution). Real Time Device's
AD100/500 12-bit analog input boards
have software-prcgrammable gains so
you can change the gain according to the
signal. Instrumentation amplifiers often
have programmable gains, so if you
build your own l front end, you can use
some of the board's I/O lines to control
the amplifier gain.
Grounding & Ground Loops
Digital folk harbor an illusion (actually it's one of several) that "ground is a
volts." In truth, currents flow through
ground wires and traces. Any time current flows, there's an associated voltage
drop. In a ground path, this voltage is
generally very small. However, if you're
measuring tiny voltages, the voltages in
the ground path can show up in your
measurements and cause errors. We call
this problem a ground loop.
Here's what happens. Suppose you
have a long ground trace on a circuit
board. One end of the trace, which I'll
call downstream, dumps into the power
supply ground. Somewhere in midstream, some digital chip grounds attach.
When these chips switch, they dump current into the ground and raise the voltage
at that ground point (and every point upstream) by p fraction of a volt.
Now suppose you attach the ground
of an input amplifier upstream from the
digital chips. The input amplifier, along
with the input voltage, uses the ground
to determine the output voltage of the
amplifier. Thus, if the ground changes,

the output voltage changes. When you're
squinting at small input signals, the effect
can be significant.
There are several guidelines you can
use to eliminate ground loop problems(1) All ground traces should be as
large as possible.
(2) Analog and digital grounds should
be separated by providing completely
separate paths to the power supply.
(3) And, if possible, all critical chips
should have their own traces to the
power supply ground, or to a single
point where all the ground traces meet.
Simple Test: Digitize A Battery
You can easily test an A/D converter
board by using it to digitize a 1.5 volt
flashlight battery. You can hook the
battery directly to the inputs of most
boards, since 1.5 volts is usually within
the range of a typical board.
Then write a very small piece of code
to read the value of the A/D converter
and print it to the screen. When trying to
solve a problem which involves both
hardware and software, I find it useful to
start with something simple so I can see
if my problems are hardware or software. Assuming you hook up the .battery
to the board correctly and the board is
operational, the problem you find with
this configuration will always be in hardware.
Since a battery is such a quiet, stable
source of input, any noise in the least-significant bits of the conversion will almost
always be due to problems in the design
of the board.
A Gotcha
Although boards with A/D converters on them have become very cheap,
you're in for a surprise when you try to
calibrate one. The manufacturer will calibrate the board, but it's best to test them
when they arrive. All boards eventually
drift out of spec and you need to recalibrate them.
The problem is that calibration requires equipment which is usually unavailable to the average user. For a 12-bit
A/D converter, you need a calibrator
with overall accuracy better than 60 ppm
(parts per million) and a 5 1/2 digit digital voltmeter (DVM). Thus, the board
may be under $300 but the equipment
necessary to calibrate it can cost thousands. (I'm a novice when it comes to
calibration, but it seems like you could
get by with the DVM and a couple of
standard cells). Some manufacturers will
recalibrate the board for you, for a fee,

.............
.............
.............

and some commercial laboratories offer a
calibration service.
Future Things
Next issue (I/O Yet Again), I plan to
apply all the information I've told you
about here. The example I have in mind
is to capture a voice waveform from a
microphone, display the waveform on
the screen, and then show the frequency
components of the waveform by doing a
fast Fourier transform.
Until then, pleasant dreams and good
filtering.

Editor's note: I've noticed that everyone
does fast Fourier transforms these days. I
wonder if they're anything like the (much)
slower Fourier transforms we did by hand in
engineering lab.
Products Mentioned
Halted Specialties
PCL-712
$295
3500 Ryder Street
Santa Clara, CA 95051
(800) 4-HALTED Outside California
(408) 732-1573 Inside California
Rapid Systems
PCL-712
$395
433 N. 34th St. Seattle, WA 98103
(206) 547-8311
Real Time Devices, Inc.
AD1000
$295
P.O. Box 906
State College, PA 16804
(814) 234-8087 FAX 234-6864
Lawson Labs Model 140
from Personal Computing Tools
as the ACCUE-140
$265
17419 Farley Road
Los Gatos, CA 95030
(408) 395-6600 FAX 354-4260

•••

"/.et\Oc.o~'len

r:::
0
:;:i
ro

U

a.

u

>
CL.
CI

U

CI
C

CI)

>C

'c::J
E
en E
a> 0

C>
L..

U

$79."95
()

a..

a> >
a.

P.....

o.

0
ro-.::

o.L..

E
a>
o.c:
u(5

~o
COLO

ro
·c
en .c:
u a>

-M

~

>0
en .....
..... ro
~E

ro

~
\t=

L..
::J

en

.....
en .c:

.~
0 =0
> L..
a> a>
a> :0.. Ol
C>
0..
::J
.....> >ro .....
L..
a>
L..
a. en

~
c

0
0

~
c

0
0

.....
C

0
0

L.. L..
:J a>

o

:>

oa.._en
0 .
I ..............

>a>ro
o..~

o

L..

E

L..

o~o

0c"O~
......... -

a> ro (J)
X
a>.L.."O

................................................
................................................
................................................

{oduce 'Oes\

~

\"(\e

sc~

~\'(\\S ~

ee{\ ~

XENOFONT $49.95

IZ

oLL
o
Z

W

><
...............................................
...............................................
...............................................
...............................................
...............................................
To Order Contact:

2210 SIXTH STREET
BERKELEY, CA 94710

(415) 644-9366

uS. Fundi Only
M.C/Vou/C.CO
S5.00S/HU.SA
S1000C.n.d.,M•• ,co
S1500e*uwhllfe
S.*esTul'CA.

Reader Service Number 39

MICRO CORNUCOPIA, #49, Sept-Oct 1989

47

Schematics

Micro Cornucopia

MICRO CORNUCOPIA XT SCHEMATIC
IT1

X

IT1

z

M
;0

M
;0
»
I
»
0

x

z

»
r
0

0

»
-I
»

CD

C

;0
IT1
C/)
C/)

C

CD
C/)

C/)

At last you can plumb the mysteries of your computer with this single sheet schematic of the
IBM Xl's main board. A wealth of information for both True Blue and clone owners.
Need to know just how a non-maskable interrupt occurs (and how to mask it)? Is your
keyboard dead (or do you just want to know how to disable it)? A trip through our schematic
will answer your questions.
Although clones use slightly altered board layouts and different chip location names, they're
close enough to the original for this schematic to be very useful. As an example - you have
a dead clone. Lil sucker won't even beep. A look at the schematic shows the location of
parallel port A. You know that the power-on self test loads a checkpoint number into port A
before each test. So now all you have to do is read port A with a logic probe to see how far
the system went before it puked.
We include these checkpoints and other trouble shooting information with the schematic.
IBM PC-Xl Schematic ........................................................................................................... $15.00

CP/M KAYPRO SCHEMATICS
Of course, we still provide a complete schematic of the processor board in your CP/M
Kaypro. It's logically laid out on a single 24" by 36" sheet and comes complete with an
illustrated theory of operation that's keyed to the schematic. You get detailed information
available nowhere else.
For instance, those of you with the 10 and newer 84 systems get a thorough run down of the
processor board's video section complete with sample driver routines. All packages contain
serial and parallel port details and programming examples. Also coverage of the processor,
clock, I/O, and disk controller (information that's not even available in Kaypro's own dealer
service manual!).
Kaypro II & IV (pre-84) ......................................................................................................... $20.00
Kaypro 10 (without modem) ................................................................................................ $20.00
Kaypro 2, 4, and 10 (84 series) ............................................................................................ $20.00

NOTE: These packages cover only the main boards. You're on your own when it comes to
disk drives, power supplies, video cards, etc.
Phone Orders:
48

MICRO CORNUCOPIA, #49, Sept-Oct 1989

(503) 382-5060 or 1-800-888-8087

Monday-Friday, 9 AM - 5 PM PST

ERAC co.

AT/BABY AT XT/TURBO
8 Meg CPU Board
Zero Wait State
8 Expansion Slots
640K RAM On·Board
Math Co·processor Option
Phoenix Bios
200 Watt Power Supply
Hercules Com pat. Video Bd.
Parallel Port
2 Serial Ports Active
Game Port
Clock/Calendar
Hard Disk &Floppy Controller
20M Hard Drive
1.2M 51/4" Floppy Drive
360K 51/4' Floppy Drive
5061 Keyboard
Case with Turbo & Reset,
Hard Drive Light and
Keyboard Disable Switch
Amber Graphics Monitor

$1299

EGA ADD $400
40M HD ADD $150
10 MHz ADD $50

Motherboard
5 & 8 MHz Switchable
8088 - V20 Optional
Optional Co·processor
8 Expansion Slots
ERSO or Bison Bios
640K RAM
150 Watt Power Supply
Hercules Compat. Video Bd.
Parallel Port
2 Serial Ports Active
Game Port
Clock/Calendar
Hard Disk and
Floppy Controller
20M 5%"Hard Drive
2 ea. 360K 51/." Floppy Drive
AT Style Keyboard
Standard Slide Case
Amber Graphics Monitor

*

*

$949

EGA ADD $400
40M HD ADD $150
5 & 10 MHz ADD $21

8280 Clairemont Mesa Blvd., Suite 117
San Diego, California 92111
619 569-1864

ELGAR

UNINTERRUPTIBLE
POWER SUPPLIES
400 Watt MODEL IPS400 +
$650

Power distribution center and sine·
, wave UPS. Only 2" high.
560 Watt MODEL IPS560
$350

Sinewave, 560W complete with
batteries.
400 Watt MODEL SPR401
$180

Supplies may have minor cosmetic
damage, but are electrically sound.
Squarewave output. Run on inter·
nal or external 24VDC battery when
line goes down. Typical transfer
time = 12MS. Battery supplied.
For AT, XT & Kaypro.

*

NEW 24V INTERNAL
BATTERY
$75

KA YPRO EQUIPMENT BARGAINS
9" Green Monitor - 83 ........... $50
9" Green Monitor - 84, K16 ........ 60
9" Amber CRT ... $45 Keyboard ... 75
PRO·8 Mod. to your board ......... 149
Host Interface Board .............. 15

Replacement Power Supply ....... $50
Drivetek 2.6M FD ................. 75
CPM COMPUTERS
K4·83 ..... $350
K2·84 ..... $400
K4·84 ...... 425
K4X ....... 425

NiCds
AA Cells .6ah ................. $1.00
12V Pack AA Cells .6ah ......... 6.50
Sub·C Cells 1.5ah ......... '..... 1.50
12V Pack Sub·C ................ 10.00
Double 0 Cell 2.5V 4ah unused ... 8.00
C Cells ........................ 1.75
7.2V RC·Pack 1.2ah ........... 18.00

GEL CELLS
6V 8ah ....................... $6.00
12V 20ah ..................... 25.00
12V 15ah .................... 15.00
12V 2.5ah ...................... 8.50
o Cell 2.5ah .................... 2.00

ROBOTICS
5V DC Gear Motor wlTach 1"x2" ., $7.50
Joystick,4 switches, 1" knob ...... 5.00
Z80 Controller with 8·Bit AID ..... 15.00
Brushless 12VDC 3" Fan ......... 7.50
12V Gear Motor 30 RPM .......... 7.50 '
Cable: DB9M·DB9F 1 ft. length ..... 2.00
High Voltage Power Supply
Input: 15-30V DC
Output: 100V 400V 16KV ........ 6.50

We Repair CPM Xaypros
IC'S
81·189 Video Pal. .............. $15.00
81·194 RAM Pal ................ 15.00
81·Series Char. Gen. ROMs ...... 10.00
81·Series Monitor ROMs ......... 10.00

TEST EQUIPMENT

CPU & RAM & MISC.

SWITCBERS

OSCILLOSCOPES
TEK 7403N/7A18N/7B50A 60 MHz .$650
TEK 465B Dual Trace 100 MHz .... 1395
TEK 2215A Dual Trace 60 MHz ..... 850
ScopeProbex1,x10 100MHz ....... 25
USM338 50MHz Dual Trace
Delayed Sweep (as is) .......... 145
ANALYZERS
TEK 491 10MHz· 40 GHz ........ $4000
Biomation 805 Waveform Rcrdr '" .195
Biomation 8100 2·Channel
Waveform Recorder ............ 495
HP1600A Logic Analyzer .......... 395
HP1600A/1607 A Logic Anlyzr ...... 595
MISC.
Optronics 550 MHz Freq Cntr ...... $95
Data Royal Function Gen F210A .... 195

41256·12 .. $7.50
41256·15 .. $6.00
4164·10 .... 2.50
4164·12 .... 2.10
4164·15 .... 2.00
4164·20 .... 1.25
MK48Z02B·20 .................. 10.00
Dallas D1220Y ................. 10.00
SIP DRAM 256·12 ... '" .......... 7.00
2716 ...... 3.50
2732 ...... 3.75
2764 ...... 4.00
27128 ..... 6.50
27256 ..... 5.25
27512 ..... 7.00
MC68000·8 CPU ................. 8.00
Z80 CPU .. , .75
Z80A CPU .. 1.50
Z80 CTC ....................... 1.50
Z80A PIO .. 2.00
Z80A SIO .. 5.00
8089·3 ......................... 6.50
80C85A .... 4.50
8088 ...... 6.50
8212 ........................... 2.00
8251 ...... 1.50
8253·5 ..... 1.50
8255·2 ... '.. 3.50
8255·5 ..... 2.50
D8284A ........................ 2.50
08749 .. , ...................... 7.00
6845 ........................... 5.00
1793 ...... 6.00
1797 ...... 7.00

5V/9.5A, 12V/3.8A, ·12V/.8A ...... $39.00
5V/3A, 12V/2A, ·12V/.4A .......... 19.50
5V/6A, 12V/2A, ·12V/1A .......... 29.00
5V/6A, 24V/1 %A, 12V/.6A, ·12V/.6A ... 29.00
5V/10A ........................ 19.00
5V/20A ........................ 24.00
5V/30A ........................ 39.00
5V 100A ...................... 100.00
5V 120A ...................... 110.00

HOURS: Mon.· Fri. 9·6 - Sat. 10·4
MINIMUM ORDER - $15.00
TERMS: VISA, MasterCard, Certified
Checks, Money Order, NO COD. Visa
and MasterCard add 3%. Personal
checks must clear BEFORE we ship.
Include shipping charges. California
residents add 7% Sales Tax. For
more information please call.

*

SPECIAL

*

External 3112" Floppy Drive, 720K, Top
Loading, 5V Only, wlDocs
$55
Reader Service Number 93

* SPECIAL *

IBM PS2 Model 25. Freight
damaged. Works perfect. $550

*

SPECIAL

*

AT 80286·6 CPU BOARD
with reset and mono/color switch
Connector for KB, Battery & SPKR
Phoenix Bios
(tested with Award 3.03)
6MHz, can be upgraded to 8 or 10MHz
Used with backplane, add memory
board, I/O board, etc.
ONLY

$99

MICRO CORNUCOPIA, #49, Sept-Oct 1989

49

Computer Life
Creating Mutations On Your Very Own Computer
By Scott Robert Ladd
705 West Virginia
Gunnison, CO 81230
(303) 641-6438

Will there be life after computers? Who knows.
There certainly was life before computers, even
though it wasn't worth watching.
t's late Mayas I write this, and spring is
happening all around. It's the time of flowering in these parts; bright petals of color
cover the forest floor. On the 17th of April, our
daughter Elora was born-a perfect child, if I
might say so myself. She is quite a joy, day and
night.
My wife and I took our new child on her
first wilderness hike when she was seven
weeks old. We took the Mill-Castle Trail along
Mill Creek into the West Elk Wilderness. Two
miles in, we stopped when the trail crossed
Mill Creek (primarily because the baby
couldn't swim if she fell in) and had lunch in
an Aspen grove.
There wasn't a human in sight; the nearest
was probably several miles away. In the
shadow of those jagged cliffs, we could feel a
presence. We would have stayed later, but a
fast-moving mountain thunderstorm rolled
down the valley, chasing us back to our Jeep.
We got soaked, but enjoyed every minute of it.
The planet we live on is fantastic.
I suppose I'd better start talking about computer programming. After all, that's what this
column is supposed to be about.

I

TOOLKIT
The craft of producing computer programs
has undergone a massive change during the
last decade. For those of us who have been a
part of this industry since its earliest days, it's
like walking in the Emerald City after fighting
off the Wicked Witch. Software development
tools of amazing power abound for hardware
platforms of dazzling capability. Unfortunately,
we often take it all for granted.
With the powerful hardware and fantastic
software development environments, you'd
think applications would be equally wonderful.
Alas, that is not so. Major companies release

50

MICRO CORNUCOPIA, #49, Sept-Oct 1989

buggy versions of their software so that they
can meet "marketing windows." Many programs are hard to use, or are missing key features.
As programmers, we need to use these advanced software development tools to create
the next generation of software. As consumers,
we need to put our foot down and say, "I'm
not going to take it any longer!" Buy software
which works, support vendors who support
you-and raise the devil with those companies
who can't or won't do the job. If we continue
accepting the crud, we'll continue getting it.
The quality of public domain software is
one of my barometers of programming practice. When affordable microcomputers first appeared, public domain software flourished.
Everyone wanted to share, knowing that their
combined knowledge would make computer
software more powerful. There was a sense of
community.
Today, microcomputers are big business.
There's less public domain and more shareware
and crippleware. Legal battles and license
agreements have replaced the spirit of community. Yuck. What would have happened if
Ward Christianson had made XModem
shareware?
I don't mean to say that I don't like
shareware; some of it (PC-Write, PC-Outline,
Procomm, FST Modula-2, etc.) is excellent and
worth more than the authors charge. But 99%
of the shareware I've seen is crap-pure and
simple.
Somebody writes a program and distributes
it with a request for money. Often, the program
is badly documented, buggy, or just downright
useless. Why distribute it if it isn't any good?
Don't people have pride in their work? Or are
they just interested in a quick buck? Somehow,
I think the latter attitude is becoming more and
more common as time passes.
That's why all the source code which appears in this column is public domain. I'd
appreciate credit for it if you use it, merely as a
courtesy. If I'm going to publish it, though, I
expect people to be able to use it if they want
to.

C EXPLORATIONS

'.' .. :'

Life
This part of the column is going to
eat space again .... As usual, something
came up which changed my plans for
this issue. I was going to talk about infinite-precision math and methods of
calculating pi to an astounding number
of digits. That idea will have to wait.
I'm building it as a C++ class library,
and it will use some very sophisticated
algorithms. Also, I need to do a bit of
brushing-up on calculus. So, I came up
with something different-and much
more interesting.
Computers have been used for years
to simulate the real world. One of the
most popular simulations is Life, an
elementary imitation of a colony of
cells. John Conway of the University of
Cambridge (England) developed the
system in the late 1960s.
Cells live, die, and are born according to a simple set of rules. An empty
cell with exactly three live neighbors
gets born. When a live cell has four or
more live neighbors, it dies from overcrowding. Any live cell with two or
three live neighbors simply survives.
From these three rules came a fascinating pastime for many people. The
computer is given a beginning pattern
of live cells and then begins processing
it according to these rules. Fluctuating
and oscillating patterns emerge and
have been given names such as
"floaters" and "guns."
You have even more fun when you
change or add to the rules. People have
become quite creative in enhancing Life,
adding different universes, modifying
rules, and mutating cells. It's fascinating
to watch the patterns as they change;
even people who hate computers (are
there such cretins? posx - 1;
x <= temp critter->posx + 1; ++x)

-

-.

{

for (y = temp critter->posy ,.. 1;
y <=temp critter->posy + 1; ++y)
{

.

-

setcolor(O):
- setpixel (x, y) i

T

/* select movement *1
move =. randval (temp_critter':">move_gene [3] ) ;
for (i=O; move>temp_critter->move_gene [i]; ++i)
/*empty*/;
/* adjust critters position */
temp critter->posx += delta table [i) [0];
temp:critter->posy +;;;ddta:table[i] (1);
/*wraparoundedges of·the.worldif needed *1
if (temp critter';'>posxposx .= . max Xi
(temp-critter->posyposy= max_y;
(temp_critter->posx>max_x)
temp..;..critter,..>posx .• '" 1;
(temp critter->posy> max y)
temp:critter->posy=l; /*assessmovement·cost*1
temp critter->energy level.-=move cost;
1* redraw .critter at-new position *1
for (x = temp critter->posx- ··1;
X <",tempcritter,..>posx+ 1;. ++x)
{
-

growth; and statistics calculations. Note
that the critter's world is circular; when
they move off one side of the map, they
reappear on the opposite side.
As you watch the program run,
you'll notice that the behavior of the
bugs changes. The initial set of critters
jitter around without much direction.
Later, you can see certain types of critters-called cruisers-which tend to
travel in a single direction. Often, a
group of cruisers (critter packs) will
form; they'll move across the screen,
devouring all the food in their path.
The size of the population will ebb
and flow. Sometimes it will grow to
large numbers, and at other times it will
drop to very few members. It's interesting to see how the life cycles work,
since significant die-offs often generate
new populations based on the genetics
of the few survivors of the earlier
colony. Eventually, the population will
die out completely, although this usually happens only after several thousand generations.
The longest-lived group I've seen yet
made 29,384 generations before giving
up. Changing the factors listed in the
beginning of CRITTERS.C can have a
dramatic affect on the way the population evolves.
This project is by no means finished.
I'm adding genetics to critters for the
ability to sense food, to change their
metabolic rate (i.e., a move costs less),
and to change other behaviors.
What would happen if critters suddenly turned carnivorous? (Depends
partly on what constitutes meat, I suppose.) Does changing the distribution of
food make for different behaviors in
different parts of the critter's world?
And, of course, the program needs a
setup mode with which you change the
program constants at run-time, instead
of having to recompile every time.
The possibilities are endless. As I
add new features to the program, you'll
hear about them here in this column.

NEWS AND REVIEWS
There isn't much going on in C these
days. The biggest news is in the Pascal
arena. While this column ostensibly
covers C, the battle over Pascal between
Microsoft and Borland has several implications for the future of those companies' C language products.
Microsoft has entered Borland's territory with QuickPascal, a clone of Borland Turbo Pascal 5.0 with the addition

MICRO CORNUCOPIA, #49, Sept-Oct 1989 55

of compatibility with Apple & Wirth's
object-oriented Object Pascal language.
Borland, meanwhile, released Turbo
Pascal 5.5, which uses Borland's own
support for objects.
Before I make any qualitative statements, let me' make a disclaimer: I am
writing a book called Learning Object-

Oriented Programming with QuickPascal
for Microsoft Press. Some people may
immediately discount my opinions on
Pascal (and possibly other products) because of this. However, I like to make
my affiliations public so that people
know where I'm coming from.
QuickPascal is a good, solid clone of
Turbo Pascal. It compiled every Turbo
Pascal program I've tried very quickly
(of course). I like its environment better
than Borland's, since it allows you to
edit multiple files simultaneously. Also,
QuickPascal has the capability to animate your program, showing the source
code you are executing while the program runs in slow motion.
QuickPascal is cheaper than Turbo
Pascal; it can be found in some places
for under $50. However, Microsoft has
continued their recent practice of putting much of the documentation for
Quick products into on-line help, rather
than paper manuals.
If it weren't for the object-oriented
extensions, I don't think Microsoft did
enough extra to lure many old-timers
away from Turbo Pascal. But, of course,
it is the object-oriented extensions
which make these products interesting.

56

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Microsoft followed the existing
standard for Object Pascal, while Borland created their own object-oriented
dialect of Pascal. Both programs are
very similar in capability and function-in spite of what the propaganda
says.
Borland has made some changes
which enhance the speed of objectoriented programs.
Turbo Pascal 5.5 also shows some
signs of incomplete thinking by Borland; their implementation of constructors and destructors (borrowed from
C++) is weak. QuickPascal's objectoriented extensions are easy to learn
and follow a standard used in Macintosh Pascals, but they produce programs which are 5% slower than their
Borland cpunterparts.
Both companies are looking to the
future; they are developing enhanced
versions of the programs as you read
this. I see a similar fight occurring in regard to C.
Microsoft has publicly announced
plans to develop an object-oriented C by
the first quarter of 1990; they will probably be implementing an extended C++.
Borland is being coy, saying that
they are moving toward object-oriented
C, but that they haven't made a decision
on how to go about it. While Borland
can define their own standards in the
limited world of PC Pascal, I don't think
they can do the same for the larger universe of C.

Resources
I highly recommend A.K. Dewdney's
column (mentioned above) in Scientific
American. If you're interested in expanding your mind, this column will do it
for you.

Editor's note: Of course, if you're not interested in expanding your mind, you can
continue reading Micro C.
I hope Dewdney will put out a collection of his columns for those people
who are not Scientific American subscribers. Heck, I recommend Scientific
American all by itself; it's a solid scientific journal for the educated non-scientist.
I'm Outa Here....
I'm putting together a collection of
computer-based life programs which
you can soon find on the Micro C BBS
and issue disk. Included will be programs for the Borland, WATCOM, and
Zortech compilers. In addition, I'll be
putting in a new version of CRITTERS,
which will incorporate some of the extensions I mentioned earlier.
Please feel free to take these programs and experiment with them; I'd
love to hear back about your observations. As always, write me at the above
address, or send to me via FidoNet
NETMAIL at 1:104/45.2.

•••

Raiders Of The Lost Editor
86
W0Rl.D
By Laine Stump
% Redhouse Press

Merkez PK 142
34432 Sirkeci
Istanbul, Turkey

Laine discovers Brief; but that doesn't mea1l he's
short, just Brief as only Laine can be Brief.
guess just about everybody knows of my
lifelong search for the perfect programming
editor. Several different editors, including
my own (which my brother and I wrote about
five or six years ago), have led me down the
road. Every time I run into a new editor that
has some features I've been looking for, it always seems to have just enough minor (or
major) flaws to justify not switching over
completely.
Because of this dissatisfaction with anyone
editor, my machine usually contains three or
four of the beasties.
For example, if I need to look at several files
at once, I use Logitech's Point. It has multiple,
overlapping windows and can support up to
50-line displays. If I need to do some massive,
repetitive changes to a file, or edit a single file
with very quick response, I'll call up Express
(my homegrown editor), for its small size,
speed, and simple keystroke macros. On the
other hand, if I need to cut and paste columns
of text, I haul out Microsoft Word (the other
two can't do this.)
All this schizophrenia causes some confusion at 5:30 in the morning. For example, Point
uses F5 to begin marking a block of text and F6
to finish. Word uses F6 to begin and finish
marking a block, while F5 turns replace mode
on/off.
I've managed to get rid of the glaring differences (like cursor movement keys) by writing a
TSR program that traps keyboard input and
translates my favorite keys into the appropriate
ones for a particular program. But it's s till a
royal pain in the butt to keep jumping from one
editor to another, doing twenty seconds of
work, saving, exiting, and then jumping
back. ...

I

Enter Brief
During my last two winters at PC Tech, I sat

across a desk from Earl Hinrichs. Whenever my
eyes got screwed up from staring too hard at
my own screen, I would look up at Earl, bapping away at his keyboard like there was no
tomorrow. Windows flashing by in blinks, file
menus shooting out and disappearing a split
second later. He was using Brief (Basic Reconfigurable Interactive Editing Facility).
We talked about editors a few times. After
all, we both spend probably more than half our
waking lives working with an editor. I would
tell him a few things about my current editor,
and he would reply with a counter point about
similar capabilities in Brief. It was like "Dueling Cursor Keys," and Earl was the local,
furiously picking away on his banjo while my
fingers became impossibly tangled in my guitar
strings.
Even so, the first year I wasn't intrigued
enough to spend any time learning yet another
editor. After all, I had just spent a week or so
figuring out how to use Point. It did most
everything I wanted (I thought); Express
covered the rest (I thought). I let it slide.
This spring I was finally ready for a change.
After using Point for a year, I decided that it
was just too slow. Even on a 10 MHz AT, if I
had multiple views of a window on the screen
and hadn't saved in a while, I could type faster
than it could accept characters. It looked nice,
cursor movement was fast, and the price was
right (it came free with Logitech Modula and
older Logitech Mice). But I was ready for something new.
Also, I had decided to get a new PC Tech
Mono II board and double page display. This
display can support at least 160 columns of
text. While no other editor I knew of could
handle that size of display, the ads for Brief
claimed that it could drive displays up to 255
columns by 127 lines. That was enough for me
to dig in and try it.
What Is It?
How about a brief overview? Brief is a text
editor with a very powerful macro language. It
can display multiple windows on the screen at

MICRO CORNUCOPIA, #49, Sept-Oct 1989 57

one time, each showing a different (or
possibly the same) file. It is especially
well suited for programming, with
things like automatic indenting and
automatic compilation and error display
(it can make any compiler into a
"Turbo" compiler).
Although Brief has tons of features
and is very fast, its most important
aspect is the macro language. This is not
just a simple keystroke recorder. The
Brief macro language is full enough that
many parts of Brief itself were written
as Brief macros. You can write your
own macros to extend Brief, or modify
existing parts of Brief. (It includes the
source code to the parts of Brief written
in the macro language.)
Review?
I could go through a standard magazine review form and tell you how
many seconds it takes to save the
"standard" file, what the maximum line
length is, how many windows it can
display, and all that meaningless bull. I
will give you a bit of that, in fact. What
I really want to do is show you a few
macros that might give you a feel for
the flavor of Brief, and maybe lead you
to thoughts about some of the possible
uses of Brief and its macro language
over and above just plain text editing.
But first, a few praises and whines.
Intelligent Indenting
I always thought that an intelligent
indenting editor would be either too intelligent or too stupid for me. Of course,
nearly every editor these days has an
indent mode where hitting "enter"
places you on the next line at the position of the first letter on the previous
line. Somehow it just seemed like a program would either not recognize every
case, or would force my programming
style into something I didn't like.
Brief's intelligent indenting package
for the C language mildly surprised me.
There was only one case where it
wouldn't match my own preferences for
indenting. It was able to recognize all
the constructs I gave it and placed me
in the proper position when I hit enter.
For example, when I typed:
if (junk==2S) 

it automatically placed the cursor at the
next tab stop in from the position of "if"
on the previous line (as shown by the
underscore). If I then typed a single

58

MICRO CORNUCOPIA, #49, Sept-Oct 1989

dented one tab from the left margin:

Although Brief
has tons of
features and is
very fast, its most
important aspect is
the macro
language.
statement, followed by a semicolon:
i f (junk==2S)

ct++; 

the cursor would step back out one tab
stop for the next line. If, on the other
hand, I typed a bracket, followed by
enter, it would go down to the next line,
leaving the indent at the same place
(until I typed the closing brace).
The smart indenting package (which
is written entirely in the Brief macro
language) can recognize the four most
common forms of C indenting style:
if (junk==2S)
{

if (junk==2S)

if (junk==2S)

if (junk==2S)

It handled the first two automatically

and supported the third and fourth
styles if you set an environment variable in the DOS environment.
The one construct that it would not
handle properly, by the way, was the
definition of a function. I like to have
the braces that start and end a function
(and all the lines in the function) in-

void twist (int schillings)

/* end of twist */

When I typed enter after the closing
parenthesis of the function definition,
the cursor went to the first column of
the next line. I typed the brace there
and typed enter, expecting the cursor to
go to the first column again. Instead it
went in one tab stop:
void twist (int schillings)

Although the position of the opening
and closing braces of if0 whileO, etc., is
selectable, the position of the braces
around a function is not.
Another feature that goes along with
smart indenting is the special function
of tab and shift-tab. If you select a block
of text, tab and shift-tab will move all
the selected lines in or out by one level
of indent, rather than moving just the
current line.
Unfortunately for programmers in
other languages, smart indenting is only
available for C (and for dBase if you
buy a package called dBrief, sold by
Global Technologies). But Brief does
have "regular" indenting (the kind
found in most other editors). You could
always use the C smart indenting package as an example to write your own indenting package for another language.
Maybe you could even give me a copy.
Or sell it. Or both.
Column Blocks
This is another nice feature that the
Brief macro language (source code included, of course) implemented. When
you mark a block of text using a
"Column Mark" instead of a regular
mark, the Copy, Cut, and Delete macros
recognize it automatically. Then, instead
of deleting everything between the start
mark and end mark, they go into a loop
that appends the proper portions of
each line into the "scrap buffer," separated by a special marker.
A subsequent Insert command will
recognize that the scrap contains a
columnar block and go through a similar loop that inserts each line fragment
at the column of the cursor, starting at
the cur:rent line and continuing down
until using up all the line fragments.

I was doing some work with Xenix
mapchan (translates from one character
set standard to another on a specified
I/O channel) last week. Columnar cut
and paste saved me at least half an hour
of retyping columnar data in a different
order.
(No, I don't have Brief for Xenix. I do
most of my work under DOS and then
use the Xenix doscp command to move
it onto the Xenix partition).
Other Nice Things
Brief does all kinds of other nice
things, too. So many I can't mention
them all here. A few examples: Brief can
swap itself out to EMS, RAMDisk, or
disk when you escape to DOS to execute a DOS command. This frees up all
but 3K of your RAM for use by the
command. It also allows you to specify
which directory to put backup files in
so that, for example, all backups go into
a single directory for ease of erasing.
Finally, you can specify a macro
package to load for files with different
extensions (that's how it handles the C
indenting). It does this by setting an environment variable called BPACKAGES.
The keyboard assignments of these
macros are kept local to the window
that the file is in.
For example, you can have a .C file
in one window which is using smart indenting, while a .DOC file in another
window uses word wrap.
Bad Things (BOO!! HISSSSS!!)
The main deficiency of Brief that
kept me away for such a long time was
its tiled windows (a window not allowed to partially conceal another window). Even though I know that overlapped windows don't magically make
the screen capable· of holding more
characters, it does seem to do that. When
you add to this the fact that you can't
move a window border which touches
on more than two windows (see Figure
1), the windowing capability of Brief
appears seriously brain damaged.
I can kind of understand the decision
to make windows tiled instead of overlapped; it makes for much less complexity in the screen update algorithms. But
not allowing changes to the position of
a window border touched by more than
two windows looks to me like just plain
laziness. Surely it shouldn't take more
than a simple loop cycling through the
windows, readjusting.
Brief does have overlapped windows, by the way (I even use them in

one of the examples below), but they
are very restricted. For example, once
you open an overlapped window, you
can't switch to any other window until
you close it. Mostly, it uses overlapped
windows for menu displays.
Another window complaint is that
it's impossible to retrieve enough information about the windows to reconstruct a display successfully once it's
torn down. This would be very useful
for the included "restore" macro package, which causes Brief to reload all the

iJIJ

CONSULTANTS
PROGRAMMERS,..
ANALYSTS get

DiseDoc"1
the most advanced
SOURCE GENERATING
DISASSEMBLER AVAILABLE
for the IBM PCIXT/AT/PS2/compatibles

Figure I-Window Borders
in Brief.

1
a

DIS-DOC can help you

2

- find and fix bugs in any program
- re-create lost source code
- a great companion utility to compiler
and assembler
- able to give you a great source of
professional programming examples.
- And Much Much More!

b

DIS-DOC is:

3

This Brief screen has 3 windows
and 2 edges (a & b). Brief allows moving edge b (thus resizing windows 2 and 3), but won't
allow you to move edge a. The
only way to move a is to first
delete b.

•••

files you were editing during the previous session automatically.
No Mouse Support
Not only is mouse support not included with Brief, it would be very difficult to do many of the things I like
having a mouse for. An example is
scrolling and searching.
In Point, clicking the left or right button on the left border of a window
scrolls forward or backward through
the file. Clicking on the right border
searches for the previous or next occurrence of the current selection.
Since the right side of a Brief window is also the left side of the window
to its right, this scheme would be impossible. There is no way to decide
whether the desire is to scroll the right
hand window, or search in the left hand
window.

FAST
- Disassembles files up to 500kb in size
OR RAM/ROM memory at a rate of
10,000 lines per minute.
ACCURATE
- Uses seven passes and over 20 SECRET
algorithms to separate code from data
to make the most accurate listing on
the market.
FLEXIBLE
- Creates a MASM ready listing for easy
re-assembly of your disassembly and
only needs 320kb of memory.
TECHNICALLY ADVANCED
- The only disassembler that disassemres
all instruction sets including 80386/80387.
- And has a built-in patcher to make
changes without having to re-assemble.
DIS-DOC also includes BIOS labeling and
its own word processor in its package.
DIS-DOC is a proven programmer's
tool and is simply a must for the
consultants, programmers or analysts.

We CHALLENGE you to find
anything that can beat Dis -Doc!
DIS-DOC
EXE Unpacker

$99.95
$29.95

FREE DEMO DISK
add $4.00 for S&H in the USA
$10.00 for outside USA
30 day money back guarantee

To order or get more information
CALL 800-446-4656 today!

RJSwantek, Inc.
~
~J

178. Brookside Road ~
Newmgton, CT 06111 ~
(203) 560-0236

Reader Service Number 142

MICRO CORNllCOPIA, #49, Sept-Oct 1989

59

Maybe this is just my problem. I'm
trying to make Brief be everything I've
worked with. Maybe there's a much
more convenient way of searching that I
haven't thought of yet.
A Fixable Problem
The final complaint in my notes is
the inability of the BPACKAGES facility
to recognize wildcards (t??, 01?) in
filename extensions. I encountered this
problem when trying to set up BPACKAGES to turn on the word processing
package, wp, automatically whenever I
edited a text file.
The problem is that I use the extension of text filenames to indicate a
sequence number. For example, letters
to my brother are given the names
CECIL.OOl, CECIL.002, etc. I tried to
make BPACKAGES recognize this with
the command:
SET BPACKAGES=O??:wp

which should mean "whenever you see a
file extension with a 0 at the beginning,
load the wp macro package." Unfortunately, it didn't work. If I wanted to, I
could do it by specifying every possible
extension (all 999 ofthem), but.. ..
The best solution is to rewrite the
BPACKAGES stuff to recognize wildcards. Even better would be to rewrite
BPACKAGES to accept regular expressions for file extensions. Then I could do
this:
SET BPACKAGES=[O-9]??:wp

That's one nice thing about Brief. If a
facility isn't there, the tools to implement it are.
Support
Since I seldom ask for support from
Istanbul, I don't know anything firsthand about support from Solution Systems. The one thing I do know is that
Earl sent several letters to them asking
for information on upgrading to version
2.1, and they never replied. I guess they
didn't want his money.
However, they do have an 800 number which reportedly gives toll-free support (in case your Briefs need extra support).
Price
The final bad thing about Brief is the
price. $195!??!? Of course, if you believe
what Patrick O. Conley said in "On
Your Own" in issue #48, it makes sense.

60

Solution Systems is just keeping out the
geeks and nonserious users by pricing
their product above the "Well, hyuck,
that looks like a nifty program. Maybe
I'll just buy it even though I'm stupid. I
can always call them up when I can't
figure out how to save a file."
Aside from the appearance that Solution Systems advertises way too much
for its own good (everywhere except
Micro C), giving them undoubtedly huge
oper~ting expenses, I think the price of
Brief sends a message to prospective
buyers: "Think before you buy!"
Brief is not for the casual Space Invaders player. Not that it's difficult to
use. While Brief can do many things a
$30 editor cannot do, there are many
things that a $30 editor could do just as

MICRO CORNUCOPIA, #49, Sept-Oct 1989

---------_._-------------

well as Brief. If you only need the $30
features, it would be just plain stupidity
to buy Brief and use it as a $30 editor.
If you're a real professional, you can
justify the expense. Especially if you
buy it from Programmer's Connection
or Programmer's Paradise, or some
other discount software place.
Taste Test
So, enough pralsmg and whining.
Now I'll show you a few little chunks of
code that I wrote in the Brief macro language. They should give you an idea of
some of the possibilities. Remember
though: I'm a Brief neophyte. I wrote
my first Brief program this morning.
What I can do is nothing compared to
what is possible.

Reassigning Keys
Probably the first thing anyone will
want to do when they get Brief is to
change the command key assignments
to match what they're accustomed to.
The program MYSTUFF.M in Figure 2
shows how to do this. To begin using
this program, just type it in with Brief,
then type alt+FlO to compile and load
it.
In subsequent sessions, start Brief
with the "-mmystuff" option. The -m
tells Brief to load the macro file mystuff.
When loading a macro, Brief searches
for a function called _init and, if found,
execu tes it.
You're probably wondering about all
those parentheses in there. The Brief
language has many similarities to LISP.
One similarity is that every statement is
surrounded by parentheses (instead of
being separated by commas, like C).
It also uses prefix notation instead of
the standard infix. This means that if
you want to add 3 and 4, you use the
statement:
(+ 3 4)

If you want to call the routine "square"
on the result of 3*4+2 and put the result
of square into the variable "result, " you
would use:
(=

result (square (+ (* 3 4) 2»)

Kind of like a backwards HP calculator.

A Zoom Window
Also in Figure 2 is an assignment of
the alt+Z key combination to a macro
called zoom_window. This macro isn't
included with Brief; I wrote it myself.
I wrote it to mimic a command in
Point that zooms the current window to
fill the entire screen until I press alt+Z
again, when it restores the original state
of windows.
zoom_window uses a Brief overlapped window to display a file over
the top of the normal windows on the
screen. I was forced to do it this way because, in order to make a tiled window
fill the screen, I would have to tear
down the current window structure of
the screen. I have already mentioned
that there is no way to get enough information about windows on the screen
to reconstruct a window configuration
once it's destroyed.
First, zoom_window gets the screen
size. It uses that information to make
the zoom window as large as possible.
Next it asks which buffer (file, in practical terms) is in the current window. It
then creates a new window to fill the
entire screen and the "current" buffer is
attached to the new window.
After setting up the window to edit,
but before editing, I reassign the alt+Z
key to prevent attempting to zoom an
already zoomed window. This wouldn't
be dangerous (you can create up to
three overlapped windows simultaneously, although the only way to

switch to a previous window is to delete the current one), but there's no reason to zoom an already zoomed window.
To allow entering keystrokes and
editing the file in the zoomed window, I
call process, which is a recursive call to
Brief itself. process inputs and processes
keystrokes until it calls the macro, exit.
After process is finished, it's time to
delete the zoom window, then reattach
the original buffer to the original window. Finally, I reassign the zoom key.
There are some problems with
zoom_macro that I haven't bothered to
figure out. For example, if you move the
cursor while zoomed, the cursor in the
window display doesn't reflect that
movement when you return. Also, the
word wrap package seems to get lost
now and then if I switch the displaying
file in the zoom window.
The solution to the first problem is to
inquire about cursor position in the
zoomed window before deleting it, and
set the tiled window to the same location. The solution to losing word wrap
when switching files in the zoomed
window is to set up a "local keyboard"
for the zoomed window which has the
"switch file" keys disabled. (Each window can have its own set of commands.)
Those are the famous "exercises for
the reader," though. I may fix them
later, but meanwhile you can fix them
for yourself.
Squares
The final program, Figure 3, is just a
little something to show that the Brief
macro language really is a general purpose programming language. The function squares accepts an integer as a parameter, and returns the sum of the
squares of all numbers from 1 to that
number, inclusive. square_l0 shows
how you would call squares.
Again you'll notice the strange
parenthesis syntax of the language.
You'll also notice th~t the definition of
squares doesn't seem to indicate anywhere that it accepts a parameter. The
function get_parm handles that.
By not forcing you to hardcode the
parameter list for a function, Brief allows you to have the same function accept violently different parameter lists
based on decisions made in the function. It also allows the function to either
supply a default value, or prompt the
user for the value, when a parameter
isn't given.

MICRO CORNUCOPIA, #49, Sept-Oct 1989

61

used Brief more and more. As of today,
I haven't used any editor except Brief in
five days. A couple of times I accidentally called up Point from force of habit,
and immediately quit.
Even though it isn't "everything I've
always asked for in an editor," it's
slowly becoming "what I've always
asked for in an editor more than anything else."

Onward
You can do many other things using
the Brief macro programming language.
There's a complete macro package included for creating menus, as well as integer to string and string to integer
routines.
There are deficiencies, though. For
example, arrays must be emulated by
using a text buffer, and complex data
types cannot be constructed. Also, there
is no floating point type (big deal!).

Still, you can easily solve many problems having to do with manipulating
large amounts of text by using Brief
macro programs. Most important, you
can modify your editing environment to
be very close to "exactly how I want it."
Epilogue
I began using Brief two months ago.
At first I just used it when I was bored.
Later, as I came up against things I
couldn't do with my other editors, I

I
Goodbye BASIC, C, COBOL-heDo PASCAL! NI7N, to make
this most advanced language available to more micro users, we've cut (XI' price-to an amazing 129.951 This
astonishing prK:e Idxles the COfTl>Iete JRf Pascal &fSmm on disketm and the comprehensive new user manual.
Not a stbset, it's a corrpete Pascal. Check the featlJ'es.
Separate conpilation of external proced!res '

AutCJ.loadirg , 14 digt FLOATING POINT
arithmetic ' Troe dynanic storage , Verbs/
errrr messages • Fast one-step cOl'TfJiler:
no li,* needed • Graphing proced!res • Statistics
procedLTeS • Activity ansfyzer prints prD{f'8m
use histogram • Operating system interface

•

RlGHT-COMPLETE SATISFACTION GUARANTEED OR
YOUR MONEY BACK!
In addition, ~ yru want to copy the disketm or looseleaf
rTmJaI-so long as it's not for resale-it's O.k. with us.
Pass it on to yru' friends! This is a Limited-Tare-Offer.
SO ACT TODAY-DON'T DELAY ENJOYING PASCAt:s
ADVANTAGES-AT $29.95, THERE'S NO REASON TO
WAIT! .

THIS IS THE SAME SYSTEM WE SOLD FOR 12951
So haN can we make this offer?-why the IJlbelievable
deal? Ver'l simp~, we think an software is overpriced. We
want to build volume with the booming IBM market, and
(XI' overhead is low, so we're passing the savings 00 to
you.

AND AT NO RISKI
When you receive JRf Pascal, look it over, check it out.
If you're not compleoo~ satisfied, rettrn the sysmm within
30 days and VW' money win be reftllded nfull! THAT'S
'-----------------~

To: JRT SYSTEMS

P.O. 801187

Enola, PA 17025
phone 717n32·1093
O.K. You've sold me. Send me JRf Pascal by retlJ'fl maa.
IlJlderstand that if I'm not COI1l>leoo~ satisfied, I can
rettrn it within 30 days for a fUI reftnd.
I need 0 51/4" disk or 0 31/2" disk. 0 Send me the
JRf Pascal program formatmr too, for ooIy $14.95.
Name _ _ _ _ _ _ _ _ _ _ _ __
Address _ _ _ _ _ _ _ _ _ _ __

City
Stam _ _ Zip _ _
o ChecklM.O. 0 COO 0 Company P.O. [add $20]
PA residents odd sales tax. Add $10 for shipping outside
US/Canado. US flrlds on a US bank only. Needs only
192K and 1 floppy drive.

... ...............................
~

Reader Service Number 154

62

MICRO CORNUCOPIA, #49, Sept-Oct 1989

ria

r···································

Corrections
There were a couple of mistakes in
the listing of TRAP in my column of
issue 48:
Mistake 1 was my fault. I changed
the operation of the routine CRASHIT
(bottom of page 46), but didn't change
the comments at the beginning. Remove
the reference to "string to print in
CS:SI" and "interrupt # in DX." These
two parameters don't exist in this version of TRAP
Mistake 2 is the fault of the stupid
programs that Micro C uses for printing
listings. (It seems that somehow my
listing got sent through Ventura again).

Editor's note: We've Ventura'd every
listing Laine has sent us for the past 2 1/2
years. But we forgot to double up one set of
<>'s so they'd print-mainly because
Laine's article arrived late, as usual.
The problem here is in the table
NewIntTable (bottom of page 48). Micro
C's program ate the brackets ("<>")
around the table entries, and the interrupt number, which is the first member
of the structure. A correct printing of
NewIntTable is in Figure 4.
References
Solution Systems
541 Main Street, Suite 410
South Weymouth, MA 02190
(800) 821-2492 Ext. 351
(617) 337-6963 MA and outside U.S.

•••

RABBIT

CHICONY

McTEK

GAS PLASMA PORTABLE

LAP-TOP

EGA PORTABLE

*LCD PORTABLE
ALSO AVAILABLE
• 80286-12 CPU
• 640K MEMORY, EXPANDABLE TO 4MB
• DUAL SPEED 6/12 MHZ, 0 WAIT STATE
• LANDMARK 16 MHZ
• 5 SLOTS, EXTERNAL 5W' 25 PIN DRIVE PORT
• CGA/MGA/EGA 64Ox400, 4 GRAY SCALE
·101-KEY ENHANCED KEYBOARD
• GAS PLASMA DISPLAY
• 1 PARALLEL, 1 SERIAL
• 200WT AC 110/220 AUTOSWITCHABLE
• EGNMGA MONITOR PORT 9 PIN
• HARD DISK/FLOPPY DISK CONTROLLER
• 1.44MB FLOPPY DRIVE AND 20MG
•

~~:"~1~~'~~';~'~1~.8 LB.

• 80286-16 CPU (0 WAIT STATE)
• NEAT, TURBO PAGE MODE SPEED UP
TO 21.4 MHZ
• 1MB ON BOARD, EXPANDABLE TO
5MB (EMS V 4.0)
• CGNMDNEGA, 640x400, 4 GRAY
LARGE GAS PLASMA DISPLAY
• 1.2MB FLOPPY AND 40MB HARD DISK
• "84 + FN" ENHANCED KEYBOARD
• 1P/2S (D-9 and D-25), REAL TIME CLOCK
·1OOW, AC 110/220V SWITCHABLE
• 14.8" x 13.4" x 3.7", 15.4 LBS.
• CARRYING BAG w/SHOULDER STRAP
• ONE YEAR WARRANTY
. .........••.••..............

$3400

• CARRYING BAG w/SHOULDER STRAP
• ONE YEAR LIMITED WARRANTY

•
•
•
•

286-12 CPU, LANDMARK = 16MHZ
640K DRAM (EXPANDABLE TO 4MB)
0 WAIT STATE, DUAL SPEED 6/12 MHZ
DUAL FLOPPY AND HARD DISK
CONTROLLER (1=1 INTERLEAVE)
• ONE 1.2MB FLOPPY DRIVE
• ONE 20MB HARD DISK (40MB)
• TRUE OS/2, XENIX, MS DOS AND
NOVELL COMPATIBLE
• 80287 MATH CO-PROCESSOR SOCKET
• ENHANCED 101 KEYBOARD
wlTACTILE FEELING
• 2 SERIAL PORTS, 1 PARALLEL PORT
AND 1 GAME
• LED INDICATORS
• 200W UL POWER SUPPLY
• ONE YEAR WARRANTY

....................... $2299

GAS PLASMA ............. $2199
LCD PORTABLE .......... $1729
McTEK 286/12MHZ

McTEK 386/165X

McTEK 386-20MHZ

Assembled & Tested IBM® AT Compatible
MS-DOS® OS/2® Compatible
8028612/6 MHz
Phoenix BIOS
640K of RAM Expandable to 4MB
oWait State
200W Power Supply
1.2MB Floppy Drive
Ports: 1 Serial, 1 Parallel, 1 Game
Dual Floppy/Dual H.D. Controller
Monochrome Graphic Card
101 Key Enhanced Keyboard
TTL Monitor 12"
20MB Hard Disk (40MS)
Options:. ................................ Call

Assembled &Tested IBM® AT Compatible
MS-DOS® OS/2® & UNIX® Compatible
8038616/8 MHz Norton V4.0 5117.6
Phoenix BIOS
1MB expandable to 16MB RAM
80387 Coprocessor Socket
200W Power Supply
1.2MB Floppy Drive
Ports: 1 Serial, 1 Parallel, 1 Game
Dual Floppy/Dual H.D. Controller
Monochrome Graphic Card
101 Key Enhanced Keyboard
TTL Monitor 12"
20MB Hard Disk (40MS)
Options:. .............................. Call

Assembled &Tested IBM® AT Compatible
MS-DOS® OS/2® & UNIX® Compatible
• 80386 20/8 MHz Norton V4.0 51 22
• Phoenix BIOS
• 1MB expandable to 16MB RAM
.80387 Coprocessor Socket
• 220W Power Supply
• 1.2MB Floppy Drive
• Ports: 2 Serial, 1 Parallel, 1 Game
• Dual Floppy/Dual H.D. Controller
• Monochrome Graphic Card
• 101 Key Enhanced Keyboard
• TTL Monitor 12"
• 40MB Hard Disk (28MS)
Options:. .............................. Call

$1,199 00

$1,495 00

$1,995 00

DISK DRIVES

PRINTERS

MONITORS

PC/XT

PC/AT

MISC.

Fujitsu 360k ..................... $69
Fujitsu 1.2MB .................. $89
Teac ................................. $75
Teac 1.2MB ..................... $89
Teac 3W·1.4MB .............. $89
20MB Hard Disk Kit... ... $279
30MB Hard Disk Kit... ... $309
KL320 (40MS) ............... $215
8425 Miniscribe ............. $249
8438 30MB Miniscribe $259
3650 40MB Miniscribe $349
3675 60MB Miniscribe $379
ST-157 49MB 3W' ......... $479

Citizen CD 120 .............. $149
Citizen CD 180 .............. $189
HPLASAR SeriaI2 ....... $1699
Epson LX-800 ............... $219
Epson LQ-5oo ............... $379
Toshiba 321 XL. ............ $519
NEC P20OO .................... $369
Call for prices of other brands

MODEMS

Samsung amber ............. $79
Samsung EGA color. .... $359
Samsung RGB color ..... $259
NEC Multisync .............. $559
Sony Multiscan ............. $619
HGC·compat.mono card. $49
Color graphic card .......... $49
EGA Paradise 480 ......... $149
VGA Paradise ................ $279
Genoa Super VGA ........ $299

McTek 286-20MHz ........ $359
McTek 286-12 ................ $259
McTek 386-16SX ........... $429
McTek 386-20MHz ........ $699
McTek 386-24MHz ........ $899
Locking slide case .......... $59
200W power supply ........ $65
Enhanced keyboard ....... $59
WD FD/HDC ................. $129
DTC FDC/HDC 1:1 ....... $189
3MB EMS (aK) ................ $99

300/1200 .......................... $79
2400 external ........... ,..... $139
2400 internal ................... $99

Kingtech CRT Portable Kits:
XT/AT (powersupply. case
keyboard. monitor)
.......................... $380/$410
Eprom burner 4-socket$139
LCD Portable ................ $799
Plasma Portable Kits .. $1499
AC power strips .............. $15
Diskette file box ................ $9
Printer or serial cable ....... $8
Archive Tape Backup
40MB ......................... $339

Logimouse C7 ................. $69
Logimouse H1 Res .......... $99

640k TurboMothrbrd ....... $80
10MHz TurboMothrbrd ... $85
Multi I/O w/disk contrir ... $59
640k RAM card ............... $39
2MB Expansion card ...... $89
RS232 2-port card .......... $35
4-serial port card ............ $79
Game I/O card ................ $15
384k Multifunction card ... $69
FCC·app. slide XTcase ... $29
150W power supply ........ $49
XT keyboard ................... $42
Clock Card ...................... $19
Floppy Controller ........... $19

MOUSE

DESKTOP

XT 10MHz 640k
2 Drive System .........•.... $759

McTek Systems, Inc. ·1521 San Pablo Avenue • Berkeley, CA 94702 • 415-525-5129
Reader Service Number 42

MICRO CORNUCOPIA, #49, Sept-Oct 1989 63

By David Thompson
Micro C Staff

The Culture Corner

t was one of those classic county faires,
you know, the blare of ferris wheel
music (with or without the ferris wheel)
and the barkers:
"Hey big fella, win this stuffed panda \ .
for your little sweetheart."
.
"Hey big fella, win this little sweetheart
for your stuffed panda."
"Walk away with these prizes, we're
giving them away today, we can't take
them with us."
"Three balls for just a quarter."
There were also the smells: caramel
corn, corn dogs bubbling in rancid oil,
fresh sawdust, and Queen Anne's Lace.
Great place to hide from the battles of
hi-tech. Grab a snow cone (grape) and feel
like 12 again.
"Electronic shredder, get your electronic shredder here. Step right up, this is
the kind of file protection you can't be
without!" The barker wore a pair of the
brightest green pants I'd ever seen.
My first reaction was to flee, after all
how many 12-year-olds are into shredders? Probably none, and certainly not
more than once. But the adult side of me
was curious how this slicker was going to
sell a computer product to farm folks. As
a small crowd of overalls gathered, I
edged in next to a large fellow wearing
huge red suspenders.
"This is the latest, greatest invention.
Keeps the neighbors, the bank, the wife,
the IRS, even the government out of your
old data files. With this dramatic breakthrough you don't just throwaway information, you shred it into electronic history."
"Lemme see the shavin's," said red
suspenders. "The wife's real handy with
them jigsaws that has lots of sky."
"That's the best part, there's nothing to
throwaway. Nothing to haul out to the
hogs. This is technology at its finest."
"So what's the use of shredding if you
don't get something to do at the dinner

I

64

MICRO CORNUCOPIA, #49, Sept-Oct 1989

table during January? And no mulch?
What about the little lady's garden?"
Mr. Green Jeans looked puzzled for a
moment. "Let me explain-this removes
information from a computer, removes it
permanently, by writing new information
over what's already there. By the way, are
any of you fine folks considering buying
your first computer?"
Noone raised a finger.
"What kind of information does it
write into the computer?" asked suspenders.
"I'm not really sure, just different information, unimportant information. The
most unimportant information available.
It's information that wouldn't be interesting to the kind of person who might
otherwise be interested."
"How does anyone know what's not
interesting?"
I noticed that Red Suspenders' drawl
had disappeared and the grass stalk he'd
been chewing was getting quite short.
"Well take my word for it, no one's
been interested yet."
"What does it run on?"
The barker's eyes brightened. "Macs,
Apples, Commodores, Ataris, Amigas,
and for any of you doing serious computing, the PC family. It'll run on anything."
"How about Sun workstations?"
"What's that?"
"How about my Sun workstations?"
"Who makes them?"
At that point the crowd began to disperse, smiling to themselves. I overheard a
couple comments about problems running
DOS applications under UNIX.
The last I saw of suspenders, he had
his face totally imbedded in a fresh wad of
cotton candy. For a moment I had the impression the cotton candy was hiding a
huge grin-the grin of an unrepentant 12year-old.

•••

ARE YOU FAMILIAR WITH THE MICRO CORNUCOPIA NETWORK?
The network is a growing, international group of over 20,000 engineers, designers, programmers, publishers,
and consultants: practitioners who seek out and use micro computer products and make recommendations
about their use. Over half have advanced degrees and nearly three quarters moonlight as computer
consultants (in addition to their 9 to 5 jobs in the computer industry).
The network is the developers, hardware and software manufacturers, and retailers who provide the tools: the
libraries, systems, and hardware. Our advertisers are key technical resources providing both tools and
expertise to this fascinating group. Ads in Micro C are read as thoroughly as the articles.
At the heart of the network is MICRO CORNUCOPIA, the Micro Technical Journal, published bimonthly in a
light, often humorous, tell-it-like-it-is style. Our writers are experts, providing in-depth discussions of utilities,
libraries, graphic interfaces, clone boards, language interfaces, chaos theory, fractals, micro controllers, and
much more. Ninety-five percent of our subscribers keep back issues in their libraries. In addition to
subscriptions, Micro C is sold in major newsstands including B. Dalton and Waldenbook.

INTRODUCING THE MICRO CORNUCOPIA TECHNICAL REVIEW SERVICE
Having reviewed thousands of products, services, and startup ventures, we've discovered that most share
common challenges. To assist you in your venture we've developed our technical review service. Here's how
it works.
STEP 1. You'll start by ordering and completing our questionnaire. It has over 75 important questions about
you and your venture. We ask about your product. We ask about your manufacturing, marketing, and
administrative tasks and expenses. You'll also receive a personal evaluation form to help you assess your
own strengths and weaknesses.
All together, the questions help you explore your market and explore the expertise you and your team bring
together. Honest answers to these questions should give you a good perspective about your venture and its
chances for success. As an introductory offer, there will be no charge for questionnaires requested prior to
October 31, 1989. To receive your free questionnaire write #159 on the reader service card and send it in.
STEP 2. If filling out the questionaire leaves more questions than answers, return it and $150.00 to Micro C.
(Add $50.00 for each personal evaluation form beyond the first). We'll review your questionnaire and return
our assessment of product feasibility, including places where the idea and/or your group seem particularly
strong and where they seem particularly weak. If we see an opportunity for expanding the idea or taking it in
an entirely new direction, we'll include that.
Once you receive the written assessment, you're welcome to schedule a one-hour conference call with the
evaluators. This will give you a chance to flesh out old ideas or bang around new ones. We don't guarantee
to be right (we don't even promise to agree with each other) but we do guarantee to give you our thoughtful
opinions and we'll give them to you straight.

WOULD YOU LIKE TO CONNECT WITH THE NETWORK?
Getting started is easy.
Simply return the appropriate response card to subscribe to Micro C, to receive our media kit with everything
you need to prepare and submit your advertising, or to receive your technical review questionnaire. If you
know others who could benefit by connecting with the network please share this information with them.
MICRO CORNUCOPIA, #49, Sept-Oct 1989

65

Play It Again, DOS
WARE
Anthony Barcellos
p.o. Box 2249
Davis, CA 95617-2249
Voice: (916) 756-4866
Data: (916) 758-1002

Anarkey and ARC-rivals; if Tony doesn't watch
out, he may have Webster's camped on his doorstep.
omputers are quite literal. Muff one
keystroke and your PC comes back at
you with "Bad command or file name."
Until computers routinely offer DWIM capability ("Do What I Mean"), we'll have to watch
what we type.
DOS is not particularly helpful here. Sure,
you can reissue or edit your last command; but
unless you use DOSEDIT or CED, all the prior
commands are history.
Steven Cal was of Modern Software has
entered this arena with his own command-line
editor, Anarkey. Now at version 2.00, Anarkey
boasts a mix of features.
The Up and Down arrow keys sequentially
retrieve command lines from the command
buffer, which is a standard approach among
command-line editors. However, Anarkey also
lets you enter the initial characters of the command you want to retrieve; it will search the
history buffer to retrieve the command you
started to enter. The command-line history
buffer can be written to, or read from, disk.
The command completion featur~ of
Anarkey extends to filenames as well, matching
on a file as soon as you have entered enough
characters to get a unique match.
You may stack commands on a single line.
Your input strings can have up to 255 characters.
You may use aliases (including the standard
replaceable DOS parameters, %1 through %9).
If these features are not enough, you may
enjoy using Anarkey to reconfigure your keyboard and retrieve environment variables for
editing.
Anarkey can be reconfigured, too. Calwas
provides a utility to edit Anarkey's defaults. Its
standard history buffer is only 500 characters
long, but you can expand it. In standard configuration, Anarkey requires less than 7400
bytes of memory.
The 50-page user's manual contains lots of

C

66

MICRO CORNUCOPIA, #49, Sept-Oct 1989

examples. In it, Calwas explains the standard
Anarkey functions, the use of the AKA (or
alias) feature, applications of environment variables, and the default-editing utility.
According to the program's order blank,
you owe a modest $25 if you plan to continue
using the program. (If you use Anarkey for
more than a month without registering, you are
in violation of the license agreement. If you
truly appreciate shareware and want to encourage authors to keep distributing software
in this way, you won't flout the honor system
that keeps it going.) There is a special registration schedule for commercial institutions.
Steven Calwas has also arranged for accepting new registrations by credit card via the
Public (Software) Library at their toll-free number, (800) 2424-PSL. Visa or MasterCard.
Anarkey, version 2.00
Personal registration, $25
Update for registered users, $6
(California residents add 7% state sales tax.)
Steven Calwas
Moderne Software
P.O. Box 3638
Santa Clara, CA 95055-3638
The ARC War Peace Talks
"You can't fight in here, gentlemen! This is
the war room!" -Dr. Strangelove
The unlikely happened in Bethesda, Maryland, on June 7, 1989. Phil Katz of PKWare and
Thom Henderson of Software Enhancement
Associates shared a platform in a joint presentation to a users group. It was a meeting of the
Communications SIG of the Capital PC Users
Group. SIG chairman Walter Nissen's diplomatic skills proved equal to the formidable task
of arranging the simultaneous appearance of
the ARC-rivals.
Nissen had carefully enjoined both speakers
from attempting to rehash the SEA v. PKWare
lawsuit at the user forum. Katz and Henderson
accepted his strictures.
I called Nissen immediately after the conference was held.

"There were only the most remote
references to the lawsuit," he said, "although many in the audience seemed
curious about it."
The two combatants apparently
spent most of their time discussing the
future of archiving and compression
utilities.
According to Nissen, Katz and
Henderson agreed that there would
probably be some movement toward
compatibility among archiving programs. But, there were no signs that
either party was prepared to move in
that direction.
Katz, of course, is bound by the
terms of the lawsuit settlement to refrain from producing programs that
work with ARC-format archives (unless
he and SEA were to agree on a license
arrangement). Although Katz has
placed his new ZIP format in the public
domain, Henderson did not specifically
address it.
Nissen thought compatibility didn't
interest the speakers as much as it did
the members of the audience. From the
speakers' perspective, it's easy to understand, he pointed out. Compatibility becomes an issue only at extraction time.
To create an archive you can use
either ARC or ZIP. Of course, each vendor hopes its package will become the
standard. Each is willing to let thirdparty developers address compatibility
with extraction utilities that understand
both formats.
It turns out that many people use archiving programs for data backup;
squeezing large amounts of hard disk
information into a much smaller space
on floppies. That raises a fundamental
question about archiving priorities: size
versus security. In one sense, the best
archive is the smallest archive, and
that's one major area of competition
among compression programs. File integrity, however, depends on data redundancy.
"The point of archiving is to reduce
the number of bits used," said Nissen.
"Redundancy runs counter to this."
Vendors will have to decide whether
to aim at size or security, since users are
clearly interested in both file integrity
and compression. Katz and Henderson
both said that they were not expecting
to replace backup utilities with their
programs, but people are already using
ZIP and ARC for data storage.
The two competitors further agreed
that size is a tradeoff against speed and
security. It takes time to figure out the

most efficient compression. PKWare
managed to beat ARC in the early going
by coding the algorithms in assembly
language while SEA used C.
The archiving competition is by no
means limited to DOS. SEA is already
working in other environments and
PKWare appears to be doing the same.
SEA appears to have an edge in the
corporate market, but several bulletin
boards have converted from ARC to
PKWare's ZIP.
The competition could also branch
out into commercial software, where
many developers are interested in
embedded routines that would let their
programs de-archive files.
Although Katz and Henderson
shared similar views on the future of archiving (bright) and its applications
(broad), there was no consensus on
whether future algorithms would be
more effective at compressing files.
However, the LHARC program now
making the rounds of the bulletin
boards definitely offers better compression. Unfortunately, it's not as fast as
ARC or ZIP.
A Capital Group
The Capital PC User Group, host of
the forum, is one of the most important
and influential users groups in the
country. To learn more about the group,
call their 24-hr. recorded message number, (301) 762-6775, or write to:
Capital PC User Group
51 Monroe Street Plaza East Two

Rockville, MD 20850
A one-year membership is $35,
which entitles you to a subscription to
the Capital PC Monitor, their fabulous
monthly newsletter. The Monitor contains a regular column by shareware enthusiast Bill Fowler.
Trojan Viruses
By now everyone knows that Trojan
Horse programs are time bombs that
eventually blow up and destroy both
themselves and everything else on your
hard disk. Viruses, however, are more
sophisticated, since they attempt to
propagate. Viruses generally bide their
time until they determine that their progeny have infected enough targets to
carryon the strain.
Thanks to continuing advances by
sociopathic computer users, now we
have reports that archives can be used
as Trojan Horses to transport viruses

past your watchful eyes. There may be
something to it, though uninformed
panic has probably caused some of the
concern.
Here's how it should work: During
archive extraction, comments are displayed that a deranged mind has altered to contain nonstandard escape
codes. (PKZW and LHARC both permit
comments in their file formats.)
The escape codes then redefine your
keys so that the next time you try to use
the DIR command, you actually invoke
a FORMAT of your hard disk. (Plus,
self-extracting archives could do immediate damage.)
Slick. Not much of a danger, however, unless you use ANSI.SYS as your
console driver. Otherwise the escape
codes cannot redefine your keyboard.
Furthermore, BBS operators have already started to report precautionary
steps that users can take to counter the
slim dangers that such archives may
offer.
The simplest way is to examine the
archive before extracting it, searching
with a utility for dangerous command
strings. Of course, you could just yank
the "device=ansLsys" line from your
CONFIG.SYS file. (Are you really using
it for anything?)
Why Wait?
ButtonWare has issued version 1.1 of
PC-File:dB. Why?
As marketing representative Suzanne
Faith tells it, it was the enthusiastic response of users to version 1.0 and their
encouraging feedback: "Our users immediately had several excellent ideas
and suggestions regarding what they
would like to see in the new program.
Some of these suggestions were so
good, we decided not to wait until our
next regular update, late in 1989."
Now you'll be able choose your own
names for index files, preventing
possible conflicts. Memo fields are
wider, the import function is faster, IF
calculations have been refined, and relationallookup support supposedly has
been improved.
For more information, contact ButtonWare.
PC-File:dB, version 1.1
ButtonWa~e, Inc.
P.O. Box 96058
Bellevue, WA 98009-4469
(206) 454-0479
(800) JBUTTON (orders only)

•••

MICRO CORNUCOPIA, #49, Sept-Oct 1989

67

Modem Operated Switch
Ya Gotta Have MOX
By Jay C. Bowden
Epoch Data Devices
P.O. Box 1093
Cardiff, CA 92007

What do you do after you've fought your way
through the development cycle, lined up someone to
handle distribution, sent out releases, finagled reviews, and placed ads? You wait for orders.
hiS story begins with the unsolicited article I sent in to Micro Cornucopia back in
July of '87. "Phone Your Own Clone" described how a person could build the hard ware
to turn on his PC when the Carrier Detect (CD,
also called RLSD) signal in his external modem
became active.
A few lines in the AUTOEXEC, a program to
interrogate the state of CD via a BIOS call, and
suddenly your PC was smart enough to know if
you were sitting in front of the screen turning
the power on, or calling it over the modem. If
modem, then CTTY COM1 turns control of the
PC over to the phone line!
You probably won't remember the article,
because it didn't appear. I had even offered to
sell the PC boards and parts kit, with just
enough markup to cover the cost of the PC layout. I was convinced that this was something
that people would want to do.

T

Why I Designed The Product
I had recently worked at two separate locations: one north of home and one equally far
south. After a full day in the south, I didn't feel
like driving north, so I arranged for the installation of a modem-operated switch at the northern office, which only had one phone line.
I also put a simple appliance timer on the
modem only. Turning it on from 7 p.m. to 7
a.m. gave me access to the office PC, and let the
one phone line do double duty: daytime voice,
nighttime data. It was great!
This was not revolutionary technology, but I
was sure that if it was easy and convenient,
more people would want to take advantage of
it. Besides, there seemed to be no one else who
had done it right.
Black Box Catalog sold something called a
Line Operated Relay for $100, but it was made
for a teletype machine. You had to wire it your-

68 MICRO CORNUCOPIA, #49, Sept-Oct 1989

self, and it had no override for the times you
were sitting at the console. Then there were the
sophisticated widgets that had the brains to
make you enter a password before they would
turn on the PC, but they sold for $300 or more.
Enter MR. MOX
I answered the convenience issue by using
an RS-232 jumper box (like a gender changer,
only it doesn't change the gender) to intercept
the CD signal and run it to a jack on the face of
the MR. MaX. (Oh, and that name: like VOX is
to voice operated switch, MaX is to modem.)
Then, a small switch in a tiny box at the end
of the wire for the override. You could stick
this switch anywhere it was convenient near
the front of the PC, and keep the power cables
in the back. It really did install in seconds. I
shoe-horned the circuitry inside the case of a 6outlet power strip, and considered it productized.
Manufacturing-What Can Go Wrong ....
There were trade-offs made in manufacturing. Everything you buy has its own peculiar
cost vs. quantity curve, but the thing they all
have in common is the more you buy, the
cheaper the unit cost.
My general plan was not to sweat for absolute lowest cost at the front end. I knew I
wouldn't make any money until sales got into
the hundreds of units, anyway. So I would concentrate on low manufacturing cost later, if MR.
MaX took off.
But costs weren't the major problem. For example, I located the perfect power strip in
which to install MR. MaX. Holding it in my
hand, I ordered that part, by Manufacturer's
Model Number. What I got (with the same
model number) was a power strip from hell:
half the size of my example, single outlets instead of duplex pairs, and it was riveted together!
This was just the beginning. Relays that I could
get routinely in five days suddenly became
three-month special orders from Japan. Of
course, my PC boards would accept only this
brand.
With naIve dedication, I checked every trace

You are not
reading a success
story here. The facts
are true. I have
omitted the names
to protect the guilty.
the PC layout person should have put
down before the boards were fabbed. I
might as well have gone fishing-sure
they fixed the errors that I found, but 3/4
of the fixes were done wrong!
I even wound up special ordering
the cardboard boxes after I found out
they weren't available locally. As usual,
it's the small things that cause the most
frustration.
Finally I was held up for an entire
month by a total flake of a graphic artist. I finally accepted trash she'd produced just to get rid of her.
Eventually, though, the only hurdle
left was marketing my product.
Only? Here my dream turned into
something of a nightmare. Those of you
who want to market your own product-Beware! You are not reading a
success story here. The facts are true. I
have omitted the names to protect the
guilty.
Got Those Marketing Blues
The greatest product in the world
won't sell itself. Advertising rates in
magazines are high-a 5"x3" box
among hundreds of other such boxes

(among hundreds of pages of bigger
boxes) can cost $400 or more. Of course,
you have to recover the cost of advertising out of your "profit," but you can't
price your product too high.
I determined that the best way to get
started was by getting "free" advertising in the form of "new product announcements." I bought a mailing list of
computer magazines, and another one
of computer users groups, and began
mailing MR. MaX press releases.
For various reasons, all of which
made sense to me at the time, I proposed a partnership with the proprietor
of a dormant one-product hardware
business. His well-known (to me, anyway) logo would appear at the bottom
of MR. MaX ads. He would handle all
advertising and sales. I would supply
the product. We would coordinate ads
to appear along with the press releases
which I would submit. It sounded great.
Time passed. I finally (in frustration)
placed an ad myself in Micro C (Jan-Feb
'89-take a look), since this "partnership" resulted in no advertising. MR.
MaX, to put it mildly, was not the center of my partner's life.

A Little Exposure
However, I was actually having
some success with press releases-that
is, they were getting published. BYTE
magazine (June '88) ran one. LINK-UP
ran a paraphrase of my data sheet and a
photo. PCM, a Tandy magazine, gave
MR. MaX a mention (June '88). A note
in a Q and A column in Personal Computing (Sept. '88) continued my media
barrage.
Two problems, however. First, the
Personal Computing author suggested
that it would be better to buy an $8.79
piece of software and an appliance
timer for the PC that would turn it on
when you were likely to call in. Arrrgh!
The author had obviously never tried to
use a PC with an appliance timer (2
prongs vs. 3). Plus, the PC would crank
up every day whether you were going
to use it or not.
Second, even when they simply
printed the releases, the free advertising
didn't work. There was no flood of
orders for MR. MOX-calling it a trickle
would have been generous.
Then came a break, I thought. LINKUP wanted to evaluate MR. MOX in an
MICRO CORNUCOPIA, #49, Sept-Oct 1989

69

article. I sent off a unit and waited expectantly. And waited. And waited. I
wish now I were still waiting.
My first indication that the article
was out came by phone. A modem
manufacturer called to say that their
unit didn't have the problem described
in the article. Uh-oh. What did the article say? I asked the guy on the other
end.
"Well, it said that your product
doesn't work. They rated it a poor buy."
I had to call LINK-UP to get a copy
of the article. The author was a fellow
whose name I had seen mostly on book
reviews. The article was fairly complimentary, up until the point when the
author became frustrated that he could
not get his MR. MOX to work. What
happened?
He seemed totally convinced that if
he set up the modem the way the modem
has to be set up to work with MR. MOX,
the modem would not work with the
computer. He did not try to set it up the
way it has to be set up. He didn't have
to. He knew it wouldn't work.
He didn't call. He just gave up,
ending his article with, "It makes one
wonder how the engineers thought
through the concept and tested it."
Arrrgh.
To their credit, they published my
rebuttal in their next issue. The author
apologized, in print, "for an unintentionally misleading review." The editor
apologized on the phone, and they upgraded MR. MOX to a "Good Buy."
(Darn hard to use the condemning article/rebuttal/apology in your marketing literature, though!)
Did this undo the damage of the
original article? Dave Thompson, your
friendly Micro C editor, mentioned that
usually more people read the "letters"
columns than the articles. However, if
sales are any indication, it doesn't appear that people read either in LINKUP.

Well, there are always retail sales,
right? Not so fast! Big or small, retailers
pointed out that customers had not
been coming into their stores asking for
MR. MOX. Now my point of view was,
"If only my product were on display
next to XXXX, then people would realize how handy it would be to have this
feature."
Sorry. The most shelf space goes to
the products that have generated the
most sales; zero sales gets you zero
shelf space. Welcome to the world of
catch-22.

70

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Mr. Mox in the Flesh.

I: Ij.--~~»·-I

J

r

,'"
1\

.
"- ",~~""'.~r ,v"<,%~>",.~,,~,,

There Must Be A Lesson Here
Somewhere....
Manufacturing and marketing a product isn't glamorous. It's hard work.
The rewards are possible; the effort a
certainty.
First, if you should start down this
road, it won't take you long to discover
that everyone and their brother (and
your brother) will offer you endless advice. If success doesn't beat a path to
your door, they'll tell you exactly what
you're doing wrong. Of course, they've
never tried doing anything similar.
Plan for delays and hitches in materials. If work is done for you, check it.
Where possible, don't give anyone more
money up front than you're willing to
walk away from (my experience with
the graphic artist nailed that lesson
home).
When sending out press releases, be
aware that there is much duplication on
mailing lists. Just pick out titles you recognize, and perhaps others that seem
particularly oriented toward your product. Be persistent. Be aware that
there's a lot of competition for a New
Products editor's attention.

Editor's note: If you want an eye opener,
show up any Monday morning and you can
help Tammy sort through the basket-full of
releases.
I know I could have done better with
the pictures. I sent B&W prints to all my
targets. If you are the artistic editor of a
slick mag, and have a choice between
techno-surrealistic, visually interesting
photos from HP, Compaq, and AST,
and a dull but functional B&W pic,
which would you choose?

Editor's note: I'm thinking ....
Don't count on someone else doing
your work for you. No agent or rep or
retailer is as interested in your product
as you are. Perhaps it seems obvious,
but it's so very appealing to think someone else will do the job you don't want.
While the odds are against your
generating a retail market, it's not impossible. If you have an "in" with a retailer, give it a try. But prepare yourself
to encounter the sort of attitude I found.
while pushing Floppy Pockets. (Another
invention of mine that attached to existing hanging folders so you could
keep your floppy discs.. . . Oh, never
mind. That's another story.)
Anyway, this stationery store buyer
described to me his recollection of a
product that a large, respectable company tried to foist off on him. He knew
it wouldn't sell.
The company was 3M. The product?
Some silly little sticky pads, and they
only came in yellow.
Stay Tuned
Has all this discouraged me? Yep.
It looks as though MR. MOX is a bit
of a sleeper; a niche product where the
cost of finding buyers exceeds the price
of the product. (It's still available, make
no mistake about that!)
In spite of it all, I find myself thinking ..'.. What if there were an attachment
to the phone line that could detect a
single isolated ring, and then turn on
the power to the PC? If you called back
immediately, the PC would answer.
This way you could share the line with
an answering machine.
What if the PC would turn itself on?
Then, at 3 a.m., click, beep, PC dials,
connects to remote computer, download
(upload?), hangup, print maybe, turn
off, silence.
What if you called it LATER-ON,
since the PC programs itself to come on
later? What if this time the picture was
in color? Hook it up to your printer port,
but it doesn't affect printing. A few
lines in the AUTOEXEC and the PC
knows if it's turning on for an automatic telecom database inquiry, or for a
user sitting at the console.
New applications for realtors, stockbrokers, BBS addicts, football players,
housewives. MR. MOX-the next
generation! Clearly there is an opportunity here!
Maybe just one more release ....

•••

Around the
Bend
,
I gave you the details about the problem, but people had
questions so I'll give' em again.
First, you'll have to understand that getting valid service
information on hard drives is about as easy as swiping memos
from the CIA. So I make do with a rumor here, an upset customer there.
A while back I started hearing grumbling about hard drive
reformatters. The common complaint was that drives didn't
seem to work as well after nondestructive format. I questioned
the commenters.
"What kind of software?"
"What kind of drive?"
"What kind of controller?"
"Did you have new problems after reformatting and, if so,
what kind and how long did it take for them to show up?"
"Were there problems before reformatting?"
They were using SpinRite, 5 1/4" half-height Seagates (usually the 225s), and Western Digital controllers (those who
knew which controller they had). The new problems showed
up within a few weeks of the format, and most folks were
seeing a bad sector or two before they began the reformat.
(Bear in mind, this is a tiny survey, involving only half a
dozen drives.)
By the way, if you've been using any hard drive reformat
packages that save the data, by all means drop me a post card
with answers to the above questions (to Micro C, P.O. Box 223,
Bend OR 97709) or leave a message to the SYSOP on our BBS
(503-382-7643). That way I'll have a bigger survey.
Despite the tiny size of the sample, I suspected something
might be connecting all this together. I'd noticed that our XT
machines took hours for a reformat while ATs took only
minutes. Plus, the poor XT drives were seeking endlessly
(especially as the format progressed) while the ATs were just
stepping merrily along track by track.
It was then I discovered that the older XT controllers automatically home the head (the move toward home is very
slow), then count their way out, when they're asked to do a
single track format. (The controller designers assumed, I supposed, there was no other way to guarantee head position.
When you're formatting you can't count on reading an already
formatted track to check position. Only track 0, or -1 in the
case of the 225, is independently verifiable.)
The packages I've seen (SpinRite, Disk Technician, and Optune) are smart enough to spot a cludgy controller (by measuring the time it takes to format the first couple tracks). They
speed up the process quite a bit by doing a seek to track 0
before issuing the track reformat command. But the head still
has to move all the way home and all the way back before
formatting each track.
What does all this activity have to do with errors? Very
good question. It should make no difference how far the head
traveled, it should settle at exactly the same spot.
Hard drives that dedicate one surface to servo (position)
data have no problem positioning their heads precisely (these
drives have an odd number of read/write heads-you'll find
that full-height Seagates and Priams have odd heads).
But the little half-heights insist on cramming data onto
every platter; so they're not going to dedicate a surface for
position, they just count stepper motor pulses. (At least this is

Continued from page 4
the case for the stepper based assemblies, voice coil positioners with
optical position sensors are probably fine.)
Anyway, the heads can drift,
both with age and with temperature. That's the main reason you
purchase a reformatter. The heads
drift away from the original tracks.
When you reformat, you rewrite
the tracks where the heads are.
However, the heads may be in one
place after a seek from 0 and in a
slightly different place after stepping just once.
What began as a fix for slight
misalignment could actually make
the problem worse. At least that's
how I read it.
So .... If you have a half-height
drive with a stepper motor for head
position, an even number of heads,
running on a Western Digital controller, and you find it takes an
hour or more to do a nondestructive reformat.. .. Well, I think I'd
back off all the data and follow up
with a low level reformat and copy all the data back.
Might be enough reason to get an AT, eh?
Games
Okay, enough serious stuff, how about a light game of
chess? (An oxymoron for sure.) I've tried several chess programs, but the Chessmaster 2100 has the best graphics, the
best teaching mode, and it has a database of classic games.
Want to step back through one of your old games to see
where you went wrong? Fine. Want the computer to suggest
the next move? Fine, just tell it how much time it has to explore the possibilities. Want to know which positions can be
attacked by the opponent? Want to see your legal moves?
You can use a mouse or the keyboard to select and move
pieces, and you do it just like you would on a real chessboard.
You can select a top-down view of the pieces or an oblique
view, both easy to understand.
Does it playa strong game of chess? I don't know. When I
put it into beginner mode, I can beat it. That's all that matters.
Chessmaster 2100
$49.95
The Software Toolworks
19808 Nordhoff Place
Chatsworth, CA 91311
(818) 885-9000
Empire
"Empire is a wonderful game. Jerry Pournelle rated it the
top game, said he wound up playing it until 2 a.m.," my
brother commented as I threaded my way among computers.
Interesting. Jerry might get off on a silly game, but I have a

MICRO CORNUCOPIA, #49, Sept-Oct 1989

71

Around the Bend
column to write. Besides, I've sworn off trivial pursuits like
war games. (I tried a board game called Battleship oncefound it about as exciting as cleaning the cat box.)
"Try my copy, you'll like it."
I glanced through the manual, inside the back there were
pictures of the authors. Walter Bright? Our Walter? Author of
Zortech C++? Speaker at SaG? He wrote a silly game?
I borrowed Don's copy.
That very evening, about midnight, as I finished editing
some articles, I remembered the game. Popped in the disk
and:
"Empire, Wargame Of The Century"
Let's see, I start with one city and that city can produce an
army (every 6 turns) or a plane (every 17 turns) or one of a
half dozen ships.
Armies capture cities, troop ships haul armies, destroyers
map new territory, cruisers kill destroyers .... You play against
the computer, against another player, or both. How addictive
is it?
I called Walter and asked (not at midnight, you understand, I'd be interrupting his work day. I waited until the following noon).
He said he'd written the game on a PDP 11 while a student
at Cal Tech. When he went to Cal Tech, there were no restrictions on use of the 11; when he left, games were restricted to
graveyard shift-midnight to six a.m.
"So we renamed 'empire' to 'link,' or something like that.

That was the only way we could play it during the day.
"I no longer play it; after thousands of hours, I'm playing
with other things like C++. If I started playing it again I'd
want to add new things, like making the computer more competitive, and I wouldn't get anything else done.
"You know, it's hard to make the computer playa really
intelligent game. Most game writers create a dumb algorithm
but give the computer some kind of advantage, such as producing men faster. I worked hard on the game algorithm, so
the computer could play by the rules and still be competitive.
"Anyway, after Cal Tech, I knew it was a good game; I
tried to sell it on my own. It sold okay in spite of my efforts,
but mail order consumed too much time-filling orders, answering letters. Just a lot of details that don't interest me. I
didn't want to be involved in that end of things.
"So I collect royalties on the game and on C++. The thing
with royalties is that you work and work and work and it's
hard to keep in mind that eventually you're going to get paid
for it. Most people won't work for royalties because of the lag.
"Anyway, Interstel takes care of sales and promotion. In
fact, Empire was just reviewed in Penthouse."
But I'm getting ahead of myself-let's see, where was I.
Yeah, I start with one city, explore about, I capture more cities
with my armies, make more armies, expand my territory, capture more cities. Hey, there's an enemy troop ship! Where's
one of my destroyers? Geeze, it's getting light outside. Can't
be, it was midnight. .. just minutes ago.
Empire

ASwyzOW ~;~;~~
AT

LAST!

FLOW CHART AND ANALVZE
YOUR ASSEMBLY LANGUAGE
SOURCE CODE

b~~;k

~=

19855 Stevens Oeek BMj, Suite 154
Q.pertiro, CA 95014
(408) 24M5826
VISA· Me

current line
editor_warning
save screen
display-warning
restore screen
editor_warning
insert blank line
adjusl.line join_line
editor_warning
adjusUine
delete_ediCline
editor line out
ediUine_oUt -

t

~

30 - Day Money Back Guarantee
Reader Service Number 139

72

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Interstel
P.O. Box 57825
Webster, TX 77598
(713) 486-4163

add $10.00

n_J~\~'.
• Flow Charts
• Tree Diagrams
• Stack Sizing
• Register Analysis
• CPU Timing Analysis
• Procedural X-Reference
• 8088/87 to 80386/387
• Context-Sensitive Help
• MenulBatch/Command
line Operation
• MASM 5.1 Compatible

$49.95

ASMFLOW
I haven't done any assembly language programming lately,
mostly I work in Pascal (occasionally those efforts are perforated by a C filter). However, Larry has been disassembling
some things with Sourcer, and Sourcer generates assembly
language (for some reason no one has come up with a disassembler that regenerates the original C, or whatever).
So, I dug out the office copy of ASMFLOW and attacked
the output of Sourcer. Boxes and code and arrows, pretty
fancy. Makes it a lot easier to see the structure of the program.
The program also gives you an estimated time (and clock cycles) per routine for the 8088, 80286, and 80386.
It was interesting to watch the number of cycles it estimated. For instance, on Larry's screen update routine (we're
talking fractals here), it specified 486 clocks for the 8088, 273
for the 80286, and 156 for the 80386. In fact, all the code I
checked came out with about the same ratio.
Boy, shows how gullible I am. I believed it when the second source of 286s announced that a 20 MHz 80286 is as fast
as a 20 MHz 80386. It might be if they carefully select instructions, bu't not for any of the code I've seen.
Anyway, I remember writing assembly for a Z80. I would
have traded my second 8" drive for a tool like this. After
seeing what ASMFLOW displays, 8088 code looks almost easy.
Shucks, if Turbo Pascal 5.5 hadn't just appeared ....

way when the compiler complains or the code doesn't run, I
know it's my fault.
Now Borland's rele'ased 5.5. If objects in Pascal are as good
as objects in C++, we may find that ?oftware development is
no object. Or it is an object. Or people will no longer object to
writing software. (Sorry, I'm not being objective.)
Anyway this is beginning to sound an awful lot like something I'd put in the editorial.

ASMFLOW
$99.95 + $3.00 S&H
Quantasm Corporation
(formerly Quantum Software)
19855 Stevens Creek Blvd., Suite 154
Cupertino, CA 95014
(408) 244-6826
Turbo Pascal
For the past nine months, I've been working on a hardware
project. You know, it's one of those design jobs that you can't
talk about with your closest compatriots. However, into every
fun project a little software falls.
This is one of those I/O things where I prod lots of A/Ds,
MUXs, relays, etc. Ten years ago I'd have done it in BASIC.
Eight years ago I'd have written it in Pascal (although I'm not
sure how, there wasn't much hardware support in the old Microsoft Pascal). Six years ago I'd have done it in FORTH. Five
years ago I'd have gone nuts trying to read what I'd
FORTHed. Four years ago I'd have written it in C. Three years
ago I'd have written it in Modula.
Last year I started writing it in Pascal. Turbo Pascal 4.0.
Units make perfect libraries. I write them, compile them,
and use them. I write the low level stuff once. When it works,
it works. Of course C has libraries, but I don't C as well as I
Pascal. When I C I usually use myoid copy of Aztec. That

ICs
~\'\t::>
qr-:,t,;
0~\'Ot::>

r-:,t,;~e
....~

q~

~~,
,<0

c::,-<"

~,:. 0

.;:. ~,.
o~

G",

o~"'oc::,

~,.~+
~v

"\'l,.

qc::, ~;~

-<"~~l(,
~C:j

~
~<;)

PROMPT DELIVERY!!!

SAME DAY SHIPPING (USUALLY)

QUANTITY ONE PRICES SHOWN for JUNE 25, 1989

DYNAMIC RAM
SIMM (1) 256Kx36 80 ns $400.00
SIMM
1Mx9
80 ns 220.00 >'J'ct/:'
,!;qf<,o
SIMM 1(2)
1Mx9
85 ns 195.00 ~~
SIMM \
256Kx9
80 ns 95.00 ~~
1 Mbit
1Mx1 100 ns
16.25
II)M
256Kx1
60 ns
8.50 NM
41256
41256
256Kx1
80 ns
7.35 r!.r!.
co co
256Kx1 100 ns
5.95 MM
41256
00
coco
256Kx1 120 ns
5.75 CD 0
41256
64Kx4 120 ns
8.50 ..-N
4464
r!.r!.
co co
41264 (3) 64Kx4 120 ns 12.50 MM
00
EPROM
coco
I I I 128Kx8 200 ns $27.50
coo
'0
64Kx8 200 ns
9.95 1"'-.
II)
N..32Kx8 150 ns
7.25 co
ON
16Kx8 250 ns
4.50 co
STATIC RAM
0
~~
62256p-10 32Kx8 100 ns $26.50 1"'-11)
COM
6264p-12
8Kx8 120 ns
7.95 0..co
6116AP-12 2Kx8 120 ns
4.9
U)

U)

OPEN 6% DAYS, 7:30AM·10PM:SHIP VIA FED-EX ON SAT.
SAT DELIVERY

MasterCardlVlSA or UPS CASH COD

INCLUDED ON

MICROPROCESSORS UNLIMITED, INC.

F~~c~V~~D:~S ~~~~s~'6:,o;~4~~e"
111: ltd Air $6/31b No minimum order.
Frl P.1 $12.25/1Ib Shipping, insurance extra,

(918) 267·4961

Please note: prices Subject to changel
to $1 lor
'materials,

Speaking Of Objects
With Borland's release of objects, can Microsoft be far behind? Nope. In fact Redmond, Washington, came out with
Pascalian objects before Borland.
Microsoft's Quick Pascal is just the first shot. I think Microsoft would like nothing more than to invade Borland's home
court, the Pascal market.
The next year should be very interesting. Microsoft is
smarting from reviews, which conclude that Turbo debugger
is outperforming CodeView-no question MS would like to
depose Borland in the Pascal market and they're counting'on
objects to do it.
Are objects really that important? Look at AI. Prolog
started out with fireworks and then .... (By the way, what did
happen to Prolog? Maybe Gary remembers Prolog.) However,
I was talking to Bruce Eckel the other day and I mentioned
some of Blaise's Pascal libraries (most useful).

PC COMPATIBLE
ENGINEERING
Annabooks gives you the harNall, sanwall, and nl1llWall information you
need to design PC-compatible systems faster and better. And you have control of your design from the ground up -- our firmware and software products Include soiree _I Plus all the utilities you need.
Do hardware design? DIctIr Dull.', 1M DRAM SuperSpec Is the first of a
series of hardware books you won't want to miss. And a PC Bus timing book
Is on the wayl Start by getting these books:
AT BIa,KIt: an AT Bios with source code you can modify. With setup
& debug. 380 pages with disk, $199
IT BiasKlt: Includes a debug. 270 pages with disk, $99
Iittl Wlldcanl 11". .11 for XT BlosKit: Includes ASIC setup, turbo
speeds, 60 pages with disk, $49
1M DRAM 8IIIIrSpIc: Design your memory to all mfg's specs at oncel
Lots of timing diagrams &tables, $79
Pro.Klt: Puts anything in Eprom or SRAM; DOS, your code, data,
you name ItI With source on disk, $179
SylKIt: Here's a debug/monitor you can use even with a brand X
Bios. Includes source, of course. $69
IT·AT HandllDok: The famous pocket-sized book jam-packed with
hardware & software info. $9.95 ea. or 5 or more for $5 each.
Software tools: You need MS C& MASM 5.1 for modifying the Kit products.
Mention this ad when you order and get a 1111 IT·AT
Handbotk q Chalsslr I Fosterl Hurry before we come to our
senses and change our minds.

. FREE
Annabooks

12145 Alta Carmel Ct Suite 250·262

San Diego, California 92128
Reader Service Number 37

(6191 271-9526 Money-back guarantee

Reader Service Number 160

MICRO CORNUCOPIA, #49, Sept-Oct 1989 73

Around the Bend
"Are they object oriented?"
"No, not the versions I have."
"Then I have real trouble getting interested. Too much
trouble to use a library that's not designed around objects."
He has a point. The less you need to know about a library
routine, the easier it is to use. Objective libraries should be
very easy to get close to. (We're talking libraries here, not
librarians.) Speaking of librarians ....
How Fast Is Fast?
I spend most of my life plodding along behind an 8 MHz
.80186 system while out in the other room lies our latest acquisition, a 20 MHz 80386 screamer. It's usually busy-grinding
out fractals.
When I hit return on my 186 things pick right up, and it
isn't very long before something has happened. (I do have to
clean up around the processor socket after rust flakes off the
accumulator.) By the time I've finished hitting return on the
386, however, things are fairly well completed.
I understand we'll soon see a new 60 MHz 486. (How soon
is open to speculation.) There's a good chance Intel will run
into timing problems, after all the chip will be doing a fair
number of things in a short amount of time. I know a lot of
silicon engineers (hard rock miners) who'd be hard pressed to
do that much stuff that quickly.
Don't misunderstand, I don't have a pick to grind. Intel can
make chips fly fast and furious, but I reserve the right to finish

my return before the damned computer finishes the answer.
Kinda keeps things in perspective.
Silence
The reason my little Toshiba 1000 has become my favorite
writing computer isn't so much what it has, it's what it hasn't.
It hasn't any, uhm, noise.
There's no hard drive to whine, no power supply fan to
buzz, no monitor to whistle, no nothin'. The only thing I hear
is the chunk, chunk, whirr of the floppy drive when I'm loading or saving a file. But then it shuts up so I can work.
Someone should come up with standard 150 and 200 watt
PC power supplies with quiet fans (slow turning with special
blades). There's no reason that moving air has to be so noisy.
Since we're now moving (more or less successfully) to 3
1/2" drives, it seems like some of those should be both reliable
and quiet. Maybe there is one, though. Maybe I just haven't
heard about it.
Silently yours,

(F .

David Thompson
Editor and ....

If you thought Borland's popup product
was great just wait untU you see
OpalFire's MyFLIN for Pascal.
MyFLIN is a TSR program that captures procedure and
function details directly from the screen while you are
programming. It saves this information in an indexed database
for instant recall at any time you need it.
MyFLIN will save you hours of searching thru pieces of paper
looking for parameter details when calling a procedure. Simply type part or all of the name and press the hotkey. MyFLIN
will popup over your source code and display the nearest
named description you have stored in your database, complete
with parameters and comments.
To save a new description, positon the cursor on the procedure
name, popup MyFLIN and press "A" to add. The details will
be captured from the screen and saved with a single keystroke
and you can add a comment line as well.

YOU WANT THE SOURCE1!
WELL HOW YOU CAN HAVE IT! The IIASTER-POL
DISASSltIIBLER. (1ID86) will create HASH co.patible
source code fro. program files (EXE or COH).
And the files are labeled and co •• ented so
they become USEABLE. HD86 is an interactive
disassembler with an easy to use., word
processor like interface (this is crucial for
the REAL progra.s you want to disassemble).
With its built-in help screens you
won't have to constantly refer to
the .anual either (although
there are valuable diSC. us-~
sions on the ins and outs
of disassembling which
you won't want to miss).
'I
f::;

t

.,... c-. .....r •• •

Price $69.00 + $5.00 P&POSt.
Visa / Mastercard / American Express are accepted.

32~£!!fr!t~~tr~~t~~%~Al~~057
Phone 1-800-336-6644
MyFLIN requires PC/XT/AT Computer and MS-/PC - DOS 2/3.xx.

Reader Service Number 161

74 MICRO CORNUCOPIA, #49, Sept-Oct 1989

HD86 is a professionally
supported product and yet costs
no more than "shareware". And of course, it's
not copy protected.
YERSIOI 2 BOW AVAILABLE!
IID86 Y2 is om.Y $67.SO ($I.SO sn)

+ tax

C.C. Software, 1907 Alvarado Ave., Walnut
Creek, CA 94596, (415) 939·8153
Reader Service Number 31

Letters

Continued from page 6

called the radar equation.
I dusted off an ancient tome on radar,
and there it was-an inverse fourth power
relationship. Now whether this equation is
empirical or founded in theory, I can't say.
And it still feels wrong to me. Anyone have
anything to add to this powerful controversy? (The airlines are certainly hanging on this one.) (LCF)

practical articles about what you can do
with what you have: articles on disk
formats, what's a FAT, using CONFIG.SYS, etc. So many magazines have
articles that are just hype for new hardware and software that I can't afford
anyway. Besides that, your non-glossy
pages are easier to read than the glossy
ones that have so much glare.
However, I subscribe to your magazine for the computer content. A few
remarks once in a while, about life in
general or your SaG adventures, are refreshing. And I enjoy your wry humor.
But your July/August issue went overboard on your metaphysical views.
That's not what I subscribe for.
Peter E. Walberg
390 Lorna Dr. Box 57
Forsyth, IL 62535-0057

Editor's note: Thanks for the comments
Peter, I take them to heart. So far, we've
received seven letters, calls, and BBS messages opposed to my mentioning the
metaphysical in the editorial (two of those
were subscription cancellations).
On the other side, seven people have
been very supportive. "Where have you
been all these years?" has been the general
comment. I particularly thank those of you
who sent reading material (e.g., The Tao of
Pooh, The Mystic Path to Cosmic
Power, and, curiously, Humor Suddenly
Returns).

I've been slowed a bit on the books however. Turbo 5.5 just arrived, Hitachi sent a
whole box-full of controller data books, and
I've got to finish responding to these letters.
Isn't life a kick?
LIMBO's Distance Sensor
Since he shows us neither mathematical proof nor empirical data, I don't
know how Bob Nansel ("The LIMBO
Project," Issue #47) came to the astounding conclusion that the intensity of reflected light is inversely proportional to
the fourth power of distance. But he is
clearly in error in this assumption.
Mr. Nansel contends that since the
intensity of both the incident wave and
the reflected wave are subject to the inverse square law, then somehow these
two functions should be multiplied, resulting in an inverse fourth power law.
I'm curious as to what happens if, after
leaving the source, the light is reflected

twice instead of just once before it
reaches the detector. Do we then have
an inverse sixth power, or an inverse
eighth power relationship?
The power detected is actually proportional to-

where dl is the source-to-reflector distance and d2 is the reflector-to-detector
distance. No product, just the inverse
square of the sum of the distances.
As Mr. Nansel has pointed out, we
are measuring power per unit area. The
dimensional analysis must be consistent
with these units. The square of d (a
length) is consistent with area, but the
fourth power of d is not.
Neither of the two parts of the article
published so far have made it clear just
what the upper and lower range limits
are. So it isn't possible for the reader to
estimate the limits of sensor input and
thus determine whether he needs a log,
rather than a linear, amplifier.
I hope, upon reflection, Mr. Nansel
sees the light (puns intended).

To List Or Not To List
I have enjoyed your magazine very
much. Especially those articles on computer hardware (e.g., controlling the
outside world through the parallel port)
and the Pascal columns (more, please).
My only complaint is about what I
seem to get for my subscription fee.
Since you only publish six times per
year, I would like to see fewer National
Geographic type articles. For example,
the trips through Turkey are interesting;
but if you were the size, cost, and periodicity of, say, PC Computing, those articles would be a refreshing insert rather
than a squandering of valuable space.
Judging from your gushing (pun intended) comments on the SaG, there
doesn't appear to be a shortage of computer-related material. Would it be
possible to include some of the SaG
discussions in future issues?
A few times in past issues, great articles were diminished by statements to
the effect of, "Here's a partial program
listing. Call our BBS for the complete
program." Since your BBS isn't PC-Pursuitable, the long distance charges make
the call cost-prohibitive. Please don't
print only partial listings.
Product reviews are okay, but I enjoy
Micro Cornucopia more as a nuts-andbolts type learning tool on the how-to
and why-of the microprocessor world.
Because of this, in the past I have recommended your magazine to others as
a valuable information source.

Don E. Sweet
2161 Snowberry Road
Tustin, CA 92680

209 Cecil Ave.

Editor's note: When I read Bob's article
for the first time, my physics antennae went
up, too. So I gave him a call to set him
straight on inverse square fall off. Neither of
us could convince the other how wrong he
really was, so I headed off to the library to
check out· Bob's reference to something

Editor's note: Boy. I know what you
mean. I like complete listings. I also enjoy
the fun stuff that helps me understand the
person who's behind the technical information. This issue Larry was struggling with
this question. Much of his current fractal
code is a simple repeat of code we've run in

Ron DesGroseilliers, Jr.
Springlake, NC 28390

MICRO CORNUCOPIA, #49, Sept-Oct 1989

75

Letters
recent issues. So he's limited it to the PostScript additions .. That way we have room to
run one more article in this issue.
Making Custom PC Cards
If you took to heart the piece in Issue
#43 by Bruce Eckel on designing your
own cards for your PC, you may wish
to make something less prototype and
more production than the prototype
cards described. If you have OrCAD
PCB, log on to OrCAD's BBS, (503) 6405002. Look for IBMPCB.ARC in the PCB
Download area, among the Customer
Contributed Models.
You won't need to be a registered
user to download it, but you will need
OrCAD PCB to make use of it. It has the
outlines and connectors already drawn
for half- and full-length cards for both
XTs and ATs. There is a useful .DOC
file as well. When you've done the prototype the way Bruce suggests, and
you're ready to launch your creation on
the world, this is the way to take the
next step.
John Innes
120 MacPherson St,
Cremome, NSW 2090
Australia
Free PCB Autorouter
I've enjoyed Micro C for many years
as a newsstand purchase, and recently
(finally!) ordered a subscription. I read
with interest the articles in Issue #45
about PCB layout systems.
Micro C readers might like to hear of
the best bargain available in this type of
software: autorouting PCB layout software that runs on EGA systems, outputs to an HP laser printer, and comes
with full C and assembly source code.
The price: FREE!
Interested people can contact the
program authorRandy Nevin
1731 211th PI. NE
Redmond, WA 98053

Just send a formatted floppy and a
self-addressed mailer with sufficient
postage. The system doesn't have a
flashy interface, but it works and is suitable for two-sided board production.
The author invites feedback on the product so he can improve it.

76 MICRO CORNUCOPIA, #49, Sept-Oct 1989

Continued from page 75
David Gwillim
159 Woodbury Road
Hicksville, NY 11801-3030

1?H1?l lsny
09SZ MSN IUMolnaqdUl1?:J

'O'd lOS xog
U1?HS1?9 'M 'y
'u!cd
C SCM ~u!dAl anqM plcoqAa){ aql dn ~u!
-Ploq lnq 'PU!W 01 waas lOU P!P OldAC)l
aql. 'UMOP ap!sdn lsnqM Isanbal S!ql
padAl I 'suonclal IcuOnCulalu! poo~ }O
lSalalu! aql U! lcql uosdwoql. 'f P!ACa
'lW lnoA nal ascald nOA PlnoM
'aw Ol JHCWalps AI oldAC)l aql puas
PlnoM nOA H In}alCl~ aq PlnoM I
lap10 lapUn UMOQ

Rebuttal Rebuttal
What did I say? What did I say?
Quick, pass me that half-eaten bag of
CCCCs (crispy chocolate chip cookies)
from your editorial in Issue #45. What
was it that I said in my letter (in Issue
#42) that so upset John Mulligan ("Letters," Issue #45), a self-confessed computer store person?
I turn to my pile of magazines and
dig out the edition to read my letter
again. Ah, there it is. One passing reference to computer store sales staff (CSSS)
and the insinuation that many of their
ranks are pretenders.
Not such a damning statement
methinks. A mere pinprick in the bloodletting of business, I would have
thought. Certainly defensible most
would say, I think. (A thought-provoking letter, this.)
Well it appears that John was provoked into thought, too. Several
hundred words worth in fact. All in
defense of himself. Some were dripping
with sarcasm and vitriol. Others I have
not heard of; what do "buffalo chip
slinger" and "dishwashing jarhead"
mean?
I suspect that the former equates to
an Arthur Daley used car salesman and
the latter to a pre-stardom Sylvester
Stallone doing night jobs (maybe post
Rocky X and divorces, as well). And if
money be the measure of success then I
suppose I should be flattered with the
comparisons, but I guess I'm indifferent.
I understand "intolerant," but I don't

think it applies. After all, I am answering John's letter. And from the passion
of it, I'm glad I don't live in Syracuse.
Author I am not, but I hope John
doesn't have the ear of Khomeni.. ..
Honest, John, I was not speaking
specifically of you when I said CSSSes
are less expert than they claim to be.
During the last ten years, I have computer shopped in many places around
the world (including Bend ... by telephone).
Unfortunately, I have found many
staff who don't understand their product range, a lot who believe that they
do, some who make an effort to learn,
and some who have been very good.
Perhaps the good ones get promoted to
managers. Salesmanship is more important than technical expertise on the shop
floor. Anyway, my original comment
was aimed at the pretenders.
To other matters. I see that DJT of
Micro C (the tall skinny guy with the
startled expression) is suggesting that
the answer to the Ultimate Question of
Life, the Universe, and Everything is a
variable! (See "Culture Corner" Issue
#45.) A daring contention. Just when the
world was getting comfortable with 42.
Still, the idea does have consistency
with the Uncertainty Principle. Unless,
of course, with your blossoming confidence you may task Larry to look at
Schrodinger's cat and declare that the
Uncertainty Principle is not a sure
thing. Avant-garde stuff. Obviously,
Micro C thinks it can make waves in the
mainstream of contemporary publications. But be mindful of the puddles
you are leaving behind.
Speaking of changes, I am glad the
full frontal is back to the front so to
speak. Thanks for the CCCCs, but one
didn't taste too good. Could it have
been a Buffalo chip cookie?
Having reread this letter, I hope
there are no sensitive Sylvester Stallone
fans out there. I may be running the
risk of another nasty-gram.
Bevin J, Pettitt
84 Sun Valley Road
Valley Heights, NSW 2777
Australia

•••

UNITS &
MODULES
By Michael S. Hunt
th

2313 N. 20
Boise, 10 83702
(208) 233-7539

Keeping Order, Generically

Are you out of sorts? Are your friends out of
sorts? Well, here's the sort for all sorts, the ultimate generic sort. (You can sort all your generics
this way.)
here are many ways to sort data. Quicksort, shellsort, heapsort, bubblesort, insertionsort, and binsort to name a few.
Although each of these sorting methods has its
pros and cons, all accomplish the same end
(sorted data, we hope) by different means.
Usually they're implemented for a specific
data structure.
Each time the data structure changes, we
face the task of modifying the sort routine. In
keeping with the spirit of reusable tools, how
about a sort routine that handles any data
structure.
As I mentioned last issue, one of my new
toys at work is a VAX cluster running VMS.
VMS has many, many, many built-in routines
for the programmer. The SOR routines make
up one set.
The SOR routines let you sort or merge records and files with a few simple system calls.
The unit GenSort (see Figure 1) only supports
sorting of records. A full emulation of the
VMS SOR routines would require about three
to four times the source code.
I hope to make clear how the routines work
so you can use them and adapt them to your
specific programming style and needs. I'll
cover them in the order of use.

T

GenSrtBegin
This routine initializes the sort by passing
key information and sort options. An array of
words contains the key information. The first
word is the number of keys. Each four-word
group after that specifies the data type, order
(ascending or descending), offset from the
beginning of the record (first byte is 1, not 0),
and the length of the key.
GenSrtBegin returns a sort id that uniquely
identifies the sort, and a status code. It's the
first routine to call for a sort.

GenSrtRelease
The GenSort routines don't receive all the
data at once. A call to GenSrtRelease passes
each record to the sort. It builds the key for
each record according to the key information
stored in srtKeyArr by GenSrtBegin.
GetMem allocates storage space for the data
and key because the standard procedure New
allocates a specific number of bytes according
to the variable's type. Our variable type is
largely unknown and the storage requirements
vary between sorts.
The key is built a byte at a time. By using
variable type casting to access the address offset, it increments the pointer to the current
byte location. Use move to transfer the actual
record information from the calling routine's
variable to the space allocated. Then make a
call to GenBinlnsert to insert the information
in the correct location in the binary tree. (GenBinlnsert is part of the GenBinTree unit. See
Figure 2.)
GenSrtDoSrt
Nothing really happens at this stage of the
sort. The sort status changes to prevent further
entry of records. If you used a sort method
other than the binary tree insertion, this would
be the appropriate procedure to initiate the actualsort.
I choose the binary tree insertion sort because it works naturally with the record-at-atime loading of SOR. It's also a natural lead
into next issue's topic.
GenSrtRetrieve
Use this to get your data back from the
black hole you've dumped it into. This retrieves the data from the binary tree and
moves it back into the calling routine's variable. The procedure GenBinRetDelSmRec
stands for "return and then delete the smallest
record from the binary tree."
GenSrtEnd
This deletes any records remaining in the
tree and returns the srtId to a "not valid" status, making it available to another sort.
MICRO CORNUCOPIA, #49, Sept-Oct 1989

77

GenSrtStat
This routine returns the status record
for the passed srtId. It's great for debugging.
GenSrtMsg
This procedure provides a text interpretation of the error messages and sort
states.
Miscellaneous
GenSort allows up to MAX_SRTS
sorts at one time. I've found this feature
very useful when reading data from
several files and preparing several reports. GenSort does little error checking.
The addition of more data types such as
integer and real is necessary for this to
be a really useful tool.
As always, the Turbo Pascal 5.0 and
Modula-2 code for the two units, along
with sample programs, are available on
issue disk #49 ($6) or the Micro eBBS.
Next Time
One of the problems with using the
GenBinTree (see Figure 2) unit is that if
you insert the data into the tree in a
somewhat sorted order (either ascending or descending), the tree begins to resemble a linked list. Insertion times become lengthy and the sort performance
goes to heck. If you keep the tree
balanced, then search and insertion
times get better.
The A VL method (named for
developers Adelson-Velskii and Landis)
is one way of maintaining height
balanced trees. Height balancing does
cost. It requires additional processing
time to keep the tree balanced. A
balance factor, the difference between
height of the right and left subtrees of a
node, must be stored with each node.
A programmer has to weigh the
advantage of faster access speed (Le.,
data retrieval) against the computational and storage overhead of keeping
the tree balanced. The height balanced
tree is ideal when you'll build the initial
tree and then make very few insertions
and deletions, but make many queries.
Join us next time when Joe Reader
says, "Is that really a full-blown, generic
data, AVL, height-balanced tree toolbox?" And Michael (Midnight Programmer) Hunt replies, "Yes siree, it really
is."

•••
78 MICRO CORNUCOPIA, #49, Sept-Oct 1989
~--

.. ------~-----------

for j :=.1 to srtKeyArr[srtld].nbrKeys do
srtStatArr[srtld].keyLen :=
srtStatArr[srtld] ,keyLen
+ srtKeyArr[srtId],key[j) ,length;
srtStatArr[srtld].nbrRec := 0;
srtStatArr[srtld},srtState := GenSrtSt REL;
GenSrtBeginF := GenSrtErr~
end
else begin
ClearSrtld(srtld);
GenSrtBeginF := GenSrtErr_TMK
end
end
else GenSrtBeginF :'" GenSrtErr_MSE
end;

array(l .. MAX_SRTSl of treePtr;
word;
j:word;
done : boolean;
begin
j:= 1;
NextSrtId :=0;
done :=false;
repeat
if srtStatArr(j].srtState
GenSrtSt_NV
then begin
NextSrtld : = j;
done := true;
srtStatArr[j] .srtState := GenSrtSt_REL
end;
j := j+1
(j >MAX_SRTS) OR (done)

=

procedure GenSrtRelease (var rec; srtld : word;
var srtStatus : word);
begin
srtStatus := GenSrtReleaseF(rec, srtld)
end;
function GenSrtReleaseF (var rec; srtld
var data, key, tkey : dataptr;
), k : word;
begin
i f ValidSrtld (srtld)
then begin

function ValidSrtId(srtld : word) : boolean;
begin
if (srtld <'" MAX SRTS) AND (srtld > 0) then
if srtStatArr[;rtld],srtState <> GenSrtSt_NV
thenValidSrtld := true
else ValidSrtld := false

word)

word;

k := 1;

ClearSrtld(srtld : word);

:=

0) then

:= GenSrtSt_NV
rec; recLen

word);

word);
dataLen, srtIO)

function GenSrtBeginF (var

GetMem(key, srtStatArrtsrtldl,keyLen);
GetMem(data, srtStatArr[srtld).dataLen);
tkey :;:; key:
for j
1 ~osrtKeyArr[srtld].nbrKeys do
begi.n
if (srtKeyArr[srtld].key[j].dataType
GenSrtOType~BL)
then begin
tkey" :=.Chars(rec) [srtKeyArr[srtId].
keytj]·offset];
Inc(PtrRec(tkey).ofs,l)
end
else if (srtKeyArr[srtld].key[j],dataType =
GenSrtOType_B)
then begi.n
tkey":;:;.Chars(rec){srtKeyArr[srtld).
key[j] .offset];
Inc(PtrRec(tkey),ofs,l)
end
else

word:
word;

MICRO CORNUCOPIA, #49, Sept-Oct 1989 79

68000
SK*DOS - A 68000/68020 DOS containing everything
you expect in a DOS - on-line help, multiple directories,
floppy and hard disk support, RAM disk and/or disk
cache, 110 redirection, and more. Supplied with editor, assembler, Basic, powerful utilities. Supported by Users'
Group and BBS. Software available from other vendors
includes C compiler, Basic, editors, disassemblers, crossassemblers, text formatter, communications programs, etc.
Priced at $165 with configuration kit, less if already
configured for your system.
HARDWARE - 68xxx systems start at $200. Call or
write.

Long Horn SOG
Stuart Varus called to say the Texas SOG has been
reduced to a regular meeting of the Computer
Council of Dallas. However, we're all Invited and Irs
free.
Leave a message on Stuart's machine If you want
travel and lodging Information (or leave a message
to let him know you're coming). Otherwise Just show
up. It'll be Saturday, July 14th 9 a.m. to 4 p.m. at the
Infomart. If you'd like to speak, definitely call him. If
you'd like to see 90 SIGs meet at once, then plan to
go.
Infomart

Star-K Software Systems Corp.
P. O. Box 209 Mt. Kisco NY 10549
(914) 241-0"..87 I Fax (914) 241-8607
Reader Service Num ber 40

_80

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Stuart Varus

1950 Stemmons FWV

Dallas 75207

214-867-8012

(Weird hours)

You've Seen Your Computer Run,
Now Watch It Fly!

S. Hunt
Date: June 1, 1989
released into thepublio domain. *)

llink, rlink ~treePtr;
data, key: dataPtr;
datalen, key Len : word
end (* treeNode *);

IBM-PC, XT, AT, '386 Blue Flame II
Semi Disk Solid State Disk Emulator
Featuring:
• PC-DOS, MSDOS, and Concurrent DOS Compatible
• Very Fast Access: 6.4 Mbits/sec
• High Capacity: Up to 8 MB Per Board
• Expandable to 32 MB
• Battery Backup Option
• Hardware Parity Checking
• No Mechanical Wear
SemiDisk Systems, Inc.
• No Special Interfacing
11080 S.w. Allen #400
• Prices Start Under $600.

(varnode : treePtr;
key : dataPtr; keyLen : word;
data: dataE'tr; dataLen: word);

VISA: _

Beaverton, OR 97005
(503) 626-3104 FAX 503-643-0625

Reader Service Number 162

..................... Are You Moving?
Take Micro Cornucopia With You.
Please send us your new address at:
Micro Cornucopia
PO Box 223
Bend, OR 97709

Old Address
Name: _____________________________
Street: _ _ _ _ _ _ _ _ _ _ _ _ __
City: _ _ _ _ _ _ _ _ _ _ __
State: _ _ _ _ _ _ _ _ _ _ _ __
Zip Code: _____________
New Address
Street: _______________
Clty: _ _ _ _ _ _ _ _ _ __
State: _ _ _ _ _ _ _ _ _ _ _ __
Zip Code: _ _ _ _ _ _ _ _ _ _ __

.. ..................................................
~

MICRO CORNUCOPIA, #49, Sept-Oct. 1989

~

81

By William K. Rohwedder and Wayne L. Everhart

Interfacing
Sixteen-Bit Devices

Northern Regional Research Laboratory
USDA-Agricultural Research Service
1815 University St.
Peoria, Illinois 61604

To The IBM AT Bus
Okay, so you got a real 286 machine.
Now what're you going to do with it, huh?
Hobble it with 8-bit I/O? Come on now, you
can do better than that. A lot better.
ith its fast processor and 16-bit
data bus, the inexpensive ATclone provides an excellent industrial and scientific tool for data
measurement and control. The 16-bit interface is ideal for driving 16-bit digitalto-analog converters, reading 12-bit
analog-to-digital converters, and communicating with other word-oriented
devices.
Almost all personal computer interfacing is done in 8-bit bytes from the computer to printers, terminals, and modems.
C have
Publications like Micro
thoroughly described these interfaces.
But, little has been written about 16-bit
interfaces.

W

Computer liD
The machine language instructions IN
AX,DX and OUT DX,AX control input
and output of 16-bit data in AT computers. A MOV DX, (port address) instruction loads the port address into the computer's DX register.
During an OUT instruction, the computer loads the contents of AX (16 bits)
onto the data bus, and the port address
onto the address bus. The computer indicates to the interface that the data and
port address are available by bringing the
lOW bus line low.
Execution of an IN instruction is identical except that the data moves in the opposite direction, and the lOR line goes
low. 'the interface must decode the port
address, and the lOR or lOW· lines; it
must accept data from the data bus, or
present data to the data bus during the
active lOW or lOR.

82

MICRO CORNUCOPIA, #49, Sept-Oct 1989

Designing 16-bit interfaces is straightforward if you follow two rules: connect
the I/O CS16 feedback (shown in Figure
1), and use only even-numbered ports.
Circuit Description
We used the inverters in the 74LS04 to
generate logic one inputs to the 74LS30
NAND gate for the chosen port address.
The correct I/O port address produces all
ones at the 8 inputs to the NAND gate
which in turn produces a logic zero at its
output, pin 8. The decoding includes the
AEN bus line to prevent DMA transfers
from activating the interface.
The IBM Technical Reference for the
AT (a lot of money for very little information) assigns port addresses hex 300
through hex 31F to their prototype card.
This would appear to be a good place to
put experimental interfaces. Hex 0 to hex
IF is 16 even-numbered input ports and
16 even-numbered output ports. The interface circuit in Figure 1 decodes only 4
input and 4 output ports.
Enabling the 74LS139 2-to-4 decoder
chip requires a logic 0 at the IG or 2G
input. The 74LS32 OR gates supply this
logic 0 only when the output of the 8input NAND gate is low and either lOW
or lOR is low, thus enabling the decoder.
We decode address lines Al and A2
(along with lOR/lOW) to choose one of
the eight devices. The eight outputs of
the 74LS139 chip are normally high. Only
the one that fits the address decoder goes
low for the length of time the lOW or
lOR goes low. The eight outputs connect
to an 8-input NAND gate which enables
the tri-state 74LS126 gate to pull the I/O
CS16 line low, indicating to the computer
that a 16-bit transfer is occurring.
This circuit uses only two of these outputs. The others are available for extra
ports or as control pulses.
We use a pair of 74LS574 chips to
latch the output from the computer, and

a pair of 74LS244 tri-state bus drivers to
control the input to the computer. In
many designs, transceivers would be
used here and the data lines would be
multiplexed to handle both input and
output on the same lines. (Of course, the
data on these lines would probably have
to be demultiplexed with a set of latches
farther down the line.)
The 74LS574s latch data from the AT
bus when they are clocked by the inverted IOW300 line, formed by decoding
the lOW and the address lines. The OUTPUT CONTROL of these chips ties to
ground so that the latched data is always
available. The 74LS244 chips make the
data on their input lines available to the
computer bus when the IOR300 line
pulls enable low.
Other octal tri-state bus drivers (74LS240, 241, 373, 374, and 573) also could be
used to latch the data.
You can use the circuit in Figure 1 for
l6-bit data transfers. Another set of input
and output chips could be wired to
IOW302 and IOR302 for control, to provide data ready, end of conversion,
strobes, or handshaking capability. The
IBM AT manual recommends "a maximum of two low-power Shotty (LS)
loads per line." The outputs of tri-state
chips in the high impedance state do not
draw enough current to consider them as
loads on the bus lines.
Construction
We wirewrapped the interface on a
Vector Electronic Co. Model 4617-1 plugboard. The board comes with a paper
layout of each side, a universal bracket,
and an instruction sheet containing the
AT bus pin names and locations.
We soldered the power and ground
wires (not shown in Figure 1) to the
wirewrap pins using 22-gage wire. At
each chip we also soldered in a 0.033 /IF
bypass. Then we wirewrapped the signal

Figure 1-Circuit Diagram Of Sixteen-bit AT Interface.

r---

B13
A9
A22
A8
A23

A24
A25
A26
A27

PORT ADDRESS DECODER
1
2
74LSB4
3

~2
A6

3

5

9

8

6

11
A28 ~lB
12 12
AEN
13
All
1m
B14
A2
A29
Al
A3B
A31 ~NOTUSEO

---02

170

~SHl

013
A9
01
A8
02
A7
03
A6

04
A5
05
A4
06
A3
07
A2

08
Cl1
09
C12
Ole
C13
011
C14
012
C15
013
C16
014
C17
015
C18
~

AT
BUS

WRITE
2
3
4
5
6

2=

Yf""C:

fil-

~

..
74LS574

~OUTB
~OUT3
11 ..n.
15

~OUT4

----OUTS

fr=~~~

'1

00l'I'UT 1
CONTROL

2
3
4
5
6
7
8
9

74LS574

2

74LSB4
1

DATA OUT

~OUT2

7
8
9

6

':'

18
r---oun
17
ClK

74LS139
4 R5W3mJ
1m
2
5 ~
r - - - - - lA
6 ~
~ lB
7 ~
12 TOR3D
15
11 ~
E
10
~
.-..~ 2A
13
9 ~
~ 2B

2

74LS126

AT
BUS

r---

3

74LS32
3

4 74lS3B

4

~6
A4

11

19

~OUT8

-----OUT9
1Z--oune
16
-ounl
11 ..n.
ClK
15
-OUT12
.1±-OUT13
13
~oun4

-;--oun5

00l'I'UT
CONTROL ~

=

-013
A9
01
Aa
02
A7
03
A6
04
AS
05
A4
06
A3
07
A2

1
2
3
8..r-4
'---5
74LS3B 6
11
12
READ
18
16
14
12
9
7
5
3

...

DATA IN

74lS244

012
C15
013
C16
014
C17
015
C1a
~

AT
BUS

18
16
14
12
9
7
5
3

~IN13

4
r---IN1

~IN2
~IN3

lG"

1
11

"'L1"

~IN4

f---IN5

~IN6

E
08
Cl1
09
C12
Ole
C13
011
C14

I

74LS244

17
r---IN7
19 "'L1"

2

~IN8

r---IN9

rLINl13
a

lG"

f---IN11
1 "'L1"
11
r---IN12

~IN13

~IN14
~IN15

E

9

"'L1"

MICRO CORNUCOPIA, #49, Sept-Oct 1989

83

lines point to point to reduce crosstalk.
110 CS16
The IBM AT manual defines the I/O
CS16 line as an input to the AT bus
which "indicates to the system that the
data transfer is a 16-bit, 1 wait-state, I/O
cycle." The manual does not say why it's
important, nor does it say what will happen if it isn't used.
Figure 2 contains oscilloscope patterns. The "A" group is the desired condition with I/O CS16 pulled low when
selecting the address port. The IOW300,
consisting of the decoded address lines
and the lOW pulse, exactly follows the
shape of the lOW pulse. Since the I/O
CS16 line connects to the IOW300 line, it
also follows the lOW pulse.
If I/O CS16 isn't connected, Figure 2B
shows the strange things that happen. A
single OUT DX,AX instruction produces
two lOW pulses! IOW300 has a single
pulse aligned with the first lOW pulse.
IOW301 (we wired it up specially) has a
single pulse aligned with the second
lOW pulse.
Address line AO contains logic zero
during the first lOW pulse and changes
to logic one during the second. The computer is changing the address lines
during the lOW cycle! The IOW301 pulse
ocCt!rred with the second lOW pulse because the address lines had changed to
address 301 and the lOW pulse was present. If one used these signals to control
equipment, strang~ things would happen.
We connected fifteen of the data lines
(OUTO through OUT14), at the output of
the 74LS574 latch, to a logic analyzer in
order to follow the movement of data
through the interface. We connected the
lOW line to the 16th logic analyzer line
and the logic analyzer clock to the 10
MHz AT clock CLK, bus pin B20.
The 10 MHz clock effectively makes
the logic analyzer into a 16-channel
storage oscilloscope with 2048 measured
points, each 100 nanoseconds long. We
set the output data word at hex CC55 so
that the high-order byte could be recognized from the low-order byte. With the
feedback connected to I/O CS16 and an
instruction of OUT DX,AX, the hex CC55
transferred to the output of the chips
with a single lOW pulse as expected.
With the I/O CS16 disconnected, figure 2B shows the lOW line had two
pulses. At the first lOW pulse, the 16-bit
data transferred to the 16-bit output in
proper order, both high and low bytes.
At the second pulse, the high-order data

84 MICRO CORNUCOPIA, #49, Sept-Oct 1989

Figure 2-AT Bus Activity With and Without 110 CS16.

A

lOW

IOW3"1"1

I/O CS16

B

lOW

IOW3"1"1

I/O CS16
-"1-

IOW3"1l

A"1

o

0.4

0.8

1.2

1.6

Microseconds

transferred to the low-order byte of the
output. The word went to the 8 loworder output lines in a byte serial procedure-55 followed by Cc.
If the interface was wired to handle it,
the byte serial transfer could be used to
transfer a 16-bit word in two 8-bit bytes
to the low-order output lines. The
address line changes, as described earlier,
could be used to clock two 8-bit latches.
The logic analyzer showed CC in the
high-order byte, during part of the second lOW pulse, but the data changed to
FF part way through. Apparently some
display terminal controllers used this 2byte serial transfer to load 16-bit words
into their 8-bit memories.
Port Addresses
Output to odd port addresses produces double-pulsed lOW lines, with or
without feedback to the I/O CS16 line.
These double pulses and the computer

driven address changes complicate the
operation of the decoder. It is simply best
not to use odd port addresses.
Summary
At first glance, the double pulse and
address line changes which occur on the
AT bus during execution of the IN
AX,DX or OUT DX,AX instructions appear strange. But these pulses could be
used for data transfers of 16-bit words to
8-bit memories or data ports. You· can
easily achieve direct transfer of 16-bit
words to 16-bit ports by pulling the I/O
CS16 line low with a pulse generated by
the port address decoder.
We have made five interface boards
using circuits with both 74LS and 74ALS
chips. We set up two of these boards
with test programs. They ran through
more than 5 billion transfers without an
error.

•••

CP/M, NorthStar, Macintosh, Apple II, MS-DOS, and PS/2
Don't let incompatible diskette formats get you down

Teach your PC
to speak CP/M

Megamate by MicroSolutions

UniDOS zao Coprocessor Board
by MicroSolutions

This is the 3 1/2" drive package that you've been
waiting for. Run 720k or 1.44M diskettes in this
attractive external drive. Comes complete with
its own controller card. Easy to install, just plug
it into your PC or AT and go.
Megamate . . . . . . . . . . . . . . . . . . .. $ 329.95

Run your Z80 and 8080 code programs at LIGHTNING speed on your PC or AT with the UniDOS
8MHz. Z80 coprocessor board. UniDOS automatically switches from MS-DOS to CP/M mode
when your CP/M program is executed. UniDOS
emulates most common computers and terminals
such as Kaypro, Xerox 820, Morrow, Osborne,
and VT100. All standard CP/M system calls are
supported. Includes UniDOS and UniForm-PC.
UniDOS Z80 Coprocessor Card ... $ 169.95

The MatchPoint-PC board for the PC/XT/AT
works with your standard controller card to let
you read and write to NorthStar hard sector and
Apple II diskettes on your PC. INCLUDES a copy
of the UniForm-PC program, as well as utilities to
format disks, copy, delete, and view files on Apple
DOS, PRODOS, and Apple CP/M diskettes.
MatchPoint-PC Board. . . . . . . . . . .. $179.95

UniDOS by Micro Solutions
Equip your PC/XT with an NEC V20 chip and
run your favorite CP/M programs without taking
up another card slot. Runs 8080 code directly
on the V20, and uses emulation mode for Z80
code or systems without a V20.
UniDOS by MicroSolutions ...... , $ 64.95
UniDOS w/UniForm &
V20-8 chip. . . . . . . . . . . . . . . . . . .. $ 135.00

UniForm·PC by MicroSolutions
How have you ever wished you could use your
CP/M diskettes on your PC? Now you can access
your CP/M files and programs on your MS-DOS
computer just as you would a standard MS-DOS
diskette. Install UniForm and use standard DOS
commands and programs right on your original
diskette without modifying or copying your files.
UniForm-PC allows you to read, write, format,
and copy diskettes from over 275 CP/M and
MS-DOS computers on your PC, XT, or AT. With
UniForm-PC and the Compaticard, you can use
5%" high density, 96TPI, 3 1/2" (720k/1.44M), and
even 8" drives.
UniForm-PC by MicroSolutions '" $ 64.95
Also available for Kaypro, & other
CP/M computers

CompatiCard by MicroSolutions
THE universal four drive floppy controller board
for the PC or AT. Run up to 16 disk drives (4 per
CompatiCard), including standard 360K, 96 TPI,
high density 1.2M, 8" (SSSD or DSDD), and
720k/1.44M 3 1/2" drives. Comes with its own
MS-DOS driver and format program. Use it with
UniForm-PC for maximum versitility.
CompatiCard Board ............... $ 119.95
CompatiCard with UniForm-PC ..... $ 179.95
8" Drive adaptor ................... $ 15.00
External 5%" drive cable ........... $ 15.00

Compaticard II by MicroSolutions
Two drive version of the CompatiCard, sorry no
8" or single density.
CompatiCard II ................... $ 89.95
CompatiCard II with 1.2M or
3W' internal drive .................. $ 199.95

MatchPoint·PC by MicroSolutions

MatchMaker by MicroSolutions
Now you can copy your Macintosh diskettes right
on your PC/XT/AT with the MatchMaker. Just
plug your external 31/2" Macintosh drive into the
MatchMaker board and experience EASY access
to your Mac diskettes. Includes programs to
read, write, initialize, and delete files on your
single or double sided Mac diskettes.
MatchMaker Board ............. $ 139.95
MatchMaker w/External
Mac Drive .................... $ 325.00

Hard Disks for CP/M systems
Pep up your CP/M computer with hard disk performance. Our simple to install kits allow you to
connect up to two 5%" hard drives to your Z80
system. The Winchester Connection software
customizes your system from an easy to use
menu, with flexible drive parameters, partition
and block size, and includes complete installation and diagnostic utilities. A complete system
requires a HDS daughter board, WD1002-05
hard drive controller board, hard drive, software
package and cables.
HDS Host Board with Software ... $ 79.95
HDS Board, WD1002-05,
and software . . . . . . . . . . . . . . . . .. $ 245.00
WD1002-05 Controller Board only . $ 185.00
External drive cabinet
with power supply. . . . . . . . . . . . .. $ 139.95

Parts and accessories for the
Kaypro and Xerox 820·1
Plus2 ROM Set for Xerox 820-1 ... $ 39.95
Plus2 ROM with X120 bare board . $ 49.95
KayPLUS ROM for Kaypro 2, 4, 10 specify. . . . . . . . . . . . . . . . . . . . . .. $ 69.95
Kaypro 2X Real-time Clock
parts kit ...................... $ 29.00
Kaypro 2X Hard disk interface
parts kit . . . . . . . . . . . . . . . . . . . . .. $ 16.00
Kaypro 10 Hard Disk controller
board . . . . . . . . . . . . . . . . . . . . . . .. $ 185.00
Kaypro four drive floppy
decoder board. . . . . . . . . . . . . . . .. $ 35.00
QP/M Operating System bootable - specify system. . . . . . .. $ 64.95
QP/M without CBIOS
(installs on any Z80 system) ..... $ 49.95
Complete parts and repair services available

P.o. Box 1726 • Beaverton, OR

97075

read them all with your PC!

Special Purchases!!
PC·Mastercard
by Magnum Computer
This is probably the BEST multi-function card
on the market. Use mixed banks of 64k and 256k
chips to install up to 1.5 Megabytes of RAMDISK,
and PRINT SPOOLER (or fill your system up to
640k). Serial, parallel, game ports, and real time
clock installedl Comes with complete software.
PC-MASTERCARD
(Ok installed) . . . . . . . . . . . . . . . . . .. $ 69.95

Turbo Editor Toolbox
by Borland International .,.

$ 29.95
Ever wanted to add text editing to your Turbo
Pascal application, or write a word processor that
does things the way that YOU want? Comes with
source for two sample editors, modules for windowing, multi-tasking, and many other options.
Requires PC or compatible and Turbo PascaI3.a.

COpy II PC by
Central Point Software . . . ..

$ 24.95
Stop worrying about your copy protected disks.
COpy II PC lets you back them up, so you can
keep going when your master disk can't.

Printer/Data Switches
Quality with economy. These boxes switch all
25 lines so they can be used with either RS232,
or IBM parallel (DB25) printer cables.
Four port data switch . . . . . . . . . . .. $ 39.95
Two port data switch ............. $ 34.95
IBM style Parallel Printer Cable .... $ 12.00
Three cable set
Special
$ 30.00

**

** ...

MicroPro Manuals
WordStar V3.3 Manual ., . . . . . . . .. $ 12.00
InfoStar Set
(DataStar & ReportStar) . . . . . . . . .. $ 18.00

Call or write for our complete catalog of software,
parts, accessories and complete repair services
for the Kaypro, Xerox 820, and IBM PC/AT.
Prices subject to change without notice. VISA and
Mastercard accepted. Include $6.00 shipping
and handling, $8.50 for COD, UPS-Blue or RED
Label additional. Please include your phone
number with all correspondence.

(EMERRLD '~
(MICROWRRE)
(503) 641·8088
IV/SAl

•

Reader Service Number 10

MICRO CORNUCOPIA, #49, Sept-Oct 1989

85

muD
DI!lI!l

nrnm

By Gary Entsminger
P.o. Box 2091
Davis, CA 95617

Pascal + ObjectsA Good Lookin' Turbo Pascal 5.5
& An I/O Error Handlin' Object

First it was structures, now it's objects. What
are objects? The latest buzz word? The ultimate
way to write Pascal? The best and worst of selfmodifying code? The reason you have to buy a
whole new set of libraries?
Yep. That about covers it.

f you've been trying to wade through the
object-oriented muck, and know how to
program in Turbo Pascal, you can now take
a leisurely step (up, I believe) into the power-'
ful world of object-oriented programming.
00p,
object-oriented
programming's
acronym, has suddenly become a buzz term,
engulfed in hype. But try not to let that bother
you. Objects are a very powerful way of conceptualizing programs. Turbo Pascal 5.5 is a
great way for Pascal programmers to bypass
the buzz and get down to thinkin' out objects.
In short (Pascal terms)-objects are records
that hold not only data fields, but the procedures and functions to manipulate the data
fields as well. In OOP terms, we call these procedures and functions "methods."
In addition, objects can inherit data fields
and methods from each other. So you can
build complex objects (easily and quickly)
from simpler ones.
Third, objects can be polymorphic-just like
their ancestors in some ways and different in
others. A new object created from an existing
object can use some of the methods it inherits
while reimplementing others.
In this installment of Tidbits, I'll describe
the key features of object-oriented programming (from a Turbo Pascal perspective). Then,
I'll build a simple object, an I/O error-handler,
to illustrate these features.
If you're already familiar with objectoriented programming languages like C++ and
Small talk, it might help to know that Turbo
Pascal objects are very much like those of C++.
A little less macho, perhaps, but powerfully
featured.

I

86 MICRO CORNUCOPIA, #49, Sept-Oct 1989
-_ .•_ - - - - - - _ _ - - - - - - - - - - - - ..

Turbo Pascal 5.5
TP 5.5 is TP 5.0 plus objects. (Actually, 5.5
has several other important improvements, but
I'll leave their details to the Borland advertisements and my favorite Dr. Dobbs columnist.)
The big reason for getting your hands on 5.5 is
the new type-object.
Objects have lives and a language of their
own, and it's worth spending a few paragraphs getting to know the language.
Three main properties characterize an object-oriented programming language• encapsulation
• inheritance
• polymorphism
Encapsulation
I repeat ('tho slightly differently)-From a
Turbo Pascal perspective, encapsulation means
you can combine a record with the procedures
and functions which will manipulate the record. The new data type formed by combining
data (a record) with code (procedures and
functions) is an object.
Declare a record like thistype
recordl

= aRecord;

aRe cord

= record

Name : string;
X,Y : integer;
end;

where X, Y, and Name are data fields.
Declare an object like thistype
objectl
anObject

= anObject;

= object

X,Y : integer;
procedure doSomethingWithX&Y;
end;

X and Yare still data fields and the
procedure doSomethingWithX&Y is a
method for manipulating anObject.
An object consists of everything we
know about it. Data (which define the
variables of the object) and code (which
manipulates the object) are together in
one box: a box that can be both black
and white at once (Le., polymorphic,
but more on that later.)
To use a record, we access its data
via "dotting" or via a With statementrecordl.X := 2:
recordl.Y := 3:

orWith recordl do
begin

fields, then an object is a container for
data fields and methods.
Notice that we don't have to pass X
and Y to doSomethingWithX&Y. doSomethingWithX&Y already knows
about X and Y because they're both contained within the same object (Le., they
share a scope). Everything in an object
(methods and data) is shared. It's a
small town with a gossip-everything
knows about everything else in the object.
. This combining of data and code in
one container is a neat extension of
units. Programs consist of units. Units
consist of objects. So at one level, an object is a new way to organize tools. But
that's just the beginning. More important, it's a new way of thinking about
tools. Let's take another step.

X:= 2:

Y:= 4:
end:

We use the same methods to
manipulate objects (dotting or a With
statement)objectl.X := 2:
With objectl do
begin
X:= 2:

Inheritance
Once you've defined an object, you
can use it to build a hierarchy of objects.
Each time you build a new object
(called a descendent) from an existing
object (called an ancestor), the new object inherits all its ancestor's code and
data.
An object can have more than one
ancestor, but only one immediate ancestor. So an object hierarchy might look
like this-

Y:= 3:
doSomethingWithX&Y;

objectl

-- object2

infinitum (or until you run out of
memory, disk space, or ideas).
In an important sense, objectoriented programming is a method for
building family trees for data structures.
Let's say we've built an objecttype
anObjectl

= object

X,Y: integer:
procedure doSomethingWithX&Y;
end;

and now we want to build anObject2
out of anObjectl.
We want anObject2 to be identical to
anObjectl, except we want to extend it
by adding a procedure called doSomethingElse.
We build anObject2 simply and
quickly by inheriting (from anObjectl)anObject2

= object

(anObjectl)

procedure doSomethingElse:
end:

Since anObject2 inherits access to all
the data and methods of anObjectl, we
don't need to redeclare anObjectl's data
fields and methods. We simply add the
new method.
Now we can doSomethingWithX&Y
and doSomethingElse to anObject2-

end;
-- object3

Think of an object as a descendent
type (object) that first inherits all the
power of an ancestor type (record) and
then extends itself with methodsanyObject

= object(record)

methods;
end;

If a record is a container for data

-

object4

-- objectS

In this little sketch, objectl has two
descendents, object2 and object3. object3
has two descendents, object4 and objectS. object4, for example, inherits
everything from object3 (its immediate
ancestor) and everything from objectl
(an earlier ancestor). This can go on ad

type
object2

= anObject2:

With object2 do
begin
X:= S:

Y:= 8:
doS. methingWithX&Y:
doS.methingElse:
end:

MICRO CORNUCOPIA, #49, Sept-Oct 1989

87

Notice (again) that we don't have to
pass the variables X and Y to doSomethingElse; it inherited knowledge
of X and Y along with everything else
(from objectl).
Inheritance lets us build very complex objects without repeating any code.
The new object simply inherits
whatever it needs from an ancestor. But
that's only the beginning (haven't we
heard that before?)!
More important, the new object can
use as much or as little of its ancestors'
code as it needs. In fact, it can reimplement any method it chooses. We call
this reimplementation of code polymorphism, and in it lies incredibly beautiful
(and subtle) power.
Polymorphism
Polymorphism means that a method
can have one name that's shared up and
down an object hierarchy. Each object
can (if it chooses) reimplement the
method.
For example, suppose we want to
define anObject3 which inherits the data
and methods from anObject2 and in addition reimplements the procedure doSomethingElse. We define it like soanObject3 = object (anObject2)
procedure doSomethingElse;
end;

Now when we use a variable of type
anObject3, it will inherit the data fields
from anObject2 (which anObject2 inherited from anObjectl), but will use its
own doSomethingElse procedure.
In one sense, a descendent (object) is
both itself and all its ancestors simultaneously. And simultaneously, it's different from all of them by 0, 1, or more
methods.
The trick for the compiler is to determine when to call one descendent's
method and not another's.
When we call (or use) a method from
a descendent object, the compiler looks
first to see if the current object has the
method we're calling. If it finds the
method in the current object, it uses it
and then moves on to the next instruction.
If the current object doesn't contain
the method, the compiler backtracks up
the hierarchy through ancestor objects
until it finds a method with the correct
name. When it finds it, it executes it,
stops looking, and moves on to the next
instruction. If it doesn't find the method
in any ancestor, it reports an error.
If you're a Prolog programmer, this
backtracking scenario should sound fa-

88

MICRO CORNUCOPIA, #49, Sept-Oct 1989

miliar, and at this juncture (polymorphism) object-oriented programming really (I mean it) gets interesting.

Object: myIOhandler
Let's define an objectmyIOhandler

Static & Virtual
Each object I've created so far uses
"static" methods. When we call a static
method, the compiler searches for
methods one way-by backtracking up
the hierarchy. A fine and dandy way to
search for methods unless we create
methods that call other methods, and
we decide to reimplement some of these
other methods.
Once the compiler has backtracked
to an ancestor object to find a method, it
only uses methods from that ancestor
(or its ancestors), if the method is static.
We need a way to tell the compiler to
remember which object was current,
before it started backtracking. Then,
finding one method in an ancestor, the
compiler could look for the next method
beginning with the calling object or descendent instead of its ancestor.
Static methods (like static variables)
are static because the compiler allocates
and resolves all references to them at
compile time. What we're asking the
compiler to do is to resolve some references at runtime.
To resolve references to methods at
runtime, we create "virtual" methods by
adding the key word virtual to the
method and by including a special procedure called a constructor within the
object. But there's a catch. A method
can't be both static (in one object) and
virtual in another. You must anticipate,
by declaring these methods virtual from
the beginning.
For example, doSomethingElse must
be declared virtual at its earliest and all
subsequent declarationsanObject2

= object(anObjectl)

constructor init;
procedure doSomethingElse;virtual;
end;
anObject4

= object(anObject3)

constructor init;
procedure doSomethingElse;virtual;
end;

= object

IOErr : boolean;
IOCode: integer;
Message: string;
constructor init;
procedure report; virtual;
procedure IOCheck; virtual;

port. If report is static, the compiler uses
the report in mylOhandler.
If report is virtual, the compiler remembers that yourlOhandler called 10Check and begins backtracking from
yourIOhandler. So it will execute report
in yourIOhandler, not mylOhandler.
Methods by default are static, so we
effectively override this default by using
the keyword, virtual.

end;

This object will check for I/O errors
and report the type of errors (if any) it
discovers. It consists of three methods
(init, report, and 10Check) and three
data fields. Notice that report and 10Check are virtual methods. This means
I'm implementing them my way now
(so you can use them as a black box);
and simultaneously, I'm giving you the
chance to change them later (if you
want or need to).
10Check calls 10Resuit (a standard
Turbo Pascal function) to determine if
there's been an error. If so (if 10Result
<> 0), 10Check calls report to report the
specific error.
mylOhandler's method, report, (see
Figure 1) uses a Blaise Toolbox procedure to write a message in a window.
10Check calls report if it finds an error.
Now, suppose you're satisfied with
10Check, but don't want to incur the
overhead of creating and destroying a
window. You can create your own object (yourIOhandler) which inherits 10Check but not report. Because report is
virtual, the compiler knows to keep
track of the current object (the one calling 10Check).
Then when 10Check calls report, the
compiler will begin searching for report
by backtracking from yourIOhandler
(the descendent), not from the ancestor
(myIOhandler) where it found 10Check.
First, let's look at your object
(yourIOhandler) which consists of
everything from mylOhandler except
your new reportyourIOhandler

= object(myIOhandler)

constructor init;
procedure report; virtual;

Whew!
Virtual methods, as you should
begin to expect, positively get interesting
about here. That's where I'll bail out for
this issue.
Thanks to Borland International for
letting me have an early look at Turbo
Pascal 5.5 and Turbo Debugger 1.5,
which includes debugger support for
objects.
Thanks to Blaise Computing for letting me use their terrific Turbo Pascal
Toolbox, now recompiled for version
5.5. Power Tools Plus includes several
tools for generating windows, menus,
and TSRs. It's a timesaver deluxe for
only $99.
Blaise Computing Inc.
2560 Ninth St., Ste. 316
Berkeley, CA 94710
(415) 540-5441

Also, thanks to Osborne/McGrawHill who furnished me a galley of the
object-oriented chapter from Stephen
O'Brien's new version of the Complete
Turbo Pascal Reference. O'Brien develops
a neat little airplane object which illustrates the basics of extending Turbo
Pascal with objects. RecOlrimended for
getting your feet wet.
Finally, thanks to Bruce Eckel for
stimulating conversations in the Elk
mountains. If you want to leap into the
depths of object-oriented programming
C-style, check out his book, Using C++
(also from
Osborne/McGraw-Hill).
Bruce really knows objects.
And that, friends, is Tidbits.

•••

end;

The virtual method effectively
changes the order in which the compiler
determines which method to use when
methods share names. This is a thorny
(but quite powerful) aspect of objectoriented programming. I'll spend the
rest of TIdbits implementing a simple
but useful object-an I/O error handler,
which combines all three principal
properties of objects.

Now recall the order in which the
compiler looks for methods when
methods are static. Let's say you call 10Check from yourIOhandler. Since 10Check is an inherited method, the compiler finds it in an ancestor, mylOhandler, and (effectively) executes 10Check there.
Now 10Check (see Figure 1) calls reMICRO CORNUCOPIA, #49, Sept-Oc~ 1989

89

Batteries, Disks, And Drives

T1000 Battery Upgrade
The Toshiba TI000 contains 4 "subC" batteries. On a good day they yield 5
hours running time (assuming no disk
accesses). Periphex sells a set of 4 high
capacity C cells that will power the
TI000 for up to 10 hours, after a 16-18
hour recharge. You don't need to be a
brain surgeon to mount these batteries,
but you should be careful. You'll need:
1. The four Periphex C cells. The C
cells, shrink-wrapped into a block with
two leads welded in place, cost about
$35. If you ask Periphex, they'll ship the
battery pack with wires already on the
tabs. If you call and ask for the battery
pack for the TI000 modification, they'll
know just what you want. They even
send instructions and a proper piece of
cushioning foam right along with the
nicad pack!
2. A soldering iron or gun (about 45
watts).
3. Two female crimp-on connectors,
commonly used to connect to bladetype auto electrical systems. When you
look at the end of these connectors, you
see a shape like this:

stranded wire, about eight inches long.
Why two leads from each pole? Because the design allows for separate circuits between the battery and the computer, and the battery and the charger.
However, as currently configured, the
computer doesn't take advantage of that
separation. The connector that attaches
the batteries to the motherboard is hard
to corne by, so you'll have to improvise.
Fortunately, the male side of the connector is on the PC board.
Before you remove the female connector:
1. Back up your D: drive (if you have
a RAM drive card) to a floppy, because
as soon as you disconnect the battery,
you'll lose all files and D: will have to
be reformatted from the C: drive (the
ROM chip) before it can be used again.
2. Note carefully which two pins
have the red (positive) wires attached,
and which have the black (negative)
wires.
The configuration of the pins will
look like this:
*
B

*
B

*
R

*]
R

(--)

(B=Black)

Radio Shack sells a package of eight
female quick-disconnects (64-3039) for
just 99¢.
The Toshiba batteries mount in a
plastic tray that takes up a lot of room
in the battery compartment of the machine. C cells are slightly bigger than
sub-Cs, so you can't use the plastic tray.
Keep the old batteries and tray in case
of emergencies-for example, if you
must return your TlOOO to Toshiba for
service.
Toshiba batteries corne with two red
wires on one corner and two black
wires on the other end. Match this arrangement if you're soldering the wires
to the battery pack yourself. Use

90

MICRO CORNUCOPIA, #49, Sept-Oct 1989

(R=Red)

After you solder (or crimp) a quickdisconnect to the black and red wires,
you'll slip each over the appropriate
pair of male pins. You should pick the
female disconnects that most closely
match the spacing of the pins, then adjust them with a small screwdriver
blade until they fit smoothly over a pair
of pins.
Solder (or crimp) those connectors on
the wires. Then, wrap each with electrical tape to keep them from touching as
you push them onto the pins.
The physical mounting of the pack is
up to you. Some people have used peeland-stick velcro (also available at Radio

Shack) to stick the battery pack to the
"ceiling" of the case, and a thin (V4")
piece of plastic-tape-covered rubber
foam under the pack to protect the
motherboard. I used a thin V16" aluminum strip about 1" wide and 5" long
and placed one end under the modern
support and the other under the old
battery pack holder. Thin foam under
the nicad pack protects the motherboard.
That's it. Carefully reassemble the
two halves of the case (don't pinch the
flat cable that connects the LCD screen
to the motherboard). Reformat the D
drive and run the batteries down to
shutdown, then charge them for at least
24 hours with the original charger. After
that, you should get 8-10 hours of total
life between charges. Ordinarily, you
should double the recharge time to
about 16 hours.
Peri ph ex Inc.
149 Palmer Rd.
Southbury, CT 06488
(203) 264-3985
Guruka Singh Khalsa
Sierra On-Line
P.O. Box 485
Coarsegold, CA 93644
voice: (209) 683-4468
data: (209) 683-2084
CIS ID 71500,34
Traveling With Computers And Disks
What's the effect of airport security
on disks? Will the system erase or damage data? I've heard people answer
both yes and no, but no one could say
why. So I decided to do a little research.
I started this quest by contacting the
FAA (Federal Aviation Administration).
There I spoke to Dr. Lyle Malotky, who
explained that airport metal detectors
use less than 1 gauss of electromagnetic
field strength. The earth has a natural

Micro Ads
,

. 1r

mMr

'mWii·

u

-I

A Micro Ad is the inexpensive way to reach over 22,000 technical folks like yourself. To place a
Micro Ad, just print out your message (make it short and sweet) and mail it to Micro C. We'l/ typeset
your ad (no charge) and run it in the next available issue. You can also send camera ready copy.
Rates: $99 for 1 time, $267 for three times, $474 for 6 times (a best buy at only $79 per insertion). Full
payment must accompany ad. Each ad space is 2 V4 inches by 1 J'4 inches.

DUPLICATOR TOOLKIT PRO

F

LAS

niB DUPLICATOR TOOLKIT PROfessional Is a superlast
diskette duplication utility for your PC.

It does what

dlskcopy can't dol Copies a 360K diskette In 20 seconds,
formats and verifies "on the fly", and even produces diskette
labels at the same timel Copies 5 1/4 360K ODDS, 1.2M
hlgh-denslty, 51/4 360K using a 1.2M high density drive, 3
1/2720k. 3 1/2 1.44M and 3 1/2 720K using a 1.44M drive.
Stores master in RAM or on the hard drive. Format-on
option allows for high-speed formatting. ElIminates th
-floppy shuffle"l
$129.00 + 5.00 s/h Visa/MC/Cod
COPY TECHNOLOGIES
14252 Culver Dr. Ste.323
IrvIne, CA 92714
(714) 975-1477

Reader Service Number 163

STOCKS

OPTIONS

FUTURES

Tum Your PC Into A
MARKET QUOTATION MONITOR

[J
dd
logo
••

ORDER NOW $69.95
(800) 25-FLASH

SOFIWARE MASTERS 6352 North Guilford Ave.
Indianapolis, In 46220/ (317) 253-8088
$5.00 Shp/hnd in USA & CANADA, $15.00 overseas.

Mr. MOX™

Order direct from:

$5 Demo Diskette

DATArx

.

111 E. Drake Rd. Suite 7041
Fort Collins. CO 80525
Reader Service Number 133

ScreenLib™
Simple Screen Definition * Windows
Pop-up Menus * Context-Sensitive Help

Complete C Source Code-No Royalties!

Lots of low-level functions
Introductory Price: $69.95
Plua $:>.00 ahipping ($10.00 ouhide US)
CA residenh pleAse Add SAles tAX

Business Computer Services
1800 S. Robertson Blvd., Suite 206
Los Angeles, CA 90035
VISA/MC orders: (213) 836-5026
Demo disk AVAilAble-$10.00
Reader Service Number 155

$99 95

Support for:
~ Enhanced Keyboards
~ EGA & VGA Graphics
~ 3.5 inch Floppies
~ More ...

Authorized AWARD Distributor
(800) 423-3400
KOMPUTERWERK, INC
851 Parkvlew Blvd
Pittsburgh, PA 15215

.K
~

Why you want BAlCOM!
BATCOM is a batch file compiler that
compiles your ".bat" files to ".exe" files to
make them faster, more professional, and
more capable. BATCOM extends DOS with
new commands so you can read keyboard
input, perform arithmetic! use subroutines,
and much more. In addltion, BATCOM
protects your source code, and you can distribute your compiled programs without royalties. For IBM PC. $49.95.
/ - ' " Wenham Software Company
t • ! 5 Burley St.
, _ / Wenham, Ma. 01984
(508)-114-1036
FREE catalog.

by Epoch Data

303-223-2120

Epoch Data
P.O. Box 1093
Cardiff, CA 92007
(619) 543-9423

Reader Service Number 135

Reader Service Number 124

8031 J.l.Control1er Module $39.95
Shipping: $3.00 US'$5.00 Canada

The $25 Network
Try the 1st truly low cost LAN

Ideal for prototyp",". one cL a kind devic"," or .hm production
run .. P.,.~ct building block for PC or MacintoRh data aquililion
interface or Bland alone control pr~ect& A.".,mbled and tooW
board inc\udu 8031 microproce ..or, crystal. 8K cLEI'ROM, 128
byteto cLRAM, 2 byte·wide 110 port.B and proviailll1ll for a MAX232
to provide induotry compatible ""rial 110. AU IC. are Rocket.ed
and W i. via a 2XI7 header. Size: 2.7&· by 4.0·. OEM dilOCounta.

Cottage Resources
Suite 3·672C, 1405 Stevenson Drive
Springfield, filinois 62703
(217) 529-7679

BIOS

-cc 286 -cc 386

Reader Service Number 126

Reader Service Number 106

100 page book covers satellite and radio data
reception of financial news and quotes for your PC.
$19 (includes demo diskette). Free informative
catalog of:
* Data receivers and k~s
* Quote processing and dis~lay software

Descrambling software utilities

PC/XT

• EASY to Install
• Cache up to 32 MEGS of EXTENDED
and or EXPANDED
• Buffers up to 26 DEVICE driven drives
• Comes with 2 FREE utilities!!!!!

Modem operated
power controller
for your PC.
Makes any PC with
external modem
remote-accessable!
Software Included.

*

LATEST AWARD

H

Ilf£ DISK ACCELERATOR

1:7'_:_~_~
.•_.:.- •.::_--

\J;)

Reader Service Number 158

•
•
•
•
•
•

Connect 2 or 3 pes, XTs, ATs
Uses serial ports and 5 wire cable
RUns at 115 K baud
Runs in background, totally transparent
share any device, any file
Needs only 14K of ram

Skeptical? We make believersl
I'~ ~
Inlormatlon
P.O. Drawer FModes

ml

10 e
I

Denton. TX 76202
817-387-3339

Reader Service Number 149

WHITNEY EDITOR $39

MINI 386-20/25 MOTHERBOARD

CROSS ASSEMBLERS

Small and fast
Uses all available memory
Split-screen editing
Configurable keyboard
Regular expression search
One key compile
Features for Writing documentation
Condensed/Outline display
Runs on IBM PC's, AT's, and PS/2's

• 20/25 MHz 80386 CPU • On Boord Memory Expandable
1MB/2MB/4MB/8MB. Fully PC/AT Compatible
• Phoenix ROM BIOS PlUS with ROM-Based SET-UP
• RESET, TURBO LED Jumpers
• Battery Back-Up System Clock/Calendar and CMOS Ram
• Supports 80387 Moth-Coprocessor Asynchronously
• Interleaved Memory Access for Zero Wait-State On-Board
Operation. Exact·XT Dimension and AT Mounting Holes
• 3 8-bit. 4 16-bit and 1-32-bit expansion slots
• Surface Mounting Technology Improves Reliability
• Suppart Diskless Nelwork Application
• NOVELL OS/2 Compatible

PseudoCode releases the PseudoSam professional series
of Cross assemblers. All popular processors. Macros,
Conditional Assembly, and Include Files. Virtually
unlimited size. For IBM-PC's MS-DOS 2.0 or greater with
manual $50.00. Simulators and disassemblers also
available. (MI res. 4% tax). S&H USA $5, Canada $10,
Foreign $15. Visa/Me.

USA shipping & handling $3; Outside USA $15
CA residents odd sales tax

Whitney Software, Inc.
P.O.Box4999, WalnufCreek, CA94596 (415)933-9019

Reader Service Number 164

SPECIAL $649/$949

McTEK SYSTEMS, INC.
1521 SAN PABLO AVENUE
BERKELEY, CALIFORNIA 94702
(415) 525-5129

Reader Service Number 42

KORE Inc .
6910 PaHerson S.E .
Caledonia, MI49316 616-887-1444.
30 Day satisfaction guaranteed
or purchase price refunded.

Reader Service Number 136

MICRO CORNUCOPIA, #49, Sept-Oct. 1989

91

field of 0.7 gauss and normal magnetic
media (mag strips, tapes, and disks) require 200 to 300 gauss to write data.
Airport X-ray units use less than 1
mr (millirad). If the X-ray unit was built
in the last five years, it'will use 0.3 mr
per scan. In every day living you're exposed to 0.3 mr per day, and when flying at normal altitudes (about 35,000
feet for commercial airlines) you get 0.5
to 1.0 mr per hour.
The only X-ray unit that uses 1.0 mr
or more is the fluoroscope, which has to
have a stationary object to produce an
image on the screen. The longer it's
viewed, the more rads the object absorbs. However, at present fluoroscopes
are not in use at any major U.s. airport.
Now what does all this mean?
There's no need to worry about the
security equipment at the airport erasing your disks. Just to satisfy my own
curiosity, I carried some disks through
the metal detector and sent others
through the X-ray machine at Dulles
airport. I then tested the disks and
guess what: the data was fine.
Now for the bad news. If you travel
overseas, there's a possibility that they'll
use different equipment with higher
dosages. That means there's a possibility your disks could be erased. But
don't worry. All airports will allow you
to have items inspected visually instead
of by X-ray. The only item that should
never be X-rayed is photo film with an
ASA of 1000 or higher.
Here comes the worst news of all.
The biggest potential for data loss
during air travel comes from vibrations
and static electricity. Under most circumstances your disks will not suffer
damage if they're packed tightly and
are well padded. But static electricity
can zap your disks in a heartbeat.
At 35,000 feet, air temperature is approximately -40°F with only 3% humidity. That air is taken in, compressed,
and warmed up which brings the
humidity down to 1%. With the low
humidity, there's a lot of static electricity.
Simply moving around the plane
will generate more. So, keep your hands
off your disks during flight.
The bottom line is that U.s. airport
security systems will not damage your
disks. Using a laptop computer or
touching a disk while flying can be
dangerous. If you're traveling overseas
with disks or a laptop, have them visually inspected.

92

MICRO CORNUCOPIA, #49, Sept-Oct 1989

R. S. Cunningham III
512-D Georgetown Rd.
Charlottesville, VA 22901
Disk Drive Sensing
Recently I had to write an install program for a new application. My first
problem was to find out how many
floppy drives, how many hard drives (if
any), and their letter designations. (I
was working in Turbo Pascal, but any
language that supports DOS interrupts
should do.)
The solution seemed simple at first:
find the number of logical drives in the
system, then find the number of floppy
drives. The difference will be the number of hard drives.
However, DOS 3.0 (and higher) does
not accurately report the number of
logical drives. It reports either the number of drives, or the number in config.sys's LASTDRIVE= statement, or it
returns a 5 if there are no drives.
The routines listed in Figure 1 start
out by getting the number of floppy
drives. I use DOS interrupt IlH, checking the value of bits 6-7.
Then I find the number of logical
drives. I do this by calling DOS interrupt 21H, function 19H to get the current drive number. Then I call DOS interrupt 21H, function OEH which selects
a drive and returns the number of logical drives. Finally I figure out the number of the first hard drive.
Once I know the designation(s) of
the hard drive(s), I check its status. I do
this by calling DOS interrupt 21H, function lCH-get drive data. If the function returns FFH, the drive is not valid.
If there's no FFH, I add the number
to the valid drive list. Since I know the
drives I'm checking are hard drives, I
don't have to bother about checking the
drive type.
The routines store all the information
in the global variable "drives." I've included lots of remarks so you shouldn't
have much trouble reading the code.
The routines could be improved by
thoroughly examining each drive (e.g.,
for color, noise level...). I'll let you figure this out. As the code stands, only
RAM disks aren't correctly identified.
Jeffrey Donovan
1515 Santa Barbara St. # A
Santa Barbara, CA 93101

•••
MICRO CORNUCOPIA, #49, Sept-Oct 1989

93

MICRO CORNUCOPIA

BACK ISSUES

Is There A Gap In Your Info?
Fill in your Back Issues of Micro C today!
ISSUE #1 (8/81)
Power Supply
112 PFM.PRN
16 pages

ISSUE #27 (12/85)
SOLD OUT

ISSUE #2 (10/81 )
Parallel Print Driver
Drive Motor Control
16 pages

ISSUE #16 (2184)
Xerox 820 Column Restarts
BBI Double Density
BBII 5"/8" Interface Fix
Kaypro ZCPR Patch
Adding Joystick To Color
Graphics
Recovering Text From Memory
52 pages

ISSUE #3 (12/81)
4 MHz Mods
Configuring Modem 7
Reverse Video Cursor
FORTHwords Begins
16 pages

ISSUE #17 (4/84)
Voice Synthesizer
Kaypro Morse Code Interface
680oo-Based System Review
Inside CP/M 86
56 pages

ISSUE #29 (4/86)
Speeding Up Your XT
Prototyping In C
C Interpreters Reviewed
Benchmarking The PCs
104 pages

ISSUE #4 (2182)
Keyboard Translation
More 4 MHz Mods
Modems, Lync, and S10s
Undoing CPIM ERASE
20 pages

ISSUE #18 (6184)
Kaypro EPROM Programmer
1/0 Byte: A Primer
Kaypro Joystick
Serial To Parallel Interface
Business COBOL
60 pages

ISSUE #30 (6186)
PROLOG On The PC
Expert Systems
Logic Programming
Building Your Own Logic
Analyzer
256K RAM For Your 83 Kaypro
PC-DOS For Non-Clones
104 pages

ISSUE #5 (4/82)
Two Text Editors
Double Density Review
20 pages
ISSUE #6 (6/82)
BBI EPROM Programmer
Customize Your Chars
Double Density Update
24 pages
ISSUE #7 (8/82)
6 Reviews Of C
Adding 6K Of RAM
On Your Own Begins
24 pages
ISSUE #8 (10/82)
SOLD OUT
ISSUE #9 (12/82)
BBII EPROM Program
Relocating Your CP/M
Serial Print Driver
Big Board I Fixes
32 pages
ISSUE #10 (2183)
ISSUE #11 (4/83)
SOLD OUT
ISSUE #12 (6/83)
Bringing Up BBII
Double Sided Drives for BBI
Packet Radio
5 MHz for Kaypro
40 pages
ISSUE #13 (8/83)
CPIM Disk Directory
More 256K for BBI
Mini Front Panel
Cheap Fast Modem
BBI Printer Interface
Kaypro Reverse Video Mod
44 pages

ISSUE #19 (8184)
Adding Winchester To BBII
6 MHz On The BBI
Bulletin Boards
Track Buffering On Slicer
4 MHz For The 820-1
64 pages
ISSUE #20 (10/84)
HSC 68000 Co-Processor
DynaDisk For The BBII
Serial Printer On BBI Sans S 10
Cheap & Dirty Talker For Kaypro
Extended 8" Single Density
72 pages
ISSUE #21 (12/84)
Analog To Digital Interface
Inslalling Turbo Pascal
Low Intensity BBI Video
Turbo Pascal, The Early Days
80 pages
ISSUE #22 (2185)
Xerox 820-11 To A Kaypro-8
Sound Generator For the
STD Bus
Reviews Of 256K
RAM Expansion
88 pages
ISSUE #23 (4/85)
AutomatiC Disk Relogging
Interrupt Drive Serial Printer
Low Cost EPROM Eraser
Smart Video Controller
Review: MicroSphere RAM Disk
"86 pages
ISSUE #24 (6185)
C'ing Into Turbo Pascal
8" Drives On The Kaypro
68000 Versus 80x86
Soldering: The First Steps
88 pages

ISSUE #14 (10/83)
BBlllnstaliation
The Perfect Terminal
BBI Video Size
Video Jitter Fix
Kaypro Color Graphics Review
48 pages

ISSUE #25 (8185)
Why I Wrote A Debugger
The 32-Bit Super Chips
Programming The 32032
Modula II
RS-232C: The Interface
104 pages

ISSUE #15 (12/83)
Screen Dump Listing
Fixing Serial Ports
Playing Adventure
Upgrading Kaypro II To 4
Upgrading Kaypro 4 To 8
48 pages

ISSUE #26 (10/85)
Inside ZCPR3
Two Megabytes On DSI-32
SoolV
The Future Of Computing
Graphics In Turbo Pascal
104 pages

94

MICRO CORNUCOPIA, #49, Sept-Oct 1989

ISSUE #28 (2186)
Rescuing Lost Text From
Memory
Introduction To Modula-2
Inside The PC
104 pages

ISSUE #31 (8186)
RAM Resident PC Speedup
Practical Programming In
Modula-2
Unblinking The PC's Blinkin'
Cursor
Game Theory In PROLOG
and C
104 pages
ISSUE #32 (10/86)
Public Domain 32000:
Hardware And Software
Writing A Printer Driver for
MS-DOS
Recover A Directory By
Reading & Writing Disk
Sectors
96 pages
ISSUE #33 (12/86)
ISSUE #34 (2187)
ISSUE #35 (4/87)
ISSUE #36 (6187)
ISSUE #37 (9/87)
SOLD OUT

ISSUE #41 (5/88)
ArtNiclallntelligence
3-D Graphics
Neural Networks
Logic Of Programming
Languages
Applying Information Theory
96 pages
ISSUE # 42 (7/88)
Maintaining PCs
Keeping Your Hard Drives
Running
Troubleshooting PCs
Xl Theory of Operation
Simulating A Bus
Ray Tracing
96 pages
ISSUE #43 (9/88)
Bul/dlng Databases
Build a C Database
Selecting a dBase III
Compatible Compiler
Working with ParadOX
Designing Custom PC Cards
Accessing dBase III Plus
Records from Turbo Pascal
96 pages
ISSUE#44 (11/88)
Object· Oriented Program·
mlng
A Taste of Smalltalk
Actor
Thinking Objectively
Building MicroCad
Peripheral TechnologyPT68K-2
Hercules Graphics Printer
Dump
96 pages

ISSUE #46 (3189)
Soffware Tools
The Art of Disassembly
Handling Interrupts With Any C
Hacking Sprint: Creating
Display Drivers
Greatest C Compilers
Turning A PC into An
Embedded Control System
Practical Fractals
96 pages
ISSUE #47(5/89)
Robotics
The LIMBO Project
Starting A Robotics Company
How To Write and Use A
SystemProfiler
Problem Solving and Creativity
Turn Your Xl Into A Controller
Writing Code For Two
Operating Systems
96 pages
ISSUE #48(7/89)
Tools For The Physically
Impaired
The Adventure Begins
Selecting A Talking Computer
For A Blind Friend
Writing Software For The Blind
File Transfer Via The Parallel
Port
The LIMBO Project-Part Two
PCX Compatibility
A 680oo-Based Multitasking
Kernel
The Very Early Days of
Computing

•••

ISSUE #45 (1/89)
Computer Aided Design
CAD In A Consulting Business
Choosing PCB Layout Systems
Building Circuits With Your
Computer
Secrets of Optimization
Finding Bargains in the
Surplus Market
MASM5.1
96 pages

ISSUE #38 (11/87)
Parallel Processing
Laser Printers, Typesetters
And Page Definition
Languages
Build A Graphics Scanner
For $6, Part 2
Writing A Resident Program
Extractor In C
96 pages
ISSUE #39 (1188)
PC Graphics
Drawing The Mandelbrot And
Julia Sets
Desktop Graphics
Designing A PC Workstation Board
Around the TMS-34010
96 pages
ISSUE #40 (3188)
The Great C Issue
11 C Compilers
Writing A Simple Parser In C
C++, An Object Oriented C
Source Level Debugger For
TurboC
96 pages

To Order:
Phone:
Mail:

1-800-888-8087
PO Box 223
Bend, Oregon 97709

United States,
Issues #1-34
Issues #35-current

$3.00 each ppd.
$3.95 each ppd.

Canada & Mexico
All issues

$5.00 each ppd.

Foreign (air mail)
All Issues

$7.00 each ppd.

AQY~'!!m!!,,~E$~~"'!~!?.~
X
Issue 49
Reader . . . . . . . . . . . . . . . Page
Service . . . . . . . . . . . . . Number

112 Garrison, Peter . . . . . . . . . . 32
Genus . . . . . . . . . . . . . . . 31

72 Acquired Intelligence . . . . . . 36
160 Annabooks . . . . . . . . . . . . 73
4 Austin Codeworks . . . . . . . . 45

11 Halted Specialties . . . . . . . . 13
156 Heath . . . . . . . . . . . . . . . 35

147 Berry Computer . . . . . . . . . 53
155 Business Computer ServIce .. 91

15
31
7
163
158
143

8 Datadesk . . . . Inside front cover
133 DATArx . . . . . . . . . . . . . . 91
10 Emerald Microware . . . . . . . 85
135 Epoch Data . . . . . . . . . . . . 91
93 Erac Company . . . . . . . . . . 49

. . . . . . . 74

3 PC Tech . . . . . . . . . Back Cover
119 PeripheralTechnology . . . . . 32
139 Quantasm Software . . . . ... 72

22 Integrand . . . .'. . . . . . . . . 25
149 Information Modes . . . . . . . 91
154 JRT Systems

Capital Software . . . . . . . . . 11
Cascade Electronics . . . . . . . 15
CC Software . . . . . . . . . . . 74
CompuView . . . . . . . . . . . . 7
Copy Technologies . . . . . . . . 91
Cottage Resources . . . . . . . . 91
Covox, Inc. . . . . . . . . . . . . 37

161 Opal Fire Software

129 Research Group . . . . . . . . . 27
142 RJSwantek, Inc. . . . . . . . . . 59

. . . . . . . . . . . 62

126 Komputerwerk . . . . . . . . . 91
136 Kore, Inc. . . . . . . . . . . . . . 91
153 Lattice . . . . . . . . . . . . . . . . 5
144 Lasergo . . . . . . . . . . . . . . 41
151 Maxx . . . . . . . . . . . . . . . 21
42 McTek Systems . . . . . . . 61,91
Micro Cornucopia . . . . .
95
37 Microprocessors Unltd . . . . . 73
2 Microsphere.. Inside Back Cover
110 NuMega Technologies

162
127
106
40
152

Semi-Disk Systems, Inc. . . . . . 81
SemWare . . . . . . . . . . . . . 19
Software Masters . . . . . . . . 91
Star-K . . . . . . . . . . . . . . . 80
Stony Brook . . . . . . . . . . . . 1

62

V Communications . . . . . . . 40

124 Wenham Software . . . . . . . . 91
164 Whitney Software . . . . . . . . 91
39

Xeno Soft . . . . . . . . . . . . . 47

...... 2

Contact Advertiser Directly.
When you write for information, please tell these folks you read about their products in Micro Cornucopia.

Now Available
From Micro C
Computer
Interfacing
with Pascal & C
by Bruce Eckel
Use your PC parallel port
for digital input and output
Build an Adapter Card for
your PC
Control a stepper motor
Design and build
electronic circuits

Order From:
Micro Cornucopia
PO Box 223
Bend, OR 97709
1-800-888-8087

"With wit and superb
technical figures, Bruce
captures the essence of
making electrons out of bits
and vice versa."
Jeff Dunteman, Dr. Dobbs

•

Capturing Video Images

•

Voice Capture and Analysis

•

The Further Exploits of LIMBO

•

Bits From Our Past

•

3-D Graphics Programming

•

PostScript Programming, Part 2

Only $30 ppd.
Includes Book & Disk

MICRO CORNUCOPIA, #49, Sept-Oct 1989 95

By Gary Entsminger
1912 Haussler Dr.
Davis, CA 95616

Stochastic FictionFiction From Fractals

This introduction should not be words, it
should be a fractal something. I think.

type this at a desk far from the Davis
heat; I'm sitting in the Elk mountains
of Colorado and the face of this
mountainside varies daily. (In fact, it
varies much more frequently, but my
perception of the variation is limited by
a matrix of factors.)
This morning, the ghostly purple
larkspur (Delphinium nelsonii, named
both for its dolphin-like shape and a
Wyoming botanist) has suddenly
bloomed. It's surrounded by sky blue
lupines and various green bushes yet to
bloom. And it seems they're taller by
several inches since yesterday.
As you read this, the mountainside
has varied many times, until the only
mountainside that exists is the one you
imagine. Perhaps now (in my future)
it's in late summer seed.
Discussions of time (like this one?)
are strange and always eventually inconclusive. Yet time continues to fascinate poor and great imaginations alike.
Thinking about time is fun; and reading
someone's well-constructed thoughts is
better yet.

I

Great Work Of Time
Recently, I read a skillfully-constructed story about time by John Crowley, a World-fantasy Award-winning
author. The story, "Great Work Of
Time," extends that well-worn subclass
of science fiction, "time travel," by incorporating chaos theory into the argument.
In "GWOT," a strange genius, named
Caspar Last, discovers (or creates) a
process which can be used for time
travel. The key tool in leading him to
discover the process is a computer,

96

MICRO CORNUCOPIA, #49, Sept-Oct 1989

--~-

..--------~----------

which he uses to plot the shadows of
imaginary numbers.
Last showed me [the narrator of the
story] after our bargain was struck and he
was turning over his data and plans to me.
I told him I would not probably grasp the
theoretical basis of the process, however well
I had or would come to manage the practical
processes of it, but he liked to show me.
Re first summoned up x-y coordinates,
quite ordinary, and began by showing me
how some surprising results were obtained
by plotting on such coordinates an imaginary number, specifically the square root of
minus one. The only way to describe what
happens, he said, is that the plotted figure,
one unit high, one unit wide, generates a
shadow square of the same measurements
"behind" itself, in space undefined by the
coordinates.
It was with such tricks that he had
begun; the orthogons he obtained had first
started him thinking about the generation of
inhabitable-if also somehow imaginarypasts.
Fogg fans will no doubt recognize
these tricks. They're fractals, which Last
uses to travel into the past and then
back to the future.
Sometime later (back in the future),
Last discovers an inescapable paradoxthat the future he's returned to isn't the
future he left. Not the future of his
former past, but the future of the new
past he created by time-traveling.
Although Last had calculated to the
penny the necessity of disturbing nothing of importance during his journey, he
hadn't (and couldn't) succeed. All futures (in "GWOT") are determined by
minute variations and choices. Paths
diverting, particles close together, pasts
altered slightly vary little by little but
wind up very far apart.
Each choice, each detail that made
up Last's past is a bifurcation (or
branching) from what might have been,

and leads to a future slightly removed
(at least) from that of any other past.
So Last's one and only journey into
the past opens up a kettle of futures and
pasts and futures ad infinitum. The stories within the story, "Great Work Of
Time" are intriguing and subtle. Not the
least is a moralist's viewpoint that our
choices lie at the crux of all that's important.
The difference you make, makes all the
difference.
Last must have known the instant he
arrived on the morning of 1856, 127
years earlier, that something was upDut of the unimaginable chaos of its interminable stochastic fiction, Time thrust
only one unforeseen oddity on Caspar Last
as he, or something like him, appeared
beneath a plaintain tree in 1856: he had
grown a beard almost down to his waist. It
was abominably hot.
Funny Lane
I expect, as literary folk learn more
and more about the implications of
scientific theories, we'll see more and
more thoughtful excursions like this one
into stochastic fiction.
For now, if you want to enjoy a good
thought, check out, Novelty: Four Stories
by John Crowley, in paperback ($6.95)
from Doubleday.

•••

Quality &Price You Can't Pass Up!
MPLETE 80386-25SDX
SYSTEM

with Rotary Voice Coil Hard Drive
This machine features an 80386 CPU running at
25 Mhz on a full size motherboard. For extra
quality and reliability we've included a 45 Mb
Miniscribe 3053 Hard Drive with a 25 ms access
time, 1.2Mb & 1.44Mb Toshiba or TEAC floppy
drives. 28Mb 32 bit memory slots, 1Mb of fully
optimized 80ns RAM (Runs an incredible Norton .
SI test of 24!), 2 serial ports, 1 parallel port, 101
key keyboard, Graphics Combo video card with
amber or green monochrome monitor, Bios,
socket for an 80387-20 math coprocessor, 200
watt power supply, clock/calendar, and housed
in a sophisticated tower case. Full 1year warranty.
ASk for FREE assembly and testing..

Display Color Graphics
on a monochrome monitor!
All Microsphere XT, AT
~.
& 386 systems NOW include ~
the GRAPHICS COMBO
multimode video card.
The Graphics Combo combines
the video functions and software
compatibility of the IBM Monochrome Display Adapter (MGA),
the Hercules Graphics Card; and
the IBM Color/Graphics Adapter
(CGA) all on a single card. In addition the CGA graphics are automatically converted to display on
a standard rn monochrome
monitor in 16 shades of gray.

1\

l

1~

otV! $249,~

20MHz ............. $200 less
8 MB RAM Crd ............. 99
(32 BIT, ~K)

DISK DRIVES (Continued)

SPECIAL OFFER!
Order a Complete
~licroSphere Computer
System and receive 7 FREE
disks of our hest pUhlic
domain games.

XT SYSTEM
Includes: 640K RAM, serial/parallel/
game ports, clock/calendar, 101 key
keyboard, turbo switchable, slide cabinet, power supply, Graphics Combo
video card with amber or green monitor. Full 1 year warranty. Ask for
FREE assembly and testing.
4.77/10 Mhz with 2
360K floppies ...•••....•••. 725
1 FD and 1 Miniscribe HD:
4.77/10 Mhz with 20 Mb HD •••• 929
4.77/10 Mhz with 30 Mb HD •••. 955

AT SYSTEM
Includes: 640K RAM, 1.2 Mb FD,
1.44Mb FD, 40 Mb Miniscribe 3650
HD, serial/parallel/game ports, clock/
calendar, 101 key keyboard, turbo
switchable, slide cabinet, power supply, Graphics Combo video card with
amber or green monitor. Full 1 year
warranty. Ask for FREE assembly and
testing ..
6/10 Mhz .................. 1249
6/12 Mhz .................. 1295
Color options for any kit (includes
video card and monitor)
CGA Color ................. 175
CGA/EGA Color .........•... 380
VGA (analog) with
Mitsubishl monitor .......... 650
CGA/EGA/EGA 480
(Multisync) ................ 450

$2395

(TowerCase)
(Sid. Case)

PCXT&AT
Clock •••...•••••...•.••..... 19
Game ••••..•.•••....•••....• 14
Parallel (LPT 1, 2 or 3) ••....•.• 18
Serial Port Card - 1 installed
Switchable Com 1, 2, 3 or 4 ...• 18
Kit for 2nd Serial Port •••...•••. 18
Multi I/O
Serial/Par/Game .•.•.••..••• 32
2nd Serial Kit .••...•.••..... 20
Multi Drive Controller ••••••..•• 39
Supports 1.44, 72OK, 1.2, 360K drives

MOTHERBOARDS
XT/Turbo 4.77/10 ............. 75
AT 6/10 Award/Phoenix!
DTK Bios ••..•••••....••.. 229
AT 6/12 Award/Phoenix!
DTK Bios •••...••••..•.••• 279
Baby AT 6/12 AMI/DTK ••••••. 249
AT 8/16 DTK Bios ............ 395
80386 8/20 DTK Bios •••....••• 799
XT/AT Memory •••••....•• $CALL

SOFIWARE

PC/XT
Floppy Controller •..•••••••••• 19
MultHunction-1 ser/par/
clk/game/2 floppy •...••••.•• 47
640K RAM (0K) ..•••.•..•..••• 25
150 Watt Power Supply ••••..••• 50
Slide case lock, LED ••..•.••... 38
2 MB EMS Memory Board
ilK Installed ...••.••••..•••• 49

AT
200 Watt Power Supply •.••..... 75
AT/386 Case, Lock, LED •.••••.• 72
Tower AT/386 Case, Lock,
LED & 200 Watt ps .•..•••••• 239
2 MB EMS Memory Board
f)K Installed ••••••.••••••••• 99

MS DOS 3.21 w/GW Basic •...•• 49
DR DOS 3.3 w/GEM ........... 49
MS DOS 3.3 w/GW Basic .•••..• 95

DISK DRIVES
Teac/Toshiba 360K •••••••..••• 69
Teac/Toshiba 1.2 MB ...••••.... 85
Teac/Toshiba 3W' 720K ••....•• 79
Teac/Toshiba 3W' 1.44 MB kit •••. 90
XT 20 MB Miniscribe
8425 (65ms) ............... 279
8425 w/controller •••••..•••. 319
XT 30 MB Miniscribe
8438 (65ms) ............... 299
8438 w/controller •.••..••... 349

ti6MicroS~hereNC
,I
~COMrDUTCR~C'
I CJ

...::!

Orders Only:

VI

"HARDWARE.MANUFACTURER
SINCE 19FI.~"

1-800-234-8086

855 N.W. WALL • BEND, OREGON 97701
Reader Service Number 2

AT 40 MB MiniScribe
3650 (61 ms) •••............ 339
AT 40 MB MiniScribe
3053 (25ms) ............... 489
AT 71MB MiniScribe
6085 (28ms) ......••.....•• 631
AT (MFM) HD & FD
Controller card DTK .......• 110
WD ......... 127
AT RLL HD & FD
Controller ................. 189

MONITORS/ CARDS
EGA/CGA
(Autoswitch .31 dot) ....•... 385
CGA/EGA/VGA
MultiSync (.31 dot) ......•.. 495
CGA Color ..........••••... 249
Amber/Green 12" TTL ......... 89
Graphics Combo ••.....•...... 79
VGA Analog
(Mitsubishi .28 dot) ...•..... 549
Color/Graphics/Par Card ..••... 49
Mono/Graphics/Par Card ....... 49
CGA/EGA Card •••••......•.. 175
VGA Analog/Digital Card •.•... 249

KEYBOARDS
Casper Enhanced 101 ..... " ... 54
Keytronic KB101 .............. 67
Focus 101 Tactile,
Switchable, Control Caps Lock,
Dust Cover ................. 89
(#1 find by MicroC Staff)
All keyboards, XT/AT switchable

*

*

Prices are subject to change without notice.
Shipping CHARGES will be added.

BUILDING YOUR OWN COONE V2.1
****FREE BOOKLET****

*90-day v.arranty/ jO-day money hack
(subject to restrictions)

Tech Calls: (503) 388-1194
Hours: Monday-Friday9:00-S:30

VERY HIGH PERFORMANCE
Processors, Memory, and .Display A(japters
The X24 High performance processor
•
•
•
•
•

12 or 16 MHz 80286 with NO WAIT SIATES!
Small size ("XI" height and length) passive bus design
1 to 4 Mbyte 0 wait state dynamic memory
Fully "AT" compatible Award BIOS
Runs DOS versions 2.2 and later, Xenix and OS/2

The X24 combines the best of motherboard and backplane designs in a too% AT com'patible system. Incor·
porating a t 6 MHz 80286, the X24 processor is designed to operate with the PC Tech Advanced System Mother·
board, which contains the peripheral interfaces (hard disk, floppy disk, two serial ports and a parallel port) . The
X24 processor can also be used w~h other totally passive bus backplanes. Most critical components including
th e microprocessor and up to ~ megabytes of fast memory are contained on a single PC size plug·in card. This
allows the procesSOt' and main system memory to be serviced or upgraded without disturbing other peripherals
such as serial ports and disk drives.

PC Tech X24 and ASMB
The PC Tech Advanced System Motherboard
• Built in "IDE" interface for AI interface type hard drives
• Fully AI compatible floppy disk support for 3.5", 5.25" drives, capacities of 360k, 1.2m and l.44m
• Iwo serial ports and one parallel port
• 8 total expansion slots PC/XI/AI compatible (4 slots have 32 bit bus)
The PC Tech Advanced System Motherboard is designed to complement PC Tech's X24 and)(32 high perlormance processor cards. It contains the mass storage interlaces necessary for a complete system, plus the basic I/O required in most systems. Extra care has been given to FCC compliance by design.

34010 Monochrome Graphics Adapter II

PC Tech Mono-II

• Up to 384k bytes display memory
• Up to 2 Megabytes program memory
• Software is RAM based, allowing complete operating software
replacement and timing re-programming from the host bus
• 34010 program loader included. Assembler, debugger, and C
compiler available.
• Full hardware and software CGA, MDA and Hercules emul ation
• Single. bit shared memory bit-map with optional resolution up
to 2048 x 1536 (736 x 1008 standard)
• Very high resolution COLOR version available
• Custom 34010 software development available

The TMS34D1D is a true general purpose graphics processor. PC Tech makes the total processing power of the 340.10. available to both programmers and end users. Our 340,tD Monochrome Graphics
Adapter is designed to allow programming from the PC/Xf/AT host bus. You can completely replace our 340.10. software w~h yours to directly hamess the incredible image processing power of the TMS
340.10. for your application. We make a complete set of development tools available, including an assembler, C compiler, program loader, 340.10. debugger, and PC interrace tracer/debugger. Our stand·
ard product includes support for extended CGA, MDA and Hercules emuration as well as a host addressable graphics bit· map. We also support and recommend the DGIS graphics interrace standard (from
Graphic Software Systems) for applications development as an anernative to native 34DtD software development. Ready to run drivers are available for most major applications software packages as well.

Custom Designs Available
PC Tech will license most products for non-exclusive manufacture. We will also customize any of our designs to better meet your needs on our in-house CAD systems.
All of our standard products are available in private label versions .

About PC Tech
PC Tech has been designing. manufacturing and marketing high performance PC related products for over three years. Our standard product line includes processor,
memory, and video products. All products are designed, manufactured and supported in our Lake City, Minnesota facilities .

Designed, ,Sold and Serviced By:

High resolution fractal produced
on the PC Tech COLOR 34010
907 N. 6th St., Lake City, MN 55041
(612) 345·4555 • (612) 345·5514 (FAX)
PC, XT, AT, OOIS, Hercules, and Award BIOS are trademar1
Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Create Date                     : 2013:01:25 15:29:57-08:00
Modify Date                     : 2013:01:25 17:42:21-08:00
Metadata Date                   : 2013:01:25 17:42:21-08:00
Producer                        : Adobe Acrobat 9.52 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:108d68a0-e730-4d27-82f2-8a382727ddcb
Instance ID                     : uuid:fc3816b8-65a4-40df-8b08-61e9d18cc61c
Page Layout                     : SinglePage
Page Mode                       : UseNone
Page Count                      : 100
EXIF Metadata provided by EXIF.tools

Navigation menu