No. 51 January-February 1990 $3.95 THE M N CAL J 0 URN A L

Embedded Systems

Looking for an easy way to put together an embedded controller? Then don't put down this issue.

Embedding An XT page 8 This is for those of you who want it all. Cheap hardware, a familiar (MS-DOS) environment, and complete tools for development and debugging.

Writing A Neural page 16 Network In , Part 1 Neural Nets are delivering nearly everything that AI promised. Our series includes all the needed to experiment with this fascinating technology.

LIMBO, Part 4 page 30 Give your robot a body (and part of a mind).

Marketing Your page 66 Own Software How and wh~re should you advertise your new product? What kind of response should you expect when you do advertise? . And More ... Getting Started in Hardware The Poet and The Computer

01

a 7447019388 3 SUPER 25Mhz 386 SYSTEM! Tower Cases w/Power Supply with 4MB RAM and Rotary Voice Coil Hard Drive For extra speed and reliability we've included a 44MB Mitsubishi MR535 voice coil hard drive with an access time of 28ms, and a super fast 1: 1 interleave HD controller card.

• 25Mhz 80386 CPU, AMI Bios, Full Size MB • 4MB of RAM, expands to 8MB on MB • 1.2MB and 1.44MB Floppy Drives • 12" Amber Monitor w/Mono Graphics Card • 101-Key Enhanced Keyboard • Serial/Parallel/Game Ports, Clock/Calendar • 200-Watt Power Supply • Socket for 80287, 80387 or Weitek • Full 1 Year Warranty '1 w/Std AT Case ...... $2395 Mini Tower Standard Tower 24J.95 w/1MB ...... $250Less $ (Mega Tower) 20Mhz 386 ...... $150 Less $225 $269

1MB AT SYSTEM Includes: 1MB RAM, 1.2MB & 1.44MB FD, 'rhe'· •. Most ·.• 9o~t·· .• ·Effe¢tive·i.M'~Y •••.t9Sp~e4 XTlTurb04.77/10Mhz ...... $75 44MB Mitsubishi MR535 Voice Coil HD Upy()urt\Tor~8()Sy~teqtJ AT 6/10Mhz ...... 189 (28ms), Fast 1:1 Interleave HD Controller, AT 6/12Mhz ...... 225 Mono Graphics Video Card, 12" Amber AT 8/16Mhz ...... 319 Monitor, 101 Key Keyboard, Serial/Paral­ Upgrade your .·.hard driv~. c()l1tr9g~~,···.iii.Y 522 Ksisec: Math Co-Processors ...... Call 4.77110Mhz w/20MB HD ...... 929 OTC 7287.1:t Interleave,RLL~w/Cache 799 'Kb/Sec; 4.77/10Mhzw/30MB HD ...... 955 .-; .. :::.' .. :":."::'. POWER SUPPLIES 150-Watt XT Power Supply ...... 50 Color options for our systems 200-Watt AT Power Supply ...... 78 (includes video card and monitor) ·'~~:~;~ff~~~;~f~r~~~~,0'jc1~~5:~~c~~~ ATI Graphics Solution ...... 39 ·'911~ging ·froIl1.~ .~!aIl9ar~.t\.!.90Iltr()I~er.toil:J ·•.•• int~rI~aye EXPANSION CARDS CGA Color ...... 175 controllerimproves~tforIlulIlC:t!by.3PO%t Clock ...... 18 EGA Color...... 350 N()ie:fest results~singljjMhtAtMiisnbishjMFi535Haf{fi>rjve'ani:l Game (Joystick) ...... 14 VGA Color (Analog Parallel Port (LPT1 , 2 or 3) ...... 18 Spinf1itl!Disk.Optimizer~ w/Mitsubishi monitor) ....., ...... 495 Serial Port, 2 ports, 1 installed, CGAlEGAlVGA (Multisync) ...... 495 (COM1 or 2) ...... 18 2nd Serial Port Kit...... 18 FLOPPY DRIVES CONTROLLER CARDS KEYBOARDS Serial Port, 4 ports installed ...... 99 NCL 1:1 MFM Controller ...... $110 Chicony Enhanced 101-Key ...... $67 Multi Drive Controller, up to TEAC 360K ...... 74 DTC 7287 1:1 RLL w/Cache ...... 165 Keytronic Enhanced 10 1-Key ...... 67 2 drives, Supports 360K, TEAC 1.2MB ...... 85 Focus 101-Key Tactile, Switchable 720K, 1.2MB & 1.44MB ...... 39 TEAC 3 1/2" 720K ...... 79 Control/Caps Lock, Dust Cover ...... 89 TEAC 31/2" 1.44MB ...... 90 XT CABINETS (#1 Find by Micro C Staff) XT Slide Case, Lock, LED ...... 38 • All Keyboards, XT/AT switchable* XT Multi-IO, Ser/Par/Clock/ HARD DRIVES AT Slide Case, Lock, LED Game/2 Floppy Drives ...... 47 XT Floppy Controller ...... 19 XT 20MB Miniscribe/Kalok 3 half ht., 1 full ht. drives ...... 72 SOFTWARE XT 640K RAM Card (w/OK) ...... 25 8425 (65ms) ...... 239 Baby Tower, w/200 watt PS, XT 2MB EMS Memory Board (OK) ..... 49 8425 w/controller ...... 279 2 half ht., 2 - 31/2" Drives, MS-DOS 3.21 w/GW Basic ...... 49 XT 30MB Miniscribe/Kalok Baby Motherboard ONLy ...... 145 MS-DOS 3.3 w/GW Basic ...... 95 AT/386 8438 (65ms) ...... 249 Mini Tower, w/200 Watt PS, DR-DOS 3.3 w/GEM ...... 49 AT Multi-IO, Ser/Par/Game ...... 33 8438 w/controller ...... 299 3 half ht, 2 - 3 112" Drives, SpinRite Disk Optimizer ...... 49 2nd Serial Port Kit...... 20 AT 44MB Mitsubishi MR535, holds Full or Baby size MB ...... 225 386Max Memory Manager for AT 2MB EMS Memory Board (OK) ..... 99 Rotary Voice Coil (28ms) ...... 459 5 Bay Std. Tower, 250 Watt PS, 386 Systems ...... 69 AT 71 MB Miniscribe 3085 3 half ht., 1 full ht drives ...... 269 Rotary Voice Coil (25ms) ...... 699 6 Bay Mega Tower, 200 Watt PS ..... 239

VIDEO CARDS MONITORS Mono Graphics w/Parallel port ...... 39 12" Amber Monochrome TTL...... 89 ~MicroS~here~ 1:COM,oUTCR'C' "HARDWARE MANUFACTURER CGA Graphics Card ...... 45 CGA Color RGB ...... 249 ~ ,I I CJ V, SINCE 1983·' ATI Graphics Solution EGAlCGA Autoswitch .31 dot ...... 362 Mono w/CGA Emulation ...... 79 CGAlEGAlVGA Orders Only Please! Jl-800-234-8086 CGAlEGA w/256K ...... 95 Multisync (.31 dot) ...... 489 Tech Calls: (503) 388-1194 Hours: Mon-Fri 9:00-5:30 CGAlEGAlVGA 8-Bit...... 149 VGAAnalog CGAlEGAlVGA 16-Bit...... 189 (Mitsubishi .28 dot) ...... 489 855 N.W. WALL • BEND, OREGON 97701 'Prices are subject to change without notice. Shipping CHARGES will be added. 't-year warranty/30-day money back (subject to restrictions)

Reader Service Number 2 'I ~J~~jWg AT&T C++ RELEASE 2.0 SPECIFICATION

E~[1~ag MS WINDOWS COMPArl BI LITY

£~1~IWg EASY PORTABILITY FROM MICROSOFT C

[J~[i~Jlg C++DEBUGGER & EXPANDED C++ TOOLS [/0fE~.R.7g OS/2 UPGRADE AVAILABLE NOW!

We listened carefully to DEBUGGER, and now the For many, EMS what you wanted in a next wait is over. programming support, built G--lOVJ Yo Order: Already own Zortech generation MS DOS C++ into the compiler is C++? Call the order compiler. The answer is '!ou wanted expande~ and important, so it's in there V2.0 hotline for details of our Zortech C++ Improved documentatIon, too. low cost upgrades. fdi~i~~:er's I-~[~\V7If:~~~y /;s~ebn~~ You were happy using the To order Zortech C++ for the first time, just call ! tc: .§Ii ;Hl:;ll..o@..(~Il.f!!~j'j' )':II~HIH{;;'I'\ and 18 classes prOVided in You wanted, «'!1i ':!liif~~, f~!':ii0\(.{!ir~1~1~~1H(~1 delivered. C++ TOOLS, but we the order hotline. We revised and expanded it accept payment by' th~&ITatve2stOlI (E::~: (c\.n-il.1H~; I~~n'.... )'i'.:.: (iii!)) You anyway. Mastercard/Visa/COD. AI I! • (c:; :: IDlil~,~~ci=r' ~~Hi·ai) ~€J\ wanted to Alternatively, mail the leatures I \..c ~~ :: r~ir-j\:" .' :~~tI1~! ~!b) be able to You never asked for a free with the ll~t ~li'~f.Ir.','~;!\!I~!f?' n'~li~i~\i~";.)l coupon below with your power 'R.mjl\J~.!ll:.~(?:.. ~'(;r;~:' .t;·i~f upgrade TSR library to be included, check ar credit card offered by --- to an but we knew you'd love to details. multiple inheritance and OS/2 version compiler use our neat little package, ZORTECH INC., type safe linkage, so here it supporting Presentation so we included it tree. 1165 Massachusetts is. Manager, Y.c0u did not w,ant You liked our FlASH Avenue, Arlington, Iv1A it to cost a lortune, so it s GRAPHICS 02174, USA You wanted compatibility available ,.------, Voice 617-646-6703 with MS WINDOWS, we for $150. Here is our list of highly package Fax 677-643-7969 added it. recommended C++ cooks: for its You want speed, but ZORTECH LTD., You repeatedly asked for to look at C+ + language;Stroustrup $32.25 wanted a 106- 708 Powis Street, C+ + Ansv.er Book;Hansen $26.95 London, SE 18 6LU, easier portability from the c+ + for C Programmers $29.95 CCI+as+s ENGLAND. Microsoft C, we got the standard c+ + Primer;iippman $30.25 Voice (44)-1-316-7777 message, and have written library interrace, Fax (44}-1-3 76-4738 the library functions you SOURCE Ask about our new c++ Video Tutorial so we've need. CODE, so L--__. ______-:-l written it. we are You wanted the world's first including MS DOS C++ source level it.

Name Addre·s-s------o DEVELOPER'S EDITfON$450 (Save $200) o OS/2 COMPILER UPGRADE $749.95 o C++ COMPILER $799.95 o C++ VIDEO COURSE $499.95 o C++ DEBUGGER $749.95 o C+ + Language /Stroustrup $32.25 City--,.,-~ ____State_Zip___ 0 C + +- TOOLS $ 749.95 o C+ + Answer Book/Hansen $26.95 Visa/MC# _---:;-;-______. 0 LIBRARY SOURCE CODE $ 749.95 o C+ + for C Programmers/Phol $29.95 Exp.Date ___Tel ______. 0 COMPILER & LIBRARY SOURCE $299.95 o C++ Primer/Lippman $30.25 All MicroSoft trademarks are ocknowledged. For US orders please add $5.05 shipping Overseas orders at international mail rates. Reader Service Number 70

------_.__ ._-_. -- ENAllY. A debugging tool tough enough to handle the DOS New Version 2.0 Nasties.

How Soft-ICE Works Soft-ICE uses the power of the 80386 to sur­ round your program in a virtual machine. So1f1t- This gives you complete control of the DOS environment, while Soft-ICE runs Nasty over-write? No sweat! safely in protected mode. Soft-ICE uses the 80386 to provide real-time break points on Soft-ICE memory range break points help you memory locations, memory ranges, execution, track down memory over-write problems II 0 ports, hardware & software interrupts. whether you are doing the over-writing or With Soft-ICE you get all the speed and power of another program is over-writing you. a hardware-assisted debugger at a software price. Hung program? No problem! Don't want to switch debuggers? When the system hangs, you now have hope. You don't have to! With Soft-ICE you can break out of hung Soft-ICE can run stand-alone or it can add its programs no matter how bad the system has powerful break points to the debugger you already been trashed. And with Soft-ICE's back trace use. Use your favorite debugger until you require ranges you can re-play the instructions that led Soft-ICE. Simply pop up the Soft-ICE window to set up to the crash. powerful real-time break points. When a break point Program too large? Not with Soft-ICE! is reached, your debugger will be activated automatically. Soft-ICE runs entirely in extended memory. This means MagicCV with Soft-ICE you can debug even the largest DOS programs. And Using Soft-ICE with CodeView gives you the features since your program runs at the same address whether necessary for professional level systems debUgging. Soft-ICE is loaded or not you can find those subtle MagicCV and Soft-ICE can work in concert with Code­ bugs that change when the starting address of your View to provide the most powerful debugging platform code changes. you will find anywhere. System debugging? Soft-ICE is a natural! Soft-ICE is ideal for full source level debugging of TSRs, "These may be the only two products I've seen in interrupt service routines, self booting programs, DOS the last two or three years that exceeded my wildest loadable device drivers, real-time kernels, non-DOS O/Ss expectations for power, compatibility and ease-of-use." and ROMs. Soft-ICE can even debug within DOS &: BIOS. -Paul Mace Paul Mace Software

New Soft-ICE 2.0 features Soft-ICE $386 RUN CODEVIEW~M C Back Trace Ranges IN 8K - .. MagicCV $199 C Symbolic & Source level debugging MagicCV for Windows $199 [J EMS 4.0 support with special EMS MagicCV ~;~ '. Buy Soft-ICE &: MagicCV(W) debugging commands Code View is a great integrated debugger. but -Save $86. C Windowed it uses over 200K of conventional memory. MagicCV uses advanced features of the Buy MagicCV and MagicCVW 80386 to load CodeView and symbols in -Save $100. extended memory. This allows MagicCV to Buy All 3 -Save $186. run Code View in less than 8K of conven­ T]?Nu-Mega tional memory on your 80386 PC NEW-Version 2.0 includes EMS 4.0 driver. 30 day money-back guarantee \/-TECHNOLOGIES Visa. MasterCard and Attention Windows Developers! Version available for CVW. AmEx accepted A w,. _ 0 0' CALL TODAY (603) 888-2386 O'H''''C''O,,", or FAX (603) 888-2465 P.O. BOX 7607 • NASHUA, NH • 03060-7607

2 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Reader Service Number 110' THE M I C R 0 TECHNICAL JOURNAL MICRO CORNUCOPIA

JANUARY/FEBRUARY 1990 - ISSUE NO. 51

Gene Toner 8 Embedding An XT Motherboard 58 C'ing Clearly Wouldn't it be wonderful if you could use one of those $50 XT cards as an ? You can, ducky. You really can. 64 Culture Comer Russ Eberhart and Roy Dobbins 16 Writing A Neural Network in C, Part 1 Russ and Roy are applying neural nets to some incredibly practical projects. 66 On Your Own In this series you'll get the theory,· the application, and you'll get the code so you can try your own applications. (Also check out our neural oriented Tidbits.) 78 Units and Modules

82 Shareware

90 Techtips

Gregory K. Landheim 26 3D-Surface Generation, Part 2 Greg finishes up his 3-D project by getting right into the code. 84 Tidbits Norman Cousins 28 The Poet and The Computer

Bob Nansel 30 LIMBO, Part 4

Bruce Eckel 42 Capturing & Graphing A Voice, Part 2 Bruce tackles the digital half of his speach problem.

Karl Lunt 50 Getting Started In Hardware This is for all of you who've asked for an entrance level article on hardware.

Cover Illustration by Jerry Werner.

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 3 ;iH E M I C ROT EC,H N I CAL JOUR N A L By David J. Thompson

. Editor and P~blisher David J. Thompson

Associate Editors Gary Entsminger Larry Fogg Cary Gatton

Contributing Writers Anthony Barcellos Bruce Eckel Michael S. Hunt Scott Ladd Laine Stump

Advertising & Distribution Our Paper Gareth Thomson You've probably noticed that our paper has changed. This paper isn't quite as white as our old paper and it's Accounting coated. That's the bad news. The good news: it's made Sandy Thompson of 50% recycled pulp and it's the least glossy coated Reader Services paper of this type we've found. Nancy Ellen Locke In the past we paid top dollar because we insisted on the highest quality uncoated paper. (No coating-no Graphic Design & Production glare.) But in the last six months, paper companies have Carol Steffy raised the price for our wonderful paper a bunch, while they've substantially reduced what they're willing to 'MICRO CORNUCOPIA (ISSN 0747-587X) is published hi-monthly for $18 per year by Micro pay for recycled paper. Cornucopia, Inc. 155 NW Hawthorne, Bend, OR Maybe we can save some money and (because of the 97701. Second-class postage paid at Bend, OR arid coating) improve our reproduction. Plus, since we pur­ additional mailing offices. POSTMASTER: Send chase over 14,000 pounds of paper each time we print a address changes to MICRO CORNUCOPIA, PO Box 223, Bend, OR 97709. Printedon recycled magazine, we'll save about 42,000 pounds of trees a paper. year. Just by using recycled paper. I broached the subject of coated versus uncoated at SUBSCRIPTION RATES: SOG East. Everyone voted for uncoated. Then I added 1 yr. (6 issues) $18.00 2 yr. (12 issues) $34.00 that it contained recycled pulp. It was unanimous again. 3 yr. (18 issues) $48.00 They voted to try the new paper. .1 yr. Canada & Mexico $26.00 ;. "1 yr. Other foreign (surface) $36.00 ; J yr. Foreign (airmail) $50.00 Futures, Bricks, And The Wall Street Journal The call I answer most often isn't a tech call (and it isn't nature), it's a sales call. "I'm calling with the information you requested on CHANGE OF ADDRESS: . Please send your old label and new address to: commodities futures." "Commodities futures? I didn't request any informa­ MICRO CORNUCOPIA tion on commodities futures." P.O. Box 223 Bend, Oregon 97709

READER SERVICES: ;' For orders and., subscription .... problems call 1~-888-8087, 9 am to 5 pm, Pacific time, M-F. FAX your VISA or.. MC order to llS, oUr FAX " number is (503) 389-6833.

TECHNICAL ASSISTANCE For help call 503-382~, . .. 9 am to noon Pacific time, M-F' . BBS - 24 hrs; 300-1200-2400 baud 8 Bits, No Parity, 1 Stop Bit

". Copyright 1990 by Micro. Cornucopia, Inc. , . , All rights reserved . ISSN0747-587X Contented Timber•

..s?~u·.·· Continued on page 73 4 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 You asked for a place to put your things ...

The Tele 1M FILE SYSTEM is just the thing

BerryComputers presents The Tele Toolkit - a complete Operating Systems Kernel

If It's Data, It Must Be A File system. Files can also be redirected from the keyboard and to the console display and printer. Tele's file system is modular at several levels. FS is respon­ sible for all storage and transfer of data. To support efficient communication and storage, FS con­ tains a modified Huffman compression algorithm. The The physical interface to disk devices is through MS-DOS modification automatically recognizes fields within records installed device drivers (MS-DOS itself is by-passed). and applies a different compression tree to each type of Therefore, Tele will work with the same devices that MS­ field. Compression can be processed directly on blocks DOS supports. or continuously and transparendy within the file system. Separate from the physical interface is the directory struc­ All source code, in C and assembly, is included. Tele SK ture. Tele supports installable file systems; each device is required for FS. CD is also required for console device can have a unique media format. Only MS-DOS compati­ support. ble media are supported in FS. Demo Diskette $ 5 (refundable with purchase) Some other Tele components involve installable file systems. SK system kernel $50 (multitasking) For instance, the UX component emulates the Unix ketneL CD console display $40 (windows, requires SK) Most of its code supports Unix media. Networks are sup­ FS file system $40 (MS-DOS media, requires SK) ported by an installable file system that causes directory OS core $130 (SK, CD, and FS) operations to be performed on a device in a remote com­ puter system. FS itself only supports MS-DOS media, but Telephone support is freely available. it provides the main hooks by which any other file system· can be emulated. The Tele Toolkit is available from: Crosby As~ociates The bulk of Tele FS code supports hierarchical directory P.O. Box 248 structures and file redirection. Because MS-DOS is not Sutter Creek, California involved, you can use FS to avoid .its restrictions. 95685 Tele FS also includes serial communications support. 8250 controllers are supported in bidirectional interrupt mode. CALL NOW TO ORDER: Ring and break indicators are also supported. Serial ports (209) 267-0362 (FAX) (209) 267-0115 can be accessed directly, or redirected through the file Visa, Mastercard, American Express & Discover Card accepted.

MS-DOS is a Irademark of Microsofl Corporalion. Unix is a Irademark of AT&T

Reader Service Number 147 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 5 VOICE MASTER KEY ® VOICE RECOGNITION SYSTEM FOR PC/COMPATIBLES & TANDY 1000 SERIES A FULL FEATURED VOICE I/O SYSTEM

GIVE A NEW DIMENSION TO PERSONAL COMPUT­ Letters ING ... The amazing Voice Master Key System adds voice recognition to just about any program or application. Voice up to 256 keyboard macros from within CAD, desktop publishing, word process­ ing, spread sheet, or game programs. Fully TSR and occupies less than 64K. Instant response time and high recognition accuracy. Voice recognition tool-box utili­ ties are included. A genuine productivity enhancer!

SPEECH RECORDING SOFTWARE ... Digitally record your own speech, sound, or music to put into your own software programs. Software provides sampling rate Long Lawn, Laments Loyal Loiterer SpinRite Defended variations, graphics-based editing, and data compres­ sion utilities. Create software sound files you can add My motorcycle vacation took me I've been a faithful follower of Micro to macros for voice recognition verification response. A through Bend. I have not been in Bend C from the day I bought my first micro­ complete, superior speech and sound development too/. since P~P (pre-) days, computer (my old Kaypro II), but I think SOFTWARE CONVERSION CODES ...The Voice and there have been a few changes! A that you goofed when you trashed Spin­ Master Key System operates a growing list of third tour of Bend would not have been Rite in recent issues. I bought SpinRite party talking software titles using synthesized phone­ tics (text-to-speech) or digitized PCM, ADPCM, and complete without a swing by Micro C. as a last resort to save my ailing hard CVSDM encoded sound files. Voice Master Key System I don't make a habit of visiting pub­ disk (a Miniscribe 32 MB, 65 ms, on a does It all! lishing headquarters, but Micro C is an card-the kind you get from Com­ exception. Alas, no one was home­ puAdd) in my XT clone (built from a kit probably out rafting/tubing instead of from, where else, MicroSphere). mowing the lawn. (Gosh, I hope that I was getting a lot of read/write er­ wasn't too metaphysical.) rors and an increasing number of bad Keep up the good work .... sectors when running the surface analy­ sis part of PCTools. Doing a destructive Nils R. Olson reformat (and, of course, reloading all 419 Woodhaven Drive my files from backup) was the only way Vacaville, CA 95687-5941 to get the disk back into reliable shape. EVERYTHING INCLUDED. . .Voice Master Key Then the problem would reappear and System consists of a plug-in card, durable lightweight microphone headset, software, and manual. Card fits Editor's note: Thanks Nils for the photo. get worse within a month or so. any available slot. External ports consist of mic inputs Yes it does look like it's time for our annual I ran SpinRite on the flakey drive and volume controlled output sockets. High quality mow. (It's more physical than metaphysical.) (full, deep testing with nondestructive throughout, easy and fun to use. ONLY $149.95 COMPLETE ONLY $89.95 FOR TANDY 1000SUTLMODELS­ SOFTWARE 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 (3Y2" or 5W') when ordering. Add $5 shipping charge for delivery in USA and Canada. Foreign inquiries contact Covox for C & F quotes. 3ODAYMONEY BACK GUARANTEE IF NOT COMPLETELY SATISFIED. ONE YEAR WARRANTY ON HARDWARE.

CALLORWRITE FOR FREE PRODUCT CATALOG

covox iNC. 675-0 Conger SI. @ Eugene, Oregon 97402 U.S.A. TEL: 503-342-1271. FAX 503-342-1283

Reader Service Number 143 Letters continued on page 70

6 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Introducing ••. The 1st Family of Lo~ Cost, Powerful Text Editors

VEDIT Jr. $ 29 VEDIT $ 69 VEDIT PLUS $185

Finally, you can choose the best editor for your needs without compromising performance or paying too much. And organiza­ FREE Evaluation * tions that want the "same" editor for everyone can pick VEDIT® for most users and VEDIT PLUS for their power users. Call 1·800·45·VEDIT 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.) Compare Features and Speed Call for your free evaluation copy today. See why VEDIT has been the #1 choice of programmers, writers and engineers VEDIT BRIEF 2.10 Norton 1.3 OEd it 2.07 since 1980. Pull-Down menus Yes No No Yes Pop-Up ASCII table Yes No No No VEDIT Jr.-Unmatched performance for only $29. Keystroke macros 100+ 1 No 100+ All VEDIT editors include a pull-down menu system with "hot Regular Expressions Yes Yes No No keys;' context sensitive on-line help, pop-up status and ASCII "Cut and Paste" buffers 36 1 1 100 table, a configurable keyboard layout and flexible, unlimited Text (book) markers 10 10 No No Undo keystroke by keystroke Yes Yes No No keystroke macros. Edit files of any size and any line length .. Undo line by line Yes No No No Perform block operations by character, line, fileorcolumn. Undo Normal/max Undo levels 500/1000 30/300 - - up to 1000 keystrokes- keystroke by keystroke, line by line, or Variable tab positions Yes Yes No No deletion by deletion. Automatic indent, block indent and paren­ Configurable keyboard Yes Yes No Difficult theses matching speed program development. Word wrap, Integrated mouse support Yes No Yes No paragraph formatting, justification, centering, adjustable mar­ FILE LIMITS gins and printing for word processing. Run DOS programs. Edit files larger memory Yes Yes Difficult No Maximum line length >8096 512 65,535 512 VEDIT-A best value at only $69. Maximum lines/file 8,388,607 65,535 >65,535 20,000 Simultaneously edit up to 36 files and split the screen into win­ COMPILER SUPPORT None None dows. Search/replace with regular expressions. Includes the Menu driven Yes No - - best compiler support available- menu driven, easy selection Select Compiler options Menu Difficult - - of compiler options, supports "Include" files and MAKE utilities. Support "Include" files Yes No -- BENCHMARKS 50K FILE VEDIT PLUS-Ultimate programmer's tool for only $185. Simple search 0.2 sec 1 sec 1 sec 0.3 sec VEDIT PLUS adds the most powerful macro programming Save and continue 1 sec 2 sec 2 sec 1 sec language of any editor. It eliminates repetitive editing tasks and 1000 replacements 3 sec 19 sec 17 sec 2.5 sec permits creating your own editing functions. The macro BENCHMARKS 3 MEG FILE language includes testing, branching, looping, user prompts, Simple search 1:40 min 1:36 min Cannot Cannot keyboard input, string and numeric variables and control over Save and continue 1:05 min 3:23 min Cannot Cannot the size, position and color of windows. Source level macro 60,000 replacements 3:18 min 1:44 hour Cannot Cannot debugging with breakpoints and tracing. Macros developed Block-column copy (40 x 200) 2 sec 30 sec Cannot 2 sec Insert 1 Meg file in with VEDIT PLUS also run under VEDIT. middle of 1 Meg file 1:11 min 15:13 min Cannot Cannot 30 day money-back guarantee. Call for pricing of XENIX, OS/2 PRICE $69 $195 $15 $54.95 and FlexOS versions. Very attractive quantity pricing is avail­ able for schools, hardware and software vendors.

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 CompuView and other displays. Also supports Concurrent DOS, DESOview, Microsoft Windows, PC-MOS/386 and most networks. 1955 Pauline Blvd., Ann Arbor, MI 48103 'Also available for MS-DOS (CRT terminals), TI Professional and others. 'Free evaluation disk is fully functional and can edit small files. Reader Service Number 7 (313) 996-1299, Fax (313) 996-1308 Embedding An XT Motherboard Putting Together A Conlplete Developlnent Systeln Without Trading In Your House

cost in-circuit emulator to make them fortune then, a small fortune now. The There are fancy chips and fancy boards. function? Why does a micro controller project requirements for this device But however you do it, there's one big im­ that costs $5 for the mask programmed changed as it developed (this is an ad­ pediment to developing an embedded sys­ part cost $50 for the EPROM version? vanced engineering management tech­ tem-it's putting together a complete set of I spent a lot of my early days in en­ nique called lithe moving target"). The tools and then learning how to use them. gineering wrestling with these questions. device would have to calculate in floating And ICE: you know, in-circuit emula­ I also had a lot more courage than brains point. I wrote a four-function floating tion. Boy, that's wonderful when you're de­ in those days. My first experience was point arithmetic package in Z80 as­ bugging code on a deaf-mute board (espe­ with a Z80 single board computer on the sembly. What a pain. . cially when it pretends to be brain dead). So, SID bus (it was memorable). I hoped the Next I used an 8048 single chip micro­ when Gene offered to do this article, what Navy would use the machine to test jet controller in a temperature controller. I could I say? (ICE is nice.) engines. only needed integer math for this beast. This was around 1978, and I also had The cost of an 8048 (the version they pro­ a TRS-80 model 1. I used to say TRS-80 gram at the factory) then was about $5, y experience with embedded model 1 computer, but I know better but unless you wanted at least 5000 systems goes way back. Most of now. The TRS-80 had a workable assem­ pieces, Intel wouldn't consider the pro­ Mmy early recollection is clouded bler, but the EPROM programmer sup­ gram mask. by the memory of intense P?in. The plied by the Navy couldn't talk to it. It The version with internal EPROM pain centered on the following ques­ couldn't talk to anything. It had a hex was about $50, so I designed a card to tions. Why do little low cost single chip keypad. Humans cursed it. supply external EPROM and RAM (with micro controllers require a large high In-circuit emulators for the Z80 cost a an address latch). It looked like a single

8 MICRO CORNUCOPIA, #51, Jan-Feb 1990 By Gene Toner IDEC, Inc. P.O. Box 69 Fountainville, PA 18923

board computer when I finished. The What really makes this board attrac­ worst part was that I still couldn't afford tive, however, is the C-THRU-ROM by an in-circuit emulator for debugging the DATALITE. This software package does code. \Vau might think I things that $20,000 in-circuit emulators There's a neat little circuit you can just dream about. build around the 8048 to cause it to would have learned, It lets you write your programs in Mi­ single step through a program. You can crosoft C 5.x or Turbo C 2.X, cross load monitor the state of the address bus with but I still do em­ the executable and the C symbol table to LEDs. You can have the 8048 write inter­ the target system, and DEBUG ON THE mediate results to an output port with bedded controllers. TARGET SYSTEM IN C (using a debug­ more LEDs. Then you can single step ging environment very similar to Micro­ your way through the bugs, bum new Fortunately, I now soft's CodeView). Finally, it lets you bum EPROMs, single step, bum new the whole works into EPROM, all for less EPROMs, single step .... have real solutions than $500. The Prescription For Embedded Pain for development. XT Motherboards These were just two early experiences. The usual XT motherboard will hold I also wrote a cross assembler for the up to 640K of parity checked RAM and National Semiconductor 8073 micro­ 40K of ROM. This ROM space is usually processor in TR5-80 model 1 BASIC. I not the whole XT, just the motherboard. mapped as 8K of BIOS residing at para­ did this to avoid hand assembly. Embed the mother to handle any control graph FEOO and 32K of ROM BASIC at Interestingly, this processor had an task you want. Editor's note: Micro C is F600. Both of these ROM spaces are on-board integer BASIC interpreter and not always a safe place to make offhand com­ available for embedded programs. interfaced to a terminal. National de­ ments about the fairer sex. In most embedded applications, 640K signed a board with this processor, A 12 MHz motherboard costs about is overkill since RAM is usually only EPROM, RAM, I/O, and one of the $80 these days, an 8 MHz unit about $65, used for variables and stack. Other appli­ EPROM sockets would program 2716s! usually less without the BIOS (more cations, such as data loggers and pattern It was a dream come true until my about this later). These boards have eight recognizers, make good use of every­ BASIC program grew beyond about 20 expansion slots for adding anything and thing they can get. Also, RAM is a lines. You needed a calendar to time the power supplies are only $35. Text Continued on page 12 execution. They threw in a BASIC in­ struction that jumped to machine lan­ guage routines, but no assembler. I wrote Figure I-Motherboard 1/0 Map the assembler. You might think I would have I/O DECODED I/O USED FUNCTION learned, but I still do embedded control­ lers. Fortunately, I now have real solu­ OOOOh - 001Fh 16 DMA control.l.er tions for development. 0020h - 003Fh 2 Interrupt control.l.er What is the ideal platform for an embedded controller? It should be inex­ 0040h - 005Fh 4 Timer counter pensive, flexible, expandable, available, 0060h - 007Fh 4 PPI (S255) chip and reliable. Plus, there should be great software support, such as assemblers, de­ OOSOh - 009fh 4 DMA page registers buggers, and high level languages, all in­ OOAOh - OOBFh 1 NMI mask bit expensive. We don't want to have to sell the kids to control the temperature in the aquarium (hmmmmm ... ). • • • The answer, of course, is the XT! No,

MICRO CORNUCOPIA, #51, Jan-Feb 1990 9 Figure 2-PC Card with a Dead-man Timer

C20 jil""""C23-iliip-CZ-ili.....C2:I-ili"t- - - +:5 C26-ili.....CZ 7 -12 R9 CZ3 - C27 .OIIS"

TTTTT R6 CHO- 1-"---""',.."..--"-....;....-.1:5.3

+12 R7 CHO+ 1-"-_-""''''''---"''=--.1:5.4 Rl lK R8 ..... _ ...... _+5REr

IC3

DSc' l J1B3O..::=.::....-...... ::;~

C19

-12 RI3

~...... _ ....R""I",O _....:C::.H::..I-_ .r.5.:5

LF444B ~...... _...,R""l1_---=C::.H::..;I+~ .r.5.6

IC7 +:5REr REr+ 12 R12 Jl.A3I REr- 16 Al 0\ AI! 0 CD DO 17 0 JlJ\9 DI 14 DO U JLA8 ~ IIi! 1:1 Dl JlJ\7

R4 R:5 :5.1K :5.1K tIlTEo DECODES 02CQ.02DO, 03CQ.03DQ, 16 LDCATI~S

I 1 ICI:5 >----J:5.21 J2 ICI J :5'1!2 II f 12 IDR 3 J1B14 13 +:5Rrr IDV I!I! J1B13 14 D1 21 J1J\e4 1:5 DI! 20 JIA2:5 co 03 --J 19 JLA26 (;) 04 (\J 18 JIA27 11:5 17 JLA26 D6 16 JIAI!:! 07 1:5 JIA24 DB JI.Bl ----...... ---.1:5.1 JIA23 ----+---.1:5.2 JIA22 JI.B31 JI.A11 .I:5.!IO J1.B3 ----..-...",..- .1:5.49 J:5.1!3 Jl.B7 --...... --t--.-=-- .1:5.48 Jl.B9 -1--+---t-:-;::;-- .1:5.47 J f :5·24

10 MICRO CORNUCOPIA, #51, Jan-Feb 1990 -Ie ~: R17 -12 ~l R~ y- y------y+ y+ R14 CHe- RZZ CH4- .JS.7 J:IJl :! 1 2[:~a3 : LF'444~ C LG 1t Rl:! CHZ+ k' R23 I"-S + 10 CH4+ 6 r;~ 3!Cl0 6 7l'--. Ica J:l.a ',i:~- J:I.12 11 ca 8 '

-12 ~: R~ +12 v- -Ie ~: R21 y+ 4 y- 2 Re6 CH:I- 1 v+ 4 J:I.13 2 Ria 00- I RZ7 CH:I+ L13 3 ..e.' '.1~&-6 :! [F'~ 3 14 LF'444D -;-~ICU .JS.14 C LG R19 CIO 8 '

I ~: R33 y- V+ R30 CIi6- 8~9 J:l.l:1

I ~ R31 CIi6+ 6 ICl3 ~IO 'i:~3-;-~ .JS.16 I Cll a ICII! R3I! I I 'I~J I "*' CI3 \ I II -II! R37 +12 v- V+ 4 2 R34 CH7- 1 L13 J:l.17 ICI8 14 LF'444D 10 EDC PC7 R3:I CH7+ SAMPLE '1~&-3 ~12 PC6 :~ 6 -;-~ICI4 J:I.18 PC:! 13 Cl2 8 ICte .JS.e6 PC4 17 R36 JLI2 RESET 3:1 RESET .JS27 ~: 16 J:l28 '1~1 PCl :: .JS29 -==- , PCO 2S .JS.3O CS .JS.31 IlR S PB7 24 RD .JS.32 I mv 36 PB6 e3 +:1 'JR If) PB:I 22 J:l.33 lIMTRIG 13 12 If) PB421 .JS.34 At C\J L-.JS2:J I : Al co PB3 .JS.3:I +:1 lceo AD 20 7406F' AD PB2 19 .JS.36 R3 .JS.37 14 18 1M PBl 18 y+ I J:l.38 R2 R D7 27 PDQ 37 :IlK 2 D7 .JS.39 TR If) TH~--- l PA7 38 If) ~ D6 PA6 39 .JS.40 J e v JUI IDCHCK CUT .... D~ ~ os PAS 40 .JS.41 tO~ J4 GND tV ~ D4 PM 1 .JS.42 IC20 .!!L..2!. D3 PA3 J:I.43 7406£ IC1' 2 ~ De .JS.44 .!!...... E PA2 3 --C22 Dl Pi'll J:I.4:! Dl~ I ~ DO PAD 4 .JS.46 lfm TDUE

MICRO CORNUCOPIA, #51, Jan-Feb 1990 11 wonderful place to develop and debug programs. Figure 3-Function Offsets (from BASE) Along with the memory, other on­ board resources include four DMA chan­ OFFSET (HEX) READ FUNCTION WRITE FUNCTION nels, one dedicated fo DRAM refresh. There are three counter/timer channels­ one dedicated to requesting refresh cy­ o CHO CONVERSION DATA SET AID CHO FOR INPUT cles, one to interrupting the processor 1 CHl CONVERSION DATA SET AID CHl FOR INPUT (used in the PC for time of day with a 2 CH2 CONVERSION DATA SET AID CH2 FOR INPUT link interrupt), and one to work the 3 CH3 CONVERSION DATA SET AID CH3 FOR INPUT speaker. 4 CH4 CONVERSION DATA SET AID CH4 FOR INPUT There is also an eight-level priority in­ 5 CH5 CONVERSION DATA SET AID CH5 FOR INPUT terrupt controller. Level 0 (highest prior­ 6 CH6 CONVERSION DATA SET AID CH6 FOR INPUT ity) connects to the counter/timer chan­ 7 CH7 CONVERSION DATA SET AID CH7 FOR INPUT nel 0, and channell connects to the key­ board adapter circuits. The other six in­ 8 NO FUNCTION LOWER 8 BITS D/A 0 VALUE terrupts are bussed to the adapter cards. 9 NO FUNCTION UPPER 4 BITS D/A 0 VALUE The keyboard adapter circuits provide A NO FUNCTION LOWER 8 BITS D/A 1 VALUE an externally clocked serial input to the B NO FUNCTION UPPER 4 BITS D/A 1 VALUE motherboard, with an interrupt generated at the conclusion of a received C 8255 A PORT READ DATA 8255 A PORT WRITE DATA byte. There is also an eight-position DIP D 8255 B PORT READ DATA 8255 B PORT WRITE DATA switch mapped into the I/O space to E 8255 C PORT READ DATA 8255 C PORT WRITE DATA allow for static input to a program; nor­ F NO FUNCTION 8255 CONTROL REGISTER mally the board reads this switch at power up. Figure 1 presents the I/O map of the devices on the motherboard. • • •

Figure 4-C Code to Monitor EOC

STOMP OUT get_channel (chan)

EPROM MADNESS char chan;

int eoc; int result; 1* start the conversion process *1 I .--.. " ~,..". outp(BASE+chan,O); 1* select the channel, start *1

1* monitor EOC *1 saving eoc=O; both time and money during your development while(!eoc) 1* loop executes until EOC is high *1 cycle, Programmable in seconds via your PC eoc=inp(BASE+OxOe) & Ox80; 1* get the EOC value *1 printer port or any computer RS232 port, it can emulate most 27xxx devices, result=inp(BASE+chan); 1* get the converted value *1 return(result); • 8K-8M bit devices • 8-256 bit downloads • High speed download: • Easily expandable: -Universal RS232 -4 EPROMS per unit -PC printer port -Up to 8 units • • • • Menu driven software • Also programs like • Battery backup a real EPROM

$599 for 150nS units with 256K bits Ask for pricing of other options

Made in USA by: T~XEL ~BS INC. Box 239 .RONKONKOMA, NY ·11779 516-737-5147

Reader Service Number 178

12 MICRO CORNUCOPIA, #51, Jan-Feb 1990 C-THRU-ROM C-THRU-ROM lets you write C code, compile it with Microsoft or Turbo, dump it to the target XT via a serial port, and debug it (remotely). The only thing you can't do is use DOS calls. Microsoft tells you which of its library routines use DOS calls in the ''Writing Programs for Read-Only Memory" section of its manual. After the usual compile and link, C­ THRU-ROM starts to work. The LOC command in C-THRU then locates the re­ sulting program. CONVERTS ACTION DIAGRAMS; Located? Besides the program code and data, an EXE file contains informa­ For line 0 to T tion on program memory requirements, Put leading spaces in the output string segment modifications, and the start Put the line number and ': ' in the output string address. DOS resides in low memory and Calculate offset (line * 32) loads programs right above itself. Pro­ If line is not 0 or 4 grams start at the first byte of code and For count equals 0 to 31 end with the last byte of data. Character value is count plus offset In our embedded system, we (usually) [ Add character and space to the output string 1*r Endfor */ don't have things so well lined up. ROM I gets mapped in high memory space so it /* Else */ can pick up the 8088's power-on jump /* Add 'Control characters, can't print them!' to the */ /* output 6tring */ vector (paragraph FFFFh). RAM, how­ /* Endifelse */ ever, must start at paragraph OOOOh to /* Display the output string */ support the 256 four-byte interrupt vec­ /* Add CR and LF to the output string */ tors. Fortunately, C-THRU's LOC can /* Print the output string */ handle a memory map with holes in it. /* Endfor */ Once located, the program communi­ cates via the serial port to the target sys­ tern's kernel for debugging. Kernel? Se­ rial port? This is the only hard part of the whole package: getting the C-THRU­ ROM kernel configured for, and running on, the target system. C-THRU supplies the kernel source, but you must con­ figure it for your own motherboard. In an XT motherboard, the kernel must initialize all the ports, set up inter­ rupt vectors in low RAM, and set up the DMA channel and timer for DRAM re­ fresh. For all this, you should have a good idea what's going on inside the XT's hardware. Once you have the kernel running, however, the debugging en­ vironment is grand. Even though the target system has, say, no drive, no monitor, no keyboard, no nothing (but a serial port), you can download programs from the host and debug them on the target. So the program resides on the target system, and the C-THRU-ROM program RDEB runs on the host Pc. You're step­ ping through C code (or assembly or both) one line at a time, watching varia­ bles change. You can also set breakpoints on C symbols. The environment is a lot like CodeView.

MICRO CORNUCOPIA, #51, Jan-Feb 1990 13 After you've finished debugging, you simply link the C program with C­ Figure 5-Assembly Routine to Collect AID Data From Channel 5 lHRU-ROM's startup code (which re­ places the normal C startup code) and DATA_SEG SEGMENT AT 0040H produce an Intel hex format file. Then RESULT DB 2 send the file to your EPROM program­ DATA_SEG ENDS mer. (My Taiwanese programmer loves Intel hex.) STACK_SEG SEGMENT PARA STACK ' STACK' AT oeOOH There are some drawbacks to the DB 100 DUP(?) package, the most limiting being C­ STACK_SEG ENDS lHRU's inability to debug interrupt routines. So, we usually write polling CODE_SEG SEGMENT AT OF600H loops for initial debugging and then add ASSUME CS:CODE_SEG interrupts later. MOV AX,DATA_SEG ;INITIALIZE THE DATA SEG Talking To The World MOV DS,AX After building several embedded sys-:­ tems, I have discovered that microproces­ MOV AX,STACK_SEG ;INITIALIZE THE STACK sor systems, used as controllers (read that MOV SS,AX as left alone in the real world), some­ MOV SP,OH times jump out of their programs into what is affectionately known as outer ;INITIALIZE EXTRA IF USED space. ASSUME DS:DATA_SEG,SS:STACK_SEG Editor's note: Apparently, this is the part of outer space where daisies grow. START: If it's really important to keep the sys­ MOV AL,O tem running, you should include a dev­ MOV DX,BASE+S ;CONVERT CH 5 ice known as a dead-man timer in the OUT DX,AL ; START design. If a dead-man timer isn't serviced MOV DX,BASE+OFH ;POINT TO C PORT at a certain interval, it resets the proces­ LOOPO: IN AL,DX ;GET THE CONDITION sor. AND 10000000B ;RESET UNUSED BITS The service to the dead-man must be JZ LOOP 0 ;LOOP UNTIL EOC IS HIGH from the main loop of the program, not from an interrupt routine. It's possible for MOV DX,BASE+S ;POINT TO THE DATA the processor to be totally lost but still be XOR AX, AX ; CLEAR capable of servicing interrupts. IN AL,DX ;GET THE DATA Since I couldn't find any PC cards MOV AX, DS: RESULT ;STORE IT containing a dead-man, I built my own. Because It would be silly to put together • • • a whole board with one or two tiny chips, I added a little something: 8 chan­ nels of 8-bit 10 KHz AID conversion, 2 channels of 8- or 12-bit DIA, and 22 digi­ interface chip (lC18) supplies the 24 I/O converter won't be confused by rapidly tal 1/0 lines. See Figure 2. lines. I use two lines on the board so changing signals. Don't let inputs to the The heart of the AID is the National there are 22 available through the I/O ADC0809 exceed the 0-5 volt range. Semiconductor ADC0809 eight channel connector. AID converter. This is a successive ap­ The dead -man timer (lC19) is a CMOS A Cheap Alternative proximation eight-bit converter with an 555 timer configured as a resetable mon­ The alternative to using C-lHRU­ internal eight-channel multiplexer. In this ostable multivibrator. When it times out, ROM for this type of development is to design it will perform a conversion in it makes the I/O channel check bus line do all the development and debugging about 100 microseconds (lC2). active. I installed a jumper on the line to on a Pc. This is feasible and could be The 20L 10 PAL handles address de­ disable this function during debugging. even more so. coding, supplying all the read and write All real world inputs and outputs Replace the standard BIOS ROM on strobes. The decode is for 16 contiguous enter the card through the 50 pin dual the PC with a ROM program that initial­ addresses at the starting points Indicated row header. I use PET input differential jzes the motherboard and then jumps to on the schematic. The D I A function (lCs op amps to buffer all the analog inputs. the highest paragraph. of the next. lower 15 and 16) generates analog signals for Differential inputs are much more im­ ROM. This would allow development to the real world. mune to noise than single-ended inputs. start in the "crash and burn" type en­ The schematic indicates the part num­ I included capacitors in the amplifiers' vironment. ber for the 12-bit converters, but the 8-bit feedback loops for filtering, if necessary. So how do we do it? Let's look at parts (DAC830) are pin for pin compat­ Following the op amps, I added sample doing an AID conversion using C for the ible. The 8255 programmable peripheral and hold amplifiers so our slow AID C-lHRU environment and assembly lan-

14 MICRO CORNUCOPIA, #51, Jan-Feb 1990 guage for the jump ROM environment. To run in a jump-start type environ­ C-THRU-ROM by DATALlTE First, disable the dead-man timer on the ment (without a locator program) would List $500-IDEC $400 card by removing the jumper J4 for require .that the C compiler handle the lo­ Includes fully developed kernel for development. The card has the following cation, or you'd have to use assembly standalone PC address offset mapping, the base address language. In assembly, of course, you in the processor's I/O space being 02CO, have complete control of the segments A!D+D/A+I10+DEADMAN ADAPTER 02DO, 03CO or 03DO, depending on the and jump locations. A&T List $199-IDEC $139 jumper setting. (See Figure 3). In Figure 5, you'll see my assembly Bare board + PAL To start a conversion, in AID channel language version of the C program in IDEC $49 5, for instance, just write data to the Figure 4. I wrote it for a PC motherboard address of channel 5 (the board address with 64K of RAM starting at OOOOOh, the Both of the above plus an offset of 5). It doesn't matter jump start ROM at FEOOOh, and the user List $699-IDEC $500 what you write. ROM at F6000h. After the write, the EOC (end of con­ The last thing the jump start ROM Initialization + Jump ROM for PC version) line will go low. (Monitor this will do after initializing the peripherals, List $49-IDEC $25 line by reading the high bit (bit 7) of port the RAM refresh, and the interrupt vec­ for non C-THRU ROM development C of the 8255.) My program monitors this tor table is to far jump to FDFFOh, the line, waiting for it to go high, indicating last paragraph of the user ROM. Here the conversion's done. you must place a far jump to your code's • • • A C program to do this might look entry point, with interrupts disabled. like Figure 4. Note that BASE is the base address of the board. The Offerings While this code would work fine with IDEC, Inc., offers the following pack­ the C-THRU package, you'd need a loca­ ages to support the development of tor program to justify the compiler's seg­ embedded systems using the PC-XT ment references if you used this with a motherboard as the platform for stand­ simple jump-start ROM. alone applications:

AS~OW ~;~;;~ AT LAST!

FLOW CHART AND ANAL VZE YOUR ASSEMBLY LANGUAGE SOURCE CODE • Flow Charts • Tree Diagrams • Stack Sizing • Register Analysis • CPU Timing Analysis • Procedural X-Reference • 8088/87 to 80386/387 • Context-Sensitive Help break_currenUine editor_warning • MenulBatch/Command r- save screen line Operation L display-warning This add was prepared on a laser printer usin restore screen • MASM 5.1 Compatible editor_warning n Idee Supervision captured Tiff image, Xerox insert blank line adjuslJine - entura Publisher, ZSoft's PC Paintbrush IV,and join_line pplication Techniques' Pizazz Plus. Call: editor_warning adjusUine 19855~= Stevens Creek Blvd, Sutte 154 delete_ediUne VISA Master Cupertiro, CA 95014 ~ editor line out 215-249-0673 ediUine_oUt - Card (408) 244-6826 VISA • Me 30 - Day Money Back Guarantee

Reader Service Number 180 Reader Service Number 139 MICRO CORNUCOPIA, #51, Jan-Feb 1990 15 Implementing A Neural Network In C: Part l' \ \

Russ and Roy were hits at SOG East. After their presentation, I found myself in a' motel room cornered by these two neural ad­ dicts. I must say my mind is still working on the inputs-back propagation, I think it's called. All seriousness aside, neural nets are very possibly the most important new tech­ nology I've seen. Once you're comfortable with the concepts, things really open up. In many ways this is everything that AI had promised, and more.

eural networks are hot! For many good reasons. We now use appli­ Ncations which include embedded neural networks in manufacturing, teaching, aerospace engineering, finan­ cial advising, circuit board analysis, and more. Contrary to popular opinion, you don't need a super parallel processing computer, a Sun workstation, or a PhD. in neurobiology to use a neural network. A PC and the C code for the neural net­ work tool (NNT) we develop in this ar­ ticle will get you going. This issue we'll briefly introduce NNTs, explain how they work, and show you all the equations and code you need to create one. In Part 2, we'll show you how to train and use our NNT. Mean­ time, download our NNT (including C source code and .EXEs) from the Micro C BBS and tell us what you think about this fascinating technology. Editor's note: We've excerpted Russ & Roy's article(s) from their forthcoming book on implementing and using neural networks, due in 1990 from Academic Press.

Intro A neural network, in short, looks for patterns in a set of sample cases (a train­ ing set), learns from these samples, and

16 MICRO CORNUCOPIA, #51, Jan-Feb 1990 By Russ Eberhart and Roy Dobbins 6770 Halfcrown Court Columbia, MD 21044

classifies new examples based on the pat­ be positively or negatively weighted. In­ terns it's learned. formation about the state of a PE passes Neural networks are particularly use­ on to the PE(s) connected to it based on ful for solving problems that use impre­ these weights and the network's transfer cise or fuzzy input patterns. They're par­ function. Neural networks ticularly inappropriate for solving prob­ Neurons in biological neural networks lems requiring precise calculations. You'll typically cycle in about 10-100 millisec­ are particularly probably never successfully balance your onds. The clock frequency in an 80286 or checkbook with one. (Of course your 80386-based is generally useful for solving checkbook might be unbalanceable, any­ 10-30 MHz, which results in a cycle way.) of 0.03-0.10 microseconds. problems that use We broadly characterize NNTs using Even taking into account the number three criteria: of multiply accumulate operations need­ imprecise or fuzzy (1) Network architecture: in general, ed to calculate and propagate a new how slabs (made up of layers) are inter­ value for a PE (typically 10-100), the basic input patterns. connected and how they receive input cycle time for an individual PE is still and output. More on slabs and layers only about 1-10 microseconds, orders of later. For now, look over Figure 1: a typi­ magnitude faster than our brain! But cal NNT feedforward architecture. Feed­ speed is deceiving; our brain processes forward means that the information flow is always in one direction, from input to output, without any feedback. Figure l-Back-propagation Network Structure (2) The type of transfer function we use for processing elements (PEs or nodes or neurodes) in the network. That is, what function describes the output of CONNECTIONS CONNECTIONS an element given its input? (WEIGHTS) (WEIGHTS) (3) The type of learning paradigm we use to train the network. Think of these three criteria (or cate­ gories) as the top level attributes of an NNT. As we'll show you, you can't al­ ways vary these attributes inde­ INPUT 1 OUTPUT 1 pendently. Certain architectures, for ex­ ample, preclude certain learning para­ digms. Neural biological. structure (as we cur­ INPUT 2 OUTPUT 2 rently understand it) and the implemen­ tation or representation of this structure in NNTs differ significantly. Let's face it-the brain is much more complex than anything we can write (yet!). Loosely, we INPUT . OUTPUT say that a processing element (PE) or unit n n I n· n· I in an NNT is roughly analogous to a bio­ I J nl logical neuron. INPUT HIDDEN OUTPUT In a typical NNT, each processing ele­ LAYER LAYER LAYER ment (PE) connects to other processing elements. Each of these connections can

MICRO CORNUCOPIA, #51, Jan-Feb 1990 17 many kinds of information faster. sents the output vector of the output We'll also use three coefficients later: Neural networks are hot, but they're layer. • the learning coefficient, eta (11), far from perfected. At this juncture We often work with a combination of • the momentum factor, alpha (a), several commercial products show pro­ an input vector and its associated output • and the error term, delta (8). mise, but even the best of these will no vector. This combination of an input and Later, we'll describe each of the net­ doubt change (for the better) as we learn its associated output comprises a "pat­ work elements. In Part 2 we'll describe more about our brains and more about tern vector," represented by a "p." the operation and training of the BP net­ computers. We list the input part first, then the work of Figure 1, step by step. Let's ex­ But enough general introduction. Let's output. Typically we divide all our pat­ amine now how we present input to the create an NNT, beginning with a few terns into two categories or sets: a train­ network. definitions for the back-propagation ing set and a testing set. The subscripts model, the architecture we'll use. "r,s" are associated with training and Network Input testing, respectively. On the left of Figure 1, note the inputs The Back-Propagation Model entering the network via the input layer Although a back-propagation neural (a layer of processing nodes). These in­ network model is generally considered a puts can be a set of raw data, a set of good one, it has no "standard" defini­ parameters, or whatever we've chosen to tion. Neural network experts agree Neural networks represent as a pattern. mostly on the algorithms they use to de­ For our BP NNT, the value of each scribe network training and operation, are hot, but they're input can take on any value between a but don't agree how these algorithms and 1. That is, the input values are should be implemented. far from perfected analog and are normalized between the We'll try to simplify our implementa­ values a and 1. The fact that we can use tion by describing the back-propagation even the best of analog inputs adds significant flexibility (BP) model (as we understand it) in some toourNNT. detail. We'll examine each of its elements these will no doubt Does the normalization between a and and describe how these elements com- 1 constrain us in any way? Probably not, bine to form the BP topology. I change ... as we at least not usually. Whenever we deal Figure 1 (remember you looked with a real-life computer system that's re­ before) shows a simple, three-layer, BP learn more about ceiving input, we're always limited to model. some extent by the size of the number we • Each circle represents a pro­ our brains and more can put in. As long as the resolution of cessing element (PE). our input data doesn't get lost in the nor­ • Each arrow represents an inter­ about computers. malization process, we're all right. connection (synapse) and its as­ In our implementation of the BP sociated weight. NNT, we use standard floating point • The PEs with the letter "b" inside So, for example, "pr" is a training pat­ variables, called "float" in C. Floats are are called bias nodes. tern and "ps" is a testing pattern. In both 32 bits long, using 24 bits for a value, and In this article (and our book), sub­ cases, in the representation of the vector 8 bits for an exponent. scripted lower case letters represent the (for example, in the pattern files for the We therefore have a resolution of attributes of individual PEs (nodes) and NNT), the output components follow the about 1 part in 16 million, or, stated of individual connections. input components. another way, resolution to 7 decimal • the letter "i" represents an input, Connection weights require two sub­ places. If your data has 7 significant • "0" represents an output, scripts that represent the sending and re­ figures or less, you'll be okay. We • "w" represents a connection ceiving layers. For example, the weight of haven't found this at all limiting. Even weight, the connection from an input PE to a hid­ input data from a 16-bit analog to digital • "n" represents the number of den PE is "Whi." Note that the receiving (A/D) converter requires a little less than nodes in a layer. PE layer is the first subscript, and the 5 digits of resolution. Most of the appli­ cations we've seen require 3 to 5 digits of • The subscripts "i,j,l" refer to the sending PE layer is the second. While input, hidden, and output layers, this may seem somewhat counter-intui­ resolution. Normalizing our input patterns can respectively. tive to you, it's the generally accepted provide us with a tool for preprocessing (If you use more than one hidden way to represent weights, and corre­ our data in various ways. You can nor­ layer, the subscript "k" represents it.) sponds to the matrix notation which malize the data by considering all the For example, "ii" is the input to an sometimes represent weights. "n" inputs together, normalize each input layer PE, "oj" is the. output of a We represent matrices by bold capital hidden layer PE, and "nt is the number letters. For example, "Wji" represents the channel separately, or normalize groups of channels in some way that makes of PEs in the output layer. matrix of connection weights to the hid­ Bold lower case letters represent vec­ den layer (from the input layer). sense. In some cases, the way you choose to normalize the inputs can affect the tors. For example, "ii" represents the Don't despair (if you're despairing); input vector to the input layer, made up we'll use vectors and matrix notation performance of the NNT, so this is one of all the individual inputs. "01" repre- sparingly. place you can really experiment.

18 MICRO CORNUCOPIA, #51, Jan-Feb 1990 If your inputs all consist of raw data PE in the network of Figure 1 due to one any other node. We'll say more about the points, you'll probably normalize all the single connection is just the output value bias node later. channels together. If the inputs consist of of the input node (the same as the input parameters, you may normalize each of the input node) times the value of the ij= L WjiOj Equation 1 channel separately, or normalize chan­ connection weight. nels that represent similar kinds of para­ The net input to a hidden PE is the meters together. For example, if some of sum of the values for all connections Equation 2 describes the output of a your parameter inputs represent ampli­ coming into the PE, as described in Equa­ hidden node as a function of its net tudes and some represent time intervals, tion 1. Note that this includes the input input. This is the sigmoid function to you might normalize the amplitude from the node we call the "bias node," which we've been referring. The sigmoid channels as a group and the time chan­ which we assume always has an output function is illustrated in Figure 2. nels as a group. of 1, and which we treat otherwise as Text Continued on page 24

Feedforward Calculations Now (assuming we have the input Figure 2-Sigmoid Transfer Function Used in Back-propagation NNT pattern represented by our normalized set of inputs) what happens at the input PE layer? Given that the values are normal­ OUTPUT ized, the input PEs simply split the signal into multiple paths to the hidden layer PEs. In other words, the output of each input layer PE is exactly equal to the input, and is in the range of a to 1. (Another way of looking at the input LARGE NEGATIVE LARGE POSITIVE layer is that it normalizes input. Most NET INPUT NET INPUT . NNT implementations normalize inputs before they're presented to the network.) The input signals are then sent to the PEs of the hidden layer via the connec­ tions from the input layer. A weight is associated with each connection. Note that each PE of the input layer connects to every PE of the hidden layer. Likewise, each PE of the hidden layer Add lightning fast graphics to your programs quickly and connects to every PE of the output layer. easily through the popular PCX file format. Why reinvent the Also note that each connection, and wheel? Make your programs immediately compatible with all data flow, goes from left to right in hundreds of packages from Aldus PageMaker to ZSoft's PC Figure 1. This one-way flow is called "feedforward." There are no feedback Paintbrush with these linkable graphic libraries. loops, even from a unit to itself, in a feed­ "An exceptional product" - Programmer's Journal, Aug forward network. All standard back NEW! Version 3.5 of the PCX Programmer's Toolkit gives you over 60 propagation implementations, including powerful functions to l1Ianipulate bitmapped graphics. Use Virtual screens, our BP NNT, are feedforward. Super VGA modes, LIM 4.0 support, a 300 page manual, 9 utilities including The way the net input to a PE is cal­ screen capture and display, and the fastest routines on the market. $195 culated, and the way the PE calculates its Need Special Effects, but caught in a GRASP? output as a function of its net input, de­ Why create a demo when you can create the real thing? Don't be trapped in pends on the type of transfer function a slides how editor or demo program when you can use PCX Effects for the we're using in the NNT. Our implemen­ PCX Toolkit and your favorite programming language. A Music Language tation (and most BP NNTs today) uses an and spectacular effects for exploding your graphics! $99 additive sigmoid PE. Blazing Graphics Text We'll now show you the mathemati­ With PCX Text you can display text with graphics as fast as it always should cal equations that describe the training have been. Display characters, strings, fixed and proportional text, and testing/running modes of a BP background transparency, and more. Includes a font editor, 85 fonts, and NNT. We won't derive or prove them text utilities for blazing graphics bitmapped text. $149 (sparing you those mathematics), but you All packages support 12 compilers for C, Pascal, Basic, , Assembly, and Clipper. All modes of the Hercules, can find all the proofs you want in CGA, EGA, VGA, and Super VGA adapters are supported, up through 800x600x256 (22 modes in all). Assembly Language Rumelhart and McClelland (V 01. 1). MICROPROGRAMMING source code is optionally available. Trademarks are property Much of what you'll want to know is in of their respective holders. 11315 Meadol'! Lake. Houston. Texas 77077. (713) 870-0737 Chapter 8, the chapter on internal repre­ No Royalties! 30-day Money Back Guarantee. sentations. (See References.) VISAlMC/AMEXICOD/PO accepted. 1-800-227-0918 The signal presented to a hidden layer

MICRO CORNUCOPIA, #51, Jan-Feb 1990 19 Figure 3-BATCHNET.C int p, 1* index pattern number *1 q, 1* index iteration number *1 1* r, 1* index run number *1 Generic back-propagation neural network nPatterns, 1* # of patterns desired *1 (c) i988, 1989 R.W.Dobbins and R.C.Eberhart nInputNodes, 1* # of input nodes *1 All Rights Reserved nHiddenNodes, 1* # of hidden nodes *1 $Revision: 1.1 $ $Date: 21 Sep 1989 11:35:06 $ nOutputNodes, 1*-# of output nodes *1 *1 nIterations, 1* # of iterations desired *1 nRuns; 1* # of runs (or input lines) *1 #include FILE *fpRun, 1* run file *1 #include *fpPattern,l* source pattern input file *1 #include *fpWeights, 1* initial weight file *1 #include *fpWeightsOut,l*final weight output file*1 #include *fpResults, 1* results output file *1 #include *fpError; 1* error output file *1 char szResults[66]; 1* various pathnames *1 #define ESC 27 char szError[66]; #define ERRORLEVEL 0.04 char szPattern[66]; #define ITEMS 8 char szWeights[66]; char szWeightsOut[66]; 1* typedefs & prototypes for dynamic storage ... *1 char *progname = *argv; 1* name of executable typedef float *PFLOAT; 1* ... of arrays *1 DOS 3.x only *1 typedef PFLOAT VECTOR; 1* read optional - arguments *1 typedef PFLOAT *MATRIX; for (; argc > 1; argc--)

void VectorAllocate(VECTOR *vector, int nCols); char *arg = *++argv; void AllocateCols(PFLOAT matrix[], int DRows, int nCols); if (*arg != '-') void MatrixAllocate(MATRIX *pmatrix, int DRows, break; int nCols); switch (*++arg) void MatrixFree(MATRIX matrix, int nRows); case 'e': 1* define storage for net layers *1 sscanf(++arg, "%d", &DReportErrors); 1* Arrays for inputs, outputs, deltas, weight~ & break; targets *1 case 'd': MATRIX outO; 1* input layer *1 sscanf(++arg, "%f", &ErrorLevel); MATRIX out1; 1* hidden layer *1 break; MATRIX delta1; 1* delta at hidden layer *1 default: break; MATRIX delw1; I*change in weights input:hidden*1 MATRIX w1; 1* weights input:hidden *1 MATRIX out2; 1* output layer *1 if (argc < 2) MATRIX delta2; 1* delta at output layer *1 MATRIX delw2;I*change in weights hidden:output*1 fprintf(stderr, "Usage: %s {-en -df}\ MATRIX w2; 1* weights hidden:output *1 runfilename\n" , progname) ; MATRIX target; 1* target output *1 fprintf (stderr," -en => report \ VECTOR PatternID; 1* ID for each pattern *1 error every n iterations\n"); fprintf(stderr," -df => done if\ void main(int argc, char *argv[]) sum squared error < f\n"); exit(l); float eta = 0.15, 1* default learning rate *1 alpha=O.075; /*default momentum factor*1 1* Open run file for reading *1 int nReportErrors=100; I*err report frequency*1 if «fpRun = fopen(*argv, "r"» NULL) float ErrorLevel=ERRORLEVEL; I*OK error level*1 char MonitorError=O; I*true=mon. err display*1 fprintf(stderr, "%s: can't open file %s\n", float error; 1* latest sum squared error val *1 progname, *argv); register int h; 1* index hidden layer *1 exit (1) ; register int i; 1* index input layer *1 register int j; 1* index output layer *1 I*Read line 1: (lines to read' from run file)*1

20 MICRO CORNUCOPIA, #51, Jan-Feb 1990 fscanf (fpRun, "%d", &nRuns);

1* beginning of work loop *1 The $25 for (r = 0; r < nRuns; r++)

1* read and parse run specification line; *1 Network fscanf (fpRun, "%s %s %s %s %s %d %d %d %d %d %f %f", szResults, 1* output results file *1 Try the 1st truly low cost LAN szError, 1* error output file *1 • Connect 2 or 3 PCs, XTs, ATs szPattern, 1* pattern input file *1 • Uses serial ports and 5 wire cable szWeights, 1* initial weights file *1 szWeightsOut, I*final weights out file*1 • Runs at 115 K baud &nPatterns, 1* # patterns to learn *1 • Runs in background, totally transparent &nlterations, 1* # its through data *1 • Share any device, any file &nlnputNodes, 1* # input nodes *1 • Needs only 14K of ram &nHiddenNodes, 1* # hidden nodes *1 &nOutputNodes, 1* # output nodes *1 Skeptical? We make believers! &eta, 1* learning rate *1 &alpha); 1* momentum factor *1 1* allocate dynamic storage for all data *1 Ovet 15.000 ~JJ ~ MatrixAllocate(&outO,nPatterns,nlnputNodes); MatrixAllocate (&outl, nPatterns, Information Modes nHiddenNodes) ; .. ~ ~ mP.O. Drawer F MatrixAllocate(&out2,nPatterns, I 0 I e Denton, TX 76202 nOutputNodes); "'-_____~;;..! 817-387-3339 MatrixAllocate (&delta2, nPatterns, nOutputNodes); Why waste money on simple file transfer systems? MatrixAllocate(&delw2,nOutputNodes, Reader Service Number 149 nHiddenNodes + 1); MatrixAllocate (&w2, nOutputNodes, nHiddenNodes + 1); INGRAF 2.10 MatrixAllocate (&delta1, nPatterns, A multi-device graphics library for Scientific, nHiddenNodes) ; Engineering, and Business users! S~pports video, MatrixAllocate(&delw1,nHiddenNodes, printer, and plotter graphics for personal computers. nlnputNodes + 1); Over 100 routines to create bar. pie. and smith charts; linear. log MatrixAllocate (&w1, nHiddenNodes, (semi-log and log-log). and polar plots; axes and grids with tick malks and labels. matken. line types. curves. arcs. circles. ellipses. nlnputNodes + 1); and more. (EuU 'oure' cod,: no wallkl or run-tim' (UII) MatrixAllocate(&target,nPatterns, The window function allows you to use up to 32 windows. You nOutputNodes) ; can set individual characteristics (such as sizing. scaling. labeling. VectorAl1ocate(&PatternID, nPatterns); etc.) for each window or identical characteristics for all windows.

1* Read the initial weight matrices: *1 INoue T I VE REACT "NeE TEMP. 8. RAINFALL Of" HOUSTON AREA if «fpWeights=fopen(szWeights, "r") )==NULL) ~D ~D

fprintf(stderr, "%s: can't open %s\n", progname, szWeights); exit (1);

1* read input:hidden weights *1 for (h = 0; h < nHiddenNodes; h++) l5.D D.D for (i = 0; i <= nlnputNodes; i++) JAN FEB MR N'R MAY JIM J(1. Al£ SE:P OCT NOV II:C C .... PACITIVE REACTANCE 1984

fscanf(fpWeights, "%f", &w1[h][i]); INGRAF is available for C. FORTRAN-77. and QuickBASIC delw1[h] [i] = 0.0; (pascal available soon); support for numerous compilers. We also have GRAFLIB 4.10 for video and printer graphics; 1* read hidden:out weights *1 PLOTLIB 4.10 for pen plotter graphics. and a FOR'IRAN enhancement library. for (j = 0; j < nOutputNodes; j++) FORTLIB 4.05. for (h = 0; h <= nHiddenNodes; h++) Sutrasoft P.O. Box 1733 • Sugar Land, TX • 77487 Continued on page 22 Order Line: 1·800·888·8460 All other calls: 713 491·2088 Reader Service Number 173 MICRO CORNUCOPIA, #51, Jan-Feb 1990 21 Continued from page 20

fscanf(fpWeights, "%f", &w2[j][h]); for (j = 0; j < nOutputNodes; j++) delw2[j] [h] = 0.0; float sum = w2[j] [nHiddenNodes]; fclose(fpWeights); for (h = 0; h < nHiddenNodes; h++) 1* Read in all patterns to be learned: *1 sum += w2[j][h] * out1[p] [h]; if « fpPattern=fopen (szPattern, "r"» -NULL) out2[p][j] = 1.0/(1.0 + exp(-sum»;

fprintf(stderr, "%s: can't open %s\n", I*delta 9utPut-Compute deltas for each progname, sZPattern); output unit for a given pattern *1 exit (1); for (j = 0; j < nOutputNodes; j++) delta2[p][j] = (target[p][j] - for (p = 0; p < nPatterns; p++) out2[p] [j]) * out2[p][j] * (1.0 - { out2 [p] [j]); for (i = 0; i < nlnputNodes; i++) 1* delta hidden *1 if (fscanf (fpPattern, "%f", for (h = 0; h < nHiddenNodes; h++) &outO [p] [i]) != 1) goto ALLPATTERNSREAD; float sum = 0.0; I*read target output for input patterns*1 for (j = 0; j < nOutputNodes; j++) for (j = 0; j < nOutputNodes; j++) sum += delta2[p] [j] * w2[j] [h]; fscanf(fpPattern, "%f",&target[p] [j]); delta1[p] [h] = sum * out1[p] [h] * 1* read in identifier for each pattern *1 (1.0 - out1 [p] [h]) ; fscanf(fpPattern, "%f ", &PatternID[p]);

ALLPATTERNSREAD: 1* adapt weights hidden:output *1 fclose(fpPattern); for (j = 0; < nOutputNodes; j++) if (p < nPatterns) float dw; 1* delta weight *1 fprintf (stderr, "%s : %d out of %d patterns \ float sum = 0.0; read\n", proqname, p, nPatterns); 1* grand sum of deltas for each output nPatterns = p; node for 1 epoch*1 for (p = 0; P < nPatterns; p++) 1* open error output file *1 sum += delta2[p] [j]; if «fpError = fopen (szError, "w"» == NULL) I*find new bias for each output unit*1 dw = eta * sum+alpha * fprintf(stderr, "%.s :can't open file %s\n", delw2[j] [nHiddenNodes]; progname, szError); w2[j] [nHiddenNodes] += dw; exit (1); delw2[j] [nHiddenNodes] = dw; 1* Calculate new weights *1 fprintf(stderr,nlterations>l?"Training .. \n" for (h = 0; h < nHiddenNodes; h++) :"Testing\n"); 1* begin iteration loop *1 float sum = 0.0; for (q = 0; q < nlterations; q++) for (p = 0; p < nPatterns; p++) { sum += delta2[p] [j]*out1[p] [h]; for (p = 0; p < nPatterns; p++) dw = eta * sum+alpha * delw2[j] [h]; w2[j] [h] += dw; 1* hidden layer - Sum input to hidden delw2[j] [h] dw; layer over all input-weight cmbnatns*1 for (h = 0; h < nHiddenNodes; h++) 1* adapt weights input:hidden *1 1* begin with bias *1 for (h = 0; h < nHiddenNodes; h++) float sum = w1[h] [nlnputNodes]; for (i = 0; i < nlnputNodes; i++) float dw; 1* delta weight *1 sum += w1[h][i] * outO[p] [i]; float sum = 0.0; 1* Compute output (use sigmoid) *1 for (p = 0; p < nPatterns; P++) out1[p] [h] = 1.0/(1.0 + exp(-sum»; sum += delta1[p] [h]; I*find bias weight for hidden units*1 dw = eta * sum + alpha * 1* output layer *1 delw1[h] [nlnputNodes];

22 MICRO CORNUCOPIA, #51, Jan-Feb 1990 wl[h] [nInputNodes] += dw; error /= nPatterns; delwl[h] [nInputNodes] = dw; /* Print final it number and error value */ /* Calculate new weights */ fprintf(stderr, "Iteration %5d/%-5d Error \ for (i = 0; i < nInputNodes; i++) %f\n", q,nIterations,error); /*CON*/ fprintf(fpError,"\n%d %f\n",q,error); /*fp*/ float sum = 0.0; fclose(fpError) ; for (p = 0; p < nPatterns; p++) /* print final weights */ sum += deltal[p] [h]*outO[p] [i]; if «fpWeightsOut = fopen (szWeightsOut, "w"» dw = eta * sum + alpha*delwl[h] [i]; = NULL) wl[h][i] += dw; delwl[h] [i] dw; fprintf(stderr, "%s: can't write %s\n", progname, szWeightsOut); exit(l); /* monitor keyboard requests */ if (kbhit () for (h = 0; h < nHiddenNodes; h++) for (i = 0; i <= nInputNodes; i++) int c = getch(); fprintf(fpWeightsOut, "%g%c",wl[h] [i], if «c = toupper(c» 'E' ) i%ITEMS=ITEMS-l? '\n':' '); MonitorError++; for (j = 0; j < nOutputNodes; j++) else if (c == ESC) for (h = 0; h <= nHiddenNodes; h++) break; /* End gracefully */ fprintf(fpweightsOut, "%g%c",w2[j] [h], j%ITEMS=ITEMS-l? '\n':' '); /* Sum Squared Error */ fclose(fpWeightsOut); if (MonitorError I I (q%nReportErrors=O» /* Print final activation values */ if «fpResults=fopen (szResults, "w") ) ==NULL) for (p=0, error=O.O; p

/* Array storage allocation routines */ /* Average error over all patterns */ /* Allocate space for vector of float cells for Continued on page 24

MICRO CORNUCOPIA, #51, Jan-Feb 1990 23 1 0'=---- Equation 2 Continued from page 23 J 1 + exp(-ij) one dimensional dynamic vector[cols] */ As you can see in Figure 2, the output, void Vector~locate(VECTOR *vector, int nCols) after going through the sigmoid function (also called a squashing function), is if «*vector = (VECTOR) calloc(nCols, limited to values between 0 and 1. At a sizeof(float») == NULL) net input of 0 to the PE, the output is 0.5. For large negative net input values, the fprintf(stderr, "Not enough memory\n"); output of the PE· approaches O. For large exit(l); positive values, it approaches 1. The nonlinear nature of this sigmoid transfer function plays an important role /* ~locate space for columns (float cells) for in the performance of the neural net­ dynamic two dimensional matrix [rows] [cols] */ work. We can use other transfer func­ void AllocateCols(PFLOAT matrix[], int nRows, int nCols) tions, as long as they're continuous and possess a derivative at all points. int i; Functions such as the trigonometric sine and the hyperbolic tangent have for (i = 0; i < nRows; i++) been used, but the exploration of these VectorAllocate(&matrix[i], nCols); and other transfer functions is beyond the scope of this article. For more infor­ /* ~locate space for 2D dynamic matrix */ mation, refer to Rumelhart and McClel­ void Matri~locate(MATRIX *pmatrix, int nRows, land, and McClelland and Rumelhart. int nCols) Once Equation 2 calculates the output of each hidden layer PE, the net input to if (*pmatrix (MATRIX) calloc(nRows, each output layer PE is calculated in a sizeof(PFLOAT) » == NULL) manner analogous to that used for calcu­ lating the net input for each hidden PE, fprintf(stderr, "Not enough memory\n"); as described by Equation 3. Likewise, the exit(l); output of each output layer PE is calcu­ lated in the same way as for the outputs ~locateCols(*pmatrix, nRows, nCols); of the hidden layer PEs, as described by Equation 4. /* free space for two dimensional dynamic array */ void MatrixFree(MATRIX matrix, int nRows) iI =L W1jOj Equation 3 int i; j

1 for (i = 0; i < nRows; i++) 01=----- Equation 4 1 +exp(-lI) free(matrix[i]); free (matrix) ; This set of calculations, which results in the output state of the network (or simply the set of the output states of all • • • the output PEs), is carried out the same way during the training phase as during the testing/running phase. The test/run operational mode just involves pre­ or the ratio of the change in output for a download the complete system from the senting an input set to the input nodes given change in input. Micro C BBS (or order the issue #51 disk and calculating the resulting output state. As you can see, the slope of the func­ for $6, add $2 postage for foreign orders) To summarize, during the feedfor­ tion (gain of the amplifier) is greatest for and start exploring this amazing tech­ ward calculations, two math operations net inputs near zero. This serves to miti­ nology. are performed by PEes). The output state, gate problems caused by noise, and by If you want to really get into neural or activation, is obtained as a result. The the possible dominating effects of large networks, a great place to start is Vol. I of first is a summation of previous layer PE input signals. Parallel Distributed Processing by Rumel­ outputs times interconnecting weights, The code in Figure 3, Batchnet.c hart and McClelland. You'll probably and the second is the squashing function. completely implements our NNT. come away with a good understanding We can view the squashing function of back propagation networks if you read (illustrated in Figure 2) as a function sim­ Parf2 Chapters 1 through 4 and Chapter 8. Be ilar to an analog electronics amplifier. Next issue (Part 2) we'll train the net­ prepared to read Chapter 8 at least twice. The gain, or amplification, of the ampli­ work (by error back propagation) and Also consider attending conferences fier is analogous to the slope of the line, show you how to use it. Meanwhile, or symposia on neural networks. The

24 MICRO CORNUCOPIA, #51, Jan-Feb 1990 International Joint Conferences on Neural REFURBISHED SEAGATE HARD DRIVES Networks (IJCNN), sponsored jointly by the Institute of Electrical & Electronics ST-125 20 Meg MFM 28MS $175.00 Engineers (IEEE), Neural Network Com­ ST-125N 20 Meg SCSI 28MS $230.00 mittee (NNC), and the International ST-138 30 Meg MFM 28MS $215.00 Neural Network Society (INNS). The ST-138R 32 Meg RLL 40MS $195.00 societies alternate in terms of which one ST-138N 32 Meg SCSI 40MS $235.00 is lead society. For the time being, the INNS is lead in the Winter, IEEE NNC in ST-15l 40 Meg MFM 40MS $315.00 summer. ST-157N 49 Meg SCSI 40MS $275.00 The Winter 1990 IJCNN will be held ST-157R 50 Meg RLL 40MS $240.00 in Washington, D. c., January 15-19, ST-225 20 Meg MFM 65MS $160.00 1990. For more information, contact ST-225N 21 Meg SCSI 65MS $200.00 Deverman & Assoc., 4233 Spring Street ST-225R 20 Meg RLL 65MS $150.00 #99, La Mesa, CA 92041, phone (619) 462- ST-238R 30 Meg RLL 65MS $165.00 6800. ST-250R 40 Meg RLL 70MS $190.00 A smaller conference, but one of very ST-25l-0 40 Meg MFM 40MS $250.00 high quality, is the Neural Information ST-25l-1 40 Meg MFM 28MS $270.00 Processing Systems (NIPS) meeting, al­ ST-25lN 40 SCSI 40MS $290.00 ways held in Denver. This year, it will be Meg held November 28 - December 2 at the ST-277R 65 Meg RLL 40MS $280.00 Sheraton Denver Tech Center. ST-277N 65 Meg SCSI 40MS $325.00 For more information, contact Kathy ST-277R-l 65 Meg RLL 28MS $320.00 Hibbard, NIPS89 Local Committee, Univ. ST-296N 85 Meg SCSI 28MS $380.00 of Colorado, Engineering Center, Cam­ ST-4053 40 Meg MFM 28MS $310.00 pus Box 425, Boulder, CO 80309-0425, ST-4096 80 Meg MFM 28MS $440.00 phone (303) 492-4720. To give you an ST-4l44R 120 Meg RLL 28MS $510.00 idea of 'the selectivity of this conference, this year over 500 papers were sub­ Listed above are refurbished SEAGATE mitted; fewer than 100 will be accepted hard drives. Warranty on these units for oral or poster presentation. is 90 DAYS or the remainder of the References factory warranty, whichever is greater Anderson, J. A. and E. Rosenfeld, Most drives have six (6) months plus Eds., Neurocomputing: Foundations of Re­ remaining warranty search. MIT Press, Cambridge, Mass., 1988, ISBN 0-262-01097-6, $39.95. FOR ONE YEAR WARRANTY ADD $45.00 EACH McClelland, J. 1. and D. E. Rumelhart, Parallel Distributed Processing, Vol. 2. MIT THE ABOVE DRIVES SUBJECT TO STOCK Press, Cambridge, Mass., 1986, ISBN 0- 262-13218-4, $16.75 paperback. ALL SALES FINAL ON REFURBISHED DRIVES McClelland, J. L. and D. E. Rumelhart, Explorations in Parallel Distributed Pro­ cessing. MIT Press, Cambridge, Mass., Controllers and cables in stock 1988, ISBN 0-262-63113-X, $27.00 paper­ Please call for current price. back (with software diskettes). , Rumelhart, D. E. and J. 1. McClelland, ********** 2400 BAUD MODEM ************** Parallel Distributed Processing, Vol. 1. MIT by Computer Peripherals Press, Cambridge, Mass., 1986, ISBN 0- 2400 Baud Internal and Software $85.00 262-18120-7, $16.95 paperback. 2400 Baud Enternal and Software $140.00 Stubbs, D. "Neurocomputers." M.D. Computing, 5(3):14-24 (1988). CASCADE ELECTRONICS, INC. ROUTE 1 BOX 8 • • • RANDOLPH, MN 55065 507-645-7997

Please ADD shipping on all Orders COD Add $3.00 Credit Card ADD 5% MN Add 6% Sales Tax Subject to change

Reader Service Number 15 MICRO CORNUCOPIA, #51, Jan-Feb 1990 25 3D-Surface Generation An In-Depth Look At Graphics, Part 2

On To Printer Graphics dismemO - De-allocates bit map array Okay, now that we have the theory, it's Module grafprt contains an assort­ space. time to dissect the code. This time Greg ex­ ment of functions to perform high-resolu­ psetO - Plots a point in the bit map. plains the gnits and the grits. tion plotting on IBM Graphics Printers plankO - Blanks point in the bit map. and compatibles such as Epson FX and prntgrO - Sends the graphics page (bit LX printers. The basic idea is to use the map) to the printer. mentioned last issue that the z values ESC L command to turn on low-speed iprtlnO - Draws a line in device in­ for a 3D plot must be stored in a double density graphics mode for an 8" teger coordinates. Imatrix declared as float **z. alloc-2d- line with 960 dots. You can obtain a verti­ frameO - Draws a boundary around arrayO handles the dynamic allocation cal resolution of 1600 dots by using the the maximum (8" by 10 5/8") plotting re­ used in both surfaceO and in the demo ESC 3 command to select n;216 line spac­ gion. program. The method permits the dy­ ing. frarnxyO - Draws a boundary around namic allocation of very large arrays, of The bit map is stored in two 2-dimen­ the plot window defined by defregO. any type, not limited to what will fit in sional arrays dynamically allocated using transfO - Transforms real (x,y) to in­ a 64K segment. Editor's note: Greg's code alloc_2d_arrayO with MAXCOLS (1600) teger world (ix,iy) coordinates. was too big to include this time. Take a look columns and MAXPRINTROWS (100) itransfO - Transforms integer world for it on the Micro eBBS or the Issue #51 rows of type unsigned char **. (ix,iy) to plot device integer (dx,dy) listings disk. (If you got last issue's listings, The two arrays, Evenrow and Od­ coordinates. you already have the complete 3D package.) drow, interlace such that, when printing defregO - Defines the correspondence Since the tighter the grid mesh, the the bit map, one even row prints, the line between integer and real worlds. nicer the result, I recommend this spacing sets to 1;216", an odd row prints, prtlinO - Draws a line specified in real method for allocating z. For smaller ar­ the line spacing sets to ~216", then the world coordinates. rays there are better methods. Reference 1 next even row prints. contains an excellent discussion of these prntgrO prints by looping through the Printer Graphics String Routines topics. entire process MAXPRINTROWS times, Just to provide a complete set of tools, surfaceO also expects you to supply a yielding 1600 vertical dots in 10 5/8". Ref­ module grafstr contains routines that line function. Now that I have Turbo C erence 2 outlines this interlacing method. work with module grafprt to let you 2.0 instead of 1.0, the new line function It is also where I obtained Professor print scalable, rotatable, justifiable (left, lacks the "color" argument. It uses a sep­ Rasala's Bresenham line implementation. right, and center) graphics strings. arate function to set the line color. You This achieves a 120 dots per inch density Again, I think the code is adequately could kludge your own function to pass across the width of the page, and 160 documented internally, so I will just list to surfaceO, using Turbo's and set­ dots per inch down the length of the the functions in module grafstr. colorO, but it would be better to modify page. aspect_and_rotateO - Performs aspect the printer graphics modules and threed I also derived the point setting and ratio correction and rotations for strings. module to make my line function com­ blanking routines from Reference 2, so far Used only by intprntstrO. patible with Turbo's. as concerns the interlacing. swapmodeO - Swaps between portrait The hmax parameter passed to sur­ There is no need to discuss the rest of and landscape modes by exchanging faceO must always be MAXROWS-1 or the code, as it is sufficiently documented global variables declared in module 1599 (as currently configured) whether internally. A brief description of the func­ grafprt. Used by intprntstrO and prtstrO. you use Portrait or Landscape mode (for tions in module grafprt should suffice. intprntstrO - Prints a string at (ix,iy) in printers). For CRT plots, it should be the portraitO - Sets a global variable to in­ integer world coordinates. maximum y value for the current dicate Portrait mode plotting. prtstrO - Prints a string at (x,y) in real graphics mode. You can obtain this value landscapeO - Sets a global variable to world coordinates. via a call to Turbo's getmaxyO. indicate Landscape mode plotting. Module grafstr contains the character Finally, graphics programs tend to use initgrafprtO - Allocates arrays for the font description, and the comments in­ a lot of memory, so I used the large code bit map from the heap and initializes clude a complete description of how· it model for all the source code. some global variables. works.

26 MICRO CORNUCOPIA, #51, Jan-Feb 1990 By Gregory K. Landheim 132 Greene St. North Andover, MA 01845

Now For The Fun Part on the printer (in both Portrait and Land­ surface is produced in real time (after the A demo program, test3d, demon­ scape modes). This page shows an ex­ Mandelbrot values are produced). strates the use of the above described ample of the printer output. modules. Since we all like the Mandel­ Generating printer graphics on a tight Another Idea brot set so much, it plots surfaces pro­ grid, say nx = 100 and ny = 100, takes a Those of you with high-resolution, duced by the Mandelbrot generator pub­ lot of time. But you can get away with a many colored CRT displays could try lished on page 8 of Micro Cornucopia #39, small number of iterations and still inves­ modifying the surface program so it fills Jan.-Feb: 1988. It has been modified to be tigate a lot of interesting terrain. Use the the quadrangles with colors that corre­ consistent with the requirements of sur­ CRT mode to look around at likely re­ spond to the average height of the quad­ faceO. gions of the set in coarse resolution, then rangle. One important modification is scaling use the printer mode to make pretty pic­ But then enough's enough. It's de­ in the z direction. I didn't go through a tures. finitely time to scout out some more beer. detailed description of Cartesian I developed this software on a Lead­ geometry just for fun, you know. Carte­ ing Edge Model D running at 4.77 MHz. References sian implies the scales are the same in the I find the time performance acceptable at (1) Advanced C Tips and Techniques, Paul x, y, and z directions. Before you pass a this lowest possible denominator in the Anderson and Gail Anderson, Howard surface to surfaceO, you should scale the IBM PC world. At least, I keep telling w. Sams & Co., 1988. z values. myself it's acceptable. A spqre 4 or 5 (2)''High-Resolution Printer Graphics," Scaling according to the larger of the grand would change my mind real fast. Mark Bridger and Mark Goresky, BYTE, two distances Xmax - Xmin and ymax - ymin On my clunky Leading Edge, I can November, 1985, pp. 219-232. usually works well. For the Mandelbrot produce a 100 by -100 resolution surface, (3) "The Painter's Algorithm," Richard generator, imagine how silly your surface including the generation of the Mandel­ Chandler and Gary Faulkner, PC Tech would look if your x range was 0.02, brot values and the printout, in less than Journal, November, 1985, pp. 181-187. your y range 0.25, and your z range was an hour. The surface generation into a 500. printer bit map takes about 16 minutes at test3d allows plotting on the CRT or that resolution. On a CRT display the • • • MICRO CORNUCOPIA, #51, Jan-Feb 1990 27 The Poet And The Computer Stirring A Little Conscience Into The Data

purely contemporary. The result is a has always been. That problem is not In our quest for ever greater quantities of mechanization not just of the way we live solely how to be more productive, more information and ever more sophisticated but of the way we think, and of the comfortable, more content, but how to be methods of manipulating, verifying, and dis­ human spirit itself. more sensitive, more sensible, more pro­ playing it, we risk forgetting something The delegates to the United States portionate, more alive. The computer very important. Constitutional Convention were able to makes possible a phenomenal leap in undergird their arguments with allusions human proficiency; it demolishes the to historical situations and to the ideas of fences around the practical and even the Poet, said Aristotle, has the philosophers, essayists, and dramatists. theoreticc.tl intelligence. But the question advantage of expressing the uni­ Names such as Thucydides, Aristotle, persists and indeed grows whether the Aversal; the technician or specialist Herodotus, Plutarch, or Seneca were computer makes it easier or harder for expresses only the particular. The poet commonly cited to support their posi­ human beings to know who they really moreover, can remind us that man's tions. They alluded to fictional characters are, to identify their real problem, to re­ greatest energy comes not from his dy­ from Aristophanes, Marlowe, or spond more fully to beauty, to place ade­ namos but from his dreams. The notion Shakespeare to lend color to the explora­ quate value on life, and to make their of where a man ought to be instead of tion of ideas. Analytical essays by Hamil­ world safer than it now is. where he is; the liberation from ton, Madison, and Jay that appeared in Electronic brains can reduce the profu­ cramped prospects; the intimations of The Federalist Papers were an excursion sion of dead ends involved in vital re­ immortality through art-all these into the remote comers of history. search. But they can't eliminate the fool­ proceed naturally out of dreams. But the Men such as Jefferson, Adams, Fran­ ishness and decay that come from the un­ quality of man's dreams can only. be a klin, and Rush could summon pertinent examined life. Nor do they connect a reflection of his subconscious. What he quotations from Suetonius or Machiavelli man to the. things he has to be connected puts into his subconscious, therefore, is or Montaigne to illustrate a principle. If to: the reality of pain in others; the possi­ quite literally the most important nour­ they referred to Bacon's opinion of Aris­ bilities of creative growth in himself; the ishment in the world. totle, they didn't have to cite particulars; memory of the race; and the rights of the Nothing really happens to a man ex­ they assumed such details were common next generation. cept as it is registered in the subcon­ knowledge. Their allusions were not the The reason these matters are impor­ scious. This is where event and feeling product of intellectual ostentation or or­ tant in a computerized age is that there become memory and where the proof of namentation but the natural condiments may be a tendency to mistake data for life is stored. The poet-I use the tenn to of discourse, bringing out the full flavor wisdom, just as there has always been a include all those who have respect for of the cultivated intelligence. tendency to confuse logic with values, and speak to the human spirit-can help The same was true of correspondence. and intelligence with insight. Unob­ supply the subconscious with material to People regarded letters as an art fonn structed access to facts can produce un­ enhance its sensitivity, thus safeguarding and a highly satisfying way of engaging limited good only if it is matched by the it. The poet, too, can help keep man from in civilized exchange. The correspon­ desire and ability to find out what they making himself over in the image of his dence of Jefferson and Adams and Priest­ mean and where they would lead. electronic marvels. The danger is not so ley was not so much a display of per­ Facts are terrible things if left sprawl­ much that man will be controlled by the sonal matters as a review of the human ing and unattended. They are too easily computer as that he may imitate it. condition. It was not unusual for the regarded as evaluated certainties rather There once was a time, in the history writers to range across the entire arena of than as the rawest of raw materials cry­ of this society, when the ability of people human thought as a way of sharing per­ ing to be processed into the texture of to convey meaning was enriched by their ceptions. Allusion was common currency. logic. It requires a very unusual mind, knowledge of and access to the work of Today, we rarely tum to letters as a way Whitehead said, to undertake the analy­ creative minds from across the centuries. of embarking on voyages of intellectual sis of a fact. The computer can provide a No more. Conversation and letters today, discovery. correct number, but it may be an ir­ like education, have become enfeebled by The essential problem of man in a relevant: number until judgment is pro­ emphasis on the functional and the computerized age remains the same as it nounced.

28 MICRO CORNUCOPIA, #51, Jan-Feb 1990 By Norman Cousins Dean's Office - School of Medicine 12-138 CHS - V.CL.A. Los Angeles, CA 90024 (213) 825-8281

To the extent, then, that man fails to make the distinction between the inter­ mediate operations of electronic intel­ ligence and the ultimate responsibilities of human decision and conscience, the computer could obscure man's aware­ ness of the need to come to terms with himself. It may foster the illusion that he is asking fundamental questions when actually he is asking only functional ones. It may be regarded as a substitute for intelligence instead of an extension of it. It may promote undue confidence in concrete answers. "If we begin with cer­ tainties," Bacon said, "we shall end in doubts; but if we begin with doubts, and we are patient with them, we shall end in certainties." The computer knows how to van­ quish error, but before we lose ourselves in celebration of victory, we might reflect on the great advances in the human sit­ uation that have come about because men were challenged by error and would not stop thinking and probing until they found better approaches for dealing with it. "Give me a good fruitful error, full of seeds, bursting with its own corrections," Ferris Greeslet wrote. "You can keep your sterile truth for yourself." Without taking anything away from the technicians, it might be fruitful to ef­ fect some sort of junction between the computer technologist and the poet. A 1e question persists and indeed grows genuine purpose may be served by turn­ ing loose the wonders of the creative im­ whether the computer makes it easier or agination on the kinds of problems being put to electronic tubes and transistors. harder for human beings to know who they The company of poets may enable the men who tend the machines to see a really are, to identify their real problems, to larger panorama of possibilities than technology alone may inspire. respond more fully to beauty, to place Poets remind men of their uniqueness. It is not necessary to possess the ultimate adequate value on life, and to make their definition of this uniqueness. Even to speculate on it is a gain. world safer than it now is. • • • MICRO CORNUCOPIA, #51, Jan-Feb 1990 29 By Bob Nansel 816 North 105th St. Seattle, W A 98133 LIMBO, Part Four LIMBO Gets A Body

and low cost. STD is traditionally an 8-bit This time, ladies and gents, you'll watch bus, but a compatible high performance as LIMBO gets a body (weird but true, se­ 32-bit standard has just been introduced, rialfans). This is all in preparation for next so there's plenty of room to grow. time, when Igor (I mean LIMBO) gets a Above the card cage the middle disk, brain. Stay tuned, this melodrama only gets X-dividers, and top disk make up the op­ better. tical sensor platform. The X-dividers divide the platform into four sensor bays-facing front, rear, left, and right. o describe the superstructure, I'll Each bay shields its optical emitter / sen­ start at the bottom and work my sor arrays from ambient light and from Tway up. At the bottom of any adjacent emitter/sensor arrays. good robot are the batteries. Mounting batteries on a robot requires a little fore­ Making The Superstructure thought. First, you must consider the Tools: Machinist compass, straight­ weight distribution. edge, try square, band saw or coping Ba tteries are typically the heaviest part saw, brad point drill bits, spade bits, of any mobile 'bot. Place the mass too countersink, jack plane, marking gage. high, and it'll be top heavy; place it too Materials: far from center line, and your unit 2 pieces plywood lf4"x24"x24" (both sides wobbles and doesn't have much traction. good), Try to keep two-thirds of the robot mass 1 piece clear hemlock moulding concentrated in the lower third of the ma­ the base to the stepper driver boards or 1;2"X5/S"x72" , chine, distributed as closely and evenly the controller cards. 4 plastic Trapez fittings, about the center line as possible. The card cage provides slots for five 41" steel right angle braces, Also think about the battery's environ­ SID bus cards. The SID standard speci­ 10 nylon card guides, ment. No matter what the manufacturer fies a minimum card-to-card spacing of 32 #6x5/s" flathead phillips woodscrews, says, you can usually expect a small 0.5", but I chose 1.2" so I could use wire­ 32 #6-32x3/s" flathead phillips machine amount of leakage from gelled-electrolyte wrapped boards. Above the card cage is screws, cells, especially if they're not vertical. a 1;2" airspace between the top cross 4 #10-32x3/4" flathead machine screws, Robotics slang for this leakage is "The panel and the middle disk. Use this space 8 #6-32x3/s" aluminum standoffs, Ooze" or "Battery Ick." Robots tend to (it provides clearance for the STD card 4 #1O-32xlJ4" Tee-nuts, work batteries hard, too, causing'the bat­ ejectors) to route wires between LIMBO's 24 #6-32xlf4" Tee-nuts, teries to heat up-more ooze. front and rear sections. 1 oz. 5-minute epoxy So leave some space around the bat­ Why STD? Indeed, why a bus at all? teries and, because of the hydrogen gas, For those of you who experienced the Step 1: Fabricating The Pieces make sure the space is well vented. Cool early closed architecture "Data Appli­ With the machinist compass, layout batteries last longer. ance" days of the , the answer three 11" diameter disks on the better of LIMBO will run on either one or two should be clear: a bus is the best way to the two squares of plywood. (See Figure of the Panasonic batteries mentioned in overcome the designer's lack of clairvoy­ 1.) Try to get plywood squares with as the second article. To keep the center of ance. Where technology marches, LIMBO little warp as possible. Noting the grain gravity low, both batteries lie flat in the will follow. directions on the disk layout diagram, lay bottom of the superstructure. SID is the quiet bus. Not flashy like out perpendicular diameters and label Wooden cleats that hold the super­ VME, or superfast like Futurebus, STD is bottom, middle, and top disks as shown. structure together provide 1;2" of air nonetheless the bus of choice for in­ Layout all straight lines by lightly above and below the batteries. These dustrial control applications. The small (and precisely) scoring the plywood sur­ spaces are great for routing wires from form factor (4"x6.5") means ruggedness faces with a hobby knife. Sometimes lines

30 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 TOP DISK NOTE 1: These holes should line up with Trapez flttlng screws on the middle disk. The holes allow screwdriver access. NOTE 2: Dashed lines show placement of X-divider panels on the underside of the top disk.

I 1II. I Il.1" I I 2 11/1;r-I 2 11/1&- -W IIII , . 1mJ.' I 3/16- x.. I I I I I SIDE PANEl. JI or I 1 1/4· Il I SlIFnNER (f=_" NOTE 2~DIAIL + -~l \ I~ POSIllON__ 1 ___ _ ~:m/32" 2'J/32" U"7 r------1 C· or RAIl. I r 12 1/4- Ii 8-r~11 I t4- 2 11/1"- T 2 11/1"- III I I ~4- I I 1111 I IT II I L I il J I

MIDDLE DISK BOTTOM DISK NOTE 1: 45· dashed lines show placement of X-divider NOTE 1: Drill c!c countersink from the bottom side of panels on the top side of the disk. the disk. See text for exact drnllng sequence. NOTE 2: Dashed lines show placement of cleats c!c NOTE 2: Clearance arc for 10-32 wing nut. panels on the bottom side of the disk. NOTE 3: Dashed lines show placement of cleats and See Bottom DIsk layout for dimensions. panels on the top side of the disk. NOTE 3: Drill c!c countersink from the top side of the NOTE 4: Material Is 1/4- plywood. disk. See placement dimensions from the Bottom Disk la>'Out. NOTE 4: Hatched areas show placement of Trapez flttlngs. See text for mounting detans.

Figure l-Plywood Disk Layouts

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 31 with the grain tend to disappear, so mark 3116" dia. mounting holes and the 1 1f4" help prevent comer splitting. Precutting them with a pencil, too. Don't be afraid dia. wire access hole in the bottom disk. the comers with a hobby knife helps, too. to put too many labels on the wood; Drill the screwdriver access holes in the Take an equal number of strokes from you're building a robot, not a piece of top disk. Use a brad-point drill for the each direction, letting the plane do the furniture. Cut out the disks and sand to smaller holes to get clean cuts. work. You should need fewer than ten final dimension. On the remaining plywood square, strokes to make the edge true and Transfer the diameter lines to the op­ layout the side panels, stiffeners, and square. posite side of each disk using the try cross panels, again orienting the grain as Take the time to resharpen the iron square. Each disk will have some warp shown. (See Figures 2 and 3.) These rec­ after you're done. The adhesiv~s used in in it, generally at right angles to the outer tangular parts are best cut out on a table making plywood are hard on the edge, ply grain. Place the bottom disk crown saw (for the precision). For those of you and few tools are more disappointing to up, the middle disk crown down, and without access to a table saw (like me), use than a dull plane. top disk crown up; label the sides facing cut out the pieces using a band saw, After the side and stiffener panels are up "Top." sabre saw, circular saw, or what have cut and planed to size, cut out the curved With middle and bottom disks you, leaving 1;32" or so to sand or plane wiring recesses and sand smooth. oriented this way, their warps will cancel down to the line. I prefer to use a jack The X-divider panels require special out, bringing the whole structure into plane because I can shoot an edge attention. Once you've established the proper alignment; the X-dividers will straighter and truer with it than with a 3"xll" outer dimensions, you must cut take care of the warp in the top disk. table saw. the intersecting grooves. The key to a Complete the layout lines for cleats, Mark the line you'll plane down to on tight fitting joint is to use the actual panels, and hole locations for each disk both sides of the piece. Tape the ends thickness of each panel at the middle, not on their top and bottom surfaces. Drill with masking tape just below the line to the nominal 114" thickness.

Figure 2-Side Panels and Stiffeners

L.---3/4"__ ---._ ...... NOTE 4 g-~------~~------e-­ ------~~------T-, -~------11------1-J T> NOTE 1 I I 1/2- ~ r r - I I I NOlE 3 .. +--- r = 1/2" ~-.,.--3-17-/-3-2- ~ I NOTE 2 ~ ~I I I I ~LO r I l~ I IX) I ------,-,-I ------;4 --e ------~~ ------1 T I I I I ~ Ile---+------r--e-r ...... I I I ItT I I co N I I , l~--,- l~------e~---~-----.r---~-~-~-~------~-~L~r~I------~-~~-~--_--_-_-~-~-~--~e------~n---~--L~ ~ 2 1/4"-l I. 1 1/2" I- 8 7/8" -l 1 1/2" .1 SIDE PANEL STIFFENER (Left & Right) LEFT SIDE PANEL (Right Side Panel is mirror image)

NOTE 1: Dashed lines show positions of cleats & cross panels on the inner side. NOTE 2: Vertical dashed lines show placement of stiffener on outer side. NOTE 3: LIMBO Stepper PCB mount holes (4). Drill & countersink from inner side of panel. NOTE 4: Cleat mounting holes (6). Drill & countersink from outer side of panel.

32 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 End diskette compatibility problems. Call Emerald Microware. CompatiCard I by Micro Solutions Copy II PC by Central Point Software This four drive universal floppy controller will let you Don't let a damaged copy protected diskette stop you run up to 16 disk drives (4 per CompatiCard), including cold. Copy II PC lets you back up your master disks so standard 360K, 96 TPI, high density 1.2M, 8" (SSSD you can keep going even when your key disk can't. or DSDD), and 720k/1,44M 31f2" drives. The Compati­ I Copy II PC ...... " $ 24.95 Card I comes with its own MS-DOS driver, utility pro­ CP/M ~J grams, and will let you boot on an XT (must be used Copy II PC Deluxe Option Board as a secondary controller on an AT or 386). Use it I \ MS·OOS with UniForm-PC for maximum versatility. by Central Point Software CompatiCard I Board...... $ 119.95 Have a copy protected diskette with a particularly CompatiCard I with UniFORM-PC ..... $ 179.95 EL:- [1] stubborn protection scheme? Would you like to be 8" drive adaptor board...... $ 15.00 able to read your Macintosh disks in your 31/2" in­ External drive cable set ...... $ 15.00 ternal drive in your PC or AT? Repair a disk that's UniForm-PC by Micro Solutions damaged, even between sectors? How about speed­ CompatiCard II by Micro Solutions Have you ever needed to use your CP/M diskettes ing up your hard disk backups (if you are using PC Two drive version of the CompatiCard, for the XT or on your PC? Now you can access your CP/M files Tools Deluxe)? The Copy II Deluxe Option Board can AT. Same drive support as the CompatiCard I except and programs on your MS-DOS computer just as you help you do all of this, and more. A must for the no 8" or single density. would a standard MS-DOS diskette. UniForm allows sophisticated user. CompatiCard II ...... $ 89.95 you to use standard DOS commands and programs Copy II Deluxe Option Board ...... " $ 139.95 *** Special *** CompatiCard II with right on your original diskette without modifying or internal 1.2M or 1,44M drive. . . .. $ 199.95 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, AT, OR 386. Central Point CompatiCard IV by Micro Solutions With UniForm-PC and the CompatiCard, you can use Meet the newest four drive controller in the Compati­ 5%" high density, 96TPI, 31f2" (720k/1,44M), and SoJ!!;!J,ft~~ Card family. This CompatiCard may be used as a even 8" drives. primary or secondary controller in almost any PC, AT, UniForm-PC by Micro Solutions ...... $ 64.95 or 386 System. Boot or use 360k, 720k, 1.2M, 1,44M, Also available for Kaypro, & other CP/M computers or 2.88M, at any location in your system. The Com­ patiCard IV has a BIOS ROM on board so no external driver software is required. CompartiCard IV ...... $ 139.95 CP/M .. MS-DOS UniDOS Board zao PC Tools Deluxe by Micro Solutions VS.S Don't throw out all of those old, reliable CP/M pro­ by Central Point Software grams, run them at LIGHTNING speed on your PC This is one of the great bargains in MS-DOS utility or AT with the UniDOS 8MHz. Z80 coprocessor software. But with so many features built in, we think board. And the UniDOS Z80 runs so smoothly and that many people are overlooking the REAL value transparently that you won't even be able to tell in PC Tools: DISASTER RECOVERY! Sure, the shell whether you're running DOS or CP/M. UniDOS emu­ is great for copying, viewing, editing, and deleting lates most common computers and terminals such files, and the desk top environment is nice for its as Kaypro, Xerox 820, Morrow, Osborne, VT100, and appointment calendar, note pad, phone dialer, calcu­ many others. Supports all standard CP/M system lators, and ASCII table. The fast hard drive backups calls, and now works with MS-DOS version 4. In­ can't be beaten by any other program, and the file cludes UniForm-PC. unfragmenter speeds up hard drive accesses. But UniDOS Z80 Coprocessor Card ...... $ 169.95 where else can you get all of that along with UN­ DELETE, REBUILD, and UNFORMAT? Have you ever entered "ERASE *. *" and realised when all was UniDOS by Micro Solutions said..and done that you were in the wrong directory? If you have a fast machine or have a V20 chip in­ How about those dreaded messages from CHKDSK, Megamate by Micro Solutions stalled, you may not need to use a card slot to run like "File allocation error .... "? The very first time you You don't have to be a computer expert to install this your CP/M programs. Run 8080 code directly on the recover your missing files will make you a believer. attractive 31/2" external drive on your PC or AT. Just V20, or use emUlation mode for Z80 programs. Don't wait until it happens. plug the MegaMate controller board into any empty UniDOS by Micro Solutions ...... $ 64.95 PC Tools Deluxe V5.5 ...... " $ 99.95 slot, attach the drive cable, run the installation soft­ UniDOSw/UhiForm&V20-l;Jchip ..... $ 135.00 ware, and you're ready to run 720k or 1,44M diskettes. Megamate ...... $ 329.95 MatchMaker I tJ( Micro Solutions /NoiN you can c~your Macintosh diskettes right on EMERRLD w MS DOS./ your PC/XT/fSFwlth the MatchMaker. Just plug your Apple . ,.., - , external 31f?!' Macintosh drive into the MatchMaker ./ board and-experience EASY access to your Mac disk- MICROWRRE MatchPoint-PC by Micro Solutions ettes. Includes programs to read, write, initialize, and delete files on your single or double sided Mac disks. Apple II or NorthStar diskettes in your IBM? Tha MatchMaker Board ...... $ 139.95 MatchPoint-PC board for the PC/XT/AT works with MatchMaker w/External Mac Drive ... $ 325.00 your standard controller card to let you read and write P.o. Box 1726 to NorthStar hard sector and Apple II diskettes on your PC. INCLUDES UniForm-PC program, as well as utilities to format disks, copy, delete, and view files (503) 641-8088 Beaverton, OR 97075 from Apple DOS, PRODOS, and Apple CP/M disks. VISA and Mastercard accepted. Please include $6.00 MatchPoint-PC Board...... $ 179.95 Call or write for our complete catalog of shipping and handling, $8.50 for COD, UPS-Blue or software, parts, accessories and RED Label additional according to weight. Prices complete repair services for the subject to change without notice. Please include your Kaypro, Xerox 820, and IBM PC/AT. phone number with all correspondence. • Reader Service Number 10 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 33 To do this, first find the vertical center of the width. Cut the slots to inside the stock you're likely to find at the lumber line of both divider panels. Scribe a line lines thus scribed. Trial fit, sand, trial fit, yard will probably not have a Vz"x5/s" offset l/s" from the center line of one etc., until the panels slide snugly to­ cross section. Get 3/4" square moulding panel with the try square as a guide, then gether. Check for square often during and plane to final dimensions. This stock place the edge of the other panel along this process. There should be little or no will be less than the nominal 3/4"· square the scribed line so you can scribe its play and the top panel should seat on the (more like 5/S" square). thickness onto the first panel. same plane as the bottom panel when It's much easier to do the planing When you've marked both panels, you are through. before you cut the cleats to length. Mark mark the end of the slots at the midpoint Next come the cleats. The moulding the whole length of the stock on two par-

Figure 3-X-div:iders, Trapeze Fittings, & Cross Panels

~~! !~ ~/64" TLEjI7/32" r 1/2" 1 1/32" ---L (ref) L- L 17/32"-1 ~ - 11~ ~ 11~ RIGHT FRONT RIGHT REAR 1/4" ] : 1 : 1 I eI I e I I I I I j ~L 1 7/16" I I I e I el L~ PLASTIC TRAPEZ FITllNG L.-I "'- NOTE 1

; (ref) .6" I 1.2" I 1.2" I 1.2" I 1.2" 1.6" I 1.• •.• •. • . • • . F.' r.

Ii! 1/2" I I I -e-f-l-. I I NOTE 2 -e- 1/4" NOTE 2 } __ I I I I I r- -[-- '--r---I I .- 11" -T--e---e----i~--'-r I r-r l.....-_--t NOTE 3 : I 1 1/2" 1 1/2" I I I I I

. NOTE 1 -.11

---GRAIN 10 r, r, ID I e I ID I e I 0 I I d 0 I I d I­ I I ""'0 I I ""'0 Z I : ,1/2" I I e I I e I o -e~ I -e- ~ ~ 0::: It s:::: s:::: -e-e-e-e-e-- J J I J LL I I I I I I· 3" ·1 It-·-- 3" ----I-I I. , 6" .1' LEFT REAR LEFT FRONT TOP & BOTTOM CROSS PANELS X-DIVIDERS NOTE 1: Dashed lines show placement of cleats on NOTE 1: Dashed lines show location of Trapez fitting bottom of bottom cross panel and top of (upper half). See text for mounting details. top cross panel. NOTE 2: X-divider join line. NOTE 2: Drill & countersink from panel side, centered on cleat. (Cleat mounting holes). NOTE 3: Card guide mounting holes (6). See text on mounting card guides.

34 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 C CODE FOR THE PC source code, of course MS-DOS file Compatibility Package (create, read, & write MS-DOS file systems on non-MS-DOS computers) $500 NEW! CSource Application Program Generator by MBAC (includes all source code; generator & libraries) . . . . . $500 dB2c (dBase-to-C translator; i!1c1udes db_Files for C ~nd db_ 100ls for q...... $325 CQL Query System (SQL retnevals on B-trees plus windows) ...... $325 GraphiC 5.0 (high-resolution, DISSPLA-style scientific plots in color & hardcopy) ...... $325 NEW! Drasch aisp with Crules (Li~p library and programmin~ enviro~ment with r:ule p~ing cap'ability; natural language example) . . . . $300 Greenleaf Data Windows (Windows, menus, data entry, interactive form desl~n; specify compiler) ...... $300 PC Curses (Aspen, Software, System V compatible, extensive documentation) ...... $290 NEW! CoData Manager (object-oriented data management, persistent objects from runtime definitions, network and entity models) .... . $250 MEWEL (extensible window and even~ library by Magma Software; message-passing & object-oriented; SAA-compatible; dialog editor) $250 Thrbo1FX (Release 2.0; HP, PS, dot dnvers; CM fonts; La'J6X; MetaFont) ...... $250 PC PosiScnpt (co~plete PostSaipt interpreter (ROM yerslon 47.0A), 80286/386 0J.lly, many device drivers, optimized graphics, fast) $250 db_File & db_Retneve (B-tree and network database WIth SQL query and report wnter) ...... $245 Greenleaf Communications Library (interrupt mode, modem control, XON-XOFF; specify compiler) .....••...... $225 NEW! Booter 100lkit ( bootstrap routines, DOS file system, light-weight multitasking, windows, Cast memory management) $210 NEW! CDirect (mu~ti-user. hl.lshed file manager; variable length fields! binary or ASCII data, alternate keys)...... $210 NEW! BCPL Compiler (thiS IS not C source but BCPL source; BCPL IS the mother of C) ...... $195 QuickGeometry ubrary (Il.lrge colle~ion of. mathematics, graphics, display & DXF subroutines for CAD/CAM/CAE/CNq $170 CB1fee (B+tree ISAM dnver, multiple vanable-Iength keys) ..•...... $165 ThrboGeometry (library of routines for computational geometry, Version 3.0)...... $160 AT BIOS Kit (roll your own BIOS with this complete set of baSIC input/output functions for ATs) ..... $160 WKS Library Version 2.01 (C pro~ram interface to Lotus 1-2-3, dBase, Supercalc 4, Quatro, & Clipper) .. $155 OS/88 (industrial-strength U ••x-hke , many tools, cross-development from MS-DOS) . . . $150 NEW! Cephes Mathematical Library (over 100 high"9uality, double-precision scientific functions) ...... $150 ME Version 2.1 (programmer's editor with C-hke macro language by Magma Software; Version 1.31 still $75) $140 Vmem/C (virtual memory manager; least-recently used pager; dynamic expansion of swap file) ...... $140 Thrbo G Graphics Ubrary (all popular adapters, hidden line removal) ...... $135 NEW! Power Search by Blaise Computing (regular-expression compiler; generates machine code on the fly). . . . ". $120 Install 2.3 (automatic installation program; user-selected partial installation; CRC checking) ...... $120 NEW! Installation 100lkit 3.0 (250-page User's Guide, interactive saipt development program; many special cases covered) $120 NEW! B-Strings (dynamic string handling; cut, copy, paste, search, user input, etc.; non·fragmenting memory management) $105 TE Editor Developer's Kit (full screen editor, undo command, multiple windows) ...... $105 Updated! Minix Operating System (Version 1.3; U ••x-Iike operating system, includes manual) ...... $105 PC/IP (C.MU/MITTCP/IP for PCS; Ethemet'.~l?pletalk & NETBIOS drivers, RVO, update by Dan Lanciani) .. $100 B-1fee ubrary & ISAM Dnver (file system utlhtles by Softfocus) ...... $100 The Profiler (program execution profile tool) . . . . • ...... $100 QC88C compiler (ASM output, small model, no longs, floats or bit fields, 80+ function library) ...... $90 Otter 1.0 (beautiful theorem-prover by Bill McCune; includes manual & two books by Wos; complete starter kit) . $80 C Windows 100lkit (pop-up, pull-down, spreadsheet, CGA/EGA/Hercules) ...... $80 JATE Async Terminal Emulator (includes file transfer and menu subsystem) ...... $80 MultiDOS Plus (DOS-based multitasking, intertask messaging, semaphores) ...... $80 Makx ~acros, all languages, built-in rules) ...... $75 evalU C function to evaluate ASCII infix expression string; 17 built-in functions) ...... $75 XT BI S Kit (roll your own BIOS with this complete set of basic input/output functions for Xn) $75 Professional C Windows (lean & mean window and keyboard handler)...... $70 ScreenUb (simple screen definitions, windows, pop-up menus, context-sensitive help) ...... $65 Heap Expander (virtual memory manager using expanded memory, extended memory, and disk space) ...... $65 Quincy (interactive C interpreter) ...... $60 Symtab/lltree (general-purpose symbol table/parse tree construction and management package; specify Symtab or Ptree) $60 Coder's Prolog (Version 3.0; inference engine for use with C programs) ...... $60 Async-Termio (Unix V compatible serial interface for MS-DOS; stty, ioctl, SIGINT, etc.) ...... $55 Backup & Restore Utility by Blake McBride (multiple volumes, file compression & encryption) . . $50 NEW! Floppy TAR (TAR backup and restore on MS-DOS devices; direct access to non-standard deviCes) $50 SuperGrep (exceptionally fast, revolutionary text searching algorithm; also searches sub-directories) $50 NEW! REGX Plus (search a~d replace string mampula!ion routines base~ on regular expressions). . . . $50 OBJASM (convert .0bJ files to .asm files; output IS MASM compatible) ...... $50 Multi-User BBS (chat, mail, menus, sysop displays; does not include J-tayes modem driver) . . $50 NEW! LaplaceB (LaPlace polynomials, real and complex) ...... $50 Updated! CLIPS (rule-based expert system generator, Version 4.3; advanced manuals available) . . . . $50 NEW! Kier DateLib (all kinds of date manipulation; translation, validation, formatting, & arithmetic) $45 Updated! Fortran-to-C TIanslator by Polyglot ....•...... $40 NEW! DES I?ncryption ~ Decryption (~OO bits/seco~d on 4-?7 MHz PC foron-the-fly encryption at 2400 baud; U.S. only) $40 NEW! F1exList (doubly-hnked hsts of arbitrary data WIth multiple access methods) ...... $40 Virtual Memory Manager by Blake McBride (LRU pager, dynamic swap file, image save/restore) ...... $40 Heap I/O (treat all or part of a disk file as heap storage) ...... $40 Bison & PREP (YACC workalike parser generator & attribute grammar preprocessor; now includes documentation) ...... $35 PC-XINU (Comer's XINU operatmg system for PC) ...... $35 NEW! RXC & EdREP (Regular Expression Compiler and Pattern Matching; RXC makes finite state machine from regular expression) $35 NEW! CCALC (handy extended-precision calculator; real and complex models; many built-in functions) ...... $30 NEW! GNU Awk & Diff for PC Qx>th programs in one package) ...... $30 6-Pack of Editors (six pubhc domain editors for use, study & hacking) ...... $30 Crunch Pack (14 file compression & expansion programs) ...... $30 Pascal P-Code Compiler & Interpreter or Pascal-to-C Thlnslator (Wirth standard Pascal) . . . $25 FLEX (fast lexical analyzer generator; new, improved LEX; official BSD Version 2.1 with docs) $25 List-Pac (C functions for lists, stacks, and queues) ...... $25 A68 (68000 cross-assembler) ...... $20 XLT Macro Processor (general purpose text translator) ...... $20 Data . NEW! Mo~ Pronunciator (150,000 words & phrases encoded with full IPA pronunciation & emphasis points; 900 distinguished by part-of-speech) $160 NEW! Mo~ Part-of-Speech (200,000 words and phrases desaibed by prioritized part(s)-of-speech) ...... $105 NEW! Moby Hytlhenator (150,000 words fully hyphenated/syllabified) ...... $120 Smithsoman Astronomical Observatory Subset (right ascension, declination, & magnitude of 258,997 stars) ...... $60 Moby Words (500,000 words & phrases, 9,000 stars, 15,000 names) ...... $65 U. S. Cities (names & longitude/latitude of 32,000 U.S. cities and 6,000 state boundary points) . $35 The World Digitized (100,000 longitude/latitude of world country boundaries) ...... $30 KST Fonts (13,200 characters in 139 mixed fonts: specify 1BX or bitmap format) ...... $30 USNO Interactive Computer Ephemeris (high-precision moon, sun, planet & star positions) $30 U. S. Map (15,701 points of state boundanes) ...... $15 The Austin Code Works Voice: (512) 258-0785 111 00 Lea/wood Lane acw!in/[email protected] BBS: (512) 258-8831 Austin, Texas 78750-3409 USA FAX: (51g) 258-1342 Free surface shipping for cash in advance .For delivery in Texas add 7% MasterCard/VISA Reader Service Number 4 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 35 allel sides with a carpenter's marking before unclamping so you know which lowed for either a PCB or wire-wrapped gage set to 112." depth, plane to the lines, cleat goes where. Repeat for the top disk backplane (for those of you who want to then mark the other two sides to 5/8" and and the top and bottom cross panels (Le., do more work and spend more money). plane to those lines. Keep it square. the top and bottom of the card cage). The backplane PCB screws directly onto Once you've planed the stock, cut six Treat the side panels in a similar fash­ the two remaining 6" cross cleats 8 %" lengths, two 6" lengths, and two 2" ion. Orient the side panel so it bows (thought I'd forgotten 'em, eh?). lengths. Cut them slightly long, then away from the cleat. Be sure to orient the "The DC-DC power convertor board sand to exact length. Select two of the numbered cleat properly before clamping mounts on the other side of these cross long cleats and mark the 251.32" radius and drilling as above. The drilling depth cleats in the rear of the superstructure. clearance at their midpoints as the bot­ this time should be about 13116". Repeat Don't worry, I'll talk about both the tom disk diagram shows. Cut the arcs for the rest of the long cleats. power convertor and backplane PC out and sand smooth. These arcs will Once you've drilled all the panel! clea t boards in detail next time. For now, it's provide clearance for wing nuts to hold pilot holes, set aside the cleats and ream" sufficient just to point out where they go. the superstructure to the base. out all the panel holes with a 9/64" bit. Butt each cross cleat against the rear Chuck up a 60 degree countersink and of its cross panel and clamp to the long Step 2: Preparing The Panels countersink one of the holes just enough cleats. In the case of the top cross cleat, Woodscrews hold the plywood panels so that a #6 flathead wood screw seats the long cleats have already been at­ and cleats together. Each screw requires flush. tached to the middle disk. Do the drill, a pilot hole and must be countersunk. With the drillpress power off, bring ream, and countersink routine, this time First clamp a cleat to the bottom disk, the countersink bit gently down into "with a drill depth of 718". carefully lining up the edges of the cleat countersunk hole until you have firm Secure each cross cleat with epoxy with the lines scribed earlier before tight­ contact. Temporarily lock the spindle in and a #6x7/8" wood screw on each end. If ening the C-clamps. If the disk is place if your drillpress has this featUre, you like, you can also put a line of epoxy warped, the clamps and cleat will hold it otherwise hold the spindle in place while on the butt joint between cross panel and flat. you set the depth stop to the current cross cleat. To finish the cross panels, Drill the holes through the disk into depth. epoxy the card g~ides in place. the cleat with a #44 bit. The depth to drill If your drillpress does not have a is 1116" less than the combined thickness depth stop, then mark the position on the Step 4: Constructing The Sensor of the panel/cleat combination, or about depth indicator G've yet to see a Platform 11116". Number the cleat and the disk drillpress without one or the other). One problem I had with the sensor Countersink the rest of the holes in all platform was shielding the sensors from the other panels and disks, taking care to stray infrared while leaving easy access You've Seen countersink from the correct side (Le., the for maintenance. The solution needed to side you drilled the pilot holes from). be strong enough to allow carrying Your Computer Run, Drill the LIMBO Stepper PCB mount­ ,LIMBO by two grab handles on the top Now Watch It Fly! ing holes (9/64") for left and right side disk, too. panels. Countersink these holes, too, but I must have thought up a dozen un­ from the opposite side of the panels (the satisfactory methods, all too heavy, com­ crown side). Drill the V8" card guide plicated, or expensive. Time to visit the mounting holes in both the top and bot­ local hardware store. The hardware store tom cross panels. Do not countersink didn't have the answer, either, so I went these holes. to a wood working store. Furniture To finish with the panels, epoxy the makers face this problem daily: how do IBM·PC, XT, AT, '386 Blue Flame II stiffeners to the side" panels, then epoxy you make a piece of furniture strong yet and screw the long cleats to the bottom easy to break down into smaller, easy-to­ Semi Disk Solid State Disk Emulator disk and top and bottom cross panels. carry sections? Epoxy the 2" backstop cleats to the The answer: "Knock Down" hard­ Featuring: middle of the side panels in the battery ware. I chose a variety called the Trapez • PC-DOS, MSDOS, and Concurrent DOS compartment; Place them level with their Compatible fitting, two mating plastic blocks with a ends butting against (but not epoxied to) single screw to hold them together. The • Very Fast Access: 6.4 Mbits/sec both the bottom disk cleats and bottom Trapez is designed to join a vertical panel • High Capacity: Up to 8 MB Per Board cross panel cleats. The middle disk will to a horizontal panel. The top block has • Expandable to 32 MB eventually be attached to the same cleats sideways screw holes for mounting on • Battery Backup Option as the top cross panel, but do not epoxy the vertical panel; the bottom block has • Hardware Parity Checking the cleats to the middle disk at this time. screw holes for mounting on the horizon­ • No Mechanical Wear SemiDisk Instead, use screws alone to hold this tal. (See Figure 3.) • No Special Interfacing Systems, Inc. disk to the cleats so the disk can be re­ When you remove the holding screw, • Prices Start 11080 S.w. Allen #400 moved later. the two panels come apart. Each fitting Under $600. Beaverton, OR 97005 weighs a fraction of an ounce, so four of (503) 626-3104 Step 3: The Card Cage them are no problem, one for each comer FAX (503) 643-0625 The card cage must provide mechani­ of the X-dividers. Reader Service Number 162 cal support for the backplane. I've al- Angle brackets and epoxy per-

36 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 call sl ;e68Z:ee&1 »xref=<96847>« Unlimited file .,v ax ;e68Z:9994 »xref=« Built-in BIOS size ... Fully :coaversiol ta'le Preprocessor automatic aw .s __.le- ;e68Z:e897 IM)V al S.'roathe ;e68Z:8889 xor si lIIiI ;e68Z:eEM Or il iI ;Loa. register' WI 8 ; e68Z:88811 .au All Data formats aw ;e68Z:8918 Batch mode and ;»»> Conversion Section xrer a4.ress including DB, OW, interactive les 4i Uord ;e68Z:991Z »xref=<86999)« DD&DUP Address ;coaversioa ta'le lfs bx.------:9682:8916 .ovzx cx Help ; 9682 : 99th get 'Yte count repz st~=====:::!1 ;9&81:99U ;Store AL at ES:(DIJ Locates EXE Unpacker sti ;9&92:9921 Data/Code ;Tufn 0" Interrupts included! boundaries .... ;9692:9922 :96e2:9925 DOS:1c-ter.ildte

No Source Code? No Problem. too much to start over (it's a programming man­ New DiseDoc Professional is your dual-mode ager's dream). Save your employer huge new­ key to any DOS source code. It works in batch programming fees and enhance your marketabil­ and interactive modes simultaneously, allowing ity. DiseDoc is so easy to learn, you'll be a you to generate the core information of even the high-dollar hero in no time! most complex programs fast. .. and modify them even faster. Most programs will come apart in just Knowledge really is power. two minutes. Imagine what you can do with a tool DiseDoc Professional is an amazing new teach­ this powerful! DiseDoc sifts through programs ing tool. Learn how programs work... take them eight times for guaranteed accuracy. When code apart and see the writing techniques that top pros gets mixed up with data, our toolbox comes to the use. Use it to assist in debugging. Hunt down vir­ rescue with smart search and easy edit utilities. uses and write killers. DiseDoc can save you DiseDoc can handle any instruction set up to years of frustration, and it only costs $149.95 and including 486 and offers a variety of other including the EXE Unpacker (until January 1). To great features that you can sample on our order your DiseDoc Professional kit or our free Free Demo Disk. demo disk, simply call:

Warning: DiseDoc Professional may change the way you work forever. 1-800-446-4656 Programmers who used to shy away from fixing outmoded programs with no source code are WITHIN CT & OUTSIDE THE U.S., CALL (203) 953-0236 going to discover a valuable new talent: the ability MasterCard & VISA. Shipped Immediately Via UPS to modify and revise codes that would cost way RJSwantek, Inc., 178 Brookside Road. Newington CT 06111 manently secure the top disk to the X­ edge of each panel. Once you've marked blocks of each Trapez fitting, then re­ dividers, and Trapez fittings hold this all the hole locations, drill them out to move the holding screws and use the whole assembly to the middle disk. 11/64" dia. Lightly tap 6-32 Tee-nuts into lower blocks to mark the hole locations Screwdriver access holes in the top disk each hole, then mount the Trapez fittings on the disk. Drill the mounting holes and aligned with the holding screws below and angle brackets with 6-32x3/g" flat­ mount the blocks with Tee-nuts and complete the arrangements. And they head machine screws. The brackets go on screws as above. only cost 70¢ each. Elegant, strong, the opposite sides from the Trapez fit­ Try the fit between the X-divider and cheap. tings; Trapez fittings go in the left and disk Trapez blocks. If it takes consider­ First mount the Trapez blocks onto right bays, brackets in front and rear able force to mate all the blocks, you will the X-divider panels. Remove the screws bays. have to enlarge one or more of the lower from the middle disk and set the cleats Assemble the dividers to check that block mounting holes to allow the and top cross panel aside. With the X­ the Trapez blocks sit flush with the bot­ block(s) to move enough for easy mating. divider panel upright on the top of the tom edges, and that the angle brackets Repeat this process for mounting the middle disk, position the Trapez fitting are flush with the top. Epoxy the X­ brackets to the top disk. Don't forget the squarely against both the vertical X­ divider panels together, using a try screwdriver holes must be aligned with divider panel and the horizontal disk, square and masking tape to hold the the holding screws. Check that this is then mark the hole locations of the top panels square until the epoxy sets. right before you epoxy the X-dividers to block with a pencil. After the epoxy sets, position the X­ the top disk. Mate the two halves of the Use this same procedure to locate the dividers on the top surface of the middle sensor platform together and secure the holes for the angle brackets on the top disk. Carefully trace around the lower holding screws.

Figure 4-Isometric View of the Whole Superstructure

1------14 11" DIAMETER ------.I-I

TOP DISK

SCREWDRIVER ACCESS HOLE (1 of 4)

X-DIVIDER .. SENSOR (1 of 2) BAYS

I c.:> POWER I CONVERTOR MIDDLE DISK TOP CLEATS . BAY (in rear) ~ TOP CROSS PANEL t') STD CARD N BOTTOM CROSS PANEL CAGE (in front) ,SIDE PANEL (1 of 2)

MIDDLE CLEATS BATTERY COMPARTMENT

SIDE PANEL STIFFENER BOTTOM CLEATS (1 of 2)

BOTTOM DISK

38 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Step 5: Finishing The Superstructure Mate the X-divider to the top disk and The studs are merely 1O-32x3/4" flat­ Assemble the side panels to the top stand back to admire the completed su­ head machine screws held captive to the and bottom cross panels and the bottom perstructure. Well, almost complete. You base top disk by 10-32xV4" Tee-nuts. The disk. Use screws only for now. Sit the still need to go back and epoxy the side holes must be countersunk on the bottom sensor platform on top. (See Figure 4.) panels and. the middle disk to the cleats, side so that the screws are flush. Notice that, with all the Tee-nuts pro­ but wait until after you install the STD It is also necessary to counter-bore the truding from the bottom of the middle backplane. other four Tee-nut holes on the top side disk, the middle disk no longer sits flush The last task is to mate the superstruc­ of the base top disk as well as the mount­ on its cleats. Use a Dremel tool or a chisel ture to the mobility base. Last time we ing holes on the underside of the super­ to cut shallow recesses into the side drilled eight holes in the top (5 3/4" dia.) structure bottom disk with a 3/4" spade panels and cleats to accommodate the disk of the base, but used only four. Use bit. The depth should be no more than Tee-nuts. With some trial and error, you the remaining holes to mount threaded the thickness of the flange of a Tee-nut. should get a good snug fit, especially studs that will protrude up through the All this assures that the base top disk is when you tighten down the screws hold-:­ bottom disk of the superstructure. Wing in full contact with the superstructure ing the middle disk to its cleats. nuts hold the superstructure to the base. bottom disk.

Making The Robot Move Figure 5-LIMBO Stepper Board Parts List Tools: 30 W soldering iron, YOM or DVM, needle-nose pliers, CMOS logic C1 100 mfd/50 V Electrolytic probe and/or oscilloscope, 5V and 6V C2 1 mfd/35 V tantalum power supplies, screwdriver. R1-R4 1 ohm, 1/4 W, 5% Materials: Asst. electronic components R5 0.47 ohm, 2 W, wirewound (see Figure 5), silicone heat sink com­ IC1 CD4070 Quad XOR pound, masking tape, solder flux paste. IC2 CD4027 Dual JK flip-flop You can amuse your family only so IC3 CD4093 Quad NAND, Schmitt trigger inputs long by pulling LIMBO around with a IC4 CD4584 Hex invertor/buffer, Schmitt trigger inputs leash and making race car sound effects. D1-D4 1N4005 600 V PIV, 1 A Silicon rectifier Eventually they'll demand to see the Q1-Q4 IRF530 Power MOSFET robot move under its own steam. In steps J101 10-pin male right-angle header, dual row LIMBO Stepper. J102 8-position wire terminal block, 0.2" centers The LIMBO Stepper board is not the Jl03 2-position wire terminal block, 0.2" centers most up-to-date stepper motor controller, Misc: Printed circuit board but it is cheap, rugged, and reliable, great 4 #6-32x3/8" machine screws features for any robot subsystem. (See 4 #6-32 nuts Figure 6.) Karl Lunt has a fancier (and 4 heats inks (AAVID #5751B) more expensive) stepper controller based 1 16-pin dip socket on the 68HC705 for those of you who 3 14-pin dip sockets like smarter circuitry. Assorted wire jumpers Three inputs control LIMBO Stepper's • • • four output phases: STEP*, DIR*, and ENABLE. The asterisk in STEP* and DIR*

Figure 6-LIMBO Stepper Board Schematic

J101 2 1 "3 5;9. naI5!~ ~I Cl C2 11 IC~C "4 Vee 0 ~ ~OVcc ENABLE J J.± i J.± > 10-=:- 9 ji j~

RS J103 [{§l B+ (unregul.,ed) .------~~ HoghCurrenlGND

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 39 Figure 7-Stepper PCB Layout

signifies that these are active low signals. are cheaper). Power MOSFETs have ex­ The traces and transistors on the This is the convention used by the SrD tremely high current gains and can oscil­ board are sized to accommodate larger Bus Specification and Practice Handbook, so late at several hundred MHz, which motors than those currently used in I'll use it also. spells Smokey Trouble if not properly at­ LIMBO, up to about 10 A per phase For each STEP* pulse, the stepper tenuated. (with a higher wattage ballast resistor). motor will rotate one step in the direction Use the other two invertors for their With the 1 A per phase draw of the IMC specified by DIR*. If STEP* is held Schmitt trigger inputs to clean up the stepper motor, the MOSFETs stay cool to steady, two phases of the motor will DIR* and STEP* signals should they pick the . Heatsinks are not required, but energize, locking the rotor. To conserve up any electrical noise. The NAND gates it's easier to put them in while building power, bringing ENABLE low allows all also have Schmitt trigger inputs, so the boards than later when you want to phases to deenergize, regardless of the ENABLE gets cleaned up, too. use bigger motors. states of DIR* and STEP*. Overkill? Maybe. Noise pickup is I recommend using printed circuit A dual JK flip-flop (in conjunction surely the toughest problem to solve boards for LIMBO Stepper. Point-to-point with a few XOR gates) provides all the once you have it. Best to avoid it in the wiring works, but life is too short to con­ sequencing. The NAND gates perform first place. Along the same line, I also tinue using such time-consuming the ENABLE function, and four of the in­ used separate paths for signal ground methods. I don't recommend wire-wrap­ verter I buffers drive the power MOSFET and high current ground. In any system ping these boards because wire wrap gates (gives you better rise times). mixing high current circuits and logic cir­ connections aren't meant for high cur­ The 1 ohm resistors in the gate circuits cuits, it is essential to use a Single Point rent. prevent high frequency oscillation (ferrite Ground (SPG), which means physically For those of you who've never tried it, cores are the ideal solution, but resistors separating the current paths. I encourage you to etch your own boards

40 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 from my layouts. (See Figure 7.) It's not wonder what "normal precautions" means, turns erratically, check for cold solder that difficult, especially for a single sided so: (1) don't shuffle your feet on the rug; (2) joints. Also check that all the terminals board like this. Plus, you'll learn some­ connect a piece of hookup wire between your are making connection to the stepper thing. watch and the board's ground; (3) don't hand motor wires and that the wires are in the An excellent tutorial on prototype an IC to another person without tOllching proper sequence on the J102. PCB fabrication and design is David that person, skin to skin, first; (4) leave ICs If the motor appears completely dead, Kasten's Electronic Protohjpe Construction in their tubes or foam until you're ready to first disconnect the function generator (H. W. Sams, 1987, ISBN 0-672-21895-X). install them; (5) don't slide ICs across the output from STEP*, then jumper STEP* The book covers everything from laying table top; and (6) don't give me static about to ground. Try turning the shaft by hand out boards to fabricating enclosures, and not telling you. with and without 6V applied to B+ of even such exotica as electroplating gold To test the boards with the stepper J103. With 6V applied, there should be on edge connectors. This book belongs motors, you'll need an adjustable square­ firm resistance to turning; without 6V, on every roboticist's bookshelf (or better, wave generator that can output 5V there should be almost none. If there is on his workbench). For you diehards, CMOS levels from 0 to 1000 Hz. A bench no difference, check with a volt meter there are also etched and drilled boards function generator is ideal, but you can that 6V is making it past J103. available from Robotic Systems. jerry rig a 555 timer to do the job. If you Check that 6V is also present on all Stuffing the boards begins with the haven't the faintest idea what I'm talking the even terminals of J102. If everything jumpers. I like to use the precut jumpers about, I suggest you obtain a copy of checks out so far, measure Ohms from sold for solderless breadboards, but any Forrest Mims' 555 Timer Circuits, En­ drain to source of each MOSFET with B+ 24 gauge solid wire will do. Next come gineer's Mini Notebook at Radio Shack. disconnected. For those MOSFETs with the sockets. Simply hold the DIP sockets Connect the eight wires of the stepper 5V on their gate inputs, the On resistance in place with a bit of masking tape while motor to the screw terminals of J102. should be about 0.18 ohm; for those with you solder. Solder the corner pins first, With power off, connect a 6V supply OV on their gates, the reading should be then work around to the other pins in a capable of sourcing at least 2 Amps to several mega-ohms. Replace any circular rotation. This will help you avoid the B+ and High Current Ground termi­ MOSFETs that don't pass these tests. overheating and delaminating any of the nals of J103. On J101 jumper ENABLE to If the board has been perverse enough pads, and it helps prevent solder bridges. Vee, jumper DIR* to ground, connect Vee to work perfectly right off, then you'll Resistors and diodes come next. and Signal Ground to a 5V power have missed all the above troubleshoot­ Watch the polarity of the diodes. Now supply, then connect the squarewave ing. Before you mount the boards on the install the MOSFETs and their hea tsinks. output of your function generator (power superstructure, I advise you to go Dab a bit of silicone heat sink compound still off) to STEP*. Now comes the big through all the tests, anyway. Trouble­ on the back of each MOSFET before moment. shooting electronic gear is good for your snapping its heat sink into place. Bend First, turn on the logic power supply soul, and half of successful roboting is re­ the leads with needle-nosed pliers, alone, then tum on the function gener­ pairing the creatures. making sure that the tab mounting holes ator. Monitor the STEP* input with an Next time, we endow LIMBO with line up with the holes on the board when oscilloscope or a logic probe to verify more sensors, more intelligence, and a you insert the pins. Secure the heatsinked that STEP* is pulSing, then monitor the DC-DC convertor. MOSFETs with 6-32x3/s" machine screws outputs of IC2, pins 1, 2, 14, and 15. On and nuts, and solder the pins. each, you should see a squarewave ex­ Parts Sources Finally, install the connectors and actly 4x the period of the STEP* input. capacitors. These are taller components If you have a two channel scope, you Nylon card guide-Part #770-4457 than the rest, so I save them for last. can verify that pin 2 is an inverted ­ Concord With all the components soldered in, sion of pin 1, as pin 14 is an inversion of 30 Great Jones Sl but with empty IC sockets, use a DVM to pin 15. Pins 15 and 14 should be 90 New York, NY 10012 check continuity from the Signal Ground degrees out of phase with pins 1 and 2, (212) 777-6571 pin of J101 to the ground connections on respectively. Now follow these signals on the IC sockets. Check the socket contacts the schematic to the outputs of the Trapez fitting-Part #03911 to make sure the solder joints are sound. NAND gates, where you will see in­ The Woodworker's Store Repeat this process with the +5V Vee pin verted versions of the previous signals. 21801 Industrial Blvd. and the Vee connections of the ICs. If you see no signals at these pins, Rogers, MN 55374 Next check the Ohms reading be­ check that ENABLE is tied to Vee. If all is (612) 428-2199 tween Vee and Ground. If there is a low still well, follow farther to the right on reading here, start looking for a solder the schematic. The signals are inverted bridge or a backwards diode. If you'can't once more by the invertor Ibuffers. • • • find it now, the thin curl of blue smoke Once this all checks out, it's time to when you first power up the board ,,,,ill tum on the 6V power supply. The step­ point it out. per motor should begin to rotate at once. When the boards pass all these tests, Jumpering DIR* to Vee should change the then-and only then-install the ICs. Use direction of rotation. If the motor just sits the normal precautions for handling there and hums, try reducing the static sensitive components. frequency input to STEP*. If the motor Editor's note: I know some of you will still doesn't rotate, or if it shudders and

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 41 Capturing & Graphing A Voice In Real-Time: Part 2 The Digital Half Of The Problem

PC's interrupts). But it will cost three 8255 parallel I/O ports. This is easy on Last issue Bruce gave us the analog por­ times more than the ADI000. the ADIOOO board; just solder a small tion of this often-discussed problem. This The upshot of all this is: wire between two holes to select bit 7 of time he converts the analog signal to digital (1) Even boards which seem like they port A, B, or C. data and displays it. ought to be almost the same (Le., the Ad­ I used port B since it isn't brought out vantech board and the RID board) can to the external connector on the board, so function very differently; none of those lines has been used. The hile in graduate school, I took (2) People buying the RTD AD1000 8255 defaults to input mode so you don't several classes in digital signal are using it for measurement, not digital even have to configure the chip; just start W processing, digital filtering, and signal processing or control; reading it. digital control systems. The classes al­ (3) I'm doing my sampling in soft­ ways began with a professor or techni­ ware, without the aid of the Code cal assistant saying, "sample at regular counter /timer. I've separated the code according to intervals." George said he knew a fellow who function: While researching and writing this ar­ used the AD1000 to sample music; ap­ • Figures 1 and 2 (CAPTURE.H and ticle, I naiVely assumed that any A/D parently the sampling rate was high CAPTURE.C) show how I tell the board which contained a timer/counter enough that the rattle in the sampling pe­ ADIOOO hardware to capture a set could use that timer to start the conver­ riod (inconsistencies due to other of samples. sion of the A/D converter. The timer demands on the system) didn't affect it. • Figures 3 and 4 (DISPLA Y.H and makes sure the samples occur at precise I've always heard the sampling period DISPLA Y.C) show how I translate intervals, something your PC can't must be constant, though I'm not sure data into screen graphics. guarantee (your program competes with how constant. • Figure 5 (VOICE.C) declares the the RAM refresh and clock interrupts). My computer, a Standard 286 from CAPTURE and DISPLAY func­ However, a timer isn't always useful. PC Source, has two speeds: 6 and 10 tions by including their header My favorite board from Issue #49, the MHz. Normally, I can't use 10 MHz be­ files, and then uses the functions Real-Time Devices ADI000, has a real­ cause they used the wrong interrupt con­ to capture your voice pattern and time clock chip; unfortunately it can't be troller on the motherboard-it locks up display it. used to start A/D conversions. The Ad­ during disk writes, tape backups, modem Figure 6 is the MAKEFILE which tells van tech board, sold by Rapid Systems communications, etc. (PC Source was MAKE.EXE (which comes with Turbo C) and Halted Specialties, seems to be trig­ quite rude when I wanted it fixed, by the how to assemble the project (look up gerable with a "pacer" clock. (This por­ way, so I've been stuck in the slow lane "make" in the reference manual to un­ tion is so poorly documented it's not ever since.) derstand Figure 6). By typing MAKE, clear to me exactly how to do it, espe­ Since I didn't use interrupts in this you'll build VOICE.EXE. cially without a schematic.) project, I was able to switch between 6 I wrote all the code in Turbo C, but George Dooley at RID explained that and 10 MHz and see a dramatic differ­ you shouldn't have too much trouble the industry-standard 12-bit A/D chip ence. In this case, faster is better; we can translating it to something else. they used was designed in the days of catch higher frequencies without aliasing. In CAPTURE.H, you'll see a set of C the 8080 CPU. It uses two lines instead of preprocessor macros for controlling the one to start a conversion. One of these Testing EOC AD1000 board. I chose preprocessor mac­ lines is an address from the CPU. To sample, you start the conversion ros over C functions because the macros They've given long thought to run­ and then begin polling the end-of-conver­ put the code in-line when they're called. ning the converter with the sion (EOC) line on the A/D converter. The compiler gurus at Borland real­ timer/counter chip but haven't yet Once the conversion is complete you can ized that if I/O takes too long, you may worked it out. They're designing a new read the value and start a new conver­ have to resort to assembly language. To board which uses a FORTH CPU and its sion. solve this problem, they altered the way own memory to store samples (and thus To monitor end-of-conversion, strap the compiler handles inportO, inportbO, will not be subject to the vagaries of the the EOC line to the input of one of the outportO, and outportbO function calls. If

42 MICRO CORNUCOPIA, #51, Jan-Feb 1990 By Bruce Eckel Revolution2 308 Meredith St. Kennett Square, P A 19348

Figure l-CAPTURE.H

1* CAPTURE.H by Bruce Eckel Revolution2 Real-Time Again, data written to the addr is unimportant: *1 Consulting. Preprocessor macros & function #define START_AD () outport (base + 9, 0) declarations for the RTD ADIOOO board. Note that for this code to work, the end-of-conversion (EOC) 1* This tests PB7. Is AID conversion complete? *1 line of the AID converter must be strapped to the #define COMPLETE() (inportb(base + Oxd) & OxSO) parallel port B line 7 (PB7). This is accomplished by soldering a short wire from the EOC line to the 1* This macro produces the value of the AID PB7 line on connector PS on the ADIOOO board (this conversion. Backslash at end of the line allows connector is clearly marked by silkscreen info on you to continue the macro on the next line. *1 the board). This wire allows the code to monitor #define READ_AD (result) (result= (inportb (base+S) \ status of the AID converter by looking at PB7. *1 « 4); result+= (inportb (base+9) » 4);} 1* Note result is left-justified in the 16 bits of #include 1* So you get Turbo C inport the AID registers. *1 and outport macros (fast) instead of functions. *1 1* This macro starts a reading, waits till the AID 1* Macros in this file generate no code unless completes the conversion, and reads the result: *1 they are called (thus you can put them in the #define GET_VALUE(result) { \ header file without causing multiple-definition START~(); \ errors at link time). Since the compiler does all while(!COMPLETE(» \ the work of expanding the macro at compile-time, ; \ you get readability and ease-of-use of function READ_AD (result) ; calls, but the run-time speed of in-line code. Because of the code generated by the compiler for 1* Here are declarations for functions defined in a function call, small macros don't necessarily CAPTURE.C. By including this header in another create more code than an equivalent function call. file, you automatically declare these functions. Note the macros don't have semicolons after them; Thus, you can use the functions by including the this forces user to add semicolon so a macro call header and linking CAPTURE.OBJ at link time (see has the same syntax as a function call. *1 the MAKEFILE for details). *1 1* Display 16 bits of ones and zeroes: *1 1* The following address is set by a bird jumper void print_binary(unsigned int); clip on the ADIOOO board. If you change the clip, simply change the following (hex) number: *1 1* Display value as a voltage between -5 and +5:*1 #define base Ox200 void print_value (unsigned int reading); 1* Note that the compiler performs the addition of . this number in expressions like: base + Oxd so no 1* This function waits for AID input to exceed run-time overhead is incurred. *1 "threshold" and then fills "buf" with "bufsize" samples, taken at software-controlled sampling 1* This macro sets analog multiplexer address, so "rate." Note that the effect of "rate" will vary you can select which input the AID will read: *1 depending on type and speed of your machine: *1 #define MUX(channel) outportb(base + channel, 0) void capture(unsigned * buf, int bufsize, 1* (note that channels must be counted 0-7) *1 unsigned threshold, int rate); 1* Data written to the address is unimportant *1 1* This macro starts a 12-bit AID conversion. • • •

MICRO CORNUCOPIA, #51, Jan-Feb 1990 43 you include the DOS.H file (as in CAP­ TURE.H), the compiler will replace any Figure 2-CAPTURE.C of those function calls with in-line code. Thus, the C code should be fairly opti­ 1* Uses the RTD AD1000 board to capture a set of samples. *1 mal. #include "capture.h" Study the code (and my comments #include there) for the details of what's gOi!lg on. 1* Uncomment the following or define it on the compiler command line AID Converter Format (see makefile) with -DTEST_BOARD to generate test code for a newly­ The 12-bit data must be read from the installed AD1000 board: *1 converter (a Harris HI-574A) in two 1* #define TEST_BOARD *1 bytes. The high byte, which you get by reading the board's base address + 8 1* Print a value as Is and Os so you can see the bit patterns from (base+8 in the code), contains the high 8 the AID converter: *1 bits. The low byte (base+9) contains the void print_binary(unsigned int binary) { low four bits, shifted all the way to the int i; left. for(i = 15; i >= 0; i--) Thus the bottom four bits of the con­ putchar«binary & (1 < i» ? '1' : '0'); version are always zero. Notice that the preprocessor macro READ_ADO in CAP­ 1* Print the ADIOOO value as a voltage, so you can compare it with a TURE.H fixes this by shifting both bytes voltmeter reading: *1 to the right by 4. void print_value (unsigned int reading) { The AID converter could have read if(reading & OxOSOO) from 0 to +10 volts. RTD decided to have put char (' +'); it read -5 volts to +5 volts. Thus, when reading &= Ox07ff; 1* strip off "plus sign" bit *1 the converter sees -5 volts, it outputs a else { digital 0; when it sees +5 volts, it outputs putchar('-'); all ones. 1* Flip bits and mask them so a negative number near 0 becomes a small negative value: *1 reading = (-reading) & Ox07ff;

1* now scale and print the value *1 68000 printf("%l.3f", 5.0 * «float) reading) I «float)Ox07ff) ); SK*DOS - A 68000/68020 DOS containing 1* Capture a block of samples: *1 everything you expect in a DOS - on-line help, void capture(unsigned * buf,int bufsize,unsigned threshold,int rate) { mUltiple directories, floppy and hard disk Sup­ unsigned int sample; port, RAM disk and/or disk cache, I/O int i, j; 1* First, wait until the threshold is exceeded: *1 redirection, and more. Supplied with editor, while (1) { assembler, Basic, powerful utilities. Supported GET_VALUE(sample); by Users' Group and BBS. Software available 1* High bit added to threshold to make it a positive AID value: *1 if(sample > (threshold I OxSOO» from other vendors includes C compiler, break; 1* out of while (1) loop *1 Basic, editors, disassemblers, cross-assem­ blers, text formatter, communications 1* Then capture a block of samples: *1 for(i = 0; i < bufsize; i++) programs, etc. Priced at $165 with configura­ GET_VALUE(buf[i]); tion kit" less if already configured for your for(j = 0; j < rate; j++) system. 1* delay by a factor of "rate" between samples *1 HARDWARE - 68xxx systems

#ifdef TEST_BOARD 1* The following program creates a digital voltmeter out of a selected channel of the AD1000. You should run this program and test a 1.5 volt battery, or a potentiometer connected to a DC power source, to insure that your AD1000 is installed and working properly. *1 Mt. Kisco NY 10549 main () { const av = 10000; 1* Averaging factor to remove noise *1 (914) 241-0287/ Fax (914) 241-8607 1* av=lOOOO gives incredibly accurate results (in complete agreement

Reader Service Number 40

44 MICRO CORNUCOPIA, #51, Jan-Feb 1990 with my voltmeter). Try smaller av to see rattle in your system. */ unsigned int sample; Rack &Desk long sum; int i; PC/AT Chassis MUX(O); /* select channel */ while (1) Integrand's new Chassis/System is not another IBM mechanical and electrical sum = 0; clone. An entirely fresh packaging design for(i = 1; i < av; i++) ( approach has been taken using modular GET_VALUE(sample); construction. At present, over 40 optional sum += sample; /* Add up a bunch of samples */ stock modules allow you to customize our standard chassis to nearly any requirement sum /= av; /* calculate the average */ Integrand offers high quality, advanced design hardware along with applications putchar('\r'); and technical support all at prices competi­ print_binary(sum); tive with imports. Why settle for less? put char (' '); print value(sum); if(kbhit(» exit(l);

#endif /* TEST_BOARD */ • • •

Figure 3-DISPLAY.H

/* Declarations for functions to support graphic screen display of voice patterns. */ #include /* The Turbo C BGI header file */

/* "printf"-like function for printing messages while using the BGI in graphics mode. */ void gprintf(char * format, ... ); /* Display the graphics "viewport" values (for debugging) */ void display_viewsettings(struct viewporttype view); Accepts PC, XT, A T Motherboards and Passive Backplanes /* Types of scaling for display_series: */ Doesn't Look Like IBM typedef enum ( quarter, half, full, twice, quad } scale_factor; Rugged, Modular Construction /* Display a series of numbers as dots on the screen: */ Excellent Air Flow & Cooling void display_series (unsigned * series, int series_size, int offset, Optional Card Cage Fan· scale_factor vertical_seale_factor, Designed to meet FCC scale_factor horizontal_seale_factor, int color); 204 Watt Supply, UL Recognized 145W & 85W also available • • • Reasonably Priced

This means that a volts produces a jumper, change the base. (Otherwise you ~QVi reading with only the high bit (bit 11, won't get to first base.) counting from zero) set. When the high CAPTURE.C defines print_binaryO, bit is set, it's like turning on the plus which prints a 16-bit value as a binary ~Passive Backplanes sign. This, of course, is quite different number (this often detects problems) and from normal 2' s compliment arithmetic. print_valueO, which displays the value ._.... ••=W=;;=="r=;. -- ...... ;;::::;. . Notice the code in the function from the AD1000 as a voltage. By defin­ .. - . -- --_--- .... - ==~=~~: ~~~ print_valueO to account for the sign. ing the name TEST_BOARD (see the MAKEFILE to do this on the command Capturing Data Points line; just type "make meter"), you can Call or write for descriptive brochure and prices: The "magic numbers," which are the create a standalone program which pre­ 8620 Roosevelt Ave. • Visalia, CA 93291 I/O port locations used in CAPTURE.H, tends it's a digital voltmeter. Compare 209/651-1203 come from the documentation for the the output of the program with your TELEX 5106012830 (INTEGRAND UD) FAX 209/651-1353 AD1000. Notice that all the numbers are standard voltmeter for verification. We accept Bank AmericardlVlSA and MasterCard relative to a base address called CAPTURE.C also contains capture 0, IBM. pc. XT. AT trademarks of International Business Machines. (curiously) base. This address is set by a the function used in VOICE.C to capture Drives and computer boards not included. jumper on the board. If you change the a set of voice samples. Notice that you Reader Service Number 22 MICRO CORNUCOPIA, #51, Jan-Feb 1990 45 must pass the address and size of the buffer where you want the samples Figure 4-DISPLAY.C stored, as well as the threshold and the sampling rate. The threshold lets you cut /* Functions to support displaying a voice pattern on the screen using off background noise (i.e., when you the Borland BGI graphics functions. */ aren't speaking into the microphone). lIinclude' lIinclude Displaying Data Points lIinclude /* va_start 0 , etc. */ Figure 3 contains the declarations for lIinclude the functions which display the data lIinclude points. I used gprintfO and display_ view­ lIinclude "capture.h" settingsO for debugging and left them in lIinclude "display.h" for your enjoyment. The important function is display_ser­ /* This is a "printf"-like function for printing messages while using iesO, which takes any series of points th~ BGI in graphics mode. It is limited because it always starts at (not necessarily collected from the the left and doesn't wrap at the bottom of the screen, but it's useful ADlO00-you can create your own ser­ for debugging. */ ies). It then displays it after moving the void gprintf(char * format, ... ) ( /* graphics printf for BGI */ whole group up or down by amount static int text line = 0; "offset," and scaling the output using char textbuf[80]; verticaCscalejactor and horizon­ va_list argptr; taCscale_factor. va_start (argptr, format); The definition for display _seriesO is in vsprintf(textbuf, format, argptr); Figure 4. I chose to make a local copy of va_end (argptr) ; the series before performing the scaling outtextxy (0, textline, textbuf); so the original series isn't touched. The textline += textheight("x"); /* move to the next line */ call to the ANSI C library function cal­ locO allocates the space on the heap void display_series(unsigned * series, int serieS_Size, (which is later de-allocated with freeO). int offset, scale_factor vertical_scale_factor, scale_factor horizontal_scale_factor, int color) int i, j, step; /* create a local copy of the array: */ int * lseries = (int *) calloc(series_size, sizeof(int»; memcpy(lseries, series, series_size * sizeof(int»; /* First, perform vertical scaling of the local array: */

u.s. Postal Service Statement of Ownership, Management switch (vertical_scale_factor) ( and Circulation (Required by 39 U.S.C 3685) lA)Title of Pub­ case quarter: for(i = 0; i < serieS_Size; i++) lication: MICRO CORNUCOPIA lB.)publication Number: 0747-587X 2.)Date of Filing: 9-29-89 3.)Frequency of Issue: Bi­ lseries[i] »= 2; /* divide by 4 */ monthly 3A)Number of Issues Published Annually: 63B.)An­ break; nual Subscription Price: $18.00 4.)Location of Known Office: 155 NW Hawthorne, Bend, Oregon 97701-2917 5.)Location of case half: for(i = 0; i < series_size; i++) the Headquarters or General Business Offices of the Publish­ ers: 155 NW Hawthorne, Bend, Oregon 97701-2917 6.)Name lseries[i] »= 1; /* divide by 2 */ and Complete Address of the Publisher, Editor, and Managing break; Editor: Publisher: David ]. Thompson 155 NW Hawthorne, Bend, Oregon 97701-2917; Editor: David ]. Thompson 155 NW case full: break; /* no change */ Hawthorne, Bend, Oregon 97701-2917; Managing Editor: case twice: for(i = 0; i < serieS_Size; i++) David ]. Thompson 155 NW Hawthorne, Bend, Oregon 97701- 2917 7.)Owner: Micro Cornucopia, Inc. PO Box 223, Bend, lseries[i] «= 1; /* multiply by 2 */ Oregon 97709-0223; David]. Thompson 1259 NW Iowa, Bend, break; Oregon 97701-1001; Sandra S. Thompson 1259 NW Iowa, Bend, Oregon 97701-1001 8.)Known Bondholders, Mortgagees, case quad: for(i = 0; i < series_size; i++) and Other Security Holders Owning or Holding 1% or More lseries[i] «= 2; /* multiply by 4 */ of Total Amount of Bonds, Mortgages or Other Securities: None 10.)Extent and Nature of Circulation: Average Number break; of Copies Each Issue During Preceding 12 Months A)Total Number of Copies Printed: 29,104 B.)Paid Circulation: I)Sales Through Dealers and Carriers, Street Vendors, and Counter if (offset) Sales: 12,059 2)Mail Subscription: 9,555 C)Total Paid Circula­ tion: 21,614 D.)Free Distribution by Mail, Carrier, or Other for(i = 0; i < series_size; i++) Means, Samples, Complimentary, and Other Free Copies: 507 lseries[i] += offset; E.)Totai Distribution: 22,121 F.)Copies not Distributed: 1)Office Use, Left Over, Unaccounted, Spoiled after Printing: 893 2)Re­ /* Now display the array according to horizontal scale factor: */ turns from News Agents: 6,090 G.)Total (Sum of E, Ft and switch (horizontal_scale_factor) ( 2)-Should Equal Net Press Shown in A: 29,104; Actual Num­ ber of Copies of Single Issue Published Nearest to Filing Date: /* display a part of the series in the whole space: */ A)Totai Number of Copies Printed: 28,000 B.)paid Circulation: case quarter: for(i = 0; i < (series_size/4); i++) 1)Sales Through Dealers and Carriers, Street Vendors, and Counter Sales: 17,396 2)Mail Subscription: 9,178 C)Totai Paid putpixel(i«2,lseries[i], color); Circulation: 26,574 D.)Free Distribution by Mail, Carrier, or Other Means, Samples, Complimentary, and Other Free Co­ break; pies: 274 E.)Totai Distribution: 26,848 F.)Copies not Dis­ case half: for(i = 0; i < (series_size/2); i++) tributed: 1)Office Use, Left Over, Unaccounted, Spoiled after Printing: 1,125 2)Returns from News Agents: 27 G.)Total (Sum of E, Ft and 2)-Should Equal Net Press Run Shown in A: 28,000

46 MICRO CORNUCOPIA, #51, Jan-Feb 1990 putpixel(i«l,lseries[i], color); break; /* display the whole series in the whole space: */ case full: for(i = 0; i < series_size; i++) putpixel(i,lseries[i], color); break; /* display the whole series in a smaller space: */ 25 MHz 8-bit case twice: for(i = 0; i < (series_size/2); i++) ANALOG-TO-DIGITAL CONVERTER putpixel(i, lseries[i«l], color); break; Based on the TRW THC1068-1 case quad: for(i = 0; i < (series_size/4); i++) hybrid flash converter, its high putpixel(i,lseries[i«2], color); signal-to-noise ratio yields ex­ break; cellent accuracy at the Nyquist limit.

free(lseries); /* release local copy of the array */ • 4 KB of cache SRAM or to host as converted at DMA speed void display_viewsettings(struct viewporttype view) { • I/O or DMA data transfer /* The following macro was used during debugging to display all the • 10 MHz full-power bandwidth viewport settings. Notice the use of the new ANSI C preprocessor • 3.92 mV resolution directives: the "stringize" directive (#) which takes the argument • 16 jumper selectable base and makes it into a string, and the "paste" directive (##) which addresses takes two names and creates a variable name from them. Notice also • External clock and trigger inputs that in: TTL compatible #arg " = %d" • Software source code included the preprocessor concatenates the two strings together. */

#define P(arg) gprintf(#arg " = %d", view.##arg) P(left); P(right); P(top); P(bottom); P(clip); getchO; ALSO AVAILABLE AS A KIT • • • FOR $99, INCLUDING: • Printed Circuit board • Software Figure 5-VOICE.C • Manual & assembly instructions

/* Display a voice pattern using Borland BGI graphics functions. */ Requires: PC compatible 112 length #include /* kbhit() */ 8-bit expansion slot. DOS 2.11 or greater. EGA, VGA or Hercules dis­ #include /* calloc() */ play needed for graphic representa­ #include "capture.h" tion of data. #include "display.h" /* includes graphics.h */ mainO { int graphdriver = DETECT; /* will request autodetection */ struct viewport type view; int i, graphmode, color; unsigned int * points; /* Initialize graphics. The string in the third argument tells the function where to look for the graphics drivers (you may need to change it for your own environment): */ initgraph(&graphdriver, &graphmode, "c:\\turboc"); color = getmaxcolor(); /* works with all machines */ getviewsettings(&view); Silicon Alley ~ /* display_viewsettings(view); */ /* for debugging */ P.o. BOX 59593 /* create an array according to size in pixels of the monitor: */ RENTON, WA 98058 points = (unsigned int *)calloc(view.right, sizeof(int»; 206.255.7410 MUX(O); /* select the channel to read */ while(!kbhit(» { © 1989 Silicon Alley Inc. tHude is a trade­ mark of Silicon Alley Inc. Other brand or product names are trademarks or regis­ Continued on page 48 tered trademarks of their respective hold­ ers. Prices and specifications subject to change.

MICRO CORNUCOPIA, #51, Jan-Feb 1990 47 The ANSI C library function memcpyO copies the series into the new capture (points, view. right, 1000, 0); memory. Use this process whenever you for(i = 0; i < view.right; i++) want to make a local copy of an array. points[i] »= 3; /* do some rough scaling */ Notice you must pass the size of the display_series (points, view. right, 20, half, full, color); array into the function. Once inside the clearviewport(); function, the array simply looks like an address, so there's no way to figure out closegraph(); its size. Although callocO and memcpyO are • • • quite efficient, making a local copy of the array slows things down a bit, as does the scaling and offset process. I reasoned Figure 6-MAKEFILE for VOICE.EXE and METER.EXE that data acquisition is the critical process, and display can be done at lei­ # Change these two paths for your particular installation: sure. You can of course hard-code the # path for standard include files: display process, and make it much INCLUDE = \turboc smaller and faster. # path for libraries: LIB = \turboc ANSI Preprocessor Tricks # memory model: The function display_ viewsettingsO in MEM = s Figure 4 tells you how big the screen is, in pixels, using the gprintfO function # Following rule tells make how to create a .obj file from a .cfile: (discussed later). The BCI figures out .c.obj: how big the screen is at run time, after it tcc -c -m$(MEM) -f -I$(INCLUDE) $*.c loads the graphics driver from disk when you call the BCI function initgraphO. The # The main rule-this will be invoked if you simply type "make": graphics drivers must be available; the voice.exe: voice.obj capture.obj display.obj program won't run without them. tcc -L$(LIB) -m$(MEM) voice.obj capture.obj display.obj \ You can make a viewport of any size, graphics. lib but the system defaults to full screen. Thus, by calling the BCI function # If you type "make meter.exe" the following rule will generate a getviewsettingsO (as in Figure 5), you # program called CAPTURE.EXE which will test your AD1000 by turning it load the argument with the current # into a simple voltmeter, so you can compare the readings with a DVM. screen parameters. display_ viewsettingsO meter.exe: will print this information. tcc -c -m$(MEM) -f -I$(INCLUDE) -DTEST_BOARD capture.c I retain display_ viewsettingsO in tcc -L$(LIB) -m$(MEM) capture.obj order to use the new ANSI preprocessor capture.exe meter.exe functions. I find these tremendously capture.obj helpful when debugging or doing any re­ petitive production of code. Notice the # These are the dependencies. When any of the files in the dependency macro: # list change, the .obj file is re-made according to ".c.obj" rule: voice.obj : voice.c capture.h display.h #define P(arg) gprintf(#arg" %d",\ capture.obj capture.c capture.h view.##arg) display.obj : display.c display.h

The ANSI C preprocessor will take • • • #arg al1:d "stringize" it; that is, it will take whatever argument is substituted for arg and tum it into a string. Now, since there is no punctuation between #arg and " = P (left); clone of printfO. At run-time, printfO an­ %d", the preprocessor will perform string alyzes its format string and goes through concatenation and tum the two strings will produce: the arguments to print them according to into a single string. ' the format. Normally, this would be a Finally, the ## is the token pasting gprintf("left = %d", view.left); very unpleasant task to duplicate, and operator. It will take the argument to the one I would never attempt. But the ANSI left and "paste" it to the argument on the As you can see, the additions to the C library provides functions declared in right to create a new token. (Note: not a preprocessor in ANSI C can be very use­ STDARC.H, which make writing your string, but something the compiler will ful. own printfO-like function quite easy. treat as a name for a function, variable, gprintfO is one example. typedef, struct, etc.) This means, for ex­ Write Your Own printfO The basic technique is this: define a ample, the macro call- The function gprintfO in Figure 4 is a va_list and pass it to va_startO along

48 MICRO CORNUCOPIA, #51, Jan-Feb 1990 with the address of the format string. these values with the display_ viewset­ Then you can either pick through the ar­ tingsO function in Figure 4. guments yourself (see an ANSI C refer­ Because you never know until run­ ence) or call the special functions time how big your screen is going to be, vprintfO, vfprintfO, or vsprintfO, which you can't determine beforehand how big are printfO, fprintfO, and sprintfO for the buffer to hold your data points .• frotll BruceEck~I'sJ.lsjl1g0Aj+. variable argument lists. should be. Dynamic memory allocation I used vsprintfO to send the results to comes to the rescue again-by using cal­ ..•.. t~~~oJ~1_~~{~2~§~illpJffii;i.··· a buffer called textbuf. This is very locO with the value of view.right, I get an 500K:·complete.sollrc~fr()rt) •• th.~ powerful because it gives you all the out­ array of ints which is the correct size for •• •.. b()()k. .. pI u~... aqdi~i9l)aL"p r9J(,wts~H. put formatting abilities available in any screen. Tested .. wlth>Zortech. C+.± .. >& .... · printfO. The system spends most of its time in Glc)ckenspier>¢±"#/(C<:>irtM6rt~\ After you're finished manipulating the while loop, capturing a series of yie\V).··All chap~~r~an.(I.proj~cts 1.1I1separatesubdlr~ft()p~~,~~c:11 the variable argument list, you must call points and displaying that series. When with .. a "makefile;If/>.» ... va_endO to clean everything up. After you press any key, the program cleans that, I call the BGI function outtextxyO to up (by calling the BGI function close­ send textbuf to the screen in graphics graph()) and quits. Try making the dis­ Projects··.i6tllJ~.~.: ••• ••••••••••.• » =~~;!ly-sije(larrays mode. I keep track of the line I'm on with play_series 0 arguments adjustable from a static variable called textline (which the keyboard. »SirnpleDataba.s~ . keeps its value between function calls). » TAWK:ADailibase· hiter.. .. This function could be cleaned up quite a Fast Fourier Transform . preter ...... •.. .. .•...... )« ...... bit for "real" use, but for debugging it's I considered doing an FFf on the ... » ATinle-Based<:()JjtroISYs-. quite handy. waveform in order to see the frequencies tern ...... < ...... in my voice, but I ran out of time. If you » Simulation EX~lnple.· ...... Let's Do It want to add an FFf to this system, an ex­ » Figure 5 is the mainO function which cellent reference is Numerical Recipes in C. tenlObject,;Orierite~MeriifSy~- ...... uses the CAPTURE and DISPLAY func­ (Editor's note: Their recipe for digits in light tions to display your voice on the screen. oil (#2) is unreal.) It includes the source » Text-screenWindo-ws » MathernatiCalulgtriicl.ass The BGI function initgraphO initializes code for an FFT in C plus a thorough ex­ . ', ...... the graphics screen according to the ar­ planation, so it shouldn't be too hard to » CAD ·delTIo: nl011secreates gument graphdriver, which is set to auto­ adapt it to this project. andtTIoves graph ks ...... mine which hardware you have and load Three issues ago in the "parallel port I·» Graphicushm?~~<()1JJ¢c~ •.••••• < ••. file transfer" article, I noted that Herc the appropriate graphics driver from Code·used·t()··discover.colh~ disk. It looks for the graphics driver in clone cards have parallel ports which pilerbugs< . the path specified by the third argument. seem a bit tender (I blew mine out while To improve this program for general trying to transfer a file). I couldn't find And ···.M llcl1>I\1()rel< . the chip which drove the port anywhere, use, you may want to tell the user to set To ··Order,.send$75ch~d(t6 an environment variable to the path and assumed it was custom (i.e., unavail­ Revollltion2·Jaddr~ssbelow).<· where the graphics drivers are, then read able). Overs.eas. ordersplea~~~cld •.. $7 the environment and use that as the third John Welch wrote to tell me he had for alrmall,andsendaU.S~ argument for initgraphO. You can also also zapped his chip, a UMC 82Cll, but check in . U.S. fUl1dsor>aniriter,;> fold the path in via a compiler com­ that they could be obtained from: riational...... postal rridheY<:>fclei.·.····· mand-line argument and change it in the makefile. John Kennaugh Revol u ti()fl2>pt()vicl~s>#I1-. The BGI function getmaxcolorO re­ 5725 St. Charles Road, Suite 202 andoff-siteCf±>¢pri$t.iltirig< turns the number corresponding to the Berkeley, IL 60163 .···&· •.•• ·.·.·:.· .•• ·.•••.••• } .•..••..•...•..•• any PC adapter. C++ version 2.0 and Borland's Turbo The BGI function getviewsettingsO C++. ···R.ev()lll~i()t1.2.·.······ .. ·· ..· will place the parameters of the current viewport into the function argument (no­ i .. Brl.lceEckeF<.· .. . tice you're passing an address, so "view" • • • .. ... :308> MefedithStfeef:· is filled with the parameters). To find out I

MICRO CORNUCOPIA, #51, Jan-Feb 1990 49

------_._---_._.__ ..... _. Getting Started In Hardware

1 Pkg of 270 Ohm V4-watt resistors On the top of the 555, you'll find I've gotten a lot of requests lately for a (271-1314 @ 39¢.) either an engraved dot next to one pin, or real beginner's level hardware project. Okay, 1 22 JlF electrolytic capacitor (272-1026 an engraved notch in the center of one here it is, simple enough to warm anyone's @69¢.) edge. This dot (or notch) provides orien­ irons. 1 Pkg of 3 spools solid 22 Gauge tation information for most ICs; pin 1 is hook-up wire (278-1306 @ $3.49) immediately next to the dot, and immedi­ 1 Pkg of 9v battery snap connectors ately counterclockwise of the notch (look­ f you work/play primarily with soft­ (270-325 @ $1.19) ing from the top of the chip). See Figure 1 ware, building electronic projects 1 9v battery for additional information. Iopens a new area of exploration. No Your first project uses the 555 timer IC Notice that with the 555 plugged into libraries, no editors, no optimizing com­ to blink a red light-emitting diode (LED). the breadboard, each pin occupies one pilers ... this is really low-level stuff. Building this circuit up on the bread­ hole out of a row of five holes. All five Here, you get your hands dirty playing board lets you finish the thing quickly, holes in a row are connected; anything with wires, resistors, and sockets. When rewire any errors with a minimum of plugged into an empty hole connects to I talk about tools, I mean tools. fuss, and try changing components. It's a anything else in that row. To connect a Yet your entry into hardware con­ great way to start. resistor or capacitor to one of the IC's struction need not be expensive. A couple Begin by clearing off some table space, pins, just plug one of the component's of trips to the local Radio Shack and you . opening the breadboard and 555 timer Ie wire leads into a hole in the same row. could have your first project running for packages, and taking a moment to look Refer to the schematic in Figure 2. under $20. That's probably less than you over the 555. Plug the eight metal pins of First, plug one lead (either one will do) of spent on your last "save the galaxy" the IC into the breadboard so the legs a 10K resistor into a hole connected to game! straddle the wide gap down the center of pin 8 of the 555. Bend the leads of the (Note: I will deal almost exclusively the breadboard. resistor into a horseshoe shape and plug with Radio Shack in this article. I don't work for Radio Shack, in fact I don't know why anyone would want to work for Radio Shack, but they are every­ where. You can get your supplies a lot of other places; but if you ever get stuck on a Sunday afternoon and just have to have a 555 timer, I'll bet next week's lunch. money you'll wind up at RS.)

First, Breadboard It To get started in hardware, you need to build something. Editor's note: this is a rite of passage. So head on down to the Shack (or to your nearest hacker buddy with a well-stocked junk box) and get the following: 1 Modular IC breadboard socket (276- 175 @ $7.49 or 276-174 @ $11.95) 1555 timer IC (276-1723 @ $1.19) 1 Pkg of jumbo red LEOs (276-041 @ 69¢.) 1 Pkg of 10K Ohm lA-watt resistors (271-1335 @ 39¢.) The Author's Lash-up (er, Breadboard Version). Note the Careful Lead Dress to Reduce Spurious RF Emissions. 50 MICRG CORNUCOPIA, #51, Jan-Feb 1990 By Karl Lunt 2133 186th Place SE Bothell, W A 98012 (206) 483-0447

the remaining lead into a hole connected battery connector appears on the sche­ The 22 flF electrolytic capacitor. Like the to pin 7 of the 555. Now check the sche­ matic; the downward-pointing triangle LED, it has two leads and those two are matic to see how this resistor connection means ground. This is generally, though different. Wire it up backwards and it is pictorially represented; the sawtooth not always, the most negative point in won't work (electrolytics can make symbol drawn between pins 8 and 7 is the circuit. (I'm positive about this.) strange noises and smoke and ooze if the resistor you just plugged in. Almost done! Now take a close look wired backwards). Do the same with another 10K resis­ at the LED. Notice that the rim of the red The electrolytic cap has one lead tor, plugging it into the board so it runs plastic case has a flat spot next to one marked with a string of minus signs and from Ul-7 to Ul-6. (On the schematic, Ul lead (this same lead may be the longer of (generally) a stripe. You must connect means the 555, and the number after the the two, but no guarantee). The flat edge this lead to the more negative circuit dash refers to the pin number of the com­ marks the cathode lead; this appears on point of the two leads. The other lead of ponent.) the schematic as a flat bar. The other lead the cap matches the plus-sign shown on So cut a couple of 2" pieces of hook­ connects to the arrowhead. the schematic. Connect the negative lead up wire and strip V4" of insulation from Unlike wiring the resistors (which of the cap to pin Ul-l and the positive..,· each end. Connect one piece of wire from have no orientation), you must get the lead to pin Ul-2. Ul-2 to Ul-6. The other wire runs from LED leads wired exactly as shown on the Take some time to check your wiring Ul-4 to Ul-8. While you're at it, notice schematic. Plug the LED into the bread­ against the schematic and against the in­ how these wires appear on the schematic. board so the cathode lead (flat edge) fits structions. If anything looks wrong, it Now for the battery connector; make into a totally empty row of pins. The probably is. sure that both the red and black wires of other LED lead (arrow head) connects to Okay, plug a 9-volt battery into the the connector have at least %" of bare Ul-3. battery connector. The LED should blink wire showing. Do not connect the battery Next, connect a 270 ohm resistor be­ about once per second. If so, congratula­ yet! Run the red wire to Ul-8 and the tween the cathode lead of the LED and tions! If not, disconnect the battery before black wire to Ul-1. Notice in particular pin Ul-l. something melts and go back over the how the black (negative) lead of the We have only one component left. circuit again. (Is your battery good?)

Figure 1-Pinout and Orientation of the 555 Timer Figure 2 -Schematic of a Basic 555 Oscillator V+ (9 VOLTS) ENGRAVED ENGRAVED DOT NOTCH R1 8 4 10K

8 8 R2 U1 3 2 7 2 7 10K 555 555 555 LED1 3 6 3 6 R3 4 5 4 5 C1 270n 22~F TOP VIEW TOP VIEW

Using the dot or notch on an IC package to locate pin 1. A simple LED blinker. R1, R2, and C1, as shown, will This same identifying convention holds for all other DIP give a pattern of one second on, one second off. Change (dual-inline package) ICs. these values to see the results on rate blink and duty-cycle.

MICRO CORNUCOPIA, #51, Jan-Feb 1990 51 Once you get it working, think about For the soldering iron, try the Shack this one the hard way!) is the plastic (or the implications of what you just accom­ 64-2070 unit. Rated at 25 watts, it comes nylon, Teflon, or whatever) coating over plished. No software, no compiler, no with a decent-sized tip (large enough for a bare wire. The covering prevents that fancy debugger; yet the dam thing actu­ speaker wires, small enough for IC leads) wire from contacting other conductors. ally does something! I tell you, there are and a little stand to hold the tip off the You can easily remove plastic insula­ possibilities here. I'll bet someone could table. (The latter comes in handy when tion, by far the most common type, by build a fairly complicated thingamajig you're married.) If you stay with hard­ using the insulation strippers mentioned that used no software at all! ware long enough, you'll soon replace above. Other types of insulations may re­ But a breadboarded circuit has limited this open-top stand with a complete cage, quire expensive heat strippers or similar use; although you could put it into a but the stand will do for now. Price: tools. For now, stick to the plastic­ small chassis and use it for whatever you $6.29. covered hookup wire. need a blinking LED for, the circuit Be sure to pick up some rosin-core Gauge refers to the thickness of the would not withstand much abuse. To do solder;· 64-005 gets you 2.5 ounces for bare wire, regardless the thickness of the the job right, you have to do some $3.19. If you use up this much solder, insulation. This gauge number some­ soldering. you're either hooked on hardware or ter­ times appears as AWG (for American minally clumsy. In the old days, you had Wire Gauge), as in 24 AWG. The larger Your First Tool Kit to be careful about getting rosin-core ver­ the number, the thinner the wire. Just as with software, a set of well-de­ sus plumbing solder; the latter contains For example, 30 gauge wire gets used signed tools makes any project easier. As an acid core that eventually destroys any often for wirewrapping digital circuitry. a minimum, you'll need: connection you use it on. Today, you This wire measures 0.01" in diameter; its A small, low-power (10-25 watt) won't need to worry about this distinc­ tiny diameter makes it easy to work soldering pencil (or "iron") tion if you buy from an electronics store. with, though it cannot carry much cur­ A pair of needle-nosed pliers The needle-nose pliers (64-1843 is a rent. A common size for two-wire power A pair of wire cutters nice-looking pair at $4.49) may be the cords and speaker cable is 18 gauge wire; A small spool of rosin-core solder most often-used item in your toolbox. it measures 0.04" across and handles up A pair of wire strippers (to strip insu­ Get a good pair. Editor's note: These pliers to 16 amps. lation from hookup wire) can double as chop sticks when you're having Most simple hardware projects will If you stay with hardware for long, canned chinese food at home. use 22 or 24 gauge for "point-to-point" you'll replace these first tools as you out­ The handle should fit comfortably in soldering, 18 or 20 gauge for power ca­ grow them. No big deal, you probably your hand as you open and close the bles, and 30 gauge for wirewrapping. outgrew your first text editor, too. pliers. If you have to rearrange your face Stranded wire refers to a single con­ while you pick up a wire, try another ducting wire made of many smaller bare pair. Check that the tips of the pliers wires, all covered together by a single meet precisely. layer of insulation. The power cords Use the same care in selecting your around the house use stranded wire to Mr. MOXTM wire cutters (also known as diagonal cut­ make them more flexible; without the ters; old-timers call them "dikes"). flexibility, they would soon break. When $99.95 Shack's 64-1841 ($4.49) matches the size you wire up a small project, you will of the needle-nose pliers above. Again, normally use solid wire for the point-ta­ check the feel of the handle and make point connections and stranded wire for sure the cutting edges close completely any cables that will be wiggled around Modem operated when you clamp down. By the way, often. power controller most dikes cut. copper wire and other for your PC. items equally soft. Use them on steel wire Gentlemen, Warm Up Your Irons or nails and you will buy new ones. Soldering is like riding a bicycle-it's Makes any PC with Insulation strippers rank as a begin­ easy when you know how to do it. external modem ner's tool. Buy them to keep your frustra­ Start by measuring and cutting remote-accessible! tion level down as you get started. If you several pieces of solder exactly V4" long. stay with the hardware hobby, you will Place one of these solder pieces on the Software included. eventually use the dikes as insulation table top in front of you. Clear your strippers. The Shack model 64-2129 mind of distracting images and stare Order direct from: ($2.79) handles any wire from 10 to 24 fixedly at this little bit of solder. Become gauge, an ample range for beginning one with the solder. Epoch Data projects. This represents the most solder you P.O. Box 1093 will likely need to make any single elec­ Cardiff, CA 92007 What Were Those Terms? tronic connection. When I started out in electronics, well­ Beginners cause more problems by (619) 543-9423 intentioned people used all kinds of using too much solder than by not using terms I didn't know, taking my silence enough. Too much solder on a connec­ for understanding. Allow me to explain a tion causes short circuits, poor connec­ few key words and phrases .... tions (that don't hold as they should), Reader Service Number 135 Insulation (don't laugh, I had to learn and an ugly-looking product. Resolve

52 MICRO CORNUCOPIA, #51, Jan-Feb 1990 now to be a craftsman in any hardware solder connection. Get into the habit of Clean the solder off the tip, using your project you undertake; make each con­ tinning your iron after every two or three damp cleaning pad. nection the best you know how to make. solder connections, or anytime it sits for Repeat these steps a few times, always Now plug the soldering iron in and more than a few minutes. trying to judge when you have used let it heat up; this should take about five Editor's note: When I heat a new iron for about 1f4" of solder. If necessary, cut off a minutes. While you're waiting, get a the first time, I hold solder against the tip 1f4" length of solder as before and melt it small sponge (about 2"x3" and about 1f4" while it's heating. Heat causes oxidation on onto the tip again, to refresh your thick), soak it in water and wring it out. an untinned tip. Once it's oxidized, you have memory. If you can't find such a sponge, fold a to file off the corrosion, perhaps damaging the . clean cloth rag into a pad about 1f4" iron tip coating. So, smother the tip in solder Now Add Some Wire thick, then soak and wring that. In a the instant it's hot enough. (Prevents oxida­ Use your wire-strippers to remove all pinch, you can also use a paper towel tion.) Then wipe off most of the solder from the insulation from a 4" length of 22 folded several times to get the right the face of the iron you're going to use just as gauge wire. Cut the wire off the spool at thickness. you're taking the iron to the work. That way the insulation, so you end up with a Pick up the soldering iron as if it were the face will be bright and shiny clean. Some length of bare wire. a pencil, using whichever hand you use of the solder from the joint will cling to the Repeat this step with several I" best. Carefully touch the tip to one of the iron, helping to keep it tinned. lengths of wire. small pieces of solder you cut earlier and Cut a three-foot length of solder off Now hold a I" wire in your strength watch the solder melt onto the tip of the the spool and roll it into a convenient hand and the needle-nose pliers in your iron. Then wipe the tip of the iron across shape; I use a loose coil, like a coil of precision hand. Carefully bend the end of the damp sponge to clean off most of the rope. Put the large spool of solder away; the wire into a small hook, just large melted solder (this should only take one for now, you can use the short spool you enough to fit around the long, bare wire or two quick swipes). just made. you cut previously. Loop the hook over Repeat the above steps two or three Pick up both the soldering iron and the long wire (somewhere near the times for each side of the soldering iron's the solder, then touch the solder to the middle will do) and use the needle-nose tip. tip of the iron. Allow only 1f4" of solder pliers to clamp the hook closed. You have just cleaned and "tinned" to melt onto the iron's tip. (You do re­ If you do these steps properly, you your soldering iron tip, one of the most member what 1f4" of solder looked like should be able to pick up the 4" length of important steps toward making a good after it flowed onto the tip, don't you?) wire and the smaller wire will remain

iiQEditisa i i QEdit is, without question, great piece of soft­ the smallest, fastest, most versatile QEditTM ware. Highly text editor in the DOS world. ~ ~ recommended. ~ ~ P. L. Olympia, Ph.D., ADVANCED John C. Dvorak, DBMS PC Magazine July, 1989 September 12, 1989

Js~~ ~~; :iu~ text·-i~~r1u1~ M editor at an affordable price. LY~ EDITOR QEdif $5495 AlSO.~AllABlE $79 00 ADVANCED Q EdIt for OS/2

If you are looking for the paste or template operations • QEdit supports 1Ol-key key­ To order direct call right combination of price • Exit to DOS (or a DOS shell) boards, EGA 43-line mode, and from within QEdit VGA 50-line mode 404·641·9002 and value in a text editor, • "Pop-Down" menu system and • Great for use with laptops­ then give QEdit a try. At customizable Help Screen QEdit edits files entirely in memory, ·IEEI rz .Cards ' ONLY $54.95 and a • Column Blocks saving drain on laptop batteries . Add $3.00 for shipping-$l 0.00 money-back guarantee­ • Easy to use macro capability • Compact-Even with all these , for overseas shipping. UPS 2nd you just can't go wrong. including keyboard recording features, QEdit requires less than DAY AIR available within • Wordwrap and paragraph SOk of disk space the U.S. for ONLY $5.00 QEdit is fast, easy to use, and simple reformat capabilities Full 30 day COD's accepted-please add $3.00 to install. At the same time you get • Recover deleted text Georgia residents add 4% sales tax . all of these features and more. • Automatic indentation for C money-back guarantee • Completely configurable, in­ programming System Requirements ____ SEMWARE™ cluding keyboard and colors • Import files and export blocks QEdit requires an IBM PS/2, PC/AT, PCIXT, 4343 Shallowford Rd. • Suite C-3 • Edit as many files simultaneously • Locate matching braces and PC, PC/Jr, or compatible. Minimum system Marietta, GA 30062-5003 as will fit in memory requirements are 64 KB of memory, PC-DOS parentheses 2.0 or MS-DOS 2.0 or greater, 50 KB of disk QEdit and SemWare are trademarks of • Open up to eight windows • Execute command line compilers space. QEdit runs GREAT on floppy based Applied Systems Technologies, Inc. • 99 scratch buffers for cut-and- from within QEdit systems and laptops. © 1989 Applied Systems Technologies, Inc.

Reader Service Number 127 MICRO CORNUCOPIA, #51, Jan-Feb 1990 53 firmly attached where you clamped it. If the smaller wire slips, spins, or falls off, Figure 3-0ther Ideas for the Output Device redo the hook and reclamp the wire. Practice this hook-and-clamp routine several times, using the I" wires you had Ui~3 ~ U~3 --...---8-11-----,1 cut. Each time, make sure that the shorter PB1 ~ SPKR1 wire clamps firmly onto the longer wire; (1000 if the connection is loose or shaky, redo OR MORE) it. Now you get to try some real solder­ PIEZO-BEEPER FOR MINIATURE SPEAKER FOR ing. Clean and tin the tip of your iron. SOUND OUTPUT METRONOME-TYPE CUCKS Pick up the solder in your strength hand and hold the iron in your precision hand. Select one of the clamped wire connec­ ~TO BAND ON tions you just made as your first target. ""-- SWITCHED The next sequence of steps should all be t- CIRCUITS ~DE done in about three seconds. TO Firmly hold the iron's tip against the U1-3 connection, touching both the long wire and the short wire simultaneously. Hold 01 Ll.":~RLY1 (5VDC rCATHODE RELAY) the tip on this connection for about one -----t[>:>I-I---- second. Touch the solder to the wires at their junction and flow about 1/4" of solder RELAY FOR CONTROLLING OTHER ORIENTATION INFORMATION FOR DIODES into the connection. DO NOT touch the CIRCUITS solder to the iron's tip! Remove the solder from the heated wires after you A short list of other output devices that can be controlled by the 555 circuit. feel 1/4" of solder has melted into the The diode is intentionally connected backwards in the relay circuit: do not leave connection. it out if you use the relay. Hold the tip against the soldered junc­ tion for an additional second, then re­ move the iron. DO NOT touch or move the wires, and do nof blow on the heated on your iron. Never use the iron's tip to properly and you don't need sockets, connection. Wait about five seconds for pry a connection loose or press a connec­ right? But if you make a mistake.... the connection to cool. Clean your iron tion closed, use your needle-nose pliers The project board (and the other and set it back down on its stand. for that. Radio Shack predrilled boards like it) Now take a moment to inspect your Always remember to unplug your may be the best experimenter's bargain work. The tiny gaps in the hook should iron when you finish your work; your around. In the old days, you had to bend be filled with bright, shiny solder. There iron's heating element (not to mention leads and connect wires because the perf­ might even be a thin sheen of solder on your house) will last longer. Always put board didn't have solder pads on each some of the wires. You should clearly see the iron back onto its stand when you hole. These project boards, with pre­ the shape of the wires, as well as the finish soldering. etched pads and channels, make wiring a hook in the connection. Never, ever, use a file to clean the snap. If you cannot see the shape of the iron's tip. Except for a damp cloth, the Notice that the component side of the wires or of the hook, you used too much only other cleaning tool you might project board carries a silk-screened solder. Try another connection using less possibly (I say, possibly) need would be white copy of the copper pads that are solder. a wire brush; and you would only need etched on the solder side. You can use If you can see copper inside the hook, this if you got something really stubborn this layout guide to help decide where to where the wires meet, you did not use on the tip-say, human flesh. mount components . enough solder, or you may not have left . Start with the 8-pin DIP socket. Just the iron on the connection long enough. Meanwhile, Back At The Blinker like the IC that fits into it, this socket has Try another connection. Okay, now that you know how to a notch, dot, or slot for identifying pin 1. If the solder appears grainy or grey, solder, it's time to build a permanent ver­ As you wire your circuit, treat this socket either you moved the connection before sion of your breadboard circuit. Start by just as if it were the actual Ie. Later, it cooled or your iron's tip wasn't clean. picking up a couple more items from you'll plug the IC into the socket, using Reclean and tin the tip, then try another Radio Shack: the same orientation, and your IC con­ connection. This time, let the wires rest a 1 Pkg of 8-pin DIP solder-tail sockets nections will be correct. little longer before you touch them. (276-1995 @ 59~) Working from the component (silk­ 1 Multipurpose predrilled project screened) side of the project board, posi­ Caring For Your Soldering Iron board (276-150 @ 99¢) tion the DIP socket so that the two rows. Be sure to clean and tin the tip of your Some beginners look on sockets as an of pins straddle the two long copper iron regularly. Never use acid-core solder extravagance; after all, build the circuit channels running the length of the pro-

54 MICRO CORNUCOPIA, #51, Jan-Feb 1990 ject board. Exactly where along the they contact their solder pads. Again, length of the board you place the socket watch for shorts to nearby pads as you isn't critical; near the middle will do. bend the leads. Solder the leads in place. Push the socket flush against the board, If the solder For the two connections that called for hold it in place with one finger or a bit of hook-up wire on the breadboard, you masking tape, then turn the board over appears grainy or can run hook-up wire along the com­ to view the solder side. ponent side of the board to appropriate Notice that each pin of the socket con­ grey, either you holes, then solder the wires. Or, you can nects to a three-hole row of solder pads, run the hook-up wire along the solder all joined with a run of copper foil. Looks moved the side of the board, bending each end of something like the breadboard, doesn't the wire around the proper lead before it? connection before soldering. Using the needle-nose or a small­ Double-check each connection, then bladed screwdriver, carefully bend each it cooled or your again after you finish. If things look of the socket's pins until it lies flat good, plug the 555 into the DIP socket, against the solder pad surrounding it. iron's tip wasn't connect the battery, and watch the LED Make very sure that each pin touches blink. only its own row of solder pads. clean. This circuit could become part of a After bending all the pins into place, robot, an alarm or signaling system, a carefully solder each connection. Be sure model train layout, or any number of you don't accidentally fill an adjoining tors, capacitor, and LED. Use the sche­ other projects. hole with solder. Also, guard against matic and your breadboard to help you putting too much solder on a connection get the connections right. For each com­ Variations On A Theme and forming a solder bridge to a nearby ponent, bend the leads until they fit So you can blink an LED; now what? pad. (Quiz: How much solder should properly into the holes (work from the The 555 can supply up to 200 rna on pin you use for each connection?) component side). Cut the leads about 118" 3. For some ideas, look at Figure 3. With the socket in place, add the resis- too long, then bend the leads over so The piezo-beeper (try Shack's 273-065)

cr P P TurboFlow is serious BIOS ~gg~CE rJ 'aI:T LE, flowcharting software at a price that won't cost you your kingdom. It's easy to use and more powerful than Merlin's magic. The AT BiosKit gives you a complete Bios with source TurboFlow runs on an IBM PC code you can modify for your own applications! The il: l~:;~~~tfI":and features a complete set of ANSI BiosKit includes a Bios on diskette ready for program­ J"bI'~~~ ~...... ~ ...... ~sym~b~ol~s,~is~m~e~nu driven, interfaces ming an Eprom, and includes the utilities you need to with desktop pub­ lishing . software, Rom the source code. The Bios also has a Rom and supports a va­ Monitor/Debug and Setup. At last you have control over riety of printers and plotters. the core of your system. Over 380 pages, with diskette, So stop living $199. The Xl BiosKit is only $99, or get both for $279. in the dark ages. Call 1-800-882- Thelntal Wildcard Supplement for the XT BiosKit is $49. 5822 and order We'll include a free copy of the I your copy, or ask for our free bro­ FREE pocket-sized XT -AT Handbook by L-....L...L:~:;;;;..~~.~~~==---...l chure. Choisser and Foster with each BiosKit if you men­ tion this ad when you order. Of course, this $9.95 ~~:. . " ~ TurboFlow & Logitech :

~~~~ ••,,~' i,.,.)."" ~~.;,~.,;::.f" 800-462-1 042 ,,~"~~~~01~ L PI ... "::!i.='1' • In California 619-271-9526 • ~~"'" ..~ ~U!J ylJ.Y1,,,. AnnabooksEE lZ Da;t~~it=ct;on~~s~ ~n~~ '(214) 669"-2137 12145 Alta Carmel Ct Suite 250-262 610 S. Shirman, Suite 104, Richardson, Tx 75081 1. San Diego, California 92128 Money-back guarantee Reader Service Number 174 Reader Service Number 160 MICRO CORNUCOPIA, #51, Jan-Feb 1990 55 emits a 78 db squawk, enough to irritate mission/reception fundamentals, RF fil­ Circuits come with a full parts list, a most people. If you use a small speaker tering, and (you guessed it) computers. brief discussion of operation, and a refer­ (about 100 ohms), you get a click, some­ The 1989 edition contains many pro­ ence to the magazine or book that origi­ what like a metronome. Or you can add jects dealing with computers in the ham nally published the project. Known a relay (such as 275-240 at $1.99) to con­ shack; stop by the local library and simply as the Markus book, you can usu­ trol devices, needing more current or browse through a copy. Who knows, you ally find it on the reference shelf of any higher voltages than the 555 provides. might even decide to take up ham radio. large library. He's arranged the circuits If you're adding a relay, be sure to in­ Then you could finally find a use for all by topic (burglar alarms, ultrasonic, clude the diode (use Shack's 276-1101 at your computers. power supply, audio amps, etc.) and the 49(t) as shown. It protects the 555 from Radio Shack (who else?) carries sheer volume of information will keep the reverse EMF generated by the relay. several little booklets written by Forrest you busy for weeks. Don't try to use this relay to control 120 Mims III. Forrest has written technical Spend some time with hardware. VAC (house current) without some ex­ books of different sizes for years. These After all, there was hardware long before perienced help! booklets run about $1.49 and cover digi­ there was software. You could end up Figure 4 shows my working· version tal logic circuits, op-amps, communica­ with a new hobby, additional job skills, of this circuit; the basic 555 schematic tions, semiconductors .... more respect for the abilities of the hard­ serves as a starting point. I use this ver­ He also has a 32-page booklet devoted ware designers, extra insight into the sion to help me with a simple home to the 555. Each book carries one (or guts of your computer. Who knows, you problem. more) complete schematics per page, might want to try building one of those We have a freezer in the garage, con­ with parts lists and cautions where babies yourself. It's really not that hard. nected to the same electrical circuit as the needed. For $2.49 you can try his Getting two upstairs bathrooms. Unfortunately, Started in Electronics, a hands-on intro to my wife's hair dryer occasionally trips hardware. ••• the ground-fault circuit protector in the Without a doubt, the "most schemat­ bathroom, shutting power off to the ics in a single book" award has to go to whole circuit. If we don't notice this in Modern Electronic Circuit Reference time (or if the breaker trips for any other Manual, by John Markus. Updated peri­ reason), we stand to lose a freezer full of odically, this monster manual contaiils food. hundreds of pages, each with several Now I have a simple solution; I just previously-published schematics. leave the 555 timer circuit plugged into a bathroom outlet. If the power shuts down, the relay drops out, closing the connection on the 9-volt battery and Figure 4-Practical Version of the Basic 555 Oscillator Circuit starting the piezo-beeper. Resetting the GFCI in the bathroom or garage restores power, pulls the relay back in and shuts off the beeper. I just make sure the .-+9V SA TTERY battery is fresh.

That's A Wrap TO SMALL L­ Now you know enough about hard­ WALL-MOUNTED ~ RL Y1 ware construction to do some simple cir­ DC POWER SUPPLY --3 cuits. If you like this type of hobby, start (8-14 VDC) R1 8 4 shopping for books and reading. 10K Radio Electronics magazine offers R2 U1 plenty of construction projects each issue. 10K Although the circuits are more sophisti­ 555 cated than the 555 project just described, the magazine usually supplies a source for. printed circuit boards and (occasion­ ally) a complete kit of parts for each pro­ ject. RE also runs columns on theory, practice, and tips for experimenters of all kinds. Though catering to a very special audience, the American Radio Relay This version uses a piezo-beeper, rather than an LED. The plug-in power League (ARRL) handbook, published an­ supply can be any DC value, so long as it causes the relay to pull in when nually, is an excellent source of technical current is applied. Note that the 9v battery connects to the normally closed information. The book covers all types of relay contact; this keeps the beeper quiet until the power into the wall-mount electronics of interest to radio amateurs supply is shut off. (hams), including antenna theory, trans-

56 MICRO CORNUCOPIA, #51, Jan-Feb 1990 Which Resistor Is Which? • SEE HOW PROGRAMS WORK A 10K Ohm resistor isn't the same • EASILY MODIFY PROGRAMS as a 270 Ohm resistor. Right? How, then, do you tell them apart? SOURCER 1M creates detailed commented source code and listings from memory The colored bands, found on nearly and executable files. Built in data analyzer and simulator resolves data across multiple segments and provides detailed comments on interrupts and subfunctions, all small resistors, give the resistor's I/O ports and much more. Determines necessary assembler directives for reassem­ value. This value can be determined bly. Includes a definition file facility to include your own remarks and descriptive by using the color code given below: labels, force data types, and more. Complete support for 8088/87 through 80386/387, 80486, and V20N30 instruction sets, We welcome comparisons with any other product, because no product comes close to the ease of use and output clarity of SOURCER, Color Number Multiplier Sourcer is the best disassembler we've ever seen! -PC Magazine, January 17, 1989, page 101 Blk 0 1 resetprn.lst Re .. tPRNvl.01 Sourcerllstlng 18-Sep-89 1:41 pm Pagel Bm 1 10 SAMPLE PAGE 60,131

Red 2 100 OUTPUT R[SETPRN Org 3 1000 Fully Created: 14-Aug-89 Version: 1.01 Yel 4 10,000 automatic Passes: 8 AnalyslsFlagson:H Gm 5 100,000 Program ,386c header Blu 6 1,000,000 • 0008 @prn_port_l equ ; (0040:0008·378h)

: -.------~ ~~~-~~ -. ~. -'~ ~. -. ~. -~. - -~ ~. ~ ~~ - ~~ ------. -- - - seg. a - - - -- Vio 7 10,000,000 Assembler seg.a segrrent para use16 public assurrecs:seg.a,ds:seg.a, ss:stack.seg.b Gry 8 100,000,000 directives resetprn proc far Wht 9 1,000,000,000 658[:0000 start: 658[:0000 [613 J~ short loc I 658E:0001516573657450 db 'ResetPRN-v1.01',OOh Gold 0.1 658[:0008514E1076311[ Determines 658[:000[ 30 31 00 As 4th band, shows 5% tolerance 658[:0011 0040 data 1 d. 40h data areas 658[:0013 00 OA 51 65 73 65 data) db OOh, OAh, 'Reset Printer7 S' Silver 658[:001974105071696[ 0.01 and type 658E:00lf 7465723f1014 658[:0015 loc): As 4th band, shows 10% tolerance 658[:00150E push cs Detailed 658[:0026 If pop ds (Blank) 658E:0017 .6A 0013 rrov dll,offsetdata.3 ; (658[:0013.00h) comments 658[:001A 64 09 rrov afl,9 As 4th band, 658[:001C CD 11 int 11h : DOS Services ah·function09h shows 20% tolerance ; display char c;tring at ds:dll 658[:001[ 6401 rrov .h,l Simulator 658E:0030 CD 11 int 11h ; DOS Services ah·functionOlh follows getlo.eybdcharai, .... ith(!ChO An example should make this 658[:00313C79 c~ al,79h 'y' segment 658E:0034 75 lA Jne short loc.3 Ju~ if not equal 658E:0036 8E 1[ 0011 rrov ds,data.2 (658[:0011·40h) dearer. Take a look at the 270 ohm re­ changes 658[:003A 88 160008 orov dX,ds:@prn.port.l ; (0040:0008.37Bh) ii58[:003E 83 C1 01 add dX,1 sistor. Note the colored bands starting 658[:0041 80 08 rrov .1,8 658[:0043 [[ out dll,al : port 37Ah, printer-2 control ; al ·8. Initialize printer with the band closest to the edge of the 80386 and 658[:004466: 8900020000 ecx,10000h 80486 658[:004A locloop_1: resistor. It's Red-Vio-Bm-Silver (the 658[:004A 67: [2 fO loopd locloop.2 ; Loop if eo)o 0 support 658£:0040800C aLOCh fourth band may be Gold, Silver, or 658E:004f EE dll,al port 3lAh, printer-2control .1 ·OCh, init & strobe off 658£:0050 loc.3: Blank). The first two bands are the first 658E:0050 84 4C rrov ·ah,4Ch 'l' 658E:OQ51 CO 11 int 11h ; DOS Services ahafunction4Ch two digits of the valuei here, these Easy to ; terminate with alareturn code read resetprn endp digits are 2 (Red) and 7 (Vio). The seg.a ends format :------stack.seg.b---- third band is the multiplier; in this case stacksegb segtrent para use16 stack 6593:000000CO[ff] -- db 192dup(Offh) 10 (Bm). This gives a value of 27 * 10, stack.seg.b ends or 270 ohms. end start If a fourth band exists, the tolerance (Source code output and inline cross reference can also be selected) of the resistor's value may be 5% (for a gold band) or 10% (for a silver band). • CHANGE AND ADD FEATURES If no fourth band appears, the toler­ , BIOS SOURCS' • CLARIFY INTERFACES ance is 20%. The chart above is based on the for PS/2, AT, XT, PC, and Clones ARRL manual; the idea of a multiplier The BIOS Pre-Processor lM with SOURCER provides the first means:to obtain could have been made a little easier to accurate legal source listings for any BIOS! Identifies entry pOints with'full expla­ nations. Resolves PS/2's multiple jumps for improved clarity, Provides highly grasp. Just think of the multiplier band descriptive labels such as "video_mode" and much more, Fully automatic, as the number of zeros to add to the SOURCER Commenting disassembler $99,95 UNPACKER'M Unpack packed EXE files and more $39,95 first two digits. The color of the band SOURCER with BIOS Pre·Processor 139.95 ASMtool 'M Assembly source analyzer and flowcharter 89,95 tells you how many zeros. Shipping & Handling: USA $3; Canada/Mexico $10; Other $15; CA Res. add sales tax; PS/2 trademark of IBM Corp. For example, the 10K Ohm (10,000 NOT COpy PROTECTED 30-DAY MONEY-BACK GUARANTEE ohm) resistor has· a color code of Bm­ If within 30 days of purchase you find our product does not perform in accordance with our claims, Blk-Org-Silver.. Using the chart above, call our customer service department and we will gladly arrange a refund. , , I this becomes 10 and 3 zeroes, or 10,000 For orders and mformatlOn, call: / .I ohms. , ~/SA; • • ___J 1-800-662-8266 • V COMMUNICATIONS, INC. 3031 Tisch Way, Suite 802, Dept. MC4, San Jose, CA 95128 (408) 296-4224

Reader Service Number 62 I MICRO CORNUCOPIA, #51, Jan-Feb 1990/ 57 ZipGraph: Part 1 C'ING GLEARl.Y

guage that gives me everything C did-and By Scott Robert Ladd Scott begins his super-power, super-compatible more. My newfound favorite is C++, a lan­ 705 West Virginia graphics routines with this issue. He also gives us guage that has captured my heart and hard Gunnison, CO 81230 the latest on hot new packages from Zortech and disk. At first, it was a tenuous relationship. I (303) 641-6438 . Lattice. was hesitant to leave C, a language in which I BBS: (303) 641-5125 had written so much. Yet C++ slowly won me over with promises of object-oriented program­ t's fall in the Rockies as I write this. The ming and wonderful new capabilities. So, my summer residents have scurried back to friends, C++ will begin to creep into this Iwarmer climes, and those of us remaining column. are bundling up. I'm sure you'll hear about I firmly believe that C++ will replace C in Gunnison on your local news during the next most applications over the next several years. It four months; consistently, we have the coldest offers so many advantages over C, and it cur­ temperatures in the lower 48 states. Weather­ rently has momentum. So, as time goes on, men take a perverse pleasure from mentioning you'll see more C++ and less C. But don't "and in Gunnison, Colorado, the low tempera­ worry-I'm not abandoning C, I'm just adding ture today was a brisk 40 0 below zero!" C++. As you'll see, this month's column dis­ It doesn't feel that cold. There's no humid­ cusses 850 lines of low-level code. Let's get to ity. The sky is sunny 350 days out of the year it .... here, so we have a constant supply of solar radiation. Since sunlight warms objects, it's C Ex lorations ' quite possible to go ice fishing on Blue Mesa Reservoir in 10" below weather, without wear­ As promised, this installment of the column ing a heavy coat. Strange, huh? begins the presentation of my auto-sensing Planning for Rocky Mountain SaG II con­ graphics library for IBM PCs and compatibles. tinues. Maria and I plan to hold RM-SOG II Called ZipGraph, it functions on several levels. during the weekend of June 14-16 in 1990. We We'll start with the low-level routines, which need to hammer out some exact details, but the handle basic tasks such as determining the in­ conference is a go. stalled adapter type and the plotting of pixels. Maria and I are very grateful for the over­ Future segments will cover drawing primi­ whelmingly positive <:omments we received tives, clipping, region filling, and other basic from this year's attendees. Particular thanks go tasks. In the highest level of this library, I'll to Linda and Karl Lunt for their kind words in present a' series of C++ classes, built on the the last issue of Micro C. There's no way we lower-level C code, which will handle ad­ could go through a summer without a SaG. vanced routines for ray tracing, 3D modelling, You'll find SaG information in the sidebar. and animation. An obvious question might be: why write a Toolbox graphics module? Not only are there dozens of commercial graphics libraries for C, but most As time goes on, things change. In our in­ compiler vendors now include their own dustry, the world changes on a daily basis, graphics routines. What does ZipGraph offer which can sometimes be disconcerting. Re­ that others don't? cently, a change in my programming has come I had several goals in mind when building to mean.a change in this column. Yes, I have a ZipGraph. To begin with, I wanted it to be fast. confession to make: C is no longer my primary The current version is more than twice as fast programming language. as any other graphics library I've tried. I've found a new love, a programming lan- Surprisingly, my C-Ianguage version of the

58 MICRO CORNUCOPIA,#51,Jan-Feb,1990 low-level graphics routines was nearly as fast as the one I had built in as­ sembly language. The advantages of Rocky Mountain SOG II having easily maintainable C source far outweighed the few percentage points June 14-16, 1990 THURSDAY- loss in speed. Gunnison, Colorado Horseback riding trip: $25 I also wanted to make ZipGraph All-Day Raft Trip: $60 portable. As time passes, more and Last year's Rocky Mountain SOG Barbecue (adult) $10 more of my articles involve programs was a great success. Maria and I, in a Barbecue (under age 12) $6 which do graphics. Alas, C compiler fit of unbridled optimism, have de­ vendors do not have any interest in cided to hold.· a. sequel. Yes, . Micro. C SATURDAY Night Banquet: $15 making their proprietary graphics li­ readers, there is a Rocky >Mountain RM Sog II Tee Shirt $10 braries compatible. SOGII. If I write a program using the Bor­ Thursday the .14th .will begin with Please register as early as land Graphic Interface (BGI) included a .choice of· activities: a horseback possible! Some activities may fill with Turbo C, that program won't com­ ride into the rockies, or the tradi­ early. Ask about family and group pile with any other C compiler. Rather tional whitewater rafting. Thursday discounts! Speakers attend the con­ than shut people out, I decided to build night, we'll have a. barbecue at a ference and the Banquet free. a library which would compile under national forest campground. Remember: you only need to pay all the popular compilers. Friday and Saturday will again be for those things you participate. in. The version of ZipGraph presented filled.·with· presentations~ The focus For example, if a family member here compiles with Borland Turbo C thisyearwiU be on graphics, anima­ wants togo to the other events but 2.0, Lattice C 6.01, Microsoft C 5.10, tion,

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 59 some of -the more powerful features of giv,es you an example of how to use the the ZG_VideoInfo structure. You can C and provides the basic functions for ZG_LWLVL module. use constants for these values, defined detecting the type of graphics adapter. We'll start with a quick synopsis of in the ZG_LWLVL.H file, to make your It also supports plotting and reading how to use the ZG_LWLVL functions. code a bit clearer. At this point, Zip­ pixels on all common IBM adapters. First, you need to call ZG_Init to initial­ Graph has only determined which Editor's note: Scott's 850 lines of code ize the module. ZG_Init detects the video adapter you have. just wouldn't fit in this issue. See "Around adapter installed in the PC and saves its I've tested the detection routine on The Bend" for more on the problem of stuff­ initial status. The public ZG_Videolnfo several computers with a variety of ing programming examples into Micro C. structure will return the information on adapters. So far, it has worked flaw­ In the meantime, the code is available on the adapter. lessly with VGA, EGA, MDA, and Her­ Micro C's BBS (503) 382-7643, and on the You then need to set a graphics cules adapters. I do not have a CGA or Issue #51 disk. mode using the ZG_SetMode function. MCGA adapter, but I tested those IBM PCs and their compatibles were It sets the video mode you -request, as­ routines on my Paradise 16-bit VGA originally designed to be modular. In signs the proper pixel plotting and card, which emulates the CGA and spite of IBM's recent move toward reading function to the function point­ MCGA. I'd appreciate hearing from you building video hardware into the com­ ers ZG_PlotPixel and ZG_ReadPixel, if you have problems. puter's motherboard, most vendors con­ and returns information on the new tinue to let you install whatever video graphics mode in ZG_Videolnfo. Selecting The Graphics Mode you want. You can then plot pixels by calling To display graphics, you now need Currently, a PC will usually contain the function pointed to by ZG_PlotPixel to set a graphics mode. Call the ZG_Set­ one of six standard video adapters: the and read pixels via the function pointer Mode function and pass one of the Monochrome Display Adapter (MDA), ZG_ReadPixel. When your program is ZG_MOD constants defined in the Color Graphics Adapter (CGA), the done, it should call ZG_Done to restore ZG_LWLVL.H as its first· parameter. Hercules Graphics Card (HGC), the En­ the video adapter to its pre-pro­ ZG_SetMode will return 1 if the re­ hanced Graphics Adapter (EGA), the grammed state. ZGTEST.C will show quested mode is not valid for the adapt­ Multi':'Colored Graphics Array (MCGA), you the details of how this all fits to­ er detected. or the Video Graphics Array (VGA). gether. Now, let's examine the above The public global variable PC software authors have always process in detail. ZG_VideoInfo will again return infor­ faced the problem that anyone of these mation on the mode. That information video adapters can be installed in a Pc. Identifying The Graphics Card includes the x and y dimensions of the While the PC's BIOS supports most of When called, ZG_Init attempts to new graphics mode and the number of the adapters,. it does not support the identify the video adapter installed in colors available. If all goes well, ZG_Set­ Hercules card. I'm sure most of you your computer. There isn't any built-in Mode will return 0 to indicate success. have had the experience of finding a way to determine the adapter type, but ZG_SetMode also does some auto­ piece of graphics software which will we can use the process of elimination. magical work for you. Two special not run on your computer. ZG_Init begins by calling an MCGA graphics modes are ZG_MOD_BESTRES Some graphics libraries allow you to and VGA BIOS function, which returns and ZG_MOD_MOSTCOLOR. Respec­ detect which video adapter is installed. the adapter type. If an MCGA or VGA tively, they represent-for the detected Borland's Graphic Interface (BGI) has BIOS' is installed, this call will tell us adapter-the best possible resolution, this capability. However, the BGI uses which one of those it is. If the adapter and the resolution providing the external drivers, loaded at run time. , installed is not a VGA, the call to this greatest selection of colors. While you can convert the BGI BIOS function will fail. The global static array VideoTable drivers to object modules, you then Once we've eliminated the VGA, we contains the actual modes for both of have to go through a clumsy procedure call an EGA BIOS function. Again, if the these special modes, for each adapter. to link them in and make the program EGA BIOS is not .. present, the function In addition, Video Table contains a bit aware of their resident status. Other will not return expected values. If mask which indicates the valid modes auto-sensing packages fail to support there's no EGA, we ask the BIOS for the for a given adapter. The requested certain adapters or are just plain hardware information word. We check graphics mode is compared against the clumsy. the appropriate bits to see if we're deal­ MQdeList value for a given adapter type I've always believed that computers ing with a color or monochrome adapt­ to make sure it is valid. If it isn't, should do work for you. ZipGraph not er. A color adapter will be a CGA at this ZG_SetMode returns an error. only detects the presence of all the point (since we have eliminated the Once it has determined the validity above adapters, it also automatically other color adapters). of the requested graphics mode, sets up its routines so that you can If a monochrome adapter is installed, ZG_SetMode uses the information write one program which works. The our final task is to differentiate between stored in the global static array Mode­ type of adapter you're working with is an MDA and an HGC. We do this by Data to do the mode set-up. ModeData as transparent as possible. monitoring the vertical synch bit of the contains the equivalent BIOS mode for Any source program using the monochrome card's status. register; if the mode requested, the addresses of ZG_LWLVL module must include the bit changes, we have a Hercules the appropriate pixel plotting and read­ ZG_LWLVL.H-the header file. card. ing functions, and the dimensions and ZG_LWLVL.C contains the implementa­ Information on the adapter's type color counts for each mode. tion of the module. Finally, ZGTEST.C and its installed monitor is placed into When the mode is set, ZG_SetMode

60 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 SAYW!'!O great T~IS. The lightning-fast The breakthrough screen generator. DBMS toolkit for Pascal Whether you're a novice If you'd like to combine the raw power ~ " programmer longing for and speed of Turbo Pascal or Micro- C~v simplicity, or a seasoned soft's QuickPascal with the simplicity£ ~ ~'rSGn/ pro searching for higher and elegance of dBASE, Topaz is L.r::;-:<~~ / productivity, you owe it just what you're looking for. ?~~,,:/If I to yourself to check out That's because Topaz was "",-" 0<., J Saywhat. You see, with specially created to let you Y,~~, 1/" \ \ _ ) /""" /- Saywhat, you can build enjoy the best ofboth worlds./.~':Y) f) l1 2!...=.. / (beautiful, elaborate, color- The result? You create com- 'd?J'/~,,- ,,~ ~ I coded screens in minutes! plete, truly dazzling applicat- / _ (I." ~ fc A ~)'~' / That's right. Trulyfantastic ionsinaveryshorttime.Andnowonder. \. ~,...... !) \ it-\.t ~ screens for menus, data Topaz is a comprehensive toolkit of ~~ ----- ~ entry, data display, and dB~E-like commands and functions, .,\ \ \\ help-panels that can be deSIgned to help you produce ~\l displayed with as little as one outstanding, polished programs, fast. line of code in any language. Check out these powerful features:

Here's what you get: • Over 220 routines all with easy-to­ ORDER NOW. use, dBASE-like syntax. YOU RISK NOTHING. • Design screens, windows, and Thousands of satisfied customers • Data entry routines like SAY, GET, moving bar menus! have already ordered from us. Why PICTURE, RANGE, color selec­ • Easy-to-use, powerful editor lets not visit your dealer or call toll-free, tion, unlimited data validation. you create screens in a jiffy. right now and putSaywhatand Topaz • Open up to 10 DBF files, with up to to the test yourself? They're fully • Pop up your screens and menus 15 indexes with USE, SELECT, guaranteed. You don't risk a penny. with one line of code in dBASE, SKIP, APPEND, PACK, INDEX all the dBASE compilers, your Special limited-time offer! Save $26. ON, SET INDEX TO, and FIND. favorite BASIC, Pascal, or any Buy Saywhat?! and Topaz together • No need to buy dBASE. CREATE, other language! for just $99 (plus $5 shipping and BROWSE and REPORT utilities handling, $10 Canada, $25 Inter­ included. • Screen Library Manager. national, Calif. residents add 7%). • Generates runtime code. Visit your nearest dealer • Easily implement S aywh at and or call toll-free: Lotus-style moving bar menus. • No runtime license or royalty fees. 800-468-9273 • BROWSE or EDIT any DBF file • Comes with a 100 page manual, In California: 800-231-7849 with just one line of code! Pro­ plus dozens of sample programs International: 415-571-5019 grammable and windowed too. and free utilities. Software Science, Inc. • Pick from windowed data or file­ 100 Valley Drive, Brisbane, CA 94005 names with one line of code. 0;; • Comprehensive Time & Date ~3 ,~) T) ) ') ') )") ,),')-,-,)"') --)-'lo-;\ math in 7 international formats. A1> '- \~ I MONEY BACK GUARANTEE. ~ I Ut;:!" ",/ Ifyou aren't completely delighted with Saywhat i. !owerful code and report generators (0 fl' p 1 or Topaz, for any reason, return them within Included! ,J 30 days for a prompt, friendly refund. C 'th I t 320 - 3 • omes WI a comp e e page • Ct to: ~- manual, plus sample programs to Dealers: SAYWHAT?! and TOPAZ are get you started. available from Kenfil Distribution. and in Europe from com~raiifeoo!

SOFTWARE SCIENCE INC.

Reader Service Number 129 assigns the appropriate values in the most of you know, I'm a big fan of the DOS compatibility, and dozens upon ModeData table to the function pointers compilers written by Walter Bright, and dozens of tools and libraries. ZG_PlotPixel and ZG_ReadPixel. an even bigger fan of C++. I beta-tested In fact, the Lattice library is one of its Thus, for each graphics mode, the this latest release and can frankly say most outstanding features; it contains correct pixel plotting and reading that this is one of the finest compilers more than 800 functions! To do this, routines are set-automatically. ever written. It's one of the fastest com­ Lattice simply bundled their dBASE III Once that is done, ZG_SetMode as­ pilers I've seen, and it produces very interface library, curses library, graphics signs values from the ModeData table tight and reliable code. library, and communications library to the width, height, and color count Probably Zortech's biggest feature is with the compiler. Previously, these had values of the ZG_Videolnfo structure. its near-perfect implementation of been separate products. You should note here that· AT&T C++ version 2.0. C++ 2.0 is prob­ Editor's note: The curses library? You ZG_LWLVL.C handles the Hercules ably the most amazingly complex lan­ mean the room where engineering and card in a special manner. Since the PC guage ever developed, and Zortech is marketing discuss the features in the next BIOS does not support the HGC in any the first MS-DOS vendor with a native­ revision? way, its graphics and text modes must code compiler for it. I used a beta copy Of course, a compiler cannot be be set via special functions. The Zip­ of Zortech C++ 2.01 while writing a judged wholly upon the size of its li­ Graph functions make exceptions to book on C++ 2.0. The compiler's capa­ brary. Lattice C 6.01 is a very good com­ their normal set-up by calling the bilities were very impressive. piler; it produces competitive code both special Hercules functions rather than The new Zortech compiler is missing size- and speed-wise. It doesn't win all the BIOS. a few C++ 2.0 features. For example, it the benchmarks, but it certainly does does not support pointers to member better than average on all of them. Plotting Pixels functions yet. A release due sometime The compiler itself is reasonably fast, Different video modes require differ­ early next year will correct that. Other­ and Lattice supports several C-language ent pixel plotting and reading routines, wise, this is a faithful implementation of extensions aimed at imbedded systems which is why I use pointers to the func­ the language AT&T describes in its ref­ programmers. It's impressed me tions for these tasks. erence documentation. Even AT&T's enough to install Lattice C 6.01 along­ You can use ZG_PlotPixel and own C++ translator, called cfront, does side the Borland, Microsoft, and Zortech ZG_ReadPixel exactly as if they were not support the full language. compilers. regular functions. However, what they Zortech C++ 2.01 comes in two pack­ do depends on the graphics adapter. ages. You can buy just the compiler for Resources Their value is based on the graphics $200, or you can purchase the mode you requested via ZG_SetMode. "Developer's Version" for $450. The lat­ You may have noticed the BBS tele­ In a way, you can look upon this as a ter contains the compiler, complete phone number under my byline. Yes, form of polymorphism. source for the run-time library, a set of I've put up a BBS, called Duck Tower (a This column has already run far C++ classes, and a C++ source-level de­ menu selection on the BBS explains the longer than it should, so I won't go into bugger. Zortech no longer sells the name). It's at (303) 641-5125, and works the specifics of how the individual pixel vanilla C compiler separately; however, at 300/1200/2400 bps, 8 data bits, 1 plotting and reading functions work. If the C++ products still include it. stop bit, and no parity. It's currently a you're dying to know, pick up a copy of Another hot entry is Lattice's long­ node on the FidoNet system: 1:104/708. Richard Wilton's Programmer's Guide to awaited upgrade. Going from version The BBS is oriented towards my PC & PS/2 Video Systems I(ISBN 1-55615- 3.4 to version 6.01 may seem a bit favorite subjects: science and computers. 103-9), by far the best reference ever strange. While Lattice justifies the radi­ I try to maintain the best in MS-DOS published about the nuts and bolts of cal change in version numbers with applications and utilities, too. Program­ PC graphics programming. some mumbo-jumbo, I suspect the real ming languages supported are C, C++, I doubt ZG_LWLVL will be static. reason is that they wanted to impress Smalltalk, Pascal, Modula-2, and 80xxx For instance you could add support for upon people that Lattice C has really assembly language. the super VGA modes, such as 800x600. been upgraded. I also have what I believe to be the Additionally, you might like to try some Back in the early days of the IBM PC world's largest collection of fractal gen­ of the non-documented VGA modes, and its clones, Lattice C was the king. In erators and Chaos Theory programs. such as 320x400 with 256 colors. But all fact, early versions of the Microsoft C And I carry the issue disks for Micro C , in good time. I suspect this issue's compiler were licensed versions of Lat­ along with the latest versions of Zip­ source code is more than enough for tice. Then Microsoft wrote its own C Graph, CRITTERS, and the other soft­ most of you to chew on for a while. compiler, and other vendors entered the ware you've seen here. So come on over market with faster, optimizing pack­ and visit; we'd love to have you! News and Reviews ages. Lattice C quickly slipped into ob­ Everything comes in bunches. Two scurity. Now, they've returned with one Movin' On.... significant C-related products have ar­ of the best packages on the market. That's it for now. Next time, we'll rived on the scene-Zortech C++ 2.01 For $250, you get a globally optimiz­ look at line and curve drawing, fol­ and Lattice C 6.01. ing compiler, a MASM-compatible as­ lowed by a 3D plotting module used to Zortech C++ 2.01 will have b'een re­ sembler, a very good full-screen debug­ implement the fractal generator. leased by the time you read this. As ger, OS/2, Microsoft Windows, and MS- • • •

62 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 8280 Clairemont Mesa Blvd., Suite 117 San Diego, California 92111 ERAC co. (619) 569·1864 BABY 386·20/24 MOTHERBOARD ELGAR NiCds AACelis .6ah ...... $1.00 One 32 bit slot, Five 16 bit slot, Two 8 bit UNINTERRUPTIBLE 12V Pack AA Cells .6ah ...... 6.50 slot. Maximum 8 meg on board (1 meg POWER SUPPLIES Sub·C Cells 1.5ah ...... 1.50 SI M MS). OK on board. 80287 or 80387 or 400 Watt MODEL IPS400+ 12V Pack Sub·C ...... 10.00 Double D Cell 2.5V 4ah unused ... 8.00 Wytek Co·Processor slot. Shadow RAM. $650 CCelis ...... 1.75 Power distribution center and sine· 7.2V RC·Pack 1.2ah ...... 18.00 ·20 $630 ·24 $660 wave UPS. Only 2" high. 1 meg SIMMS $115 560 Watt MODEL IPS560 GEL CELLS $350 6V 5ah ...... $5.00 Sinewave, 56 OW complete with 6V 8ah ...... 6.00 batteries. 12V 15ah ...... 15.00 16 BIT VGA CARD 12V 2.5ah ...... 8.50 400 Watt MODEL SPR401 D Cell 2.5ah ...... 2.00 Resolution Color $180 640x480 256 of 256* Supplies may have minor cosmetic ROBOTICS 800x600 16 of 256* damage, but are electrically sound. 5V DC Gear Motor wlTach 1"x2" .. $7.50 1024x768 16 of 256* Squarewave output. Run on inter· Z80 Controller with 8·Bit A/D ..... 15.00 12V Gear Motor 30 RPM ...... 7.50 ·with 512K RAM nal or external 24VDC battery when line goes down. Typical transfer Cable: DB9M·DB9F 1 ft. length ..... 2.00 Runs all standard VGA modes. 256K RAM time = 12MS. Battery supplied. High Voltage Power Supply on board. Drivers for AutoCad, Lotus, For AT, XT & Kaypro. Input: 15·30V DC Framework, GEM, VP, WP, WS & MS Win· Output: 100V 400V 16KV ...... 6.50 dows. 1 year warranty. NEW 24V INTERNAL* TERMINALS For 512K $30 extra $185 BATTERY $75 Televideo 925 ...... $99 KAYPRO EQUIPMENT BARGAINS We Repajr CPM Kaypros 9" Green Monitor - 83, 84, K16 .... $60 CPM COMPUTERS IC'S Host Interface Board ...... 15 K4·84 ...... 425 K4X ...... 425 81·189 Video Pal...... $15.00 Keyboard ...... 50 81·194 RAM Pal ...... 15.00 Replacement Power Supply ...... 70 We carryall Ie's 81·Series Char. Gen. ROMs ...... 10.00 Drivetek 2.6M FDD (Robie or K4X) .... 75 for Kaypro repair. b81·Series Monitor ROMs ...... 10.00

TEST EQUIPMENT CPU & RAM & MISC. SWITCHERS OSCILLOSCOPES 41256·12 .. $6.50 41256·15 .. $5.00 AT 200W Pulls, tested ...... $35.00 4164·10 .... 2.50 4164·12 .... 2.10 5V/75, 12V/8, ·12V/3, ·5V/5 ...... 85.00 TEK 7403N/7A18N/7B50A 60 MHz .$650 4164·15 .. , .2.00 4164·20 .... 1.25 5V/9.5A, 12V/3.8A, ·12V/.8A ...... 39.00 Leader LB0520 30 meg Dual Trace .. 300 MK48Z02B·20 ...... 10.00 5V/3A, 12V/2A, ·12V/.4A ...... 19.50 TEK 475 Dual Trace 200 MHz ..... 1499 Dallas D1220Y ...... , ...... 10.00 5V/6A, 12V/2A,·12V/1A ...... 29.00 ScopeProbex1,x10 100MHz ...... 25 SIP DRAM 256·12 ...... 7.00 5V/6A, 24V/1 %A, 12V/.6A,·12V/.6A ... 29.00 ANALYZERS 2716 ...... 3.50 2732 ...... 3.75 5V/30A ...... 39.00 TEK 491 10MHz· 40 GHz ...... $4000 2764 ...... 4.00 27128 ..... 6.50 5V 100A ...... 100.00 Biomation 805 Waveform Rcrdr ., .. 195 27256 ..... 5.25 27512 ..... 7.00 5V 120A ...... 'J' I" .110.00 Biomation 8100 2·Channel MC68000·8 CPU ...... 8.00 HP DCIDC 12V In 5/8, 12/5, -5/.3 out ...... 45.00 Waveform Recorder ...... 295 Z80 CPU . " .75 Z80A CPU .. 1.50 HP1600A Logic Analyzer ...... 295 Z80 CTC ...... 1.50 Z80A PIO .. 2.00 Z80A SIO .. 5.00 HP1600A/1607A Logic Anlyzr ...... 495 8089·3 ...... 6.50 * SPECIAL * Gould K40 32 CH Logic Analyzer ... 950 VERSATEC 8222F 22" 80C85A .... 4.50 8088 ...... 6.50 Electrostatic Printer Plotter MISC. 8212 .... : ...... 2.00 8251 ...... 1.50 8253·5 ..... 1.50 200 dots per inch. Up to D size. Optronics 550 MHz Freq Cntr ...... $95 1" per second Exact 566 VCF/Sweep Function 8255·2 ..... 3.50 8255·5 ..... 2.50 $3,999 Generator ...... 195 D8284A ...... 2.50 D8749 ...... 7.00 6845 ...... 5.00 * SPECIAL * HOURS: Mon.· Fri. 9·6 - Sat. 10·4 1793 ...... 6.00 1797 ...... 7.00 AT 80286·6 CPU BOARD MiNIMUM ORDER - 515.00 with reset and mono/color switch. TERMS: VISA, MasterCard. Certified Connector for KB, Battery & SPKR. Checks. Money Order. NO COD. Visa Phoenix Bios (tested with Award 3.03). and MasterCard add 3%. Personal * SPECIAL * 6MHz, can be upgraded to 8 or 10MHz. checks must clear BEFORE we ship. COLOR MOU,SE - Red, Green, Yellow, Use with backplane, add memory Include shipping charges. California Blue or Standard with manual & board, I/O board, etc. residents add 7% Sales Tax. For diskettes. Lifetime warranty. $39 more information please call. Reader Service Number 93 ONLY $99

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 63 The Things Up CULTURE GORNER With Which I Have To Put

I had just staggered in the door from A couple of weeks later a handwrit­ another grueling vacation. The latest ten letter arrived, supposedly from a issue of Micro C, hot off the presses, sat Sonja Travers of San Francisco, respond­ in newly opened boxes. An exciting ing to "my" personal ad in Micro C. time, this; we catch our first glimpse of Sonja described herself and went on to the end product of months of hard work say: (well, of months anyway). "It seems we are both lovers of the I snagged a copy, settled in next to wilderness. I like to go hiking, but I Cary's desk, leafed through the pages, can't go during ragweed season as I and found an insert. An insert? Micro C suffer from asthma and hayfever. I had never has inserts. It read: a polyp removed from my sinuses last year which seems to help somewhat." SWM, WHO LOVES THE GREAT OUTDOORS: Sure. Once I had a polyp removed, Rock Climbing, Mountain Biking, Snow too-from my brain. So I don't believe Camping. Ex-physicist turned computer every little piece of BS my fellow Micro technician (nerd) seeks sweet young c:: inmates try to foist on me. thing with amazonian strength to The next attacks on my incredulity share the milk of Mother Earth. Must - came by phone, from people I'd always be petite, healthy, possess good thought of as friends. Bruce (of Eckel genes, and the ability to carry a 50 fame) called to complain about my use pound pack up steep terrain. Must of Micro C as a platform to further my speak only when spoken to and, when own questionable personal needs. permission is given, be independent. Thanks, Bruce. Next time you visit, , Please respond with photo and vital you're sleeping outside with the cats statistics to: Larry Fogg, at Micro and curs. C, P.O. Box 223, Bend, OR, 97701. And Herr Entsminger.... Et tu? I learned long ago that Gary at his most (If you wear L.L. Bean jammies and sincere is also most suspect. But I didn't breathe heavily, call evenings.) think he'd lower himself to aiding in this kind of nonsense. I looked around at the innocent faces No way I bought into this drivel, but and knew something was wrong (no dang if they weren't doing a fine acting one ever looks innocent around here un­ job. I felt like I was stuck in a bad TV less they've hatched some sort of devil­ show-a cross between The Dating Game try). The entire untrustworthy crew of and The Twilight Zone. Micro C wanted me to believe that they Miss Esther Ruth Lancaster (a Men­ had sent out this implausible (but nicely nonite from Pennsylvania) was up next. worded, I had to admit) personal ad "I am a hard worker. Every day I with each copy of the magazine. rise at 4:00 a.m. and milk the cows. Of course I didn't buy it-not for a Then I collect the eggs from the chicken minute. We all had a good laugh and I house, feed the chickens and the ducks, went back to my desk for a well de­ and our little kitten. Then I start the served post-vacation nap. day's bread baking, and while the bread

64 MICRO CORNUCOPIA,#51,Jan-Feb,1990 By Larry Fogg Micro C Staff

is in the oven I get my little sisters to be seen in public with a woman who ready for breakfast and for school. would say such a thing?) "Then I help mother with laundry But the final letter caught me before I which we do by hand and can take up had a chance to take the plunge with the rest of the morning. Then we start Ferrin. I pulled up a chair in the pro­ preparing pies and roasts for dinner. duction room. After that we usually beat the rugs and "I saw your picture in Micro Cornu­ sweep the floors and then go help copia and it made me pucker! You seem Father and my brothers in the fields. like such a man!!" "I finished ninth grade. I am now 19 Obviously an intelligent and dis­ and I understand that in other com­ criminating woman, or so I thought. munities, girls have more schooling. "I'm petite, with blond hair and Perhaps you have met some of these green eyes and I love to .... " girls, Mr. Fogg, and they must be very I won't continue; you can probably smart. But I can read and write and guess where the letter was heading. Be­ cipher quite well. sides, at that point a decidedly un­ "I would like to have lots of babies female picture fell out of the envelope and I think I would be a good mother and I heard a couple of snickers from and wife. I already know how to run a the next room. I skipped to the end of household and my cousin Sarah Bern­ the letter and read: stein says that I would get used to sex. "I must be getting off now. I'm due Excuse me for speaking so openly, Mr. at the humane society for my volunteer Fogg, but I am a farm girl after all and work. I just love those cocker spaniels. I'm sure it would be okay from time to lipS: Jackie and Cary helped me time." write this and all the others. Steamy Now we were getting somewhere; I enough yet??" just love a good roast. And my rugs Suddenly I was surrounded by the hadn't been beaten for at least nine same conniving crew that had watched years. I felt my raging disbelief easing me read the personal ad weeks before. into a fine, healthy skepticism. They tried to appease me with pizza I almost looked forward to the next and chocolate frozen yogurt pie, and I letter. When it came from Ferrin Ken­ let them think that they had. But now I nedy with a phone number, an address, get my final and poetic revenge: they a picture of a beautiful blond, and an wrote most of this article, but I get paid invitation to lunch (her treat-my kinda for it. woman), I knew it was time to see if Editor's note: Of course the next pizza Ms. Kennedy actually existed; I would and the next yogurt pie are on you fella. accept her invitation. And we'll take 'em as soon as you return (The only thing that worried me from Yosemite. about Ferrin's letter was a closing re­ mark that she found "Around The Bend" quite titillating. Did I really want • • •

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 65 Marketing The $25 Network Making It A Little Bit At A Time

By Kim Jindra with seemed like a big risk at the time. Plus, we The Jindras became special friends at the B.c. would have to wait more than six weeks to see Don Jindra SOG, and the friendship has grown as I've seen . if there was any response. We decided to call Information Modes P.O. Drawer F them at SOG after SOG. Their $25 network was our main product "The. $25 Network." If that Denton, TX 76202 also quite a hit, and despite the low price, they didn't grab attention, nothing would. (817) 387-3339 seemed to be doing quite well. So I asked Kim to I sent in the check as Don, started work on send me an "On Their Own." phase two, The Weak Link, a subset of the net­ work. He said he wanted to begin with a simple "network-like" project. He still hadn't ur company, Information Modes, is a started the network and we had an ad coming software development/publishing com­ out in weeks. He hadn't entirely finished DOS, Opany with a grand total of two em­ either! I told him six weeks was not a very long ployees-my husband Don and me. time. Until January, 1987, Don worked as a con­ "Don't worry," he said. sultant. For approximately two years, our in­ I worried. come came primarily from one small manufac­ Fortunately, he does his best work under turing company. Don developed software for pressure. Soon the big day came and we went their business with the understanding that he down to the post office to check our box. Lo and the owners would market it in a separate and behold, an order for the DOS disassembly. partnership. As the project neared completion, The Computer Shopper ad was out. it became clear that "marketers" and program­ I asked Don if he had finished DOS yet. mers are natural enemies, like cannibals and "Don't worry," he said. missionaries. We decided we didn't need their I asked how the network was coming. money. "I think I'd better finish DOS first," he said, "but don't worry." 1MODES The next day another check arrived, this Suddenly we had virtually no income be­ time for the network. I asked how long until yond the six month cushion in our savings ac­ the network would be ready to ship. count. Fortunately, I was working part-time at "I guess I'd better get busy," he said, "but a local bookstore, making enough to cover don't worry." food. Don put in 18-20 hour days. I helped by Don got busy. He had been thinking for having nightmares-something about the At­ some time of creating a simple and affordable torney General showing up at the door. network for the guy with two or three pes. Now he had the time. The Paperwork Before I knew it, he was disassembling and By the time Don finished the network, he commenting DOS. "But what about the net­ was so sick of the project he had a tough time work?" I asked. He assured me DOS would with the documentation. He enlisted my help, gobble the network if he didn't understand it but since most of the stuff was new to me, I just thoroughly. Also, I think he was just curious proofed the copy. about how it worked. We printed the originals on our dot matrix printer, reduced the copy, pasted it up, and hit The Ad the local copy center. Then, stacks of pages, in Soon Don was writing a classified ad for hand, we adjourned to the kitchen table to as­ Computer Shopper to advertise his network and semble manuals. his DOS disassembly. He was sure other people Five a.m. August 5,1987, we finished. We'd might be interested in DOS. That $34 ad received a handful of orders so we duplicated

66 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 disks, packaged everything in hand-cut A Foreign Agent cardboard squares, and shipped. Then one day we received a letter We promptly packed up the car and from West Germany. Joseph Kirsch­ headed for south Texas and the Gulf. baum, a PC-SIG distributor, wanted ex­ Once home, we got our first bug call. clusive rights to sell The $25 Network in The program couldn't read MS-DOS 3.1 Europe. He had read about our network disks. We'd tested PC-DOS 2.1 and MS­ on The Weak Link disk. (That's how we DOS 3.2, assuming that if they worked, discovered the PC SIG Library was dis­ the rest would. Not true! We quickly tributing The Weak Link.) We laughed fixed the bug and shipped updates. when we read the letter, we hadn't even We thought we had a spiffy product, considered overseas sales. but we didn't have the bucks to really He called us before we had time to advertise. We quickly rejected respond. He was serious. We tried our shareware for the network, but we did best to discourage him, but he was so have The Weak Link. persistent we finally relented and

TreeTop provides an easy to use interface to DOS commands. A visual tree of your directory structure is displayed with a point and shoot ability to move around your hard disk. Whether you are doing hard disk housekeeping, reorganizing your directory structure, or simply copying files, TreeTop makes it a breeze. Check out these features: • Fast and user friendly • Pull down menus • Context sensitive help • User installable setup fl;" • Full color or monochrome support • Shell to DOS fL • Execute COM, EXE, and BAT files -<:<,<~.)<. • Point and shoot user interface • Execute your favorite editor • Mouse support (not required) • Sort files by name, ext, size, date/time, ascending or descending order ' • Copy, move, delete, rename, or print Single files or groups of files • When copying, TreeTop will optionally: • Scan and display destination drive • Copy to root • Copy to user defined path name • Prompt user when disk is full • Add, delete, and rename directories • Select and operate on files in a single directory or by the entire drive • Select files by wildcards, date/time, attributes, or individually The Weak Link • Change files' date/time or attributes The hook on The Weak Link was • Find files with speed searching source code. When people registered, • Disk and directory status display they received the complete source. We • View files in hex or text format also mentioned The $25 Network on the Our decision to • Set, rename or delete disk volume labels shareware disk. (Registration is only • And much, much morel $15, but still only two or three register test the shareware Only $39.00 in a month.) Our decision to test the shareware waters did not come 30 Day Money Back Guarantee Price includes disks (3 1/2' and 5 1/4'), registra­ waters did not come lightly because we tion, bound manual, tax and shipping in U.S. Send were quite skeptical. After several lightly because we check or money order to: weeks of agonizing, we sent a copy of Kilgore Software The Weak Link to PC SIG. were quite skeptical. p, O. Box 2291 West Sacramento, CA 95691 While we were waiting (it' seemed (916)371-3715 like forever), we continued running the classified in Computer Shopper. We cele­ or call toll free: brated when sales hit $100 a month. As agreed to terms. We didn't expect too i·S00·TREETOP many similar offers. At the time, we Runs on DOS 2.0 or greater, 256K RAM. with or without a mouse. more money came in, we slowly in­ Quantity discounts and site licenses available. TreeTop is shareware. so creased the size of our ad. We set mod­ looked upon European sales as bonus you can distribute copies for evaluation. est goals and celebrated the gains. money, not really expecting much. Reader Service Number 175

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 67 A week later we got another offer tremely disappointing". We bought a BYTE, so we gave them a call. The ad from Germany. But it turned out that modem and started checking into BBSs was expensive, but if we'd learned one signing with Kirschbaum was an excel­ around the country. When we found thing, it was that advertising sometimes lent decision. We've had a good (and our network, we asked the SYSOPs to pays. We also added PC Resource. profitable) relationship for two years. remove it. Most did and apologized. Some didn't help us at all. Others How Ads Work More Promotion seemed downright criminal. So Don de­ All we expect from the first ad in Meanwhile, business picked up in cided to serialize each copy. He also any publication is that we get as much the U.S. We increased our product line made significant improvements. This in orders as we paid for the ad. So, if and threw in a list of' other products was early 1989. Since then we have up­ the ad cost $400, we expect to get $400 with the orders. We also sent this infor­ dated the network every couple of in orders. After a few months, we ex­ mation with bingo card literature. months. pect an ad to bring in at least three or Other products include: disassem­ four times the money we spend. (Our blies of DOS 1.1 ($15) and 2.1 ($45), The Big Time Micro C Micro Ad does the best, gener­ Weak Link ($15), Hercules Graphics Finally we decided it was time to ating a minimum of 10 times its cost.) Drivers ($15), an 8748 simulator ($15), advertise in other magazines. I con­ A long time ago we decided it would and the System Technical Reference tacted Micro C and signed up for a be better for us to take out a lot of small complete with BIOS calls, DOS calls, year's worth of micro ads. At $79 per ads than gamble on bigger ads in fewer and everything else Don needed to have issue it seemed like a bargain, and that's places. We think consistency and stabil­ on hand while writing drivers in as­ how it turned out. (In fact, it has been ity are more important than single full­ sembly language ($5). The Technical one of the most profitable ads we've page splashes. (Some customers will call Reference has been very popular, even bought. It's obvious from the people only after seeing our ad in several though we don't mention it in our ads. who contact us that Micro C has ex­ places.) Meanwhile, the want ad in Computer tremely loyal and knowledgeable read­ Ads in BYTE's Buyers Mart are $475, Shopper grew larger as we added infor­ ers.) but we got immediate response to our mation on the Hercules Graphics Shorty thereafter I called PC Tech first ad. We received 34 bingo cards the Drivers and the simulator. Journal. Despite their heavy push to sign first week; now we're up to 75 plus per As sales grew, Don put me to work us up for a long term contract, I com­ week. About 25% of the bingo checkers nights (after spending days mucking mitted to just one time. I had to find out purchase after receiving our literature. about in my new archaeology job). I if it was worth the money before com­ Plus, at least 1;3 of our phone orders started by helping out with the mail. mitting to a long run. come from BYTE. Our next big step was to take out a I soon discovered I'd made the right PC Resource wasn't as successful at small showcase ad just for the network. decision. We'd caught the last issue of first. We had just about decided to The ad cost $250, very foolhardy. It the magazine before Ziff-Davis folded spend the $306 per issue elsewhere, but meant we would spend close to $400 it. Other small advertisers were not so response seems to be steadily im­ per month advertising in Computer lucky. They saw their ads continued in proving so we'll probably stay. Shopper. Plus, they wanted a three­ publications not of their choosing. This Computer Shopper has been a con­ month commitment. was only the first of several bad ex­ sistent performer though we've ex­ periences we've had with Ziff-Davis. pected response to go downhill as the All The Way (And Ziff just recently bought Computer .magazine gets larger. So far that hasn't By October 1988, I'd quit the digs to Shopper.) happened. We have been in their Shop­ go full time on our business. It was a pers Mart for over a year. It generates risk, but Don couldn't handle it alone. I Plastic slightly less response than BYTE. worked on packaging and promotion Obtaining a vendor account for Besides trying different magazines, while he improved the Network and VISA/MasterCard was another chal­ we've also tried different slogans. The worked on new products. lenge. We had sent a significant number one we've settled on is: "Skeptical? We We began promoting our products at of orders "net 10," hoping the customer make believers." Does it work? Every local shows. Don and I and our two would send us a check when he re­ day we get several calls that begin, boys stayed up half the night copying ceived the product. Some customers "Make me a believer." And we get let­ disks and collating manuals, getting were very impressed with our trust, ters signed, "Skeptical." ready for the first show in Fort Worth. and most eventually paid; but the few The turnout was terrible and we sold who didn't were a constant source of On The Road only five copies of the Network. We aggravation. We needed VISA/Master­ Early in the spring of 1989, I read had better luck in Dallas a few weeks Card. with great interest about the B.C. SaG later, but the experience taught us a les­ Entering a bank and mumbling in Micro C. I was convinced we should son: THINK BIG, but don't be surprised "mail order" is like putting a kerchief try to go on the road with The $25 N et­ by small. over your face and shouting, "Stick 'em work. Besides, we had planned a West up." It took months to convince just one Coast vacation. Don agreed. Sharing The Network bank we were legitimate, but it paid off. We had no idea what a SaG was, Around this time we received some Our volume doubled. but thought there was a chance we bad news. Someone was uploading our It was time to increase our advertis­ would meet the editor and perhaps con­ network to bulletin boards. This was ex- ing again. Our goal had always been vince him to look at our product. We

68 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 hooked up with an answering service ing. Plus, if Microsoft, with all its over­ number, a BBS, and a FAX). Don's also and a mail service and drove to Canada. head, can sell Quickbasic for $59, we finishing up a whole new network. The B.C. SaG was wonderful. We should be able to prosper at $25. Our new net should handle 20 to 30 had so much fun that we followed up It's not our customers who complain nodes, be very flexible, and support lots with the Rocky Mountain SaG. Sales­ about the price, it's the dealers. They of different hardware such as serial wise, our trip to Colorado was more want to make $100 for a IS-minute sale. ports, parallel ports, arcnet cards, and successful than B.C. I decided in Fine. But until someone explains to us SCSI. It will also include all the specs Colorado we would go to SaG East, but exactly why we aren't making money at for the hardware interface. That way it took me about a month to convince $25, we'll go happily about our business purchasers can write their own hard­ Don. I just couldn't let Dave be the only and bank our profits. ware drivers. Target price will be $75, one to complete the Tour de SaG '89. We started small, borrowed no and we'll offer a $25 discount to current Editor's note: Tour de What? I have to ·money, and took no great risks. That's customers. admit that Kim and Don really know how probably why we're doing well today. On the marketing side, we'll keep ex­ to network, and it was great seeing their We've made a few mistakes. Don panding the advertising slowly. What friendly faces in Port Alberni, B.C.-Gun­ should have quit consulting six months would we do if we got 10,000 orders in nison, Colorado-York, Pennsylvania­ earlier. We should have serialized each a month? We'll be adding some regional and Dallas, something. (Dallas used to have copy of the network from the begin­ publications as well as some language a football team. I think.) ning. We probably should have in­ magazines. Finally, we'd like to try PC As I mentioned, we'd originally at­ creased advertising faster. Maybe we Magazine, if we can justify the expense. tended SaG in hopes of meeting the should have charged more for the net­ editor of Micro C. Well, at the Longhorn work. But this is all hindsight. Contrary SaG here in Texas, Dave became the to popular belief, hindsight is not 20/20. • • • fifth member of our family. We have a small two-bedroom house, so Dave The Future bunked with the kids. There's nothing Soon we'll be moving to larger quar­ like rubbing elbows with the rich and ters (room for help) and adding addi­ famous! tional phone lines (including an 800 Editor's note: I was sure 1'd debunked the rich and famous part, but I must thank Kim, Don, Courtland, and Donald for put­ ting on the Longhorn SOG and for inviting me to be a part of their wonderful (tight­ knit) family. Which brings us to today. Business is better than ever. The two of us barely keep up, and it's time to think about I moving to a larger house and hiring help. Goodbye BASIC, C, COBOL-hello PASCAL! Now, to make RIGHT-COMPLETE SATISFACTION GUARANTEED OR Why$25? this most advanced language available to more micro us­ YOUR MONEY BACK! • Our success surprises many people. ers, we've cut our price-to an amazing 529.95! This In addition, if you want to copy the diskette or looseleaf astonishing price includes the complete JRT Pascal sys­ manual-so long as it's not for resale-it's o.k. with us. After all, they constantly tell us we can't tem on diskette and the comprehensive new user manual. Pass it on to your friends! This is a Limited-Time-Offer. make money selling a program for $25. Not a subset, it's a complete Pascal. Check the features. SO ACT TODAY-DON'T DELAY ENJOYING PASCALS We hear that all the time. In fact, we get ADVANTAGES-AT $29.95, THERE'S NO REASON TO tired of hearing it. Separate compilation of external procedures • WAIT! We decided on $25 for a few good Auto-loading • 14 digit FLOATING POINT arithmetic • True dynamic storage • Verbal r···································r. reasons. At the time, $25 seemed like a To: JRT SYSTEMS lot of money. (That was all we could error messages • Fast one-step compiler: P.O. Box 187 ria no link needed • Graphing procedures • Statistics have afforded if we were buying a net­ Enola, PA 17025 procedures • ActiVity analyzer prints program phone 717/732·1093 work.) We had no money for advertis­ use histogram • Operating system interface ing, so the name of the product had to O.K. You've sold me. Send me JRT Pascal by return mail. THIS IS THE SAME SYSTEM WE SOLD FOR 5295! I understand that if I'm not completely satisfied, I can grab attention. Finally, our goal was to return it within 30 days for a full refund. So how can we make this offer?-why the unbelievable sell to the majority who had two or 1 1 deal? Very simply, we think all software is overpriced. We I need 0 5 /4" disk or 0 3 /2" disk. 0 Send me the three computers-not to the relatively JRT Pascal program formatter too, for only $14.95. few who were putting together large want to build volume with the booming IBM market, and Name ______our overhead is low, so we're passing the savings on to Address ______networks. Probably most important, you. though, people don't need a lot of con­ City State __ Zip __ AND AT NO RISK! vincing to spend $25. o Check/M.D. 0 COD 0 Company P.O. [add $20] Also, we wanted our customers to When you receive JRT Pascal, look it over, check it out. If you're not completely satisfied, return the system within PA residents add sales tax. Add $10 for shipping outside feel like they got the buy of the year. US/Canada. US funds on a US bank only. Needs only 30 days and your money will be refunded in full! THAT'S 192K and 1 floppy drive. We didn't just want their money-we L...-.------...... I wanted their word-of-mouth advertis- Reader Service Number 154 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 69 Letters continued from page 6

reformat) and it's like I have a new matting, reformatting to the old inter­ drive. I've not had a single read/write leave before writing the data back. error in over six months and peTools Needless to say, this is time consuming can't find any sectors to balk about.· and tedious and very, very slow going. Sure, it took about 12 hours for SpinRite 'Till I can get an answer to this prob­ to do its stuff, but it beats having to re­ lem, I'll just stick to the old tried and format my hard disk every month and true approach of a complete backup spend an hour or two feeding it disks. (preferring my trusty Archive 60 Meg I've since used SpinRite on the Mini­ tape with Sysgen controller), then refor­ scribe cards in my other computers and mat the drive and restore the data. This have not had any problems with the not only gives me the proper interleave, drives afterwards. In your editorial you but also has a side effect of making all imply that the problems that have been my files contiguous for faster access. reported seem to be limited to Seagate Other notes. Does SpinRite allow drives. Maybe you should pan the Sea­ you to set the skew factor? This is a gates (as you usually do-that's why I fixed offset in the interleave for each bought Miniscribe) instead of SpinRite! succeeding head, in case your controller Well, you wanted feedback. For me, or drive is slow in switching from head SpinRite has been a lifesaver and I think 2 to head 3. Skew factor can amount to that you've done both your readers and though. Perhaps you can answer this about 5% of the throughput. Normal Gibson research a disservice by steering for me. values of 0 or 1 usually are fine. Note, 0 those of us with XT-type hard drives Assume I have a hard drive for­ gives you no skew. away from such an outstanding pro­ matted at, say, 4:1 interleave. This hard Another thing-can you reformat duct. I feel bad writing such a critical drive has had some use over the years, only part of the drive? I wrote a refor­ letter; Micro C is the only magazine and it has a few bad sectors that were matter in C for IBM AT clones that does (computer or otherwise) that I read not on the original bad track table. No both of these. DOS can handle 2:1 MFM from cover to cover as soon as it arrives, real problem, though, because DOS's using a WA-2 controller, but Microport and I recommend it most highly. But I FORMAT command noticed it couldn't UNIX can only keep up with 3:1. I did think that you really goofed on this read those sectors and marked them (in not want to slow DOS down, and didn't one.... the FATs) as unusable. want UNIX to run slow either, so I re­ Now I gets me a copy of SpinRite, formatted the back two-thirds of the Joel M. Goldberg and I sez to it, "Figger me out the best disk to 3:1. Pretty slick, but not a project RD#1 Box 230 interleave and rebuild my drive." Off it for the faint of heart. Richmond, VT 05477 goes on its merry way, and 10 and be­ I do appreciate the magazine; it's the hold it finds out the best interleave for last known true hacker (in the old style Editor's note: If you felt bad enough, you my system is really 5:1, not 4:1. It mer­ of the word) magazine around. DDJ has could bring over your lawn mower. Ap­ rily reformats my drive by reading in a gone commercial, BYTE has become a parently the SpinRite folks thought 1'd track at a time, then reformatting that small Computer Shopper, and everybody trashed their product, too, and I feel bad track to 5:1, then writing back that same else is just dying to know Bill Gates' about that. (I'll help you with the grass.) track of data. latest breath. Micro C just keeps on We've been chasing a problem with our Here's the fun part. It gets to the bad cranking out interesting hardware and BBS for the pastfew months; it's been going spot. Reading in the track, it notices it software for true hobbyists. off into never never land fairly regularly. cannot read sector 7 of this track cor­ Larry noticed some sector errors on the little rectly. It reformats the track and tries to John Welch Microscience drive so he ran SpinRite on it. write the data back again. The bad spot 1310 Kenneth Circle The system's been flawless since (and it's an is no longer in sector 7! We just moved .Elgin, IL 60120 XT). things around, and now the bad spot is Plus, of course, 286 and 386 hard drive in sector 12! Editor's note: Any answers for John? controllers don't have the homing problem If it writes this track back, it will be Anyone? As for Bill Gates, he's welcome to (the problem really resides in the XT' 5 con­ guilty of the major crime of putting stop by the Micro C office anytime, espe­ troller). I don't know; use SpinRite if you good data on a nonreadable bad sector, cially if he has a lawn mower. wish, we're using it. However, you might as well as the minor one of leaving a want to read the following letter before let­ now good sector marked bad. Beware The Big Time ting it change the interleave. The safest way to reformat your hard I take keyboard in hand to write my drive out from under existing data first-ever letter to an editor. The motiva­ SpinRite Questioned would require skipping any track that tion comes from reading "Around The Noticed that you have taken a liking had a bad cluster marked on it, deter­ Bend" in Issue #50, which makes me to SpinRite. I have a little nagging mining the interleave for each track and wonder if maybe you haven't finally doubt about using that program, if that track sprouts an error during for- gone (around the bend, that is).

70 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 On one hand you make a good point Editor's note: Thanks c.R. However, I about a marketeer's value to an enter­ think it's time for Micro C to reach out, prise and the need to find one's niche; and I think it can be done without losing on the other, you say you're ready for Mi,cro C's style. some heavy duty "focusing" and "sig­ nificant playing" in the publishing biz. SMUG Lives! While "focusing" and "playing," you I read with interest your discussion are going to keep Micro C as appealing of "The End of User Groups" in your as ever. Good luck. editorial of Issue #47. I would like to One of the things I find most enjoya­ make the following points. ble about your magazine is precisely its (1) The Sacramento Microcomputer lack of focus. It is one of the few publi­ Users' Group (SMUG) still exists and is cations I read cover to cover because healthy in spite of reduced membership. Organize, Query, every article is different, and every ar­ (2) SMUG meetings have presenta­ ticle is interesting. tions and discussions involving pre­ & Make Connections While I'm not knowledgeable in the sently popular computers, including Between Files of Information yins and yangs of magazine publishing, IBM PCs (and clones), Apple II GSs, I can't help but think that being a bi­ Atari STs, and Amigas. Your article monthly and operating away (a long stated that SMUG was going out of bus­ MICRO EINSTEIN way 'away) from the "media centers" iness because "it stayed with CP 1M, The Expert System Shell contributes mightily to this. Good S100, and other (more and more) gravy, ask for a partner of the type you unique systems." That is not accurate. • Create expert systems des(:ribed and you're liable to get Ziff­ SMUG supports a wide variety of popu­ easily in minutes Davis. I can see it now: "Tidbits" by lar . • With pulldown menus and John Dvorak. (3) SMUG's members consist of You started from scratch, you've at­ people whose interests lie in the more windows tained a loyal following, and maybe technical aspects of computer hardware • Automatic rule generator now it's time to cash in and head for the and software. They tend to have an in­ • Context-sensitive help mountain (I thought you were already terest in "what goes on under the there). I don't have any arguments with hood" and why. Frankly, SMUG mem­ • Free example expert that; but I'd rather see you take your bers are the audience that Micro Cornu­ systems gains and pack it in than let Micro C be­ copia targets. • Interactive full-screen come another PC Magazine. I enjoy reading your publication. text editor While I'm spilling my guts, let me Glad to see that you are reading ours! put in a plug for Bob Morein and more • DOS access from shell articles on UNIX for 386-based PCs (as Don Del Porto • Turbo fast execution opposed to dedicated work stations). I'd SMUG President (NOW 5 times faster!) like to know more about the hardware P.O. Box 161513 requirements to run UNIX efficiently Sacramento, CA 95816 For Diagnosing ... and reliably on a . Also: will UNIX ever have a stand­ • • • Monitoring ... ard? If so, which of the current crop is Indexing ... the best bet? Will UNIX ever get a Mac­ Organizing .. . like interface? Just how portable is Classifying .. . UNIX across different CPUs? I don't remember when I first sub­ & Discovering links scribed to your magazine; however, I do between files of information. recall that I was still using a Kaypro 2. Since I recently re-upped for 18 more is­ ONLY $99.95! sues, I feel I have the right, indeed an obligation, to make my views known on the proposed shift to the "big time." P.S. I think you've already found your niche.

C. R. Bartchy 4340 South Hopkins Ave. ACQUIRED INTELLIGENCE Suite 230 p,O, BOX 2091 • DAVIS, CA 95617 • (916) 753-0360 Titusville, FL 32780 Reader Service Number 72 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 71 Continuing AROUND THE BEND

"It must have been your significant other, but as long as I've got you on the phone.... " "Look, I didn't request any information. My significant other didn't request any information, and I'm certainly not in­ terested in connecting up with a dishonest futures trader." (After watching the papers, I'd suspect that adding l "dishonest" was redundant.) It turns out I'm not interested in futures, at least not the I kind that cause grown men to stand in pits shouting and waving their hands. (All the while hoping the guy on their elbow doesn't work for the government.) }) This is just one of a plethora of sales calls I've received in the past month. Stock and bond brokers every other day, all trying their best to sneak past Nancy. "Dave, someone on the phone says he's calling about your new business card. I don't think it's legit." It wasn't. He was a stock broker. Folks selling penny stocks (stocks in the 10¢ to $5 range, not traded in a major exchange) have been particularly active. I bit once, lost most of $1,500 on Environsure, a waste processing company that apparently was dumping, not processing. I purchased the stock because the Blinder Robinson sales­ man told me the stock was moving up rapidly. Curiously, its direction changed a few days after I bought it.

Program FASTER with ••• Then I read in The Wall Street Journal that penny stock­ brokers (including Blinder) often purchase large blocks of shares and then push the shares at a big profit. Once the push CC-RIDER is over, the price nearly always falls into a hole. In this case, THE C PROGRAMMER'S COMPANION not only did the push end, but the government started criminal action. After all that, the Blinder salesman asked if I'd like to move into something a little more solid-part of a race horse. (I didn't ask which part, but I figured he was trying to saddle me with yet another slow mover.) PROFESSIONAL EDITION This experience made me really appreciate The Wall Street Journal. The Journal not only gives me the latest on financial CROSS-REF Editing! Function Prototypes! QulckHelp, too! scams (I read about diamond, platinum, and oil drilling rights Instantly recall your C Build a database of useful CCSYM can also create a scams just days before the calls started), but it also covers com­ symbol definkions by hkting information for your C code help database for your puter companies. In fact, it often covers things untouched by a hot-key inside your edkorl whh CCSYM, a powerful program which is Along wkh standard source code analyzer compatible whh Microsoft's the computer journals. CCRIDER features like which can generate fully help system, QuickHefp. All For instance, there's Miniscribe. Source View, Edh and commented function symbols in your application Miniscribe has a reputation for solid drives, but I didn't Definhion Paste, the new prototype #include files are accessible from realize just how solid until I read the Journal's piece on the Professional Edition has a for your program's static and QuickHelp's menus, Symbol Browse mode and global function definhions. together with company. Miniscribe was apparently shipping bricks (solid even lets you walk through Imaginel - No more manual documentation extracted new bricks) instead of drives to make it appear that sales were all usages of a symbol. k's maintenance of function automatically from your growing. I can imagine some dumb dealers, serious anti-tech­ on-line cross-referencing declarations ee and you original source code. asyoueditl know they are consistent! nical types, but it's hard to believe they were fooled. Plus, I'm sure dealer training firms were quick to add the appropriate classes: "This is a hard drive-this is a brick." "This is a hard drive-this is a brick." "You don't slop mortar on a hard drive." "You don't install a brick in a Mac." Usually.

Reader Service Number 169 72 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 The $25 Network "Yep." We were well into SOG East (great SOG, by the way). Don "If operator two were distracted for a second?" Jindra had cabled up three computers and started his presenta­ "Uhmmmm." tion on networks (mostly his network). It was early afternoon "We're all weird. You know that." so the the previous night's Jolt SIG had nearly worn off. With networks the latest rage, I'm constantly asked by local Like his presentation at the BC SOG, the group response people what kind of system we use. began with the usual, "Bet it can't...," passed through, "Wow, I used to tell them, "We don't have a network." really?" and finally settled into an easy banter. Now I tell them, "Oh sure, we run the $25 network." "What if you were on system one and the guy on system I like it, too. I can network any two systems in the office two started harassing you? Could you do something nasty?" just by connecting them together via serial cable and booting That brought the few still-fuzzy heads off the table. them both off the floppies I set up with the network and DOS. "Could you lock up his keyboard?" At 115K baud it's not as fast as ARCNET, but it's a lot cheaper. "How about really slowing down his system with some- I just built an AT to replace the XT we've used for receipts thing disk intensive?" and labels. Counting everything, it was about 10 megs of pro­ "Format his hard drive?" gram and data. In five minutes, I had the two systems cabled "Yeah, how about formatting his hard drive?" together, had booted them up on the network disks, and voila: "Nope, you couldn't run FORMAT on system one and have drive C on the XT became drive F on the AT. I simply used it format a drive on system two," Don broke in. "DOS won't COpy *.* to move all the files from F to C and that was it. let you do that. You'd have to be running FORMAT on system I'll leave the two connected and once a week back up the two. However, my next version will not only let you com­ AT's files to the XT. Not bad. municate with the operators of the other machines, it'll also let you take control of those machines and run programs on them Cards In Magazines just as though you were sitting in front of them." I was speaking to the PC SIG in Dallas when the question "The ultimate multitasking?" came up. Why do magazines contain so many cards, the ones "Right." that fall out everywhere. "That includes FORMAT?" Actually, we don't have loose cards in Micro C, but there's a

If you thought Borland's popup product was great just wait untn 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. Simp­ Mandelbrot Explorer 3.2 ly type part or all of the name and press the hotkey. MyFLIN will popup over your source code and display the nearest Fantastic fractal grapnlcs on 16-color EGAjVGA to 800x600. named description you have stored in your database, complete Magnifies up to 16.5 trillion times. Stop and start at will, save and with parameters and comments. retrieve, collage, full control over color boundaries, ''zoom box, " display ofperiodic orbits, auto-backup, all optimizations for speed including pixel interpolation and 386 integer SUpp01t. Comes with To save a new description, positon the cursor on the procedure seven ready-made pictures for immediate gratification. 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. $34.95

Price $69.00 + $5.00 P&POSt. Peter Garrison Visa / Mastercard / American Express are accepted. 1613 Altivo Way Los Angeles, CA 90026 32~lfo~!£!t~~tr~~o~~~E~A1~~057 2136651397 Phone 1-800-336-6644 When ordering please specify EGAfVGA and disk format Overseas orders please add $4 MyFLIN requires PC/XT/AT Computer and MS-/pC - DOS 2/3.xx.

Reader Service Number 161 Reader Service Number 112 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 73 very good (but little known) reason other magazines do. No, MICRO CORNUCOPIA it's not an overabundance of trees, it's an underabundance of postal workers. XT SCHEMATIC You see, for many years the postal service was losing mail­ men. Yep, they'd find a good man, train him for a month on his new route, send him forth alone, and never see him again.

At last you can plumb the mysteries of your com­ puter with this single sheet schematic of the IBM Xl's main board. A wealth of Informaffon for both True Blue and clone owners.

Although clones use sllghtiy 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. UI sucker won't even beep. A look at the sche­ matic shows the location of parallel port A. You know that the power-on self test loads a check­ point 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-XT 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 For a while they suspected pit bulls or UPS drivers, but it comes complete with an Illustrated theory of turned out their new charges were simply getting lost. So operaTIon that's keyed to the schematic. You get magazine publishers got together and came up with the idea detailed InformaTIon available nowhere else. of inserting loose cards. Within a month, every mail route had become a trail of cards. (Hansel and Gretel should have car­ Kaypro II & IV (pre-84) ...... $20.00 ried magazines into the woods rather than bread.) Kaypro 10 (without modem) ...... $20.00 The post office was happy, the publishers were happy, and now that you know why the cards are there, you can be Kaypro 2, 4, and 10 (84 series) ...... $20.00 happy, too. (Now if we could just keep those vicious little Boy Scouts from going out on litter patrols .... ) NOTE: These packages cover only the main boards. You're on your own when It comes to disk 286, 386, 386SX, 486 drives, power supplies, vld~o cards, etc. There's been a bit of controversy about chip choices. Over the past year, we've bought four 12 MHz 286 machines. After Phone Orders: (S03) 382-5060 or 1-800-888-8087 the 8 MHz 186s and the 6 MHz AT, they've been wonderful. Monday-Friday, 9AM-SPM PST With Intel getting $300 a piece for 386s, there didn't seem much reason to purchase anything beyond the 286. Micro Cornucopia, Now, however, there might be a few reasons. P.O. Box 223, Bend, Oregon 97709 • Intel's dropped the price of the 386 and the 386SX. • We're beginning to hear about some interesting applica­ tions that take advantage of the 386. There's windows

74 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 RABBIT CHICONY McTEK GAS PLASMA PORTABLE LAP-TOP EGA PORTABLE

*LCD PORTABLE ALSO AVAILABLE • 80286-16 CPU (O WAIT STATE) • 80286-12 CPU • NEAT, TURBO PAGE MODE SPEED UP • 286-12 CPU, LANDMARK = 16MHZ • 640K MEMORY, EXPANDABLE TO 4MB TO 21.4 MHZ • 640K DRAM (EXPANDABLE TO 4MB) • DUAL SPEED 6/12 MHZ, 0 WAIT STATE ·1MB ON BOARD, EXPANDABLE TO • 0 WAIT STATE, DUAL SPEED 6/12 MHZ • LANDMARK 16 MHZ 5MB (EMS V 4.0) • DUAL FLOPPY AND HARD DISK • 5 SLOTS, EXTERNAL 5V4" 25 PIN DRIVE PORT • CGNMDA/EGA, 640x400, 4 GRAY CONTROLLER (1=1 INTERLEAVE) • CGA/MGA/EGA 64Ox400, 4 GRAY SCALE LARGE GAS PLASMA DISPLAY • ONE 1.2MB FLOPPY DRIVE ·101-KEY ENHANCED KEYBOARD • 1.2MB FLOPPY AND 40MB HARD DISK • ONE 20MB HARD DISK (40MB) • GAS PLASMA DISPLAY • "84 + FN" ENHANCED KEYBOARD • TRUE OS/2, XENIX, MS DOS AND • 1 PARALLEL, 1 SERIAL • 1 P/2S (D-9 and 0-25), REAL TIME CLOCK COMPATIBLE • 200WT AC 110/220 AUTOSWITCHABLE • 1OOW, AC 110/220V SWITCHABLE • 80287 MATH CO-PROCESSOR SOCKET • EGNMGA MONITOR PORT 9 PIN • 14.8" x 13.4" x 3.7", 15.4 LBS. • ENHANCED 101 KEYBOARD • HARD DISK/FLOPPY DISK CONTROLLER • CARRYING BAG w/SHOULDER STRAP wlTACTILE FEELING • 1.44MB FLOPPY DRIVE AND 20MG • ONE YEAR WARRANTY • 2 SERIAL PORTS, 1 PARALLEL PORT HARD DISK 40MS AND 1 GAME • 9.45"x16"x8.27" 19.8 LB...... $3400 • LED INDICATORS • CARRYING BAG w/SHOULDER STRAP • 200W UL POWER SUPPLY • ONE YEAR LIMITED WARRANTY • ONE YEAR WARRANTY GAS PLASMA ...... $2199 ...... $2299 LCD PORTABLE ...... $1729

McTEK 286/12MHZ McTEK 386/165X McTEK 386-20MHZ Assembled & Tested IBM® AT Compatible Assembled &Tested IBM® AT Compatible Assembled & Tested IBM® ATCompatible MS-DOS® OS/2® Compatible MS-DOS® OS/2® & UNIX® Compatible MS-DOS® OS/2® & UNIX® Compatible 80286 12/6 MHz 80386 16/8 MHz Norton V4.0 SI 17.6 8038620/8 MHz Norton V4.0 SI 22 Phoenix BIOS Phoenix BIOS Phoenix BIOS 640K of RAM Expandable to 4MB 1 MB expandable to 16MB RAM 1 MB expandable to 16MB RAM o Wait State 80387 Coprocessor Socket 80387 Coprocessor Socket 200W Power Supply 200W Power Supply 220W Power Supply 1.2MB Floppy Drive 1.2MB Floppy Drive 1.2MB Floppy Drive Ports: 1 Serial, 1 Parallel, 1 Game Parts: 1 Serial, 1 Parallel, 1 Game Ports: 2 Serial, 1 Parallel, 1 Game Dual Floppy/Dual H.D. Controller Dual Floppy/Dual H. D. Controller Dual Floppy/Dual H.D. Controller Monochrome Graphic Card Monochrome Graphic Card Monochrome Graphic Card 101 Key Enhanced Keyboard 101 Key Enhanced Keyboard 101 Key Enhanced Keyboard TTL Monitor 12" TTL Monitor 12" TTL Monitor 12" 20MB Hard Disk (40MS) 20MB Hard Disk (40MS) 40MB Hard Disk (28MS) Options:...... Call Options:...... Call Options:...... Call $1,19900 $1,49500 $1,99500

DISK DRIVES PRINTERS MONITORS PC/XT PC/AT MISC. Fujitsu 360k ...... $69 Citizen CD 120 ...... $149 Samsung amber ...... $79 640k TurboMothrbrd ...... $80 McTek 286-20MHz ..... '" $359 Kingtech CRT Portable Kits: Fujitsu 1.2MB ...... $89 Citizen CD 180 ...... $189 Samsung EGA color ..... $359 10MHz TurboMothrbrd ... $85 McTek 286-12 ...... $259 XT/AT (powersupply. case Teac ...... $75 HPLASAR SeriaI2 ...... $1699 Samsung RGB color ..... $259 Multi 1/0 w/disk contrir ... $59 McTek 386-16SX ...... $429 keyboard. monitor) ...... $3801$410 Teac 1.2MB ...... $89 Epson LX-800 ...... $219 NEC Multisync ...... $559 640k RAM card ...... $39 McTek 386-2DMHz ...... $699 Eprom burner 4-socket$139 Teac 3'12' 1.4MB ...... $89 Epson LO-5oo ...... $379 Sony Multiscan ...... $619 2MB Expansion card ...... $89 McTek 386-24MHz ...... $899 LCD Portable ...... $799 20MB Hard Disk Kit...... $279 Toshiba 321 XL ...... $519 HGC-compat.mono card. $49 RS232 2-port card ...... $35 Locking slide case ...... $59 Plasma Portable Kits " $1499 30MB Hard Disk Kit...... $309 NEC P20OO ...... $369 Color graphic card ...... $49 4-serial port card ...... $79 200W power supply ...... $65 AC power strips ...... $15 KL320 (40MS) ...... $215 Call for prices of other brands EGA Paradise 480 ...... $149 Game 1/0 card ...... $15 Enhanced keyboard ...... $59 Diskette file box ...... $9 8425 Miniscribe ...... $249 VGA Paradise ...... $279 384k Multifunction card ... $69 WD FD/HDC ...... $129 Printer or serial cable ...... $8 8438 30MB Miniscribe $259 Genoa Super VGA ...... $299 FCC-app. slide XTcase ... $29 DTC FOC/HDC 1:1 ...... $189 MODEMS Archive Tape Backup 3650 40MB Miniscribe $349 150W power supply ...... $49 3MB EMS (CJK) ...... $99 40MB ...... $339 3675 60MB Miniscribe $379 300/1200 ...... $79 MOUSE XT keyboard ...... $42 ST-157 49MB 3'12· ...... $479 2400 external ...... $139 Logimouse C7 ...... $69 Clock Card ...... $19 DESKTOP XT 10MHz 640k 2400 internal ...... $99 Logimouse H1 Res ...... $99 Floppy Controller ...... $19 2 Drive System ...... $759 McTek Systems, Inc. ·1521 San Pablo Avenue • Berkeley, CA 94702 • 415-525-5129 Reader Service Number 42 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 75 386, OS/2 (forget PM), and Nu-Mega's SoftIce (I've their 286 boards as 386 machines. That's· probably true; but if heard wonderful things about it from C developers). you need the 386 architecture and can live with a 286.bus, it's • An Intel marketing type did. a presentation at the Lon­ probably not a bad way to go. ghorn SaG. Fortunately he had been a technical type in Anyway, with 386 and 386SX prices way down and with a previous life and he knew the 486. He said that as far the 386's ability to watch itself run (necessary for the ICE and as architecture is concerned, there's no real difference be­ serious multi-anything), plus its ability to create memory seg­ tween the 386 and the 486. So, unlike the jump from 286 ments of any size (it can view all your RAM as one large seg­ to 386, the 386 will do everything the 486 can do. ment), I'd think twice before purchasing another 286. That doesn't mean there's no reason to buy a 486. The 486 On the other hand, those little baby AT boards are so cheap will run instructions in half the clocks· (an average of 2) per and those tiny tower cabinets so cute, they make tempting re­ instruction. Plus the 486 is supposed to be out the chute at 33 placements' for 7 MHz XT "turbo" boards. I've heard that MHz with 40 MHz and 50 MHz parts very soon now. (His most of the baby AT cards will accept all the original XT plug­ words, not mine.) in cards, including the hard drive controllers. (Ask your dealer The initial production will run about $1,000 per. part with to try it before he says it won't work.) prices scheduled to settle into the $300 range by fall 1990. That sounds high, but it includes an on-board 387 (487?). Float Attention Spies times will improve drastically because the ALU won't have to There's no longer a reason to dig out your stock of master go through all the motions of waking up an external chip, keys ... no need to sneak into the Micro C office at midnight. giving it control, and waiting for notification that the We're now available on microfilm. This is not part of a plot arithmetic's finished. but rather a way to make Micro C available to ants, amoeba, Also, there's 8K of on-board cache and transfers from cache gnats, and squinty-eyed librarians. to the ALU happen in 128-bit chunks. Interesting. If you want to order a reprint or just an article from an Now the 386SX (sounds like it should have a V6 and fuel issue that's out of print, you can contact: injection) is a bit controversial. Some folks think it's a 386 that Intel crippled to make it easy for manufacturers (IBM) to sell University Microfilms International 300 North Zeeb Ro'ad Ann Arbor, MI 48106-1346 (313) 761-4700

68000 SINGLE BOARD COMPUTER Of course, if the issue is still available, you'll probably want to get the original version directly from Micro C. See the back issues list on page 94 for more information.

Transparent' ROMs About half way through the Embedded Systems article in this issue, I realized I was: 1. Very interested in the C-Thru-ROM package, and 2. Very hungry (it being halfway through my lunch hour). Knowing I could either: 1. Call immediately, meant missing lunch, or • 512/1024K DRAM • 4 RS-232 SERIAL PORTS 2. Grab a byte of lunch and then call Datalight. • FLOPPY DISK CONTROLLER • REAL TIME CLOCK I called Datalight on a full stomach. NEW LOWER PRICES! That was fortunate, because I had some zingy questions: "Is it all that easy?" BASIC KIT (8M HZ) - BOARD, MICROPROCESSOR, HUMBUG MONITOR! BASIC IN ROM, 4K SRAM, 2 SERIAL PORTS $200 "As easy as what?" "Does it only work with Microsoft C 5.x?" PACKAGE DEAL - COMPLETE KIT WITH 10MHZ MICROPROCESSOR, , SK*DOS OPERATING SYSTEM, 512K DRAM $499 "No." SYSTEM BOARD (12MHZ) - ASSEMBLEDITESTED, 1MEG RAM, 6 PC/XT It turns out that C-Thru-ROM 1.50 also works, in a limited PERIPHERAL PORTS, SK*DOS $699 fashion, with Turbo C 2.0. By early January they're supposed to have a new release that does everything with Turbo C. COMPLETE INFORMATION AVAILABLE UPON REQUEST Then Datalight sent me the package. Unfortunately, their PERIPHERAL TECHNOLOGY sample program (SIEVE.x) didn't work because they hadn't 1710 CUMBERLAND POINT DR., #8 included the right .MAP file. Did we have Microsoft C? A MARIETTA, GA 30067 404/984-0742 quick perusal showed the cupboard was nearly bare. No Microsoft C, but some extended scrounging turned up COD/MASTER CARDNISNCHECK SK*DOS IS A TRADEMARK OF STAR-K SOFTWARE SYSTEMS CORP. Quick C (probably too quick) and Turbo 2.0. Ah hal So I recompiled, linked, and MAPped with Turbo. Doing all the usual new-package fumbling, it worked. I connected Reader Service Number 119 76 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 my laptop to my AT via a. serial cable, ran their little kernel 16K of C. Russ Eberhart and Roy Dobbins couldn't neural net­ routine on the laptop (so it pretends it has a kernel ROM work without 18K of C. We bit our lips and made room. Then, plugged in), and fired up Datalight's remote debugger. not to be outdone, Scott Ladd sent in 26K with his C column Wow, the debugger downloaded SIEVE to the laptop via and Greg Landheim is our champion with 34K of 3-D. the serial connection and then let me single step through the Between Scott and Greg, that's 18 pages of C, space for at program, either in C or in assembly. I could even watch the least four (unlisted) articles. variables .... Oops. Unfortunately, it didn't understand most of All right, already. If you authors can't be a little briefer, the variables. Oh yeah, this version only understands Turbo's (you know about "little briefers," right?) then you'll be globals; next version adds the locals and statics. relegated to the BBS and the issue disk(s). Starting right now. Ah well, I went back to the source and made all the vari­ (Great Scott! What'll Mr. Ladd say?) ables global. Wow, the AT's screen displayed the contents of C So, to get Scott and Greg's code (along with the printed variables as the laptop ran one line at a time. code), you'll just have to: This isn't a particularly fast environment (the serial link be­ 1. Download ISSUE-5l.ARC from the Micro C BBS. (503) tween the two systems is one reason), so they suggest you 382-7643. (300-1200-2400, 8,1,N, 24 hours) break up large routines for debugging. But a wonderful en­ 2. Send $6 ($8 foreign) to Micro C, P.O. Box 223, Bend OR vironment? Yeah. Seriously. 97709, or call (800) 888-8087 (Visa/Mastercard) and ask for the Issue 51 disk. Our issue disks contain all the code, printed or Datalight C-Thru-ROM $495 not. Price includes postage. (Sometimes an issue disk is as 17505 68th Ave. N.E., Suite 304 many as three disks, but it's still only $6). Bothell, WA 98011 (206) 486-8086

This Issue Is Listing Boy, are we on somebody's list this issue. Gary threw in 9K of Turbo Pascal with Tidbits. Bruce Eckel's voice contained David Thompson, Editor and Publisher

PROMPT DELIVERY!!! SAME DAY SHIPPING (USUALLY) ICs QUANTITY ONE PRICES SHOWN for OCT. 29, 1989

DYNAMIC RAM AST Prem386/33Mhz $300.00 SIMM (1) 256Kx36 80 ns 300.00 ~of:- ~',,~ ~q!f;o qt?l\'b~ SIMM} 1Mx9 80 ns 120.00 qt?l'};'D SIMM (2) 256Kx9 ns ..\~~ YOU WANT THE SQURCE1! ,.,f8 100 35.00 ~tt' ~~\~e 1 Mbit 1 Mx1 100 ns 10.99 VELL NOV YOU CAN HAVE IT! The IIASTEItFDL ,,~'O iiiSiSSDlBLER. (1ID86) will create HASH coapatible 41256 256Kx1 60 ns 4.75 1I)e") Ne") source code from program files (EXE or COH). 41256 256Kx1 80 ns 3.75 r:..r:.. And the files are labeled and coaaented so coco ~\:. 41256 256Kx1 1 00 ns 2.80 e")e") they become USEABLE. HD86 is an interactive 00

Reader Service Number 31 Reader Service Number 37

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 77 By Michael S. Hunt 2313 N. 20th Boise, ID 83702 (208) 336-7413 Balanced Trees UNITS & M0Dl.Jt.ES

the code to delete the key and data identical. Some of the parameter order What happens when your sorts are off by memory areas after the sort had re­ has changed and a new parameter has one? How do you balance trees? (Without a leased the information. I inserted a dele­ been added. The "boo" parameter is chain saw .... ) tion of the key memory in GenBin Tree needed for the routine's recursive calls. and a deletion of the data memory in They need to be provided when called the GenSrtReleaseF function. from GenSort, but not initialized. bout a week after Issue #49 came The more important problem was I will inch.lde the source for my cor­ out, Ed Stimpson called me from that the key building routine for strings rected GenSort, GenAvlTree, and ASalt Lake City. He had obtained a had an index off by one. I hadn't caught several sample programs on the issue downloaded copy of the GenSort mod­ the problem because I set up my index disk. If you have more questions about ule and the routines didn't work. All incorrectly. If you use strings in the data the routines, contact Ed or myself. sorts of possibilities raced through my then you must count Turbo Pascal's mind. Had the file been corrupted when length byte. If you pass a string[25] to Next Time I uploaded it to Micro C? Had I GenSort, it receives 26 bytes. The first In the next issue I'll start discussing uploaded the right file? Did Ed know one is the length byte. I do most of my Turbo Pascal, Modula-2, and objects. how to use the GenSort module? I programming in Modula-2 and Fortran Through issue #49, I've written all the asked myself all these questions. which, like C, do not have a length byte. source code for the column in both After talking with Ed a few minutes, If you want to use a string for a key Turbo Pascal and Modula-2. Although I was confident he knew how the mod­ then the correct offset is the second byte the two languages are very similar, if ule worked. It never occurred to me of the string. you are squeezing them for perform­ that I might have written buggy code. ance or using many of Turbo Pascal's Pride can be very hard to swallow, and AVL Trees extensions, translating between the two it leaves a bitter aftertaste. If you insert semi-sorted data into a can be very time consuming. I had tested the code with what I binary tree, the tree begins to resemble Because I have started a large project thought was a very general test case. In a linked list. The search time for this for Micro C and I would like to spend reality, because of a minor oversight tree becomes unpredictable, quite long more time on the column, I will provide concerning low level pointer manipula­ if the search key is at the end of this only the Turbo Pascal source code. And tion, I had only tested a very specific pseudo list. One solution, as suggested thanks Ed, for your time, effort, and case. What a way to be reminded to test by Adelson-Velskii and Landis, is to suggestions. my code very, very carefully and to cut keep the tree balanced. They defined a back on after-midnight programming. balanced tree as one where, in every Ed Stimpson Thoroughly humbled, I listened care­ node, the heights of the left subtree and 3862 Millcreek Rd. fully as Ed explained the problem and right subtree differ by, at most, 1. Salt Lake City, UT 84109 his solutions. If you are using the Gen­ The storage overhead to keep the Sort module, you'd probably benefit by tree balanced is a balance factor (the References contacting Ed. He has used the sort in a difference in height between two sub­ G. M. Adelson-Velskii, E. M. Landis; cross-reference program and is building trees), stored with each node in the tree. Doklady Akademia Nauk SSSR, 146, a shell around it so it can replace the This can be as little as two bits per node (1962); (English translation in Soviet DOS sort command. By press time, he since only the values of -I, 0, and 1 are Math) will have added the GenA vlTree mod­ required. If the balance factor becomes Holub, Allen; "C Chest," Dr. Dobb's ule to his sorts. -2 or +2 because of an insertion or dele­ Journal; August 1986 tion in the tree, an appropriate rotation Knuth, Donald E.; The Art of Com­ GenSort Changes around the nodes with balance factors puter Programming, Vol. 3; Addison-Wes­ Ed had discovered several problems of +2 or -2 restores the balance. ley; 1973 with the GenSort module. Even though GenAvlTree is pretty much a drop-in Wirth, Niklaus; Algorithms & Data the GenBinTree module was deleting replacement for GenBinTree. (See Figure Structures; Prentice-Hall; 1986 the tree node, in GenSort I had left out 1.) The procedure names are almost • • •

78 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Figure l-Balanced Tree Code ELSE IF p".bf = 0 THEN BEGIN p".bf := 1; UNIT GenAvlTree; h := FALSE (* END Michael S. Hunt ELSE BEGIN Released as Public Domain Software pl := p".rlink; *) bl := pl" .bf; INTERFACE IF bl >= 0 THEN (* single RR rotation *) BEGIN TYPE dataPtr = "dataType; p".rlink := pl".llink; dataType = array [1 .. 32767) of CHAR; pl".llink := p; treePtr = "treeNode; IF bl = 0 THEN BEGIN treeNode = RECORD p".bf := 1; data, key : dataPtr; pl".bf := -1; dataLen, keyLen : WORD; h := FALSE llink, rlink : treePtr; END bf : SHORTINT ELSE BEGIN END; p".bf := 0; pl".bf .- 0 PROCEDURE GenAvlTrlns(k, d: dataPtr; END; keyLen, dataLen: WORD; P := pl VAR p : treePtr; VAR h : BOOLEAN) ; END PROCEDURE GenAvlTrDel(k: dataPtr; VAR p: treePtr; ELSE BEGIN VAR h : BOOLEAN); p2 := pl".llink; PROCEDURE GenAvlTrDis(root: treePtr;tab: INTEGER); b2 := p2" .bf; PROCEDURE GenAvlTrRetDelSmRec(VAR p: treePtr; pl".llink := p2".rlink; VAR key, data: dataPtr; p2".rlink := pl; VAR keyLen, dataLen:WORD;VAR h:BOOLEAN); p".rlink := p".llink; p2".11ink := p; IMPLEMENTATION IF b2 = 1 THEN p".bf .- -1 CONST tabinc = 3; ELSE VAR boo: BOOLEAN; p".bf .- 0; IF b2 = -1 THEN FUNCTION CompArr(VAR arrl, arr2: dataType; p".bf .- 1 len: WORD) : INTEGER; ELSE VAR k : WORD; p".bf := 0; BEGIN p := p2; k := 1; p2".bf := 0 CompArr : = 0; END WHILE k < len DO BEGIN END IF arrl[k) < arr2[k) THEN BEGIN END; (* BalLeft *) CompArr := -1; k := len + 1 PROCEDURE BalR!ght(VAR p:treePtr; VAR h: BOOLEAN); END VAR pl, p2 treePtr; ELSE IF arrl[k) > arr2[k) THEN BEGIN bl, b2 SHORTINT; CompArr : = 1; BEGIN k .- len + 1 IF p".bf 1 THEN END p".bf := 0 ELSE ELSE IF p".bf = 0 THEN BEGIN Inc(k); p".bf := -1; END h := FALSE END; END ELSE BEGIN PROCEDURE BalLeft(VAR p: treePtr; VAR h: BOOLEAN); pl : = p". llink; VAR pl, p2 treePtr; bl := pl" .bf; bl, b2 SHORTINT; IF bl <= 0 THEN (* single LL rotation *) BEGIN BEGIN IF p".bf -1 THEN p".llink := pl".rlink; p".bf := 0 pl".rlink := p;

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 79 IF b1 = 0 THEN BEGIN ELSE IF p". bf o THEN p".bf :=- 1; p" .bf := -1 p1".bf ;= 1; ELSE IF p".bf = -l-THEN BEGIN h := FALSE p1 := p" .llinki END IF p1".bf = -1 THEN(*single LL rot*) ELSE BEGIN BEGIN p".bf := 0; p".llink := p1".rlink; p1".bf .- 0 p1".rlink:= Pi END; p" .bf := Oi p := p1 p := p1 END END ELSE BEGIN ELSE (* double LR rotation *) p2 := p1".rlink; BEGIN b2 := p2" .bf; p2 := p1".rlinki p1".rlink := p2".11ink; p1".rlink := p2".11inki p2".11ink := p1; p2".11ink := p1i p".llink := p".rlinki p".llink := p2".rlinki p2".rlink := Pi p2".rlink := Pi IF b2 = -1 THEN IF p2".bf = -1 THEN p".bf .- 1 p".bf := 1 ELSE ELSE p" .bf := Oi p" .bf := Oi IF b2 = 1 THEN IF p2".bf = 1 THEN p" .bf .- -1 p1".bf := -1 ELSE ELSE p".bf := Oi p1".bf := Oi p := p2i p := p2 p2" .bf .- 0 ENDi END p".bf := Oi END h := false END i (* BalRight *) END END PROCEDURE GenAvlTrIns(k, d: dataPtri keyLen, END dataLen: WORDi ELSE IF CompArr(p".key", k", p".keyLen)<=O THEN VAR P : treePtri VAR h :BOOLEAN) i BEGIN VAR p1, p2 : treePtri GenAvlTrIns(k,d,keyLen,dataLen,p".rlink,h)i BEGIN IF h THEN (* right branch has grown *) IF P = NIL THEN (* insert *) BEGIN BEGIN IF p".bf = -1 THEN BEGIN GetMem(p, SizeOf(treeNode»i p".bf := Oi h := TRUEi h .- FALSE p".data := di END p".key := ki ELSE IF p".bf o THEN p".dataLen := dataLeni p".bf := 1 p".keyLen := keyLeni ELSE IF p".bf = 1 THEN BEGIN p".llink := NIL; p1 := p". rlinki p".rlink .- NILi IF p1".bf = 1 THEN (*single RR rot*) p".bf := 0 BEGIN END p".rlink := p1".11inki ELSE IF CompArr(p".key", k", p".keyLen) = 1 THEN p1".11ink := Pi BEGIN p" .bf := Oi GenAvlTrIns(k,d,keyLen,dataLen,p".llink,h)i p .- p1 IF hTHEN (* left branch has grown *) END BEGIN ELSE (* double RL rotation *) IF p".bf = 1 TH~N BEGIN BEGIN p" .bf := Oi p2 := p1".11inki h .- FALSE p1".11ink := p2".rlinki END p2".rlink := p1i

80 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 p~.rlink := p2~.11ink; h := TRUE

p2~.11ink := p; END

IF p2~.bf = 1 THEN ELSE BEGIN

p~ .bf .- -1 del(q~.llink, h); ELSE IF h THEN BalLeft(p, h)

p~.bf := 0; END;

IF p2~.bf = -1 THEN (* FreeMem(q~.data, q~.dataLen); { resp.

p1~.bf := 1 of calling program } *)

ELSE FreeMem(q~.key, q~.keyLen);

p1~.bf := 0; FreeMem(q, SizeOf(treeNode»; p := p2 END END; END; (* GenAvlTrDel *)

p~.bf := 0; h .- false PROCEDURE GenAvlTrDis(root: treePtr;tab: INTEGER); END VAR space, k : INTEGER; END BEGIN END IF root <> NIL THEN BEGIN

END (* GenAvlTrlns *); IF root~.rlink <> NIL THEN BEGIN

GenAvlTrDis(root~.rlink,tab + tabinc) PROCEDURE GenAvlTrDel(k :dataptr; VAR p: treePtr; END; VAR h : BOOLEAN); FOR space := 1 to tab DO VAR q : treePtr; write (' '); FOR k := 1 to 6 DO

PROCEDURE del(VAR r treePtr; VAR h BOOLEAN) ; write(root~.data~[k]);

BEGIN writeln(' , ,root~.bf);

IF r~.rlink <> NIL THEN BEGIN IF root~.llink <> NIL THEN

del(r~.rlink, h); BEGIN

IF h THEN BalRight(r, h) GenAvlTrDis(root~.llink,tab + tabinc) END END ELSE BEGIN END (* root # nil *) ELSE q := r; writeln (' Nil' )

r .- r~.llink; END (* GenAvlTrDis *); h := TRUE END PROCEDURE GenAvlTrRetDelSmRec(VAR p :treePtr; END; (* del *) VAR key, data :dataPtr; VAR keyLen, dataLen:WORD;VAR h:BooLEAN); BEGIN VAR q treePtr; IF P = NIL THEN (* key not in tree *) BEGIN

ELSE IF CompArr(p~.key~, k~, p~.keyLen) 1 THEN q := p;

BEGIN WHILE p~.llink <> NIL DO BEGIN

GenAvlTrDel(k, p~.llink, h); P := p~ .llink IF h THEN BalLeft(p, h) END;

END data := p~.data;

ELSE IF CompArr(p~.key~, k~, p~.keyLen)=-l THEN dataLen := p~.dataLen;

BEGIN key := p~.key;

GenAvlTrDel(k, p~.rlink, h); keyLen := p~.keyLen; IF h THEN BalRight(p, h) p := q; END GenAvlTrDel(key, p, h);

ELSE (* delete p~ *) END; (* GenAvlTrDel *) BEGIN q := p; BEGIN

IF q~.rlink = NIL THEN BEGIN END.

P := q~.llink; h := TRUE END • • • ELSE IF q~.llink = NIL THEN BEGIN

P := q~.rlink;

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 81 Victim Of Success

the future will be my only significant commit­ Anthony Barcellos It's always great when someone betters himself, ment to users group activities. p.o. Box 2249 especially when he starts out in academics. In this, Davis, CA 95617-2249 Voice: (916) 756-4866 his last column, Tony tackles text and graphics, ap­ Parting Glances Data: (916) 758-1002 propriate tools for his next life. There are a few loose ends that I would like to tie up as I depart. I've long been intrigued by desktop publishing and sophisticated tools th O long, everyone. This is my 15 -and like Adobe's PostScript. final-shareware column for Micro C. A Under pressure from Microsoft and Apple, Slot of user-supported software has Adobe has decided that they have to give up streamed through this column during the past their secrets and make PostScript an open 21;2 years, and there's no end in sight. I have standard. PostScript's power has attracted only sampled the flood. many users despite its high costs. Recent Although there remain so many attractive developments may make PostScript more avail­ packages to examine, I must redirect my efforts able than ever before (in either the Adobe ver­ toward other interests. My arrival in the pages sion or as clones from competitors). of Micro Cornucopia coincided with my appoint­ HortIdeas Publishing latched on to Post­ ment to the mathematics faculty of American Script early in the game, putting out a River College in Sacramento. While I was shareware drawing program that generates delighted by this long-sought opportunity to PostScript files. One attraction of PictureThis is teach full-time, I couldn't anticipate all the re­ its low cost-only $50. But as a PostScript­ percussions-all of them, so far, good. based application, its attractions are many. Be­ While a California civil servant, I was fairly sides being compatible with every desktop successful as a freelance mathematical writer. publishing program and high-end word pro­ My articles. on Mandelbrot's fractal geometry cessor that works with PostScript printers, Pic­ won a couple of awards and my interview of tureThis enjoys PostScript's immunity from the Benoit Mandelbrot was published in Mathemati­ "jaggies." cal People. (Yes, I now admit that I have long Recall that PostScript incorporates a scaling been smitten with fractals-just like everyone technology that adjusts for changes in size else at Micro C.) without creating the jagged edges and broken My stock as a writer, however, has risen lines that appear whenever you magnify bit­ enormously since I returned to academia. It mapped graphics. Jagged bitmaps can be im­ helps that American River College already has ported into PictureThis and then traced to cre­ several successful authors on its faculty, so per­ ate a scalable version. Nice! haps I'm gilt by association. One problem with PictureThis may have During the past summer, I was courted by been addressed by the time you read this. The several publishers looking for textbooks. Over program currently requires a CGA or compat­ the next two years my name will appear on ible graphics adapter. Given that PostScript ap­ texts and supplements for algebra, trigono­ plications are toward the high-end of today's metry, and calculus courses. It will be a lot of applications, most users who would be inter­ work, but I'm looking forward to it. ested in PictureThis are probably already using In the meantime, I have to reorder my pri­ EGAs or VGAs. PictureThis definitely needs to orities. I've submitted my resignation as soft­ migrate to a higher platform. ware librarian to the Sacramento PC Users Congratulations to Greg and Pat Williams of Group. I have also decided to withdraw from HortIdeas for being ahead of the crowd in this column, much as I regret doing so. I hope moving shareware into the PostScript domain. to retain the editorship of Sacra Blue, which in This could be the start of something big.

82 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 I

I , "I I

,'.

I ~ ,I r'

PictureThis, $50 way. PKZIP still produces quick ahd HortIdeas Publishing tight file compression, while PKUNZIP .. Greg & Pat Williams performs the reverse operation eVen Route 1, Box 302 Under pressure more quickly. . . Gravel Switch, KY 40328 PKWare is branching out a little, (606) 332-7606 from Microsoft and offering PKZFind to search for .fil~s across disks and directories and auto-' . Quick Editor Keeps Moving Apple, Adobe has matically log you onto the directory,; SemWare has updated QEd it, the where the desired file resides. It will· "Quick Editor," to version 2.08. New even peek into zipped files to see if the decided that they '1 features include sorting and support for target is hiding there. macros invoked from the command have to give up line. Those of you with laptops will PKZIP/PKUNZIP 1.01, $50.50 appreciate the optional large-block cur­ their secrets and PKZFind, $25 sor that shows up so well on LCD PKWare, Inc. screens. make PostScript 7545 North Port Washington Road QEdit costs $54.95 with $3 for ship­ Glendale, WI 53217-3422 ping. As before, it fits nicely on floppy­ an open standard. (414) 352-3670 based systems and can run in only 64K. (Where did they find a 64K PC to test it Post Script . " . " on?) They also have an OS/2 version at Last time I asked where users like.;to the same price. It offers several OS/2- by name across drives and directories. It get their shareware. Although I am vii.:. specific features. A whole new area is also lets you paste information into cating this space, I plan to coIled . any opening up here and SemWare is on the your application. responses to pass along to the good edi~. • scene. The most unusual and exciting fea­ tors here at Micro C. If I accumulate a ture of PC-Browse is the hypertext tool worthwhile list, perhaps it will see pri11t • QEdit 2.08 that you can use to create help systems in these pages. . $54.95 plus $3 shipping or linked menus. Quicksoft has started Goodbye, folks. Keep registeririg that SemWare advertising in user group newsletters shareware. And remember the motto of 4343 Shallowford Road, Ste. C-3 and they've gotten rave testimonials the Sirius Cybernetics Coq,oration:: Marietta, GA 30062-5003 from their beta testers. PC-Browse may "Share arid enjoy!" . ..' (404) 641-9002 soon be encroaching on SideKick's terri­ Editor's note: Apparently we're 100~iHgi' tory. Watch for it soon at a users group for a new shareware columnist. Any librari­ Browsing Quickly near you, or buy it directly from Quick­ ans out there yearning to write? (You·can Quicksoft has long been famous for soft for $54. even turn in a friend.) . PC-Write, the leading shareware word processing program. A new Quicksoft PC-Browse, $54 program called PC-Browse is in beta Quicksoft, Inc. • • • test and should be out by the time you 219 First Avenue North, #224 see this. Seattle, W A 98109 NEW! PC-Browse is a pop-up utility that (800) 888-8088 Now Micro Cornucopia has. avallabllHy; 16mm microfilm. 35mm rnlc:rolllffl.1 lets you look at files or disk directories 105mm microfiche copies of Issues and artie while you work in your application pro­ Zipping Along provided through ... gram. But that description doesn't do it PKWare has released version 1.01 of UntversHy Mlcrotllms Intematlonal.. . .. ) • justice. PC-Browse lets you search for PKZIP /PKUNZIP. The new ZIP utilities 300 North Zeeb Road. Ann Arbor. MI4810b-l.34~· • text files by matching a given word or can work with files created with version phrase inside the file. It hunts for files 0.92, but the compatibility is only one

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 .83 o 11 100 100 A Case Of Optical Character Recog-nition: From .PCX To .TXT Via A Neural Network

By Gary Entsminger "Thanks," she managed a semi-smile, semi­ P.o. Box 2091 Recognizing characters isn't the easiest thing sweet, and semi-ambivalent. Davis, CA 95617 for a computer (but then, recognizing friends isn't "Save the thanks," I muttered underneath either). Gary applies a neural net to a pile of type­ my breath, "until I deserve it." written pages and .... At least he doesn't paper over Her problem was simple enough, in theory, the problems. but I must admit I felt a little uneasy. She had a bunch of typed paper; she wanted it to ap­ pear magically in WordStar. A case of optical my's desk, piled high with typewritten character recognition, or OCR as we say in the pages, was a research assistant's night­ business. She was right: there are a lot of Amare. A gothic soap opera. For years her people in her position. boss and a legion of bosses had accumulated I investigated and got my hands on a few enough reports, abstracts, and just plain gossip tools- to fill up the Greek Theatre. Now, they wanted (1) A scanner-which I could use to get an all those pages WordStar-compatible. image of a page into a computer. An "image," Her mission (would she take it?)-was to I say, since scanners inherently scan pixels, not retype the pages, line by line, character by characters. A graphic image of a character (a character, until her fingers and mind numbed matrix of pixels) may look like a character to with futility. Going crazy, really. you and me, but to a computer it's garbage. She looked at me. Glancing up, I pretended I was handsome, dark, and perhaps mysteri­ ous; as if I were Fred MacMurray in Double In­ Figure l-Both Inputs Produce Output 1 demnity or Jack Nicholson in Chinatown-two of my favorite movies. Amy loves movies. (Input 1) "Can't you do something?" she asked. I cleared my throat in my hand, considered ... xx .. . the possibilities, remembering the plots of .. xxx .. . Double Indem and several other "B" movies. A ... xx .. . diabolic solution like murder, of course, was ... xx .. . (Output 1) out of the question. I really liked her boss. . .. xx .. . Anyway, it's messy and immoral. Fred found .. . xx ...... xx .. . . xxxxxx. __ that out. I took the Jack Nicholson approach. · .xxx .. . "Well, Ms. Seidel," I said, "I don't know .. . xx .. . what I can do; you're in an unusual situation." (Input 2) · .. xx .. . "Not really," she interrupted, "a lot of · .. xx .. . people are in my position." ... xx .. . -- . .. xx .. . I noticed her legs, long and crossed and ... xx .. . .xxxxxx. turned a little towards me, but not far enough .... x .. . to be suggestive. I glanced past her, out .... x .. . toward the grassy hill that led up and then .... x .. . broke into a forested valley. ... xx .. . Sighing, I didn't know what to do; I said, . .xxx .. . "Okay, I'll poke around a little and get back to you." • • • She may have mistaken my tone. I don't know.

84 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 . Images can be beautiful, of course; work article this issue. I found four con­ but moving, entering, and deleting char­ tenders- acters, pixel by pixel, isn't a giant step NeuroShell (from Ward Systems) for computer science. NeuralWorks (from Neuroware) (2) A graphics editor-which I could NNT (Shareware) use to manipulate pixels (to realign Since a network BrainMaker (from California Scien­ them, for example). . tific). (3) A neural network-which I could recognizes Each works well alone, but has even use to evaluate and correct input pat­ more interesting potential for use within terns. patterns, not bits, other systems. I found, at first surpris­ Neural networks effectively filter ingly, that developers have taken dis­ input to produce output. More specifi­ no particular bit is tinctive approaches to implementing cally, a net looks for patterns in a set of neural networks. Everything from the examples (called a training set, the crucial for the user interface to operational theory var­ input) and learns from these examples ies. to produce new patterns (the output). network to I conclude that neural networks are Then using what it's learned- (these at that inchoate stage where they share input/ output pattern-associations), it recognize a pattern some fundamental qualities (such as the classifies a new set of examples (called a use of training sets, thresholds, normali­ test set). successfully. zation, etc.), but diverge widely in the The net uses patterns of bits instead details. I chose BrainMaker for the OCR of individual bits to process informa­ project because it: tion. Since a network recognizes pat­ (1) is relatively inexpensive; terns, not bits, no particular bit is crucial produce reliable output by making (2) has a neat batch mode which I for the network to recognize a pattern good guesses. can call from my programs; successfully. The network will accept We train the network by showing it a (3) is fast enough (at least with small minor variations in bit alignment (see set of input patterns and their corre­ sets); Figure 1) and still produce the right pat­ sponding output patterns. For example, (4) allows two-dimensional picture tern. we show the network an 8 by 8 bit pic­ input (which makes it easy for me to see You input a pattern into a neural net­ ture of a character and the correspond­ and edit 8 by 8 bit characters). work; it compares the pattern with the ing ASCII character. We say, in effect, I had three tools .... It was a start, the patterns it knows (the patterns it when you see this input pattern (a bit nucleus of a project, but much was learned from its training set); and out­ picture), output an ASCII character. missing. As usual, the tools didn't fit to­ puts a ''best guess" pattern. (Note: the This part is tricky and requires a gether well enough to solve Amy's network's best guess might even be no pat­ shuffling of examples. Eventually, after problem. My computing skills had got­ tern. We tell the network (using a threshold we toggle a switch or two and add or ten my foot in the door, but I still wasn't value) how much variation (or error) we'll delete a few examples, the network sure I'd solve anything. I proceeded. accept. If no output exceeds the threshold, "learns" to "guess" well enough for our Step 1: I scanned in an image (you the network could produce a space, for ex­ problem. A pattern is good enough can simulate this step in any of the ample.) when it reaches the threshold value we Turbo languages using the Borland Scanning typewritten pages is, at set. Graphics Interface, or BGI)- best, an imperfect operation. We can ex­ I shopped around for a neural net­ (1) Initialize graphics; pect the scanned patterns (our input) to work. I was in a hurry and it beat pro­ (2) Open a Viewport; be incomplete or contain "errors," such gramming one from scratch, tho' Russ (3) Use OutTextXY to create some as bit misalignment. A neural network Eberhardt and Roy Dobbins show us graphics text; can correct these kinds of problems and how to do just that in their neural net- - (4) Save the text to a file.

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 85 Step 2: I loaded the image into a (4) writes an output file for Brain­ graphics editor (PaintShowPlus) and ex­ Figure 2-Examples of Brain Maker; amined it bit by bit. Right away I dis­ Maker Input (5) calls BrainMaker (via a batch file covered that text sizes, fonts, styles, and executed by the built-in procedure horizontal and vertical alignments vary. .xxxxx .. exec); Too much variation is a· problem. I de­ xx ... xx. (6) translates BrainMaker's output to cided to teach the neural net to handle xx ... xx. characters. size, font, and style matters. We teach xx ... xx. See the figure for details or networks by showing them a training xx ... xx. download the entire system from the set. xx ... xx. Micro C BBS. Realignment I did by bit (in Paint­ .xxxxx .. In brief, note: ShowPlus). I didn't teach my network • To use the Turbo Pascal exec proce­ much, so it wasn't all that smart. A one dure, you need to reduce the large column pixel shift introduced more var­ ... xx .. . heap size in order to have enough iation than it could handle. So I cor­ .. xxx .. . memory to run the neural network rected a lot of bits. Ugh! In the future, ... xx .. . from a batch file. I used 64K for this I'll either train the network more exten­ ... xx .. . one. Experiment. sively or automate column and row ... xx .. . • Viewports and the many constants in shifts. ... xx .. . my OCR shell are screen specific. An Step 3: PaintShowPlus writes three .xxxxxx. 80 by 25 character screen needs to kinds of output files: .TIF, .IMG, and have an array of 2000 characters .PCX. BrainMaker, the neural net, wants (Num of characters). its input as a text pattern (a matrix of .xxxxx .. The PCX files on the Micro C BBS are "X" s and periods representing a charac­ xx ... xx. screen-specific. I've set the constant in ter). Problem: bridge the abyss between ..... xx. my code (Figure 4) for a CGA, 600 by these two. ... xxx .. 200 screen. The BBS (.EXE) version uses I had a copy of the PCX Toolkit, .xxx ... . variables instead of constants and al­ which displays, loads, saves, and in xx ... xx. lows you to input your screen type at various other ways manipulates .pex xxxxxxx. runtime. OCR_shell then sets the adapt­ images, so I decided to work toward it. er type, Viewport size, and displays the I created a .PCX file with PaintShow­ • • • correct .PCX for your screen. Plus. I planned to translate images from the screen instead of from a file, so any Notes & Conclusions file format will do (if you can display As I told Amy later, my initial results it). Eventually I had to create a two-di­ (5) A neural network to pure text were revealing and incomplete. I ini­ mensional "text" picture for BrainMaker part. tially trained the network to recognize (see Figure 2). I created Parts 3 and 5 with Turbo numbers by using a set of number The programming problem at this Pascal, and ran Parts 2 and 4 out of a "facts" that came with BrainMaker. juncture- Turbo Pascal shell. The Turbo Pascal Then I tested a screen of numbers I (1) To prepare input for BrainMaker program (see Figure 4): created with the BGI. I wrote text (using (in this case, to translate a bit by bit (1) initializes graphics; OutTextXY and a default 8 by 8 bit image of a .PCX file, or screen) to a text (2) opens a viewport; font). Results-terrible. BrainMaker picture; (3) translates the screen (looking at 8 couldn't recognize more than 2 or 3. (2) To evaluate and translate the out­ bit x 8 bit images) into a text picture; Text Continued on page 89 put from BrainMaker to a WordS tar (or other text editor) readable format.

Objects Figure 3-BrainMaker Output; 3 Digits Weight and 1 Digit Output I dec~ded to glue everything together in a couple of Turbo Pascal objects: one .909 0 .001 1 .018 2 .009 3 .001 4 .033 5 .021 6 .050 7 .097 8 .081 9 to translate a graphics screen into a text .000 0 .988 1 .009 2 .049 3 .034 4 .091 5 .018 6 .067 7 .012 8 .001 9 picture for BrainMaker; and one to .017 0 .034 1 .929 2 .033 3 .002 4 .038 5 .000 6 .050 7 .068 8 .034 9 translate BrainMaker's output (symbols .009 0 .017 1 .053 2 .918 3 .000 4 .053 5 .003 6 .020 7 .100 8 .087 9 plus numerical values; see Figure 3) into .003 0 .085 1 .005 2 .017 3 .911 4 .021 5 .016 6 .027 7 .030 8 .000 9 pure text (Le., characters). .081 0 .014 1 .008 2 .072 3 .000 4 .900 5 .006 6 .042 7 .070 8 .031 9 In sum, the case seemed to hinge on .095 0 .025 1 .000 2 .049 3 .001 4 .003 5 .936 6 .020 7 .100 8 .001 9 five parts- .066 0 .046 1 .030 2 .008 3 .000 4 .006 5 .000 6 .972 7 .041 8 .004 9 (1) A scanner (or simulated) part; .020 0 .000 1 .032 2 .078 3 .001 4 .001 5 .071 6 .007 7 .902 8 .018 9 (2) A .PCX (or screen display) part; .088 0 .000 1 .006 2 .050 3 .000 4 .000 5 .005 6 .064 7 .094 8 .910 9 (3) A screen to neural network trans- lator; • • • (4) A neural network part;

86 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Figure 4-0ptical Character Recognition Shell OCR_Output_file = 'C:\TP\EXE\OCR.Out'; Program OCR_Shell PCX_file = 'C:\TP\EXE\a.PCX'; uses Line_length = 79; Threshold = 0.60; Crt, Dos, Graph,pcx_tp; {pcx_tp from Genus Toolkit} PCX_type = pcxCGA_6; type

var Weights = array[l .. Num_of_characters] F, F2 : text; of string[4]; const Patterns = array[l .. Num_of_characters] { BGI fonts } of string[l]: Fonts: array[0 .. 4] of string[13] = objects } ('DefaultFont', , TriplexFont' , 'SmallFont', NNlptr = Aneural_net_interpreter; 'SansSerifFont', 'GothicFont'); neural_net_interpreter = object { BGI text directions } Array_index: integer; First_char, S: string; TextDirect: array[O .. l] of string[8] Weight: Weights; Output-pattern: Patterns; ('BorizDir', 'VertDir'); constructor Init; destructor Done; virtual; Num_of-patterns = 10; procedure Get_weights; Num_of_characters = 2000; { for 80x25 viewport procedure Output_characters; Input_file_from_neural_net = end; 'C:\TP\EXE\BrainRTS.Out': Screenptr = Ascreen; Output_file_for_neural_net = screen = object 'C:\TP\EXE\BrainRTS.ln' ; GraphDriver: integer; Graphics device driver} Continued on page 88

"It's Glorious!" Any ASCII • EBCDIC. c-tree • Packed data "No color PCompatible is complete without a copy of this; Binary. dBASE • R:BASE • Paradox. Xdb get one and see what I mean." - Jerry Pournelle, BYTE Excel. 1-2-3 • SC4 • Btrieve. Oracle "In~inite ... Neither of us (the chief engineer of the Galileo Informix. Clarion. DIF. SYLK JupIter probe and I) may ever be heard from again." •.. plus many more file types. - Arthur C. Clarke • No programming - completely menu driven! "I could watch an animated image for hours." - Larry Fogg, Micro C (MIA 89) • Selects & rearranges records, fields and characters! • Instant script file creation for total batch processing! • Maps new data structures automatically by name! FractalMagic 5.0 America's Premier Fractal Program • Ideal for OEM/run-time applications!

" ... an invaluable integration tool." -Byte IBM PC, PS/2 (3.5" or 5.25") CGA, EGA, & VGA: $35.00 " ... more than worth its price." -PC Magazine Mac, Apple II, Atari ST: $25.00 " ... a surefire winner." -Computer Language EGANGA Picture Disks: $15.00 ·:,.IIt!'~l~ Expansion Modules Coming Soon! Standard $99 - dDASE, AScn, 1-2-3, Q&A, Enable, DIF, askSam & merge files for WordPerfect, Word & Wordstar Sintar Software Professional $199 - Standard formats plus Binary/EDCDIC, SC4, SYLK Paradox, R:BASE, Clarion, Excel, c-tree & Btrieve "Software for the Mind" Advanced $299 - Standard & Professional formats plus Informix, P. O. Box 3746 Xdb, Oracle & C-ISAM Bellevue, W A 98009 (206) 455 - 4130 Call 800/444-1945 or 512/482-0824 Visa - MC - AmEx MCNISA • AMEX • COD • Corp. PO. ,.....-'~-";{ available for LANs, Xenix & Unix .I.~ Tools & Techniques Inc. 1620 W 12. Austin TX 78703 miS&lIDJNKu5

Reader Service Number-181 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 87 GraphMode: integer; { Graphics mode value destructor neural_net_interpreter.done; MaxX, MaxY: word; Maximum screen resolution begin end; ErrorCode: integer; {Reports graphics errors { object methods MaxColor: word; Max color value available pcxReturn: integer; PixelStatus: integer; procedure neural_net_interpreter.Get_weights; ViewInfo: ViewPortType; constructor init; var destructor done; virtual; procedure Initialize; ThiS_Weig~ string[4]; end; Thisyattern string[1] ; var Count integer; Char_Ptr: integer; OldExitProc Pointer; {Saves exit proc addr} begin {$F+} FOR Count .- 1 TO Num of_characters DO begin Initialize arrays procedure MyExitProc; Weight [Count] .- , ,. begin Output""pattern[Count] := ' ,. ExitProc := OldExitProc;{Restore exit proc addr} end; CloseGraph; {Shut down the graphics system } Assign(F,Input_file_from_neural_net); end; { MyExitProc } Reset(F); Array_index := 1; {$F-} WHILE Array_index <= Num_of_characters DO begin Readln(F,S); First_char := Copy(S,1,1); procedure screen. Initialize; IF First_char THEN begin { Initialize graphics and report errors} Char_ptr := 2; var FOR Count .- 1 TO Num_ofyatterns DO InGraphicsMode: boolean; { Flags graphics init} begin PathToDriver string; {path to *.BGI & *.CHR} This_weight:=Copy(S,Char_Ptr,4); begin Weight[Array_index]:=This_weight; When using Crt & graphics, turn off Crt's Char_ptr := Char_ptr + 5; memory-mapped writes } This""pattern:=Copy(S,Char_Ptr,1); DirectVideo .- False; Outputyattern[Array_index] := OldExitProc := ExitProc; Save prev exit proc } This""pattern; ExitProc := @MyExitProc; Insert our exit proc} Char_ptr := Char_ptr + 2; PathToDriver .- ". Inc(Array_index); repeat end; GraphDriver := Detect; {detect graphic adapter} end; InitGraph(GraphDriver,GraphMode,PathToDriver); end; ErrorCode := GraphResult;{Preserve err return} Close(F); if ErrorCode <> grOK then { Error? } end; begin Writeln('Graphics error: " procedure neural_net_interpreter.output_characters; GraphErrorMsg(ErrorCode»; var if ErrorCode = grFileNotFound then begin Output_char : string; Writeln('Enter full path to BGI driver'); Pattern_count, Char_count, ReturnCode integer; Writeln('or type to quit.'); Wt, New_weight : real; Readln(PathToDriver); Writeln; begin end Assign(F2,OCR_Output_file); Rewrite(F2); else Halt(1);{ Some other error: terminate} Array_index := 1; Char_count := 1; end; WHILE Array_index <= Num_of_characters DO until ErrorCode grOK; begin end; { Initialize Pattern_count := 1; { object constructors & destructors } Wt := 0; Output_char .--- , ,., WHILE Pattern_count <= Num_of""patterns DO constructor screen.init; begin begin end; Val(Weight[Array_index],New_weight, Ret urnCode) ; destructor screen.done; IF New_weight > Wt THEN begin begin end; Wt := New_weight; output_char := constructor neural_net_interpreter.init; Output""pattern[Array_index]; begin end; end;

88 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Inc(Pattern_count); Inc(Array_index); WHILE XPt <= ViewInfo.x2 DO begin end; FOR y := YPt to (yPt + 7) DO begin IF Wt >= Threshold THEN Write (F2, Output_char) FOR X := XPt to (XPt + 7) DO begin ELSE PixelStatus := GetPixel(X,Y); Write (F2,' '); IF PixelStatus = 0 THEN IF Char_count > Line_length THEN write(F,' .') {BrainMaker wants} begin ELSE { either a . or an X } Writeln(F2); Char_count .- 0; write(F, 'X'); end; end; Inc(Char_count); writeln (F); end; end; Close(F2); YFt := RowPt; XPt := xPt + 8; end; end; var XPt .- 0; RowPt := RowPt + 8; YPt := RowPt; NNI : NNIptr; end; end; procedure pcx_to_neural_net; Close(F); {get PCX; display; convert to txt for BrainMaker.} end; var Dispose(SPort,done); SPort Screenptr; end; x, y integer; XPt, yPt, RowPt integer; S: string; begin { main program body } begin pcx_to_neural_net;{prep PCX file for BrainMaker} New (SPort, init); New (NNI, init); WITH SPort A DO begin WITH NNIA DO begin Initialize; SwapVectors; Maxx := GetMaxx; Maxy := GetMaxy; exec('C:\COMMAND.COM' ,'/C C:\BATCH\net'); {BM} SetViewPort(O,O,Maxx,Maxy,ClipOn); SwapVectors; SetTextStyle(DefaultFont, HorizDir, 1); IF DosError <> 0 THEN pcxReturn := pcxSetDisplay(PCX_type); Writeln('Dos error # ',DosError) pcxReturn := pcxFileDisplay(PCX_file,O,O,O); ELSE IF (pcxReturn = pcxSuccess) THEN begin Get_weights; {Translate BrainMaker's output} Assign(F,Output_file_for_neural_net); Output_characters; {write a file of ASCII} Rewrite (F) ; Dispose (NNI, done); { Clean up } GetViewSettings(ViewInfo); { coordinates of end; Viewport end. { main} XPt := 0; YFt := 0; RowPt := 0; • • • WHILE RowPt <= ViewInfo.y2 DO begin

Problem: the default BGI font and Genus Programming for timely conversa­ Paint5howPIus plus scanner $339 the BrainMaker font both use 7 rows tions while I was working on this project. Logitech· and lines of pixels to represent a num­ For more information- (800) 231-7717 ber. But the .BGI's font is shifted 1 row (800) 552-8885 (in CAl and 1 column down and right of Brain­ Turbo Pascal Professional 5.5 $250 Maker's. So I retrained the network Borland International NeuralWorks $1,495 using the .BGI default font. Results­ 4585 Scotts Valley Dr. Neuralware great. Scotts Valley, CA 95066 Penn Center West-Bldg. IV Conclusion-to create a full-blown (800) 345-2888 Suite 227 Optical Character Recognizer, you'll Pittsburgh, PA 15276 need to focus on training the neural net­ BrainMaker $99.95 work to recognize different fonts, styles, California Scientific Software NeuroShell $195 and sizes. Labor intensive, of course, 160 E. Montecito #E Ward Systems Group but doable. And an exercise, of course, Sierra Madre, CA 91024 228 West Patrick st. for smart Micro C' ers. (818) 355-1094 Frederick, MD 21701 "Amy," I said, "I figured it out and it (301) 662-7950 works, but I'll have to get back to you. PCX Toolkit $195 "There's no more room in this TId­ Genus bits." 11315 Meadow Lake • • • Thanks to Dave Schultz at California Houston, TX 77077 Scientific Software and Chris Howard at (800) 227-0918 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 89 Frozen Floppies, Etc.

Floppy Data Recovery If you have a floppy that's gIvmg Figure l-Speed Up cpu By Slowing Down DRAM Refresh you read errors, try putting it in the re­ frigerator or freezer for a half hour or ; This macro gets around a bug in 80286 that won't popf correctly more. No joke. The magnetic domains POPFF MACRO are more active at lower temperatures. JMP $+3 The party who turned me on to this IRET used to teach physics and has used this PUSH CS technique many times to recover "lost" DB OE8H,OFBH,OFFH ;Call far $-2 data from disks. ENDM

David E. Michener REFRESH SEGMENT PARA PUBLIC' CODE' 7466 S.E. 112th Ave. ASSUME CS:REFRESH, DS:REFRESH, ES:REFRESH, SS:NOTHING Portland, OR 97266-5033 ORG 100h ; .COM format

Editor's note: Of course you could skip REFR PROC FAR the disk and just keep the raw data in the freezer. I've found that it doesn't need BEGIN: blanching, just be sure to double wrap it so JMP OVER Jump over resident section of code it doesn't get freezer burn. (I also have a rec­ ipe for binary freezer jam made from half­ OLD_40 DD 0 Place to store old INT 40H vector baked Apples (with the cores) and a little sugar.) I_40: PUSHF RAM Refresh Revisited PUSH AX Save the registers we're changing I have just tracked down a very strange and annoying bug relating to MOV AL, 74H the DRAM refresh rate change you ran OUT 43H, AL Set up to write LSB-MSB clock rate several months ago ("DMA Control on JMP $+2 Delay for lousy IBM AT design the PC," Issue #37). It seems only to MOV AL, 12H Set refresh to every 12h clock ticks happen with the AMI BIOS. As you in­ OUT 41H, AL (15.3 u-secs ???) crease the time between refreshes, the JMP $+2 More delay floppy disk motor start-up time also in­ XOR AL, AL MSB of timer value to 0 creases as some (large) multiple. OUT 41H, AL I have been setting the timer to hex 80 ("normal" is hex 12) and it takes POP AX Recover our trashed registers about 15 seconds for the floppy to corne POPFF up to speed. I finally got fed up enough to check out why, and it turns out to be PUSHF (make this call look like an INT) DRAM refresh-time related. CALL CS: [OLD_40] and call the original stuff As I'm an incurable speed-freak, I could not live without the extra 5% PUSHF INT 40 done, restore fast DMA value horsepower I got from changing the re­ PUSH AX Save the registers we're changing fresh. I wound up writing a short TSR that hangs on the INT 40H chain (where MOV AL, 74H Set up for LSB-MSB rate again hard drives rev ector the floppy BIOS), restores the rate to its normal value

90 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 Micro Ads . £fii-h ¥d w~.s. ·,·rim

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'll 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 Briefly, a hypertext help system, context sensitive, up to must accompany ad. Each ad space is 2 V4 inches by 1 J'4 inches. 80% compression, requires less than 10K, Includes editor for documents, and source for Pascal, C, and Basic. (203)368 - 0632 NTERGAID, 955 Connecticut Ave. Bridgeport, CT 06607

CONVERT PCX FILES 16 Megabytes EMS and/or WISDOM OF THE AGES TO COLOR POSTSCRIPT! Extended Memory pcx Printshop will convert all of your EGA -Works on 8 or 16 bit bus Electronic book puts over \,000 of the world's greatest minds and VGA PCX files to 16-color. 300 d.p.i. ·16 bit transfer on AT bus XT and AT to work for you. They will give you tools to act, write and Color Postscript format. ·Single board design speak better; earn more. ' .Includes RAM disk and Compatible Great for grabbing screens, touching them up, and printing them out at "coffee-table" extensive diagnostics Point to a subject and select. Receive a vivid parade of quotes, resolution. -Quantity/OEM discounts sayings and ideas. Read, print or send some to disk. $99 Subjects are organized into sections to give you the most Argon Technology Group ~:~~~e:;ured; m~ ~I~ Sold and Serviced by benefit in the least time. Filters customize output; Dynamic 131 Rindge Ave., Cambridge, MA 02140 ~J~~!..Jru mode simulates creativity. (617) 492-7442 807 North 6th SL Lake Clty,IIN 55041 (612~555 Reader Service Number 179 Reader Service Number 3 It's never too early to get a head start. Introductory Offer: $79.00 - all 5 disks. 30 day money-back guarantee. Technology £or the Arts Why you want BAlCOM! PC MPU-40 1 Compatible BATCOM is a batch file compiler that compiles Requires 256K, DOS 2.0 or later & 2 floppies or hard disk. Add MIDI Interface Board $119 your -.bat-files to -.exe- files to make them faster, $2.00 S/H. CA residents add 7%. Outside U.S. Add $10. Willow Publlhsers' VGA $599 more professional, and more capable, BAT­ (video frame grabbber/VOA) COM extends DOS with new commands so you can read keyboard input, perform arithmetic, use MCR Agency; Inc. New hi-res frame grabber $495 6116 Merced Ave. #81M subroutines, and much more. In addition, BAT­ Oakland, CA 94611 Panasonic CC1V camera $225 COM protects your source code, and you can distrbute your compiled programs without royal­ it- Special: Sanyo Color camera $395 1-800-767 -6797 Free MIDI or Digitizer Catalogs ties. For IBM PC. Only $59.95. Order today I Fax: 415-444-6561 /'-, Wenham Software Company joel Sampson Engineering 1 • lIS Burley St. P.O. Box 550363 (214) 328-2730 '_'/ Wenham, Ma. 01984 Dallas, TX 75355 BBS 328-6909 (1S08) 774-7036 Reader Service Number 181 Reader Service Number 176 Reader Service Number 124 8748 EMULATOR NEW COMPUTER 8031 J.lControl1er Module $39.95 Shipping: $3.00 US'$5.00 Canada Simulate your 8748 programs in software before burning the EPROM. See all internal registers BOOKS Ideal for prototyp,,",. one cL a kind devic,,", or ehort production and i/o pins. Script files can simulate complex nma. perfect builciing block for PC or Macintosh data aqui.ition external events. Includes source. up to 400/0 OFF LIST interface ... eland alone control pr~ecta. Aeltembled and tMted board include. 8031 microproc:e ..",r. cryet.al,I!K ()(EPROM, 128 ~ -' :'>":Other 'Products ".. ' SMALL, MINIMUM ORDER byte. cL RAM, 2 byte·wide I/O p«tIIand proviaione for. MAX232 DOS Source to provide induoby compatible OteriaIIlO. All IC. are .ockel.ed Fully commented 1.1. 2.1 ...... $15/$45 SEND 3 STAMP SASE TO: and 110 i. via a 2X17 headeo. Size: 2.75" by 4.0". OEM diBCounta. Hercules Tools Graphics stuff w/source ...... , ...... $15 Math Library C. B. CO. Cottage RcsourccB ascii Floating pt. w/source ...... , ...... $15 Suite 3-672C, 1405 Stevenson Drive 180\.::,:,:..:::',:::,::. PO 1758 Springfield, minois 62703 \J;) I.~ ~ D~llnlormalion P,O. Drawer F Modes (217) 529-7679 I 0 I ~ Denton, TX 76202 SOLANO BEACH, CA 92075 817 -387 -3339 Reader Service Number 167 Reader Service Number 158 Reader Service Number 149

WHITNEY EDITOR $49 DSP32C COPROCESSOR BOARD ' EGA FRACTAL MASTER . . Whether fractal novice or fractal hacker, this easy to use yet Small and fast >- 25 MFLOP Floating Point DSP powerful package lets you explore: Uses all available memory >- High speed NUMERICS and GRAPHICS The Mandlebrot set Julia sets Split-screen editing >- 32 BIT on board data bus Configurable keyboard >- 16 bit PC/AT interface ~r~~~~~~sd ~:~~c:,~:r~~t~~aons Regular expression search >- ALL ON BOARD MEMORY DUAL PORTED Peano curves Fractal landscapes One key compile >- Parallel and codec serial 10 Features for writing documentation Interrupt. save and resume plots at any time. Easily change >- 15 ms 1024 point FFT colors, set boundaries, animate colors, create mirror Condensed/Outline display >- Assembler, monitor, and libraries images. Supports fast integer computations (even Runs on IBM PC's. AT's, and PS/2's Base board and ALL software ...... $950 WITHOUT an 80386) and 80x87 math co-processors. Includes a slideshow program. Specify 51/4 or 31/2 disk. USA shipping & handling S3; Outside USA S15 640K 85ns memory ...... $300 CA residents add sales tax Only $25 ' SYMMETRIC RESEARCH Paul W. Carlson Whitney Software, Inc. 15 Central Way, Suite #9, Kirkland, WA 98033 602 North Avenue, #23 P.O.Box 4999, Walnut Creek, CA 94596 (415) 933-9019 (206) 828-6560 Burlington. Vermont 05401 Reader Service Number 164 Reader Service Number 182

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 91 before chaining on to the floppy BIOS, then sets it back to hex 80 before exit­ OUT 43H, AL ing. .JMP $+2 More lousy delay I'm sending you the code for this MOV AL, SOH A reasonable value for timeout TSR (see Figure 1) in the hopes that it OUT 41H, AL That nets about 5% more CPU speed will help anybody else having this prob­ .JMP $+2 for free lem. Note that this code is dumb; it as­ XOR AL, AL Set MSB to 0 sumes that anybody trying to increase OUT 41H, AL CPU power must already have a hard drive. POP AX Restore trashed registers I suppose it's possible that some­ POPFF where in Po dunk, Iowa, there lives a RET 2 1RET witho~t popping flags true power user with dual floppies, but I've never met him. I am not very This ends resident code section. From here on, we set things up and happy with this assumption, but it's parse command line. Since this gets done only once, we don't want to what I needed. If the guy in Podunk save this code, so it also contains the means to decide how much needs.this, he can rewrite it. memory to save when going resident.

John Welch OVER: PUSH DS 1310 Kenneth Circle CLI Turn off INTs while revectoring INT Elgin, IL 60120 XOR AX, AX 1NT vectors are at SEGMENT 0 MOV DS,AX Set DS SEGMENT to zero Back Up! (Let me repeat that. .. ) You say that backing up is hard to ;Redirect the floppy do? Let me assure you that it's harder, MOV AX, DS: [100H] ; Get old addr, and store it here by far, to recover from a hard disk crash MOV WORD PTR CS:OLD_40,AX if you don't back up regularly. Yes, this MOV AX, DS: [102H] is the voice of experience speaking. My MOV WORD PTR CS:OLD_40+2,AX old faithful 20 meg Miniscribe ex­ perienced a hardware failure. MOV WORD PTR DS:[100H],OFFSET 1_40 ; Then replace it with Hindsight being what it is, backing MOV WORD PTR DS:[102H],CS ; vector to floppy interceptor files up daily is now a part of my routine, and I promise myself to keep it POP DS Put DS back where it belongs up as long as possible. The only prob­ lem is that I will have probably forgot­ MOV AL, 74H Set DMA timer to slower value ten this trauma and let my habits get OUT 43H, AL (less refresh) sloppy a month or so before the next .JMP $+2 failure. MOV AL, SOH Hard disks can fail in several modes. OUT 41H, AL The most feared is a head crash. When .JMP $+2 that happens, the data is generally gone XOR AL, AL since the surface of the disk is physi­ OUT 41H, AL cally damaged. In· my case, I know the data is still in there, locked up like MOV AX,OFFSET OVER Get the addr of the end of 1NT code jewels in an impenetrable vault, and I SHR AX, 1 don't have a combination to the door. SHR AX, 1 My failure was in the speed sensor; it SHR AX, 1 wasn't a crash. So if any of you out SHR AX, 1 Dvivde by 16 and add 1, there have a non-functioning 20 Mega­ INC AX to get how much memory to save byte MiniScribe (model 3425), I would MOV DX,AX Save the calculated amount of memory be greatly interested in it for the parts. MOV AH,3lH DOS func to terminate & stay residnt I knew that the failure was not re­ STI Allow interrupts again lated to the heads because the Mini­ 1NT 2lH Do DOS call (never returns) scribe told me. You see, the drive's LED activity light can flash error codes. The REFR ENDP LED will flash four or five pulses of REFRESH ENDS light, pause a few seconds, and repeat END BEGIN the code. A steady .light indicates a 1, a flickering light indicates a O. Figure 2 • • • shows the error codes. Although the codes seem to be the same from one Miniscribe drive to the

92 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 CURVEF~NGFORPROG~MERS C PROGRAMMERS • TABLECODE'" fits any X-V data table to 211 different equations in a single step. A Central Oregon technology company engaged In • Full graphical selection of most appropriate equation. remote sensing and information management systems more development has openings for: • Generates function code for selected equation and a twin-window calling program to test equation code. 1. Manager of software systems development! Sr. Analyst. • Reads Lotus, dBASE, ASCII, and binary files. 2. Programmer/Analyst. • Full working demo available for $5. The ideal candidate will hold a BSCS and have a minimum of 5 years hands-on experience In C language. database :!'O[ .. IO..,.c ••IIt,hll rl-o.It1t.cl2V'l Code Ubrarles Include: Turbo C & Micro MSC S.x, Turbo Pascal, BASICA, integration. Unix. and workstation applications. Turbo BASIC, QulckBASIC, Lahey Comprehensive benefits and competitive salary offered. FORTRAN, JPI Modula2, dBASE I . ~ - -. IV, Clipper, dBASE III +. Please send resumes to: Personnel l! .•. - -. _. -- .~ --- Recon Technologies, Inc. t 1-- • ___ .. _ _ _ _ ...... $149 P.O. Box 7497, ...,,' IAISN,I M~~~;;:;:o Bend, Oregon 97708 Ads ... Phoenix, 1Z. 85064 I 10 XI I.U~_;II • Software 602-266-1925 (503) 389-8149 Reader Service Number 170 HIGH RESOLUTION TIMER XenoCopy-PC $79.95+S/H TOOLBOX PC-~OS program lets your PC as DEGREES Read/Write/Format PCHRT is the definitive answer to execution over 350 formats ... from fully-accredited Colleges, We help Computer Professionals avoid years profiling and embedded timer applications. 30 functions XENOFONT $49.95 +S/H of unnecessary class work. Get the job manage 100 timers with microsecond accuracy. Self calibrating. Generates extensive and flexible timer high quality text screen printouts offers and recognition you deserve. Phone reports. Profiles selected BIOS interrupts. Supports TC, ideal for use in software documentation UDA for more information and our free TP 5.0, MSC 5.x. Libraries, examples, manual, and full Bold face and reverse video supported. booklet "Career Thctics and Strategies!' source included. $24.95 postpaid USA, elsewhere add 2210 SIXTH STREET University Degree Advisory $4.00. VISA/Me. Elqh·MldJ BERKELEY, CA 94710 'S 800-765-7272 RyleDesign 415-644-9366

Reader Service Number 39 Reader Service Number 168 Reader Service Number 171

next, some drives pulse four times and some pulse five. If your drive pulses Figure 2-Miniscribe Error Messages four times, ignore the leading zero in the above table. If there are only four Error reported pulses, the error cannot be higher than 00000 00 Microprocessor RAM error 01111. 00001 01 Microprocessor ROM checksum error 00010 02 Interface Chip diagnostic error Beverly Howard OOOll 03 -WRITE FAULT wi11 not reset 00100 04 Index pu1se not detected or 10st Byte Aid! 00101 05 Unab1e to maintain spin speed (0.5%) 205 Canyon Rim Drive OOllO 06 Loss of +FINE TK during id1e mode Austin, TX 78746-5016 00111 07 More than one seek retry 01000 08 T~e out on +END DECL signa1 Editor's note: John, Beverly, and David are 01001 09 T~e out on track crossing (-CYL PULSE) 01010 OA Overshoot each receiving three copies of this issue plus OlOll OB T~e out on +FINE TK a genuine Micro C author's tee shirt (avail­ OllOO OC +TKO signa1 not detected able only to Micro C authors). If you have 01101 OD Comparator mismatch any juicy little technical tips, send them to: 01110 OE Comparator mismatch Ollll OF Unexpected Microprocessor interrupt Juicy Tips, Micro Cornucopia, P.O. Box 10000 10 T~e out on TKO pat 223, Bend, Oregon 97709. 10001 II T~e out on GBl pat 10010 12 T~e out on GB2 pat 100ll 13 Seek range error • • • 10100 14 Voltage unsafe with -WRTGATE inactive 10101 15 Voltage unsafe with -WRTGATE inactive 3112 or 5114 Disks 10110 16 Chip unsafe (-WRITE FAULT) Available 10111 17 Step pulses received with -WRTGATE active $6 ppd (U.S.) or $8 ppd (Foreign) 11000 18 T~e out on +END DECEL signa1 11001 19 T~e out on track crossing (-CLY PULSE) 11010 lA Overshoot 110ll lB T~e out on +FIUE TK lllOO lC +TKO signal not detected 1·800-888·8087 11101 lD Comparator mismatch after rezero (orders only) 11110 lE Servo adjust fai1ure - no c10sure or (503) 382·8048 lllll lF 6301 Trap • • •

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 93 MICRO CORNUCOPIA BACK ISSUES ,', Complete Your Education ... 'hi ':1 111 Out Your Collection of Micro C today!

~\lE.1 (8/81) ISSUE #16 (2184) ISSUE #27 (12/85) ISSUE #41 (5/88) ISSUE #46 (3189) ~.rSupply Xerox 820 Column Restarts SOLD OUT Artfflclallntelligence Software Tools ,- 1,:112 PFM.PRN BBI Double Density 3-D Graphics The Art of Disassembly ,' ""G~ag.es BBII 5"/8" Interface Fix ISSUE #28 (2186) Neural Networks Handling Interrupts With Any C ,t'Y"I!',_' Kaypro ZCPR Patch Rescuing Lost Text From Logic Of Programming Hacking Sprint: Creating ,qUE'~ (10/81) Adding Joystick To Color Memory Languages Display Drivers P.rallGl print Driver Graphics Introduction To Modula-2 Applying Information Theory Greatest C Compilers , O(1v" ~tor Control Recovering Text From Memory Inside The PC 96 pages Turning A PC into An Em- l~page.s ' 52 pages 104 pages bedded Control System ISSUE # 42 (7/88) Practical Fractals 'If$Ui:,3 (12/81) ISSUE #17 (4/84) ISSUE #29 (4/86) Maintaining PCs 96 pages :4MHz Mods Voice Synthesizer Speeding Up Your XT Keeping Your Hard Drives yonfiguring Modem 7 Kaypro Morse Code Interface Prototyping In C Running ISSUE #47(5/89) : 'fJ,VQr$fil Video 'Cursor 68000-Based System Review C Interpreters Reviewed Troubleshooting PCs Robotics fO~T~words Begins Inside CP/M 86 Benchmarking The PCs XT Theory of Operation The LIMBO Project '~P ges 56 pages 104 pages Simulating A Bus Starting A Robotics Company ,1",', .. Ray Tracing How To Write and Use A , "8SU~'4 (2/82) ISSUE #18 (6/84) ISSUE #30 (6/86) 96 pages SystemProfiler .t<.Y9Qard Translation Kaypro EPROM Programmer PROLOG On The PC Problem Solving and Creativity ~.4¥Hz Mods 1/0 Byte: A Primer Expert Systems ISSUE #43 (9/88) Turn Your XT Into A Controller ~.ms, Lync, and S1 Os Kaypro Joystick Logic Programming Building Databases Writing Code For Two , " UI'I~~ing CPIM ERASE Serial To Parallel Interface Building Your Own LogiC Build a C Database Operating Systems :::~QP~Qes Business COBOL Analyzer Selecting a dBase III 96 pages > ..':";{ , 60 pages 256K RAM For Your 83 Kaypro Compatible Compiler ,s.l,Ii'5 (4/82) PC-DOS For Non-Clones Working with Paradox ISSUE #48(7/89) "l~Text Editors ISSUE #19 (8184) 104 pages Designing Custom PC Cards Tools For The Physically Oouble Density Review Adding Winchester To BBII Accessing dBase III Plus Impaired , ~O,paQe$, 6 MHz On The BBI ISSUE #31 (8/86) Records from Turbo Pascal The Adventure Begins ;!"" .:p Bulletin Boards RAM Resident PC Speedup 96 pages Selecting A Talking Computer '$$UE #6 (6/82) Track Buffering On Slicer Practical Programming In For A Blind Friend "' E:PROM Programmer 4 MHz For The 820-1 Modula-2 ISSUE#44 (11/88) Writing Software For The Blind Cy~omize Your Chars 64 pages Unblinking The PC's Blinkin' Object-Oriented Program­ File Transfer Via The Parallel Qouble Density Update Cursor ming Port , I 21'pages ISSUE #20 (10/84) Game Theory In PROLOG A Taste of Small talk The LIMBO Project-Part Two

, I HSC 68000 Co-Processor and C Actor PCX Compatibility 'aUE (17 (8/82) DynaDisk For The BBII . 104 pages Thinking Objectively A 68000-Based Multitasking , 6 Reviews Of C Serial Printer On BBI Sans S 10 Building MicroCad Kernel

I A(jding 6K Of RAM Cheap & Dirty Talker For Kaypro ISSUE #32 (10/86) Peripheral Technology- The Very Early Days of ~LOr1Your Own Begins Extended 8" Single Density Public Domain 32000: PT68K-2 Computing :, t~pages 72 pages Hardware And Software Hercules Graphics Printer 96 pages ;,;. Writing A Printer Driver for Dump ·~UE:'8 (10/82) ISSUE #21 (12/84) MS-DOS 96 pages ISSUE #49 (9/89) $9~OpUT Analog To Digital Interface Recover A Directory By IIO,VO.•. • :.: ,! •• Installing Turbo Pascal Reading & Writing Disk ISSUE #45 (1/89) Build A Computer The Easy 'MVE 19 (12/82) Low Intensity BBI Video Sectors Computer Aided Design Way (J.ijIlEPROM Program Turbo Pascal, The Early Days 96 pages CAD In A Consulting Business PostScri ptals fWlo~ting Your CP/M 80 pages Choosing PCB Layout Systems Prog. Logic Controllers :S.rial,print Driver ISSUE #33 (12/86) Building Circuits With Your Driving Stepper Motors Big $oarcf I Fixes ISSUE #22 (2185) ISSUE #34 (2187) Computer Writing TSR Programs , ~? pages Xerox 820-11 To A Kaypro-8 • ISSUE #35 (4/87) Secrets of Optimization Low Cost I/O For The PC Sound Generator For the ISSUE #36 (6/87) Finding Bargains in the InterfaCing 16-Bit Devices :1"~E'10 (2/83) STD Bus ISSUE #37 (9/87) Surplus Market 96 pages ."UE #11 (4/83) Reviews Of 256K SOLD OUT MASM5.1 .'~ ;~L.POUT RAM Expansion 96 pages ISSUE # 50 (11/89) .', i',· ' , ,\<-,1' 88 pages ISSUE #38 (11/87) 3-D Graphics U.Uf; ,12 (6/83) Parallel Processing 3D Surface Generation , . .,iriging Up BBII ISSUE #23 (4/85) Laser Printers, Typesetters PC Video Frame Grabber , ,'4>C?Ublt Sided Drives for BBI Automatic Disk Relogging And Page Definition LIMBO, Part Three ,p~~tRadio Interrupt Drive Serial Printer Languages PostScript, Part Two "',' $ MH~ fQr Kaypro Low Cost EPROM Eraser Build A Graphics Scanner UNIX For The PC ,tQP~s Smart Video Controller For $6, Part 2 Capturing & Graphing A Voice : ;; 'r, ,'" '!:" .~ Review: MicroSphere RAM Disk Writing A Resident Program In Real Time: Part 1 J.I,JQUE '13 (8/83) 86 pages Extractor In C , (}P/M Disk Directory 96 pages ••• MOi'~'56K for BBI ISSUE #24 (6185) Minj FWnt Panel C'ing Into Turbo Pascal ISSUE #39 (1/88) ;C~~pfa.st Modem 8" Drives On The Kaypro PC Graphics ...,1,P,riHter Interface 68000 Versus 80x86 Drawing The Mandelbrot And To Order: '~yp;oReverse Video Mod Soldering: The First Steps Julia Sets .~pages 88 pages Desktop Graphics I,'.,:,''':' . Designing A PC Work­ Phone: 1-800-888-8087 ,"U~#14 (10/83) ISSUE #25 (8/85) station Board Mail: PO Box 223 ti'$.lIlnstaliation Why I Wrote A Debugger Around the TMS-34010 ,111.' Perfect Terminal The 32-Bit Super Chips 96 pages Bend,Oregon 97709 ~/$$'Video Size Programming The 32032 .; ,I Vi~()Jitter Fix Modula II ISSUE #40 (3188) United States, :' k,iYpro Golor Graphics Review RS-232C: The Interface The Great C Issue Issues #1-34 $3.00 each ppd. • J ... pages 104 pages 11 C Compilers ~ -\ (' , Writing A Simple Parser In C Issues #35-current $3.95 each ppd. . ,iSu~ #15 (12/83) ISSUE #26 (10/85) C++, An Object Oriented C ,'.~re,,, Dump Listing Inside ZCPR3 Source Level Debugger For Canada & Mexico 'fillir,iO $erial Ports Two Megabytes On DSI-32 TurboC Pttlyi!19 Adventure SOGIV 96 pages All issues $5.00 each ppd. '!JP9'"aqing K1;\ypro II To 4 The Future Of Computing Upgrading Kaypro 4 To 8 Graphics In Turbo Pascal '~8pages 104 pages

94;, MICRO CORNUCOPIA, #51, Jan-Feb, 1990 -'n;' AD~:~S~EX ISSUE 51

170 AISN Software ...... 93 180 IDEC ...... 15 .... RJSwantek Inc ...... 37 72 AcquiredIntelligence ...... 71 149 Information Modes ..... 21,91 171 Ry Ie Design ...... 93 160 Annabooks ...... 55 22 Integrand...... 45 179 Argon Technology Group ....91 176 Sampson Engineering ...... 91 4 Austin Codeworks ...... 35 154 JRT Systems ...... 69 127 SemWare ...... 53 162 Semi-Disk Systems ...... 36 147 Berry Computer ...... 5 175 Kilgore Software ...... 67 177 Silicon Alley ...... 47 .... Sin tar Software ...... 87 31 CC Software ...... 77 181 MCR ...... 91 40 Star-K Software Systems .... 44 Carlson, Paul ...... 91 42 McTEK ...... 75 173 Sutrasoft ...... 21 15 Cascade Electronics ...... 25 .... Micro Cornucopia ...... 71,93 182 Symmetric Research ...... 91 167 Computer Book Outlet ...... 91 37 Microprocessors Unlimited " 77 7 Compuview Products, Inc. ... 7 2 Microsphere, Inc. ... Inside Front 183 Tools and Techniques ...... 87 158 Cottage Resources ...... 91 165 Mt. St. Helens Software .... 13 178 Traxel Labs ...... 12 143 Covox ...... 6 .... NTERGAID ...... 91 168 University Degree Advisory .. 93 174 Daytron ...... 55 110 Nu-Mega Tech ...... 2 16 Dreamtech ...... Inside Back 62 V Communications ...... 57 161 Opal Fire Software ...... 73 10 Emerald Microware ...... 33 124 WenhamSoftwareCo ...... 91 135 Epoch Data ...... 52 3 PC Tech ...... Back Cover, 91 169 Western Wares ...... 72 93 Erac Co ...... 63 119 Peripheral Technology ..... 76 164 Whitney Software ..... ; .. 91 .... Eckel, Bruce ...... 95 139 Quantasm Corp ...... 15 39 Xenosoft ...... 93 112 Garrison ...... 73 .... Genus Microprogramming .. .19 .... Recon Technology ...... 93 70 Zortech ...... 1 129 Research Group ...... 61 .... Revolution 2 ...... 49

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 • c++ Pointers, from Walter Bright Use your PC parallel port for digital input and output • Inside C++ 2.0 Build an Adapter Card for your PC Design and build • Building an AT Keyboard Interface electronic circuits • TTL Families Explained "With wit and superb technical figures, Bruce • Filling Memory Holes on Your XT captures the essence of making electrons out of bits and vice versa." • Neural Networks, Part 2 Order From: Jeff Dunteman, Dr. Dobbs Micro Cornucopia PO Box 223 Bend, OR 97709 Only $30 ppd. 1-800-888-8087 Add $10 for foreign orders Includes Book & Disk

MICRO CORNUCOPIA, #51, Jan-Feb, 1990 95 By Gary Entsminger P.O. Box 2091 Davis, CA 95617

Brains, Neural, Networks, THE & Expert Systems LAST

Rule-based systems, scripts, and philosophically and technically appeal­ Gary takes a top down approach to bot­ frames are the tools of the AI top-down ing. tom up. trade. The "intelligence" of any of these The net uses patterns of bits instead systems is generally static. No dynamic of individual bits to process informa­ learning system based on rules has ever tion. Since a network looks for patterns OW do we learn, recognize, and been successful. rather than at the status of individual remember? In other words, how In a fascinating study of the "big is­ bits, no single bit is crucial. The network Hdo we think? And to what degree sues" in science, called Paradigms Lost, can deal with minor variations in input can a computer model us? Duplicate John Casti sums up the top-down posi­ and still produce the right output. our thinking? (Editor's note: Assuming a tion- I'm inclined to think that this more computer would want to model us.) Put crudely, the top-down thesis is that nearly mirrors our thought processes. Much thinking, paper, and many human thought processes take place as a re­ Humans are associators, often computer bits have been used to explore sult of rule-based symbol processing in the guessers-we take informal statistical these and similar questions. Computer brain.... Top-downers blithely forget about samples and make decisions based on a scientists, neurobiologists, psycholo­ brain states altogether, and just assign ma­ best-fit scenario. One memory leads to gists, philosophers, and just plain folk chine states to cognitive states, much in the another. We often forget details, but still delight in concocting visions and ex­ same manner as we assign ASCII codes to recall the overall picture. periments, in hopes of edging a bit alphanumeric symbols. The bottom-upper's view is also con­ closer to something plausible. ' A set of rules (usually termed a semantic sistent with most physicists'-we can't The AI community, for example, network or conceptual dependency graph) know individual particles precisely broadly splits along two paradigms for telling how these machine states can com­ ,·(their momentum and location), but we explaining thinking: Thinking => the bine with each other is then postulated, and ,.-,can know quite a bit about the behavior way the brain does it; Thinking => the the resulting machine states are decoded to of a group of particles. results the brain gets. These views repre­ give an interpretation .... This, in a nutshell, ,Bottom-uppers haven't answered the sent the strong and weak schools of AI. is the strategy of the entire top-down ap­ big-think question, and probably won't, The weak school at its most pliant proach to AI. but they're tilting the AI community in (according to philosopher Keith The top-down approach is software an intriguing direction. Gunderson) claims that computers can oriented, ignoring the hardware (our For now of course, who knows how perform tasks that previously required brains) almost entirely. we do it. Think, I mean. According to intelligence, without using any intel­ Aristotle- ligence at all. Bottoms Up It often happens that a man cannot recall An expert system belongs in this par­ The bottom-uppers take the opposite at the moment,but can search for what he adigm since it typically classifies new approach. In their view we'll learn more wants and find it.. .. For this reason some information based on rules extracted about thinking by working from the use places for the purposes of recollecting. from a human expert. The expert was level of primitive processors (the neu­ The reason for this is that men pass rapidly (presumably) intelligent. The expert sys­ rons in our brains) up. Strong AI. from one step to the next: for instance from tem will seek answers, give advice, or Neural networks and the work of milk to white, from white to air, from air to classify by looking things up. Looking bottom-uppers-Douglas Hofstadter, damp; after which one recollects autumn, things up isn't all that intelligent. Geoffrey Hinton, Douglas Lenat, and supposing that one is trying to recollect that Rule-based systems also belong to (strangely enough, considering his early season. the domain of the top-downers in the criticism of perceptrons-neural net­ AI community. Alan Turing, Herbert work-like systems) Marvin Minsky-are References Simon, Allen Newell, Edward Feigen­ beginning to shed a bit of light on the Casti, John L., Paradigm's Lost, 1989, baum, and Roger Schank are all top­ thinking question and show promise. William Morrow & Co. downers, and their thinking about Neural networks' aren't technically And thanks to Al Goldberg for thinking has dominated AI research for that complicated (see Russ and Roy's stimulating this discussion. 30 odd years. article in this issue) but are, I think, • • • 96 MICRO CORNUCOPIA, #51, Jan-Feb, 1990 The Computer Store America'sjinest in computer mail-order is having their biggest sale ever•.•

6' Parallel Printer Cable $3 ~1rlhle DIream ~§§ ®~ Molded & shielded with thumb screws 30 Megabyte mM Compatible AlB switch Box $19 12 MHz CPU with 640K RAM installed For parallel printers 30 Megabyte bard disk drive (3.5" 4(km aYCrIF accesl) 128K Expanded memory installed (LIM4.0) Joystick $15 With auto centering & rapid fIre 1.2 Megabyte or 360K 5.25" floppy drive Floppy controller Game & Clock Card $12 (will control up to 1.44MB floppy drives) High resolution amber monitor with tilt/awi~ hue Logitech C-7 Mouse Hercules compatible graphics Senal Mouse with software $65 Professional enhanced keyboard Nashua DSHD Disks 1 year warranty Box of 10 high density disks in $10 Reg. $995 plastic carrying caase All computer systems can be customized VGA Card $185 to your exact specifications Capable of 1024 X 800 with 256 colors

~1rItne DIream~2g~® =:a. ~1rItne DJream-386® =- Our 40 Megabyte mM AT Compatible Our 40 Megabyte 386 Speed Demon 12 MHz CPU with 1 Megabyte RAM installed 16 MHz CPU with 1 Megabyte RAM installed 40 Megabyte bard disk drive (28ms average access) 40 Megabyte bard disk drive (28ms average access) 1.2 Megabyte 5.25" floppy drive 1.2 Megabyte 5.25" floppy drive Hard & floppy disk controller card (1:1 interleave) Hard & floppy disk controller card (1:1 interleave) 14" High resolution flat screen amber mo:nltc)r 14" High resolution flat screen amber monitor Hercules compatible graphics Hercules compatible graphics Professional enhanced keyboard Professional enhanced keyboard 1 year warranty 1 year warranty Reg. $1495 . ~~e $ lili~5 Reg. $1995 ~~e $1.dJ95 Upgrade any of these computers to color (monitor and adapter) Above with 20MHz CPU c....~e $ 1. 7lf1\ f!: CGA +$150 EGA +$325 VGA +450 Reg. $2295 ~ Y ~ We carry a complete selection of••• Citizen GSX-140 With name brands like ... 24-wire 192 CPS Printer Hard/Floppy Drives Memory upgrade cards Color on command® Apple Citizen chips Advanced Paper Handling RAM IBM Seagate Command Vue® LCD console 110 cards Everex· Maxtor Modems eliminates dip switches Micropolis Sony Monitors Advanced paper handling Miniscribe Samsung Printers including paper parking Borland Logitech Diskettes Push/pull tractor with bottom, Microsoft Xerox Digitizers top, and rear feed SCQ Aldus Cables 2 year warranty Novell Hayes Reg. $595 ~~e $ 345 Ribbons NEC Curtis Software Toshiba Fujitsu If you need it, we have it ... for less. Give us a call ...... andmore . .. andmore DreamTech (408) 996-2373 'In the heart o/Silicon Valley' 5175 Moorpark Avenue San Jose, CA 95129

PriCCII arc subject to change without notice. All aales arc FOB San JOIIC, and arc subject to prior sale. A 3% surcharge applies for all MC and VISA lransactionl. California relidcnts add 7% sales tax. 1bc fdlowing trademarks arc recognized: IBM PC/XT, AT to IBM Corporation; Hercules to Hcn:ules Computer Teclmology, Inc. Other product names arc trademarks of their IIWIUfacturcrs. This ad is a copyrighted publicatilD of DrcamTcch with III rights re~ Distributed Miao Cornucopia, January, 1990. Reader Service Number 16 VERY HIGH PERFORMANCE Processors, Memory, and Display Adapters The X24 High performance processor • 12 or 16 MHz 80286 with NO WAIT STATES! • Small size ("XT" 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 matherboard and backplane designs In a tOO% AT compatible system. Incor­ porating a t6 MHz 80286, the X24 processor Is designed to operate with the PC Tech Advanced System Mother­ board, wh ich 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 the microprocessor and up to ~ megabytes of fast memory are contained on a single PC size plug-in card. This allows the processor 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 AT interface type hard drives • Fully AT compatible floppy disk support for 3.5",5.25" drives, capacities of 360k, 102m and 1044m • Two serial ports and one parallel port • 8 total expansion slots PC/XT/AT compatible (4 slots have 32 bit bus) The PC T eeh Advanced System Motherboard is designed to complement PC Tech's X24 and X32 high periormance processor cards. It contains the mass storage interfaces necessary for a complete sys­ tem, plus the basic I/O required in most systems. Extra care has been given to FCC compliance by design.

34010 Monochrome Graphics Adapter 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 emula­ tion PC Tech Mono-II • 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 TMS340tO is a true general purpose graphics processor. PC Tech makes the total processing power of the 34010 available to both programmers and end users. Our 340tO Monochrome Graphics Adapter is designed to allow programming from the PC/Xf/AT host bus. You can completely replace our 34010 software w~h yours to directly hamess the incredible image processing power of the TMS 34010 for your application. We make a complete set of development tools available, including an assembler, C compiler, program loader, 34010 debugger, and PC interface tracer/debugger. Our stand­ ard product includes support for extended CGA, MDA and Hercules emufation as well as a host addressable graphics bit- map. We also support and recommend the DGIS graphics interface standard (from Graphic Software Systems) for applications development as an a~ernative to nalive 34010 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 cus­ tomize any of our deSigns to better meet your needs on our io-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 re­ lated products for over three years. Our standard product line includes processor, memory, and video products. All products are designed , manufactured and sup­ ported 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) Reader Service Number 3

PC, XT, AT, DGIS, Hercules, and Award BIOS are trademarl