<<

No. 46 March-April 1989 $3.95 THE MICRO TECHNICAL

Software Tools

OK, you asked for it, an issue dedicated (mostly) to software.

The Art of Disassembly page 8

Using Sourcer to create commented, assembly source from object files.

Handling Interrupts page 16 WithAnyC

Hacking Sprint: page 36 Creating Display Drivers Annual Reviews

Comparing the latest, page 40 greatest C . And More ...

Turning A PC Into An page 24 Embedded Control System

Bringing Up A Surplus page 28 68000 Board

Part 2 of Karl Lunt's cheap 68000 project. Plus: Practical Fractals 32 Shareware you must register 62 And Much, Much, More

04

o 74470 19388 3 '.Aztec C ROM Cross Deve)opmel1tSyslems Produce Fast, TightC Code with LessrEtTort i Aztec CROM Cross Development systems areth~ Systems give you the best results - choice of more . clean, tight and fast running code. professional ROM Aztec C systems are available for a variety developers. . of targets and for both MS-DOS or Apple So when you're 100kingJor Macintosh hosts! And, Aztec C systems the best results, insist ()n come complete with all the tools to edit, Aztec C ROM Cross Devel()pment compile, assemble, optimize.and, now, Systems. Call today and find out·mote source debug your C code in less time and about our complete line of Cross·· with less effort. Development Systems. Quality, tight code that's. fast and efficient. An abundance of tools to produce better Supported targets include: the 68xxx family, the full 8086 family, the results in less time. That's why Aztec C 80801280 family and the 6502 family of microprocessors.

1-800-221-0440(O~;de (NJand· 1 201 5422121 Telex:4995812MANX ebyMJ\NX Outside U.S.) --- . Fax: 201/542-8386 SOFTWARE SYSTEMS One Industrial Way Eatontown, New Jersey 07724 Reader Service Number 17 Quality & Price You Can't Pass Up!

SUPER 80386 SYSTEM 8/20 mhz features an 80386· 20 CPU on a full size DTK motherboard with 28MB 32 bit memory slots. Accepts 80387·20. This machine runs an incredible Norton SI test of 24! For quality and reliability we've included a 40 MB Miniscribe hard drive, 1. 2MB & 360K Toshiba or Teac floppy drives, monographics with green or amber monitor, 101 keyboard, 1 MB of 80 ns DRAM, DTK Bios, slide case, 2 serial ports, 1 parallel port, po~r supply, clock, calendar. FREE assembly and test· ing. One year warranty.

2 MB EMS configurations: MEMORY BOARDS towenase, color, etc. 0 0 0 0 0 0 • SCan XT SYSTEMS DTK 8 MB RAM card 0 0 0 0 • 0 • 0 •• 99 ~ Include: 640K RAM, serial/parallel/ (32 BIT, fK) game ports, clock/calendar, 101 key PC/XT keyboard, turbo switch able, slide cabi­ Floppy Controller ••••••••••••• 19 net, power supply, mono graphics Multi-f\..inction-1 ser/par/ DISK DRIVES (Continued) with amber/green monitor. 1 yearwarranty. clk/game/2 floppy ••••••••••• 47 AT 40 MB MiniScribe FREE assembly and testing. 640K RAM (0K) ••••••••••••••• 25 3650 (61 ms) 0 0 • 0 0 0 • 0 0 0 0 0 • 0 0339 4.77/10 with 2 Floppy ••••••••• 790 150 Watt Power Supply ••••••••• 50 AT 40 MB MiniScribe IFD and 1 Miniscribe HD: Slide case lock, LED ••••••••••• 38 3053 (25ms) • 0 0 • 0 0 0 0 0 •• 0 0 0 0489 4.77/10 with 20 MB HD •••••••• 995 AT 71MB MiniScribe 4.77/10 with 30 MB HD ••••••• 1010 AT 6085 (28ms) 0 0 0 • 0 0 • 0 • 0 0 0 0 • 0 649 200 Watt Power Supply ••••••••• 75 AT (MFM) HD & FD AT/386, Lock, LED •••••.•••••• 65 AT SYSTEMS Controller card DTK 000.000.110 Includes: 640K RAM, 1.2 MBFD, 1 Tower AT/386, Lock, LED & 200 Watt ps •••••••••• 239 WD ..... 0 0 0 .127 360K FD, 40 MB Miniscribe 3650HD AT RLL HD & FD serial/parallel/game ports, clock/cal­ Controller. 0 0 0 0 0 0 0 0 0 0 0 0 0 • 0 0 189 endar, 101 key turbo switchable key­ MOTIlERBOARDS board, slide cabinet, power supply, XT/Turbo 4.77/10 ...... 79 AT 6/10 Award/Phoenix! MONITORS monographics with amber or green EGA/CGA monitor. Full one year warranty. FREE DTK Bios •••••..••••• 0 •••• 249 (Autoswitch .31 dot) 0 0 • 0 • 0 •• 385 assembly and testing. AT 6/12 Award/Phoenix! 6/10 mhz ...... 1450 DTK Bios •••••••• 0•••• 0 ••• 299 CGA/EGA/VGA 12 mhz •••••••••• , ••••••••• 1495 Baby AT 6/12 AMI/DTK ••••••• 279 MultiSync (.31 dot) 0 0 0 0 0 0 0 0 0495 CGA Color • 0 0 0 0 0 0 0 0 0 0 • 0 0 0 0 0249 Color options for any kit (includes 803868/20 DTK Bios. o' ••• 0 ••• 937 video card and monitor) XT/AT Memory 0...... $CALL Amber 12" TTL 00000000000000089 CGA Color •••••••.••••••••• 175 Green 12" TTL 0000.0000.0.0 •• 89 CGA/EGA Color •••.••••••••• 380 SOFfWARE VGAAnalog VGA (analog) ••••••••••••••• 650 MS DOS 3.21 w/GW Basic 0 ••••• 49 (Mitsubishi .28 dot) • 0 • 0 0 0 0 • 0549 CGA/EGAlVGA Multisync ••••• 450 DR DOS 3.3 w/GEM 0 0•• 0 •••••• 49 Color/Graphics/Par. 0 •• 0 0 0 0 0 0 0 049 Mono/Graphics/Par 0 0 • 0 0 0 0 0 0 • 049 PCXT&AT DISKDRlVES CGA/EGA/VGA (640x480) 0 0 0 • 0 169 Clock .•••••••••••••••••••••• 19 Teac/Toshiba 360K •• 0 ••••••••• 80 VGA Analog, STB Extra 0 0 •• 0 0 0 235 Game .•••••••••••••••••••••• 14 Teac/Toshiba 1.2 MB •••••••••• 105 Parallel (LPT 1, 2 or 3) ••••••••• 18 Teac/Toshiba 3112" 720K •••••••• 99 KEYBOARDS Serial Port Card - 1 installed Chicony Click 101 ••• 0 •• 0 • 0 0 0 • 049 Switchable Com 1, 2, 3 or 4 •••• 18 Teac/Toshiba 3112" 1.44 MB kit. •• 139 Keytronic KB101 00 •••••• 0 0 0 0 • 067 Kit for 2nd SerialPort •••••••••• 18 XT 20 MB Miniscribe Multi I/O 8425 (65ms) 0 ...... 279 Focus 101 Tactile, Serial/Par/Game •••••••••••• 32 8425 w/controller ••••••••••• 319 Switch able, Control Caps Lock, Dust Cover 00' •• 0 0 0 0 00000.0089 2nd Serial Kit ••••••••••••••• 30 XT 30 MB Miniscribe (#1 find by MicroC Staff) Multi Drive Controller •••••••••• 39 8438 (65ms) ...... 0 0 0 0 0 0 .. 0299 Supports 1.44, 720K, 1.2, 360K drives 8438 w/controller 0 0 0 0 0 0 0 0 0 0 0349 * All keyboards, XT/ AT switchable) *

Prices are subject to change without notice. Shipping CHARGES will be added. BUILDING YOUR OWN CWNE V2.1 XT SYSTEM .. $49 ~Micro5~hEreNC .... FREE BOOKLET"·" ~COMrDUTCRIC' "HARDWARE MANUFACTURER - ,I I CJ VI SINCE 1983" *90-day warranty /W-day money back (subject to restrictions) AT SYSTEM ... $99 Orders Only: :[-800-234-8086 Tech cans: (503) 388-1194 855 NoW. WALL • BEND, OREGON 97701 Hours: Monday-Friday 9:00-5:30

Reader Service Number 2 MICRO CORNUCOPIA, #46, Mar-Apr, 1989 1

,----",------_.- SERIOUS DEBUGGJING at a REASONAB1LE lPRJIClE All the speed and power of a RUN CODEVIEW hardware-assisted debugger IN~~LY8K! at a software price ?/~.A!!!II~"""

Soft-llL-".~_ CodeView is a great integrated debugger, but it uses over 200K of conventional memory. Hardware-level break points MagicCV uses advanced features of the 80386 REAL-TIME break points on memory locations, memory ranges, microprocessor to load Code View and symbols in execution, I/O ports, hardware and software interrupts. More extended memory. This allows MagicCV to run powerful break points than ANY software-only debugger on the Code View using less than 8K of conventional market. Soft-ICE gives you the power of an in-circuit emulator on memory on your 80386 PC. your desk. Don't let 640K be your limit! Break out of hung programs If you are closing in on the 640K limit and would With a keystroke - no external switch necessary. Even with like the power of Code View, MagicCV is for you. interrupts disabled. Don't let the debugger hide the bug! Breaks the 640K barrier Even if you're not closing in on the 640K limit, Soft-ICE uses ZERO bytes of memory in the first 1MB of address running Code View with MagicCV makes your space. This is especially useful for those subtle bugs that change debugging environment much closer to the end when the starting address of your code changes. With Soft-ICE user's program environment. You can use your code executes at the same address whether the debugger is Code View to locate subtle bugs that only occur when there is plenty of free memory, or those loaded or not. difficult bugs that only occur when your program Works with your favorite debugger is running with a couple of TSRs loaded. Soft-ICE can be used as a stand-alone debugger or it can add its powerful break points to the software debugger you already use. How MagicCV works You can continue to use your favorite debugger until you require MagicCV uses the 80386 to create a separate virtual machine for Code View. MagicCV uses Soft-~CE. Simply pop up the Soft-ICE window to set powerful real-tIme break points. When a break point is reached, your between 4K & 8K of conventional memory as a debugger will be activated. bridge between the DOS environment and CodeView. Solve tough systems problems too MagicCV is easy to use Soft~ICE is ideal for debugging TSRs, interrupt handlers, self bootmg programs, DOS loadable device drivers, non-DOS Ifyou are a Code View user, you already know how operating systems, and debugging within DOS & BIOS. Soft-ICE to use MagicCV too. Just type MCV instead of is also great for firmware development because Soft-ICE's break CV; everything else is automatic. points work in ROM. Save $86 How Soft-ICE Works Soft-ICE uses the power of the 80386 to MagicCV $199 surround your program in a virtual machine. Soft-ICE $386 MagicCV This gives you complete control of the DOS environment, while Soft-ICE runs safely in Buy Both and Save $861 with Soft-ICE protected mode. Soft-ICE uses 80386 CALL TODAY Using Soft-ICE with Code­ protected mode features, such as paging, I/O (603) 888 - 2386 View gives you the features privilege level, and break point registers, to necessary for professional or FAX (603) 888 - 2465 provide real-time hardware-level break points. level systems debugging. 30 day money-back guarantee Visa, Master Card and AmEx accepted MagicCV and Soft-ICE can "Soft-ICE is a product any MS-DOS work in concert with Code­ developer serious enough to own a l\U -r,lEG1\ TECHl\OLOGIES View to provide the most 386 machine should have." powerful debugging Dr. Dobb's Journal -May 1988 P.O. BOX 7607· NASHUA, NH 03060-7607 platform you will find anywhere. Both require 80386 AT compatible or IBM PS/2 Model 80. MagicCV requires at ~••• Riiieiiiadiie~r s~er.ViiiceiiNiiuimiibeiir.l1iio •. .... least 384K of extended memory. CodeView is a trademark of Corporation.

2 MICRO CORNUCOPIA, #46, Mar-Apr 1989 THE MICRO TECHNICAL J 0 URN A L MICRO CORNUCOPIA

MARCH/APRIL 1989 - ISSUE NO. 46

B. H. Flusche, Jr. 8 The Art of Disassembly 40 C'ing Clearly Disassembly has long remained one of the black arts: black The great C comparison for 1989. because few do it well, black because of its hacker reputation. However, it's a skill that will serve you well. Very, very well. 52 86 World Laine creates packed and unpacked screen fonts.

60 ShareWare Tony reviews PC-File:dB and PC- Write 3.0. Sam Azer 16 Handling Interrupts With Any C 62 The Culture Comer Some Cs support interrupts elegantly, some support them barely. Here's how to interrupt with any C in style. This column is for adults only.

Bruce Eckel 64 On Your Own Turning A PC Into An Embedded Control 24 Kent Peterson starts a computer newsletter. System Bruce goes back to hardware and produces an EEPROM board. This is the first of a series on embedded controllers. 68 Units And Modules

2 18 OATAO /V OATA2 Absolute precision using rational numbers (via irrational AS Data 0 AI Bl Data 1 3 17 DATAl -/V OATA3 AS A2 B2 4 18 nATAl' DATM means). A7 A3 B3 Data 3 5 15 OATA3 -/V OATA5 M M B4 8 14 OATM /V OATA8 AS Oa184 AS B5 n ••• ~ 7 13 ·DATAS /V OATA7 M M B6 A3 08186 8 12 OATM /V A7 B7 . 82 CP/M Notes Karl Lunt Sources of CP/M products. 28 Bringing Up A Surplus 68000 Board What would you do with a fancy, but undocumented, 68000-based processor board? Figure out how to make it 90 Tech Tips run, of course. I Larry Foggi 32 Practical' Fractals What does a,fractal have that'~ practical? What does a fractal have in common with the Deschutes River? Larry brings us the answers to these burning questions. 86 Tidbits Graphing your data with Slide Write. Brett Glass 36 Hacking Sprint: Creating Display Drivers Now that you've hacked everything else you might as well 96 LastPage write a display driver for a text editor. (You'll, of course, Go. use the editor's interface language. Right? You knew about that, I know you did.)

Cover illustration by Paul Leatherwood

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 3 By David J. Thompson THE MICRO TECHNICAL JOURNAL MICRO CORNUCOPIA

Editor and Publisher David J. Thompson Returning SOG To Associate Editors AROUND Gary Entsminger Cary Gatton THE BEND Its Roots Technical Department Larry Fogg

Director of Advertising & Distribution This has probably been the most difficult editorial Jackie Ringsage I've had to write. It's been difficult because I've had to Accounting make some hard choices, and it's been difficult because Sandy Thompson I can't explain everything that went into those choices. Over the past couple of SaGs (Semi-Official Get-to­ Order Department gethers), a number of you have approached me about Tammy Westfall future SaGs. Would there be future SaGs? Was I as ex­ hausted as I appeared? Graphic Design "Of course," I said, "there will be another SOG." Carol Steffy "Yes, I'm exhausted," I added, ''but this is a wonder­ ful time, the highlight of my year. Sure it's fun to write MICRO CORNUCOPIA (lSSN 0747-587X) is for 30,000, but it's ten times more exciting to speak with published bi-monthly for $18 per year by Micro Cornucopia, Inc. 155 NW Hawthorne, Bend, OR 400." 97701. Second-class postage paid at Bend, OR and However, I'm not sure I'd survive another SaG. The additional mailing offices. POSfMASTER: Send Monday after SaG VII, Laura Logan left Micro C. It address changes to MICRO CORNUCOPIA, PO Box 223, Bend, OR 97709. wasn't a bad leaving, she'd always wanted to live on the Oregon Coast. However, when she left, we lost our SUBSCRIPTION RATES: SaG organizer. She planned to continue the project, re­ 1 yr. (6 issues) $18.00 motely, so we announced SaG VIII. But finally, as 2 yr. (12 issues) $34.00 things became busy for her there (making waves, I pre­ 3 yr. (18 issues) $48.00 1 yr. Canada & Mexico $26.00 sume), she bowed out. 1 yr. Other foreign (surfaca) $36.00 For SaGs I and II, loss of a key person wouldn't 1 yr. Foreign (airmail) $50.00 have been a problem. One hundred people showed up Make all orders payable in U.S. funds on a U.S. at our house for a day of potluck food and potluck dis­ bank, please. cussions. Sure, it was a long day - two days, really, but it was wonderful. CHANGE OF ADDRESS: Please send your old However, SaG has grown to 400 people, too many label and new address. for any facility short of the local college. Laura made MICRO CORNUCOPIA sure there were rest rooms, dorm rooms, motel rooms, P.O. Box 223 and classrooms. She also set up rafting, volleyball nets, Bend, Oregon 97709 food services, apple barrels, and that myriad of wonder­ ful, soggy things that had to be done. CUSTOMER SERVICE: For orders and We no longer have someone who has either the time subscription problems call 503-382-8048, 9 am to 5 or the experience to effectively handle another SaG, so pm, Pacific time, M-F. I've been mulling over some options. For technical help call 503-382-8048, Charge for SOG. That way we could afford to hire a 9 am to noon Pacific time, M-F. convention manager or service. But who pays? It's a family event with activities for spouses and kids and BBS - 24 hrs. 300-1200-2400 baud babysitting and all that. So far we've not charged for 8Bits, No Parity, 1 Stop Bit admission. (If we did charge, who'd patrol the corridors 503-382-7643 to make sure everyone had paid?) Plus, everyone from staff to speakers donated their time. That really made Copyright 1989 by Micro Cornucopia, Inc. All rights reserved SaG unique. ISSN 0747-587X End SOG. That's it. Kaput. No more. When I men­ tion this option to folks who call in, I always get a stunned silence. (Thanks.) But some have offered to e Continued on page 72 4 MICRO CORNUCOPIA, #46, Mar-Apr 1989 YOU'LL LOVE /f ~il~ s~=~??T~;~~.ES. The breakthrough

'0 \) fast screen toolkit for Q\t b generator Turbo Pascal 5.0 It doesn't matter which language you pro- Wi If you'd like to combine the raw power and gram in. With Saywhat, you can build beautiful, E speed of Turbo Pascal with the simplicity and elaborate, colorful screens in elegance of dBASE, Topaz minut~s! That's right. Truly GUrARANTEE IT' is just what you're looking fantastzc screens for menus, ~ for. You see, Topaz (our data entry, data display, and • brand new collection of help-panels that can all be displayed r\. n units for Turbo Pascal 5.0) was specially with as little as one line of code in any V IRON CLAD "d created to let you enjoy the best of boUt language. Batch files, too. MONEY-BACK worlds. The result? You create truly daz- With Saywhat, what you see is GUARANTEE. zling applications fast. And no wonder. If you aren't completely h I exact Iy w hat you get. And response time delighted with Saywhat or, Topaz is a compre ensive too kit of is snappy and crisp, the way you like it. Topaz, return them within dBASE-like commands and functions, That means screens pop up instantly, 30 days for a prompt, designed to help you easily write out- whenever and wherever you want them. ~friendlY refund. standing, polished programs. Now you Whether you're a novice program- ~ Q can write in Pascal using SAYs and merlongingforsimplicity,oraseasoned -~ GETs, PICTURE and RANGE clauses, professional searching for higher produc- ,../ I)" then SELECT and USE databases and SKIP through tivity, you owe it to yourself to check out U2/. ~1 records, plus BROWSE, INDEX ON, FIND, PACK, Saywhat. For starters, it will let you build 0~ APPEND, a complete set of time and date handling your own elegant, moving-bar menus into \ \ .... routines and lots more. any screen. (They work like magic in any / )) ) In fact, we've emulated nearly one hundred actual application, with just one line of code!) I..::::: U dBASE commands and functions, and even added new You can also combine your screens into extremely commands and functions! All you do is declare Topaz's powerful screen libraries. And Saywhafs remarkable units in your source code and you're up and running! VIDPOP utility gives all languages running under PC/ The bottom line? Topaz makes writing sophisti- MS-DOS, a whole new set of flexible screen handl ing cated Pascal appl ications a snap. Data entry and data commands. Languages like dBASE, Pascal, BASIC, C, base applications come together with a minimum of Modula-2, , and COBOL. Saywhat works with code and they'll always be easy to read and maintain. all the dBASE compilers, too! Topaz comes with a free code generator that auto- With Saywhat we also include a bunch of terrific matically writes all the Pascal code you need to main- utilities, sample screens, sample programs, and out- tain a dBASE file with full-screen editing. Plus truly standing technical support, all at no extra cost. (Com- outstanding technical support, at no extra cost. (Com- prehensive manual included. Not copy protected. No prehensive manual included. Not copy protected. No licenSing fee, fully guaranteed). $49.95 licensing fee, fully guaranteed!. $49.95

ORDER NOW. YOU RISK NOTHING. Thousands of satisfied users have already ordered from us. Why not call toll-free, right now and put Saywhat and Topaz to the test yourself? They're fully guaranteed. You don't risk a penny. ------SPECIAL LIMITED-TIME OFFER! Buy Q"""YES. I want to try: Saywhat?! and Topaz together for just Saywhat71 your lightning-fast screen gener- Topaz, your programmer's toolkit for Turbo $85 (plus $5 shipping & handling). ator. so send __ copies ($49.95 each. plus $5 Pascal 5.0. so send __ copies ($49.95 each. That's a savings of almost $15. shipping & handling) subject to your iron-clad plus $5 shipping & handling) subjecttoyour iron- money-back guarantee. clad money-back guarantee. To order: Call toll-free D YES. I want to take advantage of your special offer! Send me __ copies of both Saywhat?! 800.. 468.. 9273 and Topaz at $85 per pair (plus $5 shipping & handling). That's a savings of almost $15. In California: 800-231-7849 NAME ______International: 415-467-6840 ADDRESS ______C1lY ______STATE _____ ZIP ______The Research Group 100 Valley Drive D Check enclosed D Ship C.O.D. D Credit card Brisbane. CA 94005 # ______Exp. date __ Signature ______THE RES EAR C H G R 0 U P Reader Service Number 129 MICRO CORNUCOPIA, #46, Mar-Apr, 1989 5 "Pop-Up" DBASE Reference System Powered by The Norton Guides™ Letters Only $99

Powered by The Norton (iliY~9E @iillilH~m~I!r'!I~i Guides reference engine iijil€il~mill!ril~~!1l!l.~j i;l9f3l~i'(!f:J Oops Indeed @ti~Jlit~ (furiil~lLfI; t'Jmll4m!{~n To power DBASE!l.a..Li.a&.. We have included the Norton Guides "reference I thoroughly enjoyed Micro C's Object Oriented Program­ engine". It features ease of use, small ming issue (#44). Indeed, I am one of the religious fanatics of f~!IJ;"';Mt:J(:TiT!lYI!1:nmi::t=:ti m.; size and fast automatic lookup the WWLFSOG (We Who Live For SOG) sect that Micro C o ®tr:Ht~ti) @!It!J:f:'lIl!lH. capability. It instantly "pops-up" information on your screen, right next caters to so well. But I seem to be suffering from an acute case () '.1 (!@':..~~ fIIH:lI!~'1 (~r;}:(~ to your work, right where you need it. of Groping for Acronyms Syndrome (GAS). .., ('ill.)'~;I~'J t:. 1;r~~€Y.:.~1?;: In either full screen or movable half In issue #44's articles and advertisements, the letters 00, screen. OOP, or OOPS are used for the same phrase - Object Oriented Instant "pop-up" Reference Programming. Zak Urlocker calls it OOP on page 18, Bruce 1!'li1.:.'\-:r: @.#!lJ1il~ 1f..;J i:l!WJ~('l!II~l~ DBASE!l!LLi.M. is a "pop-up" quick Eckel calls it 00 on page 32, the Digitalk ad on page 12 uses reference system that provides you Ilil<1 j~C!l~!:!lil (!t!Jf!~~:'; 1':1t;H::tH!J~ with instant access to all aspects of the ('1i~Jm~ OOPS (the picture on page 13 does include the word "system"), DBASE language and programming l; l~jt~iilO]"'/INmJll~iit'Jil~::' ik.~!H) and the Zortech ad on the inside back cover uses both OOP and environment. u (lliml.i.!lill('IIJ~il!,millf!lfl~1,j oops (oops?). i I ill!l!!!'l iI I lima;, First, I think 00 is incomplete (maybe Bruce saw fireworks No More SearchlngThrough '(!f:l')I.ri~ m~::r:I~H!!l:) tHj\~IIii'@ as he bathed in the Pleasure of Object Oriented Programming Books flit:-:H!.lllriliW 1~(ilil~lm Each DBASE Q.n...L.inL reference 'I 1,:,\!'.!)iii~~-W:~',i~I-"~ I~):!l:'q, 1m (POOP». Then there's OOPS. What's the "S" for? Software? database is a complete and thorough I !i~'.''I'l~J(U:'J I iiliI!" tf!tii'llit:l System? Or is it just Silent? I suspect some advertisers think it's reference library eliminating the need ~'t.·ml'1il cute or has a nice ring. But, frankly, oops is something I say for tedious time-consuming searches :1 I~WI.!li lihllf "i!r(:t'1i1r!.If::l~h\'J through books and manuals. All when I've made a misteak. L' ~'II r:\lJul ~l!J t?J 1N!Ji [~)~II hI i l.!l!f:.c!l~ reference databases are organized so l!~It!t£§I!i'IW li~JiIVlHli,(lili - . I can only hope these Fanatical Object Oriented Language you can find relevant information/ast. l~t!Jil!Ji)<-fuIlH® li,~~I,~il!l.il Sellers (FOOLS) drop the "S" before we all Generate Adverse Gossip (GAG). Comprehensive DBASE \~i~Iit~ " I£HH!)~(iLollH!.L~11Iil~i~l!1~t~1i1 Reference (fultiIY;ilr.:tl§ltil"i&~\!h1!ililibi;CI Larry Hollibaugh DBASE Q.n..Lin.e.. gives you quick 13iIiiHl/r'J i -i1il!Jllril!<..:r, .~IIt!lwtil!) th reference to important information 2714 SE 19 Ave. \'J!l!IIt!)(!I'iliH~ III!l!" !!lWil such as; syntax, description, options, Portland, OR 97202 notes, library, example of use and f(=t~i~ilW~,l!.I(!.l4-) complete cross reference to all related keywords. DBASE On Line ... Is Easy A Dose Of Reality Replaces Books & Manuals To Use With all the Object hype being published, there is one article Reference topics include; Commands, You will be using DBASE f2.n....LiM. which I fear will not get the attention it deserves. In the May '88 Functions, Operators, Cursor productively in less than 5 minutes. Navigation Keys, Error codes and Guaranteed! issue of IEEE Software, the creator of c++ published an article messages, Config settings, Technical titled, ''What is Object Oriented Programming?" specifications, dbf file structure, Create Your Own Reference Before some readers groan, "Oh God, not another one," I descriptions for all utility programs along with tables for reserved words, Databases I must say this article is different. I may do it injustice, but to bru­ InkeyO, ReadkeyO, ASCII codes and In addition to our databases, you can tally sum up the article: line drawing characters. The Clipper also create your own reference and Quicksilver databases also provide databases with The Norton Guides In the beginning there was flat programming a hi BASIC, but complete reference on such topics as; reference database and it had a,b,c wrong with it. Trying to fix a,b,c gave us Pascal and Compiling, Linking, Debugging and Linker which is included in every procedures. But now we had d,e,f problems. Trying to fix d,e,f full reference to the Clipper Extend DBASE ~ package. Our well System including C interface written manual will take you through yielded modular programming, but with problems g,h,i. Fixing functions, Assembler macros and each step of the creation process. g,h,i yielded abstract data type programming, but with prob­ much much more. lems j,k,l. We fixed j,k,l with object oriented programming, but 60 Day Guarantee Free Upgrades now we have problems m,n,o, and we have no idea how to fix DBASED. "- these! The Reference System of Choice for DBASE Users. The article goes on to say much more, but the fact that it showed objects as part of a progression rather than being To Order, Call Toll Free: 1-800-622-6435 brought down off the mountain carved on stone tablets just

SofSolutions ~O Quentin Drive San Antonio, TX 78201 Continued on page 80

Trademarlls: Norton GuldeslPeter Norton Computing. dBASE III Plus IV/Ashton-Tate. CllpperlNantuckel, dBXL OulcksllverlWordtech Systems. FoxBASE+/Fox Software. On Une/SofSolutions Reader Service Number 108 6 MICRO CORNUCOPIA, #46, Mar-Apr 1989 From C To Shining C Greenleaf Has Tile Best l?eplltcltioll 711e Best fJroc/llcls

Over the last five years the name Greenleaf has Greenleaf SuperFunctions become synonymous with quality software. An advanced collection of functions for the experienced C programmer. Functions include expanded memory support, As a leader in the professional C programming _____.. extended mouse library market, we are recognized by the industry in functions, general, and our customers in particular, as the -,w--; advanced time premier supplier of quality products that consistantly • manipulations, r ~~~ unique date lead the industry in performance. b,,,w__ functions, DOS .. ~ critical error Our customers rate our products, support and '~"1 handler along with documentation EXCELLENT. It's a fact that almost , windows, menus 50% of our clients bought one or more of their , and keyboard Greenleaf products without ever considering the " functions. competition.

Greenleaf's dedication to the attainment of Greenleaf Business MathLib excellence is driven by our customers. They tell us The only product available that gives the programmer a what they need and want in order to perform their jobs complete set of math functions while providing the accuracy as professionally as possible. It is this partnership in of BCD math to the C language. Business functions such as excellence that has made Greenleaf the most compound interest, internal rate of return, cash flow analysis, bond calculations, amortization, array processing, statistics, respected provider of C language libraries in the trigonometry and print flexibilty make financial output a world. breeze. If you don't own a Greenleaf product, talk to one of Greenleaf Data Windows our users. We suspect that you will be a Greenleaf This easy to use and powerful windowing C library features owner soon. If you already own Greenleaf products overlaid logical windows, transaction data entry and three we thank you for your trust and support and we look styles of menus. Functionality such as context sensitive help, forward to our continued partnership. menus within data entry, keyboard idle, list boxes and ROM BIOS redirection. Pop-up, pull-down and Lotus style menus are also included. Greenleaf MakeForm Working in conjunction with DataWindows, MakeForm will reduce the time it takes to design and build a human interface. Forms stored in special files enable you to change them without recompiling your application. Cut and paste between multiple forms while using the fully supported editing features. GREEI\JLEAF Greenleaf Comm Library XMODEM, XMODEM CRC, RTS/CTS, and XON/XOFF protocols are all available on up to 17 ports with this interrupt driven, asynchronous communications library. Your programs can fly at up to 19,200 buad. G Greenleaf Functions Greenleaf Software Inc. The original. Still as popular and powerful as it was 5 years ago, Over 300 functions to support your programming Bent Tree Tower Two - Suite 570 efforts. DOS and BIOS calls, string color text, time, date, and 16479 Dallas Parkway graphics functions are just the beginning. Dallas, TX 75248 1-800-523-9830 Texas and Alaska: (214)248-2561 Telex: 559-068 Reader Service Number 146 The Art of Disassembly; Getting To The Source Of The Problem V\'hen The Object's The Data

, ~ -"~ it , 8" ;, .. "'- Disassembly is largely misunderstood. \ *, Many folks think it's some kind of reverse ~. '\ \ voodoo. Others think it's a nefarious sport , better left to hackers. But the reasons to dis­ "- " assemble are many: including silencing an '\:. irritating bell, or recreating source after a ~\;" " , hard disk crash. " ~

've divided this article into two parts. In the first I do a general disassembly Iof disassembly; in the second I use a disassembler called Sourcer.

What Is Disassembly? Disassembly is the process of taking machine code and translating it back into . The program that does this is called a disassembler. There is no requirement that the original code be written in assembly, but no matter what language was originally used, dis­ assembly will only produce the assembly translation of the machine code. An ex­ ample of a disassembler is DEBUG's un­ assemble command. The disassembler can translate numeric instructions into assembly mne­ monics, but not every byte or word in an .EXE or .COM file is an instruction. There are tables for data, embedded messages, and so on, so it's often up to a human to make the disassembler's output useful. A knowledgeable operator can greatly improve the quality of the final disas­ sembled code by making multiple passes, each time gleaning new information. This new information can be fed back to the disassembler to improve the quality of the next run.

Why Disassemble? Now the question, why on earth would anyone but a hacker want to dis­ assemble code? There are many reasons. First, to find out how the program works. To practice safe computing, you may want to check out any new pro-

8 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By B. H. Flusche, Jr. 3892 E. Geddes Ave. Littleton, CO 80122

grams to be sure they do not contain a must tell the disassembler the entry point virus. into the target program. The disassem­ Once you know how the program bler then starts translating instructions works, you can modify the program. I from that point until it encounters an un­ have a utility program called "browse" A conditional jump or a subroutine return. which allows me to view an ASCII file. It It then stops translating and stores the can move though the file one line at a knowledgeable beginning and ending addresses that de­ time, or one page at a time. fine this portion of the program as in­ However, to search for something, I operator can structions. must page a screen at a time until I find As the disassembler translates, it notes it. Tedious. So I disassembled the pro­ greatly improve the the destination addresses of all condi­ gram and added a string search feature. tional jumps and subroutine calls that it A third reason is to document a pro­ quality of the final encounters. It stores these addresses in a gram. Sometimes programmers produce table and uses them as new entry points only object code as their finished pro­ disassembled code into the program since it can be sure that duct. With a disassembler, the company these addresses are for instructions. can at least regain the assembly code. by making multiple The disassembler goes back and forth You can also reverse engineer a pro­ through the code until it has used up all gram. However, be very careful since passes, each time the destination addresses. Thus, it gener­ distributing the results would probably ates a map of the instructions. It assumes be illegal. gleaning new everything else is data. What this disassembler calls instruc­ How A Disassembler Works in·formation. tions, are usually instructions. However, There are two types of disassembler the rest isn't always data. Instructions programs. The first assumes that every will be missed if they aren't called by the byte or word it reads is an instruction. rest of the program. This works until the disassembler reaches There are two primary causes for un­ the first data area. The "unassemble" called code: command in DEBUG is a good example 1. Multiple external entry points to the of this kind of disassembler. Figure 1-DEBUG program. Figure 1 is a printout from DEBUG. Is Unassembly of Simple.com 2. Non-accessible code produced by this data, instructions, or both? compilers. The main disadvantage to this method 118B:0100 EB61 JMP 0163 The non-accessible code is not impor­ 118B:0102 90 NOP is that it requires a great deal of highly 118B:0103 OAOO OR CL, [OIl tant since it is never executed. However, skilled operator intervention. 118B:0105 48 DEC AX multiple entry points should be caught More sophisticated disassemblers also 118B:0106 65 DB 65 by the operator. 118B:0107 6C DB 6C assume the binary code is all instructions, 118B:0108 6C DB 6C The listing produced by the diSassem­ but they can later correct themselves and 118B:0109 6F DB 6F bler should be in a standard assembler 118B:010A 2C20 SUB AL,20 format. If not, you will have more diffi­ determine which addresses are data and 118B:010C 706C JO 017A which are instructions. But even these 118B:0101: 65 DB 65 culty reassembling the program after disassemblers will sometimes need help. 118B:010F 61 DB 61 modifications. A good disassembler will 118B:0110 7365 JNB 0177 Sourcer falls into this category and the 118B:0112 206561: AND [OI+61:] ,AB even add the assembler directives. intervention it requires is discussed in 118B:0115 7465 JZ 017C The disassembler has no knowledge detail later. 118B:0117 7220 JB 0139 of what the program does or how it does 118B:0119 796F JNS 018A 118B:011B 7572 JNZ 018F it. The listing will be labeled for the expli­ A Different Type Of Disassembler 118B:0110 206E61 AND [BP+61] ,CH citly called data and instruction locations, The second type of disassembler but they will have some sequential for­ /***/ makes no initial assumptions about data mat such as "loc_12" or "data_24" in­ or instructions. In this case the operator stead of intelligible names like

MICRO CORNUCOPIA, #46, Mar-Apr 1989 9 "geCrs232_inpuf' or "screen_offset." One of your major tasks is to work through the code, figure out what's hap­ • SEE HOW PROGRAMS WORK pening, and change the sequential labels • EASILY MODIFY PROGRAMS to meaningful ones, This process is com­ plicated if the disassembler mistakes data SOURCER'M creates detailed commented source code and listings from memory for instructions or vice versa. and executable files, Built in data analyzer and simulator resolves data across multiple segments and provides detailed comments on interrupts and subfunctions, Most of the commercial disassemblers 110 ports and much more, Determines necessary assembler directives for reassem­ ad vertise a feature called. commented. bly, Complete supportfor8088 through 80286, V20IV30, 8087, and 80287 instruction code where the disassembler automati­ sets, We welcome comparisons with any other product, because no product comes cally puts comments in the listing. This is close to the ease of use and output clarity of SOURCER. not really as useful as it seems. Remem­ On my list of programs that I simply won't do without! ber the disassembler does not understand -Robert Hummel, Senior Technical Editor, PC Magazine the target program. So its comments can

SAMPLE resetprn,lst ResetPRN vl.OI Sourcer Listing 19-Apr-88 4:05 pm Page I only tell you a bit about what is happen­ OUTPUT PAGE 50,132 ing, not why. Fully RESETPRN Created: 15-Apr-88 automatic Version: 1.01 Program il I header - OOOS data.le equ : (0040:000S-37Sh) :------seg.a ----- seg.a selllllOnt para publiC Assembler assume cs:seg.a, ds:seg.a, ss:stack.seg.b These three directives resetprn proc far 558E:0000 start: 658E:0000 EB 23 J"I' short loci goals, deciphering 658E:0002 52 55 73 65 74 50 db 'ResetPRN·vl.OI', ooh 658E:000S 52 4E 20 76 31 2E 658E :OOOE 30 31 00 Determines 658E:001l 0040 data 2 dw 40h 658E:0013 00 OA 52 65 73 65 data) db ooh, OM, 'Reset Printer? S' program logic, data areas 658E:0019 74 20 50 72 59 6E and type 658E:00IF 74 65 72 3F 20 24 658E:0025 658E:0025 OE push cs adding comments 658E:0026 IF pop ds Detailed 65SE:0027 ,BA 0013 dX,offset data 3 : (658E:0013-ooh) 658E: 002A .B4 09 IIIlV ah,9 • comments 658E:002C CO 21 Int 21h : 005 Services ah-functlon 09h : display char string at ds:dx and labels, and 658E:002E B4 01 IIIlV ah,l 658E:0030 CO 21 Int 21h : 005 Services ah-Iunctlon Olh . , get keybd char ai, with echo 658E:0032 3C 79 c"l' al,79h : 'y' ensunng accuracy 658E:0034 75 16 Jne loc 3 : Ju"l' If not equal 658E:0036 BE IE 0011 dS,aata 2 : (558E:001l-40h) 658E:00lA 88 16 OOOS IIIlV dx,ds:data Ie : (0040:000S-378h) Simulator 658E:003E S3 C2 02 add dX,2 • 658E:0041 BO 08 IIIlV ai,S are synergistic. As follows 658E: 0043 EE out dX,al : port 37M, pr I nter-2 contro I : al - 8, Inlttallze printer segment 658E:0044 B9 BOOO cX,BOOOh 658E:0047 you improve one, changes 658E:0047 E2 FE loop locloop 2 : Loop If cx • 0 658E:0049 BO OC IIIlV al,OCh· 658E: 004B EE out dX,al : port 37M, prlnter-2 control : al - OCh, Inlt I strobe off 65SE:004C it's easier to 658E :004C 84 4C IIIlV ah,4Ch : 'L' 658E:004E CO 21 Int 21h ; 005 Services ah-functlon 4Ch Easy to ; terminate with ai-return code resetprn endp improve the others. read seg.a ends format :------stack seg b ---- stack.seg.b segment para stack • • 6593:0000 OOCO[FFJ db 192 dup (OFFh) stack.seg.b ends end start For example, Sourcer will comment a LODSB instruction with ";string [si] to (Source code output and inline cross reference can also be selected) aI." This helps if you're an inexperienced. 8086 programmer who would otherwise • CHANGE AND ADD FEATURES have to look it up, but what you really BIOS SOURCE • CLARIFY INTERFACES I want to know is the purpose of the in­ for PS/2, AT, XT, PC, and Clones struction. In this case, it might be "; get byte from filename for parsing." The BIOS Pre-Processor'M with SOURCER provides the first means to obtain 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 How The Disassembly Process Works descriptive labels such as "video_mode" and much more, Fully automatic, Now that we have seen what a disas­ sembler does, and doesn't do, lefs look SOURCER $99,95 BIOS Pre· Processor· $49,95 SOURCER w/BIOS Pre-Processor $139 ,95 at the overall disassembly process, The USA Shipping & Handling $3; Outside USA $15; CA Residents add local sales tax 6, 6.5 or 7%; -requires SOURCER basic steps are: All our products come with a 30 day money back satisfaction guarantee, Not copy (1) Examine the machine code using protected, To order or receive additional information just call! DEBUG. 1-800-662-VCOM (2) Feed the machine code to the dis­ (1-800-662-8266) assembler. (3) Examine the disassembler's output. V COMMUNICATIONS (4) Determine new settings for the dis­ 3031 Tisch Way, Suite 905, Dept. M3, San Jose, CA 95128 (408) 296·4224 assembler. PS/2, AT, XT, and PC are Irademarks ollBM Corp. (5) GOTO step (2) until the listing is satisfactory. Reader Service Number 62

10 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Steps (2) and (5) are self-explanatory and step (4) is disassembler specific, so Figure 2 - Simple.com Object Code we will concentrate on steps (1) and (3). In step (1) you use DEBUG to dump 2EEO:Ol00 EB 61 90 OA 00 48 65 6C-6C 6F 2C 20 70 6C 65 61 . a ... Hello, plea 2EED:Oll0 73 65 20 65 6E 74 65 72-20 79 6F 75 72 20 6E 61 se enter your na the target code. This is to give you a 2EED:0120 60 65 3A 20 24 OA 00 57-65 6C 6C 2C 20 24 2C 20 me: $ .. Well, $, general idea which addresses contain 2EEO:0130 68 6F 77 20 64 6F 20 79-6F 75 20 6C 69 6B 65 20 how do you like data. Look for ASCll strings and initial­ 2EEO:0140 63 6F 60 70 75 74 65 72-73 3F OA 00 24 15 00 20 computers? . $ •• 2EEO:0150 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 ized data areas. 2EEO:0160 20 20 20 80 16. 03 01 B4-09 CD 21 BA 40 01 B4 OA ..••••. !.M .•. ASCll strings are readily recognizable 2EEO:0170 CD 21 BA 25 01 B4 09 CD-21 8A OE 4E 01 32 ED BE .! .!is •••• ! .. N.2 •• from the dump listing. Record their 2EED:0180 4F 01 B4 02 E3 07 AC 8A-00 CD 21 E2 F9 B4 09 BA O ••••••••• 1 ••••• 2EEO:0190 2E 01 CD 21 B8 08 4C CD-21 ... ! .. L.! beginning and ending addresses so that you can tell the disassembler that this is a 1***1 data area. (It will appreciate all the help you can give it.) By looking closely at the strings, you will be able to glean addi­ tional information. Figure 3 - Initial Definition File, and Listing If the strings end with a zero, they are ------Section 1 Control Information ------­ in the ASCIIZ form. This means the pro­ keep segments = def gram was probably compiled with a high Input filename = simple.com level language (for instance, C uses ------Section 2 Range Definitions ------ASCIIZ strings): If the strings end with a begin end default seg $, then the source was probably an as­ seg:off off ds es type sembly program. sega:Ol00 0102 sega sega code You will be able to recognize the ini­ sega:Ol03 0162 0000 0000 data tialized areas if you get large areas of the sega:0163 0198 sega sega auto same byte. In particular an area initial­ ------Section 3 Reference Definitions ------ized to zero is easy to notice. seg:off type options and label If you are not sure, use DEBUG to un­ sega:0103 da msg1 assemble the code. If you get the same sega:0125 da msg2 instruction 100 times, then it's probably sega:012e da msg3 data. Two in a row, well, they could be data or instructions. When in doubt, as­ sume instructions. simple. 1st Example disassembly Sourcer Listing vl.68 Page 1 Step (3), examining the disassembler's Editor's note: We've taken some small liberties with this listing output, is the hardest part of disas­ to make it fit on the page. Please excuse the line wraps. sembly. This is a job for an experienced = 014E 14Eh assembly programmer. The key to ; (OOOO:014E=O) successfully disassembling the target pro­ codeseg segment gram is to examine the listing, instruction assume cs:codaseg, ds:codeseg by instruction, to decipher the original program logic. org 100h

Deciphering The Listing simple proc far You must understand the target pro­ 81BF 0100 start: gram so that you can add labels and 81BF 0100 EB 61 jmp short loc 1 comments, and ensure the disassembled 81BF 0102 90 db 90h - 81BF 0103 OA msgl db OAb version is an accurate recreation of the 81BF 0104 00 48 65 6C 6C 6F db OOh, 'Hello, please original. The mechanics of deciphering enter your na' 81BF 010A 2C 20 70 6C 65 61 the listing vary, but I have found the fol­ 81BF 0110 73 65 20 65 6E 74 lowing effective: 81BF 0116 65 72 20 79 6F 75 1. Start at the beginning and follow 81BF 011C 72 20 6E 61 81BF 0120 60 65 3A 20 24 db 'me: $' the program flow. When you come to a 81BF 0125 OA msg2 db OAb conditional jump, try to figure out why 81BF 0126 00 57 65 6C 6C 2C db OOh, 'Well, $' the jump exists. Record the conditions 81BF 012C 20 24 81BF 012E 2C mag3 db , , , and take both branches. You may not ini­ 81BF 012F 20 68 6F 77 20 64 db ' how do you like tially know why the jump is there, but by computers?', OAb 81BF 0135 6F 20 79 6F 75 20 comparing the instructions following 81BF 013B 6C 69 6B 65 20 63 both branches you can figure it out. 81BF 0141 6F 60 70 75 74 65 2. When you get to a subroutine call, 81BF 0147 72 73 3F OA 81BF 014B 00 24 db OOh, '$' note the contents of the registers, then go 81BF 0140 15 00 db 15h, 0 to the subroutine code. Try to determine 81BF 014F 0014[20) db 20 dup (20h) 81BF 0163 loc_l: the purpose of the subroutine. Record 81BF 0163 80 16 0103 lea dx,msgl which registers it uses for input and which it uses to return values. continued on page 12 3. Don't try to get everything straight

MICRO CORNUCOPIA, #46, Mar-Apr 1989 11 the first time. Get as much as you feel Continued from page 11 you can, then rerun the disassembler with the new information. You will be (SlBF:0103=OAb) Load effective addr surprised at how much easier the second SlBF:0167 B4 09 mov ah,9 SlBF:0169 CD 21 int 21h examination will be since the new listing DOS Services ah=function 09h will have some descriptive labels. display char string at ds:dx Instead of trying to remember that SlBF:016B BA 014D mov dx,14Dh SlBF:016E B4 OA mov ah,OAb "sub_23" reads a sector and "sub_1S" SlBF:0170 CD 21 int 21h writes a sector, you will have changed DOS Services ah=function OAb the labels to "read_sector" and get keybd line, put at ds:dx SlBF:0172 BA 0125 mov dx,125h "write_sector." If you can make the dis­ SlBF:0175 B4 09 mov ah,9 assembler put comments in its listing, do SlBF:Ol77 CD 21 int 21h DOS Services ah=function 09h so. You want as much information as display char string at ds:dx possible on the listing. SlBF:0179 SA OE Ol4E mov cl,ds:data_1e 4. As you examine the listing, be sure (OOOO:Ol4E=O) SlBF:017D 32 ED xor ch,ch that the data is really data, and that the Zero register instructions are really instructions. SlBF:017F BE Ol4F mov si,l4Fh Ideally you could check this before the SlBF:01S2 B4 02 mov SlBF:01S4 E3 07 jcxz detail exam, but unfortunately the exam JUDq? if cx=O is the only real way to know. SlBF:01S6 locloop 2: SlBF:01S6 AC -lodsb These three goals, deciphering pro­ String (si] to al gram logic, adding comments and mne­ SlBF:01S7 SA DO mov dl,al monic labels, and ensuring accurate SlBF:01S9 CD 21 int 21h DOS Services ah=function 02h translation have a synergistic effect. As display char dl you improve one, it's easier to improve SlBF:01SB E2 F9 loop locloop 2 the others. Conversely you cannot Loop if cx > 0 - SlBF:01SD 10c_3: complete one until the others are nearly SlBF:01SD B4 09 mov ah,9 complete. Working on these three simul­ SlBF:01SF BA 012E mov dx,12Eh 81BF:0192 CD 21 int 21h taneously is the secret to disassembly. DOS Services ah=function 09h display char string at ds:dx Sourcer SlBF:0194 BS 4COS mov ax,4C08h SlBF:0197 CD 21 int 21h Now that we have thoroughly ex­ DOS Services ah=function 4Ch amined general disassembly, let's look at terminate with al=return code Sourcer. In the rest of this article, I'll ex­ simple endp plain how Sourcer works, how to use it, codeseg ends and some things about it not mentioned in the operators manual. If you haven't end start read Sourcer's user manual, the last sec­ /***/ tion may be hard to follow.

How Sourcer Works Sourcer is a multipass disassembler Figure 4 - Original Program Simple.asm where you set the number of passes from 2 to 5. On the first pass Sourcer assumes all the code in the target program is codeseg segment assume cs:codeseg, ds:codeseg made up of instructions. As it goes org 100h through the code, it stores the symbol start: jmp begin addresses for use in the next pass. It msg1: db OAb, ODh, 'Hello, please enter your name: $' maintains three symbol tables; one each msg2a: db OAb, ODh, 'Well, $' for data, locations, and subroutines. On msg2b: db " how do you like computers?', OAb, ODh, '$' name buf: db 21 the next pass it looks at the symbol tables - db o ibuffer for ,name input and makes sure the item referenced is db 20dup (") valid. begin: lea dx,msg1 iask for users name With each additional pass, Sourcer re­ mov ah,9 fines the symbol tables and its ability to int 21h mov dx, offset name buf iget name via string inp distinguish instructions from data. The mov ah,OAH - number of entries in each table may int 21h decrease as invalid entries are recognized mov dx, offset msg2a iwrite 1st part of response mov ah,9 and removed. On the last pass it writes int 21h the listing to disk. mov cl, byte ptr name buf + 1 iget char count to cl Sourcer works through the program xor ch,ch - ;count in cx mov si, offset name buf + 2 iget buffer addr sequentially. It does not take any jumps mov ah,2 - iset up for char disp or subroutine calls, and as it works jcxz done icheck for null string through the code it maintains a set of disp_char: lodsb iget char from buffer simulation registers which it tries to keep

12 MICRO CORNUCOPIA, #46, Mar-Apr 1989 mov dl,al ;mov to dl for service 2 int 21h loop disp char ;loop til all char displayed ah,9- NEW done: mov ;write rest of msg mov dx, offset msg2b int 21h mov ax,4C08h ;terminate process BLAISE int 21h codeseg ends end start TOOLS /***/ Thefastest way fJ) create -.. ,." •. ':_--- poweiful, progmms with 'IUrbo Pascal and'lUrbo C 2.0/ Figure 5 - Example of Range Overlap Blaise Computing, manufacturer of function libraries that offer Range Section fragment easy-to-use solutions to your pro­ gramming needs, introduces: sega:0100 0102 sega sega code sega:0100 0100 0000 0000 data Note overlap POWER TOOLS PLUS/5.0-$149 -completely in1egrated arullightning!ast routines tohelpyau: Listing fragment • Add moving bar pull-down menus and windows to your user 81BF:0100 start: interfaces;.iWW! • Generate context sensitive help screens;.iWW! • Add easy-to-use date and time conversion 81BF:0100 EB 61 short loc 1 routines; NEW! • Let users choose from window 90h - 81BF:0102 90 oriented pick lists; NEW! • Create and access "huge" 81BF:0100 EB 61 90 OEBh, 61h, 90h data structures; NEW! • Use multiple-line edit fields with fully 81BF:0103 OA OAb configurable edit keys;.iWW! • Speed up your sorting with flexible in-memory sort routines;.iWW! /***/ • Add EMS support; NEW! • Write TSRs and ISRs easily; • Control DOS memory allocation; • Create powerful programs in Thrbo Pascal 4.0 & 5.0! Thrbo C TOOLS/2.o-$149 -tighJ,fas4 highqualityjuncf:ian.y to helpyau: • Add easy-to-use mousesuppoliforwindows and menus;mf.7 updated. These registers are used in pro­ byte, word, dword, ASCII, or even a • Quickly include virtual windows and menus; NEW! ducing comments or finding the address structure. If you tell Sourcer that the data • Integrate your windows and menus with Thrbo CS text windows.NEW! • Create context-sensitive help screens; NEW! of jump tables. item is an offset, it will add the offset • Provide multiple-line edit fields with fully configurable ' Since Sourcer does not jump or loop, directive and target label. ' edit keys; NEW! • Use keyboard and video services (including enhallced keyboard and VGA);.iWW! the simulation register will be incorrect if Sometimes Sourcer will override your .WriteTSRsand ISRs easily; • Create powerful programs the program changes a register and then range definitions. This can happen if you : in.Turbo C.l~ 1..5.and 2.o! jumps to a previous location. miss a data area, and Sourcer er­ ~lVith tl\~le Pl'(HiU"If$l You control Sourcer via a command roneously translates the data as a jump to ¢Ode; com~ samlpleprogr.mlS,~ W!mpn~,i·,·t menu or a definition file. the area you defined as data. Sourcer will then believe the bogus jump and label Definition File the area (you previously defined as data) The definition file has three sections. as instructions. The first is for control information and duplicates all of the commands available Example Disassembly Using Sourcer from the menu. Let's look at an example disassembly Section two is for range definition and process using Sourcer. Figure 2 is a it specifies how Sourcer processes a DEBUG dump of the program range of bytes. "simple. com." This is the same code as in The third section is for reference defi­ Figure 1. Note the possible data areas. nition. It specifies how a particular Figure 3 is the define file derived from address is to be treated. Figure 3 has looking at the DEBUG dump and sample definition files. Sourcer's output based on that definition The range definition tells Sourcer file. Compare the disassembled listing to which portions of the target program are the original program in Figure 4. data, which are instructions, which are unknown, and which are ROM. Sourcer Sourcer Secrets And Tips will read these directions, and it will skip (1) Some of the definition file control the data areas during the first pass. This commands are sequence sensitive. For in­ prevents bogus labels from being entered stance, the "Header" command must be into the symbol tables. after the "Input filename" command or Reference definition allows finer con­ you'll get the default header. The "keep trol. You specify individual addresses segments" command must be before the and direct how Sourcer is to treat those ''Input filename" command. addresses. For data you can specify a (2) Sourcer will accept almost any Reader Service Number 5 MICRO CORNUCOPIA, #46, Mar-Apr 1989 13 string as a label, but it's a good bet your the DEF option. H your range definition assembler won't. H you plan on reassem­ contains only addresses outside the pro­ bling the code, save yourseH some pain gram's areas (such as the BIOS data later and use only labels acceptable to area), use the BOTH option. Sourcer will your assembler. process the code twice if your range defi­ (3) H the target program contains an nition covers the program's address !NT 20H, Sourcer does not recognize this space and you specify BOfH. as the end of the procedure and does not (10) Labels can be added to the disas­ put the required "endp" directive into sembly listing at will. However you the listing. should restrict their use so that they are (4) Sourcer has a number of built-in present only when they are the target of labels which it uses when it feels the an instruction. For instance, if you add need. They include: "copywrt" for a extraneous labels to instructions, it will copyright statement, "start" for the pro­ be unclear which labels are decorations gram's entry point, "int_XXh_ext" for ex­ and which are the destinations of jumps ternal interrupt entries, and "strategy" and calls. Unfortunately Sourcer requires and "interrupt" for device drivers. You you to specify a label in order to add a have no control over these labels. comment. I recommend you use a You Don't Have To Be (5) H you use the "repeat" option to sequential label notation so that each A Programmer To Be define a data area and you miscount the label is unique and is distinguished from number to be repeated, Sourcer will add functional labels. An Expert bogus bytes as needed. This can rear its (11) H Sourcer's analyzer makes a mis­ ugly head if you have defined ASCII text take and translates data as instructions, and it contains a copyright. The built-in these bogus instructions can cause TINY EINSTEIN 2.0 copywrt label will be applied, and your trouble farther down the line. Any The Expert System Shell repeat count will be wrong. addresses the bogus instructions refer­ (6) When you define segments via the ence as data will be marked as data, even • Create expert systems and range definition section, you must expli­ if they are really instructions. Bogus citly specify the last byte's address. There dynamic databases in jumps or calls will mark the destinations is no end of code operator. The best way as instructions and these second genera­ minutes to find the address of the last byte is to tion bogus instructions can cause addi­ • With pulldown menus and load the program with Sourcer then note tional trouble. H you find that Sourcer windows the last address as shown on the main made a mistake, don't just fix the part • Context-sensitive online menu. Since Sourcer will process all the you found, backtrack until you find the help addresses you specify, it will stop where root cause. The cause will always be you told it regardless of the length of the bogus instructions. • Free example expert program. (12) The more passes you specify, the systems (7) The addresses in the range defini- . better the analyzer can separate data • Tutorial tion section should be contiguous. H from instructions. Five passes will pro­ there is a gap, Sourcer will skip over the duce the best resolution, and you can use • Interactive full-screen text gapped code and generate an org state­ the cross reference option. By using cross editor ment. This ensures the subsequent references, you can backtrack to the • DOS access from shell addresses are in their proper place, but source error. the gapped code is removed. Sometimes a label will not have a • Turbo Fast execution (8) H two range definitions overlap, cross reference. This indicates the label • For Diagnosing ... Sourcer will process the overlapped code was created by a bogus instruction that Simulating .. . twice. H the first range is a data defini­ the analyzer has converted back to data. Predicting .. . tion, and the second is code definition, You can find the cause by reducing the Classifying .. . Sourcer will output both the data and number of passes and then using the Training ... code. Figure 5 illustrates this. range definition to fix the problem. Monitoring ... (9) The "keep segments" command is and Organizing systems. not explained well. It tells Sourcer which Sourcer of two sets of range definition to use. The V Communications first is internal to Sourcer and is created 3031 Tisch Way Suite 905 Only $99.95! (Plus $5 8tH) as Sourcer processes the binary code. The San Jose, CA 95128 Demo $10.00 • The AI Newsletter $1 second is the one you write in the defini­ (408) 296-4224 tion file and is optional. The ''keep seg­ ments" command tells Sourcer to use either: its internal definition (FILE), the one from the definition file (DEF), or to ••• use both (BOTH). H you haven't written a range defini­ ACQUIRED INTELLIGENCE tion, use the default FILE option. H you P.o. BOX 2091 • DAVIS, CA 95617 • (916) 753-4704 have written a range definition that in­ cludes the target program's address, use Reader Service Number·72 14 MICRO CORNUCOPIA, #46, Mar-Apr 1989 8280 Clairemont Mesa Blvd., Suite 117 San Diego, California 92111 ERAC co. . 619 569-1864 AT BABY AT XT/TURBO NiCds Motherboard 6 & 10 Meg Motherboard 6 & 10 Meg Motherboard AA Cells .6ah ...... $1.00 Zero Wait State Zero Wait State 5 & 8 MHz Switchable 12V Pack AA Cells .6ah ...... 6.50 8 Expansion Slots 8 Expansion Slots 8088 - V20 Optional Sub·C Cells 1.5ah ...... 1.50 640K RAM On·Board 80286 Processor Optional Co·processor 12V Pack Sub·C ...... 10.00 Math Co·processor Option Math Co·Processor Option 8 Expansion Slots Double D Cell 2.5V 4ah unused ... 8.00 Phoenix Bios 640K RAM On·Board ERSO or Bison Bios C Cells ...... 1.75 200 Watt Power Supply Phoenix Bios 640K RAM F Cells ...... 2.50 Hercules Compat. Video Bd. 200 Watt Power Supply 150 Watt Power Supply Parallel Port Hercules Compat. Video Bd. Hercules Compat. Video Bd. 2 Serial Ports Active Parallel Port Parallel Port GEL CELLS Game Port 2 Serial Ports Active 2 Serial Ports Active 12V 20ah ...... $25.00 ClOck/Calendar Game Port Game Port 12V 15ah ...... 15.00 Hard Disk &Floppy Controller Clock/Calendar Clock/Calendar 12V 2.5ah ...... 8.50 20M Hard Drive Hard Disk &Floppy Controller Hard Disk and D Cell 2.5ah ...... 2.00 1.2M 5114" Floppy Drive 20M Hard Drive Floppy Controller 360K 5%" Floppy Drive 1.2M 5%" Floppy Drive 20M 51/4 "Hard Drive ROBOTICS 5061 Keyboard 360K 5%" Floppy Drive 2 ea. 360K 5%" Floppy Drive 5V DC Gear Motorwith Tach 1"x2" . 7.50 Case with Turbo & Reset, 5061 Keyboard AT Style Keyboard Hard Drive Light and Mini AT Case with Turbo & Standard Slide Case Joystick, 4 switches, 1" knob ...... 5.00 Keyboard Disable Switch Reset, Hard Drive Light and Amber Graphics Monitor Z80 Controller with 8-Bit AID . .... 15.00 Amber Graphics Monitor Keyboard Disable Switch Brushless 12VDC 3" Fan ...... 7.50 Amber Graphics Monitor * * Capacitor, .47farad 10V 1"x1 3/.t" ... 4.00 $1581 $999 Solar Cells .5V .5A, .8"x1.6" ...... 2.50 EGA ADD $449 $1531 EGA ADD $429 High Voltage Power Supply 40M HD ADD $150 EGA ADD $449 40M HD ADD $150 Input: 15-30V DC 6 & 12 MHz ADD $73 40M HD ADD $150 5 & 10 MHz ADD $21 Output: 100V 400V 16KV ...... 6.50 EQUIPMENT BARGAINS 9" Green Monitor ...... $50 IC'S * NEW * 9" Amber CRT .$45 Keyboard. 75 81-189 Video Pal ...... $15.00 CPM COMPUTERS PRO-8 Mod. to your board ..... 149 81-194 RAM Pal ...... 15.00 K4-83 ...... $350 Host Interface Board ...... 15 81-Series Char. Gen. ROMs .. 10.00 K2-84 ...... 400 Replacement Power Supply .... 50 81-Series Monitor ROMs ..... 10.00 K4-84 ...... 425

ELGAR UNINTERRUPTIBLE CPU & SUPPORT CHIPS SWITCHERS POWER SUPPLIES MC68000-8 CPU ...... $8.00 5V/9.5A, 12V/3.8A,-12V/.8A ...... $39.00 560 Watt MODEL IPS560 $650 Z80 CPU ...... 75 5V/3A, 12V/2A, -12V/.4A ...... 19.50 Sinewave, 560W complete w/batteries. Z80A CPU ...... 1.50 5V/6A, 12V/2A,-12V/1A ...... 29.00 5V/6A, 24V/1 %A, 12V/.6A, -12V/.6A ... 29.00 400 Watt MODEL SPR401 $149 Z80 CTC ...... 1.50 Supplies may have minor cosmetic Z80A PIO ...... 2.00 5V/10A ...... 19.00 damage, but are electrically sound. Z80A 510 ...... 5.00 5V/20A ...... 24.00 Squarewave output. Run on internal or 8088 ...... 6.50 5V/30A ...... 39.00 external 24VDC battery when line goes 8089-3 ...... 6.50 5V 100A ...... 100.00 down. Typical transfer time = 12MS. 5V 120A ...... 110.00 Battery supplied, not guaranteed. D8284A ...... 2.50 SIP DRAM 256-12 ...... 7.00 NEW 24V INTERNAL BATTERY $75 4164-10 .: ...... 2.50 TEST EQUIPMENT 4164-12 ...... 2.10 OSCILLOSCOPES POWER SUPPLIES 1793 ...... 6.00 TEK 7403N/7A18N/7B50A 60 MHz .$650 1797 ...... 7.00 TEK 465 Dual Trace 100 MHz ..... 1000 0-8VDC 100A Metered ...... $249.00 ANALYZERS Volt & Current Regulated 6845 ...... 5.00 VC3524 SWitching Regulators ..... 5.00 TEK 491 10MHz· 40 GHz ...... $4500 5V/1A. -5V/.2A, 12V/1A, Nicolet 500A 1 Hz 0-100 KHz ..... 1800 -12V/.2A, -24V/.05A ...... 9.90 1458 Dual Op·AMP ...... 70 LM2877P 4W Stereo Amp Dual ..... 2.50 Biomation 805 Waveform Rcrdr .... 259 MB81464-15 ...... 2.75 Biomation 8100 2-Channel Waveform Recorder ...... 795 HOURS: Mon.· Fri. 9·6 - Sat. 10·4 2716 ...... 3.00 MINIMUM ORDER - $15.00 HP1600A Logic Analyzer ...... 600 2732 ...... 3.25 HP1600A/1607A Logic Anlyzr ..... 1000 TERMS: VISA. MasterCard. Certified 2764 ...... 3.50 FREQUENCY COUNTER Checks. Money Order. NO COD. Visa 27C128-1 ...... 9.00 Optronics 550 MHz ...... $100 and MasterCard add3%. Personal 74HCOO ...... 38 checks must clear BEFORE we ship. 74LS125 ...... 30 Include shipping charges. California 74LS373 ...... 50 DBASE BOOK OF BUSINESS 1 APPLICATIONS by Michael J. Clifford residents add 6 /2 % Sales Tax. For 74LS174 ...... 30 more information please call. Reg. $19.95 NOW ONLY $3.00

Reader Service Number 93 MICRO CORNUCOPIA, lt46, Mar-Apr 1989 15 Handling Interrupts With Any C A Detailed Look At Supporting Interrupts

CALL_80860. (See Figure 1.) They're ter pairs and the PSW flags. Each regis­ Micro C is famous for cramming lots of written in a mix of assembly level ter / flag name expands into the notation useful information into very little space. spaghetti and C. The third function, required to get at it in a __regs struc­ This article may be too long to qualify as IN1N_80860, and fourth, regs_dump, I'll ture. "little space" but it's so crammed with in­ describe shortly. An almost identical list follows, only formation on implementing interrupt serv­ this time the names expand into a refer­ ice routines (ISRs) that you've got to read #include ence to an object within the __regs on. (Find a spot where you won't be inter­ struct _REGS. Nothing called _REGS is rupted.) This is a great one, folks. unsigned int far call_8086( ri, ro ) declared in the header, so you'll have to __regs far *ri, *ro; declare a structure or macro by that name before using any of the macros. ne idea which added to unsigned int far intn_8086( ri, ro ) The point of the second list is to elimi­ Turbo C really bowled me over __regs far *ri, *ro; nate completely all structure/union nota­ Owhen I first saw it. It's their "in­ tions so you can work directly with the terrupt" type modifier! Hooray for Bor­ unsigned int far seg86( r ) desired registers, register pairs and CPU land, but not everyone uses Turbo when __regs far *r; status flags. working in C. The last group of #defines expands I found another simple but impressive void __regs_dump ( r ) into function calls. ca1l86(pc) does a far idea hiding in a listing for a low level __regs far *r: call to the function at void (far *pc) 0, driver. (I don't remember where I saw int86(i) does a software interrupt to inter­ the listing.) The listing contained assign­ ri and ro are pointers to _ Jegs struc­ rupt i, and pcdos(f) loads the DOS func­ ments to CPU registers! What incredibly tures; *ri contains the register values tion number f into AH, then calls DOS. nice code to read - no structure refer­ passed and *ro contains the values re­ Each macro expects to use the _REGS ences full of obscure object names. Very turned. structure for both the "input" and "out­ neat! calC80860 does a far call to the far put" registers. I decided to combine these two ideas function at location ri->CS:IP. intn_80860 into support headers and library func­ assumes that the desired interrupt num­ ISRHs tions. The CPU registers were easy. A ber is in ri->IP, and does a software inter­ When an ordinary C function gets long list of #defines did most of the job. rupt to that handler. Both functions re­ called, it expects the proper values in the Adding support for high level interrupt turn the result in the PSW register. segment registers, expects parameters on handlers wasn't too tricky either, and it's seg860 copies the DS, ES, CS, SS and the stack, and expects the stack to be big turning out to be more useful than I ex­ PSW register values into the enough for automatic storage. pected. corresponding objects in the _ _regs An ISR Handler can't expect anything. In this article, I'll describe two main struct at *r. __regs_dumpO displays the To get a C function to handle an inter­ modules, each module a group of func­ contents of the _ _regs structure *r on rupt, you'll need to add some support tions. The first group supports existing STDOUT. code between the interrupt and the func­ system interrupt and far call functions. The _ _regs structure is typedefed in tion call (and before the return-from-in­ The second group contains support the CALL.H header (see Figure 2). It's a terrupt). routines to allow standard C functions to complicated structure full of unions of I figured the easiest solution would be service interrupt requests or be called by structures of pointers and unsigned chars to write a "straight" version of the sup­ external programs. and ints, representing the CPU registers. port code, then have another routine Everything was written to be com­ The main difference between this struc­ copy it into a data, structure for each ISR piled with Manx Aztec C 86, version ture and the ones included with most handler. The file ISRHT.C contains this 4.10a. Other compilers might run into 8086 compilers is the organization of the "isr handler template." (See Figure 3.) minor problems handling the assembly registers. You can directly access some of The ISRH data structure contains space code, but it shouldn't be anything seri­ the more commonly used register pairs: for the code, and variables are positioned ous. ES:BX, DS:DX and DX:AX. I also used bit so you can modify the code. fields to fully define the PSW (Processor This way, the function isr_installO can CALLs&INTs Status Word). install a C function as an interrupt han­ The functions in this group are super You'll see the list of #defines follow­ dler, then iscrestoreO can put the pre­ simple. They do software interrupts and ing the structure definition in CALL.H. vious vector back into the interrupt table far calls. The work is done by two func­ The list names each CPU register, its when the program's done. It's that tions in the CALL.C module, SEG86 and lower and upper halves, plus some regis- simple!

16 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By Sam Azer 1405 Bishop St Suite 100 Montreal, PQ Canada H3G 2E5

The file ISRH contains the typedef for Figure 1 - CALL.C far calls and software interrupts from C the ISRH data structure, the prototypes for the functions in ISRC, and some sup­ #include port macros (see Figures 4 and 5). ISRC contains all the support routines. The /* SEG86 listings are reasonably straightforward, This function copies the 8086 segment register contents so I'll try to be brief here. into the __regs register structure pOinted at by rio */ The ISR functions are:

#praqma vpindex seg86 #include unsigned int far seg86( ri regs far *ri; {- void far *isr_get_vector( inum ) #asm int inum push es push es les bx, _RI void isr_set_vector( inum, farfuncp ) pop ax void far (*farfuncp) ()i mov _ES, ax mov _OS, ds int inum; mov _55, ss mov _CS, cs void isr_install( isr, inum, handler) pushf pop ax isrh *isr; mov _PSW, ax int inum; pop es #endasm void far (*handler) (); } void isr_restore( isr ) /* isrh *isr; This function calls the code at PC in *ri. It doesn't check for messed up stacks, but is reentrant. */ isr~et_vectorO returns the vector for interrupt inum from the 8086 interrupt #praqma vpindex call_8086 unsigned int far call 8086( ri, ro ) vector table. isr_set_vectorO puts the vec­ regs far *ri, *ro;- tor farfuncp into the table. {- isr_installO copies· the ''handler tem­ #asm push si ;save C regs plate" code into the isrh structure "isr. It push di then modifies the code in that structure. push ds The far function "handler is installed as push es the function that will handle the inter­ les bx, _RI ;get pointer to input regs rupt. The vector for interrupt inurn is push bp ;we're going to need this later ... saved in isr->prev_hndlr. If that vector is NULL, "isr will do an push cs ;here's where the routine that we'll call lRET when "handler returns; otherwise, mov ax, offset retadr push ax ;will return "isr jumps to "isr->prev_hndlr on return from "handler. The last thing isr_installO push _CS iput address to call on the stack does is point the CPU's interrupt vector push _IP to interrupt inum at "isr; at which point do_it: push _ES ;can't touch these now ... "handler will be called if an interrupt oc­ push _BX so put them on the stack curs.

%:lOV ax, _AX ;load up the cpu regs isr_restoreO restores isr->prev_hndlr mov cx, _cx to the interrupt vector table. mov dx, _OX mov si, _51 The template code does the following: mov di, _01 Stacks the CPU registers. • Loads the correct data segment mov bp, _BP mov ds, _OS Continued on page 19 value into the DS and ES regis­ pop bx ters. (You'll have to check your start-up routine to find out what

MICRO CORNUCOPIA, #46, Mar-Apr 1989 17 Programmers, Analysts, Expert Systems Developers: Interactively Develop Perfect Complete Logic, Generate Bug-Free C, BASIC, Pascal, or dBASE Source ASwrzOW !!~~~o~ Prototype, test logic, generate code and English AT LAST! documentation automatically with Logic Gem ™ YOU CAN STEP BACK AND TAKE Logic Processor and Code Generator ALOOK AT YOUR CODE Logic Gem is the first programmer's tool that helps you develop the logic portion of any computer program. It FLOW CHART AND ANAL VZE includes 3 components: YOUR ASSEMBLY LANGUAGE SOURCE CODE • The Logic Editor helps you create a graphical decision table - and completes it for you, generating a • Flow Charts mechanically perfect set of decision rules while • Tree Diagrams eliminating redundancy and optimizing logic. • Stack Sizing • The Logic Interpreter steps you through the logic to • Register Analysis verify or demo on the fly - great for prototyping and • CPU Timing Analysis testing, avoiding multiple edit/compile/execute cycles. • Procedural X-Reference • The Logic Compiler translates your decision table into • 8088/87 to 80386/387 cur'!~;:;;~~· error-free source in C, Structured or Interpretive BASIC, • Context-Sensitive Help editor_warning • Menu/Batch/Command save screen Pascal, FORTRAN, dBASE - even English, for display-warning automatic documentation! line Operation Erestore screen • MASM 5.1 Compatible editor_warning insert blank line ORDER TODAY! 800-722-7853 _____IIIIIIIIIII!!!IIil'l$1l'+R"<'lil.tmmm:; adjust)ne - only join_line Logic Gem: $198.00 QUANTUM SOFTWARE editor_warning * with a 90-day money-back guarantee! adjusUine 10055 Stevens Creek BMj, &.ita 154 delete_ediUine STERLING CASTLE Q.pertiro, CA 90014 ~ editor line out 702 Washington St., Suite 174, Marina del Rey, CA 90292 213-306-3020 (400) 244£826-Free Derro ediUine_oUt - Inside CA: 800-323-6406 Outside CA: 800-722-7853 FAX: 213-821-8122 VISA • Me 30 - Day Money Back Guarantee

Reader Service Number 141 Reader Service Number 139

values you need in OS and ES.) the stack used by the C handler function, clear the caller's Carry flag to indicate • Stacks a far pointer to the ISRH you can access anything that's on that that you want your program to continue data structure (Le., this routine.) stack as a parameter. A handler would executing, or set the carry flag to indicate • Does a CALL FAR to your C han­ therefore be declared like this: that you'd like to crash. An !NT 0x23 dler function. handler to ignore Ctrl-Break interrupts .• On return, pops the far pointer to void far handler( *isr, bx, es, ex, would be set up like the following: the ISRH structure off the stack, ax, dx, ds, di, si, bp, ip, es, discarding it. psw ) main() • Restores the CPU registers. isrh far *isr; • If your C handler used the unsigned int bx, es, ex, ax, dx, void far int_23(); isr_iretO macro before returning, ds, di, si, bp, ip, es, psw; isrh isr_23; then an IRET instruction is ex­ {} ecuted here. If it used the isr_install(&isr_23,Ox23,int_23); isr_passO macro, or neither of the Or, if your compiler supports passing /* your program */ two macros, the default procedure structures by value (most do) isr_restore( &isr_23 ); at this point is to jump to the pre­ viously installed handler; or in the void far handler( *isr, _REGS) absence of one, to execute an isrh far *isr; void far int_23( isr, _REGS) lRET. isr_regs _REGS; isrh far *isr; The isr_retfO macro can also be used {} isr_regs _REGS; by functions that are called by external { programs; it causes the handler to ex­ Again, CS:IP and PSW were pushed _CARRY = 0; ecute a far return. This can be handy, for by the CPU prior to calling *isrh, which isr_iret(isr); example, when writing handlers for stacks isr and BX through BP, then calls mouse driver interrupts. The mouse handlerO. On return from handler, *isr driver will intercept the interrupt, then pops BP through BX and isr. CS:IP and As you can imagine, if a program do a far call to the user's handler. PSW get popped off when an lRET is ex­ puts other stuff onto the stack before ecuted. generating a software interrupt, your Using The ISR Functions If, for example, you install an !NT handler would have access to that, too. Since the CPU registers are pushed on Ox23 Ctrl-Break exit handler, it can either An !NT Ox24 Critical-Error handler

18 MICRO CORNUCOPIA, #46, Mar-Apr 1989

_ .. _------_..• _------· would have a parameter list like this: (isr, r1, r2). r1 was pushed by OOS before it Continued from page 17 issued the INT 0x24. r2 was pushed by DOS when it received control from your pop es program. To force 005 to retry the operation, you'd have to set r1.AX to 1, ret ido the call then do an IRET (return after an retadr: iwhen the routine does a retf, we get isr_iret(isr». here ... push bp isave the current bp A couple of side notes: See the IBM mov bp, sp imake it possible to get values off the Disk Technical Refer­ stack ence, chapter 5, if you need more info on mov bp, 2 [bp] iget value of BP that we had before the call the Critical Error handler (and others). The isr pointer is passed by the tem­ push es isave the current value of ES plate code to allow the interrupt handler push bx and BX to identify the source of the interrupt. I les bx, _RO iget pointer to output register structure did that to allow a general handler to in­ mov _AX., ax isave the current value of AX. tercept and identify illegal interrupts. If pop ax iget the returned value of BX you find you need the stack space, or mov _BX, ax i and save it too aren't suffering from spurious interrupts, pop ax iget ES mov ES, ax isave that .. . you can get rid of it by deleting the as­ mov -ex, cx iand this .. . sociated code in the template, in isr_in­ mov :DX, dx mov DS, ds stallO and in the ISRH structure defini­ mov :SI, si tion in the ISRH header. (Spurious inter­ mov _DI, di rupts aren't a problem most of the time.) pop ax ithen the BP that we last pushed mov _BP, ax pop ax iget rid of BP that we pushed before that The Listings pushf iand last but not least, save the flags ... CPU.H contains CPU related con­ pop ax mov _PSW, ax stants and the definition of the _ _flags structure. REGSDUMP.C contains the en­ pop es irestore C regs pop ds tire __regs_dumpO routine, which is pop di kept separate to ensure that it's only pop si linked in if it's used (see Figures 6 and 7). ftendasm } At the end of ISRC is a test routine that gets compiled if MAIN is #defined. As you can see, it installs handlers for the This function calls the interrupt handler pointed at by keyboard, timer and CTRL-BREAK inter­ element (IP) in the 8086 interrupt vector table. rupts. Essentially, it displays the last scan */ code received from the keyboard, and the ftpragma vpindex intn_8086 elapsed time since the program started. unsigned int far intn 8086( ri, ro ) It's not very easy to break out of since it T-regs far *ri, *roi- traps all attempts from the keyboard, and ftasm tells OOS to ignore anything that might push si isave C regs push di come down a COM line if the console is push ds redirected. push es Two other files, CALLER.C and CAL­ LERH, contain improved versions of push bp iwe're going to need this later ... code originally written as part of a big les bx, _RI iget pointer to input regs project two years ago (see Figures 8 and pushf i simulate an INT nn 9). They served as the prototypes for push cs ihere's where the routine that we'll call CALL.C and CALL.H. They're based on mov ax, offset retadr a routine, callerO, that's faster, smaller push ax iwill return and uses less stack space than the new mov ax, IP iinterrupt number is hidden in _IP ... functions. It also saves and restores SS:SP shl ax, '1 shl ax, 1 to recover from routines that don't be­ cwd have properly. moves, dx I didn't bother to discuss it here be­ mov bx, ax push es:word ptr 2[bx] iput address to call on the stack cause it's not ROMabie or reentrant For push es:word ptr O[bx] some applications, though, callerO would do just fine, so those two files are in­ les bx,_RI irestore the es:bx pointer to RI jmp dO_it iuse the code in call_8086 ... - cluded with the others in the file ftendasm !SRARe. Look for it on the Micro C BBS } or the Issue #46 disk. /***/ ISRHNotes The main thing to bear in mind when

MICRO CORNUCOPIA, #46, Mar-Apr1989 19 The Complete Diagnostics Solution for Your PC/XT, PC/AT, or Compatible

INCLUDES ... PC/XT System Diagnostic Software $ 29 DRIVE TESTS-Complete diagnostics for Hard and Floppy PC/XT Disk Diagnostics (w/ test diskettes) $ 29 drives, including controller cards. Tests read, write, and format PC/XT 110 Loopback Test Plugs $ 19 capability as well as seek timings, hysteresis and rotation COMPLETE PC/XT DIAGNOSTICS SET (save $28) $ 49 timings. PC/ AT System Diagnostic Software $ 29 I/O PORTS-For both parallel and serial ports, confirms internal PC/AT Disk Diagnostics (w/ test diskettes) $ 29 and external loopback capabilities at all baud rates and PC/ AT I/O Loopback Test Plugs $ 19 configurations. COMPLETE PC/AT DIAGNOSTICS SET (save $28) $ 49 MEMORY-Performs over eight different tests to check standard extended, and expanded memory. BOTH PC/XT and PC/AT SETS (save $75) $ 79 KEYBOARD-Verifies that all keys send correct key codes, Capital Software presents the definitive disk-based diagnostics including shift, CNTL and ALT modes. package for the IBM PC AT and XT. Atechnical tool detailed CPU. NUMERIC COPROCESSOR-Verifies that all single and enough for the repair technician. A friendly interface that multiple instructions perform correctly and accurately, as well places problem-solving skills in the hands of the end user. as testing all internal registers. An uncompromising solution. VIDEO DISPLAY-Checks video controller cards. Confirms attributes, graphics, colors (if applicable), and CRT alignment SEND CHECK OR MONEY ORDER TO USE YOUR VISA OR MASTERCARD patterns. CAPITAl SOFTWARE CAlL TOLL FREE (800) 541-0898 REAL TIME CLOCK-Verifies correct timing, all internal 951-2 OLD COUNTY ROAD SUITE 224 BELMONT, CAlIFORNIA 94002 registers, and battery backed-up RAM. FOR INFORMATION CAlL: .Nand many more features to Insure the Integrity of your computer. (415) 592-9076

Figure 2 - CALL.H unsigned char far *p; unsigned long 1; } __regdp; /* CALL.h - header to allow low level routines to look like they work directly with CPU registers typedef union REGPSW and do call flints "naturally!" Works with the flags bit;­ functions in CALL.C/ISR.* Unsigned int w; *1 } __regpsw;

#ifndef OP RETF typedef union REG3R #include struct { - - #andU reg ax, dx; unsigned int ds; /* These typedefs describe the types of structures } rl; that are found in the final register structure at struct { the end. reg ax; These aren't intended to be used by humans ... :: ::regdp dsdx; */ } r2; struct { typedef union REG { regdp dxax; struct { - - unsigned int ds; unSigned char 1, h; } r3; } b; } __reg3r; unsigned int X; __reg; 1* This is the main register file structure. The typedef union PCREG interrupt handlers all push and pop registers in this void far (*x)(,>; order, and the functions in CALL.C work with this struct { "register file" organization. Note that the stack unsigned int 1, h; pointer isn't actually used. That object was included } W; in the structure for "completeness" andlor "future } _ Jlcreg; expansion," etc. *1 typedef union REGDP struct { - - typedef struct REGS __reg r; __regdp esbx; - unsigned int S; reg c; } i; :: ::reg3r dsdxax;

20 MICRO CORNUCOPIA, #46, Mar-Apr 1989 writing an ISRH is that your function will be using whatever's left of the stack Continued from page 20 frame that the interrupted code was using (i.e., don't expect to have any stack unsigned int di; 'define _REGSP ( C _regs far space available). Better still, don't use au­ __regdp bpsi; *), CREGS» tomatic storage at all - if possible, de­ _ ycreg pc; clare your local variables as static. regpsw psw; 'define _AX CREGS.AX) : :regdp stk; ,define _AS CREGS.AS) Make sure that your handler isn't __regs; 'define _AL CREGS.AL) being interrupted, then called reentrantly. /* These macros are provided to 'define _BX CREGS.BX) If that's going to happen, be careful make it easier to access 'define _BH CREGS.BH) about how you use static locals; they objects in the above structure. 'define _BL CREGS.BL) might get wiped out by the reentrant call. Use either p->AX or s.AX as appropriate to keep the code ,define _CX CREGS.CX) You might also have to implement some from looking too silly ... 'define _CH CREGS.CH) form of mutual exclusion lock, or modify */ 'define _CL CREGS.CL) the template code to use an array of stack 'define AX dsdxax. rl . ax. x 'define _DX CREGS.DX) frames. 'define AS dsdxax.rl.ax.b.h 'define _DH CREGS.DH) Often, you can avoid these hassles by 'define AL dsdxax.rl.ax.b.l 'define _DL CREGS.DL) keeping a handler short and sweet. Let it 'define BX esbx.i.r.x ldefine _SI CREGS.5I) collect whatever information the main 'define BH esbx.i.r.b.h 'define _DI CREGS.DI) program might need, execute a proce­ 'define BL esbx.i.r.b.l 'define _BP CREGS.BP) dure, or whatever; but keep it simple, 'define CX c.x 'define _DS CREGS.DS) and get out fast! ldefine CH c.b.h ,define _ES CREGS.ES) Remember that the compiler makes Idefine CL c.b.l 'define BPSI (,YEGS.BPSI) assumptions about the structure of the 'define DX dsdxax.rl.dx.x 'define :DXAX CREGS.DXAX) memory spaces that it works with. In Idefine DH dsdxax.rl.dx.b.h 'define _DSDX CREGS.DSDX) ,define DL dsdxax.rl.dx.b.l particular, it may assume that your stack ,define _ESBX CREGS.ESBX) frame is in its data segment (especially in Idefine DI di ,define _PSW CREGS.PSW) the small data models), so it's wise to be 'define 51 bpsi.i.r.x 'define _PC CREGS.PC) careful about pointers while servicing an Ide fine BP bpsi.i.s Ide fine IP CREGS.IP) interrupt. If you've got a bug somewhere Idefine :CS CREGS.CS) 'define DS dsdxax.rl.ds and don't see any problem with your Idefine ES esbx.i.s 'define STKPTR CREGS. STKPTR) source, check the assembly level output Idefine -SS CREGS.SS) from the compiler. Make sure that the 'define BPSI bpsi.p 'define :SP CREGS.SP) ldefine DXAX dsdxax. r3 . dxax.l proper segment values are used in Ide fine DSDX dsdxax.r2.dsdx.p ,define _OF CREGS.OF) pointer operations. 'define ESBX esbx.p 'define _DIR CREGS . DIR) Not all ISRHs are going to be tricky, 'define _INTE CREGS. lUTE) 'define PSW psw.w 'define TRAP C REGS. TRAP) but many will. In most cases, it won't be ,define -SIGN CREGS. SIGN) possible to run them through a debugger, 'define PC pc.x Idefine -ZERO C REGS. ZERO) and library functions like printf(} won't 'define CS pc.w.h ,define :AUXC CREGS. AUXC) 'define IP pc.w.l 'define PE CREGS.PE) work from within them. On the other 'define :CARRY CREGS . CARRY) hand, they're useful enough to be worth 'define STKPTR stk.p 'define SS stk.i.s the extra effort! 'define SP stk.i.r.x

'define OF psw.bit.of 'define DIR psw.bit.dir 'define INTE psw.bit.inte /* The following functions are 'define TRAP psw.bit.trap in the module CALL.C. 'define SIGN psw.bit.sign Call 8086() calls the far ••• 'define ZERO psw.bit.zero function at PC, while 'define AUXC psw.bit.auxc intn 8086 () expects an ldefine PE psw.bit.pe interrupt number to be in IP. Idefine CARRY psw.bit.carry Seg86 simply fills the __r structures' segment registers with the values found in the /* The macros here all refer to CPU registers at the time of something called _REGS, which the call. must be defined in your module. */ It can either be a structure, or another 'defined macro which refers to a structure, etc.

The idea here is that modules that contain many DOS or BIOS calls can put a __regs _REGS; declaration at the start of every function. As such, _AX allows access to the AX object in the structure, etc.

This makes the source code look MUCH better! Listing continued on next page */

MICRO CORNUCOPIA, #46, Mar-Apr 1989 21 _____1 -AliI can s~ about the GibsonResearch "SpinRitetkscribesit.se/fas 'a truly new ' people is thai they did their homework. SpinRite is what the word MUST was generotion 01 hard-disk utilities,' which is a marvel underslatementl'" invented lor. " 01 - Stephcn M. Leon, MICROISYSTEMS - Richard Grchan, BYTE MAGAZINE ~pinQite

Our users' experiences lias sllown: Or cure the problem at its source by preventing your • In a matter of minutes it gives any ooS drive a 11you use SpinRite"'every two or three drive's low-level foundation from ever weakening completely new, clean, stable and solid low-level montlls, you '1/ never lIave ANY and crumbling. format WITHOUT requiring a tedious back-up & PROBLEMS witlr your liard disk. SpinRite completely eliminates the problem of restore operation. The low-level format of your hard disk drive is gradual low-level format deterioration by quickly • It detects and eliminates all data-threatening hard p-obably the last thing you want to think about, let low-level reformatting any OOS hard disk while disk errors (which DOS can'l see) long before they alone worry about. But like the foundation of your leaving all its data in place... become data-damaging. home, you depend upon it every day without ever But SpinRite goes FAR BEYOND JUST THAT! .It instantly optimizes and resets the drive's sector giving it a second thought. .. until something goes interleave, guaranteeing maximum possible data wrong. transfer rates. SpinRite's Main Features: Every byte of data stored in your hard disk rests upon • It locates and isolates all data-threatening surface the drive's low-level format foundation. When that Spin Rite Is an all-ln-one, totallow-Ieve', format defects_ (Two to three times more than ANY other maintenance, repair optimization utility. foundation weakens, DOS begins repol1ing errors: slIrface testing softwarel) • Non-destructlvely low-level reformats any DOS hard BOOT FAILURE ask drive In minutes. Backup & restore are not SpinRite is offered with a 3O-day money-back SECTOR NOT FOUND requlredl satisfaction guarantee. It is extremely easy to lise with BAD SECTOR ERROR • Fully automatic surface defect management utilizing a simple user-interface, on-line help, on-line index GENERAL FAILURE READING DRIVE the Industry's most extensive worst-case data pattern and a short 40-page owner's guide. Spinrute is ABORT, RETRY, IGNORE analysis. immediately available from: That's how your vital data becomes hard to recover • "On-the-fly" Instant sector Interleave oJilmlzation Gibson Research Corporation or lost forever. This problem makes our personal establishes the maximum possible drive data transfer rate. 22991 LaCadena, Dept-MC computer hard disk drives tire least reliable Laguna Hills, CA 92653 components in our computers. • Recovery and repair of correctable and com pletely ,""correctable (unreadable) datal (714) 830-2200 Today you have two choices: Sit around worrying • Identification, diagnosis and repair of every form of Credit card orders, personal checks and COD about the safety of your data, backing up the drive data and format damage. orders welcome. Send: $59 plus $2 shipping and continually to minimize the extent of the loss wi,en • MFM, All, AALl and EALl compatible. handling. California residents please include 6% it occurs... sta te sal es tax.

Reader Service Number 138

unsigned int far segS6 ( regs far *ri ); _CH equ es:byte ptr OS [bx] unsigned int far call S086( regs far *ri, __regs far *ro ); _AX equ es:word ptr 06[bx] unsigned int far intn-SOS6( - -regs far *ri, __regs far *ro ); _AI. equ es:byte ptr 06[bx] void __regs_dumpC _regs far *rp); _AH equ es:byte ptr 07 [bx]

/* These macros do what they seem to do ... _DX equ es:word ptr OS [bx] _DL equ es:byte ptr OS [bx] NOTE: the cast to (void far (*) (» for PC in the callS6() macro _DH equ es:byte ptr 09 [bx] doesn't work unless x appears before l,h in the typedef for PCREG (Manx C S6, V. 4.10a.) */ _DS equ es:word ptr 10 [bx]

'define callS6(pc) ( PC = (pc), call SOS6 ( ( REGSP), (REGSP) » _DI equ es:word ptr 12 [bx] 'define intS6(i) ( -IP = ( i), intn-SOS6( (-REGSP), (:REGSP) » _SI equ es:word ptr 14 [bx] 'define pcdos(f) ( :AH = ( f), intS6( Ox21 » _BP equ es:word ptr 16[bx] _IP equ es:word ptr 1S[bx] 'asm _CS equ es:word ptr 20 [bx] ;If a C function is declared as being far, and having two ;far pointers ( RI and RO) to regs structures as its _PSW equ es:word ptr 22[bxJ ; first two parameters, the instruction "les bx, _RI" would ;set es:bx to point to the _RI __regs structure, and SP equ es:word ptr 24[bx] ; "les bx, _RO" would set es:bx to pOint to the _RO __regs -SS equ es:word ptr 26[bx] ; structure. iendasm

RI equ dword ptr 6 [bp] /***/ :RO equ dword ptr 10[bp]

;The following are offsets from ES:BX to the contents ;of the __regs structure.

equ es:word ptr 00 [bx] equ es:byte ptr 00 [bx] equ es:byte ptr 01 [bx] Note: You'll find figures 3 - 9 equ es:word ptr 02 [bx] on pages 74-79. equ es:word ptr 04 [bx] equ es:byte ptr 04 [bx]

22 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Great for the Experlmenterl RS-232 BREAKOUT BOX • Switchable Lines o ~ • LED Indicators ~ " Dual Conversion Superhet 450 MHz • Patch Terminals & Jumpers Pioneer Laser Disc Player • Control/ed Receiver Module (Plug-In I) . emoved trom service • Compact Size ~rystal These units were r 100VAC trom ~enty-Char. Alpha-Numeric LED . tor upgrades. They run on Wh·le they • RDlsPlay (ASCII Encoded, ANSI Char Set) CA COP 1802 Based . supplied 120V~C a:~~:r~ay ~ave minor should be wor ng, t sell them on an : P~izo~/eclric "Beeper" Unit problems ~ we mus VIbrating "As-Is" basIS. "Silent" Alert $ 9 9 5 e " 1-2 mW He-Ne Laser Tube • Untested - "As-Is" • $1 7aChgo5r two for • " Laser power Supply " 2 Front surface Mi~rors "Two 1/2" Voice COil Actuated IBM/ A Oscillating Mirrors laM TITLES E SOFTWARE BLOWOUT! " One Beam Splitter Visi On Graph " Two Optical Lenses VisiOn Calc VisiSchedule APPLE TITLES " One Optical Detector ViSiOn Word " Mini Gear Reduction APPlications Manager F!a~hCa/c M~tor DesktOP/Pian V,s/Ca/c " All Controlling Electronics . ~SOLO.. our I " Assorted switches, Fan, Solenoid VIS/Word • VisiFile VisiLink VisiSpelJ F/ashCa/c VisiDex :~GI~~~Sc"~~~J~:cog~~6'~~R VisiTutor for VisiWord V!s!Answer V!s!Tutor for VisiCa/c Stretch Calc VIs/Trend/P/ot V!S!C.a/c (Advanced) (NOT AVAILABLE FROM HSC). . V,s/F,le THEY CANNOT BE MANUALLY * VlslCorp Closeouts P * rlced from $6 95 CONTROLLEDl $ 9 9 . 0 0 • Mouse and 8asi . • to $12.95 c reqUired for some P rograms Mitsumi UVEX-AW51 P COMPUTER CHASSIS with POWER SUPPLY UHF / VHF These attractive system chassis were ~,~- @ manufadured by Televideo for the TSa06l20 Computer System. They are brand new and VARACTOR HALF HEIGHT EXTERNAL include the following features: DRIVE ENCLOSURE " Heavy Duty Plastic Case TUNER • Atrractive Low PrOfile C " 17" x 17- x a- 0.0. '" 3 112" X 2" X 1/2" " 19" ase " Hinged Drive Mounting Assembly for " . x .15" x 3" 0.0. 2 Floppy Drives and 1 Internal Hard Drive '" Pinout on Case " FIts nIcely directly under PC Standard IBM Colors " +5 +12 -12 Power Supply "Bezel fits One 5 1/4" and "IEC Receptacle, Power Switch One 3 1/2" Drive .QnU! "Fan $ 00 NEW! IN ORIGINAL BOX! 6 9 · ~~~$17.95 $29.95

ENGINEERING! • TEST! • DEVELOPMENT! DELTEC AT/XT 3-SLOT . TEAC FD-558 AC LINE CONDITIONER MOTHERBOARD 400 WATT DISK DRIVE * Ideal for you PC or An~ Equipment EXTENDER * 5 1/4" • Fused Extender Card • Eliminates AC Line NOIse and • One 16 Bit Slot Regulates to a Constant 120VAC * IBM COMPATIBLE • Two 8 Bit Slots • Reliable Ferroresonant Transformer * 360K • Test Points for All Bus Points * Attractive Case with power Cord, * 90-DAY WARRANTY • Power Connector Outlets, and Switch/Circuit Breaker • Cables Included • Not an Expansion Chassisl $149.00 $89.95 $89.95 30 oW • 2S00W, soooW also available HSC of Santa Clara WE SHIP C.O.D.! 3500 Ryder Street

HSC of Sacramento HSC of Santa Rosa Santa Clara, CA 95051 5549 Hemlock St. 6819 Redwood Drive sac(~~:)n~03a~:54~92a ~~~~)' ~:2_~~~1 C a II g~:~~~ia 800 -4 -HAL TED lise Since '63! Now! ~:~~~~~rs 408-732-1573 TEAMS: Mnlrrumonler $1 O. C.-omia Rnid ... mel 7'110 ."'ID. Prepaid orders .... I'eighl C.O.D. ar eallor cflarges. Shipping wil be ~ 10 aedit eM! anc/ C.O.D. arclerl. $2 Handling charge on orders lell lhan $25. Prapaidadeno_ $100u .. money order or certJied cflack. Pleas. no not ..ndeash. Some a.... liniIed1o slock on hand. Prices subject Iocfl.nge. Reader Service Number 11

MICRO CORNUCOPIA, #46, Mar-Apr 1989 23 Turning A PC Into An Embedded Control System: Phase 1 - Interfacing EEPROMs To The PC Bus

zao with the necessary peripheral sup­ going to take us several issues before we Okay, guys, Bruce is hacking hardware port chips. have all the nooks and crannies explored again. He's taken on a project that'll keep Many companies can't justify the cost and worked out. But that's where we're him embedded in our hearts and minds for of building everything from scratch, and headed. some time. It's an unforgettable design pro­ there's a rapidly growing industry which ject using EEPROM. supplies various types of PC-environment EEPROM embedded systems. These include normal EEPROM allows you to store informa­ PC hardware with a special BIOS (which tion not lost when you power down. It's n the coming months, I'll be working doesn't look for disk drives, etc.) and like an EPROM which doesn't require an (piece by piece) on an ambitious pro­ (often) a ROMed version of 005. EPROM burner - it gets "burned" right Iject - turning a PC motherboard into Systems like this allow you to develop in the circuit. EEPROMs take much an embedded control system. your embedded systems using the longer to write than they do to read. The In this issue, I'll start by showing you powerful compilers and tools available on read cycle is on the same order as normal how to use nonvolatile memory (or EE­ the PC (you can, for instance, use C or memory. PROM: Electrically-Erasable Pro­ C++). You can only write to a memory loca­ grammable Read Only Memory) in your Commercial PC-environment embed­ tion of an EEPROM a limited number of Pc. ded systems tend to be expensive; not as times (for the chip I'll talk about here, it's expensive as most, other alternatives, but 10,0(0). However, there's no restriction Embedded Controllers often as expensive as an XT with a hard on the number of times you can read it. Embedded controllers are standalone disk. The prices drop dramatically if you Normally you erase an EEPROM by writ­ systems generally dedicated to a single get into volume. ing over old data, but new crops of "flash task. They usually don't include monitors My favorite example is Intel's "Wild­ erasable" chips are showing up. or disk drives, but sometimes do have a card 88," which has the core of an XT Embedded systems often use EE­ very simple keyboard or display. motherboard on a card 2" x 4". Unfor­ PROMs as long-term storage for state in­ You hear a lot about the microcomput­ tunately, there isn't any RAM (an Intel formation (since there are no disks) or for ers in telephones, toasters, toilets, and tel­ spokesman said, "we don't make RAM, storage of information which can't rely on evisions. These embedded controllers on so why should we put any on the the presence of a disk. a single chip have been optimized for board?"), but these boards are only $50 As EEPROMs get cheaper, it becomes cost. Single-chip microcontrollers are apiece, in lots of 1000! feasible to begin using them to store large ideal for situations where you make thou­ Since XT motherboards are under $100 amounts of data. Several companies make sands of products, because the design (and you don't need the usual hefty cards containing EPROM (with ROMed costs can be spread out. These costs are power supply since there won't be disk 005) and large amounts of EEPROM. (of course) significant. drives), why can't we build our own These cards look like bootable DOS While I was at Fluke (in Seattle), I pro­ embedded controller (in quantities of one) disks. You simply load your program grammed a 4-bit microcontroller de­ with the power and development en­ onto the EEPROM and install it in your signed by NEC to drive a vacuum­ vironment of a PC for under $200? target system as drive A, so the computer fluorescent display directly (like the one We can, if we can negotiate the tricky boots from the card. This looks like it on your VCR). This involved learning the parts- might be an alternative way to create an hardware characteristics of the chip and a (1) Figuring out how to modify (or embedded system from a Pc. However, very arcane assembly language. We had write from scratch) the ROM BIOS. the price of these cards has always been to develop and debug the assembler (2) Using RAM - probably static too high for me. while writing the code (with little in the RAM, since it uses less power and way of examples or English documenta­ doesn't need refreshing. The Chip tion). (3) Establishing nonvolatile memory, I selected the chip for this project by All this work was expensive. since we don't have disk drives (the sub­ going to the back pages of BYTE and However, since it was going into a meter ject of this article). looking for EEPROMs. I always try to use with projected sales of 15,000 to 25,000 (4) Writing C or C++ embedded appli­ easy to find parts, but sometimes people per year, the costs were insignificant com­ cations and burning them into EPROM. still have trouble, so I felt this was the pared to the price of using, for instance, a This is a big tricky ticket, and it's safest approach.

24 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By Bruce Eckel Eisys Consulting 501 N. 36th Street, Suite 163 Seattle, WA 98103

This part is a Samsung KM2816A-25 If you need a denser part, the 2865A- RAM. (The pinout is the same as a com­ (compatible with Xicor X2816A) 2K by 8 30 is 8K bytes for only $9.95; it should be mon 6116 static RAM; you can just drop bit (i.e., 2K bytes) TfL-compatible 5-volt­ easy to modify my design for that part. it into the same socket if the bus timing is only EEPROM. The "25" in the part des­ Many EEPROMs require special hard­ within specs.) The only caveat is you ignation refers to the 250 nanosecond ware support for the extra-long write must wait 10 milliseconds between read time. It's available through Jameco cycle. Or they may have other interfacing writes. for $6.25, but they do have a minimum requirements (higher write voltages, for In an embedded application with order of $20. I suggest you get the data example). hardware dedicated to a specific task, it sheet ($0.50 extra). The 2816A chip was designed to inter­ would be appropriate to take over some face directly to a microprocessor bus. It of the PC's memory space for EEPROM, Jameco Electronics only requires 5V for reading and writing, some for static RAM (lower power, fast 1355 Shoreway Rd. and has internal hardware to latch the - no wait states, and no refreshing nec­ Belmont, CA 94002 write value. essary), and some for the program (415) 592-8121 You use the same kind of bus cycle to EPROM. write to the EEPROM as you do to a On a general-purpose PC, however,

Figure 1-PC Bus To EEPROM Interface

PC Bus CARD Slot Pin SELECl\ Read Select All AEN Adrenab 2 1 PO p.o p1L- A YO A28 Address 3 4 2 ~ PI B Yl A27 Address 4 6 3 ~13 P2 p>o C Y2 A26 Address 5 8 ~ P3 Y3 A25 Address 6 11 P4 Y4 :#-- A24 Address 7 13 VC~ :>B,- P5 Gl Y5 A23 Address 8 15 4 ~ P6 G2A Y6 A22 Address 9 17 5 P7 G2B Y7 ~ VO Read: BASE. 2 AEN SEL 3 ao 74LSI38 r-::::::< 14 A3SEL 5 rJ- 01 -= 13 A4SEL 7 ~ 02 -= 12 A5SEL 9 Write Select ~ 03 -= 11 A6SEL 12 1 15 VOWrite:BASE ~ Q4 A YO -= 10 A7SEL 14 2 14 05 B Yl ~ -= 9 A8SEL 16 3 13 110 Write: ~ as C Y2 -= 8 A9SEL 18 VOWr~.: BASE. 1 07 Y3 rL- -= t>*- BASE. 2 VC~ Y4 -=~ Ad~ 74LS682 PH,- Gl Y5 (optional) Address 4 ~ G2A Y6 Comparator ...L<: G2B Y7 ~ 74LSI38 2 3 ao DO DATAO A31 Address 0 Address Decoder 5 4 DATAl 01 Dl A30 Address 1 6 7 DATA2 .', 02 D2 A29 Address 2 9 8 DATA3 03 D3 B14 IORl I/O Read 12 13 DATA4 ." Q4 D4 B13 IOWl VOWr~e 15 14 DATA5 , 05 D5 16 17 DATA6 r-- as OS 19 18 DATA7 .', 07 D7 Selects Data I , Direction DATAO 9 1 DO AO OC DATAl 10 r+- Dl AI CLK A9 Data 0 2 18 DATAO DATA2 11 ~

MICRO CORNUCOPIA, #46, Mar-Apr 1989 25 we can't dedicate any of the memory space to EEPROM so I've designed it to Figure 2 - 2816 EEPROM Control Bits use the I/O space. Even then, there isn't enough free I/O space to support 2K bytes (only 10 lines, or 1 K, of I/O is brought out to the PC bus, with much of A7 A6 AS A4 A3 A2 A1 AO that dedicated to other purposes). To test the EEPROM, I've designed a card which occupies 8 I/O addresses. 1/0 Write: Base (For an introduction to designing PC adapter cards, see my article in Micro C #43, Sept./Oct. 1988, or chapter 11 of my book, Computer Interfacing with Pascal & CE\ x x x x A10 A9 AS C) . The card only uses three of the 1/0 Write: Base + 1 addresses. You write address and control line information to BASE and BASE+l. (These are write-only.) You write data to 1/0 Read & Write: BASE + 2 : Data and read data from BASE+2. Once again, I've taken a chip designed to interface directly to a bus and made it independent of the bus through a combi­ the read. While unnecessary in our sys­ capacitor with a value from 0.01 to 0.1 uP nation of hardware and software (see tem, this happens automatically if the between power and ground to keep TTL Micro C #42, July/Aug. 1988, or chapter chip is interfaced to a bus. noise from propagating through the 10 of my book). Maybe it's a step back­ For a write cycle, you send the supply lines (called ''bypass capacitors"). ward, but I find it a very useful tech­ address (BASE) and data (BASE+2) to the Editor's note: Bypasses should be low-im­ nique for testing hardware. chip. Then you enable the chip by drop­ pedance ceramic or plastic capacitors and you Figure 1 shows the complete circuit ping CEo Here, DE must be high (since should keep their leads as short as possible. In for the chip. Most of the circuit is simply we're WRITING to the chip, outputs are fact, it doesn't hurt to have one tied between the PC adapter card interface described not enabled). Finally, you lower and raise +5V and ground at every IC Also add three in issue #43. Two latches were added to the WE line to generate a write pulse. or four 10 to 50 uF tantalum capacitors be­ hold the address and control lines to the After the write, you raise the CE line tween the 5V line (and any other supply EEPROM; the rest is done in software. to disable the chip and then twiddle your lines) and ground. Figure 2 is the assignment of the bits thumbs for 10 msec to make sure another Tantalums are polarized (like common in BASE & BASE+l (BASE+2 is simply write doesn't happen too quickly. (This electrolytics) so be sure someone shows you the data bus, so I didn't show it here). isn't necessary if you have some other in­ which lead is plus. Also, tantalums have a Notice I've combined address and con­ surance that your program won't write a voltage rating. Those rated at 20V or greater trol functions in the two bytes. I could byte more often than once every 10 will work fine for 5V and 12V supplies. put the control lines in a separate byte, msec.) To write large quantities of data The DIP switch controls address selec­ but that would take more hardware. If while performing other tasks, you might tion. I've shown it as "optional" since you modify this design to add more EE­ want to use an interrupt routine tied to a you can simply wire the lines to ground PROMs, however, you might want to clock tick. or leave them open. To select an address separate the control lines. In a system where the EEPROM ties for BASE of Ox220 (generally unused), Figure 3 shows the two functions - directly to the microprocessor bus, the ground all lines except AS SEL .and A9 microprocessor and the decoding logic SEL. The 74LS682 has internal pullup re­ EEPRO~write () generate signals to the chip, so they look sistors so any lines left open will be EEPROM_read () other than they do here. In that situation, forced to 1/1." you must examine the timing on your The backslashes ("\") after signal and a very simple program which uses bus and compare it to the spec sheets for names denote "not" or "active low." these functions. the 2816A. OrCAD won't let me draw bars above If you program in another language, signal labels (which would have been you should be able to find similar func­ Circuit Notes prettier). At least, I haven't figured out tions to substitute for inportO and out­ You'll notice I left off the power and how to do it. portO. ground pins on the chips. I drew the dia­ For quick bread-boarding, you can get gram with OrCAD (what a wonderful a superstrip card that plugs into the PC Cycling The Lines program!) and the parts came from the li­ bus from Global Specialties. The part Reading the chip is a two-step brary this way, which is very common number is PB88 or PB88-2. They also process. First, you write the address to on circuit diagrams. Fortunately, there's a have a new proto-development card with BASE, latching it onto the 2816's pins, pattern. If you look down at the top of all the decoding and buffering done for and force CE (chip enable) and DE (out­ the chip with pin one in the upper left you (PCL-750). Call them for a catalog. put enable) low by writing to BASE+ 1. comer, you'll see the lower left pin as (These lines are active low.) ground and the upper right pin as Global Specialties Then you can read data from BASE+2. power. P.O. Box 1405 You can save power by raising the CE Another "hidden feature": every two Newhaven, cr 06505 line (again a write to BASE+l) following or three TTL chips, you should put a (800) 345-6251

26 MICRO CORNUCOPIA, #46, Mar-Apr 1989 @Edit Advanced Figure 3 - 2816 EEPROM Reads And Writes

1* Turbo C program to read and write data on the 2816 EEPROM by Bruce Eckel, EISYS Consulting *1 the . ~~ 'define BASE Ox220 1* address set on DIP switch *1 66QfU1Cn. r99 void EEPROM write (int address, unsigned char value) ( j! 1* See figures 1 and 2 to understand this function *1 edito outportb(BASE, address' Oxff); 1* low 8 bits *1 1* High 3 bits and CE forced low *1 By SEMWARE outportb(BASE+l, (address» 8) , Ox07); 1* Write the data: *1 outportb(BASE + 2, value' Oxff); QEdit is one of the smallest, /* 'delay()' is a function from Turbo C 1.5 to wait for a number of milliseconds. If you fastest, most easy to' use multi­ have version 1.0, write a simple "for" loop. */ file editors available for IBM delay(lO); /* Wait 10 mS for EEPROM to finish writing */ Compatible Computers with many features to enhance int EEPROM read(int address) ( /* Place-the address at the 2816 pins and force CE low: */ your productivity. outportb(BASE, address' Oxff); outportb(BASE+l, (address» 8) , Ox07); 1* Read the data: *1 o Extremely Fast return inportb(BASE + 2); o Completely Configur­ mainO { able (Including Key­ int i, address, value; /* First, dump the contents of the EEPROM: *1 boardI) for (i = 0; i < 2048; i++) { 1* Generate breaks, line numbers: *1 if ( i % 20 = 0) printf("\n%d: ",i); o Easy to Use Macro printf("%d ",EEPROM_read(i-l»; Facility } while (1) ( printf("\nRead, Write, or Quit?\n"); o Optional "Pop Down" switch(getch(» ( case 'R' : case 'r' : Menu System printf("address to read? "); scanf("%d",'address); printf("%d\n", EEPROM read(address»; o Recover Deleted '!ext break; - case 'w' : case 'w' : Edit Dozens of Files printf("address to write? "); o scanf("%d",'address); Simultaneously printf("\n") ; printf("value to write? "); scanf("%d", 'value); o Utilize up to 8 Windows printf("\n") ; EEPROM write(address,value); to View Files break;- case 'Q' : case 'q' : QEdit Advanced requires an exit(O); IBM PC/XT/AT or Compati­ default: ble, IBM PS/2 30-80, 128KB of available memory. *** Please specify 5.25" or 3.5" diskette.

$ 5 4 95 MASTERCARD &. VISA ACCEPTED Next Time Editor's note: Bruce often refers to articles Add $3.00 Shipping & I may get distracted from embedded in previous issues. You can get a book of his Handling. Georgia Residents systems sooner than I expected. I was hardware articles, Computer Interfacing Include 4% Sales Thx. cruising Radio Shack the other day and with Pascal & C, and a disk of source code. saw a pair of nifty LSI chips which, com­ Send a check for $30 to Micro Cornucopia, bined with some hardware, create P.O. Box 223, Bend, OR 97709. To Order: speech. If you want to learn more about C++ pro­ SEMWARE, 730 Elk Cove Court I know speech projects are popular, gramming, you can get disk #1 of the c++ Kennesaw, Georgia 30144 and it seems like a PC adapter card to Source Code Library, "Windows, Matrices & Phone Orders: (404) 428-6416 generate speech could be a lot of fun. MicroCAD," by sending a check for $15 to Embedded systems, C++, speech synthe­ the Bruce Eckel, Eisys Consulting, 501 N. sis, PCB cards ... there are just too many 36th St., Ste. 163, Seattle, WA 98103. fascinating projects waiting to be created! ••• Reader Service Number 127 MICRO CORNUCOPIA, #46, Mar-Apr 1989 27 Bringing Up A Surplus 68000 Board A New Father Describes The Experience

is a good system that can be purchased space. Last issue Karl talked about purchasing for as little as $200 in kit form; drop PT a A partial disassembly of the EPROMs, boards on the surplus market. This issue he line for more info. provided by a friend who had also pur­ describes the process of bringing up a sur­ chased a Mini-Frame board, revealed that plus system. It's a fascinating process, one Checking Out The Hardware ... the EPROM was addressed to start at you'll miss if you limit your building to A quick look at the Mini-Frame re­ $800000. plugging together clone boards. vealed enough information to get started. Since the 68010 typically uses address The board has a single large LED near zero as the starting point for its exception one edge, a row of five smaller LEDs (ap­ table, it was a safe bet that the RAM ran wanted a fast 68000 system with lots parently a status display) down another from $0 to $7FFFF. (It turned out that of RAM, capable of running the edge, two socketed 2764 EPROMs and wasn't the case, but I'll get to that in a ISK*DOS operating system, and I some 1488/1489 RS-232 drivers for the se­ bit.) But where were the peripheral chips? wanted it for less than $200. This article rial ports. Since the 1488s use +12V, +5V I had to find the address of the Intel 8274 tells how I did it. and -12V, I knew my board would need serial chip before I could talk to my I built my system around a surplus (at least) these voltages. I also found a board. Convergent Technologies Mini-Frame large reset button below the serial con­ There was only one way into the ma­ 68010 board running at 10 MHz. The nectors. chine - through the ROMs where the board boasts 512K of RAM, a floppy disk After perusing the board, I figured it boot code resides. I would have to burn a controller, a hard disk controller, two se­ was time to see if it worked. Using a test routine into a pair of EPROMs, install rial ports, a parallel printer port, and a YOM (and a pin-out of the 1488s), I lo­ them in the board. and run the program. 16-channel HDLC cluster controller. I cated the pins on the nine-pin power My routine would scan through added a Panasonic JU-455 floppy drive, plug for +5, +12 and -12 volts. When I memory, reading each address. When it high-current power supply and a Tele­ connected my $30 surplus power supply hit the address containing the serial chip, Video 910 tenninal. Total cost of the com­ and hit the board's reset button, the large the chip's select line would go low. Once ponents (all surplus) - about $180. LED lit red and stayed on. Not encourag­ I found the block which contained the Getting a surplus floppy drive to work ing. port, I tested smaller and smaller areas seldom presents a problem; bringing up a Looking over the board more care­ within that block to locate the address. full mini-computer without user's manu­ fully, I noticed that one of the two system als, technical docs, or even a schematic is EPROMs had been plugged in back­ The Host, The Target, And The Tools another story. When I first brought my wards. I reversed the chip and tried Obviously, the Mini-Frame wasn't $40 board home from the surplus shop, power again. This time I got ten seconds ready to be the development system, so I all I had for infonnation was what was worth of dancing LEDs. After the LEDs needed a host and some tools. I used a silk-screened on the board. stopped flashing, the large LED went out PC-clone running the X68K cross-assem­ and only a single green status LED re­ bler from 2500 A.D. Software. To burn There Are Easier Systems mained lit. the EPROMs, I spent weekends with my If you want to try your hand at bring­ Encouraged, I connected a floppy disk company's DATA-I/O Model 19 PROM ing up a surplus 68000 system, you can drive, inserted a floppy disk and programmer. make your job easier by starting with a powered up the board. The drive came I knew I was going to be reprogram­ better documented board. Schematics and on and the heads stepped across the disk ming and reinserting the Mini-Frame's documentation for something like the as the board attempted to boot the alien ROMs many times, so I plugged ma­ Motorola M68KVM02 VERSAmodule disk. I had a working board! chined-pin AUGAT sockets into the family are easy to get. The boards turn up board's original ROM sockets. That way I often in the surplus markets. Writing A New Monitor could use the upper, removable sockets Or, you might stumble onto a used But this board wanted to boot and run as much as I wanted, without damaging Amiga or Atari 68000 system, in which UNIX - I wanted to rewrite the code in the lower, soldered-in sockets. case there should be no problem with the EPROMs to do something more inter­ For hardware tools, I had only a documentation. Of course, you can also esting. This meant figuring out where all simple LED logic probe. When touched to buy these systems new, or go with the the peripheral chips, EPROMs, and RAM a circuit point, the probe would show a Peripheral Technology PT-68K The latter resided in the CPU's 16 MB address logic one, a logic zero, or a pulse. I used

28 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By Karl Lunt 7349 W. Canterbury Peoria, AZ 85345 (602) 869-6146 (days)

the logic probe mainly to track down the Activating The RAM for goodies. Considering the 64 KB addresses of the different peripheral Figuring I had overlooked something, memory of my 6809 systems, it felt chips, by looking for a pulse on the chip I went back to the disassembly of the strange to look at addresses above select line. original EPROMs. The code started out $10000; I wasn't used to numbers that Most of all, a large library of technical by writing a pattern of words to particu­ large! data made this project possible. I ob­ lar addresses. After I added this code to I tried using the dump command to tained data books on all the major chips the beginning of my routine, I got my locate the addresses of the other main in the Mini-Frame, knowing I would stream of asterisks on the terminal. Ap­ chips, such as the WD2797 floppy disk need the information at least twice. I parently, writing just those words to just controller (FDC). That got boring quickly; used the pinout data as I hunted for the those addresses activated RAM. it was too much work to type in a dump chip's address in the memory map. I Later, I found that system RAM could command, hold the logic probe in place, later used the programming information be moved about in the CPU's logical and press RETURN just to read 256 when I wrote new code for my own address space by changing the data writ­ bytes. I needed a way to check a lot of monitor and programs. ten into the mapping RAMs. This was addresses quickly and repeatedly. So, I verified later still when a friend acquired added the sweep command to the moni­ Finding The Serial Port a set of schematics for the Mini-Frame. tor. Now began the hunt for the address For now, it was enough to know how I The sweep command would read of the 8274 serial port chip. What fol­ could turn on the RAM. whatever size block I wanted, repeating lowed was a long, tedious cycle of the task until I interrupted it. Using this coding, programming the EPROMs, run­ The Beginnings Of A Monitor tool, I quickly found the locations of the ning the code, noting the results and try­ By now, I had learned enough about FDC, the WD1010 hard disk controller ing again. The program repeatedly read the Mini-Frame to begin writing a small, (HDC), and the printer port. I also every address in a selected range, then EPROM-based monitor. I built some stumbled across at least one address that started over again. As the program ran (if simple diagnostics into the first section of appeared to force a hard reset of the sys­ it ran), I would hold a logic probe on the the monitor's code, using the five status tem. Earlier, this had caused me so much serial port's chip select, looking for a LEDs. As the monitor went through its grief when I had to burn my searches select strobe. startup sequence, it would light different into EPROM. The board crashed many times, leav­ LEDs. A failure of any test crashed the Which brings up a point - each time ing just the large LED on. This meant system, leaving a distinctive status pat­ I changed the monitor or tested a pro­ that I had read a forbidden address. Un­ tern. If all the tests passed, only a single gram, I still had to burn a new set of fortunately, there seemed to be several green LED remained lit. EPROMs. This had two major draw­ such areas of memory. I included the system testing because backs. First, it takes time to erase, pro­ Finally, I tracked down the serial port several friends had also purchased sur­ gram, test and install EPROMs. Second, at address $C30000. Armed with the plus Mini-Frame boards and the tests since the EPROM programmer belongs proper Intel manual, I wrote a routine would help them get their boards run­ to my company, I only had access to it on which sent a stream of asterisks to the ning. the weekends, limiting the time I could terminal. Then I installed the new code in Finally, before the monitor prompted hack on my machine. I needed a way to the EPROMs and fired up the board. for a command, it would activate all 512 download 68000 code directly from the Unfortunately the big LED stayed on, KB of RAM and test it, displaying on the host system. telling me the code had crashed. I re­ terminal the results of the test. The first 5ince the linker on the host system wrote that code a couple of times, to be time that baby came up and announced could output Motorola 51-59 object re­ sure I got it right, but the result was al­ . that all 512 KB tested good, I felt great. cords, I wrote a simple 51-59 loader and ways the same - the board crashed. burned it into the monitor EPROMs. This The code was correct; there had to be Dumping, Scanning, And The RAM RAM loader command removed the last a problem elsewhere. Since I used sub­ Loader barrier to rapid progress on the Mini­ routines to do the initialization of the se­ One of the first commands I installed Frame. I could now develop programs on rial port, the RAM had to be working for in the monitor was a simple ASCII dump the weeknights, then use the EPROM the code to work. Perhaps the RAM routine. This allowed me to quickly ex­ programmer on the weekends to up­ wasn't there after all. plore areas of the address space, looking grade the monitor.

MICRO CORNUCOPIA, #46, Mar-Apr 1989 29 Tracking Down The Disk DMA was not PC-compatible. Using the sche­ Peripheral Technology I had made a lot of progress so far. I matics, I made a small adapter with a 480 Terrell Mill Rd., Suite 870 had full control of the serial ports, access pair of DB-25 connectors - my line Marietta, GA 30067 to 512 I

30 MICRO CORNUCOPIA, #46, Mar-Apr 1989 TM EDITING SYSTEM

ED is an editor that makes the very conception of other editors obsolete. ED is an object-oriented open architecture system for editing programs and manuscripts, manipulating data files and creating snazzy demos. ED's commands respond with no perceptable delays. Programmers have complete simul­ taneous control over multiple source files. Functions for creating manuscripts are part of ED's design, with stream blocks, word-wrap, tabs, intelligent paragraph formatting, block justification, and pagination that behave correctly and execute instantly. ED can be used to create sophisticated sorts and filters. Macros, search and replace, column blocks, and block sorts allow records to be sorted and selectively removed, and fields to be added, rearranged, and removed. Flexibility, extensibility, and programmability are realized by providing programmers access to the objects which ED itself manipulates. All aspects of ED's appearance and operation can be controlled by the programmer. ED, a restricted or enhanced form of ED, or any of ED's objects, can be embedded in the programmer's applications with no royalties. Objects such as dynamic arrays, windows, data entry windows, macros, menus, browsers, popup directories, and regular expressions are manipulated through normal C function calls.

ED • NUMBER OF BUFFERS LIMITED ONLY REACTIVATE· TAB· DRAG· SORTS· SPREAD· TYPED·OVER CHARACTERS· CHANGE DIREC­ BY AVAILABLE RAM • NUMBER OF WINDOWS SHEET STYLE MATH· ADD/SUB/MULT/DIVDlAVG TORY • BRACKET/BRACE/PARENTHESIS LIMITED ONLY BY SCREEN SIZE· POPUP • MACROS· MENU DRIVEN· VIEW· AUTO· MATCHING· ENTER GRAPHICS CHARACTERS· DIRECTORY FACILITY· VIEW EXECUTE, TIME·DELAY • NESTED' RECURSIVE EXCUTE DOS COMMANDS· POPUP ASCII TABLE FILESPEC/SUBDIRECTORIES • FIND FILE ON • INTERACTIVE· 1 OR 2 KEYSTROKE· SCREEN • USER DEFINED POPUP FILES • KEYBOARD DISK' SEARCH DISK FILES FOR TEXT· COpy DISPLAY CONTROL· SIZE LIMITED BY AVAIL· CONFIGURATION' PRINT BUFFER WITH PAGE • RENAME· DELETE· BROWSE· FILE STATUS ABLE MEMORY· AUTOMATIC MACRO MENU NUMBERS. ADJUSTABLE SPACING AND MAR· • EDIT· EXECUTE· SORT· SEARCH AND CREATION • MORE FUNCTIONS • GINS, INTERACTIVE TUTORIAL' MANUAL AND REPLACE· FORWARD/BACKWARD· CASE PULLDOWN USER MENU SYSTEM • RECON· TUTORIAL ON·LlNE • WRITIEN IN C AND AS· SENSITIVE/INSENSITIVE • FULLY PAREN· FIGURE COLOR AND WINDOW STYLE • SEMBLER· EXTERNAL UTILITII;S • IN· THESIZED REGULAR EXPRESSIONS· IN· VIEW/MANIPULATE BUFFERS THROUGH MENU TELLIGENT CHANGE DIRECTORY COMMAND • CREMENTAUGLOBAL SEARCH AND REPLACE OR KEYSTROKE· INTELLIGENT DIAGRAM/BOX POPUP DIRECTORY FACILITY· STRING TRANS· ACROSS ALL BUFFERS • BLOCK COM­ DRAW • ADJUSTABLE SCROLL VALUE • LATOR· HARDWARE REQUIREMENTS MANDS • COLUMN/LINE/STREAM BLOCKS • TRANSPOSE LlNES/CHARACTERSIWORDS • • DOS· Pc/XT/AT. PS/2. 386 • CGA. MDA. EGA. SAVE, CUT· DELETE· BLANK· SEARCH·FOR MOVE·TQ·POSITION STACK· VISUAL TAB CREA· HERCULES. WYSE 70G'AMDEK 1280 • RUNS IN • FORMAT • JUSTIFY LEFT/RIGHT/CENTER • TION' POPUP RULER • COLUMNAR/ENTIRE· ALL VIDEO MODES. NO FLAGS. NO DRIVERS· UPPER/LOWER CASE, REMOVE· OVERLAY' LINE TABS· TIME AND DATE STAMP, RESTORE . 256K· FOR UTERATURE AND DEMO:

CALL 201-450-4545 VERSION 1.1 , PRICE: $265.00 -- MASTERCARD, VISA, C.O.D, AND P.Oo'S THE AMERICAN COSMOTRON 80 HOLMES ST • PO BOX 128 • BELLEVILLE, NJ 07109

Reader Service Number 107

. MICRO CORNUCOPIA, #46, Mar-Apr 1989 31 Practical Fractals And Other Flights Of Fractal Fancy

again looking similar to the view from skip to the next section, but for those with Larry obviously didn't understand the space. a penchant for completeness, the general true import of last issue's Culture Corner This "scale invariance" of the coast­ case follows: (he thought I was encouraging his fractici­ line's appearance is a major characteristic lious schemes). And now, of all things, he of fractals. It makes the length of the peE) oc: ed-O thinks he's found a practical application for coastline hard to pin down. A measure­ these twisted notions. (We're trying to ment taken fr(')m space misses much of where P(E) represents the value measured humor him, really we are.) the small detail and therefore will be (here, the length of the coastline), e is the smaller than one taken by a man with a unit measure, d the topological dimen­ yardstick. But we can measure the rate of sion, and D the fractal, or Hausdorf-Besi­ icked back in my chair, feet up on increase of the coastline length as we covitch dimension. Think of d in the more the desk, I watch yet another zoom in. traditional way - a dimension of integer KMandelbrot plot crawl across the It seems reasonable that more complex value. (Coastlines have a topological di­ screen. A sarcastic voice behind me says, coastlines, like England's, would show a mension of one, and for planetary sur­ "Fractals? Again? When are you going greater increase in length than, say, faces, d=2.) to do something useful around here?" Southern California with its long, straight By the way, one definition of fractals An annoying and utterly unfair re­ beaches. So this rate of increase directly says that a fractal has D>d. Again, this mark. I do plenty of useful work at Micro measures the complexity of the coastline. makes sense: D=d gives us straight lines C. In summer I mow the lawn (well, once It's also related to the coastline's fractal and flat planes - definitely not fractals. anyway), and in winter I shovel snow dimension. from the walk. What more do they want? In more specific terms, determination Fractals In Oregon? As it turns out, plenty of folks are of the fractal dimension of England's One of the nice things about living in working on practical applications of frac­ coastline goes like this: Measure its length Bend is having a wild river running tals. But, before we get into that, let's go at various scales and draw a graph of the through town. At least, the mink, otter, over some fractal theory from a less log of the length vs. the log of the unit and beaver seem to like it. (Our own mathematical perspective - one that will measure. "Unit measure" means the governor once refused to visit Bend - make clear the potential for use of fractals smallest measurable unit at a given reso­ ''The middle of nowhere" as he called it.) in the real world. lution - large scales have large unit What better place to try my hand at measures. fractalizing than on a nice crooked river. Empirical Theory Obviously, the slope of the plotted line No, I didn't actually pace the banks of Enough obscure esoterica has been will be negative since, as the scale in­ the Deschutes for a small scale measure: I written on fractal theory to supply the creases, the length decreases. The fractal let my dividers do the walking on a map. Micro C outhouse with paper products dimension then equals one minus the An afternoon of diligent dividing in the for years to come. (Indoor plumbing? In slope of the plotted line - a value greater Central Oregon Community College map Central Oregon? Be serious.) Let's take than one since the slope is negative. It room generated the data I needed. It's the concept of fractal dimension and turns out that England's coastline has a hard to come up with more than one come up with a gut-level definition. fractal dimension of about 1.2. order of magnitude in scale variation this Many objects and processes in nature We can test this notion with a way, but it does serve as an example of exhibit "self-similarity" at different scales. geometrically straight line segment. Since the technique. (See Figure 1.) That is, they look the same under varying it has no irregularity, measurements of its By my approximation, the wanderings magnifications. England's coastline is a length will give the same value at all of the Deschutes earned it a fractal di­ classic example. scales. Plotting length and unit measure mension of 1.25 - not an unreasonable From space we see an irregular line as before shows a line of slope zero - no value. I'm sure the otters (and Governor made up of bays, peninsulas, and amuse­ change in measured length. And (1-0) Goldschmidt) will be glad to know. ment parks. A walk along the beach gives a dimension of one, like all good shows similar detail, but on a much Euclidean lines should have. Finding The Fractal Dimension smaller scale. And the view through a Despite my good intentions, a bit of a know - sounds like an episode of magnifying glass includes miniature bay­ unexplained math has crept into the dis­ Flash Gordon: Flash Explores the Fractal lettes, peninsulettes, and parklettes - cussion. The faint of heart may want to Dimension.)

32 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By Larry Fogg Micro C Staff

Given an object in the "3-0" real One possibility involves taking a hori­ age of the elevations of the four corners world, The Real World for example, we zontal slice of the surface (a contour line), and assign it to the center of the square. can look at its diameter at different finding its fractal dimension, and adding Now find the total area of the four sur­ scales. Or we could consider the same one. A fairly coarse approximation, and faces of the resulting pyramid. scaling effect on its surface area. Again, one that may depend on the elevation of This gives a first large scale measure the difference between mountains on the the contour. analogous to measuring a coastline from grand scale and molehills on a lesser Or you could look at individual space. Next, overlay four smaller squares scale gives us the information necessary points on the surface and investigate on the same surface and measure their to find the fractal dimension of the their elevation difference vs. the distance areas in the same way. The smaller scale Earth's surface. between them. Or you can choose from will yield a larger value for the total sur­ Gathering this data poses a difficult other computationally intensive methods. face area since it will catch more of the task, but researchers have developed KC. Clarke came up with a simpler surface's details. 1 methods for approximating the fractal di­ method . Overlay the surface with the Continue this process to the lowest mension of a surface. largest square that will fit. Take the aver- limit of scaling (two pixels by two pixels

Figure 1 - Finding The Fractal Dimension (D) Of The Deschutes River

1.7

-1.0

1.6

-.c..... 0) c: Q) .....a; 1.5 .....0 "-" C!:J 0 ...J 0.25 Slope = -1.0 1.4 D = 1 - (-0.25) = 1.25

1.3 -1.0 -0.5 0 LOG (unit length)

MICRO CORNUCOPIA, #46, Mar-Apr 1989 33 7 for a digitized image). Then plot the log • Spreading of diseases • ing parameters directly. of total area vs. the log of the area of an • AC behaviorS. While both programs let you "ani­ 9 overlaid square, for each size of unit • Growth of DLA clusters . mate," or dynamically change the color 1o square. Very similar to the coastline • Simulation of lightning . map of an image, PM gives you more method described above, Clarke's Data compression, linguistics, tur­ control over the process. I could watch method saves a bunch of computer time bulent flow, population growth, and an animated image for hours. over other fractal surface dimension tech­ most anything else you can imagine have Finally, both support math coproces­ niques. been explored with fractal techniques. sors - a definite must for serious fractal The list is truly endless. work. A Practical Example On to the differences. PM has mouse Professor Philip J. Hopke (of the Uni­ .COMplexity support, ME doesn't. I don't consider this versity of Illinois at Urbana-Champaign I wanted to do something keen like a a deciding factor - the cursor keys work Environmental Research Laboratory) and fractal measure of program complexity. just fine. his associates have used Clarke's method But this points out a danger: Not all ob­ If you have a CGA system, get PM in an effort to characterize particles by jects and processes are fractal in nature. If since ME won't run on CGA. Better yet, 2 their fractal surface dimension . They experimentation shows scale invariance buy an EGA or VGA setup. I used a hope to use the fractal dimension as a of some property, then by all means ex­ VGA/386 system at MicroSphere to test tool to identify the processes that form plore its fractal possibilities. these programs and I'm hooked. I've up­ airborne particles. I'll keep thinking about it, but it graded the recommended minimum sys­ Hopke captures the particle's image doesn't look like executable programs are tem to EGA. CGA and Hercules fractals from a scanning electron microscope fractals. (Except, of course, fractal pro­ just don't cut it. (SEM). The SEM bombards the surface of grams.) the particle with a tightly focused beam Mandelbrot Explorer of electrons. The surface, in turn, reemits The Bottom Line Mandelbrot Explorer sports online secondary electrons whose energy de­ A few years back, John Maddox help, very powerful control over color as­ pends on the topology and composition wrote, " ... this is an interesting case, signment, some picture editing capabil­ of the surface. This digitized secondary which seems to happen more and more ity, and tips on photographing screens. electron image provides the data neces­ often, of how an explanation in search of In the PC tradition, ME accepts com­ sary to find the fractal dimension. a phenomenon may lay claim to far more mand line parameters and operates with 11 Particles of sodium chloride, sodium territory than it can handle ." keystroke commands. The command line sulfate, ammonium sulfate, and one un­ This still holds true for the most part. capability means that you can easily set known compound have been subjected But while fractals remain the darling of a up a batch file directing ME to do any to this technique. Like most of the re­ large portion of the scientific community, number of fractals unattended. Wonder­ search I've seen, this application seems to a healthy case of skepticism has set in. A ful! Head off on a month-long vacation work well over a somewhat limited myriad of applications tease researchers while your computer sits home alone range of scales. Hopke reports very con­ with promising results, but no one seems scratching out fractals. sistent results at lower magnifications. willing to claim absolute success in mod­ Another nice feature called Escape lets However, high magnification eling, characterization, or any other ap­ you watch the dance of a point as it goes (>l00DX) yields lower values for the frac­ plication of fractals (except graphics). through the iterative process. tal dimension. Nonetheless, a judicious Still, it won't surprise me in the least I do not like ME's method of screen choice of magnification may yield useful to see fractals become an increasingly im­ boundary input. Instead of taking maxi­ information. portant tool in the future. mum and minimum values, ME wants to To quote Professor Hopke, '1f we can see the coordinates of the center of the re­ work out the remaining kinks in our Commercial Fractal Software gion and a "magnification." Very unnat­ methods, fractals could prove to be a This here's a computer rag so let's fin­ ural. valuable tool in investigating atmos­ ish up with a look at some software pheric particles." available for interdimensional explora­ Fractal Magic tions. I know of only two commercial Written in Turbo Pascal, FractalMagic Other Applications fractal packages for the PC: Mande1brot comes in two flavors - regular, and Fractals have shown promise in a Explorer (ME), and FractalMagic (PM). 8Dx87. And if you want to create your wide variety of fields, often in finding a Both do a fine job of tying up your com­ very own fractal set, Advanced Fractal­ quantitative measure of the irregularity puter at a bargain basement price. Magic ($25) lets you write new calcula­ of some property, as in Professor According to the Micro C Fractal Ac­ tion routines that can be linked in with Hopke's research. Other areas are: cessory Review Team (Allan Chambers, the FractalMagic code. (You'll also need • Characterization of the roughness Dave (that Thompson guy), and myself), Turbo Pascal v.4.D.) 3 of the ocean floor . ME and PM do just about anything PM uses pull-down menus to create a • Distribution of earthquakes along you'd want with Mandelbrot and Julia very nice user interface. Screen parame­ 4 fault systems • sets. ter input follows the more standard • Optical diffraction analysis of par­ Both packages allow storing work in method of specifying maxima and min­ ticle clusters formed by diffusion progress for resumption at a later time. ima. During operation PM shows a limited aggregation (DLA)5. (Handy if you occasionally use your sys­ bright dot at the point of calculation - a Fractal modeling of many processes tem for such mundane tasks as word very nice touch that makes it easy to see may also be possible. Candidates for this processing.) They also let you define par­ where the heck you are. application include: ameters for new plots by moving a win­ The makers of PM also sell a screen 6 • Clustering of stars • dow around an existing plot, or by enter- dump utility, T-shirts, and another inter-

34 MICRO CORNUCOPIA, #46, Mar-Apr 1989 68000 SINGLE BOARD COMPUTER

YOU WANT THE SOURCE1! • 612/1 024K DRAM • 4 RS-232 SERIAL PORTS WELL NOW YOU CAN HAVE IT! The HAS'rKltFDL • FLOPPY DISK CONTROLLER • REAL TIME CLOCK DlSASSKlfBLER. (10)86) will cr;;te MASK co.patible source code from program files (EXE or COM). BASIC KIT( 8 MHZ) - BOARD, MICROPROCESSOR, HUMBUG MONITORI And the files are labeled and co ••ented so BASIC IN ROM, 4K SRAM, 2 SERIAL PORTS $200 they become USEABLE. KD86 is an interactive disassembler with an easy to use,_ word PERIPHERAL TECHNOLOGY PROVIDES ACCESSORIES TO BUILD processor like interface (this is crucial for COMPLETE SYSTEMS! the REAL progra.s you want to disassemble). With its built-in help screens you PACKAGE DEAL - COMPLETE KIT WITH 10 MHZ MICROPROCESSOR, von't have to constantly refer to SK*DOS OPERATING SYSTEM, 512K DRAM $575 the .anual either {although t . SYSTEM BOARD( 12MHZ) - ASSEMBLED/TESTED, 1MEG RAM, 6 PC/XT there are valuable diSCUS-~ sions on the ins and outs PERIPHERAL PORTS, SK*DOS $899 of disassembling which COMPLETE INFORMATION AVAILABLE UPON REQUEST you won't want to miss}. 'l f:=; -n. c:...... r •• • PERIPHERAL TECHNOLOGY KD86 is a professionally 1710 CUMBERLAND POINT RD., #8 supported product and yet costs MARIElTA, GA 30067 404/984-0742 no more than "shareware". And of course, it's not copy protected. VERSIOR 2 BOY AVAILABLE! COD/MASTER CARDNISNCHECK SK*DOS IS A TRADEMARK OF STAR-K SOFTWARE SYSTEMS CORP. 1ID86 n is OIILY $61.50 ($1.50 sQ) + tax Reader Service Number 119 C.C. Software, 1907 Alvarado Ave., Walnut Creek, CA 94596, (415) 939·8153

esting sounding graphics program called References 6 Lucchin, F., "Clustering in the Uni­ KaleidoScope. 1 Clarke, Keith c., "Computation of the verse," Ibid., pp. 313-318. Fractal Dimension of Topographic Sur­ Which One? faces Using the Triangular Prism Surface 7 Grassberger, P., "Spreading of Epidemic A rough comparison using the full Area Method," Computers & Geosciences, Processes Leading to Fractal Structures," Mandelbrot set gave FM about a 15% Vol. 12, No.5, pp. 713-722. Ibid., pp. 273-278. faster rating. I didn't get a chance to com­ pare the two on an 80x87 system. 2 Hopke, Philip K, et aI, "The Use of 8 Liu, S.H., et aI, ''Theory of the AC Re­ I'd be hard pressed to make a choice Fractal Dimension to Characterize In­ sponse of Rough Interfaces," Ibid., pp. between the two programs. I prefer the dividual Airborne Particles," paper pre­ 383-389. user interface of FractalMagic, and it has sented to the EPA/APCA Symposium on the edge in speed. But Mandelbrot Ex­ Receptor Models in Air Resource Man­ 9 Sander, L., ''Fractal Growth Processes," plorer's batch ability and its slick Escape agement. Nature, Vol. 322, August 28, 1986, pp. 789- feature tip the balance back towards 793. even. 3 Barenblatt, G.I., et aI, ''The Fractal Di­ Shoot, it's only money - buy 'em mension: A Quantitative Characteristic of 10 Tsonis, A., et al, "Fractal Characteriza­ both. Ocean-Bottom Relief," Oceanology, Vol. 24, tion and Simulation of Lightning," Bei­ No.6, pp. 695-697. triige zur Physik der Atmosphiire (ISSN 0005 8173), Vol. 60, May, 1987, pp. 187-192, Mandelbrot Explorer $30 4 Turcotte, D.L., "A Fractal Model for English language. Peter Garrison Crustal Deformation," Tectonophysics, Vol. 1613 Alvito Way 132 (1986), pp. 261-269. 11 Maddox, J., "Gentle Warning on Fractal Los Angeles, CA 90026 Fashions," Nature, Vol. 322, July 23, 1986, 5 Allain, C. et aI, "Optical Fourier Trans­ p.303. FractalMagic $35 forms of Fractals," Fractals in Physics, Sintar Software Pietronero, L. and Tosatti, E. editors, ISBN P.O. Box 3746 0-444-86995-6, (Amsterdam: Elsevier ••• Belleview, WA 98009 Science Publishers B.v., 1986), pp_ 61-64.

MICRO CORNUCOPIA, #46, Mar-Apr 1989 35 Hacking Sprint: Creating Display Drivers

printers, screens, and terminals. user-accessible '1anguage" can create Brett was one of the original architects of Sound intimidating? It might be, had new commands and menu text. the IEEE 802.5 Token Ring LAN, and Borland not invested a great deal of time A C-like macro language controls the coauthored Living Videotext's ThinkTank and effort to hide much of the complexity interpretation of keystrokes and allows 2.0. He's also an instigator of the annual of this rich environment from the novice. redefinition of EVERY KEY COMBINA­ Hackers' Conference, which makes him a Sprint emerges from the box accom­ TION. So the underlying -like natural for hacking Sprint, Borland's flex­ panied by a menu-driven setup, pop-up editor can emulate the user interfaces of ible new word processor. WordPerfect, Microsoft Word, and Side­ Kick. A configuration '1anguage" controls ife in the Silicon Valley isn't quite how Sprint interacts with the screen and as idyllic as it is in Central Oregon, printer. The Scribe-like formatting '1an­ Lbut it has its pleasures: the chal- My desire to do guage" helps to organize your output. lenge of identifying smog-shrouded And a record-oriented '1anguage" lets friends from 6 feet and the romance of something other you control the SprintMergemail merge. the regional car crawl during rush hour. This configurability makes Sprint a My desire to do something other than than fight the hacker's editor par excellence. fight the gridlock one Friday evening led me to crack the imposing manuals I'd re­ gridlock one Friday Adapting Sprint To A New Screen ceived with Borland's Sprint (the word Each of the languages and interfaces processor). evening led me to in Sprint deserves a small book of its As it turned out, the result justified the own. In this article I'll focus on one of effort. If you're picky about your editing crack the imposing Sprint's more unusual features - its abil­ environment, learning how to hack Sprint ity to run nearly any video display adapt­ will give you unprecedented control over manuals I'd er or terminal. the way you view or manipulate text. During the course of my experimenta­ received with tion with Sprint, I've sent characters to A Complete Word Processor the screen via direct memory mapping, Sprint is the progeny of a long and Borland's Sprint software interrupts, the IBM PC BIOS, distinguished line of text editors and for­ MS-DOS, a serial port, and I/O ports - matters that began at MIT and CMU with (the word all without major problems. Because you 's. EMACS (Editing can load specific processor registers with MACroS) editor and Brian Reid's Scribe processor). selected values and call a software inter­ text formatter. rupt, you can write a TSR that does al­ Versions of these two programs, main­ most anything with Sprint's screen out­ stays of the academic computing commu­ put. nity, first appeared on microcomputers as menus within the editor, and well-chosen To provide a real-world example, Earl MINCE (''MINCE Is Not Complete defaults. Many of you will never need to Hinrichs of PC Tech was kind enough to EMACS") and Scribble. These were the delve any deeper into the mysteries of let me borrow a high resolution mono­ foundations for products such as Perfect Sprint. chrome video board and monitor to test Writer, Amethyst, and Final Word. However, if you do get into the "ad­ Sprint's configurability. Sprint, derived from Final Word II, vanced" portions of the documentation The PC Tech video board, which uses provides almost every feature a user (the Reference Manual and the Advanced a lMS34010 graphics CPU, produces a could ask for. Imagine a text editor that User's Guide), you'll discover that Sprint 736x1024 "portrait" display with up to 66 comes with nine user interfaces, four has unmatched facilities for user customi­ lines by 80 characters. (It looks as if it's built-in '1anguages," a text formatter, a zation and enhancements. possible to get still more characters on the spelling checker, a thesaurus, a file format Figure 1 shows an overview of the screen, but this is the largest number cur­ converter, a mail merge, an automatic Sprint system. Note that, at every place rently supported without a special save feature, and support for dozens of where there's an arrow in the diagram, a driver.)

36 MICRO CORNUCOPIA, #46, Mar-Apr 1989 By Brett Glass p.o. Box 817 Palo Alto, CA 94302-0817

I started out by reading Appendix F "printer," "screen," or "port." Each re­ accessed via the IBM PC BIOS. of the Sprint User's Guide ("Build Your cord consists of the name of a device, fol­ Let's examine this record bit by bit. Own Screen and Printer Drivers"). This lowed by a comma and one or more First, the word "screen" in the first section describes the format of a Sprint fields. Each field gives information about column indicates we're defining a screen "library file" - a file which describes the device, and consists of a field name, a device; the name of the device, ".BIOS," screens and printers to the Sprint con­ space, and a value (if required) for the follows immediately thereafter. figuration utility (SP-SETUP). field. Commas separate the fields. The fact that the name of the device A library file consists of ASCII "re­ A record can span more than one line; begins with a period has special signifi­ cords" that define the characteristics of if it does, lines after the first must be in­ cance. Devices whose names begin this printers, screens, and I/O ports. If you're dented. Comments, which begin with way won't appear on the setup pro­ defining a printer device, there's also a double semicolons, can appear in a re­ gram's menu, but you can create devices construct called a "subrecord" that de­ cord; if they appear in the first' column, that are visible on the menu with a record fines fonts, character widths, attributes, the setup program displays them as you like- and character translation for a printing configure Sprint. device. Library records for screens have fields screen IBM PC BIOS, as .BIOS that specify a large number of options. The Library Record Format Figure 2 shows an example of a library This record will cause an entry called A record in a library file must begin at record (taken directly out of Borland's li­ "IBM PC BIOS" to appear on the screen the left margin and start with the word brary of screen definitions) for a screen setup menu, and the special lias" field

Figure 1 - Sprint System Overview

SprlntMerge Templates and Records Macro/UI Language Text/Commands

Text/Commands

MICROCORNUCOPIA,#46,Mar-Apr1989 37 will invoke all the same field settings as the hidden ".BIOS" device would. The first three fields of the .BIOS re­ Figure 2 - ".BIOS" Screen Definition Record cord, "cur," "up," and "down," are set to the capital letter "B." This setting has a screen .BIOS,cur B,up B,down B, ;; use "bios" calls only special meaning: It causes Sprint to use help 7h, infobox 7h, manu first Ofh, manu 07h, error 070h, the IBM PC BIOS to position the cursor status 070h, select 070h, plain 07h, ;; extra atributes and move it up or down. It's also AA 070H, AB OFH, AC 070H, AD OlH, AE OlH, AJ 020H, AK 070H, AL 07H, AM OlBH, AO 070H, Ap 070H, AQ 070H, possible to place strings in these fields AR 01H, AS 070H, AT 01h, AU 01H, AV 070H, AW 070H, AX OlH, which convert the row and column into a ;; to prevent clear, remove the line below ... cursor positioning string to be sent to a reset HO>AL O>CX l8S0h>DX 7>BH 6 int lOh O>DX>BH 2 int lOh " clear screen on exit - to set color instead of white terminal. ;; use "%>BH" instead of "7>BH" The next group of fields, which in­ /***/ cludes "help," "infobox," "menufirst," "menu," "error," "status," "select," "plain" and a series of control characters, selects the attributes used to paint the screen. You can modify these hex num­ Figure 3 - PC Tech Display Screen Definition Record bers for maximum visibility, or simply to suit your tastes. Finally, the "reset" field tells Sprint screen PC Tech\, 66 lines,as .BIOS, ;; PC Tech mono display (66 lines) what to do when you exit the editor. The map B800h,rows 66,init Cmovescrn\ C\ S\ 80\ 66, string in our example manipulates the reset HO>AL O>CX 4lS0h>DX 7>BH 6 int lOh O>DX>BH 2 int lOh IBM PC hardware directly via the H /***/ (hardware string) construct. The sequence- minute hardware incompatibilities - I then included the field "as .BIOS" in O>AL o>cx l8S0h>DX 7>BH 6 int lOh didn't notice the difference.) the entry, since most of the IBM PC BIOS The display, which uses two bits per calls (cursor positioning and scrolling) puts 0 in AL, 0 in CX, 1850 hex in DX, 7 pixel, maps colors to combinations of work properly even on the larger dis­ in BH, and 6 in AH, then invokes soft­ black, dark grey, light grey, and white, play. This saved a lot of typing and kept ware interrupt lOh. This causes the BIOS allowing most eGA programs to pro­ me from having to respecify all the at­ to clear the screen. duce readable output despite the lack of tributes. Then, the sequence - color. However, because the display was The comment immediately after the acting like a CGA, it limited the text to 25 first line begins at the left margin, so it O>DX>BH 2 int lOh lines at the top of the screen - a terrible appears when the device is selected in waste of high-resolution display space. the setup program. This isn't absolutely puts 0 in DX and BH and 2 in AH, and Fortunately, you can expand the PC necessary, but conforms to what I've invokes Int 10h again. This positions the Tech display to use more of the screen by done for other displays. cursor in the upper left-hand comer of the loading a special TSR, called TSRI0, that The map field tells Sprint the segment screen, in preparation for the DOS communicates with the TMS34010 address of the display, so that it can by­ prompt to appear. graphics processor. Once you've loaded pass the BIOS and write characters This example exploits only a small the TSR, the command - directly to the TMS34010's dual-ported number of the facilities available through memory. Like the CGA, the PC Tech the Sprint library file "language." Other MOVESCRN C S 80 66 board resides at B8000h, unless it's features include a case construct, control specifically remapped to emulate the string formatting, binary arithmetic, and maps more of the display area into the Hercules Graphics Card. direct writes to memory and I/O ports. PC's memory, yielding an 80 by 66 dis­ The rows field tells Sprint how many It's hard to imagine a screen control func­ play. rows the display has. This, combined tion you couldn't write with this lan­ However, at this point Sprint still with the map field, defines the area of guage. wouldn't have known that the display display memory used by Sprint. wasn't a CGA. So I created a new screen The init field tells Sprint to invoke The PC Tech Monochrome Display record (Figure 3) and inserted it into the MOVESCRN as part of the initialization I installed the PC Tech Monochrome MAIN.SPL file on my Sprint program sequence for the board. The backslashes Display in my PC almost without glanc­ disk. before the spaces in the command ensure ing at the instructions. The monitor has This record contains several tricks I'd that the setup program won't mistake an automatic on/off feature that causes it picked up by looking at other device de­ them for the end of the command. to turn on when your PC boots. It scriptions in the MAIN.SPL file. Finally, I set the reset field to a doesn't require a separate power switch First, I wanted the menu entry on sequence almost the same as that for - a very nice touch. Sprint's configuration menu to show the .BIOS - but not quite. By setting DX to I turned my PC on and the board string "PC Tech, 66 lines." However, in 4150h rather than 1850h before invoking came up emulating an IBM CGA card. order to keep the setup program from the clear screen BIOS call, I cause the (The emulation was good enough, by the mistaking the comma for the one that BIOS to clear the screen down to line 41h way, that even IBM's OS/2 Standard comes at the end of the device name, I (65, counting from zero) rather than line Edition 1.0 - known to be sensitive to had to preface it with a backslash. 18h (24) when I exit the program.

38 MICRO CORNUCOPIA, #46, Mar-Apr 1989 When I invoked the SP-SETUP pro­ gram, 10 and behold, the PC Tech display was on the menu - and after selecting it CITIZEN MATE/12 286 SYSTEM I was able to edit a whole typewritten page of text at one time. 80286 With 12.5 MHz Clock Speed Even nicer, I could open eight files on has on the Mother Board: the screen at once and move back and ONE Meg RAM with 1 Wait State forth between them - excellent for Video Controller Supports EEGA, EGA editing programs that span multiple files. CGA, MGA, Hercules and (Then, of course, I wrote a simple macro P1antronics Color Plus that did a "make" on all the files I'd Controller Provides Support for edited. Sprint can be addicting.) Two Hard Drives and Two Floppy Drives, 5.25 and 3.5 Capability Special Fonts And More Mouse, Parallel and Two Serial Ports Just displaying the fonts as different shades of grey, black, and white (as in 1.2 Meg Floppy Installed this configuration) is still barely scratch­ 32k Hard Drive Cache Installed ing the surface of what can be done with 101 Enhanced Keyboard the TMS34010 processor on the PC Tech display board. MS-DOS 3.3 With GWBASIC The graphics CPU is capable of dis­ Small Footprint playing boldface, underlined, subscript, Standard 1MB Expandable to 4MB superscript, strike-through, and other Novelle Compatible fonts on the screen pretty much as Nation Wide Service they're going to be printed, given only a few enhancements to the software on the ********************************$1595.00 board. (The Hercules RAMPont card al­ ready performs some of these functions with Sprint, but since it does them in XT CLONE SYSTEMS hardware it may not be as flexible.) PLEASE CALL FOR CURRENT PRICE At this writing, I haven't yet figured out how to modify the software on the HARD DRIVES FOR XT AND AT coprocessor to display all the variations ST-225 KIT FOR XT (20 MEG) $ 299.00 on the fonts, but it's certainly possible - ST-238 KIT FOR XT and I hope the folks at PC Tech will lend (RLL 30 MEG) $ 319.00 a hand. ST-251 FOR AT (40 MEG) $ 359.00

Macros And Other Business MONITORS Sprint's configurability in one small Color Monitor RGB (CGA) $ 255.00 area (the development of display drivers) Color Monitor RGB (EGA) $ 375.00 gives a hint of what it's capable of doing Monochrome TTL (Green) $ 85.00 in others. I've seen Sprint editing macros Monochrome TTL (Amber) $ 95.00 that play tunes on the PC's speaker, edit EGA Color Video Card $ 159.00 your directory (veteran EMACS users will recognize this as an adaptation of a macro called "DIRED" on older EMACS CITIZEN PRINTERS systems), and perform other functions MODEL 120D 120 CPS 9 $ 165.00 you might not usually see inside an edi­ MODEL 180D 180 CPS 9 $ 185.00 tor. MODEL MSP-15E 160 CPS 15 $ 359.00 The sheer size and scope of Sprint has MODEL MSP-40 240 CPS 9 $ 339.00 bewildered a few reviewers. But there's MODEL MSP-45 $ no question that at least one class of user 240 CPS 15 449.00 (the ingenious hacker) will revel in the MODEL MSP-50 300 CPS 9 $ 399.00 possibilities. If you fall into this category, MODEL MSP-55 300 CPS 15 $ 499.00 or even if you don't, you may want to put Sprint through its paces and see CASCADE ELECTRONICS, INC. what you can.create. ROUTE 1 BOX 8 'RANDOLPH, MN 55065 507-645-7997 • • • Please ADD Shipping on all Orders COD Add $3.00 Credit Cards ADD 5% MN Add 6% Sales Tax Subject to change

Reader Service Number 15

MICRO CORNUCOPIA, #46, Mar-Apr 1989 39 Great C Comparison Of 1989!

"Em" means I used the software floating­ By Scott Robert Ladd Here we go again. This is Version 2.0 of Scott's point emulator, while 1/87" means I used the P.o. Box 61425 "everything you ever wanted to know about C com­ math coprocessor. All tests ran under MS-DOS Denver, CO 80206 pilers." In this updated version you'll get faster v 3.21 on a 16 MHz 80386 PC with a 16 MHz (303) 322-7294 compiles, larger libraries, newer debuggers, and fan­ 80387 math coprocessor and a 28 msec hard cier manuals. drive. I packed the drive so all compiler com­ ponents and source files were contiguous. I used Microsoft LINK v 3.69 if the package es, it's that time of year again ... when didn't provide its own linker. my family wonders about my sanity, Figure 2 summarizes the compilers' features. my friends think I've disappeared, and It lists such things as ANSI compatibility, li­ Y I find myself buried in boxes, disks, brary features, memory models, and tools. and manuals. Once again, I'm reviewing the great hoard of MS-DOS C compilers. The Benchmarks The lineup has changed somewhat. Last To begin with, the benchmarks have under­ year, I looked at 11 compilers; this year it's 12. gone major surgery. Where there were nine Nearly all of last year's compilers (the ones still benchmark programs last year, there are now on the market) have undergone major up­ five. Only two of last year's benchmarks sur­ grades. There are two significant newcomers - vived. The seven deleted benchmarks ran C and MIX Power C. Zortech now under fifty lines in length, and supposedly sells what used to be the Datalight compiler. tested individual features of the compilers. In Mark Williams' Let's C, a fine product I rec­ reality, they tested very little. ommended in '88, is undergoing a major up­ Real-world programs do something, whereas grade to full ANSI compatibility. The people at these tiny benchmarks were simple loops con­ Mark Williams did not want their old compiler taining a few statements. Also, optimizing com­ reviewed with a new product in the wings. As pilers cannot show their mettle on a tiny pro­ soon as I get the new version, I'll cover it in the gram. This year's benchmark suite consists of regular column. longer, more complex programs - a better test My methods have changed a bit. I've spent for optimizers. the past year honing the process, and at SOG DHRYSTONE 2 is a revision of the clar.sic VII several of you suggested things you'd like Dhrystone benchmark. The original author re­ to see. wrote the program in C (the previous version was a C translation from Ada). He also cleaned The Latest Tests up its logic and corrected some bugs. DHRY­ Figure 1 summarizes the results of my latest STONE 2 contains a mix of statements de­ test. For the major benchmarks, I've listed the signed to simulate a theoretically average pro­ top five finishers. Note that, as in the coproces­ gram. Originally designed for comparing sor run-time for GRIND, the compilers at the different hard ware architectures, it's also very top are only a few tenths of a second apart. A useful as a compiler benchmark. compiler which did not make the top five may FXREF was here last year. (See Figure 3.) still have been very close to the leaders. This MS-DOS filter program creates a cross-ref­ All times are shown in seconds; EXE file erence listing of a text file. FXREF reads a file sizes are in K (the size of the executable image from standard input, and breaks it into text divided by 1024). All times are the average of tokens. It then stores the tokens (along with five tests. For QuickC and Turbo C, I used the line number references) in a binary tree. FXREF command-line versions of the compilers. Com­ tests a compiler's I/O and dynamic memory al­ pile and link times were done with optimiza­ location. The input to FXREF was its own tions turned off; after all, an optimizer usually source code. only runs in the final compile. I compared run GRIND has undergone very few changes. times after compiling for maximum speed. (See Figure 4.) It simulates a typical report pro-

40 MICRO CORNUCOPIA, #46, Mar-Apr1989 Figure 1 - Benchmark Results

Borland CWare Comp.ln EcoSoft Lattice Manx Metaware Microsoft Microsoft MIX WATCOM Zortech TurboC DeSmet C86 Plus Eco-C88 C Aztec HIGH-C C QuickC PowerC C C v2.0B v3.1e v1.20D v4.16 v3.31 v4.10C v1.4 v5.10 v1.01 v1.2.0 v6.5 v1.07

Dhry 2 Compile Time6.1 7.3 55.5 10.5 15.4 13.7 24.5 14.7 6.6 16.6 19.7 6.4 Link Time 2.6 5.0 13.1 5.2 7.5 2.4 5.8 3.4 3.5 3.3 8.6 4.7 Em RunTime 20.3 23.6 20.7 23.4 23.7 16.9 19.3 16.6 19.6 21.3 17.9 17.5 Dhryl Sec 2463 2119 2415 2137 2110 2959 2591 3012 2551 2347 2793 2857 Em EXE Size 9.5K 16.5K 14.8K 12.8K 17.3K 7.7K 26.1K 10.7K 10.9K 18.6K 9.5K 10.0K

FxRef Compile Time 4.9 5.3 37.2 9.4 10.7 6.4 22.8 10.4 5.8 11.5 11.6 5.3 Link Time 2.5 4.7 14.3 5.4 7.4 3.4 5.8 3.5 3.5 2.8 9.7 4.5 Em RunTime 41.3 42.6 38.7 38.7 42.8 42.7 39.4 38.6 38.6 39.7 39.1 38.3 Em EXESize 8.4K 13.5K 13.1K 11.6K 15.6K 8.8K 21.2K 8.9K 9.0K 12.2K 7.8K 7.7K

Grind Compile 4.1 6.5 34.0 8.2 9.1 7.1 22.5 9.8 6.0 10.6 12.3 5.0 Link Time 3.1 4.8 20.6 6.4 9.0 2.5 6.9 4.9 5.5 5.0 12.9 5.9 Em RunTime 28.8 34.2 77.4 32.3 30.4 30.6 34.8 26.9 27.6 27.2 24.5 25.1 87 RunTime 24.2 24.6 21.1 23.8 25.4 23.3 21.9 21.9 21.3 22.1 21.2 20.9 Em EXE Size 25.4K 16.5K 36.6K 16.0K 21.2K 11.1K 56.3K 26.1K 26.3K 22.3K 15.5K 19.2K 87 EXESize 15.8K 14.0K 19.6K 16.0K 18.1K 9.8K 50.2K 18.4K 18.7K 19.7K 12.9K 19.1K

Sines Compile Time 2.8 4.0 13.7 4.8 5.5 4.1 17.6 6.4 4.7 5.4 6.5 4.2 Link Time 3.0 4.0 13.5 3.2 5.8 2.4 4.7 3.6 3.6 2.6 10.2 3.6 Em RunTime 138.4 69.5 302.2 62.4 62.7 76.0 114.6 120.0 156.4 37.5 25.1 46.4 87 RunTime 9.6 20.3 10.5 15.4 10.6 23.7 7.9 5.3 10.1 22.7 11.0 9.7 Em EXESize 20.0K 7.5K 24.1K 4.3K 7.7K 5.7K 10.2K 16.9K 16.9K 5.3K 9.7K 6.3K 87 EXE Size 10.4K 5.0K 7.1K 4.3K 6.2K 4.6K 6.2K 9.3K 9.3K 3.7K 9.7K 6.1K

Empty Compile Time 2.4 3.7 8.6 4.1 4.3 2.8 14.7 4.9 3.7 4.4 3.5 3.7 Link Time 2.3 3.7 11.4 2.8 5.3 1.8 3.8 2.4 2.4 2.1 5.2 3.7 Em EXESize 2.3K 4.5K 6.8K 1.7K 5.5K 1.9K 5.7K 2.2K 2.2K 2.1K 1.9K 3.4K

Emulator EXE Size Rankings Coprocessor Run Time Rankings Rank Dhry2 FxRef Grind Sines Empty Rank Grind Sines

1 Manx Zortech Manx Ecosoft Ecosoft 1 Zortech Microsoft 2 Borland WATCOM WATCOM MIX WATCOM 2 Comp In Metaware 3 WATCOM Borland Ecosoft Manx Manx 3 WATCOM Borland 4 Zortech Manx CWare Zortech MIX 4 Microsoft Zortech 5 Microsoft Microsoft Zortech CWare Microsoft 5 Metaware QuickC

Compile Time Rankings Coprocessor EXE Size Rankings Rank Dhry2 FxRef Grind Sines Empty Rank Grind Sines

1 Borland Borland Borland Borland Borland 1 Manx MIX 2 Zortech CWare Zortech C Ware Manx 2 WATCOM Ecosoft 3 QuickC Zortech QulckC Manx WATCOM 3 CWare Manx 4 CWare QulckC C Ware Zortech QulckC 4 Borland CWare 5 Ecosoft Manx Manx QuickC Zortech/C Ware 5 Ecosoft Zortech

Emulator Run Time Rankings Rank Dhry2 FxRef Grind Sines

1 Microsoft Zortech WATCOM WATCOM 2 Manx Microsoft Zortech MIX 3 Zortech QuickC Microsoft Zortech 4 WATCOM Comp Inv MIX Ecosoft 5 QulckC Ecosoft QuickC Lattice

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 41 gram. First, it reads a text file of 1000 alone brother, certainly proves adequate group; a minimum configuration will fit floating point numbers. It then sorts for most debugging tasks. on a 360K floppy disk with some room values and performs calculations. Fi­ The debugger can execute source-line left over! The complete package re­ nally, it writes the calculated values to a by source-line. You can set watchpoints quires only 600K. While there is no in­ disk file. GRIND tests II0 speed, loop and breakpoints and you can change or stallation program, the manual clearly optimization, and floating-point library examine variables. Once you solve a describes the copying process. speed. problem, you merely edit the source Package: You get everything you SINES is a new benchmark. (See and recompile - all within the environ­ need in the basic package - an editor, a Figure 5.) It calculates the sine of every ment. It all works very easily and linker, a compiler, an assembler, and a angle between 0 and 360 degrees. SINES quickly. librarian. (The optimizer is extra.) The is unique in many ways. First, the only Help: The package includes a basic package only compiles to the variables in it are doubles. Second, it memory-resident help facility. It loads small model. The large model option doesn't use a single library function. It into memory and can be accessed from costs extra. primarily tests the speed of the floating­ within any editor via a hot key. The Environment: You can run the com­ point code generated by a compiler. It's help is somewhat context-sensitive. piler from the editor and the editor will interesting that some compilers which Errors: Turbo C does a better-than­ point out compile errors in the source. have very fast math libraries create very average job of warning you about prob­ You can reconfigure the editor to work slow standalone floating-point code. lems. For instance, it will yell if you use with non-IBM compatible MS-DOS ma­ This test generates some surprising a variable before assigning it a value. It chines. numbers. warns you about unused local variables, The assembler is not MASM compat­ EMPTY is not a practical program. but not about unused formal parame­ ible, but should be useful for creating The entire source for it is: mainO{}. It ters. You can control many of the warn­ small routines and functions. was designed to show the size of the ings via compile options. Debugger: You get a source-level compiler start-up code, and how Documentation: The two paperback symbolic debugger. Although not as quickly a compiler could compile noth­ books are reasonably well-written and fancy or sophisticated as some others, it ing. Like SINES, this test generated the tutorial section, friendly. You get does everything you need to track most some unusual results. lots of examples and lots of information bugs. Ah, now on to the meat of this re­ about each function. Documentation: The manual comes view! First, I'll look at each compiler. Unfortunately, Borland still puts in a single three-ring binder. With it Then, I'll discuss overall compiler per­ function descriptions one-after-the­ you get a sheath of update pages, which formance, along with some recommen­ other, instead of beginning each on a you must integrate. The manual has one dations and suggestions. new page. The habit of cross-referencing big deficiency - no index. detailed function information to Finally: While this compiler contains Borland Turbo C v2.0B another, similar function can lead to lots some of the ANSI features, many are In two years, Borland has come from of page flipping. still missing. For instance, it does not in­ nowhere to take a significant portion of Library: The Turbo C library is large clude any of the standard time func­ the MS-DOS C compiler market. While and complete. It supports most of the tions so I had to write a special version it has had problems, version 2.0 is a ANSI standard features and has all the of the DHRYSTONE 2 benchmark. On solid, complete product. MS-DOS extensions we've come to ex­ the plus side, DeSmet C has graphics Borland gives you a lot of bang for pect in a PC C compiler. and direct-video-display functions. your buck. Borland's Graphic Interface (BGI) is This compiler runs fast and produces For $150, the Standard package gives one of the best graphics packages in­ very small .EXE files. The performance you an integrated compiler/editor, a cluded with a compiler. It supports a of resulting programs, however, ranged command-line compiler, and several wide variety of adapters and (at least to from average to below average. programming utilities. my mind-set) appears very well thought For $250, the Professional package out and organized. I especially like the Computer Innovations C86Plus vl.20D adds a command-line debugger and hardware-sensing option which lets you C86Plus arrives with two three-ring macro assembler. As a beginner, a (with some care) write a very portable . binders. I wish I could recommend this hobbyist, or someone on a budget, the graphics program. compiler. It has the most enjoyable Standard package is all you need. You Finally: Turbo C is the fastest com­ documentation to read, filled with anec­ can always add the debugger / assem­ piler in the review, although several dotes and humor. Unfortunately, com­ bler package for $150. others come close. None of its execution piler performance is the worst of the Installation is simple and the pack­ time or size performances were particu­ bunch. age doesn't take a lot of room. In fact, larly exciting. On the SINES test, its You can tell that this compiler is a it's quite easy to use on a dual-floppy emulator came out third from last. little different by the names they give laptop. the tools. For instance, they've named The environment is nice with every­ C Ware DeSmet C v3.le their linker program "Caro1." Their ob­ thing accessed via pull-down menus or This compiler has changed signifi­ ject-module librarian is "Marion." The hot-keys. Its biggest drawback is lack of cantly since last year. Previously, package has all the important tools ex­ mouse support. You can easily cus­ DeSmet followed the K&R standard, ig­ cept an editor and a debugger (an tomize the editor, a Words tar clone (like noring many of the new ANSI features. empty chapter in the manual waits for a all Borland editors). Now, it supports the most commonly future debugger). Debugger: The built-in debugger, used ANSI features, including function Installation: You get an easy to use while not as sophisticated as its stand- prototypes. installation program which lets you set This is the smallest compiler in the the locations of the compiler and tools.

42 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Figure 2 - Compiler Features

Borland Comp.lnn. C-Ware EcoSoft Lattice Manx Metaware Microsoft Microsoft MIX WATCOM Zortech Feature Turbo C C86Plus DeSmet Eco-C88 C AztecC High-C C QuickC PowerC C C v.2.0 v.1.20D v.3.1e v.4.0.16 v.3.31 v.1.4C v.1.4 v.5.1 v.1.01 v.1.2.0 v.6.5 v.1.07

Utilities environment(1 ) Y N Y Y Y N N (8) y (3) (9) Y linker Y y y N N y N y y y y y librarian y y y N y y N y y N y N debugger N N y y (3) Y N y y (3) Y N editor y N y y (3) Y N y y (3) Y y assembler N N y N N y N (3) (3) N N N make y y N (6) N y N y y N y y grep Y N Y N N y N y N N N y profiler N N y N N Y N N N N N N

Models (4) Tiny (.COM) y N N N N N N N N N y y Small y y y y y y y y y y y y Medium Y y N y y y y y y y y y Compact y y N y y y y y y y y y Large y y y y y y y y y y y y Huge y y N N y y N y y y y y Mixed y y N N y y N y y y y y

Code Output .OBJ files Y y (5) y y (5) y Y y N y y OS/2 support N N N N y N (3) y N N N N 80x87 support y Y y y y y y y y y y y 8087 sensing y y N y y y y y y y y y 186 support Y y N N y y y y N y y N 286 support(2) Y y N N y y y y y y y N 386 support(2) N y N N N N (7) N N N N N ROMabie N (3) N N N y N Y N N N (3) Assembler y y y y y y y y y N y y

Source library $150 Y $89 $50 $500 y $2,000 $150 $150 $10 $225 $50 start-up y Y Y Y y y y y y N Y Y

Documentation tutorial Y N N N N y N y y y y N lang. ref. y y N N y y y y y y y N

Support BBS N y y N y y N N N N N N Commercial CIS BIX N N BIX N N CIS N N N N

Other Req's HD N Y N N N N Y Y N N Y N

Notes: (1) Borland, Microsoft, and WATCOM provide integrated environments with the compiler, editor, and debugger built-in. The other products provide an editor which can also run the compiler (and possibly the debugger) while editing a program.

(2) Most of the compilers reviewed support protected-mode programming - only support for the speCial instructions available in real mode on these chips.

(3) Available at extra cost.

(4) Models Tiny - code and data both in 64K (.COM model) Small - small (up to 64k) code, small data Medium - large (up to 1MB) code, small data Compact - small code, large data Large - large code, large data Huge - large code, large data, individual data items can be 64k Mixed - near and far items can be declared in one program unit

(5) Producing .OBJ files requires the use of a special utility.

(6) The compiler has limited, built-in make-like facilities

(7) 80386 protected mode support is available in a seperate product

(8) The large Microsoft Optimizing C compiler package includes Quick C. For example, the editor included with Microsoft C is actually the one from the Quick C environment. Also, although MS C cannot be placed on floppies, Quick C can

(9) WATCOM C comes with Express C, a integrated editor/compiler designed for the educational market.

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 43 C86Plus takes up a significant amount have the windowed interfaces of some of DEBUG. Lattice promised a of disk space, making it difficult to use of the newer debuggers. Still, it does CodeView-like symbolic debugger at on a floppy-based system. what it needs to - it tracks down bugs. COMDEX in 19B7, but no one's seen it Library: C86Plus has a large, robust The compiler contains several inter­ yet. library. The language conforms to most esting features. It can use "make" logic probably supports more of the early drafts of the ANSI standard. on the files specified, so that it will re­ compiler switches than any other com­ And you get typical MS-DOS extensions compile any source files newer than piler in this review. Some of them are such as near and far pointers and direct their object modules. This was provided unique. For example, the -R switch au-, access to video memory. The function, in lieu of a standalone make program. tomatically inserts the object modules zorkO, returns a weird string (ap­ Another compiler switch of interest, into a library. parently) significant to the popular the so-called "picky" flag, behaves like Finally: On the box they state that computer adventure game. the warning level switch found in other Lattice is an "ANSI" compiler. Unfor­ Finally: Running C86Plus is simple; compilers. Eco-C8B includes several lint­ tunately, nothing could be farther from it supports the Microsoft C compiler like capabilities, and the picky flag de­ the truth. Of all the compilers reviewed, switches. The product seems to be very termines how picky the compiler is Lattice is the farthest from compliance. stable. about your code. It doesn't even support simple features, Performance left much to be desired. On the upside, Eco-C8B has a fea­ such as the new Pascal-like function Compiles were so slow I occasionally ture-rich library. It misses some of the headers. And it lacks many of the ANSI wondered if the program had locked ANSI functions but contains other inter­ header files. up. The linker was no better. Programs esting routines, including functions to Lattice C's performance is nothing to ran in average times although they did manipulate binary trees and video dis­ brag about. Its only claim to fame in the very well on the coprocessor and plays. benchmark tables was the performance FXREF execution times. The C86Plus It doesn't have a graphics library and of its floating-point emulator on the floating-point emulator is very slow, some "standard" extended functions, SINES run-time benchmark. Otherwise, often twice as slow as any other emula­ such as the spawnO family, are con­ it compiled slowly and produced aver­ tor. spicuously absent. Only Lattice pro­ age-sized .EXE files. vides less support for the proposed Ecosoft Eco-C88 v4.16 ANSI standard than Ecosoft. Manx Aztec C v4.10c Ecosoft has produced C compilers Performance-wise, Eco-C8B runs Manx puts out compilers for every­ since the days of CP /M. Their MS-DOS about average. Though it generated thing from Apple lIs to 6BOOO-based ma­ offering was one of the first compilers smaller than average code, it took about chines. Its 80x86 compiler for PC com­ to implement some of the ANSI features an average amount of time to do it. The patibles comes in several flavors, rang­ such as function prototypes and void. programs were reasonably fast, and ing in price from $200 to $500. As the There have been few outward changes Eco-CBB did come in fourth in the run price goes up, so does capability. This in this compiler since last year; most of time of the SINES benchmark (using the review looked at the Commercial Pack­ the changes have been minor bug-fixes. emulator.) age, the most expensive (and extensive) Documentation: This package's big­ version available. This compiler has gest weakness is the manual. Contained Lattice C v3.31 changed very little from last year. in a three-ring binder, it's haphazardly Lattice used to be king of the C com­ Installation: Installation directions organized and doesn't contain much of pilers, but Microsoft passed them are sparse and there's no installation the information I looked for. For in­ several years ago and Lattice never re­ program, so you'll find it interesting stance, the package will link several covered. At the rate they're going, they figuring out which directories to create different libraries with Ecosoft pro­ never will. and which files to load. There's no ex­ grams, but the manual provides little Documentation: The manuals have cuse for not having at least a section explanation of when to use the libraries. seen the biggest improvement from last discussing the recommended way to in­ Installation: The installation pro­ year. They're attractively typeset, well stall the product. gram lets you select language com­ organized, and bound in two three-ring Documentation: The manual still has ponents and their location. It also lets binders. two of the problems it had last year - a you place the package on floppies. Installation: Installation is simple. too small binder and poor organization. This compiler uses more environ­ The installation program lets you select Manx adds additional documentation ment variables than any other. The en­ which components to load to disk. The for each release level. Unfortunately, vironment variables show the locations choices lie in a documented configura­ they don't integrate this information and names of libraries, compiler com­ tion file. into the manual. The inserts have ponents, and header files. One environ­ Package: This is a complete package grown to the point that the three-ring ment variable, EPICK, sets the default with several tools, including the editor, binder will not completely close. It's value for the "picky" flag (described debugger, and some unusual items like often difficult to find information when below). an OS/2 binder. Lattice is one of only it's divided among two updates and a Package: Eco-CBB includes the com­ two C compilers supporting OS/2 and two-part manual. piler, a simple source-level debugger, (Microsoft, of Package: This is one of the most and an editor. An object-module librar­ course, being the other.) Lattice does not complete packages I've seen. It includes ian is available separately. The package provide a linker. You can compile pro­ every important utility. Though the edi­ does not include a linker, which can be grams within the editor which will trap tor won't call the compiler, the symbolic a problem if your version of MS-DOS and track errors. debugger, SDB, is nearly as capable as doesn't include Microsoft's LINK. The Debugger: The debugger is very CodeView (or the Turbo Debugger). debugger is nothing fancy - it doesn't primitive, basically a souped-up version Unlike CodeView, it allows an un-

44 MICRO CORNUCOPIA, #46, Mar-Apr 1989 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 Bluestreak Plus Communications (two ports, pro&rammer's interrace, terminal emulation) ...... $400 CQL Query System (SQL retrievals plus windows) ...... $325 GraphiC 4.1 (high-resolution, DISSPLA-style scientific plots in color & hardcopy) ...... $325 PC Curses (Aspen, Software, System V compatible, extensive documentation) ...... $250 NEW! Greenleaf Busmess Mathlib (exact decimal math, formatting, depreciation, interest, cash flow, statistics) $250 Greenleaf Data Windows (windows, menus, data entry, interactive form design)...... $220 NEW! Assembler Kit (by John Zarrella; includes listing generator & loader; requires si~d license agreement) $175 Greenleaf Communi~tions Library (inteITUpt mode, modem control, XON-XO[''C'') ...... $175 ThrboTFX (TRIP certified; HP, PS, dot dnvers; CM fonts; LaTEX) ...... $170 NEW! Sherlock (C debugging aid) ...... $170 Greenleaf Functions (296 useful C functions, all DOS services) ...... $160 Essential C Utility Library, Communications Library, or Resiaent C ...... $160 Essential Communications Ubrary (C functions for RS-232-based communication systems) . . . . . $160 WKS Ubrary Version 2.0 (C program interface to Lotus 1-2-3, dBase, Supercalc 4, Quatro, & Clipper) $155 OS/88 (U ..x-like operating system, many tools, cross-development from MS-DOS) ...... $150 ME Version 2.1 (programmer's editor with C-like 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 Library (all popular adapters, hidden line removal) ...... $135 ThrboGeometry (library of routines for computational geometry) ...... $125 CB1tee (B+tree ISAM driver, multiple variable-length keys) .... $115 Minix Operati_ng System (U ••x-like operating system, includes manual) $105 PC/IP (CMU/MIT TCP/IP implementation for PCS) ...... $100 B-'free library & ISAM Driver (file system utilities by Softfocus) ...... $100 Thle Operating System (ThleKernel, TeleWindows, TeleFile, & TeleB'Iree by Ken Berry) . . . $100 The Profiler (program execution profile tool) ...... $100 QC88 C compiler (ASM output, small model, no longs, floats or bit fields, 80+ function library) . $90 Wendin Operating System Construction Kit or PCNX, PCVMS O/S Shells ...... $80 C Windows Tholklt (pop-up, pull-down, spreadsheet, CGA/EGA/Hercules) ...... $80 JATE Async Thrminal Emulator (includes file transfer and menu subsystem) ...... $80 Polyglot Lisp-to-C 'Iranslator (includes Lisp interpreter, Prolog, and simple calculus prover) $80 MultiDOS Plus (DOS-based multitasking, mtertask messaging, semaphores) ...... $80 NEW! Kinetic Image Synthesizer (3-D animation system '" Saturday morning on your PC!) ...... $75 XT BIOS Kit (roll your own BIOS with this complete set of basic in~ut/output functions for XIS) $75 TE Editor Developer's Kit (full screen editor, undo command, multiple windows) ...... $75 Professional C Windows (lean & mean window and keyboard handler)...... $70 NEW! Heap Expander (use LIM-standard expanded memory as an extension of the heap) ...... $65 lp (flexible printer driver; most popular printers supported) ...... $65 Qumcy (interactive C interpreter) ...... $60 P1tee (parse tree management) ...... $60 OBJASM (convert .obj files to .asm files; output is MASM compatible) ...... $50 NEW! Icon-Thols (full-featured icon display and editing system) ...... $60 NEW! Polyglot TSR Package (includes reminder, bookmark, virus catcher, cache manager, & speech generator) $50 HELP! (pop-up help system builder) ...... $50 Multi-UserBBS (chat, mail, me~us! sysop displays; uses Galacticomm modem card) ...... $50 Make (macros, all languages, bUllt-m rules) ...... $50 Coder's Prolog (inference engine for use with C programs) .,. $45 Virtual Memory System (least recently used swapping) . . . . . $40 CeNotes (pop-up help for C programmers ... add your own notes) . $40 Heap I/O (treat all or part of a disk file as heap storage) . . . . . $40 Biggerstaff's System Thols (multi-tasking window manager kit) . . $40 OOPS (collection of handy C++ classes by Keith Gorlen of NIH) $35 PC-XINU (Comer's XINU operating system for PC) ...... $35 CLIPS (rule-based expert system generator, Version 4.2) .... $35 Tiny Curses (Berkeley curses package) ...... $35 NEW! Polyglot RAM Pisk (change disk size on the fly; includes utilities) . $30 SP (spelling checker with dictionary and maintenance tools) . . . $30 Clisp (Lisp interpreter with extensive internals documentation) ...... $30 TIanslate :Rules to C (YACC-like function generator for rule-based systems) $30 6-Pack of Editors (six public d(;miain edito~ for use, study & hacking) . . . $30 Crunch Pack (14 file compression & expansion programs) . . . . .' . . . . '.' . . $30 NEW! Install (automatic installation program; user-sefected partial installation; CRC checking) $25 Pascal Compiler & Interpreter or Pascal-to-C 'Iranslator (P-codes, standard Pascal) . . $25 ICON (string a!ld list processing language, ~ersion 7.5) ...... $25 FLEX (fast lexical analyzer generator; new, Improved LEX) . . . . . '...... $25 LEX (lexical an~~er generator; an oldie but a goodie) ...... $25 . Bison & PREP (YACC workalike parser generator & attribute grammar preprocessor).. . $25 Auto'frace (program tracer and memory trasher catcher) ...... $25 Data HandlIng Utilities in C (data entry, validation & display; specify Thrbo C or Microsoft) $25 Arrays fOr C (macro package to ease handling of arrays). . . . . $25 ANSI Forms iforms manager based on ANSI codes) ...... $20 C Compiler Thrture 'lest (checks a C compiler against K & R) . . $20 Benchmark Package (C compiler, PC hardware, and Unix system) $20 A68 (68000 cross-assembler) ...... $20 Ust-Pac (C functions for lists, stacks, and queues) .,. . . . . $20 XLT Macro Processor (general purpose text translator) . . . . . $20 Clreativity (Eliza-based notetaker) ...... $15 Data DNA Sequences (GenBank 55.0 including fast similarity search program) ...... $150 Protein Sequences (5,415 seCJ,uences, 1,302,966 residuals, with similarity search program) . . . $70 NEW! SIC Codes (each SIC code With the name of the industry to which it UplieS) ...... $70 Dictionary Words (234,932 words in alphabetical order, no definitions ...... $60 U. S. Cities (names & longitude/latitude of 32,000 U.S. cities and 6,0 state boundary points) . $35 Tbe World Digitized (100,000 longitude/latitude of world country boundaries) . $30 KST Fonts (13,200 characters in 139 mixed fonts: specify 1J3X or bitmap format) $30 USNO Floppy Almanac (high-precision moon, sun, planet & star positIOns) . . $20 NBS Hershey Fonts (1,317 strOKe characters in 14 fonts)...... $15 U. S. Map (15,701 points of state boundaries) $15 The Austin Code Works Voice: (512) 258-0785 11100 Leafwood Lane [email protected] BBS: (512) 258-8831 Austin, Texas 78750-3409 USA Reader Service Number 4 FAX: (512) 258-1342

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 45 limited number of breakpoints and can compiler has one of the most boring li­ port. I still think of CodeView as a fine use keyboard macros. SDB does not braries in the group with operating sys­ prod uct, in spite of its reliance on the support a mouse. tem access functions, but no graphics li­ archaic DEBUG and SYMDEB com­ The Commercial Package has brary. mand set. complete facilities for the creation of Finally: High-C's performance is me­ Editor: The Microsoft Editor (ME) ROMabie code. As the benchmark table diocre. Its compile times beat only would be a much better product with shows, Aztec C produces very small ex­ C86Plus and it produces large executa­ usable documentation (it's better for ecutable files. bles. While High-C advertises as an op­ quick reference). However, if you spend Finally: I found Aztec C easy to timizing compiler, it doesn't match the the time, you'll find ME extraordinarily work with. The compiler has a simple performance levels of some non-op­ powerful. In many ways, it resembles syntax and only a few switches. En­ timizing products. High-C turned in its Brief. vironment variables locate headers and best performances on the coprocessor It does, however, have some unique libraries. My only problem came when run-time tests for GRIND and SINES, capabilities. Instead of a built-in pro­ trying to change the stack size. The where it came in fifth and second, re­ gramming language, ME lets you write manual documents three variables spectively. extensions in either C or Macro Assem­ which must be set when there are actu­ bler. You then compile them and they're ally four LSTKRED must be set to the Microsoft C v5.10 linked in at run-time. (They're lightning minimum clearance between the stack This is the industry standard. As a fast.) and heap.) Again, the documentation is leader, it has its critics (who have some Using the Microsoft compiler is easy. the weakest part of this package. valid points). However, an overall view A large number of switches control Aztec C did very well in the bench­ shows that Microsoft C has not become everything from code generation to the marks. The compiler runs fast and the standard merely because of the rep­ listing format. No other compiler fully generates small programs. While not utation of its parent. supports OS/2, including multi-thread amazing, the performance of the Installation: Microsoft has continued programs and dynamic-link libraries. generated programs is at least average. to improve its installation program. It's I've heard through the C community Aztec C came in second in the execution very flexible, giving you control over that Microsoft C 5.10 is buggy. It gained speed of DHRYSTONE 2. what's put where. You can even change this reputation with 5.00. Microsoft libraries without reinstalling the entire rushed 5.00 to market, though that Metaware High-C vl.4 package. package had a significant number of This product hasn't changed from Documentation: The documentation bugs. last year. High-C's ads proudly pro­ package includes three two inch thick When 5.10 came out, it retained the claim that it was used to create several three-ring binders containing six manu­ stigma of its predecessor. I've had no popular products (including dBASE als, along with a paperback reference problems with the compiler, although III/IV and Q&A). However, it's quickly manual for QuickC. Microsoft's docu­ there still could be some. losing ground in that arena to Micro­ mentation is very thorough and liber­ Of course, misunderstandings about soft, WATCOM, and others. ally indexed. the optimizer could also generate bug Installation: Metaware's installation Unfortunately they haven't inte­ reports. program copies the compiler com­ grated the upgrade for version 5.10 so For instance, the lOa (included in ponents to any directory but there's no you have to look in at least two places the catchall lOx switch) optimization way you can run this package from a to be sure you have the correct informa­ switch tells the compiler to ignore the floppy. The compiler takes up over tion. I don't understand why companies possibility of aliases in the program 600K! with looseleaf binders can't integrate code. You get an alias when a memory Documentation: The manual barely their updates. location gets modified by more than one fits into its three-ring binder. Divided Package: Microsoft includes a cornu­ variable. (Often occurs when using into three sections, each with its own copia (appropriate for Micro C) of utili­ pointers heavily.) index, this is one of the better manuals ties and tools with their C compiler. The Aliasing makes C harder to optimize in the group. It contains complete, most extensive of these is QuickC, an than other languages. The programmer clearly written information. environment-based compiler sold sepa­ needs to be aware of what aliasing is, to Only High-'c supports "profiles," rately (see the separate discussion of be sure it's safe to use the /Oa switch. files which contain compiler directives QuickC below.) Recent additions in­ Finally: Microsoft C performs very and instructions. You create specific clude a powerful editor and a grep util­ well. It compiles slowly, but that profiles for specific projects, thereby ity. shouldn't be a problem with QuickC in­ customizing the compiler's behavior. Debugger: CodeView is Microsoft's cluded in the package. I use QuickC for Library: Metaware doesn't provide windowing, source-level debugger. It most of my preliminary compiles, un­ many utilities. It has no librarian or looks a bit long in the tooth when com­ less I'm using some features available linker. The only utilities included are a pared to products like Borland's Turbo only in its big brother. GREP and a source code cross-refer­ Debugger, but is still one of the best . Microsoft C generates fast code - it encer. While many experienced pro­ source-level debuggers available. won the DHRYSTONE 2 benchmark by grammers don't use built-in utilities, CodeView lets you track and view data a considerable margin, though it pro­ beginners usually find them very use­ throughout the execution of a program. duces larger than average .EXE files. ful. It does line-by-line and animated (slow Probably its biggest failure was the High-C implements many common motion) execution. You can store debug­ SINES benchmark, where its emulator ANSI features, but it has a long way to ger commands in a script file. performance was very poor. It's only go before it's in full compliance. The li­ One CodeView feature is sadly lack­ fair to note that Microsoft offers an al­ brary doesn't include any extras. This ing in other debuggers - mouse sup- ternative math library -less accurate

46 MICRO CORNUCOPIA, #46, Mar-Apr 1989 than the emulator library, but consider­ Figure 3 - FXREF.C ably faster. /* Microsoft QuickC 1.01 Program: FXREF (File Cross-Reference) Microsoft's QuickC integrates editor, Version: 1.10 compiler and debugger functions. By Date: 21-Sep-1988 the time this review reaches the stands, Language: ANSI C version 2.00 will be out. Version 2 is a Reads a file from standard input, and sorts and organizes each token· complete rewrite of version 1.01, with (word) found using a binary tree, keeping track of the number of oc­ curences of each token and their location by line and column. It then many new features. Therefore, I'll keep prints a report to stdout. this discussion short. Released into the public domain for educational purposes. Quick C comes with a set of paper­ */ back manuals. Like the "big" Microsoft 'include "stdio.h" compiler, Quick C installs easily. It ,include "string.h" ,include "ctype.h" doesn't work well from floppy disks­ ,include "stdlib.h" it simply requires too much disk swap­ ping, even with the special overlay pro­ /* type definitions */ typedef unsigned short line_no; vided. Quick C offers most of the features typedef struct loc s { - of the big Microsoft compiler, though it line no line; doesn't support most of the optimiza­ struct loc s * next; tions. Microsoft produced QuickC for } - location; folks learning the C language. They typadef struct tok s figure those of you interested in an op­ { - timizing compiler will buy the larger struct tok s * less, * more; char * text; package. struct loc s *loc, *last; The package also includes a com­ } - token; mand-line version of the compiler­ token * root; merely a driver which runs the inte­ char * err_msg[] = { grated environment. It also includes a "token table root", "token text", complete set of command utilities, along "location references", with a make and a librarian. "token record" Finally: Quick C really performs. It } ; /* function prototypes */ compiles very quickly (as its name int main(void); would imply), and produces very fast void parae tokens(char *, line no); void add tree(char *, line no); programs. QuickC out performs Bor­ token * find tree (char *);- land's Turbo C (its most common rival) void show tree(token *); in most of the .EXE run-time bench­ void error(short); marks. Its worst performance came on int main() the emulator run-time test for SINES, { where it ranked second slowest. (Micro­ char buf [256] ; line no line=O; soft doesn't offer an alternative math li­ if (NOLL == (root = ( token *)malloc(sizeof( token»» brary for QuickC.) error(O); root->less = NOLL; root->more = NOLL; MIX Power C vl.2.0 root->text = NOLL; You won't find a less expensive com­ root->loc = NOLL; while (NOLL != (fgets(buf,2S6,stdin») piler available, for any language. At $20 ( (basic package), Power C costs less than ++line; most computer books. printf("'Su: 'a",line,buf); parse tokens(buf,line); Installation: Nothing fancy here, you } - just copy the compiler to floppy disks printf("\xOC\n"); show tree(root); or your hard drive. Everything about return 0; this package is budget-level, except for } the manual. void parse tokens(char * buf, line_no line) Documentation: MIX worked hard { - to create a manual useful to the novice char tok [256] ; C programmer. The tutorial contains line no pos; while (1) one of the best explanations of pOinters { I've seen. while «!isalpha(*buf» && (*buf != 0» ++buf; The manual does have problems, if (*buf == 0) though. They've separated the informa­ return; tion on compiler switches from the in­ poa = 0; while (isalpha(*buf» structions on running the compiler. The tok[pos++] = *buf++; manual includes compile options that tok[pos] = 0; continued next page don't work yet (the READ.ME file notes

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 47 this). The error reference section merely lists the error messages, there's no ex­ add tree(tok,line)i planation of them. } - Package: For $20, you get the com­ piler and linker - that's it. MIX's op­ void add tree(char * tok, line_no line) timizer is part of the compiler's code { - token *temp tok, *new toki generator. location *t8mp lOCi - The compiler does support a wide short comp; - if (root->text == NULL) variety of floating point options but has { only one memory model- medium. if (NULL =- (root->text = This is why I did Power C's bench­ (char *)malloc«unsigned)strlen(tok)+l») error(l)i marks with the medium model while I strcpy(root->text,tok); used the small models for other com­ if (NULL == (root->loc = pilers. ( location *)malloc(sizeof( location»» error(2)i Additional packages are available. root->loc->line = line; The CTrace debugger costs $19.95, as root->loc->next = NOLLi root->last = root->lOCi does a database toolbox and a BCD return; math package. The library source code } sells for $10 and contains a simple 8088 temp tok = find tree(tok)i if (comp = strcmp(tok,temp tok->text» assembler as a bonus. /* comp is true (non-zero) if they don't match */ As with all advertising claims, the { if (NOLL == (new tok = ( token *)malloc(sizeof( token»» comparative performance chart in the error(3); - Power C ads and on the back of its if (NOLL == (new tok->text = manual are a bit optimistic. It compiles (char *)malloc«unsigned)strlen(tok)+1») error(1); fast, but nowhere near as fast as Bor­ new tok->less = NOLLi land and Zortech. It produces small, new-tok->more = NOLLi swift programs, but not usually the strcpy(new tok->text,tok)i if (NULL - (new tok->loc = fastest. The most spectacular perform­ ( location *)malloc(sizeof( location»» ance by Power C was on the emulator error(2)i tests for the GRIND and SINES. Only new tok->loc->line = line; new-tok->loc->next = NOLLi WATCOM beats Power C's 37.5 seconds new-tok->last = new tok->loCi on the emulator run time test for SINES. if (comp < 0) - temp tok->less = new toki else - - WATCOMCv6.5 temp_tok->more = new_toki WATCOM gives Microsoft a run for else its money. A spinoff from the Univer­ /* if comp is false (0), the tokens match */ sity of Waterloo in Canada, the com­ { pany is well-known for its mainframe if (NOLL == (temp loc = ( location *)malloc(sizeof( location»» FORTRAN compilers (WATFOR and error(2); WATFIV). When they entered the PC temp loc->line = linei temp-loc->next = NOLL; market last year with version 6.0 of temp-tok->last->next = temp loc; their C compiler, they made a splash temp-tok->last = temp lOCi - that is still sending ripples through the } -- MS-DOS C community. Installation: WATCOM includes a token *find_tree(char * tok) simple program for installing the com­ ( short COmpi piler and its components onto a hard token *nodei drive. (Don't even bother trying it on node = rooti while (1) floppies.) As with most compilers, it ( uses environment variables to direct the if (0 == (comp = strcmp(tok,node->text») compiler and utilities to needed files. return node; if (comp < 0) Documentation: They've divided if (node->less -= NOLL) documentation into five spiral-bound return nOdei books. You also get a stack of quick ref­ else node - node->lessi erE:nce guides, one for each major pro­ else gram. All the manuals have complete, if (node->more .. NOLL) return nodei and logical, indexes. else Package: This package has every­ node = node->more; thing, though the editor isn't particu­ larly exciting. It emulates the old IBM mainframe editors by being slow and void show tree(node) clumsy. But at least it exists. token *node; { Debugger: The debugger is not as location *lloCi easy to use as its competitors, but it has short POSi if (NOLL == node) returni plenty of features. For instance, I show_tre.(node->less)i

48 MICRO CORNUCOPIA, #46, Mar-Apr 1989 couldn't figure out how to remove the printf("%-32s: ",node->text); assembler trace window. The debugger pos = -1; lloc = node->loc; doesn't remember the video mode of while (lloc != NULL) the program being debugged. If the de­ { if (++pos == 7) bugger is in 43-line mode on an EGA, { so is the output from your program. pos = 0; However, you can assign actions to printf("\n%32s: "," "); } watchpoints, something sadly lacking printf("%5d ",lloc->line); from CodeView and Turbo Debugger. lloc = lloc->next; Express C is WATCOM's integrated } printf("\n") ; compiler. Often, it produces .EXE files show tree(node->more); over 80K larger than necessary because } - it includes debugging information. void error(short err no) However, as a prototyping tool, Express { - C is very good. The editor and debug­ printf("\nFXREF ERROR: Cannot allocate \ space for %s\n", err msg [err no]); ger are versions of the standalone utili­ exit(err no+l): - ties, and work well enough for a class­ } - room. Express C runs much faster than /***/ the main C compiler does. W A TCOM C has a very interesting Figure 4 - GRIND.C code generator. One of the reasons for its sterling performance is that the com­ /* Program: Grind piler deftly uses AX, BX, CX, DX, 51, and DI to store function parameters. Version: 1.11 Date: 26-0ct-1988 Language: ANSI C (You can disable this feature.)

Tests all aspec~s of a C compiler's functions, including disk i/o, screen Finally: The W A TCOM C compiler i/o, floating point, recursion, prototyping, and memory allocation. It runs relatively slowly but it produces should be a large enough program to test the advanced optimizers in some small, fast programs. (WATCOM C's compilers. Developed by Scott Robert Ladd. This program is public domain. floating-point emulator is amazingly */ fast.) WATCOM, however, has a prob­ #include lem compiling the SINES benchmark for #include the coprocessor. When I forced it to use #include inline coprocessor instructions (the -7 #define MAXFLOATS 1000 switch), the resulting program went into an infinite loop. struct tabent { double val, vsum, vsqr, vcalc; ZoItech C vl.07 } ; Zortech now sells what used to be struct tabent table[MAXFLOATS]; Datalight Optimum-C. In fact, they've managed to improve the product. char *errmsg [] = Installation: An automated installa­ "GRIND. TBL cannot be created", "GRIND.TBL cannot be closed properly", tion program lets you select files and "GRIND. IN cannot be found", directories for this package. You can "GRIND.IN has been truncated", "GRIND.IN cannot be closed properly" also set an array of environment varia­ } ; bles to configure the compiler. Zortech C can easily run on a floppy disk-based /* function prototypes */ short main(void); Pc. void readfloats(void); Documentation: You get a 600 page void sortfloats(void); paperback which includes a simple in­ void quicksort(struct tabent *, short, short); void maketable(void); troduction to C, a description of com­ void writetable(void); piler switches and components, and a void error(short); look at optimization. short main (void) Package: The only tool missing from { this product is a debugger. Zortech will puts("\nGrind (C) vl.10 -- A Benchmark Program\n"); readfloats(); have a symbolic debugger available sortfloats(); sometime in early 1989. In the mean­ maketable(); time, version 1.07 fully supports Micro­ writetable () ; puts("\7End run GRIND!!!"); soft's CodeView. return(O); The ZED editor was designed for } programming. You can compile pro­ void readfloats() grams from within it, and track the er­ { rors in the edit buffer. register short i; char buf[12]; Zortech provides a memory-resident, FILE *fltsin; context-sensitive help facility. It will pr1ntf("--> Reading in floats. At # "}; continued next page work from inside any editor. Pressing if (NULL = (fltsin = fopen("GRIND.IN","r"»)

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 49 the help hot key will bring up a subject error (2) ; related to the item at the current cursor for (i = 0; i < MAXFLOATS; ++i) location. This way you get help while { working in your favorite editor. printf ("\b\b\b\b\b%5d", i); if (NULL == fgets(buf~12,fltsin» Zortech C includes several utilities. error(3); Many of these, such as the timer and table[i).val = atof(buf); } grep programs, come with source code. if (fclose(fltsin» Library: The Ii bra r y i s quit e error(4); complete. It includes several standard printf("\n") ; functions, such as strtokO and sleepO, } not mentioned in the manual. (I also no­ void sortfloats() ( ticed they'd left out or misplaced ex­ putS(" __ > Sorting data"); amples in the function reference sec­ quicksort(table,0,MAXFLOATS-1); tion.) Zortech has supplied a graphics } library (as have other vendors) and void quicksort (struct tabent * item, their Flash Graphics are very fast. short left, Unlike Datalight, Zortech doesn't in­ short right) clude the source to the library functions. register short i, j; Source costs you an extra $50. struct tabent x, y; Finally: On the benchmark tests, i = left; j = right; Zortech C did amazingly well. It com­ x = item[(i+j)/2); piled very rapidly and produced small do { .EXE files. Zortech showed up in almost while (item[i).val < x.val " i < right) i++; all the "top five" charts in the bench­ while (x.val < item[j).val " j > left) j--; mark table. Its file I/O and floating­ if (i <= j) ( point emulator performed admirably. y = item[i); Were I to rank compilers solely by per­ item[i) = item[j); formance, Zortech would lead by a item[j) = y; i++; wide margin. j--; } } Considerations while (i <= j); If you expect me to tell you which if (left < j) quicksort(item,left,j); compiler to purchase, you're going to be if (i < right) quicksort(item,i,right); disappointed. The compiler you need } depends upon your resources and what void maketable() you're doing. Remember that these are ( register short i; only benchmarks, not real life, and a double sum = 0.0; group of comparisons won't be as putS(" __ > Calculating table values"); for (i = 0; i < MAXFLOATS; ++i) thorough as individual reviews. ( Microsoft C has slipped a bit (in sum = sum + table[i).val; comparison to the other products) since table[i).vsum = sum; table[i).vsqr = table[i).val * table[i).val; last year, but remains an excellent table[i).vcalc = sqrt(fabs(table[i).val» * value. It provides a robust environment log10(fabs(table[i).val»; and good performance. You can pick up this package for under $300 from many mail order houses. (Watch for object­ void writetable() ( oriented facilities. They've scheduled a FILE *fd; new release for mid-1989.) register short i; WATCOM C has taken the MS-DOS if (NULL == (fd = fopen ("GRIND. TBL" , "w+"») error(O); C world by storm. If you work with puts ("--> Writing Table to File"); floating point, there is no other choice. for (i = 0; i < MAXFLOATS; i = i + 10) ( This compiler's biggest liability is com­ fprintf(fd, pile time. Otherwise, it performs amaz­ "val = %5.2f, sum = %5.2f, sqr = %5.2f, calc = %5.2f\n", ingly well. Watch for version 7.0, due table[i).val, table [i) . vsum, out in early 1989. table[i).vsqr, Borland's Turbo C is blazingly fast. table [i) .vcalc); It doesn't produce the fastest executa­ } if (fclose (fd» bles, but it's still faster than average. error(1); Borland's produced an amazing debug­ ger and an excellent graphics library. void error(short err no) Manx Aztec C remains a good value. ( - It comes with a great debugger and is printf("\n\7GRIND ERROR: %s\n",errmsg[err_no); exit(err no); optimized for producing ROMable } - code. Anyone who works with /***/ embedded systems should have Aztec

50 MICRO CORNUCOPIA, #46, Mar-Apr 1989 C. This compiler would also be a good choice in environments where code must run on different architectures. Figure 5 - SINES.C Power C is an excellent performer at an unbelievable price. MIX has finally worked the bugs out of their product, 1* making it one of the best values going. I Program: Sines recommend this compiler to students Version: 1.00 and beginners. For number crunchers Date: 29-Nov-19BB Language: ANSI C on a budget, it performs nearly as well as WATCOMC. computes all of the sines of the angles between 0 and 360 degrees. However, with all those comments Developed by Scott Robert Ladd. This program is public domain. *1 aside, one compiler stands out in my mind as an outstanding value. Zortech #define pi2rad 57.29577951 C has continued the reputation it 1* prototypes *1 earned as Datalight C, by providing ex­ void main(void); cellent code quality and compile speed double fact(double); double power(double, double); for a small amount of money. Zortech appeared in the benchmark void main() summary charts 15 out of 18 times; no { double angle, radians, sine, worksine, tamp, k; other compiler matches this perform­ ance. Many programmers interested in for (angle = 0.0; angle <= 360.0; angle += 1.0) the quality of the code they put out { radians = angle 1 pi2rad; have chosen this compiler. Those pro­ k = 0.0; grammers looking to the future may worksine = 0.0; want to purchase the Zortech C++ pack­ do age which includes this C compiler. sine = worksine; While you use their powerful compiler, tamp = (2.0 * k) + 1.0; worksine += (power(-1.0,k) 1 fact(tamp» * you can also learn about objects. power(radians,tamp); k += 1.0; The Future of C } while (sine != worksine);. By this time next year, some vendors } will have upgraded their compilers from C to C++ (or some other object­ 1* Note: this function is designed for speed; it ONLY works when n is inte­ oriented variant of C). Zortech's C++ gral *1 product is already on the market. Like double fact(double n) { the move to in double res; the seventies, object-oriented program­ ming will forever change how we write res = 1.0; programs. In the issues ahead, I'll look while (n > 0.0) at some of the reasons C is the basis for { res *= n; the languages of the 1990s. n -= 1.0; } Next Issue return res; In the May /June 1989 issue, I'll talk } about the use of some of the tools and utilities commonly associated with C. 1* Note: this function is designed for speed; it ONLY works when p is integral *1 I'll also discuss some of the differences double power(double n, double p) between the ANSI and K&R standards. { double res; Some are more significant than you might think. res = 1.0; Several of the manufacturers are while (p > 0.0) readying major upgrades as I write this { (the last week of November). So I'll talk res *= n; about these. p -= 1.0; } Micro Assembly return res; On Memorial Day weekend 1989 (May 27-29), we're holding a Micro As­ 1***1 sembly here in Denver, Colorado, at the Clarion Hotel (Airport). Registration costs $35 before the convention, and $50 at the door. Get in touch if you're inter­ ested. • • • MICRO CORNUCOPIA, #46, Mar-Apr, 1989 51 Screen Fonts For Windows & Gem Unpacking Bags & Bits

By Laine Stump "I don't want you to waste your time click­ PC Tech Wow, Laine's body may be in Minnesota, but his ing dots on and off with a mouse, though." 907 North 6th Street mind certainly hasn't cleared customs. You'll hear Earl continues. "What I really want is a pro­ Lake City, MN 55041 more as he unpacks. Meanwhile, on to the body of gram that converts between Windows and Gem his column. raster fonts, and our own internal 34010 for­ mat." "Oh." o, I'm fresh off the boat, see? Well, off So, armed with the Windows Developer's the plane anyway - you know, newly Kit, the Gem Programmer's Toolkit, Zortech arrived in the country, ready to tackle C++, and my favorite coffee cup (you must see ssome hot high tech. I've been dreaming it to appreciate it), I set off on my week long of this for months. Yeah, get back to good 01' quest to understand binary images, discover PC Tech and maybe do something new and ex­ new storage methods, to boldly figure out what citing. Like write a multitasking kernel for a the hell is going on. 34010 ... a video driver for a high res board ... a ROM BIOS for a 386. Maybe implement LIM So Where Was I? 4.0 for a new version of the 16 Megger. Oh yeah ... fonts. That's it! Well, see, it turns Anyway, I'm walking into the office, right? out that there ate hundreds of fonts in the pub­ First stop after the airport and a night on the lic domain, if you just know where to find floor at La Guardia. Slept across the carpet them. Don't ask me; I don't know where to find from an old guy named "Jackson." He had two them. sweet rolls and a can of Blitz for breakfast and Anyway, knowing that there's lots of free said someone was coming to pick him up. fonts out there (seriously!) should give you the First chance to relax since sharing overnight desire to read on. Please? baggage watch duty with two Iranian senior Here at PC Tech, we got several fonts in­ citizens who came in on the same flight. First cluded with "GFX Fonts," a font display library real moment of non-anxiety since being ap­ used with the GFX Graphics Library from a proached by a street dude asking me, "What company called C Source. I can't tell you much kinda stuff you got there, man? Got enough for about C Source or GFX Fonts, since I only me?" (This happened while I was taking out wanted to translate their fonts into another for­ my contact lenses, sitting in the lounge chair mat. right across from the Piedmont check-in All I can tell you is that their font editor counter.) failed to run on a Hercules card (although it Where was I? Oh, yeah. So, I'm walking into ran fine on an EGA). And their font files con­ the office, okay? Well, "Earl," I ask, "What am tained deviations from the Gem standard they I gonna work on? Whaddya got planned for were supposed to follow. But that's just first me?" impressions, so ignore it, huh? Besides, it in­ So Earl says, "Well, I'm finishing the soft­ cludes all the source code, so you can change it ware for this new 34010 mono board with if you want. Group 4 FAX image decompression built in Anyway, there are all kinds of fonts around. and ... " ("0h yeah!" I'm thinking. "This is Balloon fonts, cartoon fonts, Olde Englishe gonna be hot!!") " ... and I'm still using the 9 x Fonts. We even put a Cyrillic font into ROM on 15 font from the 736 x 1024 CPT monitor, but one of the 34010 boards just for fun (we're try­ this new 2048 x 1536 Moniterm needs some­ ing to land a contract with the KGB, but don't thing larger, like about 12 x 23." tell anyone). Whaatttt?? I just sold my X24/Rabbit If people just had enough information to use Portable for plane fare! I've left my friends and these fonts ... (Hah! I knew I'd squeeze a topic life of sun and leisure! I've come 9,000 miles to out of this somewhere!). click dots on and off with a mouse?!?!?

52 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Abstract The programs I ended up with are Figure 1-Typical Simple Font Structure too special-purpose (and too ugly) to put on public display in their entirety. But documentation and explanation of typedef unsigned char[HEIGHT] character; the font files themselves are worth talk­ typedaf character[256] font; ing about. So I'll explain the format of /***/ Windows raster font files and Gem font files, and give you a couple program­ ming examples so you can use them. Then, as an example of "something completely different," I will briefly de­ scribe PC Tech's own "PCT" font file, Figure 2 - Unpacked Linear Format newly created by a committee of 1.5. (I asked Earl's opinion now and then, but bit mostly ignored what he said.) 7 6 5 4 3 2 1 o First I'll discuss a few different possible font formats. 6 0 1A 1A 1A 1A 1A 1A y How To Represent A Character T 1 18 16 18 18 16 16 When asked to come up with a data structure for a graphics representation E 2 1C 1C 1C' 1C 1C 1C of a character set (a font), most people will whack out the definition in Figure 3 10 10 10 10 10 10 1. This is fine, if your characters are all equal width, and this width is 8 or less. 4 1E 1E 1E 1E 1E 1E What if your font were 9 bits wide? Do you then switch from chars to ints? 5 2A 2A 2A 2A 2A 2A You could, if you wanted to waste nearly 50% of your storage. This would 6 28 28 28 28 28 28 only mean a loss of 256*Height bytes (3840 if your characters are 15 high). 7 2C 2C 2C 2C 2C 2C That's acceptable if you only use one font, but some graphics applications use 8 20 20 20 20 20 20 more than 10 fonts at a time. Quite a few of those fonts are much larger than 9 2E 2E 2E 2E 2E 2E the font we're talking about. Some other time I'll talk about the pros and cons of different font storage formats. For now let's just look at some (but I'm sure not all) of the different ways people have come up with to Figure 3 - Packed Linear Format store font bitmaps. bit Figures 2 through 5 give a graphic idea of the font formats, using a two 765 4 3 2 1 o character 6 x 6 font as an example.

B 0 1A 1A 1A 1A 1A 1A 18 18 Unpacked Linear y This is the format of the definition in T 1 1B 18 1B 18 1C 1C 1C 1C Figure 1 (see Figure 2). The system stores all the scan lines of a character to­ E 2 1C 1C 10 10 10 10 10 10 gether. Each scan line starts on a byte boundary following the previous scan line of the character. Therefore, the bits 3 1E 1E 1E 1E 1E 1E 2A 2A for line y of character n start at the beginning of byte: 4 2A 2A 2A 2A 2B 2B 28 28 «n * Height) + y) * CharWidthlnBytes 5 28 28 2C 2C 2C 2C 2C 2C This format eliminates all those nasty 6 20 20 20 20 20 20 2E 2E bit shifts required for extracting characters in packed fonts (we'll discuss 7 2E 2E 2E 2E 2E 2E this momentarily), but wastes an aver­ age of NumChars*Height/2 bytes per font. This can add up.

MICRO CORNUCOPIA, #46,Mar-Apr, 1989 53 Also, it takes a multiply to find the where a multiply is > 100 cycles). What Packed Linear beginning of the character. While an in­ if the font is large enough that the bit­ In this format, the system stores the teger multiply takes only around 30-40 map is greater than 64K? (Not an unrea­ bits for a character together. Very to­ clocks (on a 286), all these multiplies sonable idea.) However, a long multiply gether (see Figure 3). The bits for scan can add up (especially on an 8088, takes multiple instructions.

Figure 4 - Unpacked Rectangular Format bit bit 7 6 5 4 3 2 1 o 7 6 5 4 3 2 1 o

B 0 1A 1A 1A 1A 1A 1A 1 2A 2A 2A 2A 2A 2A y T 2 1B 1B 1B 18 18 18 3 28 28 2B 28 28 28 E 4 1C 1C 1C 1C 1C 1C 5 2C 2C 2C 2C 2C 2C

6 10 10 10 10 10 10 7 20 20 20 20 20 20

8 1E 1E 1E 1E 1E 1E 9 2E 2E 2E 2E 2E 2E

To gat a charactar:

char* gat = bitmapstart + n «1; 1* location of lina 1 *1 for (int ct = 0; ct < Haight; ct++) ( Put 16 bits from *get on screen; gat += 512; ) 1***1

Figure 5 - Packed Rectangular Format

bit bit 7 6 5 4 3 2 1 o 7 6 5 4 3 2 1 o

B 0 1A 1A 1A 1A 1A 1A 2A 2A 1 2A 2A 2A 2A y T 2 1B 1B 1B 18 1B 1B 2B 2B 3 2B 2B 2B 28

E 4 1C 1C 1C 1C 1C 1C 2C 2C 5 2C 2C 2C 2C

6 10 10 10 10 10 10 20 20 7 20 20 20 20

8 1E 1E 1E 1E 1E 1E 2E 2E 9 2E 2E 2E 2E

To get a character:

int RowWidth = (NumChars * CharWidth); int BytaOffsetlnRow = (n * CharWidth)/8; int BitOffsatlnByta = (remainder of above); char* get = BitMapStart + BytOffsetlnRow; for (int ct = 0; ct < Haight; ct++) ( put *qet shifted left by BitOffsetlnByta on screan; get += RowWidth; ) 1***1

54 MICRO CORNUCOPIA, #46, Mar-Apr 1989 line y of a character tack right onto the Figure 6 - Windows FNT Font File Header Definition end of the bits for scan line y-1, regard­ less of byte boundaries. The arithmetic for figuring out where typedef struct a scan line is located gets more compli­ ( cated, if you're still talking in bytes. Ad­ unsigned int dfVersioni /* version I of font file format (256) */ unsigned long dfSizei /* file size in bytes */ dressing according to bits simplifies char dfCopyright[60]i /* vendor copyright notice */ things a little. However, except for the unsigned int dfTypei /* type of font - bit 0 on if vector */ 34010, most processors have a tough unsigned int dfPointsi /* point size at which char looks best */ time dealing with bits. unsigned int dfVertResi /* dpi at which font was digitized */ unsigned int dfHorizResi /* see above */ The bits for line y of character n start unsigned int dfAscenti /* no. of rows from top to baseline */ at byte: unsigned int dflnternalLeadingi /* Leading included in chars */ unsigned int dfExternalLeadingi /* Recommended leading outside chars */ «(n*Height) + y) * Charwidth)/8 unsigned char dfltalici /* 1 if italic font, else 0 */ unsigned char dfOnderlinei /* 1 if underlined, else 0 */ unsigned char dfStrikeOuti /* 1 if strikeout, else 0 */ and bit (7 - remainder) where re­ unsigned int dfWeighti /* stroke weight on 1-1000 scale */ mainder is the remainder of the division unsigned char dfCharSeti /* char set standard, FF for IBM PC */ unsigned int dfPixWidthi /* width of char cell, or 0 if variable */ by 8. It's (7 - remainder) instead of just unsigned int dfPixHeighti /* height of char cells & bitmap */ (remainder) because most PC graphics unsigned char dfPitchAndFam11Yi /* low bit set if variable pitch */ adaptors consider the "left" bit of a byte unsigned int dfAvqWidthi /* width of character 'X' */ unsigned int d£MaxWidthi /* widest character in var. fonts */ to be bit 7 (although bit 0 is the left on unsigned char dfFirstChari /* ASCII of first char in bitmap */ 34010s). unsigned char dfLastChari /* ASCII of last char in bitmap */ Packed Linear eliminates the waste unsigned char dfDefaultChar; /* char to use if requested not there */ seen in Unpacked Linear format, but unsigned char dfBreakChari /* char that defines word breaks */ unsigned int dfWidthBytes i /* I of bytes in one row of bitmap */ makes for all kinds of unnecessarily unsigned long dfDevicei /* disregard */ complex bitshifts just to get a character unsigned long dfFacei /* offset in file of font nama */ out of the bitmap. The amount of shift unsigned long dfBitsPointeri /* used internaly by Windows */ unsigned long dfBitsOffseti /* offset of bitmap in file */ is not only different for every character, ) WinFontHeaderi but for every scan line of every character. /***/ And, just like Unpacked Linear, you still have to do a multiply to find the beginning of a character.

Unpacked Rectangular Figure 7 - ReadWinFont In this format, the system stores the first lines of all characters, followed by the second lines of all characters, the /*--- Read a Windows FNT file into global arrays ------*/ third lines, etc. Each piece of a character WinFontHeader WinFonti char bitmap[32767]i /* watch out you don't read anything bigger */ starts on a byte boundary. In this for­ int chofstable[256+1]i mat, line y of character n is at char facenama[17]i «n*CharWidthlnBytes) + void ReadWinFont(char filenama[]) ( /* note: for brevity I have removed all file error checking */ (y*BitMapWidth) ) FlLE* fin = fopen(filenama,"rb")i fread(&WinFont, sizeof(WinFont), 1, fin)i where BitMapWidth is CharWidthln­ if (WinFont.dfPixWidth == 0) /* indicates a variable pitch font */ /* read character offset table */ Bytes*NoCharslnSet. I know this sounds fread(&chofstable, silly, but there are reasons for it. Really. (WinFont.dfLastChar-WinFont.dfFirstChar+2) *2, 1, fin); The advantage is that you can fseek(fin, WinFont.dfBitsOffset, SEEK_SET); int bitmapsize = WinFont.dfWidthBytes * WinFont.dfPixHeighti successfully retrieve any character fread(&bitmap, bitmapsize, 1, fin)i without doing any multiplies (remem­ fseek(fin, WinFont.dfFace, SEEK_SET)i ber how much time a multiply takes). fread(&facenama, 17, 1, fin)i For example, Figure 4 shows the algo­ fclose(fin)i } /* ReadWinFont */ rithm to get the nth character in an un­ packed rectangular bitmap with /***/ character cells 16 bits wide. Unfortunately, although fast, you waste just as much space in Unpacked Rectangular format as in Unpacked Linear Format.

Packed Rectangular Windows and Gem use the packed rectangular format (see Figure 5). The system stores all the bits for a certain

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 55 row packed together (paying no atten­ tion to byte boundaries) followed by the Figure 8 - Gem Font File Header Definition bits for the next row of characters. The bits of scanline y of character n start typedef struct somewhere in byte: { unsigned int gfID: /* Font type ID */ unsigned int gfPointSize; /* size in points, don't use */ «y*BitMapWidth) + (n*CharWidth)/8) char gfName [32] : /* name of font */ unsigned int gfFirstChar; /* ASCII of first char in bitmap */ where BitMapWidth is (CharWidth*No­ unsigned int gfLastChar; /* ASCII of last char in bitmap */ unsigned int gfTopLine; /* distance from baseline to top */ Charsln5et) /8 rounded up to the next unsigned int gfAscentLine; /* height of capital letter*/ byte boundary (actually the next word unsigned int gfHalfLine; /* height of small letter */ boundary, for Windows and Gem). unsigned int gfDescentLine; /* depth of descenders */ unsigned int gfBottOmLine; /* distance from baseline to bottom */ Within that byte, you can find the bit unsigned int gfMaxWidth; /* widest char in font */ offset of the start of the character by unsigned int gfMaxCellWidth; /* widest char cell in font */ taking (7 - remainder) where remainder unsigned int gfLeftOffset; /* used for tilted fonts */ is the remainder of (n*CharWidth}/8. unsigned int gfRightOffset; /* see above */ unsigned int gfThickening; /* # of pixels to thicken for bold */ All bits from this bit to bit 0 are part of unsigned int gfUndlSize; /* thickness of line for underline */ the character. So if remainder is 0, all unsigned int gfLightMask; /* BitMask for lightening, (5555h) */ the bits in the byte are part of the unsigned int gfSkewMask; /* ???? (5555h) */ unsigned int gfFlags; /* bit 3 set if monospaced */ character (unless the character is less unsigned long gfHorOfsTable; /* ???? don't use */ than 8 bits wide). unsigned long gfCharOfsTable; /* offset of char offset table in file */ Now this looks screwy, doesn't it? It unsigned long gfBitsOffset; /* offset of bitmap in file */ can't be as fast as Unpacked Rectangu­ unsigned int gfFormWidth; /* # of bytes in one row of bitmap */ unsigned int gfFormHeight; /* height of chars and bitmap */ lar forma t (you've got to shift the unsigned long gfNextFont; /* ptr to next font, used internal to Gem */ character data around to normalize it), } GemFontHeader; but it is more compact. It only wastes /***/ an average of Height/2 bytes per font (Height*1.5 if each row rounds to a word boundary instead of a byte Figure 9 - ReadGemFont boundary). /*--- Read a GEM font file into global arrays ------*/ Let's investigate how we would get a GemFontHeader GemFont; character out of this type of bitmap. The char bitmap[32767]; /* watch out you don't read anything bigger */ algorithm in Figure 5 will get all the int chofstable[256+1]: lines of a single character, "n". void ReadGemFont(char filename[]) Realize that I'm simplifying things ( quite a bit when I say "get shifted left FlLE* fin = fopen(filename,"rb"): by BitOffsetlnByte." I admit I haven't /* read header info */ fread(&GemFont, sizeof(GemFont), 1, fin); devoted enough time to this subject yet /* read horizontal offset table */ to come up with a detailed algorithm. fseek(fin, GemFont.gfCharOfsTable, SEEK_SET): I wouldn't want to make you suffer fread(&chofstable, through another bit-by-bit shift of the (GemFont.gfLastChar-GemFont.gfFirstChar+2) *2, 1, fin); /* read bitmap */ character onto the display. Heck, Larry int bitmapsize = GemFont.gfFormWidth * GemFont.gfFormHeight; already did that in the last issue. (If I fseek(fin, GemFont.gfBitsOffset, SEEK_SET); was being threatened with a snowball fread(&bitmap, bitmapsize, 1, fin): fclose(fin); down the throat of my X24 if I didn't } /* ReadGemFont */ show you something that worked, I /***/ would probably show you the same chunk of code.) Back to the subject '" Well, this looks cludes this table as part of the font file, Windows Fonts like the most speed inefficient storage and with Windows it's an optional ad­ The Windows font files I'm talking method yet. Look at all those multiplies. dition to the file (used if the font has about here are the ones that have an At least the bit shift for all the rows of a variable width characters). FNT extension, not the ones on the Win­ character is the same. The divide ... well, everybody knows dows runtime disk which have an FON Notice the first multiply is constant that a divide by 8 is nothing more than extension. You produce FON files by . as long as you use the same font. You a shift right by 3. combining several FNT files with the could do it once when you load the font So, by fooling around a bit, and by Windows Resource Compiler, which and then forget about it. Both Gem and using 516 bytes more memory (514 for shuffles the information around. The Windows include RowWidth as part of the character offset table and 2 for Row­ FON files contain the same information, the font header record, so you never Width), we have eliminated all multi­ they just don't follow the format given have to do it at all. plies from the operation of putting a in the Developer's Kit. The second multiply is different for character on screen. Also, I'm only talking about raster each character in the font. There are at I guess that's why the makers of the fonts - those represented in the file by most only 256 characters in any font, so two most widely accepted graphics in­ bitmaps indicating which dots should we can easily build a "character offset" terfaces adopted the same format. be on and off within a character. Vector table when we load the font. Gem in- fonts (those represented by lists of vec-

56 MICRO CORNUCOPIA, #46, Mar-Apr 1989 tors to draw) are a whole 'nother ani­ Figure 10 - Font Conversion mal. Yet another qualifier ... Although I /*-- Fill in a Windows Font Header from a Gem Font Header --*/ have used this method to look at the FNT version of files as recent as Win­ void ConvertG2W( ) { /* assumes all data is in previously defined global arrays */ dows 386 fonts, my Developer's Kit is int numchars = (GemFont.gfLastChar - GemFont.gfFirstChar + 1); for Windows 1.04. Microsoft has done "something" with its font format in /* Translate the header information */ newer versions of Windows, so this in­ WinFont.dfVersion = 256; strnset(WinFont.dfCopyright,'c',60); formation may be out of date. Or not. WinFont.dfType = 0; At any rate, you won't be able to WinFont.dfPoints = GemFont.gfFormHeight; take this information and use it directly WinFont.dfVertRes = 72; WinFont.dfHorizRes = 72; to modify the fonts you got with WinFont.dfABcent = GemFont.gfTopLine; PageMaker, or the fonts you bought if (WinFont.dfAscent == 0) from Bitstream. WinFont.dfABcent = GemFont.gfAscentLine; If you have the Window's WinFont.dflnternalLeading = 0; WinFont.dfExternalLeading = 0; Developer's Kit, it has a passable font WinFont.dfltalic = 0; editor that runs under Windows. You WinFont.dfUnderline = 0; can also use this information to create WinFont.dfStrikeOut = 0; WinFont.dfWeight = 200; FNT files to compile into FaN files WinFont.dfCharSet = 255; yourself. (As long as the FNT file hasn't WinFont.dfPixWidth = 0; followed the FaN file in changing for­ WinFont.dfPixHeight = GemFont.gfFormHeight; mat.) WinFont.dfPitchAndFamily = 1; /* low bits indicates proportional */ WinFont.dfAvgWidth = chofstable['X'+l-GemFont.gfFirstChar] See Figure 6 for a listing of the Win­ - chofstable['X'-GemFont.gfFirstChar]; dows font file header record. Figure 7 WinFont.dfMaxWidth = MaxWidthlnTable(chofstable, numchars); lists a C++ function to read a Windows WinFont.dfFirstChar = GemFont.gfFirstChar; WinFont.dfLastChar = GemFont.gfLastChar; font file into a global header record, a WinFont.dfDefaultChar = Ox60 - GemFont.gfFirstChar; global bitmap, and a global character WinFont.dfBreakChar = 32 - GemFont.gfFirstChar; width table, if there is a width table. WinFont.dfWidthBytes = GemFont.gfFormWidth; In ReadWinFont, I first read the WinFont.dfDevice = 0; WinFont.dfBitsPointer = 0; header record - always located at the WinFont.dfBitsOffset = «(sizeof(WinFont) && 1) == 1) ? beginning of an FNT file. Next, for vari­ sizeof(WinFont)+l : sizeof(WinFont» able width fonts (as indicated by dfPix­ + «numchars+1)*2); WinFont.dfFace = WinFont.dfBitsOffset Width being 0), I read the character off­ + (WinFont.dfWidthBytes * WinFont.dfPixHeight); set table (it always follows the header). /* NOTE: The following is out of sequence because it depends on The dfBitsOffset field of the header other computed values in the header */ strncpy(facename,GemFont.gfName,17); record points to the offset in the file of facename[16] = 0; the bitmap. (Windows uses WinFont.dfSize = WinFont.dfFace + strlen(facename)+l; dfBitsPointer after loading the font into } /* ConvertG2W */ memory.) My next step is to seek to that /*-- Fill in a Gem Font Header from a Windows Font Header --*/ position in the file, then read dfWidthBytes (the width of each row) * void ConvertW2G( ) dfPixHeight bytes into bitmap. { /* assumes all data is in previously defined global arrays */ Finally, I seek to the offset of the font int numchars = (WinFont.dfLastChar - WinFont.dfFirstChar + 1); name (stored in the header in dfFace) /* Translate the header information */ and read it into facename. Then I close GemFont.gfID = 2;; the file (I wasn't born in a barn, YOll GemFont.gfPointSize = WinFont.dfPoints; strcpy(GemFont.gfName,facename); know). GemFont.gfFirstChar = WinFont.dfFirstChar; GemFont.gfLastChar = WinFont.dfLastChar; Gem Fonts GemFont.gfTopLine = WinFont.dfAscent; GemFont.gfAscentLine = WinFont.dfAscent; Yep. These are the same fonts you GemFont.gfHalfLine = WinFont.dfAscent/2+1; see on the screen when you run Ven­ GemFont.gfDescentLine = WinFont.dfPixHeight-WinFont.dfAscent-1; tura. Every stinkin' one of them. I don't GemFont.gfBottomLine = WinFont.dfPixHeight-WinFont.dfABcent; know if it's legal, strictly speaking. It is GemFont.gfMaxWidth = WinFont.dfMaxWidth; GemFont.gfMaxCellWidth = WinFont.dfMaxWidth; certainly physically possible to use GemFont.gfLeftOffset = 0; those slick-looking fonts, like Times and GemFont.gfRightOffset = 0; Modified Boston Slang and Watusi Bold GemFont.gfThickening = 1; GemFont.gfUndlSize = 1; and all the others, in your own applica­ GemFont.gfLightMask = Ox5555; tions. GemFont.gfSkewMask = Ox5555; Figure 8 shows the fields of the GemFont.gfFlags = 0; header record of a Gem font file. Just GemFont.gfHorOfsTable = 0; GemFont.gfCharOfsTable = «sizeof(GemFont) && 1) == 1) ? like the Windows font header, there's a sizeof(GemFont)+l : sizeof(GemFont); lot of stuff in a Gem font header that most of us don't care about. Maybe continued on next page people writing Venturas and

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 57 PageMakers care about internal leading and external leading. I just want to print Figure 10 continued something on the screen and don't care GemFont.gfB1tsOffset = GemFont.gfCharOfsTable + «numchars+l)*2); about one dot this way or that, usually. GemFont.gfFormW1dth = WinFont.dfWidthBytes; Figure 9 shows a c++ function to GemFont.gfFormHeight = WinFont.dfpixHeight; read a Gem font into global memory GemFont.gfNextFont = 0; if (WinFont.dfpixWidth != 0) /* if fixed pitch in Windows */ buffers similar to the function for Win­ MakeChOfsTable(chofstable, WinFont.dfpixWidth, numchars); dows fonts. Gem uses different field } /* ConvertW2G */ names (dfWidthBytes is gfFormWidth). Also, the character offset table is not in /*-- determine size of a file --*/ a fixed place in Gem fonts, while the long fSize(FILE* fp) font name is. { /* this was written because there is not an ANSI */ /* standard fsize(). Every compiler has a different one */ /* This one uses only ANSI routines */ c++ Function?? long tmpsize; An aside here. When I say "a C++ long pos = ftell(fp); function," I mean "a C function that I fseek(fp, OL, SEEK_END); compiled with Zortech C++, so it prob­ tmpsize = ftell(fp): fseek(fp, pos, SEEK_SET); ably won't compile under normal C." I return(tmpsize); haven't gotten into C++ yet, so these ex­ } /* fsize */ amples don't look too "plussy." Don't think of them as examples of /*-- Determine if file is a Windows FNT file --*/ C++ programming. Think of them as int IsWindowsFont(char filenama[]) examples of dealing with fonts in a high { level language. int temp; long size;

Partial Character Sets FILE* fin = fopen(filenama,"rb"); Both Windows and Gem support fread(&temp,2,1,fin); /* read past version */ fread(&size,4,1,fin): fonts with any number of characters up /* read long word in byte 2-5 and see if = length of file */ to 256. (It appears Gem will support up temp = (fsize(fin) == size); to 65,535, but I haven't tried it). The fclose (fin): lowest character in the set is character return (temp) ; } /* IsWindowsFont */ dfFirstChar (gfFirstChar for Gem) and the highest character in the set is dfLast­ /*-- Construct a character offset table --*/ Char (gfLastChar). void MakeChOfsTable(int ChOfsTable[], int Width, int NumChars) To avoid wasting space on characters { that aren't even in the font, the system for (int ct = 0; ct <= NumChars; ct++) stores the character "FirstChar" at the ChOfsTable[ct] = ct*Width; very first position in the bitmap, and } /* MakeChOfsTable */ /***/ the bitmap ends after LastChar. Because of this, your character dis­ play function should always make sure the character you want to display lies As long as you're decently careful, The character offset table has (dfLast­ somewhere in the range FirstChar - you can mix the use of Windows and Char - dfFirstChar) + 2 word entries LastChar. If not, you should display De­ Gem fonts transparently. Just call which give the offset in bits of each faultChar (or nothing). IsWindowsFontO on a file before you character from the left side of the bit­ Don't forget that you find character open it, then read it into the proper map rectangle. You can find the width "n" at position "n-FirstChar" in the bit­ buffers and do the conversions. You de­ of a character n by subtracting map. cide which format to use internally. I charofstable[n+1] from charofstable[n]. would use the Windows format, but Hence the extra entry at the end, used From Windows To Gem And Back that's just because I figured it out two to determine the wid th of the last The functions ConvertG2WO and days before Gem, so I'm more familiar character. ConvertW2GO in Figure 10 show how with it. As with the bitmap, the offset for the fields of the two font types correlate. Even if you use Windows format in­ character n is at charofstable[n-First­ Use them if you want to read both font ternally, you should call Make­ Char]. types, but write all your font processing ChOfsTableO for fixed width fonts in routines to use a single font format. The order to find characters faster. Since Putting It All Together bitmaps and character offset tables are Gem requires a character offset table, Okay, so I'm too proud to flick bits, identical for both fonts. even for fixed width fonts, you have to am I? I think it makes me look stupid Speaking of multi-compatibility, the support character offset tables to be able and old-world. I would just feel too function IsWindowsFontO does a simple to display Gem fonts, anyway. guilty leaving you with absolutely no check on a font file.and returns true if it way of looking at those fonts you fits the rules of a Windows font file. It Character Offset Table ripped off from your buddy's copy of only checks that the dfSize field equals Speaking of that, I almost forgot to Ventura. the length of the file in bytes, but that's explain the format of the Windows and The C++ function in Figure 11 writes enough for mere mortals. Gem character offset tables. a character from a font onto the screen

58 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Figure 11 - DisplayCharO

/*-- Crudely display a character of a font --*/

void DisplayChar(unsigned char ch, char* bitmap, int Height, int BitMapWidth, int chofstable[)

printf("char: %02x, %d bits wide\n", ch, chofstable[ch+l)-chofstable[ch); int const bitoffset = (chofstable[ch) & 7); bitmap += chofstable[ch) »3; /* byte offset of start of char */

for (int r = 0; r < Height; r++) The C Gazette is the only { char* ptr = bitmap; code-intensive publication for C char workbyte = (*ptr++) « bitoffset; programmers on MS-DOS. int bcount = (7 - bitoffset); for (int bitstoprint = chofstable[ch+l) - chofstable[ch); bitstoprint > 0; bitstoprint--) Each issue brings a wealth of articles and C code on putchar(workbyte & oxeo ? '*':' .'); • Hardware control: workbyte «~a 1; mice, disks, laser printers, if (!bcount--) { monitors, serial ports, etc. workbyte = *ptr++; • Operating system interface: bcount = 7; BIOS, DOS and OS/2. } • Data structures: trees, stacks, } /* for b */ putchar('\n'); queues, hash tables, etc. bitmap += BitMapWidth; • Applications: data } /* for r */ compression, file I/O, data } /* DisplayChar */ entry, text processing, /*------*/ scientific and business main( int argc, char* argv[ ) ) programs. ( /* print all chars in Gem Font file given on command line */ ReadGemFont(argv[l); for (int ch = 0; ch <= GemFont.gfLastChar - GemFont.gfFirstChar; ch++) All this plus a C tutorial, DisplayChar(ch, bitmap, GemFont.gfFormHeight, interviews with famous C GemFont.gfFormNidth, chofstable); programmers (Brian Kernighan, printf("Done.\n");} Robert Jervis, Mark DeSmet), /***/ brief reviews and few ads.

The C Gazette is as a bunch of asterisks. This doesn't do Gem fonts. That's because, as men­ by programmers much in practical terms, but at least it tioned before, the 34010 is a bit for programmers. verifies that you understand what's addressed processor, so the left bit is bit going on. Two Brownie Points to the O. first one of you who figures out how to The header for PCT format fonts con­ Fill out the coupon below, we'll send you a trial issue and integrate this into Larry's printer tains more or less the same information invoice you for a one-year graphics library in issue 45. that's in the Gem and Windows head­ subscription. If not satified, If any of you have an algorithm ers. Just less of it. The actual format write cancel on the invoice and that's more efficient, I would be truly doesn't matter, since you'll probably keep the sample issue - free. honored to take a peek at it. If I get any never see a file in this format anyway good ones, maybe I'll print them. (unless you get a 34010 board). Mainly I 1 year (4 issues) $21 just mentioned it to show you that no PCT Font Format? single format is best for all situations. Oh, yeah. I promised to tell you Oh, and by the way, the entire inter­ The ~ GazeHe about our own font format. The Un­ nalloop of the algorithm I gave for A Code-Intensive C Quarterly packed Rectangular format now stores packed rectangular form is a single in­ For MS-OOS Systems the PC Tech font format. This is because struction on the 34010. Including the bit we use it only for the text mode display shifts and masks. 1341 OCEAN AVE. #257 on the 34010. You wonder what's kept Earl glued SANTA MONICA CA 90401 With our 34010s in text mode, there's to his screen for the last year ... (213) 473-7414 loads of extra memory sitting around. Name ______(Even the smallest PC Tech 34010 has Next Time Company ______256K of nondisplay memory and 256K ... the magic of the 34010 PIXBLT in­ of video memory.) 50 space isn't a con­ struction and other wonders of the elec­ Address ______cern, but the fastest performance tronic world. possible is. P.5. Remember - no matter what City ______In PC Tech format, as with any other they tell you, Raisin Bran is an addictive semi-intelligent 34010 font format, the narcotic. Please take it only as your doc­ State Zip systems stores all the bits within a byte tor advises. in reverse order from the Windows and ••• MICRO CORNUCOPIA, #46,Mar-Apr, 1989 59 PC-File:d8 & PC-Write 3.0 Definitely New & Definitely Improved •

By Anthony Barcellos For those of you tuning in late, Tony Barcellos is P.o. Box 2249 software librarian and newsletter editor for the Davis, CA 95617-2249 Sacramento PC Users Group. In his spare time he (916) 756-4866 teaches math and writes study guides, but it's his knowledge of shareware that has made him famous among software authors and has brought him to the pages of Micro C.

shareware columnist has no excuse for finally shipping, Ashton-Tate can claim to writer's block. There's entirely too having addressed the ease-of-use problem. much to pick from in this corner of the However, since the file format remains the Acomputer industry. The usual problem same, PC-File:dB should be adaptable to is deciding what to write about. dBASE IV as well.) A couple of giants in the shareware business Recent PC-File enhancements are still there, made my job easier this month. ButtonWare re­ of course. PC-File:dB's predecessor, PC-File+, leased PC-File:dB and Quicksoft shipped ver­ sported integrated graphics. Hence you can sion 3.0 of PC-Write. Both programs instantly whip up pie charts or bar charts with your But­ jumped to the top of my topic list. tonWare database. The bar charts come in several different Single File flavors, or you may choose line or scatter plots There are plenty of competing database pro­ instead. The pies explode (for your enjoyment, ducts out there, even if one forgets the high-end of course) while bar and line charts offer products for a moment. (By "high-end" we razzle-dazzle logarithmic scales. This is heavy­ mean in terms of. price, of course.) Despite wor­ duty stuff. thy competitors like ExpressWare's File Ex­ Keyboard macros, long a PC-File feature, press, however, ButtonWare's PC-File continues can be created by example within PC-File:dB. to attract the most attention. Just turn on the macro feature and let PC-File Rightfully so. Jim Button's famous database record your keystrokes. With a little ambition, program was half of the dynamic duo (PC-File you can set up a macro that closes off data and PC-Talk) that established the credibility of entry, sorts the data, prints a report (perhaps user-supported software. While PC-Talk has calling user-created report formats from disk), faded, PC-File is still going strong. and puts you back where you began. So what has Jim Button done for us lately? Not only can you save report formats Although his company's offerings have ex­ (which PC-File has supported since much ear­ panded over the years to include several other lier versions), but now you can create them by programs (see the May-June 1988 issue of Micro painting the layout of your report on-screen. C), PC-File remains the centerpiece. Still stress­ The PC-File:dB laundry list of features is im­ ing ease-of-use via menus, now enhanced by pressive. PC-File:dB has five data types: context-sensitive help screens, PC-File calls its numeric, character, logical, date, and memo. new incarnation PC-File:dB. Guess what the ButtonWare provides a few details about the "dB" stands for. program: Maximum number of records per "By making PC-File dBASE compatible," 'database: 1 billion; maximum record length: says Jim Button, "I can now offer dBASE users 4000 characters; maximum field length: 254 an easy-to-use interface for their current data," (with exceptions for special fields like date Since ease-of-use is conspicuously missing fields, which have prescribed lengths); maxi­ from the vocabularies of most dBASE users, mum memo field length: 5000 characters (even PC-File:dB goes head to head with Ashton­ greater than the standard record length); maxi­ Tate's dBASE III Plus. (Now that dBASE IV is mum number of fields per database: 70; maxi-

60 MICRO CORNUCOPIA, #46, Mar-Apr 1989 mum number of calculated fields per • You can grab rectangles of text PKARC and PKXARC, utilities that do database: 70; maximum number of re­ and delete, copy, or move them. all ARC's archiving functions (and then lational fields per database: 70. • It has menu-selected fonts and some) with major improvements in That should handle the Christmas special effects .. speed. Katz's defenders rebut Hender­ card list. • New quick keys bypass menu son by declaring that the compression The power isn't free, however. PC­ operations for greater speed in algorithms in ARC and PKARC derive File:dB requires 416K of RAM and a switching files and printing. from the same public domain sources. pair of 720K floppy drives. (A pair of • Bob's integrated the editing and Henderson continues his argument 360Ks won't do it anymore.) As you printing modules. (And they re­ by asserting that Katz would be in vi­ might guess, a hard disk would be even main in memory whenever olation of copyright law even if he better. possible.) hadn't copied any of SEA's code (al­ The other price is monetary, of Besides the word processor, Quick­ though Henderson is convinced that he course. Here ButtonWare continues to soft offers companion programs like the did). hold the line, offering a fully registered DCA utility ($29), which converts files Henderson argues that Katz's admis­ copy of PC-File:dB for only $89.95 plus sion of seeing SEA's program code for $5 shipping and handling. This pro­ ARC establishes a presumption of in­ gram conforms to the dBASE file stand­ fringement on SEA's copyright, even if ard - not the dBASE price standard. Katz then created PKARC and PKXARC PC-File:dB comes on three 360K dis­ from scratch. kettes. All three disks contain archive The original court settlement was in files (in ButtonWare's own special ar­ SEA's favor, while the court of public chival format). There's a Program disk, opinion seems to be coming down on Utilities disk, and Documentation disk. PKWare's side. Whether Henderson's The latter contains the entire user's efforts to explain his position to users manual, minus a few illustrations. The will shift the tide in his favor remains to registered version comes with two between DCA-RFT and PC-Write for­ be seen. nicely printed manuals - a standard mats. Font Selector ($29) chooses and I'm sick of the entire business so I'll user's guide and a special beginner's downloads soft fonts to your Hewlett­ just wait for the tragicomedy to come to manual. (The documentation disk does Packard LaserJet+ or compatible laser a conclusion. Somebody - anybody! - not include the beginner's manual.) printer. Finally, there's the PageMaker get the hook! Manuals are perfect-bound, attrac­ Import Filter ($10), which saves PC­ Editor's note: See the Letters Column in tively printed, and come in an amusing Write files in a format PageMaker un­ this issue for another point of view on the slipcase shaped like a giant B. The slip­ derstands. (It preserves much of PC­ SEA vs PK controversy. And, stay tuned case doesn't seem likely to hold up Write's formatting.) for more next issue. under much wear and tear, though the "PC-Write 3.0 is a giant leap in capa­ program's heritage argues that it will. bilities," says Bob Wallace. He's right. Cards And Letters And Disks My thanks to all of you who have PC-File:dB PC-Write 3.0 contacted me. It's a struggle to keep up $89.95 + $5 shipping $89 with it, let alone do justice to its ButtonWare, Inc. Quicksoft, Inc. volume. Besides the letters and notes, P.O. Box 96058 219 First Avenue North, #224 there are the stacks of disks and pro­ Bellevue, W A 98009-4469 Seattle, WA 98109 grams that I need to look over when I (800) JBUTTON, Toll-free order line (800) 888-8088 or (206) 282-0452 find the time. (Time? Anyone have the time?) Write On! Archival Arch Rivals My forays into the stacks take on the The other entrant in the geriatric The continuing legal dispu_te be­ aspects of an archaeological dig. shareware sweepstakes is PC-Write tween System Enhancement Associates Where's that program I wanted to write from Quicksoft. Now at version 3.0, PC­ (SEA) and PKWare over SEA's ARC about that does graphics in Encapsu­ Write hardly seems to be suffering from utility and PKWare's rival software is a lated PostScript format (no "jaggies" old age. Big and beefy, PC-Write now dismal thing to follow. As I mentioned when you scale an illustration)? comes on three diskettes with a in my last column, the details of the How about that critically acclaimed complete user's manual occupying one lawsuit's settlement became public spreadsheet package that was with­ of the disks. despite the agreement of the two parties drawn from the regular commercial What has Bob Wallace done to his to refrain from commenting on it. channels and relaunched as shareware? warhorse word processor? After more While PKWare's Phil Katz remains (It's around here somewhere, along than a year of teasing about what PC­ the beneficiary of sympathy from most with the nice cover note written by the Write 3.0 would offer, Quicksoft reports of the user community, SEA's Thorn author.) Then there's the program that it has added over 500 features. Henderson has explained his grievances purports to bring true 3-D CAD features Here are a few of the major improve­ in detail. He says his lawsuit was neces­ to shareware for the first time. And the ments: sary to protect the integrity of his ARC programs I talked about before keep • The old 60K file limit is gone. PC­ program. (I thank Michael Kaufman for getting updated. Write 3.0 will use all available sending along the latest archive of bul­ There's no way I'll ever catch up. But memory for files. letin board messages on the topic.) the fun is in the trying. Keep sharing. • It supports and displays multiple Henderson claims that Katz copied columns. ARC's program code in creating • • • MICRO CORNUCOPIA, #46, Mar-Apr, 1989 61 PersonalWare Shareware You'll Want To Register

By Dave Thompson "Beep!" received a small brown package the other First, get comfortable. Put on a quiet record, take day and inside I found a small black disk. off your shoes, loosen your tie or coliar, and take a Nothing more. On the label someone had sip or two of the bubbly. The lights should be low. Iscribbled "Personal Relationships, an Expert Remove any distractions. System for Adults Only." I dumped the cat off my lap. I fired up my system, popped in the disk, "Beep!" and looked at the directory. Now sit together side by side. DAVE, reach over Aha, USEME.EXE. and grasp SANDY's hand. Gently. Welcome to a new world of relationships. To take Maintain that position. Do not speak. full advantage of this software you must: "Beep!" 1. Find someone compatible. Now, DAVE, put your arm around SANDY. 2. Find a bottle of bubbly and two glasses. Notice the warmth, DAVE, that begins where your 3. Turn up the heat. arm touches SANDY. Notice how that warmth 4. Turn down the lights. travels back down your arm and spreads througJiout 5. And hit ENTER. your entire body. Notice especially how that warmth I ran upstairs, grabbed Sandy, found the settles into your solar plexis. bottle of carbonated apple juice we keep for I dumped the cat off my lap. Again. medicinal purposes, and headed back to the "Beep!" computer. SANDY, notice the warmth from DAVE's arm. I hit ENTER. Notice how it spreads, making your breathing Please enter your name. heavier. Almost audible. DAVE "Beep!" Please enter your partner's name. Now, before we begin the unbuttoning, DA VE SANDY and SANDY, you need to enter your Personal Rela­ Please select the type of relationship you'd like to tionships registration code. If you don't have a num­ develop. ber yet, you can obtain one immediately by calling • 1. Non-touching, mostly platonic. (e.g. 1-800-NDR-WARE. Be sure to have your VISA or husband/wife) MasterCard handy. • 2. Good friends (cheek kisses and hugs on Registration Fee: special occasions). For $100 you get the code immediately. • 3. Very Good Friends (e.g. quarterback/cheer- For $50 we call you back after you've cooled off for leader). 5 minutes. • 4. Consumate Roommates. For $15 we call you back next week. I selected 1. We'd already practiced that one. Note: Your shameless activity, DAVE and I'm sorry, that selection is not available. SANDY, has been recorded in the system, along I cranked up my courage and selected 2. with the time and date (you did, after all, select I'm sorry, that selection is not available. number 4). If you attempt to exit the program at I've never tackled football but after 20 years this time (via reset, power switch, etc.) to avoid reg­ of matrimonial bliss, "Very Good Friends" istering, this machine will, forever, at random, dis­ sounded like something we could work toward. play the gory details of this tryst on the screen. I selected 3. "Beep!" I'm sorry, that selection is not available. Please enter your registration code: ___ I bit my lip and selected 4. "Beep!" Good choice. Please enter your registration code: ___ From here on, I'll take the lead. Timing is critical "Beep!" so please do not begin any activity before I tell you. Please enter your registration code: ___ Continue the activity until I beep. At the beep, drop "Beep!" what you're doing and read this screen. • • • 62 MICRO CORNUCOPIA, #46, Mar-Apr 1989 5.25' HARD DISK CONTROLLER CARD 20 MEG HARD DRIVES FOR ANY MODERN 5.25' HARD DRIVE SEAGATE Model ST-225 (Full 6 Mo. Warranty)/ess face plate $219.95 $89.95 W/CABLE

western Digital Controller For Model ST-225 Drive I

$69.95w/cable COMPUTER A-B SWITCH BOXES ~. '~. Yesll These are for IBM compatible machInes. ICN36 A-B Parallel Centronlx .~. SHUGART #I 465 ::~; ::ChSerlOI R~232 N QUAD DENSITY. 720 K. 96 TPI $24.95.och ~ 1/2 HEIGHT BLACK FACE PLATE (NEW BUT HAVE COSMETIC BLEMISHES) SOLD AS IS $49.95

STEPPER MOTORS TOSHIBA 51/4' FLOPPY DRIVES Copa11SP-57 DSDD.360K 1/4' Shaft. 7.5 deg./step, 36 1/2 HEIGHT Ohm. 12VDC $6.95 BLACK FACE PLATE 3/16' Shaft, 35 OZ: torque, 2.1A., 5VDC (90 DAY WARRANTY) $89.95 WITH BRASS GEAR. 20 TEETH, 1/2' DIAMETER $9.95

LASERS TOSHIBA 3.5' DISK DRIVES IBM compatible 5 MW Laser Tube $89.95 720K Byte Power Supply Kit (115VAC)$69.95 Double sided Power supply (wired) (12VDC)$119.95 Mounting kit Power & Data cable adapter 1 MW Laser Tube$119.95 Model I FDD 421QGOK Power Supply (l2VDC)$99.95

FULL 90 DAY WARRANTY $119.95 (These lasers are brand new and guaranteed to have a 5.25' DISK DRIVE CABINETS cosmetic defect or not meet (with power supply) manufactures full specifications. All are tested For 1 full height or 2 half height in our lab to insure your ICAB-25V5 satisfaction.) $99.95 each

WARNING: Voltages present and used by losers can be lethol..,Permonent eye damage could result from direct exposure to an on coming laser beam. Only those persons qualified to handle such potentials should do so ... 300 BAUD SMART MODEM (DIRECT CONNECT) LOW COST SERIAL MODEM 7x lOx 11/2 $19.95 TECHNA-KIT

D-C Motor Controller .Control 2 O-C motors with a computer or other logic source .For motors rated 6-24 VDC .Control torward/reverse/run/cw/ccw/stop 'Up to 6 Amp starting surge. 4 Amp cont, .Dynamic breaking (capable) CABLES-CONNECTORS-SEX CHANGERS .WilI also run most 4·lead stepper motors 'Xl" STANDARD PARALLEL (10'. DB-25M TO CN36M) 110-004 $12.95 $29.95 AC POWER CORD (6' COMPUTER STANDARD. MOLDED RUGS) 110-001 2.95 USMD-C RS232 MODEM ADAPTER .Control standard 6-lead stepper motors with a (DB-25 M-F, PINS 2 & 3 REVERSED) 120-001 9.95 computer or other logic source SEX CHANGER. DB-25 F TO F 120-005 9.95 .For motors rated 1.7 - 12,0 VDC .Opticollsolation SEX CHANGER. DB-25 M TO M 120-006 9.95 .Control: forward/reverse/step rote/stop • Industry standard 22 pin edge card connector

COMPUTER POWER SUPERVISOR (A LOW COST INSURANCE POLICY $29.95 PROVIDES SURGE/SPIKE PROTECTION FOR YOUR COMPUTERI ALL INCOMING POWER IS MONITORED & CONDITIONED BEFORE ALLOWING IT TO POSSIBLY TRASH YOUR COMPUTER OR OTHER SUCH VUNERABLE & EXPENSIVE EQUIPMENT, COMPUTER AUTOMATE .5 OUTLETS. EACH WITH A LIGHTED SWITCH .Use your computer to provide automation .1 MASTER ON/OFF SWITCH .8 separate driver ports per card .SYTLISH CABINET PROVIDES FULL SHEILDING .8 TTL/Cmos inputs .RATED 15AMP. 125VAC. 1875WATTS .1 user defined sense switch DIM.12.5' x 2.5' x 14' Regular price $69.95 Your price $49.95 ·6-24VDC .4 Amps/driver (max current)

PHONE: (206) 682-5025 u"ite~ ~P()~~ct~ c()p~()pati()" 'fll; FAX: (206) 682-5593 'UJ-l DISTRIBUTORS OF ELECTRONICS SINCE 1968 :AMERICAN Icr.- EXP-RESS 1123 VALLEY STREET • SEATTLE, WA 98109-4425 M-F 9-6 SAT 9-5

Reader Service Number 101 MICRO CORNUCOPIA, #46, Mar-Apr 1989 63 Building A (Small) Publishing Empire From (Almost) Nothing

and writes to these packs while communicating By Kent Peterson You asked for it, more personal stories from "On through an eight-bit (proprietary) parallel port. Your Owners." Well, this is personal. Kent talks Psion also manufactures a device called a Psion Interest Group 41 Greenridge Avenue about his new start-up, a newsletter for a very small CommsLink that converts this port to a smar~ White Plains, NY 10605 computer. (Definitely not the Big Board.) RS-232C. In short, the Psion offered me enough ...... (914) 761-2196 sameness along with enough weirdness to . stave off boredom for awhile. ast year I landed the kind of job my After developing a relationship with the mother always told me I wanted. I be­ little Psion, Christine and I wrote a few little came a systems analyst for a fairly large music routines and I managed to squeeze in a Lcorporation which gave me job security, text adventure. Then I got serious. I made it a pension plan, full medical, and a fast AT with talk to every other computer we had - the AT, almost enough disk space. the Hewlett-Packard, and the Atari. Still, the hacker in me wasn't content. I spent The Psion keyboard lacks some characters more of my time in meetings than I did in mi­ that I consider essential (like the question crocode. My jeans and Nikes didn't look quite mark). So I dug through the tech manual until I right with my white shirt and tie. I knew there figured out how to re-vector the keyboard was more to life, but I also needed the money lookup table into RAM to give me an alterna­ my "real job" provided. How depressing. tive keyboard layout. What fun. I was having As usual, my wife, Christine, knew just how so much fun with the little machine that I de­ to snap me out of my depression. "You need a cided to do something crazy. gadget," she said. She was right. Somewhere among the megabytes and meetings, life had Thoughts Of Grandeur stopped being fun. I had started in this busi­ "I'm going to become the Peter Norton of ness hacking on little machines and I missed the Psion Organiser II," I told my wife. the challenge of pushing a little machine to its "Oh no," she said. "Does this mean you'll limits. start wearing pink shirts and ties and stand Then, one fateful day, the boys down in ac­ around with your arms folded and your shirt counting called up to tell me I hadn't claimed sleeves partially rolled up?" enough of my miscellaneous moving al­ I clarified my position. I wasn't talking lowance. I tried to explain that it hadn't cost about a wardrobe change. I just figured I could much for me to move, but they insisted that the become the acknowledged expert on the Or­ company owed me a couple hundred dollars. ganiser. This would require staying current on Furthermore, if I didn't take it, it would screw the latest developments in the Psion world, get­ up their bookkeeping. Of course I refused their ting all the latest hardware and software, and offer (for about seventeen nanoseconds). spreading that information within the Psion I spent the money on a funky little machine community. called the Psion Organiser II. (Editor's note: "Sounds expensive," Christine said. Psion is pronounced SIGH-on, a psemi-psimple "Not if we do it right," I countered. "I'm name.) This eight ounce box, billed as the going to make this machine pay for itself." She "pocket PC," was just what I was looking for. just smiled. I've said that about every computer The unit contains a 1 MHz Hitachi 6303X mi­ I've ever owned and it's seldom proven true. croprocessor (a CMOS version of the Motorola 6809) and 32K of RAM. It has a calculator-style Newsletteritis keyboard and a two line liquid crystal screen. It I decided to start a users group for the Or­ runs a proprietary language called OPL. ganiser II and publish a small newsletter of The Organiser doesn't use disk drives; it program tips, techniques, and reviews. I uses tiny packs that contain either EPROMs or figured membership dues would cover the cost battery-backed CMOS RAM. It even reads from of printing and mailing the newsletter with

64 MICRO CORNUCOPIA, #46, Mar-Apr 1989 enough left over to keep me stocked have a group called PIG. It isn't among different machines. They with the latest hardware and software. dignified." couldn't agree on disk formats, so the I checked, there was no Psion users "I think it suits you," she said Psion served as an ASCII Esperanto that group in the U.S. The British build the sweetly. they all could talk to. little computer so there's an active I looked around my office at the Finally we finished our first issue, group there. scraps of paper covered with program sent out the 100 copies, and waited for Jeff Etter, who'd sold me my Psion, fragments, the semi-random stacks of people to make PIGs of themselves. thought the U.S. market was rich books and computer magazines, the They did. Not all, not a majority, but enough to support a group and offered empty Oreo bags and Pepsi cans. enough. And, Jeff Etter kicked in some to help any way he could. "I still don't think it's a very good cash to help with postage costs. The plan we formed was simple. I'd name," I said. "Can't we come up with PICO magazine did a review of the write the first issue of our newsletter. something else?" Psion and fortunately the review con­ Christine (a former editor) would proof "You could always call it the Psion tained a technical error. I wrote a letter the copy and correct any misspellings. International Software Society," she correcting the error and mentioned our When everything passed her inspection, chuckled. users group. Lo and behold, more PIGs. we'd print the script on a borrowed "I guess PIG isn't such a bad name," Greg Paul, the director of technical laser printer. Then we'd take the laser I said. support for Psion, USA, learned of our printouts to a local print shop. (The first "Oink, Oink," she squealed. efforts and directed people our way. print run totalled 100 copies.) We set to work writing, editing, and One of our members contacted the I planned to send these copies, to­ programming. We worked ideas into British users group and we established gether with subscription forms and programs and wrote articles to accom­ a publication swap with them. pleas for contributions, to 100 of the pany the code. We pressed anything We not only gained members, we people who'd bought Psions from Jeff. with a keyboard and an RS-232 port gained a few good writers and a couple If we were lucky, we'd make back the into service for the writing. The Psion's of hotshot programmers. Ideas came money we'd spent on the first printing small size and portability made it a nat­ pouring in. PIGs are mostly users, not and be able to keep going. If not, Chris­ ural for note taking. Anywhere inspira­ programmers. But the users have plenty tine would hopefully remember she'd tion struck, the Psion was there. (It's of ideas for keeping programmers busy. married me for poorer, too. amazing how many good ideas come to I have always relied on the strange­ you when you're in the bathroom.) ness of kind people and the kindness of Really Cheap Desktop Publishing The Psion also served as a bridge strange people. Our plan depended on desktop pub­ lishing, but we had no budget. We didn't have Ventura, a scanner, or our own laser printer. We did have PC­ Write. This forced us to adopt a very dBASE III + 20 TIMES FASTER!! simple format for the newsletter: single -what a dHferencel No more column, no photos, and no graphics ® watiting for output while I could have been processing other data. beyond the simple box-drawing If, greaU· characters that PC-Write supports. This V. Kovacs Penn Services no-frills approach gave us some unex­ pected benefits. Since we didn't have dBASE III + Enh:a~n~cm~en~t~!!!11...... ~ one of those wisi-wonderful graphics ·I'm wing it in evety new system. I write. Super for creating test data packages, I spent my time writing in­ from large files. Ifs fast, easy to use, and follows dBASB syntax.. stead of playing around with graphics. FAST: (It seems like whenever I get hold of a Up to 20 times f~ster than dBASE. W.H. Whitney mouse and a bit-mapped image, I spend In one case, report generation on a 60,000 McOraw Hill, Inc. more time tweaking than working.) record file was reduced from 18 hours to 2 Another benefit was that we could hoursl print our proof sheets on the trusty old FLEXIBLE' I d I COpy DELETE Call fro~ a program file or DOS prompt Comman S APPEND RECALL Proprinter rather than use the laser . -REPLACE COUNT Run on a stand alone PC or a network. MANY MORE printer for everything. Finally, since PC­ EASY: Write uses straight ASCII, the output dBASE-like syntax - No need to learn LTRIM[] UPPER(] could be used in a disk version of our another language. Functions' TRIM[] SUBSTR[] newsletter. (Of course, most of this was COMPATIBLE: just rationalization. When Ashton-Tate Recognizes and creates dBASE III + files. offered us a copy of BYLINE, we Transfer DBF data to OAT files for use with other languages (Basic, Pascal, etc.) jumped at it.)

PIGs IJI FOR AOOITIONAL INFORMATION CALL: (215) 53~S8S8 We immediately realized our users CDmpU\BrisBd ProcBssing UnUmitsd group needed a name, so Christine and $149.00 IllI Cunnlry Square Shopping Center I discussed possibilities: "We can't call Quakertown, Pa. 18951 it the Psion Interest Group," I said. "Why not?" Reader Service Number 105 liThe initials spell 'PIG.' We can't

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 65 Problems First, I had to figure out what the Unfortunately a dot-matrix printer Of course, not everything went publication should look like. Should we has to do a digital hand stand to print smoothly. When I was ready to print use Times-Roman or Bookman? Which all those wonderful fonts and pictures. the second issue of our newsletter, the point size? How should listings look? So we got a lot of snack breaks while laser printer was nowhere to be found. But I'd poured an issue's worth of the printer exercised. Of course, we did It seems the guy who owns the printer text and programs into BYLINE when I most of the proofing on the screen, but lent it to someone else. (That's the prob­ discovered an even bigger problem. I Christine insists on paper and red pen lem with relying on one of these gener­ only had half a newsletter. Our new for her final pass. ous types, you never know when typeface and multi-column format held After more writing, rewriting, they're going to be generous to some­ a lot more information per page. editing, and playing, our fourth issue body else.) Another problem was the art. They got shipped in PostScript form to A few frantic phone calls connected say a picture is worth a thousand Psion's U.S. headquarters. They us with a laser-printer owner who let us dumped it out on their PostScript laser print the 24 pages of the second issue printer. (None of our local friends had during lunch hour. To our relief, and laser printers with PostScript or the font our subscribers' amazement, the second support we needed.) Finally, for better issue hit the streets reasonably close to I have always or worse, the issue hit the streets. its intended date. relied on the So How Are We Doing? A Conference We're now at work on our fifth bi­ Before the third issue, our editorial strangeness of monthly issue and we have about 200 staff (and the kids) flew down to sunny members in a dozen countries. Our Florida for three days of sun, fun, and kind people and membership fees ($25 U.S., $40 foreign, tech-talk at Jeff Etter's Psion Confer­ and $15 for students, senior citizens and ence. The conference was a meeting the kindness of hard-luck stories) bring in enough to ground for Psion VARs (Value Added cover printing, postage, and the oc­ Resellers) and manufacturers of Psion­ strange people. casional gadget. related hardware and software. If I figured out what I'm making per It was our first chance to meet many hour on this venture, it would come to of the Psioneers face to face and discuss words, but I found out that it's much somewhere around six cents. But if I what they would like from a users easier for me to write a thousand words factor in the people I've met, the lessons group. We signed up subscribers, than to mousepaint a picture. I've learned, and the fun I'm having, played with gadgets, and met some BYLINE could import art from a I'm richer than I've ever been. amazing people. paint program or a clip art library, but There is one little thing that bothers Shortly after the conference, interest­ the illustrations I wanted were not me, though. I was really looking for­ ing items began appearing in our mail­ available as clip art. A scanner would ward to being the Peter Norton of the box. (Now I understand exactly how solve the problem, of course, but my Psion Organiser II. Jerry Pournelle feels.) Psion programs budget didn't include a scanner. I neglected one little detail, however. ranging from word processors and When Peter formed his company, he database managers to celestial naviga­ Unexpected Features called it Peter Norton Computing. tors began piling up in our apartment. Like any sophisticated piece of soft­ When I formed mine, I called it PIG. My The most significant piece of soft­ ware, BYLINE has a few undocumented wife took note of the name and the ware wasn't for the Psi on, however. It "features." A personal favorite is the number of nights I spent at the com­ was a copy of BYLINE, Ashton-Tate's way it inserts a space following the hy­ puter and christened me "The Big desktop publishing software. BYLINE phen in hyphenated words. After I'd Boar." I have no idea what Peter Nor­ came to us courtesy of Ashton-Tate and tried the usual techniques of manual­ ton's wife calls him (or if she calls him Jeff Etter. reading and hair-pulling, I stumbled on at am, but at least I don't have to wear the solution. I manually insert an invis­ a pink shirt. Every Silver Lining Has A Dark Cloud ible space after the hyphen. BYLINE turned out to be a mixed Editor's note: Of course - an invisible Psion Organiser II blessing. Our third issue had pushed space! Why didn't I see that? (All oxy­ Weight: 9 ounces PC-Write to its limits. (That issue in­ morons are obvious.) Dim: 6" long 3.8" wide 1.2" deep cluded two simple illustrations and a I used a similar technique to get BY­ Battery: 9 V transistor very simple circuit diagram.) BYLINE LINE to print a program listing contain­ Memory: 32K main memory promised to give us many more fonts ing a less-than sign followed by a quo­ Language: OPL and sizes, along with the easy addition tation mark. BYLINE uses the <" and "> Processor 1 MHz Hitachi 6303X of real graphics. The package was easy as variable delimiters for things like Price $250 to learn, very powerful, and gobs of page numbers. It refused to print the fun. Our fourth issue was only six program listing until I inserted an invis­ Accessories weeks late. ible space between the < and the". 32K RAM pack (battery backed) In fairness to Ashton-Tate, I have to BYLINE gave us enormous layout 32K EPROM pack (EPROM burner built say that the delay wasn't BYLINE's flexibility, but it did limit our printer into Organiser) fault. BYLINE performed gallantly; the options. BYLINE supports both dot­ 128K RAM pack available soon. problems I encountered are inherent in matrix and laser printers so we could any desktop publishing system. still use the Proprinter for proofing. • •• 66 MICRO CORNUCOPIA, #46, Mar-Apr 1989 GEMS SUPER DISCOUNT* PRICES

MOTHERBOARDS CASE I/O CARDS CHIPS (Prices Subject To Change) XlIIOII XT SLIDE .....•...... S27 Multi 1/0 Ser Par Cal Clk Game Disk ..... $48 V·20 8mhz (replacement for 8088) ...... $10 4.nt8mhz TURBO. 640K.OK ...... •... S69 Xl/AT like Case ...... 30 Multi 1/0 Above (DFI) ...... •....•...... 66 V·20 10mhz ...... 16 4.ntl0mhz TURBO. 640K.OK ...... 76 AT 3 Floppy Drive Front I 2 Button ...... 54 Magic 1/0 Ser Par Cal Clk Disk Ctlr 360K. 720K. 8088·2 CPU ...... 5 4.ntl0mhz TURBO. 1mb. OK. SIW ...•.. 79 AT 3 Floppy Drive with Digital Disp ...... 72 1.2mb ...... 49 8087·2 MATH CO·PROCESSOR FOR XT. 149 4. nt15mhz SUPER TURBO. wll mb MEMORY. Xl SLIDE Heavy Duty. Quality ..•.•...... 27 1/0 Plus .. Ser Par Cal Clk Game ...... 42 8087·1 MATH CO·PROCESSOR FOR XT. 215 2/3 size. 110% faster than 6mhz IBM AT. 420 Xl/AT like. slide. heavy duty. Qual ...... 30 Parallel Card (Xl) ...... '" ...... '" .. 15 80287·8 MATH CO·PROCESSOR FOR AT. 229 ATl2eS AT SIZE AT DT 3DR FT. 2 button. SOL ...... 48 Serial Card 2nd Serial Optional ...... 18 80287·10 MATH CO·PROCESSOR FOR AI279 6/10mhz. 1mb OK. DTK. Ows ...... 229 AT DT 3DR FT. 2 button. AS ...... 54 Port Serial Card w/2 Port & Opt ...... 66 80387·16 MATH CO·PROCESSOR FOR AI.425 6/10mhz. 1mb OK. PC CALC. Ows ...... 259 AT DT 3DR FT. 2 button. DIG DISPLAY ... 72 2nd Serial for XT ...... 17 80387·20 MATH CO· PROCESSOR FOR Al CALL 6/12mhz. 1mb OK. PC CALC. ows ...... 289 AT DT 3DR FT. DIG DlSPLAYIPC CALC .... 75 Game Card (2 Ports) ...... 17 64K 150ns DRAM ...... 1.35 6/12mhz. 1mb OK. EW. 12mhz CPU. Ows .. 289 SPECIAL CASES AT 1/0 CARD par. game. ser. 2nd ser opt. 42 64K 120ns DRAM ...... 3.25 6116mhz. 1mb OK. PC CALC. Ows ...... 399 Transportable (case PS KB Mono Monit)S435 2nd Serial Port for AT ...... 19 64K lOOns DRAM ...... 4.25 ATI2IS Xl SIZE Transportable EGA VER ...... 1250 64K 120ns DRAM 4464 ...... 13.50 6/10mhz. 1mb OK. DTK. Ows ...... 239 Floppy/Hard Disk Controller 256K 150ns ...... 10 LCD portable 640X400 Bracklite 181bs ... 759 2 Drive Floppy CTLR (360Kt720K) ...... $17 6/10mhz. 1mb OK. ELTECH. Ows ...... 229 256K 120ns ...... 11.75 Carrying Case for portables ...... 35 4 Drive Floppy CTLR (360KmOK) ...... 34 6/12mhz. 1 or 4mb. OK. MS. Ows ...... 265 256K lOOns ...... 11.95 Tower Case 230W PWR SPLY. 6 half ht. 250 2 Drive Floppy Master (360K/l.2mb) ..... 39 6/16mhz. 2 or 8mb. OK. NOVAS ...... 489 256K 80ns ...... 12.95 Tower Case w/digital display. 3 Dr. Front will 4 Drive FOC (360. 1.2mO. 1.44)SEF ..... 89 6/20mhz. 2 or 8mb. OK. NOVAS ...... 549 1mb lOOns ...... 33 hold 7. 'hht Dr. 220W ...... 225 4 Drive Super Special FDC W/Cables ..... 89 ATI38S AT SIZE 256K lOOns SIMM'S (SIP's) ...... 125 WD FOX 2 Floppy Drive CTLR For AT ..... 57 16mhz. w 11mb MICRONICS ...... 1399 POWER SUPPLY 256K 80ns SIMM'S (SIP's) ...... 145 WO WX 1 Hard Disk Controller 8 Bit ...... 57 20mhz. w 11mb. MICRONICS ...... 1449 150 watt XT Compatible ...... S36 256K lOOns STATIC COLUMN RAM ...... 17 WD XT/GEN Hard Disk CTLR For XT ...... 52 20mhz. w 11mb. 287 + 387 SOCKET. MS.1415 200 watt XT Compatible ...... 49 256K 80ns STATIC COLUMN RAM ...... 18 WD 27X RLL Hard Disk Controller ...... 59 20mhz. w 11mb. up to 16mb on M/B.l par. 200 watt AT Compatible ...... 59 WD WA·2 FO/HD CTLR For AT (MFM) '" 112 1 ser w I 2nd opt ...... CALL 220 watt AT Compatible ...... 63 DTC 5287 FO/HD CTLR For AT (RLL) .... 154 Desktop Publishing 20mhz MYLEX motherboard ...... CALL 250 watt AT Compatible ...... 69 Hi·Res 1024 15"MONITOR WlVideo Controller NCL 5425 FDIHD CTLR For AT (MFM) '" 112 25mhz 38C wll mb ...... CALL 1024 X 768 Resolution ...... $499 KEYBOARDS ADAPTEC 2372 FO/HO CTLR AT (RLL) " 179 HARD DRIVES 84 KEY At Style Keyboard ...... S36 16 Bit 4 Floppy/2 Hard Drive Controller ST·225 Seagate (DRIVE ONLY) ...... S215 84 Key At Style Maxi Switch Keyboard .... 49 Modified 16 Bit DTC CTLR MFM & RLL. 295 SCANNERS ST·225 with CONTROLLER ..•...... 255 101 Key Enhanced Monterey ...... 42 Mitsubishi Hand Scanner Full Page MH216 ST·238 Seagate (DRIVE ONLY) ...... 229 101 Key Tronics Keyboard ...... 47 TAPE BACKUP 200 DPI. 8.5" X 11" ...... S638 Teac 60mb MT2ST/45 (CASS) INT ..... $539 ST·238 with CONTROLLER ...... •...... 275 101 Maxiswitch Enhanced Keyboard ...... 64 Mitsubishi 400 DPI MH 130 ...... CALL Everex 60mb Wangtek INT (Cart) ...... 679 ST·251 Seagate 40ms HARD DRIVE ..... 339 101 Tactile Enhanced Keyboard ...... 49 Mitsubishi Paper Feeder For Scanner .... 176 Colorado 44mb (Cart) Internal ...... 289 ST-251·1 Seagate 28ms HARD DRIVE ... 419 MOUSE Abaton 300 FB Full Page Scanner ...... 1349 MR535 Mitsubishi RLL 65mb 28ms ..... 465 Logitech M·8 Button ...... S35 MONITORS ST·125 Seagate 3·1h format 20mb ...... • 245 Logitech C·7 Button ...... 69 Goldstar Amber Monochrome 720X348. $58 ACCELARATOR CARDS MICRO 286·10 OK ...... $269 Miniscribe 3650 40mb (61 ms) MFM .... 315 Logitech HI·REZ ...... 86 Samsung 1252 Mono 720X348 TIUSW .. 66 SOTA 286i 10mhz OK ...... 298 Miniscribe 3675 63mb (61 ms) RLL ..... 335 Microsoft Bus Mouse + Paintbrush/Menu. 99 Samsung 1464 EGB ...... 219 SOTA 2861 12mhz OK ...... 359 MAXlOR .... Call For Special Prices ... SCALL Microsoft Ser Mouse + PaintbrushlMenu . 99 Evervision 14 Amber Flat Screen ...... 119 TOSHIBA MK130 65mb RLL 3·'1'1 form .. 575 Amdek 410A ...... 139 MOTHERCARDS HARD CARD 20mb Plus Development ... 545 VIDEO CARDS Nec GS ...... 199 SOTA 5.0 MOTHERCAROS wll mb, 10mhz.Sn9 Monochrome WI Printer Port ...... S39 HARD CARD 40mb Plus Development ... 729 Taxan Composite Amber/Green ...... 89 SOTA 5.0 MOTHERCARDS w/lmb. 12mhz.879 Monochrome 132 Column & Print Port ... 53 Relisys EGA with TILT & SWIVEL ...... 339 FLOPPY DISK DRIVES Color Graphics Adaptor ...... 39 Fujitsu 360K BLACK FACE PLATE ...... S64 Relisys Multi Scan ...... 499 Color Graphics Adaptor 11 print port ...... 53 Mitsubishi 1410XC EGA ...... 379 Econo XT® Compatible Fujitsu 1.2mb BEIGE FACE PLATE ...... 83 Micro EGA Auto Switching ...... 129 Mitsubishi 1381A Diamond Scan ...... 539 8mhz Turbo M/B,OK, case. Teac 360K ...... 73 Video·7 VGA ...... 269 Nec Multiscan II ...... 569 Keyboard. 150w PIS. FLOP CTLR. 1 360K Teac 1.2mb ...... 86 Paradise VGA Plus ...... 259 Sigma Designs Laserview 1901·PC ..... 1749 Drive. Mono video B.D. Teac 720K with 5·V. mount bracket ...... 92 Paradise VGA Professional ...... 389 MONITOR ...... $339 Teac 1.44 3·1h wi 5·% bracket ...... 110 Chips and Technologies VGA Card ...... 249 Mitsumi 360K BLACK ...... 63 CAD PRODUCTS MITSUBISHI HA3905 19V120" MONITOR. ANALOGI Sony 720K 3·1h wi 5·V. bracket ...... 94 MODEM 1200 BAUD with Software ... " ...... $52 TIL. 1024 X 1024. 15.7 35.5khz ...... 51725 . \;/ Sony 1.44mb 3·1h wi 5·V. bracket ...... 119 MITSUBISHI HL6905 19" MONITOR. 1280 X Toshiba 720K 3·'1'1 wi 5·V. bracket ...... 99 2400 BAUD with Software ...... 95 Zoom HC 2400 wlProcomm Software ... 116 1024. 30% 64khz AUTO TRACKING .... 2415 .~\~~~~~------~ Toshiba 1.44mb 3·1h Wi 5·'1. bracket .... 119 HIGH RESOLUTION VIDEO CARDS FOR CAD ---'>!'~Lap Top Computer Mitsubishi 360K ...... 69 External 1200 wlPC Talk III SIW ...... 62 ODPVIVA12801290X76816COLORS. $1289 The New Mitsubishi MP286L Mitsubishi 1.2mb ...... 84 External 2400 WIPC Talk III SIW ...... 109 OOP VIVA 2000 1024 X 1024 16 COLORS .. 1559 12mhz.1.44.20mb..... $2475 Mitsubishi 720K 3.5 ...... 79 Everex External 2400 Modem ...... 179 aOPVIVA 2000 2 2024 X 2024 16 COLORS.1895 Mitsubishi 1.44mb 3.5 ...... 95

Call for Discounted System Prices

*AII prices shown are pre-paid or ordered by VISA or Mastercard. Charge card orders are subject to a 3% surcharge. For C.O.D. or term orders on parts above add 10%. G E IVI ST" 8< IBM" Are Reglslered Trademarks 01 I nlernatlonal BusIness .M.. a.cllhi.nlle.s ......

computers II1-332-GEMS J ...... 6 Be La Cruz Boulevard IN CA 408-~HH-0161 TECH SUPPORT 408-988-0146 Santa Clara. California 9S0S ... FAX 408-988-0609 III HI/I/I/I·.II .... illl'/' II),'i5 Shippillg: -l( ( pili" ~.'.oo halldling 011 all part ordl'r" (l"l'l'pl rasl'S, 9(( + S.'.OOI. APO/FPO \ 1I/I'/lIh('/' III {Itt' Itl'l{('/" It,l\il/I'II Itl/n'lIl/ onll'"'' add X( t ph." ~.\.OO 011 pa .. t O ..dl'''\' ('all Ii, .. l',al'l l'hargl''' 011 S~"tl'l1I' and \Iollitors. (/I/({ (·/t/lll/h,·,. 01 ('/11111111'1'1'/'. ("\ rl'"idl'lIh add 7 (( la'. I'rin'" rl'l'll'l'I Y ( l'a"h diSl'IlIlIlt. 1I0ll{S: \1-1": 9 .\.\1. - 9:00 1'.\1. EST O/l(' }l'ar Hllrralltv Oil :tll Parts And Svstellls ! 7:00 .\.\1.- 7 1'.\1. PST S\T: S\.\I. - 6:00 1'.\1. PST :t/l Order.\' .'-tn' FO.JJ. Sallta Chira. Reader Service Number 130 MICRO CORNUCOPIA, #46, Mar-Apr, 1989 67 Turbo Pascal 5.0 And A Rational Number Toolkit

I've been addicted to debuggers. I could get By Michael S. Hunt Herein Michael covers Turbo Pascal 5.0 and along without them, but I'd hate to. Debug­ unreal reals. I mean real integers. Or is it rational gers, even rudimentary ones, are tremendous 845 E. Wyeth Pocatello, ID 83201 real integers? Ah well, he'll tell you more precisely time savers. (208) 233-7539 than I can. The integrated source level debugger in 5.0 is not full featured like CodeView. Borland recommends that you buy Turbo Debugger n this issue I'll briefly review Turbo Pascal for industrial strength debugging. Scott Ladd 5.0. (This'll be brief compared to the exten­ reviewed Turbo Debugger and Turbo Assem­ sive Modula-2 compiler review coming bler and took a look at what debugging is all Inext issue.) Then for those of you tired of about in his C'ing Clearly column. Look for it numeric roundoff error, check out the rational in Micro C's January/February issue (#45). number toolkit. It contains the basic arithmetic You can purchase Turbo Pascal 5.0, Turbo De­ functions to compute with rational numbers. bugger and Turbo Assembler (as the pro­ After convincing the post office that my fessional package) for $250. mail should be delivered to my house and not Turbo Pascal 5.0 supports the 80x87 E. B. Hunt three blocks away, I received some numeric coprocessors. Compiled programs reader mail. Remember you can write and are smart enough to use the 80x87 if present, complain, explain, applaud or just shoot the or emulate one if not. breeze. I'll even answer. I welcome any sug­ This package can take advantage of EMS gestions for topics or directions for the for overlay files and the integrated editor. The column. I also check the Micro C BBS about overlay manager can load the overlay file into once a week. EMS memory so overlays load faster. If you have 64K of EMS memory, the edit Turbo Pascal 5.0 buffer will be placed in EMS memory. This Well, I've had Turbo Pascal 5.0 for about frees up conventional memory and allows two months now. I like it, I like it. I upgraded you to debug larger programs. The integrated from version 2.0 so many of the features men­ editor is WordStar compatible with some ex­ tioned are also in versions 3.0 and 4.0. tensions for special program editing features. At last, units. I'm a fanatic about reusable The editor is fully configurable so you can code and problem solving tools. I've built and customize the commands to mimic your used modules in Modula-2, but now my 5000 favorite editor. line Pascal programs can be managed instead Borland's Graphics Interface (BGI) unit of manhandled. contains more than 50 graphics routines. BGI Procedure passing is essential for truly supports CGA, MeGA, EGA, VGA, Hercules, flexible tools. The classic example is a sort AT&T 400, 3270 PC and IBM-8514. BGI will procedure that can pass the appropriate com­ autodetect all but the 3270 PC and IBM-8514 parison procedure in the parameter list. With graphics cards. You can link all the device a few sort procedures, several comparison drivers and have the program automatically procedures, and some carefully constructed choose the best resolution at runtime. BGI is selection routines, you can build a very ver­ quite extensive and can help give your pro­ satile sort package. Hmmm, sounds like a gram that polished look. possible column topic. The Turbo Pascal 5.0 package also contains I have several programs in need of some a make utility, a smart linker that removes assembly language speed ups. The ability to unused code, an integrated environment with link .OBJ files and create .EXE files without context sensitive help system, and well writ­ overlays is welcome. (You can still do over­ ten reference and user guides. If you're writ­ lays, though.) ing in Pascal for IBM compatibles, I strongly Ever since I purchased Logitech Modula-2, recommend Turbo Pascal 5.0.

68 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Figure 1 - Rational Number Unit

unit Rational;

interface

type baseType = longint; (* shortint, integer, longint *) ratType = record n : baseType; (* numerator of rational number *) d : baseType (* denomenator of rational number *) end;

function GCD(x, y : baseType) : baseType; function LCM(x, y : baseType) : baseType; procedure LowestTerms(var a : ratType); procedure ComDenom(var a, b : ratType); Get Rational procedure IncRat(var a : ratType); procedure DecRat(var a : ratType); I do a lot of work with floating point procedure ZeroRat(var a : ratType); numbers. I get tired of having my re­ procedure AddRat(a, b : ratType;var c : ratType); sults turn out useless because of the ac­ procedure SubRat(a, b : ratType;var c : ratType); procedure MultRat(a, b : ratType;var c : ratType); cumulated roundoff error after repeated procedure DivRat(a, b : ratType;var c : ratType); multiplication. Even more subtle is the error introduced when we subtract two implementation numbers very close to each other (Le., function GCD(x, y : baseType) : baseType; I a - b I =0.0000001) when we have only six decimal places of accuracy. (* function GCD finds the greatest common divisor of the two numbers Even though we think of computers x and y by the Euclidian Algorithm. *) as being very accurate, floating point var r, d : baseType; numbers are just approximations. In­ begin teger and cardinal values can be repre­ if x < 0 then x := -1 * x; (* set x = Ixl *) sented accurately as sums of powers of if y < 0 then y := -1 * y; (* set y = Iyl *) if x < y then begin two. Since the computer represents r := y; (* swap x and y if Y > x *) everything in binary (powers of two), y := x; (* algorithm expects x >= y *) we can accurately represent integers x := r end; and cardinals. if y = 0 then The trick would be to represent real GCD := x numbers with integers. This is where else rational numbers come to the rescue. A begin repeat rational number is any number that can d := x; (* repeat Euclidian Algorithm until *) be represented in the form alb where a x := y; and b are integers and b is not equal to r := y; (* a remainder of zero is obtained *) y := d mod r; zero. Since the rational numbers are until y = 0; only a subset of the real numbers, GCD := r (* then set GCD to be previous remainder *) they're a bit limited. The square root of end 2 and pi are not rational numbers. end; (* GCD *) If your math can be restricted to function LCM(x, y : baseType) : baseType; rational numbers, you can avoid round­ off error. The unit Rational (Figure 1) is (* function LCM finds the least common multiple of the two numbers x and y by determining the GCD of the two numbers and then applying a set of basic tools for arithmetic with the rule la*bl = GCD(a,b)*LCM(a,b) *) rational numbers. Figure 2 lists the tools. var g : baseType; begin LCM := abs(x*y) div GCD(x, y) The Euclidean Algorithm end; (* LCM *) The real workhorse of the unit is the GCD function, called by all the other procedure LowestTerms(var a ratType) ; var g : baseType; procedures and functions in the unit ex­ begin cept ZeroRat. Using the Euclidean Algo­ if a.n = 0 then (* if numerator then set denominator *) rithm, GCD finds the greatest common a.d := 1 (* to smallest positive number *) divisor for any two numbers. else 'I begin (* find the GCD of the numerator *) The Euclidean Algorithm decom­ g := GCD(a.n, a.d); (* and the denominator *) poses a pair of numbers x and y, where a.n := a.n div g; (* divide numerator by GCD *) x and yare not both zero and x >= y, by a.d := a.d div g (* divide denominator by GCD *) end calculating r = x mod y. It then lets x = end; (* LowestTerms *) y and y = rand repeats the process until r = O. When r = 0, the previous r or continued next page the last nonzero r is the greatest com- MICRO CORNUCOPIA, #46, Mar-Apr, 1989 69 Figure 1 continued from page 69 CONSULTANTS • procedure ComOenom(var a, b : ratType); (* ~ind a common dena.inator .) var m : baseType; (* ~or a , b and adjust thea .) PROGRAMMERS' beqin m :- LCM(a.d, b.d); (* ~ind LeN o~ a.d and b.d *) ANALYSTS get a.n :- a.n * (m div a.d); (* .et a.n to ne. value *) a.d :- m; (* .et a.d to LeN o~ denominator. *) b.n :- b.n * (m div b.d); (* set b.n to new value .) b.d :- m (* .et b.d to LCM o~ denominator•• ) DiseOoc'" end; (* ComOenom *) procedure IncRat(var a : ratType); (* incr... nt a by 1 *) beqin the most advanced a.n :- a.n + a.d; (* add denominator to numerator *) SOURCE GENERATING Lo.e.t'l'erms(a) (* reduce a to lowe.t terms *) DISASSEMBLER AVAILABLE end; (* IncRat *) for the IBM PCIXT/AT/PS2/compatibles procedure DecRat(var a : ratType); (* decr... nt a by 1 *) beqin DIS-DOC can help you a.n :- a.n - a.d; (* subtract numerator ~roa denominator *) - find and fix bugs in any program Lo.est'l'erms(a) (* reduce a to lowest terms *) - re-create lost source code endi (* DecRat *) - a great companion utility to compiler and assembler procedure ZeroRat(var a : ratType); (* set a to 0 *) begin - able to give you a great source of a.n := 0; (* set numerator to .ero *) professional programming examples. a.d := 1 (* set denominator to smallest po.itive number *) - And Much Much More! end; (* ZeroRat *)

DIS-DOC is: procedure AddRat(a, b : ratType; (* add a and b and place *) FAST var c : ratType); (* re.ult in c, a+b • c *) • Disassembles files up to 500kb in size var 1, g : base'l'ype; OR RAMIROM memory at a rate of beqin Lo.est'l'erms (a) ; (* reduce a to lowe.t terms *) 10,000 lines per minute. Lo.est'l'erms (b) i (* reduce b to lowest terms *) ACCURATE CollIDe nom (a, b); (* convert a , b to common denominator *) - Uses seven passes and over 20 SECRET c.n :- a.n + b.n; algorithms to separate code from data c.d :- a.d; to make the most accurate listing on Lo.est'l'erms (c) (* reduce c to lowest terms *) the market. end; (* AddRat *)

FLEXIBLE procedure SubRat(a, b : ratTypei (* subtract b ~roa a and place *) • Creates a MASM ready listing for easy var c : ratType)i (* re.ult in c, a-b • c *) re·assembly of your disassembly and beqin only needs 320kb of memory. Lo.est'l'erms (a) ; (* reduce a to lowe.t terms *) Lo.est'l'erms (b) ; (* reduce b to lowest terms *) TECHNICALL y ADVANCED ComOenom(a, b); (* convert a , b to common denominator *) • The only disassembler that disassemles c.n :- a.n - b.ni all instruction sets including 80386180387. c.d :- a.d; - And has a built·in patcher to make Lo.est'l'erms(c) (* reduce c to lowest terms *) changes without having to re·assemble. end; (* SubRat *)

DIS-DOC also includes BIOS labeling and procedure MultRat(a, b : ratType; (* multiply a and b and place *) its own word processor in its package. var c : ratType); (* result in c, a*b - c *) beqin DIS-DOC is a proven programmer's Lo.e.t'l'erms (a) ; (* reduce a to lo.e.t terms *) tool and is simply a must for the Lo.est'l'erms (b) ; (* reduce b to lowest terms *) consultants, programmers or analysts. c.n :- a.n * b.n; (* multiply numerators *) c.d :- a.d * b.d; (* multiply denominator. *) We CHALLENGE you to find Lowest'l'erms(c) (* reduce c to lowest terms *) anything that can beat Dis· Doc! end; (* MultRat *) procedure DivRat(a, b : ratType; (* divide a by b and place *) DIS-nOC $99.95 var c : ratType); (* re.ult in c, alb • c *) EXE Unpacker $29.95 begin FREE DEMO DISK i~ b.n - 0 then ZeroRat(c) (* i~ division by 0 then c - 0 *) add $4.00 for S&H in the USA el.e $10.00 for outside USA begin 30 day money back guarantee Lowe.t'l'erms(a); (* reduce a to lo.est terms *) To order or get more information Lo.est'l'erms (b); (* reduce b to lowe.t terms *) CALL 800·446·4656 today! c.n := a.n * b.d; (* invert b and multiply by *) c.d := a.d * b.n; (* a to qet c *) RJSwantek, Inc. Lo.est'l'erms(c) (* reduce c to lowe.t terms *) ~ 178 Brookside Road ~ end ~ Newington, CT 06111 ~ end; (* DivRat *) (203) 560·0236 begin end. 1***1 Reader Service Number 142

70 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Figure 2 - Rational Number Tools MODULA-2 baseType shortint, integer or longint Something about using an advanced ratType record of numerator and denominator of baseType language inspires great work. The world's GCD returns the greatest common divisor of two numbers best programmers choose ModuJa-2. LCM returns the least common multiple of two numbers PM! publishes the best of their efforts: LowestTerms reduces fraction to lowest terms ComDenom converts two rational to a common denominator * Repertoir~: By Charles Bradford and Cole IncRat increments a rational by 1 Brecheen. After five major new releases since DecRat decrements a rational by 1 its introduction in 1985, Repertoire is now the ZeroRat sets a rational to zero most mature, reliable, and widely used Modula- 2 toolkit in the world. Includes unusually AddRat adds two rationals powerful screen design/display system pat­ SubRat subtracts two rationals terned after MS Windows; sophisticated list­ MultRat multiplies two rationals oriented OBMS; text editor; natural language DivRat divides two rationals analyzer; transparent EMS compatibility; and extensive string manipulation support. Object code works conveniently with any Microsoft­ compatible language (prototyped headers for C included). Includes full source S149 (over 1.2MB), and 400pp. manual. * Graphix: By Leonard Yates. The Modula-2 interface to the remarkable MetaWindow graphics library. Supports multiple fonts, mouse tracking, many printers (incl. Post­ Script & LaserJet), over 30 display adapters, mon divisor, the greatest divisor of both Warning! and hundreds of modes. Includes Meta Window package and source S189 a and b. The unit rational does have some for interface.. • • • • • • • • • • • • • limitations. It doesn't detect integer * Repertoir~ / Btrie~ Toolkit: By Gregory 001 = 357 * 2 + 287 overflow or underflow. It makes an at­ Higgins. Novell/SoftCraft·s Btrieve file 357 = 287 * 1 + 70 manager is the standard for large business tempt to avoid these errors by calling applications. R/BT is a massive support system 287= 70 *4+ 7 LowestTerms before and after opera­ for building Btrieve applications with Reper­ 70 = 7*10 + 0 tions on the numbers. This unit also toire's screen system. Includes a customizable customer-tracking application. Ideal for con­ assumes a nonzero denominator, sultants. Includes all of Repertoire's object code In this case, the Euclidean Algorithm ratType.d, and a nonzero deviser. You (but not its source) and full source S149 applies to 1001 and 357. The last non­ can change the size and range of the for R/BT modules .•••••••••• * EmsStorage™: By Charles Bradford and Cole zero remainder is 7, so 7 is the greatest rational numbers by changing the base­ Brecheen. Primitive EMS systems can't allocate common divisor of 1001 and 357. For Type declaration. You can use the IEEE chunks smaller than 16K; EmsStorage is a handle-oriented, high-level subsystem that more on the Euclidean Algorithm, con­ integer type comp, but all div's must be manages objects as small as 1 byte. Detects and sult a book on Modern or Abstract alge­ replaced with /'s. uses UM Expanded Memory if present, or DOS bra. I made no provisions for output or memory if not. Provides automatic garbage collection. Includes full $89 Two rational numbers must have the conversion to and from real data types. source code. • • • • • • • • • • • • • • • M same denominator before you can add As Larry Fogg says: "But I leave these * NetMotf : By Donald Dumitru. Makes it easy them together or find their difference. as exercises for the reader. (The ultimate to take advantage of Novell's NetWare operat­ ing system for local-area networks. Provides The function LCM finds the least com­ academic cop-out.)" simple, efficient access to every important mon multiple of two numbers. The least function of Advanced NetWare 2.0. Includes common multiple of the denominators Next Time thorough documentation and full $89 source code .••••••••••••••• is the smallest number they will both Next issue I'll have a Modula-2 com­ * Macro2™: By Kurt Welgehausen. Brings the divide into. This is the smallest common piler review, complete with bench­ full power of C's macro preprocessor to denominator. ComDenom uses LCM to marks, compiler comparisons and pro­ Modula-2; provides DEFINE, UNDEFINE, IFDEF, IFNDEF, INCLUDE, etc., for para­ convert two rational numbers to the gramming environment summaries. So meterized macro functions, conditional same denominator. far I have one CP/M and four MS-DOS compilation, etc. Includes $89 Inc Rat and DecRat increment and compilers, and I have a good lead on a full source:. • • • • • • • • • • • • • • • * DynaMatrix™: By James Bones. A complete decrement the rational number by one, shareware compiler. After the compiler object-oriented library for manipulating large, respectively. ZeroRat sets the rational to review, I'll cover the graphics toolkit sparse matrices. Includes $69 zero. The numerator is zero and the de­ that I've been wanting to work on for a full source .•••••••••••••••• * ModBase: By Donald Fletcher & John nominator is one. AddRat, SubRat, long time. Then on to ... well you de­ McMonagle. A B-Tree DBMS that uses a data MultRat and DivRat each perform the cide. Tune in next time for the latest file format compatible with dBase III. Release indicated operation on a and b and re­ episode of "Compiler Wars." (Music 2.0 is four times faster and includes $39 all new manual and full source .•••• turn the result in c. fades. Lights come up.) Supported compilers: JPI TopSpeed, Logitech, These tools provide only the basic StonyBrook, FST, FTL, et al. arithmetic for the rational numbers. Try Overseas shipping:. • • • • • • • • • •• $15. writing a procedure such as ExpoRat • • • All products available exclusively from PM!,' that returns a rational to an exponential dealer inquiries welcome. VISA/MC power. Or do operations on vectors and AMEX/COD/PO matrices of rational numbers. Hmmm, a PMI Telex: 6502691013 matrix toolkit, maybe even sparse, that's 4536 SE 50th TEL: (503) 777-8844 another possible column topic. Portland, OR 97206 FAX: (503) 777-0934

Reader Service Number 140

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 71 Around the Bend Continued from page 4 help, to donate their time so we'll have another one. "I just at­ you are waiting for a theme issue that fits your expertise. tended my first SaG, people don't know what they're missing, Don't wait. it's like nothing else." ... "I'll help, though I'm not sure what We're not limited to theme articles in theme issues. One of I'd do from here." our strengths is our mix of the weird and the arcane. So, for Distribute SOG. We might make it like the SaG of old, instance, we have hardware articles in this (software tools) only spread out. That way a club (or even an individual) could issue. And, of course, we ran the."Assembler Is Better Than help by holding a smaller, more informal SaG. Ideally we'd C" article in the C issue. (Boy, did that generate mail.) wind up with three to five regional events ... Northwest, Anyway, if you have ideas, call us. Somebody's got to Southwest, Northeast, Southeast, and Middle-east (Midwest?). make these theme issues interesting. If you've always dreamed of being surrounded by techies and you know of a wonderful campground, assembly hall, The Theme Issues Are Already Interesting mountain top, farmer's field, picturesque community, seacoast, Robotics is going to be hot. I mean HOT. I'm talking front or whatever - call. burner. Loren Heiny is working on an article on visual recog­ By talking we might both decide your place is crazy or it's nition, and Bob Namsel is finishing up a cheap ($300) robot perfect. Hopefully, we'll come up with locations people would complete with an ME (Mail-in EPROM). Based on the 64180 enjoy visiting. Places where we can gather for two or three (Z80 look-alike), it'll be a maze runner complete with IR range days of laid-back babble and technology, places I can write sensors, bumper switches, solid state compass, and so on. about in Micro C. He's proposing that groups build a single robot and have Anyway, call with your suggestions. And call soon. (I hope members design and burn ROMs. Each group will hold com­ it's not too late this year to pull it off.) Anyway, we'll an­ petitions as members tryout their own ROM programming nounce what we come up with in Micro C: times, dates, what prowess. people need to bring (sleeping bags or credit cards), who to Then, the top ROMs from each group would be sent to Bob contact, what to expect, lodging options and prices ... for the national runoff (amazing). The best ROM wins. If possible, I'll attend them all. After all, I haven't missed a SaG yet. (The last three weeks in July, September, or Novem­ Official Programmer's Diet ber would work best for me.) If you've been programming any length of time (Le. since midnight, last Friday) you know the importance of maintain­ Send Us Your Tech Tips ing your health. So you carefully plan your diet around the As strange as it might seem, Tech Tips is the best read por­ seven hacker food groups - twinkies, cola, coffee, chips, tion of Micro C. (Yep, that tiny little column that's written by chocolate, cold pizza, and Rolaids. you.) However, I've got to pass along some of what I'm hearing Unfortunately, each issue we scratch for good tips. I'd like in Aviation Consumer, a small (but expensive) newsletter on the column to be the longest (okay, the second-longest) in flying. Micro C. To do that we need your help. Pilots have to watch their health. They're not supposed to The biggest question: what makes a good tech tip? Send us have seizures, fainting spells, heart attacks, migraines, short­ things you've discovered about: servicing PCs, putting to­ ness of breath and such while they're flying. Distracts from the gether new hardware, locating cheap parts, surprises you've job. Every year or two (depending on type of license), each found in common assemblers or compilers, and things you do pilot gets a physical and during the exam he gets checked for to make your work easier. a whole list of conditions, any of which would send him to the Send them to: unemployment office. We all know about chocolate, chips, and pizza. They're Tech Tips good artery pluggers. But that's pretty slow and painless. Micro C Dept. Of Information Now, it appears, some pilots are having trouble with Nutra­ P.O. Box 223 Sweet, the sugary tasting stuff residing in just about every "re­ Bend, OR 97709 duced calorie" product on the market. The problem came to light when a pilot wrote in saying Send disk, paper, or both. Or leave a file or message on the he'd spent several years and about $40,000 being tested. He'd Micro C BBS, (503) 382-7643. had a whole list of problems (including seizures) that had You'll be glad you did, because Tech Tip authors get: three ended his flying. He was a mess. Almost by accident he extra copies of the magazine (at least one of those goes to your stopped drinking six bottles of diet cola a day and stopped mother), and an author's T-shirt. (Non-authors have resorted using all other diet foods. In a week he was a new man. to bribery in their attempts to get one of these exclusive chest Well, a NutraSweet official responded immediately, saying covers.) this person's experience wasn't scientific proof of a problem with their sweetener. Theme Issues Can Also Be Interesting Then a physician followed up with a long treatise on the After announcing the themes of upcoming issues, we've chemical makeup of NutraSweet and the possibility of allergic gotten wonderful response from folks working in those areas. reactions. Another physician added a look at the effects of For instance, an automated milling machine just offered to do large doses of caffeine. (Many of the pilot's complaints a piece for the robotics issue (it's about a cousin of his who matched the side effects of caffeine.) welds underbodies for GM). On the other hand, a number of Meanwhile, another pilot who'd been having similar health

72 MICRO CORNUCOPIA, #46, Mar-Apr 1989 problems reported he'd stopped using dietetic gum and candy the pair. SpinRite will cost you $69.95. after reading the original letter. He reported that his problems, One note. Use DISKCOPY to make one or more copies of too, disappeared after a week. the SpinRite master disk before doing anything. Then use the So, if you're weirder than you'd like to be (or weirder than copy. If you ever use the master to create a working disk, someone close to you would like), you might want to modify you'll only be able to use SpinRite on that system. (You'll find your diet slightly. (Chitlins and sprouts with salsa?) the same instructions in the installation section of the manual.)

Hard Drive Relief Gibson Research "Hello, Micro C?" 22991 La Cadena Yep. Laguna Hills, CA 92653 "My 20 meg hard drive hasn't been booting dependably." (714) 830-2200 Yep. "Should I get a new drive?" Better Graphics Yep. As long as I'm talking about things I'm excited about I Actually you probably don't need a new drive - you just might as well tell you about three new graphics packages. need to give the drive you have a little help. Most drive prob­ Adobe Illustrator has been running on the Mac just about lems show up after a year or so, and usually it's because the forever and I'd heard serious rumors (press releases) that unit's having a harder and harder time reading data. (Usually they'd be showing their PC version at Comdex. the head's in one place, the track's in another.) The only way I looked for Adobe. No Adobe. I made a beeline for the to straighten things out is to do a real, low level, reformat. Apple room. No Adobe. (They were there last year.) I asked Unfortunately low level formats are a pain. You back the Apple staffers where I could find Adobe. everything off the hard drive onto ten zillion little floppies, 1/Adobe who?" run DEBUG to get into the controller's formatter, run FDISK, How quickly they forget. Illustrator must have sold thou­ run FORMAT, and then copy all that data back onto the hard sands and thousands of Macs. drive. I'm talking hours, assuming everything works properly. However, Digital Research (you remember them, the guys In issue #42 I wrote an article titled "Keeping Your Hard who wrote CP / something) snuck in with an announcement of Drives Running." In it I mentioned a package called Disk Artline. I don't know Illustrator well enough to know whether Technician. Disk Technician watches for recoverable data er­ Artline is better or worse, but it looks wonderful. (In the rors. (Errors which MS-DOS ignores.) manual they show you how to draw an apple - draw your When the package finds a track with errors, it stores the own conclusion.) corrected information in memory, reformats the track, and Anyway, it lets you bend type, create shadows, sketch over then rewrites the data. You're supposed to run the program scanned images (you can't edit scanned images because Art­ every day and over a year you'll probably get a pretty line manipulates vectors, not pixels), draw, and fill, and all complete low level reformat (as it's needed). those fancy things. (You have to have expanded memory to I had two problems with Disk Technician. It was copy pro­ store the pixel images you're going to trace.) tected, and it worked best when run everyday. Also, it was de­ We've had a similar package called Designer, but Sandy signed for people who don't want any choice about what hap­ and Carol find it very difficult to use. pens (micro-power users). (I should add that I just received a Finally, Arts & Letters also announced their Editor package. new copy of Disk Technician and they've upgraded it a bit, It's very, very similar to Artline but includes a much larger li­ made it run on more machines, and they've removed the copy brary of vector drawings. protection.) Artline runs under Gem. Arts & Letters runs under Win­ Anyway, in that article I also talked about H-Test and H­ dows. Format. H-Format tests your hard drive for optimum inter­ We've received both Artline and Editor and Sandy used leave and then does the optimum low-level format without both in this issue. Artline generated the Go board on page 96 wiping out data. Wonderful package. (upper left-hand corner) and the diagram on page 37. The Arts & Letters Editor generated the books on page 95 (lower left­ SpinRite hand corner) and the illustrations on pages 33, 53, and 54. She A month ago I got a copy of SpinRite. It's a pretty complete had almost no trouble figuring out either program. (We have a combination of Disk Technician and H-Format. more complete report in the works.) It'll tell you the optimum interleave and do a low level re­ (Carol used Publisher's Paintbrush to create and edit the format using the interleave of your choice (without wiping out robot on page 95. Paintbrush works very well for editing data). It'll thoroughly test your hard drive surface and (if you scanned and other pixel images.) tell it to) even recover tracks that you locked out during the original format. Plus, it'll recover data from bad sectors (if possible). It has super displays - tells you a lot about your hard drive - is trivial to use - detects, displays, and fixes bit er­ rors (if possible) - and it runs fast. It's hard drive insurance and a lot more. (Plus it's not copy protected.) Disk Technician and H-Format sell for $99.95 each so you'd pay nearly $200 for

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 73 vLIB Handling Interrupts With Any C, Listings ~!!!.!..~,~'?!.~~~.1.!...~!Zl~~E. Continued from page 22 ==> Develop applications fasterl ==> Use vLIB to give your programs Figure 3 - ISRHT.C isr handler template. a professional look with a sophisticated and consistent lasm user interface! dataseg segment para public 'data' extrn _Dorg_:byte vUB is a comprehensive, easy to use library of over 175 custom C public _ISRHT_LENGTH_, _ISRHT_PTR functions for building sophisti­ ISRHT LENGTH dw (offset p2 - offset pl) cated PC applications. :ISRHT:PTR_ - dw offset pl dw seg pl Windows • overlapping, tiled, built-in window dataseg ends management ;This code gets moved later to a structure in RAM. ;The correct SS and SP values, as well as the Menus • vertical, horizontal ;address of the C function to call, are installed pulldown, popup, ;at that time. dropdown, arrays codeseg segment para public 'code' Forms • full screen or pl: popup data entry public isr template with multiple field isr_template proc far types ; flags Pop Ups • messages, prompts, ;CS ;IP selection lists, push bp ;save the callers registers scroll bars push si push di Mouse Support push ds Formatted Screen Output push dx push ax Full Editing Input push cx High Speed Display push es push bx Color Control mov ax, seg _Dorg_ iget local data segm value ... and much, much morel mov ds, ax mov es, ax Compilers supported: Microsoft C and Quick C, Borland Turbo C, mov ax, 0 ;push a pointer to the ISRH push ax WATCOM C6.5, and Lattice C. All mov ax, 0 iOS will be replaced later memory models. push ax library with 280 page call iisr_template also replaced manual . . . . .$99 pop ax ;restore pOinter we pushed pop ax pop bx irestore callers registers library with manual and pop es full source code . . . $149 pop cx pop ax Visa and MasterCard accepted. S5 ship­ pop dx ping and handling. California residents pop ds please add 7% sales tax. pop di pop si No royalties or additional fees. Site pop bp license available. jmp isr_template ;jump to previous handler

Demo disk with usable sample isr_template endp programs and source is available. p2: call or write: codeseg ends

Pathfinder Associates lendasm 291 Madrone Avenue Santa Clara, C4 95051 *** (408) 984-2256 DDS: (408) 246-0164 Continued on page 76

Reader Service Number 145

74 MICRO CORNUCOPIA, #46, Mar-Apr 1989 McTek LCD Portable (Also available in PlASMA PORTABLE) (Including Hard Disk Only 19lhs.) ~j}j}IT286

The McTek Rabbit-286 LCD Portable monochrome monitor. Included combines the fastest, most reliable also is an external 51j.( floppy port AT motherboard available with for reading and converting to 3V{' most visible full-size LCD port- disks (5 1A" external drive w/~: able screen on the market $179 when purchased with LCD Running at a switchable 8 Portable). The McThk Rabbit-286 or 10 MHz ~ \Wit state, it LCD Portable comes fully assembled includes a 20MB hard with our one-year parts & labor disk, nOKB 3W' floppy guarantee, and sells for an amazing, drive, parallel & serial ports, A\Wrd 3.03 bios, 640k & turbo resolution 640x400 super twisted LCD with adjustable Of~~~lete price $17991 indicator LCD. The screen is a fantas- intensity and screen-angle. The screen size is 9.5"x6'~ 386-20 MHz tically readable, electroluminescently It's as readable as a CRT. You can also plug in a digital W/IMB backli~ 8O-column by 25-line, high or analog color monitor or a digital or composite $27991

$139900 $209900 $239900 12MHzlO Walt State 16MHzlO Walt State 20MHzlO Wait State Assembled & Tested IBM@ AT Compatible Assembled & Tested IBM@ AT Compatible Assembled & Tested IBM® AT Compatible MS-DOS@ OS/2@ Compatible . MS-DOS@ OS/2® & UNIX@ Compatible MS-DOS@ OS/2® & UNIX@ Compatible .8028612/6 MHz • 80386 16/8 MHz Norton V4.0 SI17.6 • 80386 20/8 MHz Norton V4.0 SI 22 • Phoenix BIOS • Phoenix BIOS • Phoenix BIOS • 640K of RAM Expandable to 4MB • 1MB expandable to 16MB RAM • 1MB expandable to 16MB RAM • 0 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 • Ports: 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 • 20MB Hard Disk (28MS) • 40MB Hard Disk (28MS) Options:...... Call Options:...... Call Options:...... Call

McTek Systems, Inc. -1411 San Pablo Avenue· Berkeley, CA 94702· 415-525-5129

DISK DRIVES PRINTERS MONITORS PC/XT PC/AT MISC.

Fujitsu 360k ...... $69 Citizen CD 120 ...... $149 Samsung amber ...... $79 640k TurboMothrbrd ...... $80 McTek286-20MHz ...... $449 Kingtech CRT Portable Kits: Fujitsu 1.2MB ...... •....•...... $89 Citizen CD 180 ...... $189 Samsung EGA color ..... $359 10MHz TurboMothrbrd ... $85 Baby McTek 286B-AT XT/AT (power supply. case keyboard. monitor) Teac ...... $75 HPLASAR SeriaI2 ...... $1699 Samsung RGB color ..... $259 Multi 1/0 w/disk contrir... $59 8/100-wait ...... $249 ...... $380/$410 Teac 1.2MB ...... $95 Epson LX-800 ...... $219 NEC Multisync ...... $559 640k RAM card ...... $39 McTek 386-16MHz ...... $859 Eprom burner 4-socket$139 Toshiba 3'12" 720K ...... $89 Epson LO·SOO ...... $379 Sony Multiscan ...... $619 2MB Expansion card ...... $89 McTek 386-20MHz ...... $899 LCD Portable ...... $799 Teac 3',,,.' I.4MB ...... $105 Toshiba 321 XL ...... $519 HGC·compal.mono card.$49 RS232 2-port card ...... $35 McTek 386-24MHz ...... $999 Plasma Portable Kits .. $1499 20MB Hard Disk Kit ...... $279 NEC P2000 ...... $369 Color graphic card...... $49 4-serial port card ...... $79 Locking slide case ...... S59 AC power strips ...... $15 30MB Hard Disk Kit...... $309 Call for prices of other brands EGA Paradise 480 ...... $149 Game I/O card ...... $15 200W power supply ...... $65 Diskette file box ...... $9 ST-225 ...... $215 VGA Paradise ...... $279 384k Multifunction card ... $69 Enhanced keyboard ...... $59 Printer or serial cable ...... $8 8425 Miniscribe...... $249 MODEMS Genoa Super VGA ...... $299 FCC·app. slide XTcase .. $29 WO FD/HDC ...... $129 DTC FOC/HOC 1:1 ...... $189 Archive Tape Backup 8438 30MB Miniscribe $259 150W power supply ...... $49 40MB ...... $339 3650 40MB Miniscribe $349 Everex inl. 300/1200 ...... $79 MOUSE XT keyboard ...... $42 3MB EMS (aK) ...... $99 3675 60MB Miniscribe $379 Everex 2400 external ..... $195 Clock Card ...... $19 DESKTOP XT l00MHz 640k ST-157 49MB 3'12" ...... $479 Everex 2400 internal. .... $179 Logimouse C7 ...... $69 Floppy Controller ...... $19 2 Drive System ...... $759 Logimouse HI Res ...... $99

Reader Service Number 42

MICRO CORNUCOPIA, #46, Mar-Apr 1989 7S Continued from page 74

Figure 4 - ISR.H support for interrupt handlers void far (1thandler) (»; void isr_restore(isrh 1tisr);

#ifndef uchar /1t1t1t/ #include #endif

#Undef OP IRET #include #endU

#ifndef AX #include #endif Figure 5 - ISR.C support code for ISRs

#define ISR.-HDR_LOADED #include /1t REGS - Structure of a register file. #pragma vpindex isr_get_vector A far pointer to this structure is passed to the void far 1tisr_get_vector( inum interrupt handlers by the traps. The CPO registers int inum; are also passed in the order shown below. { return (void far 1t) (1t«long far 1t) «long) It's therefore possible to declare a handler like: (inum 1t 4»»; void far int_24_handler( isr, r1, r2 ) isrh 1tisr; _ -pregs r1, r2; #pragma vpindex isr_set_vector {} void isr set vector( inum, farfuncp void far-( 1t farfuncp) (); Which is much easier than the alternative ... int inum; This only works if your compiler supports passing ( structures by value (By now, there probably aren't #asm many that don't ... ) mov ax,word ptr 4[bp] 1t/ shl ax,l shl aX,l typedef struct ISR_REGS mov dx,O __regdp esbx; mov es,dx reg c; mov bx,ax - -reg3r dsdxax; mov dx,word ptr 8[bp] unsigned int di; mov aX,word ptr 6[bp] __regdp bpsi; cli _ -pcreg pc; mov es:word ptr 2[bx],dx reqpsw psw; mov es:word ptr O[bx],ax 1sr_regs; sti #endasm } /1t The code to intercept an interrupt and call a C function is copied into a structure of the follow­ ing type for each handler that's needed. The #pragma vpindex isr_install required patches to the code are then made. void isr install( isr, isr num, handler) isr install() sets up the interrupt vectors, and isrh 1tisr; - returns. isr restore() restores the previous int isr num; handler, and-isr-paSS() calls the previous void far (1thandler) (); handler. ( The code for this trap is in ISRHT.C. extern int ISRHT LENGTH; 1t/ extern unsi9ned char far 1t_ISRHT_PTR; int i; typedef struct ISRH uchar code1[17]; setmem{ isr, sizeof 1tisr, 0 ); uint isrhs; /1t use long form of movmemO to avoid uchar code2[2]; problems with the different memory models •.. uint isrho; 1t/ uchar code3[2]; for ( i = 0; i < ISRHT LENGTH; i++ ) void far (1thndlr) (); «char 1t)isr) [I] = _ISRHT_PTR[i]; uchar code4 [11] ; uchar code jmpf; isr->hndlr = handler; void far (*prev_hndlr) (); isr->isr num = isr num; int isr num; isr->isrho = «long) «void far 1t)isr» , Oxffff; int count; isr->isrhs = «long) «void far 1t)isr» » 16; void far 1tstack; isr->prev_hndlr = isr_get_vector( isr_num ); isrh; if ( !isr->prev hndlr ) isr->code_jmPf = OP_IRET; #define isr-pass(i) (i)-code jmpf= i-prev hndlr ? OP JMPF-: OP IRET) - isr_set_vector{ isr_num, (void far (1t) (»isr ); #define isr iret(i) (i)~code jmpf~ OP IRET) #define isr:retf(i) (i)-Code:jmpf= OP:RETF)

void far 1tisr get vector(int inum); #pragma vpindex isr_restore void isr set vector(int inum,void far (1tfarfuncp) (»; void isr restore( isr ) void isr:install(iSrh 1tisr,int isr_num, isrh 1tisr;

76 MICRO CORNUCOPIA, #46, Mar-Apr 1989 void far int_23( isr, _REGS isrh *isri isr regs REGSi {- - #ifdef MAIN CARRY = Oi isr_iret( isr )i volatile long Ci volatile int ki #endif

*** main() { isrh isrl, isr2, isr3, isrxi void far int lc(), int 09(), int_23()i int ascii i - -

seg86( REGSP)i __regs:dump( _REGSP ) i

isr install( &isrl, Oxlc, int lc )i Figure 6 - CPU.H CPU related #defs etc. isr-install( &isr2, Ox09, int-09 )i isr:install( &isr3, Ox23, int:23 )i /* 8086 cpu opcodes */ printf("\nBet ya can't "C, "BREAK or \ CTRL-ALT-DEL out'a this one!\n"); #define OP JMPF Oxea /* far jump instruction */ printf("(hit ESC when you give up!)\n\n")i #define OP:CALLF Ox9a /* far call instruction */ #define OP_RETF Oxcb /* far return instruction */ ascii = Oi #define OP INT Oxcd /* software int instr. */ do #define OP:lRET Oxcf /* return from interrupt */ { printf("Tima: IUds, Last Scan code: %x \r", c * 101 / 1821, k )i /* CPU flag register bit masks if ( constat () ) */ ascii = conin()i while ( ascii != 27 ); #define FLG_RESf Ox8000 /* unused */ #define FLG RESe Ox4000 isr restore( &isr1 )i #define FLG:RESd Ox2000 isr-restore( &isr2 )i #define FLG_RESc Ox1000 isr:restore( &isr3 )i #define FLG_OF Ox0800 /* overflow */ #define FLG_DIR Ox0400 /* O=inc, l=dec */ #define FLG_INTE Ox0200 /* Int Enable */ #define FLG TRAP Ox0100 /* l=single step */ int coninO #define FLG:SIGN Ox0080 /* l=result NEG */ { #define FLG ZERO Ox0040 /* l=result ZERO */ pcdos( Ox08 ); #define FLG:RESS Ox0020 return _ALi #define FLG AUXC Ox0010 /* Aux carry flag */ #define FLG:RES3 Ox0008 #define FLG PE Ox0004 /* l=even # 1 bits */ #define FLG-RES1 Ox0002 int constat () #define FLG:CARRY Ox0001 /* Carry Flag */ { pcdos( OxOb )i #asm return! '_ALi FLG OF equ 0800h FLG:DIR equ 0400h FLG_INTE equ 0200h void far int_09( isr, _REGS FLG_TRAP equ 0100h isrh *isri FLG_SIGN equ 0080h isr regs REGS; FLG ZERO equ 0040h {- - FLG:AUXC equ 0010h static int ctrli FLG PE equ 0004h FLG:CARRY equ 0001h k = inportb( Ox60 ); #endasm if ( k = 29 ) /* control key pressed */ ctrl = 1i /* Structure of the PSW register ... else if ( k = 29+0x80 )/* control key released*/ ctrl = 0; WARNING: else if (ctrl " (k = 46 II k = 70 II k = 83» { /* don't allow "c, "BREAK or "DEL */ "There are a number of caveats that apply to (bit) outportb( Ox61, inportb( Ox61 ) I Ox80 )i fields. Perhaps most significant, fields are assigned outportb( Ox61, inportb( Ox61 ) & Ox7f ) ; left to right on some machines and right to left on outportb( Ox20, Ox20 )i others, reflecting the nature of different hardware. isr_iret( isr ); This means that although fields are quite useful for returni maintaining internally-defined data structures, the } ; question of which end comes first has to be carefully isr.J>ass( isr ); conaidorod ... " - K&R, page 138. */ void far int 1c( isr, _REGS isrh *isri - typedef struct __FLAGS isr regs REGS; {- unsigned carry : 1i - unsigned res1 : 1i c++; unsigned pe : 1i isr.J>ass( isr )i Continued on page 78

MICRO CORNUCOPIA, #46, Mar-Apr 1989 77 Continued from page 77 public _STlPTR_,_SP_,_SS_ unaigned res3 1; unsigned awec 1; _ESBX_ label dword unsigned resS 1; _BX_ label word unaigned zero 1; BL db ? unsigned sign 1; :as: db ? unsigned trap 1; unaigned inte 1; _ES_ dw ? unsigned dir : 1; unaigned of : 1; CX label word unaigned reac 1; -CL- db ? unsigned read 1; :cs: db ? unaigned re.e 1; unaigned reaf 1; OXAX label ciword __naga; -AX - label word :AL: db ? /***/ _AIL db ? OSOX label dword :OX_ - label word OL db ? :os: db ? _OS_ dw ? Figure 7 - REGSDUMP.C dumps a __regs structure _01_ dw ? ,include _BPSI label dword 'define err-printf printf SI - dw ? :BP: dw ? Ipragma vpindex regs dump void __regs_duq;C rp )­ _PC_ label dword __regs far *rp; IP dw ? ( :CS: dw ? 'define _REGS (*rp) _PSW_ dw ? err-printf( "\ax-'OCx ex-,Ob si-'OCx bp-'OCx \ S1'XPTR label dword ds-'04x pc-'04x:'OCx pawh-'02x 'c'c'c'c 'c'c'c'c\n\ -SP -dw bx-'OCx dx-'OCx di-'OCx ea-'OCx \ ? atk-'04x:'04x 1-'02x 'c'c'c'c 'c'c'c'c\n", :SS: dw ? aav_aa dw ? aav_ap dw ? _PSW » 8, rp->paw.bit.reaf ? '1' codeaego ends rp->paw.bit.reae ? '1' rp->paw.bit.read ? '1' 'endasm rp->paw.bit.reac, ?, ' l' _OF ? '0' , 'pragma vpindex caller OIR ? 'd' unaigned int far caller() /* returna CPU FLAGS */ -INTI: ? 'i' ( ? 't' :TRAP "am puah bx ;aave the callera rega puah ex puah ai _PSW , Oxff, puah di _SIGN ? 's' : puah bp ZERO ? '1:' : puah ds rp->psw.bit.reaS ? '1' push ea AUXC ?' a' : '.', iP->paw.bit.rea3 ? '1' mov aav_aa, aa _PE ? 'p' : '.', mov aav_ap, ap rp->psw.bit.rea1 ? '1' _CARRY? 'c' : '.' ); mov ds, _OS_ mov ea, _ES_

/***/ mov ax, AX mov bx, :sx: mov ex, CX mov dx, :OX: mov si, _SI_ Figure 8 - CALLER.C does far calls mov di, 01 mov bp, :BP: 'aam puahf ;in caae we're faking an interrupt call ciword ptr _PC_ codeaego segment para public ' code' mov _AX_' ax public mov _BX_, bx public mov _CX_, ex public mov _OX_, dx public public mov SI , ai public mov -01-, di public mov :BP:, bp

78 MICRO CORNUCOPIA, #46, Mar-Apr 1989 mov DS , da mov :ES:, ea mov SP , ap mov :SS:, aa Neural Net Models puahf Introductory programs with source code pop ax and the compiler used to compile them mov _PSW_, ax Netwllrkz 1M A tutorial neural net model showing a simplifie~ associative mov aa, a av_a a memory network. Uses DATA statements embedded in program to mov ap, aav_ap represent neural processing elements. "... for the price and for a flexible system, I have to recommend it." AI SIG Newsletter. pop ea Connections' The Traveling Salesman TM A loose derivative of pop da the classic Hopfield-Tank model with new algorithms and reduced solution pop bp time. Gives alternative approaches and bibliography. " ... amazing pop eli commercially available program ... Give DAIR a call." Neurocomputers. pop ai pop cx pun Compiler TM A fast system language compiler and its source. pop bx PL/D self-compiles and has an extensive macro capability. It has been 'endaam applied to writing neural net models, compilers, and an EPROM-based } expert system. Review in July Computer Language. /***/ System requirements: DOS 2.0 or above; 256K PC, AT, or compatible or PS/2. Available on 5.25 or 3.5 inch diskette. All packages include compiler object code and user manual.

To order, or for additional information, contact DAIR Computer Systems:

Sing!!: ItCm Prlccs Netwurkz $79.95 Ii' fA\. rllil Computer Figure 9 - CALLER.H header for CALLER modules Connections 87.95 l..:.I~lJ~ Systems PL/D Compiler 124.95 3440 Kenneth Drive Palo Alto, CA 94303 lifndef ISR HDR LOADED Combinations at D!sc;ount 'include ­ Netwurkz + Connections $117.95 (415) 494-7081 'enelif Netwurkz + PL/D 154.95 Connections + PLID 162.95 ' Netwurkz + Connections + PLID 192.95 ....-. /* CPOREGS - Variables used as CPU reg copies. Add sales tax in California. Shipping: $5.00 in North America, $12.50 elsewhere. Orders shipped in 48 hours. Prices US funds on US bank or by credit card. The module "CALLER.C" contains the function caller(), and a variable liat which is in its code segment. Caller() loads the CPU registers with the vars, does the call, then loads the Reader Service Number 90 vars with the CPU registers. The way the vars are defined, their contents can be accessed in a number of ways; ergo the declarations below:

The macros int86(), call86() & pcdos() also use caller 0 . PROMPT DELIVERY!!! */ SAME DAY SHIPPING (USUALLY) ICs QUANTITY ONE PRICES SHOWN for DEC. 13, 1988 extern unsigned char far AR, AL, BH, BL, CH, CL, DH, DL; extern unsigned int far :AX,:BX,:CX,:DX,:SI,:DI,:BP;­ extern unsigned long far DXAX; DYNAMIC RAM extern unsigned char far * far BPSI; SIMM } 1Mx9 80 ns $450.00 extern unsigned char far * far -DSDX; extern unsigned char far * far - ESBX; SIMM ** 1Mx9 85 ns 390.00 extern unsigned int far _DS, _is; SIMM 256Kx9 60 ns 150.00 extern void far (* far PC) ()i 1 Mbit 1Mx1 100 ns 33.00 extern unsigned int far _IP, _CS, _PSW; 41256 256Kx1 60 ns 14.95 extern unsigned char far * far _ STKPTR; extern unsigned int far _SP, _SS; 41256 256Kx1 100 ns 12.95 51258 * 256Kx1 100 ns 13.50 unsigned int far caller(void); 41256 256Kx1 120 ns 12.25 /* the following spaghetti is a work-around ... */ 41264 + 64Kx4 120 ns 17.50 'define xxl (i) (+(ulong) «i) * 4» EPROM 'define - -xx2(i) «long far *) xxl«i») 128Kx8 200 ns $29.50 'define - -xx3(i) (* xx2«i»)- 64Kx8 200 ns 13.95 'define isr get vec(inum) \ 32Kx8 150 ns 8.15 «void far (*) xx3 «ulong) (inum») (» __ 16Kx8 250 ns 4.95 'define call86(farfunc) ( PC = (farfunc), caller() STATIC RAM 'define int86(inum) ( call86( isr get vec( (inum) ) 62256p-10 32Kx8 100 ns 'define pcdos (func) (_AR = (func), int86 (Ox21) ) 6264p-12 8Kx8 120 ns /***/

or UPS Factory New, Prime Parts ..uPoo MICROPROCESSORS UNLIMITED, INC. 24,000 S. Peoria Ave., BEGGS, OK. 74421 (918) 267.4961 No minimum order. Please note that prices are subject to change. Shipping & Insurance extra, & up to $1 for packing materials. Orders received by 9 PM CST can usually be delivered the next morning, via Federal Express Standard Air @ $6.00, or guaranteed next day Priority One @ $10.251

Reader Service Number 37

MICRO CORNUCOPIA, #46, Mar-Apr 1989 79 Letters Continued from page 6

might be a first. PeQple who. want a Katz who. insisted Qn language absQlv­ Tony's column. So far, they haven't re­ sense Qf perspective shQuld read the ar­ ing him Qf any wrQngdQing and who. sponded. ticle. also. insisted that PQrtiQns Qf the settle­ ment be sealed. It is indeed unfQrtunate MaxilPC PCB Update Don Taylor that SEA is nQt a larger cQmpany with Since I wrQte "ChQQsing a PCB Lay­ 13628 SE 20th Circle the reSQurces to. see the suit thrQugh to. Qut System" in Micro C issue #45, I've Vancouver, WA 98684 its bitter end. That way I WQuld imagine gQtten SQme experience with the Racal­ a IQt Qf questiQns, bQth legal and Qther­ Redac Maxi/PC PCB layQut package. wise, WQuld have been settled by the To. fix the prQblems that I was having SEA Defended public recQrd. with the sQftware prQtectiQn device I nQrmally welcQme the delivery Qf All Qf this, Qf CQurse, is speculatiQn. I (key), I had to. purchase a secQnd serial my Micro C and read it vQraciQusly WQuld, hQwever, claim that SEA has I/O card and dedicate it to. the key. This frQm CQver to. CQver. I appreciate yQur perfQrmed a great service to. the micrQ­ was a majQr annQyance at the time and irreverent editQrial style and make gQQd cQmputing cQmmunity. The cQncept Qf delayed me abQut a week frQm getting use Qf the valuable infQrmatiQn in yQur self-cQmpressing archives is ingeniQus started with the package. magazine. I feel cQmpelled to. write to. and has taken the bulletin bQard scene As a test fQr Maxi/PC, I entered the yQU nQW because yQur irreverent style by stQrm. SEA is attempting to. maintain PD32 circuit. FQr yQU neWCQmers, a has becQme irresPQnsible. I'm talking a standard - Qne which will, eventu­ PD32 is a 32016 cQprQcessQr bQard that abQut the Shareware cQlumn by An­ ally, Qperate Qn many different cQmput­ plugs into. an XT bus and runs UNIX. thQny BarcellQs in issue #45. ers and Qperating systems. The bQard and sQftware were featured The amQunt Qf misinfQrmatiQn flying Is SEA hQgging the market? I WQuld at SOG V and in the OctQber INQvem­ arQund abQut SQftware Enhancement say no.. SEA asks fQr no. registratiQn Qr ber 1986 issue Qf Micro C. AssQciate's suit against PKWare is ap­ mQney frQm private users. PKWare The PD32 was designed by GeQrge palling. That yQU WQuld allQw the type dQes. SEA publishes their SQurce cQde SCQlarQ and the firmware and sQftware Qf idle, misinfQrmed speculatiQn that so. that prQgrammers wishing to. build were written by Dave Rand. The hard­ characterized Mr. BarcellQs' cQlumn is utilities cQnsistent with SEA algQrithms ware design was dQnated to. the public also. appalling. may do. SQ. PKWare dQes nQt. dQmain; the sQftware PQrt and UNIX, Qf I dQn't knQw all the facts surrQund­ Quite rightly, SEA asks fQr a CQurse, were nQt. ing the suit between SEA and PKWare, licensing agreement to. use that cQde in The PCB is a full size XT bQard with but I do. knQw that, quite prQperly, SEA a cQmmercial prQgram. I have no. prQb­ 22 ICs and 8 256x8 SIPRAMs (fQr a tQtal has nQt entered the fray while a CQurt lems with this - it is, after all, their in­ Qf 2 Megabytes Qn-bQard). It's a mQd­ actiQn was pending. At the same time, tellectual prQperty. In shQrt, I feel that erately dense layQut and a gQQd test fQr Mr. Katz has apparently mQunted quite PKWare is the cQmpany that has dQne a an autQrQuter. . an effQrt to. try his case Qn the bulletin grave disservice to. the DOS cQmmunity. I placed the ICs mQre Qr less in the bQards rather than in the CQurts. Further, I feel that resPQnsible publi­ same IQcatiQns GeQrge chQse, but The issue, as I understand it, is nQt catiQns such as YQurs and PC World mQved a few Qf the smaller ICs to. IQca­ whether Mr. Katz has develQped a mQre shQuld go. Qut Qf their way to. CQver bQth tiQns which gave a better IQQking rats­ efficient algQrithm - it is Qne Qf theft, sides Qf an explQsive issue such as this nest. BefQre autQrQuting, I allQwed pure and simple. Mr. Katz was alleged Qne fairly and evenly. Put the shQe Qn Maxi/PC to. swap pins and gates. The to. have stQlen large amQunts Qf CQPy­ the Qther fQQt, Mr. ThQmpsQn. If I were PALs, in particular, were pin-swapped righted cQde frQm SEA withQut signing to. take yQur magazine and resell it with quite extensively. TherefQre, the bQard a licensing agreement. a different CQver, Qne which was per­ is nQt wired exactly the same as I say allege because no. Qne will ever haps mQre appealing to. the mass Qf ap­ GeQrge's bQard, but hQpefully it's really knQw what the truth Qf the matter pliance users Qut there, wQuldn't I hear equivalent. is in this case. SEA (which, incidentally, frQm yQur attQrneys rather quickly? The results? Well, there's gQQd and

is not a II much larger" entity than I WQuld hQpe in the interest Qf gQQd bad. On the gQQd side: Maxi/PC rQuted PKWare, as Mr. BarcellQs claims) had jQurnalism that yQU WQuld CQver issues all but 25 Qf the 662 cQnnectiQns Qn the an expert witness examine SQurce cQde mQre fairly in the future, Qr nQt at all. bQard, and accQmplished this in abQut frQm ARC and frQm the PK series Qf 20 minutes Qn a 10 MHz AT clQne with programs. Norman C. Saunders a 10 MHz 80287 math cQprQcessQr. The expert witness testified in CQurt The Osprey's Nest BBS HQwever, thQse last 25 cQnnectiQns that substantial PQrtiQns Qf the PK cQde, (301) 989-9036 tQQk me abQut eight hQurs. This is be­ PQrtiQns that had nQt, apparently, been cause a IQt Qf the autQrQuted traces had released to. the public, appeared to. be Editor's note: Thank you for writing, to. be rerQuted since the autQrQuter had . identical to. SEA's cQde.1t was just after Norm. I understand that SEA will be painted itself into. a CQrner. Perhaps a this witness had testified that, as I un­ making a public statement now that things rip-up and retry rQuter CQuld have derstand the situatiQn, Mr. Katz ap­ have been settled legally. (The statement cQmpleted the jQb. prQached SEA's lawyers and asked fQr should make the next issue of Micro. C.) I really have to. give GeQrge a IQt Qf an Qut Qf CQurt settlement. And, on the other side, I have contacted the credit. His layQut had Qnly abQut 75 Again, as I understand it, it was Mr. PK folks for additional information on vias and his traces fQllQW data and

80 MICRO CORNUCOPIA, #46, Mar-Apr 1989 address paths in a very regular pattern. ware for non-technical users. Be fore­ His traces flow in vertical, horizontal warned - most computer magazines I and diagonal directions on both sides of· have liked well enough to subscribe to the board. have failed within 90 days. May you be The Maxi/PC autorouter, on the spared this curse. other hand, uses an orthogonal router. Several months ago I counted noses Any time it wants to change direction, it and found I owned 27 computers. drops in a via and continues on the Shortly thereafter I realized that my other side of the board. Vertical traces self-assigned task in life is to save as are on one side of the board and hori­ much hardware and documentation as zontal traces are on the other side. As a possible defining the early years (pre- result, the autorouter generated 277 8088/32000) of the "home" computer. vias! To date I've added a number of units Why is this important? Mainly, the and hundreds of books and periodicals. issue is cost. There is a per-hole cost I'm sufficiently serious about this to when fabricating a PCB. So the more have purchased land for a museum I vias, the more expensive the board will hope to build in 1990/1991. I can't be to produce. For low volume produc­ believe the collection will be complete tion, the extra vias may be acceptable. without all back issues of Micro Cornu­ The PD32 project was one which copia. Integrand's new Chassis/System is not another generated a lot of excitement at the Perhaps you have readers who IBM mechanical and electrical clone. An time, but never really got off the would like the gift of immortality. I entirely fresh packaging design approach has ground. I think this was partly due to would be most grateful for help with been taken using modular construction. At the cost of building a system. my collection. The more obsolete, un­ presen~ over 40 optional stock modules allow The parts cost for a 2 Megabyte derpowered, and obscure the computer you to customize our standard chassis to nearly any requirement. Integrand offers high quality, board was about $400 (most of the cost the better. advanced design hardware along with in the memory chips) and the UNIX I'm especially interested in home­ applications and technical support all at prices single user licence was another $500. brew, kitbuilt or hacked commercial competitive wlih imports. Why settle for less? This is cheap for a UNIX system, but systems - preferably accompanied by apparently it was too expensive for the something of the unit's history and the hobbyist market at which it was aimed. owner's experiences. Obviously, I also At this point I have no plans to fabri­ have an interest in periodicals and Rack & Desk cate the PCB layout described above. books from the Golden Era. Can anyone However, I would like to revive the help? spirit of the PD32 and I'd like to corre­ PCIAT Chassis spond with anyone who has any ideas Vernon 1. Goodwin for a project like this. 7917 Douglas Dr. Rack & Desk Models Charlotte, NC 28217 Accepts PC, XT, A T Motherboards and Scott Baker Passive Backplanes 18185 West Union Rd. Shipping Doesn't Look Like IBM Portland, OR 97229 c/o Support Systems International Rugged, Modular Construction 8700 Suite K Red Oak Blvd. Excellent Air Flow & Cooling Editor's note: Scott and I talked for quite Charlotte, NC 28217 Optional Card Cage Fan a while about the possibilities for a high-per­ Designed to meet FCC formance public domain UNIX system. I Editor's note: Find a large lake on a 204 Watt Supply, UL Recognized suspect that a 68020 or 68030-based board windy day and look at what's tethering the 145W & 85Walso available with space for 4 megs of RAM would make boats. At the end of those waterlogged ropes Reasonably Priced a fine multi-user UNIX platform. There are you'll find 8" drives, linear power supplies, several variations of UNIX, including some and 5-100 mother boards. Best of luck with -- ---~ - -- -- free versions. Contact Scott if you're itching your search...... -.... .--~---- .---- ..-=-- _---...... -.....,. .- to do an operating system port for a new By the way, I'm looking for a few good ~!~~~~~ ~~~ piece of hardware. copies of Micro C issue #27 myself. It RESEARCH CORP. turns out I didn't put any aside before they Micro Museum sold out. Call or write for descriptive brochure and prices: I just read my first issue of Micro 8620 Roosevelt Ave .• Visalia, CA 93291 Cornucopia and am impressed almost 209/651·1203 beyond words! Finally, a magazine TELEX 5106012830 (INTEGRAND UD) that's not afraid to talk seriously about • • • EZLlNK 62926572 We accept BankAmericard/VISA and MasterCard homebrew hardware and with scarcely IBM. PC. XT. AT trademarks of International Business Machines. a word on the latest and greatest soft- Drlves and computer boards not included. Reader Service Number 22

MICRO CORNUCOPIA, #46, Mar-Apr 1989 81 Who's Alive In CP/M? Part II

By Samuel Vincent .. Verified 4/15/88" CP1M Special Interest Group Last issue we presented the first part of this list HURD Computer Systems PRO MAIL, QWIZ WRITER, Pittsburgh Area Camp. Club of active CP/M commercial software vendors (com­ 6330 Lincoln Ave. HOME INVENTORY PLUS, P.O. Box 6440 piled by Samuel and his friends at PACC). Read on Cypree, CA 90630 RECIPE INDEX. Pittsburgh, PA 15212 for the rest of that list along with public domain (714) 525-0879 Free brochure available software suppliers and Z-Nodes that sell CP/M pro­ .. Verified 7/29/88" ducts. As before, a complete version (with prices when Hoyle & Hoyle Software,Inc. QUERY III Dbase Manager available) lives on the Micro C BBS and the Issue 111 Sparrow Dr. QUERY III Calculator/ #46 disk. Please send any corrections or additions to Isle of Palms, SC 29451 Report Writer. Adventure this list by writing to the attention of Samuel Vin­ (803) 886-5802 Free brochure available cent at the address shown above. You can also phone .. Verified 8/15/88 .. Leave msg on tape. at (412) 845-8613 (evenings only). Irata Software ALIST and ALIST Plus - 2562 East Glade Simple database Mesa, AZ 85204 programs. Emerald Microware Dealer-upgrades, add­ (602) 892-0015 P.O. Box 1726 ons for Kaypro, Xerox, .. Verified 4/15/88 .. Beaverton, OR 97075 Big Board, etc. QP/M, (503) 641-0347 MicroSolutions James River Group Accounting - G/L, A/R, .. Verified 8/31/88" products, and others. 125 North First St. A/P, PayroIl, and Free catalog available. Minneapolis, MN 55401 Inventory. TMAN-General (612) 339-2521 data file manager. Everton Publishers MY FAMILY RECORD .. Verified 4/15/88" Free catalog available. P.O. Box 368 genealogy program Logan, UT 84321 Free brochure available Kamasoft OUT THINK - outline (800) 453-2707 P.O. Box 5549 processor program. (801) 752-6022 Aloha, OR 97007 Free brochure available .. Verified 8/15/88" (503) 649-3765 Leave message on tape. .. Verified 8/15/88" EZ Systems, Inc. Church membership/ P.O. Box 23190 finance software. Ufek,Inc. SPELLBINDER Word Nashville, TN 37202 Demo vers available. P.O. Box 2399 Processor. Scientific (615) 269-6428 DateMate by FreshWare Davis, CA 95617 and Desk-Top Publisher .. Verified 8/31/88" Free catalog available. (916) 758-3630 versions also . .. Verified 8/15/88 .. Free brochure available Flashlite Software FLASHPRINT P.O. Box 3535 Printing utility Lexisoft, Inc. See L/Tek, Inc. Daly City, CA 94015 Lionheart Statistical & FreshWare Creative Sftwre DateMate - calendar P.O. Box 379 Business programs. 522 Glenpark Dr. program, appointment Atburg, VT 05440 Free catalog available. Nashville, TN 37217 organizer and telephone (514) 933-4918 (615) 360-6181 list . .. Verified 4/15/88" .. Verified 8/31/88" Free brochure available Logic Associates MEGABACK-hard disk Future Communications CHECI

82 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Magnolia Microsystems Dealer-Health/Zenith Paradigm Consultants MINI-BILLING, MINI­ 2818 Thorndyke Ave. West software/hardware add­ 39243 Liberty St., Suite L LEDGER, MINI-INVENTORY, Seattle, WA 98199 ons. Most CP /M software Fremont, CA 94538 TIME &: BILLING, MINI- (206) 285-7266 being sold out. (415) 794-8977 PAYABLES &: RECEIVABLES • Verified 7/29/88· Free brochure available • Verified 4/15/88 •

Manx Software Systems Aztec C II compiler in Plu·Perfecl Systems BACKGROUNDER II, DATE­ <>nelndustrialWay educational, pro, and P.O. Box 1494 STAMPER, DosDisk and Eatontown, NJ 07724 commercial versions. Idyllwild, CA 92349 JetFIND. Z3Plus (a Z- (201) 542-2121 Cross compilers to • Verified 7/29/88 • System OS for CP/M Plus (800) 221-0440 outside NJ or from CP/M available. BBS 213 670-9465 leave msg for Bridger Mitchell. • Verified 8/31/88· Free brochure available Poor Person Software WRITE HAND MAN-Resident Mendocino Software EUREKA - Disk Catalog 3721 Starr King Circle desk accessory program P.O. Box 1564 program Palo Alto, CA 94306 Note: Doesn't work with Willits, CA 95490 (415) 493-3735 Wordstar v4.0 - does (707) 459-9130 • Verified 4/15/88· with earlier versions. • Verified 4/15/88· QuikData, Inc. Dealer-Heath/ Zenith MicroSolutions Inc. UNIFORM - Disk P.O. Box 1242 software/hardware. 132 West Lincoln Hwy. conversion program. 2618 Penn Circle Anapro, Software DeKalb, IL 60115 UniDOS - Run CP/M Sheboygan, WI 53081 Toolworks, etc. Disk (815) 756-3411 programs on MS-DOS. (414) 452-4177 conversion available. • Verified 4/15/88· Free brochure available (414) 452-4345 (BBS - 300/1200/2400 bps) • Verified 8/15/88· Free catalog available. MicroPro WordStar Version 4.0 Update Order Department CP/M Edition R & L Micro Services BOBCAT - Disk P.O. Box 7C1l9 P.O. Box 15955, Station F cataloging program. San Rafael, CA 94901-7C1l9 Ottawa, Ontario Free brochure available. (800) 227-5609 ext. 761 Canada, K2C 358 • Verified 7/29/88· (613) 225-7904 • Verified 8/15/88 • MIX Software MIX C compiler and 1132 Commerce Dr. linker. MIX Full Screen Sage Microsystems East Dealer for NightOwl Richardson, TX 75081 Editor. 1435 Centre St. Software, Plu·Perfect (214) 783-6001 Free brochure available Newton, MA 02159 Systems, SLR Systems, • Verified 7/29/88· (617) 965-3552 and Z-System software. (617) 965-7259 (BBS-3OO/1200/2400, PC-Pursuit) Mountain View Press, Inc. Forth language products • Verified 7/15/88· P.O. Box 4656 Free catalog available. Mountain View, CA 94040 SLRSystems Z80 assemblers,linkers, (415) 961-4103 1622 N. Main St. librarian, and dis­ • Verified 4/15/88 • Butler, PA 16001 assembler-full screen. (800) 833-3061 CP /M software emulators NightOwl Software MEX Plus-communication (412) 282-0864 and co-processor cards. Rt.lBox7 software. MEX Pack-MEX • Verified 7/29/88· Free catalog available. Ft. Atkinson, WI 53538 Plus with terminal (800) 648-3695 emulation and remote Software Research Technologies (414) .563-4013 capability. c/o Heritage Software,Inc SMARTKEY - Key redef, • Verified 8/15/88 • Free brochure available 3757 Wilshire Blvd. SMARTPRINT- Printer Suite 211 Control, TOUCH 'N' GO - O'NeUl Software ELECTRA FIND - Text Los Angeles, CA 90010 Typing tutor P.O. Box 26111 retrieval. San Francisco, CA 94126 Software Toolworks C, Lisp, games, utils, (415) 398-2255 13557 Ventura Boulevard spreadsheet,editors etc • Verified 4/15/88 • Sherman Oaks, CA 91423 Free catalog available. (800) 223-8665 or (818) 9f1l-6789 (Customer service) Oasis Systems The Word Plus-spelling • Verified 8/31/88 • 6160 Lusk Blvd. checker and Punctuation SuiteC-206 and Style - grammar Somogyi Software PUSH'N'PULL-Outline San Diego, CA 92121 checker. P.O. Box 1009 processor. Version for (619) 453-5711 Free brochure available Redondo Beach, CA 90278 Osborne • Verified 8/15/88· (213) 318-2769 • Verified 4/15/88·

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 83 Spectre Technologies, Inc. Desk accessory, The following companies and user groups distribute 22458 Ventura Blvd., Ste. E Sideways printing, Public Domain Software. Woodland Hills, CA 91364 MEDIA MASTER, (800) 628-2828 ext 918 REMBRANDT, Boston CP/M User Group Public domain software. (818) 716-1655 Business planner. c/o Susan Schluckebier .. Verified 6/15/88 .. Forsyth Dental Center 140 Fenway Spite Software An eclectic assortment Boston, MA 02115 4004 SW Barbur Blvd. of software/hardware (617) 262-5200 ext. 342 Portland, OR 97201 products for CP/M. .. Verified 4/15/88 .. (800) 237-9111 Free catalog available. (503) 228-8238 The C Users' Group Public domain C software .. Verified 8/15/88 .. P.O. Box 97 in source code form, for McPherson, KS 67460 CP/M, DOS and UNIX. StatSoft Inc. PSYCHOSTAT 3 - Data (316) 241-1065 Catalog available. 2832 East 10th St., #4 analysis and statistics .. Verified 6/15/88" Tulsa, OK 74104 (918) 583-4149 Canada Remote Systems Free mini catalog .. Verified 4/15/88" 4198 Dundas St. West Complete catalog on disk Toronto, Ontario SWC FEDERAL INCOME TAX Canada M8X 1Y6 P.O. Box 706 SYSTEM. Tax Preparer's (416) 231-2383 (weekdays 5pm - 9pm) Santa Teresa, NM 88008 version and yearly .. Verified 4/15/88" (505) 589-0999 updates available. (800) 862-2345 - at 2nd dial tone, dial 792 Comal User's Group, USA, Ltd. Comal .. Verified 7/29/88" Free brochure available. 6041 Monona Drive Information booklet and Madison, WI 53716 product listing with T/Maker Research Company T /MAKER-Integrated (608) 222-4432 prices - both free. 812 Pollaid Rd, Suite 8 software/word processor .. Verified 4/15/88 .. Los Gatos, CA 95038 database, spreadsheet. (408) 866-0127 Also avail for TRS-DOS. FOG, International Computer User Group .. Verified 7/29/88" Free brochure available P.O. Box 3474 Public domain software Daly City, CA 94015 for CP /M. Complete The Software Store Communication, disk (415) 755-2000 catalog on disk. 706 Chippewa Square manager, disk editor, .. Verified 8/15/88" Marquetta, MI 49855 integrated data (906) 228-7622 manager, program cross­ INCA Public domain software .. Verified 8/15/88 .. reference generator. 1249 Downing St. tested for compatibility Free brochure available P.O. Box 789 with the C-128. Imperial Beach, CA 92032 Free catalog available. Workman & Associates FI1.. Modula-2,WRITE word (619) 224-1177 1925 E. Mountain St. processor, BDS C, MITE- .. Verified 4/15/88" . Pasadena, CA 91104 80 telecommunications, (818) 791-7979 POURNELLE ACCOUNTING. International Software Library Public domain software for .. Verified 8/15/88" Free catalog available. c/o U.S. Computer Supply CP /M, DOS and others. 511-104 Encinitas Blvd. Catalog available on disk. Worswick Industries Osborne software w / docs Encinitas, CA. 92024 4898 Ronson Ct. Personal Pearl, (800) 669-2699 SuiteH SuperCalc 1 and 2, (619) 942-1627 (Customer service) San Diego, CA 92111 dBASE II, Forth, .. Verified 8/15/88" (619) 571-5400 most software by .. Verified 7/29/88 .. Spectre Technologies M&TBooks Small-C Handbook and 501 Galveston Dr. Compiler. Small-Mac Xpert Software XTRAKEY - Key redef Redwood City, CA 94063 Assembler. Small-Tools for 8865 Polland Ave. XTRAPRINT-Printer fonts (800) 533-4372 text processing. San Diego, CA 92123 SIDE 2 - Print sideways (800) 356-2002, in CA. Z80 Toolbook with disk. (619) 268-0112 XSCREEN - Copy screen .. Verified 6/15/88" Free catalog available. .. Verified 4/15/88 .. to printer or file Micro Cornucopia Public domain software for ZedcorInc. ZBASIC interpreter - P.o. Box 223 CP /M and DOS. 4500 East Speedway,Ste 22 compiler. Bend, OR 97709 Free catalog available. Tucson, AZ 85712 Free brochure available (503) 382-8048 (BOO) 482-4567 (503) 382-7643 (BBS - 300/1200/2400 bps) (602) 795-3996 .. Verified 8/15/88" .. Verified 8/31/88 ..

84 MICRO CORNUCOPIA, #46, Mar-Apr 1989 A two-billion-power Mandelbrotl Ju lia microscope. Fast! Aim-and-frame, quick draft, animate, recolor, retouch, multiple palettes, save and retrieve, cloud chamber, help and more. Includes seven ready-made pictures for immediate gratification.

MANDELBROT EXPLORER 2.6 $30

Peter Garrison 1613 Altivo Way Los Angeles, CA 90026 (213) 665 1397

16-color VGAlEGA to 800x600 Specify VGA or EGA, 1.2Mb Overseas orders please add $4

Reader Service Number 112

NAOG/Z-SIG Z-System public domain Scotch Plains, NJ 07076 payable to the SIG/M Disk North American One-Eighty Group software. No catalog .. Verified 6/15/88" Librarian. P.O. Box 2781 available. (info available Warminster, PA 18974 in back issues of group's TUG Products Public domain TURBO Pascal (215) 443-9031 newsletter.) c/o Turbo User Group programs in source code .. Verified 8/15/88 .. P.O. Box 1510 form, for CP/M and DOS. Poulsbo, W A 98370 NorthStar Computer Society Public domain software (206) 697-1151 (BB5-300/1200) P.O. Box 311 for NorthStar computers. .. Verified 8/15/88" Seattle, W A 98111 Free printed catalog (206) 525-9487 available. The following Z-Nodes sell products for use with CP/M (206) 523-5355 (BB5-300/12oo/2400) computers. .. Verified 8/15/88" The Cedar Mill Z-Node CP /M software and hardware Poseidon Electronics Public domain software. 12275 NW Cornell Rd, Suite 5 Catalog available for down Ralph S. Lees, Jr. Catalog lists compatibility Portland, OR 97229-5611 loading-PRICES.OZf (short 103 Waverly Place with C-128, C-64 CP/M (503) 641-6101 (voice) file) or PRiCES.TZf (long). NewYork,NY 10011 cartridge, or not at all. (503) 644-4621 (BBS - 300/1200/2400 bps; PC Pursuit access) (212) 777-9515 Catalog ($5) "Verified 8/15/88" .. Verified 4/15/88" Lillipute Z-Node Z-System, NightOwl, SLR Public Domain Software Copying Company 1709 N. North Park Ave. SLR Systems, and others. 33 Gold St., Apt. 1.3 Public domain software for Chicago, IL 60614 Download catalog. New York, NY 10038 CP /M and DOS. Printed (312) 649-1730 (BBS - 300/1200/2400 bps; System I) (800) 221-7372 catalog available ($4). (312) 664-1730 (BBS - 300/1200/2400 bps; System II) (212) 732-4942 Some commercial CP/M .. Verified 8/15/88" .. Verified 8/31/88" software. Newton Centre Z-Node See Sage MicroSystems East SIGIM Public domain software for c/o ACG of NJ, Inc. CP /M. Catalog available on ••• P.O. Box 135 disk ($6). Make checks MICRO CORNUCOPIA, #46, Mar-Apr, 1989 85 Graphics Of A Better Sort

Specifically, your program needs to sort Gary's discovered presentation graphics, real strings which represent names in a database. presentation graphics. They're not a bad sort of So you face this situation - By Gary Entsminger thing to discover if you've got presentations to (1) You haven't selected a specific sort nor 1912 Haussler Dr. make. written it; Davis, CA 95616 (2) You have the results of tests of sorts (gleaned from programming books and jour­ ll too often we need to convince some­ nals); one (a client, a boss, a research institu­ (3) You don't know exactly how many tion) that we have significant informa­ names you'll be sorting at a time, but you Ation about something. In business for know the range; example, we might collect data (numbers, that (4) You don't know what kind of order the is) which correspond to some monetary func­ names will be in. You can probably manipu­ tion, such as sales of Dr. Wooly windshield late the order, if you become convinced there's wipers. a need for it. That is, you can maintain the A researcher in pathology might want to names either randomly, in order, or possibly show a correlation between unsanitary living somewhere between, but it means revising conditions and the proliferation of the Bubonic . your thinking about some other parts of the plague. (Fortunately, this one we already program; know about.) (5) The program must be portable, which A programmer might want to compare the doesn't rule out assembly language tech­ efficiencies of algorithms. niques, but encourages you to find a solution In short, the sample and show scenario per­ in a high-level language; vades most of the "real world." And, an excel­ (6) You've designed a prototype, but you lent way to present data is to show it, as a haven't gotten into the programming yet. graph or a picture. Unfortunately, you find that the data Although computers have been very good you've collected on sorts have a rather relative at calculating, until recently they haven't been nature. very good at making graphs or pictures. It's Some of the tests were written in C, some in no laughing matter to PC dealers that potential Pascal, some in Prolog. Some use iteration; customers often choose Apple Macintoshes some recurse. The codes for Quicksorts, inser­ primarily for their "better graphics." tion sorts, bubble sorts, tree sorts, and varia­ But PC graphics are improving and have tions of all sorts are confusing. At this point, neared parity (I believe) with the Macintosh in you want to compare ideas first; then (assum­ many applications. One reason for my enthusi­ ing you get the approval of higher ups) you'll asm stems from a terrific program I started give yourself a chance to write your own blaz­ using this week - SlideWrite Plus, from Ad­ ing-fast sorting functions. vanced Graphics Software in Sunnyvale, Cal­ What to do? What to do? One bench­ ifornia. marker, for instance, doesn't tell you what kind of computer he used. No PC, XT, AT Performance Analysis mention. No clock speed. Let's suppose you and your colleagues are You think you see a trend, but you're not analyzing the potential performance of critical sure you could convince anybody. Maybe you functions in a large program. Today you're could with a picture. comparing algorithms for sorting objects. Maybe SlideWrite Plus could help. Many smart (and shudder, "smarter") folks have already tackled sorting, so you won't SlideWrite Plus have to figure everything out yourselves. If SlideWrite Plus does presentation graphics. you're lucky you can draw most of your con­ In other words, you can present data as: bar clusions from someone else's data, and spend graphs; charts; scatter, line, and area plots; your time forging ahead. pies; etc.

86 MICRO CORNUCOPIA, #46, Mar-Apr 1989 PerFormance and versatility For your CP/M Dr MS-DDS computer -QPIM------Kaypro ------IBM PC----- QP/M by MICROCode Consulting KayPLUS ROM Set by MICROCode Consulting Fed up with the message "BOOS error: RIO"? With QP/M, you'll Want more performance and flexibility from your Kaypro? With CP/M, NorthStar, Macintosh, Apple 1/, never lose another file because you changed a diskette. QP/M the KayPLUS ROM set you can have the advantages of a Kaypro MS·DDS, and PS/2· Don't let offers full CP/M 2.2 compatibility with outstanding performance 4 or 10, even on your Kaypro 2. and more commands WITHOUT eating up precious program • Install up to four floppies and two hard drives incompatible diskette Formats get space. Get such features as automatic disk relogging, simple • Boots from floppy or hard disk you down, read them all with your PC. drive/user selection using either a colon or semi·colon, 31 user • Supports 96 TPI and 31/z" disk drives areas, drive search path, multiple program command line, archive • Can use any ST506 type hard drive· 5 to 64 Meg • 32 character type·ahead keyboard buffer UniForm·PC by MlcroSolutlons bit maintanence, and transparent time/date stamping; all in the How often have you wished you could use your CP/M diskettes same space as CP/M 2.2. Installs from a convenient customization • Automatic screen blanking (not avail. on 83 series) .12 disk formats built·in, unlimited configurable on your PC? Now you can access your CP/M disks and programs menu, no software assembly required. Bootable disks available on your MS·DOS computer just as you would a standard MS-DOS with CBIOS for Kaypro, Xerox (8" or 5W', ·1 or ·2), & BBI. • Full automatic disk relogging with QP/M • Internal real·time clock support diskette. Once the UniForm driver is installed, you can use QP/M Operating System, bootable • specify system .... $ 64.95 • No software assembly required standard DOS commands and programs right on your original QP/M without CBIOS (installs on any Z80 system) ..... $ 49.95 Includes manual, format, configuration, diagnostics, sysgen, diskette without modifying or copying your files. UniForm·PC diskette customization utility, AND hard disk utilities. Available allows you to read, write, format, and copy diskettes from over --Networks ----- for '83 and '84 series Kaypros. 275 CP/M and MS·DOS computers on your PC, XT, or AT. With UniForm·PC and the Compaticard, you can use 5W' high QP/M Network File System by MICROCode Consulting KayPLUS ROM Set, specify model ...... $ 69.95 density, 96TPI, dual format 31/z" (720kl1.44 meg.· PS/2), and QP/M Network File System is an efficient local area network KayPLUS ROM Set with QP/M ...... $125.00 allowing up to seven CP/M computers to peripherals and even 8" drives. data resources. UniForm·PC by MicroSolutions ...... $ 64.95 • Transparent operation at speeds up to 11,000 bytes/second Parts and accessories for the Kaypro Uniform for Kaypro and other machines ...... $ 64.95 in syncronous mode Kaypro 2X Real·time Clock parts kit ...... $ 29.00 • Speeds of up to 1,920 bytes/second in asyncronous mode Kaypro 2X Hard disk interface parts kit ...... $ 16.00 CompatiCard by MlcroSolutions • Local/remote disk drive and printer support Kaypro 10 or '84 series Hard Disk host board ..... $ 49.00 Meet the CompatiCard, THE universal disk drive controller card. • Remote peripheral support for modems and real·time clocks Kaypro four drive floppy decoder board ...... $ 35.00 This half card will let you run up to 16 disk drives (4 per Compati· • All stations need not be on the network even though connected Complete parts and repair services available Card) on your PC or XT, including standard 360K, 96 TPI, high • Local drive access protection and control density (1.2 meg, dual speed), 8" single or double sided (SO or • Simple menu oriented configuration utility DO), and dual format 3V2" drives (720kl1.44 • PS/2). The combi· • Extended DOS calls are provided for addition of custom net· --Xerox 82D ---- PLUS2 ROM and X120 Double Density Board by nations are almost unlimited. Comes with its own MS·DOS driver work utilities. MICROCode Consulting and Emerald Mlcroware and format program for high density and 3V2" diskettes. Use it Works with interrupt driven Z80 systems such as Xerox 820, About had it with single density diskettes on your Xerox 820-1? with UniForm·PC for maximum versitility. 8" adaptor and addi· Kaypro (KayPLUS & Advent ROMs), Eagle, and other computers tional cabling available. running QP/M, or CP/M 2.2 Get unsurpassed versatility with our X120 Board and PLUS2 ROM package. CompatiCard Board ...... $169.95 QP/M Network File System ...... $ 39.95 • Run up to four floppy disk drives at once CompatiCard with UniFORM·PC .. * * Special * * .. $225.00 • Mix 8" and 5W' at the same time CompatiCard with UniFORM·PC & high density or --Hard Disks ---- • Software compatible with Kaypro and Xerox 820 3V2" drive ...... * * * Special * * * ...... $350.00 Need more speed and storage on your system? • Built in drivers for most serial and parallel printers Improve the productivity of your Z80 computer with a hard disk. • Get mini·monitor functions and auto-boot capability MatchPolnt·PC by MicroSolutions • 19 built in disk formats, including Xerox and Kaypro The MatchPoint·PC board for the PC/XT/AT works with your HDS Host Board • Includes custom disk format definition program standard controller card to let you read and write to NorthStar This daughter board provides a convenient interface for connect· hard sector and Apple II diskettes on your PC. INCLUDES a copy ing a Western Digital WD1002·05 hard disk controller to your • Banked ROM BIOS for more space in your TPA • CompOSite video adaptor on X120 board of the UniForm·PC program, as well as utilities to format disks, computer. • Runs 48 TPI diskettes on 96 TPI drives copy, delete, and view files on Apple DOS, PRODOS, and Apple • Plugs into the Z80 socket, no other wiring required CP/M diskettes. • 40 pin interface for a WD1002·05 (or HDO) controller board • Supports real time clock from Z80·CTC • Works on the Xerox 820·1 and Big Board I MatchPoint·PC Board ...... $169.95 • Switch selectable I/O port addressing • Both ROM and X120 board are required for operation • Comes as bare board or assembled & tested MatchMaker by MlcroSolutions • Kaypro '84 host board also available PLUS2 ROM Set and X120 Board A&T ...... $114.95 PLUS2 ROM Set and X120 Bare Board ...... $ 49.95 Now you can copy your Macintosh diskettes right on your PCIXT/ Winchester Connection by MICROCode Consulting PLUS2 ROM Set only ...... $ 39.95 AT with the MatchMaker. Just plug your external Macintosh drive The most simple and comprehensive hard disk software package 120 Bare Board only ...... $ 15.00 into the MatchMaker board and experience EASY access to your available for CP/M. * * * Special * * * 2 boards for $25, 5 for $50 31f2" Mac diskettes. Includes programs to read, write, initialize, • Designed for use with the WD1002·05 controller board Other kits, parts, and packages available and delete files on your single or double sided Mac diskettes. • Works with one or two hard disks· 5 to 64 meg MatchMaker Board ...... $139.95 • Menu installed, no software to assemble MatchMaker w/External Mac Drive ...... $325.00 • Complete hardware tests and error handling Parts and accessories for the Xerox 820 • Automatic swap, for warm boots from hard drive Xerox 820·2 CPU Board· new ...... $ 75.00 • Software drivers install above or below CP/M Xerox 820·2 Floppy Controller board· new ...... $ 65.00 Frustrated because your PC • Allows custom partition sizes and mixed drive types Xerox 820·2 CPU board w/ Floppy Controller ...... $125.00 can't speak CP/M? • Independent block and directory sizes on each partition Xerox 820·1 CPU board· new ...... $ 75.00 • Includes manual, format, test, park, and swap utilities UnlDOS by Micro Solutions Xerox 820 complete high profile keyboard ...... $ 65.00 Run CP/M programs on your PC? Of course. UniDOS is a Winchester Connection Software only ...... $ 39.95 Xerox 820 bare high profile keyboard· new ...... $ 25.00 memory resident program that can use the NEC V20 CPU chip HDS Board with Winchester Connection Software ..... $ 79.95 Xerox 820 51/4" drive cable ...... $ 9.00 to actually RUN your favorite 8080 programs. Use UniDOS with HDS Bare Board with software ...... $ 59.95 Xerox internal video cable w/brightness control .... $ 9.00 UniForm·PC, and automatically switch to CP/M mode as you HDS Board, WD1002·05, and software ...... $245.00 Xerox 820 power supply ...... $ 35.00 log on your CP/M diskette. Switch to emulation mode to run Z80 Call or write for other priCing options Power connector, specify board or cable ...... $ 2.50 code programs or for systems without a V20. UniDOS directly Xerox parallel printer interface cable ...... $ 35.00 converts video and keyboard emulation for Kaypro, Xerox 820, WD1002·05 HARD DISK CONTROLLER BOARD by Western Dual Half Height 5W' Disk Drives· DSDD, Digital Morrow, Osborne, VT100, and eight other displays. All standard in cabinet with standard Xerox cable ...... $265.00 CP/M system calls are supported. Note: The NEC V20 CPU is • Standard ST506 drive interface Complete parts and repair services available • Same size as standard 5W' drive a fast, low power, CMOS replacement for the 8088 CPU chip • 40 pin interface to host computer that includes a full 8080 instruction set as well as the standard • WD2797 floppy disk controller interface on board 8088 set. Systems using an 8086 may substitute a V30 chip. • Can control up to three hard drives (EMERRLO 1 UniDOS by MicroSolutions ...... $ 64.95 • Direct replacement for Kaypro 10 controller UniDOS w/UniForm and V20·8 chip ...... $135.00 WD1002·05 Controller Board ...... $185.00 (MICRONRRc) Other Western Digital boards available UniDOS Z80 Coprocessor Board by MlcroSolutlons P.O. Box 1726, Beaverton, OR 97075 This 8 Mhz. Z80H half·card will run your Z80 and 8080 code Prices subject to change without notice. VISA and Mastercard programs at LIGHTNING speed on your PC or AT. Functions accepted. Include $5.00 shipping and handling, $7.50 for COD, just like the UniDOS program, except NO V20 or emulation mode UPS·Blue or RED Label additional according to weight. Please ,m, (503) 641-0347 II is required to run your programs. Now includes UniForm·PC! include your phone number with all correspondence. 30 day money back guarantee on all products. UniDOS Z80 Coprocessor Card ...... $169.95

Reader Service Number 10 MICRO CORNUCOPIA, #46, Mar-Apr 1989 87 You either enter or import data into tice C (and utilizes a few optimized as­ columns, and SlideWrite shows your sembly language functions). It's been an picture of choice. You can edit data, ongoing project for programmer Larry zoom in and out of a picture, draw on it Daniel (now V.P. of Research & (freehand), manipulate it, change fonts, Development) for about five years. add text and legends, and· in many Larry told me that when he began other ways fine tune your creation (vary the SlideWrite project, his choice of a tics, scale, orientations, rotations, and programming language was more or other peculiarities). less obvious. Neither Microsoft nor Bor­ When you want hard copy, you can land were C contenders then. print, plot, or upload to a camera and The excellent documentation (440 shoot a roll. If you've got the right ring-bound pages) and numerous fea­ equipment (polorchrome film, a tures are indicative of the work that's mounter), you can make overheads and gone into this program. slides right at your desk, or go into the Figure 1 - Image Maker Slide overhead and slide business. In a worst Operation- case scenario, in most cities you could • all functions available through shoot a roll of Ektachrome and have and the pseudo code for Quicksort - menu, and most through Fkeys slides the next morning. also Figure 1 shows a chart reproduced (1) select a test value; Drawing- from a slide created with Image Maker (2) partition the array or list • object-oriented (includes a picture (a camera) and SlideWrite Plus. Don't using the test value; and symbol library) let the black and white reproduction (3) sort the left subarray (or list); • rotates objects disappoint you; the slide, itself, is in (4) sort the right subarray (or • zooms images (in and out) near-living color. list) . Graph- Alternately, you can export your • creates bars, lines, pie, text, scat­ charts to desktop publishing software To complicate matters, I entered ter, area, 3-D, mixed, multiple (like Ventura) or to slide service Hunt and Covington's data into a Para­ graphs on one screen, free posi­ bureaus. In other words, you can make dox database (of columns), then ex­ tioning of graphs, labels, and titles a pretty impression and maybe con­ ported it as an ASCII file. SlideWrite on screen vince a few folks. Plus read the ASCII file correctly and Colors- created a chart in PCX format. Finally, I • 16 Plots Of Sorts zipped the PCX file via modem to Fonts- Take those sorts, for example. I Micro C where Ventura imported it • 16 typefaces, scalable to any size. tested SlideWrite with the results from directly as Figure 2. Phew. Supports laser-printer cartridge & several sorting algorithms from two The y-axis represents time and the x­ downloadable fonts useful programming books - The C axis the number of elements in the Output- Toolbox by William Hunt and Prolog Pro­ database or array. The greater the slope • postscript gramming In Depth by Michael Coving­ of the regression line (a power curve in • HP laserjet & compatibles ton, et al. each of these cases), the more time it • various dot matrix printer Covington, et aI, tested five sorts - takes the function to sort the data. • film recorder A glance at Figure 2 shows an al­ • plotters Insertion ready ordered insertion sort as by far Other- Hoare's famous Quicksort (from 1962) the most efficient (the curve is far less • Greek/math characters Difference-list Quicksort steep). A randomly ordered insertion • curve fitting Improved Quicksort sort is the most inefficient with an al­ • equation plotting Treesort most vertical curve. Random or ordered • error bars quicksorts are similarly efficient (both user-contolled line thickness Hunt tested - lie between). • automatically senses & uses a In this example, I tried to fit several mouse Insertion kinds of curves (linear, polynomial, ex­ Limits- Hoare's famous Quicksort ponential, etc.) to the data before I • 4000 data points found the best fit - a power curve. • 12 graphs in one drawing Here's the pseudo code for the Inser­ SlideWrite's statistical function (F5) in­ Requires- tion sorts- formed me that the power curve was a • 390K available memory very good fit (accounting for 99% of the Data formats - repeat (for each element after the variation). • TIFF first) You can refit and redraw very • PCX (1) compare to sorted elements quickly until you're satisfied with a de­ • CGM to dete~ne where it should be scription (or picture) of the data. Then • ASCII inserted; you can embellish, modify, and print • WKS (2) move sorted elements to make the charts you like. • WK1 room for it; • WRK (3) insert it. Details & Features • WR1 end. SlideWrite Plus was written in Lat- Price - $445.

88 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Figure 2 - Graphics Of Sorts Generated By SlideWrite

+ Insert 4 Quick 0 Insert CUd<. Ordered Ordered Random • Random

0.40

0.32 i 0.24 ;c 0.16 ~ F 0.08

0.00 0 100 200 300 400 500

tUnber Of ObjeCts

It sounds like I'm impressed with Hunt, William. The C Toolbox. Addi­ In the same pages (28 in all), I found this program, and that's about right. son Wesley. 1985. Escher puzzles and calendars, discus­ If you want to tryout SlideWrite sions of fuzzy math books, a consulting Plus with no commitment, call Ad­ A Good Place To Shop column, rubber stamps that reject every­ vanced Graphics and they'll send you a I can't resist a good pitch- thing, a code listing from a Build Your little (and very useful) manual and a "Isn't it the truth! Hardware en­ Own Assembler Project, OS/2, 80386, SlideWrite Plus demo disk which seems gineers always blame the problems on MS/DOS, anq Unix programming to do everything the real McCoy does. software while software engineers al­ guides. The demo is free. ways blame the problems on hardware. There are "far out" opinions and For more information - And marketing just wants to ship pro­ things to buy. duct. If you want bizarre and interesting Advanced Graphics Software, Inc. "Well when I told my sister (she's a access, subscribe to John's Picks, a "re­ 333 W. Maude Ave., Suite 105 programmer) about these mugs, she view catalogue" of books and things. Sunnyvale, CA 94086-4367 said, 'That's exactly what they say!' So I Even the index is good reading! $5 per (408) 749-8620 know these will be perfect. Buy one for year from- yourself or give one to your favorite op­ ponent." Microcomputer Applications Picture two hardware and two soft­ P.O. BoxE References ware mugs, their handles shaped like Suisun City, CA 94585-1050 Covington, Michael, et al. Prolog Pro­ ears, alongside mini-reviews of "The (707) 422-1465 gramming in Depth. Scott, Foresman, & Fractal Geometry Of Nature" by Man­ Co. 1988. delbrot, and "Chaos" by the Royal And that's Tidbits. Society of London. • •• MICRO CORNUCOPIA, #46, Mar-Apr 1989 89 Diagnosing A Slipped Disk

Disk Change Solution ... And A Hardware Version Issue #45 arrived yesterday, and as usual I John Innes' directory woes come from MS­ spent most of the evening with it. I found that DOS' method of handling disk swaps. The the letter from John Innes of New South Wales, operating system actually reads a directory Australia, described some symptoms that only once for a disk, storing this information in sounded very familiar. memory for subsequent DIRs. Only when a I'm using an AT clone with the AMI 286 disk change is detected (through the disk­ BIOS. When I installed a 3.5 inch 720K drive for change or door-open signal from the drive) will drive B and ran the BIOS SETUP routine, DOS reset the drive. everything seemed fine. The format command Until recently, most drive controllers ig­ worked, files could be read and written, etc. nored the wishes of DOS and did a reset with However, upon changing disks, the directory each drive access. But newer controllers and did not change. Of course, attempts to read drives often use signals from the drive to detect from the disk produced garbage. I wasn't brave a disk change. So it's entirely possible to come enough to try writing to the disk, but I would up with a combination which can't detect a expect a write to destroy its contents. new disk. (AC will always reset the drives, but Since I use MS-DOS 3.2 (which supports who wants to type endless ACS.) DRIVPARM in CONFIG.SYS), the solution was You can easily fool the controller into reset­ easy once I figured it out. It appears that the ting with each access. If it has seen any activity AMI SETUP utility sets up the disk parameter on the disk-change line (#2 on the ribbon table to look for the door open signal. This cable), the controller assumes a disk change causes a problem if the disk doesn't have a and resets accordingly. So just connect line #2 door open switch or if the switch doesn't work. to the step line (#20) and the controller will see DRIVPARM is described in the DOS manual plenty of "disk changes." Do this by cutting as having an option (lC) that "specifies that line #2 and connecting the controller end to change-line (doorlock) support is required." line #20. What it doesn't say is that if the SETUP para­ The mod couldn't be much simpler. But if meters specify change-line service, but the drive you're feeling lazy, Fujitsu and other compa­ doesn't support it, then it should be disabled by nies sell a small adapter. using DRIVPARM without the IC option. I use: Editor's note: The preceding was gleaned from John Heilborn's "Ask Dr. John" column in Com­ DRIVPARM=/D:l puter Currents, December, 1988, Boston Edition. The article came to us from: since the other default parameters are correct for a 720K drive. Mr. Innes should use- Bruce S. Campbell 56 Birchwood Rd. DEVICE=DRlVER.SYS /D:O /F:l Windsor, CT 06095

in his CONFIG.SYS file (unless his drive has a Yet Another Hardware Fix broken door-open switch, which should be My 720K and 1.44M drives have XT and AT fixed). jumper options. I've found that jumpering the XT pins (even when the drive resides in an AT) John R. Smith solves the directory problem. 609 E. Sacramento St. I suspect that XT disconnects pin 34. Ac­ Altadena, CA 91001 cording to my documents, disconnecting pin 34 Editor's note: John presents a simple solution to between the floppy and the controller tells the the "phantom directory" problem. But those who system to ignore pin 2 (the door-open line). So just can't resist the opportunity for a little hardware the system would have to reread the floppy hacking should read on. each time it needs the directory.

90 MICRO CORNUCOPIA, #46, Mar-Apr 1989 Micro Ads

A Micro Ad II the Inexpensive way to reach over 22,000 technlcallolks like yourself. To place a Micro Ad, Just print out your message (make It short and sweet) and mall It to Micro C. We'll typeset your ad (no charge) and run It In the next avallab/e/Slue. You can also send camera ready copy. Rates: $99 lor I time, $267 lor three times, $474 lor 6 times (a best buy at only $79 per Insertion). Full payment must accompany ad. Each ad space Is 2 1/4 Inches by 1 3/4 Inches.

C SCIENTIFIC LIBRARY F LAS H NO NON-SENSE BATTERY 11111111111111111111111111111111111111111111111111111111111111111111111111111111 IH£. DISK ACCELERATOR C programming library for computations In re­ Holder for ATs and clones narch and mathematical analysis. Each rou­ • EASY to Install Cache up to 3 MEGS of EXTENDED Allows the use of inexpensive Alkaline AA cells. AA cells tine Is designed and documented for use by , . ·and or EXPANDED are available everywhere. cost far less and last much longer technical specialists and programmers. ... • Buffers up to 26 DEVICE driven drives than coin type Lithium cells. in most clock/calender Comprehensive Over 500 functions I " • Comes with 2 FREE utilities!!!!! applications. The No Non·Sense battery holder is easy to Superb Documentation Matrix Math . ORDERNO~ install and battery replacement is a snap. (BOO) 25-FLASH $19.95· Your complete satisfaction guaranteed. Send $2.99 plus $1 Microsoft or Thrbo C Statistics More for shipping and handling to: 11111111111111111111111111111111111111111111111111111111111111111111111111111111 I SOFIW ARE MASTERS 6352 North Guilford Ave. Eigenware Technologies Indianapolis. In 46220 / (317) 253-8088 New Millennium Trading Co. 13090 La Vista Drive, Saratoga, CA 95070 "To receive discount price, DEMAND IT!! P.O. Box 872 Beaverton. OR 97075-0872 (408) 867-1184 $5.00 Shp/hnd in USA &: CANADA. $15.00 overseas. Reader Service Number137 Reader Service Number 106 Reader Service Number 134 ONELINERS (or IBM pe. and compatibles Tum Your PC Into A Get Inside Your Program Today! A pop-up (or command line) utility that MARKET QUOTAT10N MONITOR Instantly alphabetically lists both the current ANIyze end iqInM ~ qideI bt>o C 1.00 ~ bxX CD.a:3 !HElllie aU m:Iio cka m::q:tim c£ firm:ial ras directory and the 1st line of all ASCII text files In aU cp:tm frr p.r EC. $19 lirx:lu:Bs cBto di.Sa:te). fue :infi:J:mi:iw 00 a full screen window. ~..culoncounll,e::"'1oiow.,=,~1on1 _IQlcttBaic==~ $75 - ail!kgC£ Automatically translates Wordstar and "Ota D:J::ci\8S aU kits :::.=!l:"~ =5= Each Wordperfect 4.2 flies (Including summary * Q.tte ~ aUdi.!plaJ s:fuam ~~~ qideI~1.bUo-2 boxes) to text. * Dmatiirg s:thee I.t.iliDfs dIIU now! YI_ AcceptecI Indlspenslble for quickly Identifying data. (800)537-5043 program source, word processor, etc. files from 303-223-2120 $5 Demo Diskette Paradigm Systems Inside a running application. DATArx P'Q Box 152 Milford, MA 01757 ONLY GNM Endeavors, Inc. 111 E. Drake Rd. Suite 7041 ~----- $15 1910 Fieldwood Drive Fort Collins, CO 80525 Northbrook, IL 60062 Reader Service Number 133 Reader Service Number 113 Reader Service Number 115 DID YOU TYPE "CD" TODAY? 68000 SOFTWARE ACCELERATE YOUR DOS users. why crawl around your hard disk • K·OS ONE operating system uses AT'S MATH with CD when you can JUMP Instead? JUMP MS·DOS disks with source code ...... $50 Most AT's and clones run their 80287 math coprocessors offers Instant four-way access to any area of • K·OS ONE manual...... $10 at 4 to 6 Mhz. So if you have an 8 or 10 Mhz 80287 in your your hard disk: via menu choice. shorthand or system. it's loafing! The Solution: Speed·up your AT's • HT68K SBC w/K·OS ONE ...... $395 symbolic name. or pathname. JUMP also has 80287's clock rate to it's maximum frequency with a • Screen Editor Toolkit...... :... $50 remote program users. Introductory price Just coprocessor daughter·board. 8 or 10 Mhz versions • HT·FORTH ...... $100 available for $29.95 (80287 not included). Simple $34.95 with special bonusl Write for free Info on installation. our complete line of DOS and CP/M • BASIC ...... $149 programming and word processing products. Free Newsletter & Spec Sheets Sierra Circuit Design HA~HORNETECHNOLOGy Cranberry Software Tooll 18185 West Union Road P.O. Box 681 1411 S.E. 31st Ave., Portland, OR 97214 Portland, Oregon 97229 (S03) 645-0734 PrInceton Junction, NJ 08550-0681 (503) 232-7332 Reader Service Number 121 Reader Service Number 34

OPT-TECH SORT/MERGE 16 Megabytes EMS and/or 8051 Extremely fast Sort/Merge/Select utility. Run Extended Memory as an MS-DOS command or CALL as a -Works on 8 or 16 bit bus subroutine. Supports most languages and Z8/ Super8 -16 bit transfer on AT bus XT and AT flletypes Including Btrleve and dBase. -Single board design Unlimited flleslzes, multiple keys and much -Includes RAM disk and Compatible morel MS-DOS $149. XENIX $249. CCOMPILER extensive diagnostics * Call today for a FREE technical bulletin * (702) 588·3737 -Quantity/OEM discounts MICRO COMPUTER CONTROL P.O. Box 275 - Hopewell, NJ 08525 USA Opt-TeCh Data Processing ~:~~;ae~·ured. m~ r;;:\(?II~ Telex 9102404881 MICRO UQ Sold and Serviced by ~~~~LrlJ P.O. Box 678 • Zephyr Cove, Nv 89448 (609) 466·1751 807 North 6th St. Lake City. liN 55041 (612)345-4555 Reader Service Number 100 Reader Service Number 64 Reader Service Number 54

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 91 "Enhance! is a must for any power user!" • C. Gengler Want to Throw Out your U.P.S. Log Book? Now You Can! Enhancel your DOS commalld lille illteiface. Here's what EASY-SHIP can do for you: • advanced command line editing, retrieval. more Automatic U.P.S. Shipping to all of U.S. & Canada. • full symboValias defming, modifying, and processing. D • robust file management...move, copy, append, list, o Fast, Easy Multiple·Shipments with All Options. remove via powerful and substantial extensions of the D U.P.S. Approved Shipping Labels & C.O.D. tags. DOS wildcard file specification support. • allows multiple commands; location maneuvering. o Approved Nationally by United Parcel Service. • RAM resident; can load/nm in expanded memory. D NO MORE MANUAL LOGGING! And more! Micro • Unix (TM), VMS (TM)·like interface. For All IBM PC, AT, OS/2 Systems. Only $365 +$3 SIH. • enhances, not replaces, DOS 2.0-4.0/COMMAND.COM. Cortex Computing Corporation P.O. Box 116788 Carrollton, Tx 75011 Stat Supply Company $79.95 ~ 579.95 20214 Brondesbury, Katy, TX 77450 Ads ... .. includes a (ree "I've been Enhance!'d" T·shil1! Reader Service Number 128 snOOp -World's Best Disassembler. CROSS ASSEMBLERS LATEST AWARD BIOS Turns any program to assembler source, PseudoCode releases version 2 of its cross assemblers. PC/XT * 286 * 386 comments each line of code. 8086 to Assemblers for the 8048, 8051,8096,8085, z80, HD64180, Support for: 6301,6303,6502, 1802, 6800, 6805, 6809, and 68000 ~ Enhanced Keyboards 80386 processors and coprocessors. DOS microprocessor families are available. Macros, Conditional calls, ports, EMS functions, topview calls Assembly, Include Files plus extensive expression ~ EGA & VGA Graphics and gets - all supported and unsupported handling. Virtually no limit to program size. For IBM pes ~ 3.5 inch Floppies . and true compatibles with MS·DOS 2.0 or greater, and ~ More ... codes. Batch or interactive. Built in code­ 256K memory. Complete with printed manual for $35.00. sensitive help. Best way to: Learn Assem­ Each additional is $20.00. (Michigan residents add 4% tax). Authorized AWARD Distributor bler, modify software when source is una­ Shipping and handling $5.00 USA, $10.00 Canada, $15.00 (800) 423-3400 elsewhere. Visa/Me. Order from distributor: vailable, find and disarm viruses, or just KOMPUTERWERK, INC snOOp. $49.95 TriDOS 4004 SW Barbur· Portland, OR 97201 KORE Inc .. K 851 Parkvlew Blvd 6910 Patterson, [Jg] VISNMC, AMEX, COD 800-237-9111 Pittsburgh, PA 15215 Reader Service Number 117 Reader Service Number 136 Reader Service Number 126 Mr. MOX $99 95 Unfortunately, the disconnection The second problem is not a bug, but Modem operated by Epoch Data might also force an AT to treat the drive a technique. In C, it's quite easy to pass power controller as a low density unit. Thus, a 1.2 meg the address of a local variable to for your PC. drive would only read and write 360K. another function, so that the second Makes any PC with A 1.44 meg drive would only read and function can modify the local variable. external modem write 720K. (Check this on your sys­ For instance, suppose you have a remote- accesssable! Software included tem.) routine that displays a menu. One of the Order From: first things it does is save the contents KENMORE COMPUTER Rob Aprato of the screen memory: TECHNOLOGIES 323 75th St. #17 30 Suncrest Dr .. Rochester NY 14609 (716) 654·7356 show_menu () Everett WA 98203 Reader Service Number 135

MASMTips /* local variable */ I just read the article on Microsoft's char screen_buffer[4000]; level languages, this is usually set up by Macro Assembler, version 5.1. ("86 the compiler. In an assembly language World," Micro C, issue #45) I /* pass address of array */ program, you do it yourself: completely agree with the author's posi­ save_screen(screen_buffer); tive comments. The new features make _main: it a real pleasure to use. However, I'd !nOv ax, @data like to mention some "gotchas." The mov ds, ax first problem has to do with the new I ran into problems when I translated eli LOCAL directive, which allocates stack that type of C function into assembly. !nOv ss, ax space and generates macros for refer­ Unfortunately, automatic variables are mov sp, OFFSET STACK ence of local (automatic) variables. Do allocated in the stack segment (refer­ sti not try to use a DWORD as the first enced by SS), while static variables are local variable. allocated in the data segment (refer­ That's because the assembler always enced by DS). The CLI/STI instructions should not uses [BP-2] for the first local variable. If you program in the large model, be necessary, but a few early (buggy) This is fine for a WORD, but if you there's no problem because both seg­ versions of the 8088 failed to disable in­ store a DWORD in [BP-2], it gets stored ment and offset of the variable get terrupts when modifying SSe Note that in [BP-2] through [BP+1], thus clobber­ passed. However, the small model only SS must be changed, then SP. ing the saved BP at [BP]. If I need a passes the offset and the function has DWORD, I declare the first local varia­ no way of knowing whether the offset Richard Lamb ble with the name DUMMY and the refers to the data segment or stack. 3016 Waverly Dr., Apt. #311 type WORD. The DWORD declaration The only way around the problem is Los Angeles, CA 90039 then follows the dummy variable. to make sure that SS equals DS. In high ••• 92 MICRO CORNUCOPIA, #46, Mar-Apr 1989 PC Software as low as $249 Thousands of IBM/Compatible Public Domain and Shar~ware Pro~rams Are Available from the Micro Star Library and at Incredibly Low Prices! II] LOTTO PROPHET (2364) Best I VIS{ I We feature the best and most u~-to-date shareware. available. • Lotto program we've seen. - Our software is guaranteed against bugs, defects, Viruses, etc. CITY DESK (2513) Simple And We Offer FREE Technical Support For Our Customers desktop publisher. ORDER TODAY on our TOLL FREE PHONE LINES. ORDERS SHIPPED OUT SAME OR NEXT DAY SPREADSHEET TEMPLATES LOTUS MACROS (601) Save GAMES WORD PROCESSING BASIC HELP DOS (1326) On line hours of work. (Req. Lotus) DOS help with menus. In­ LOTUS SPREADSHEET TEM­ ARCADE GAMES (106) Has PC-WRITE 3.0 (434, 435, 436) PC-PROFESSOR (1401) BASIC Kong, 3-D Pac man, Bricks, cludes DOS dictionary of PLATES (602) Ready-made. (3 disks) Newest verslonl tutorial. Good. terms and a hints menu. Pango. (Requires color.) Very popular and complete. (Requires Lotus 1-2-3) BASIC GAMES (107) Pac­ BASIC PROGRAM GENERA­ Includes spelling checker. TOR (1402) The menu driven SPREADSHEETS GOAL-SEEKER V3.5 (624) man, Lunar Lander, Startrek, Achieve ojectives by chang­ PC-TYPE+ (421-423) (3 disks) way to write programs. A5-EASY-AS (505) Great. In­ Meteor. Breakout. and others. Excellent. Includes mall ing spreadsheet and seeing CARD GAMES (109) Canasta, B-WINDOW (140'7) Give win­ cludes screen help menus. result. (Requires Lotus.) merge, 100,000 word spell­ dowing capabilities to your Utilizes function keys. A Lotus hearts, draw poker & bridge. Ing checker. Interfaces with LOTUS TUTORIAL Learn STRIKER (110) Defender-like Basic program. clone that reads Lotus files. PC-File +, PC-SMe. Lotus (requires game. "Top Gun" In space. PC-CALC+ (512-514) (3 disks) FLiGHTMARE (112) Futuristic GRAPHICS UTILITIES Jim Button's famous lotus clone. fighter pilot game. (Requires HOMEBASE (2608, 2612, 2613) ADULTS ONLY (2901) KEYDRAWCAD SYSTEM (1001, EDUCATION color graphics adapter.) 1002, 1065) (3 disks) Popu­ Complete desktop organ­ Animated. Req. SLEUTH (117) Who done it? lar. Also uses mouse. (Re­ Izer. Greatl AMY'S FIRST PRIMER (248) CGA DND (119) Like Dungeon quires color graphics - CGA) PROFESSIONAL MASTERKEY Children's learning game MAXINE (2902) and Dragons. (2805) Uke Norton's. Retrieve that teaches letters. numbers credible. (CGA) ROUND 42 (120) Better than. deleted files. A lifesaver. and keyboard. STRIP POKER (2903) Space Invaders. 42 levels. BAKER'S DOZEN (2821) 13 FUNNELS AND BUCKETS (201) Pick opponent . GAMES IN BASIC (124) Land­ utilities from Buttonware. A fun way to learn math. (CGA) ~.\~ er, biorhythms, desert. Phoe­ AUTOMENU (3003) Make rC MATHPAK (202) Tutorial with BAD-BAD (2904) Ad- >~ nix, Star Wars, others. menu driven. Incl. passwords. lessons In higher math. venture game. l, QUEST (152) Role playing SCREEN (3006) Save your PC-TOUCH (204) Learn typing. ASTRQ-(BLEEP) (2905) Arcade adventure fantasy game. monitor from screen burn-in. BASIC TUTORIAL (208) Learn game (CGA) (Requires CGA) DOT MATRIX FONTS (3061- programming with BASIC. X-RATED COLOR SHOW (2915) SPACE WAR (158) Dogfight In 3062) (2 disks) Print your text BEGINNING SPANISH (211) Beautiful girls. (CGA) outer space, using phasers, in different fonts. Works with Tutorial. X-RATED PRINTSHOP (2909) photon torpedoes, etc. most printers. SPANISH II (232) Sequel. Graphics for Printshop. BRIDGE PAL (171) Complete BIBLEQ (214) Learn the Bible TELlCOMMUNICATIONS game of contract bridge, ACCOUNTING/FINANCE with this Q-A tutorial. with tutorial. NOnE SCI PCllIl 1Q 1 11 Q-MODEM 3.1 (1101, 1102, SIDEWAYS (1007) Prints text MARKET CGA (BUS17) Pei­ FACTS 50 (239) Geography 1144) (3 disks) Powerful but FENIX (193) Just like the forms sophisticated analysis lessons for U.S. Nice graphics. famous arcade game. sideways. Useful for spread­ ec;Jsy to use. Fast. sheets. on stocks, funds, etc. (EGA PINBALL GAMES (197) Pin­ version Is BUS16). RBBSV16.1A(1107-1109,1150) ball, Rain, Twilight Zone, SIMCGAIHGCIBM (1027, (4 disks) Multi-user bulletin Wizard, etc. 1062) (2 disks) Use with Her­ Ullll·r·(~lIal(JlITlI)oQJII. board system. cules graphics cardl com­ II.U.r------, KID-GAMES (GAM8) Animals 11.8 PROCOM 2.42 (1112-1113) math, clock game, alpha­ patibles to run programs (2 disks) Hacker's delight. Re­ requiring CGAon your mono­ 1t.14 bet. etc. 11.11 dial capability. Latest version. chrome PC. CHESS (GAM9) Incredible. H.• SECURITY/HACKING 2D and 3D. Many levels. Play IMAGE 3-D (1048) Create H.II back moves, store games. and edit 3-D objects. Move, H.II COPY PROTECTION I (1219) scale, rotate and tip image. H.ll Instructions for unprotecting U ~ FINGERPAINT (1050) Use key­ H.H .. 1M _, tI 1M • hkhu hel .., WJrOlllt'! (111) commercial software. board or mouse to draw. n." COPY PROTECTION II (1220) APPLICATIONS Like MacPalnt. (Requires More software unprotect. CGAorEGA) BILLPOWER+ (BUS40) Bill cli­ DANCAD 3-D (1051, 1052) (2 FORM LETTERS (1907) Com­ COPY PROTECTION III (1221) ents for time and materials, monly used form letters and disks) Creat~ 3-D graphics. Additional software to unpro. advances, retainers, etc. business applications. Rotate, magnify, etc. Runs Computes taxes, past due FLUSHOT (1225) Checks on CGA EGA or Hercules. EZ-FORMS (1908) Make forms softwcire for viruses. interest. etc. Has full G/L to meet different needs. Don:::;:'C3D CPA LEDGER (706-708) (3 MANAGER'S PLANNER (1920) DATABASE PROGRAMS disks) Complete general Daily planner. Prints out. PC-FILE dB (801, 805, 837) (3 ledger for corporations, part­ HOME INVENTORY (1966) disks) Newestverslonl Rated EGA RISK (GAM11) World nerships or sole proprietors. domination in great color. Track all your possessions. better than dBase 111+. PERSONAL FINANCE MAN­ BIORHYTHM (1990) Display PC-GRAPH (802) Create Includes EGA Asteroids. AGER (715) Household bud­ PC PRO-GOLF (GAM27-28) the 3 biological cycles: phys­ graphics from PC FILE. get manager. Keep track of ical, emotional. intellectual. FILE EXPRESS 4.0 (803-804) Great graphics. Complete checking, savings. invest­ 18 hole, 72 par course. (CGA) FAMILY HISTORY (2203-2204) Powerful system. Allows 32.000 ments. (2 disks) Create files and records. Sorts up to 10 key PEARL HARBOR (GAM32) PAYROLL USA (725-726) Up to Shoot down Jap Zeros before genealogical reports. fields. ···:ersiC'n 2 2.000 employees in any state. DR DATA LABEL (2327) Power­ DBASE 111+ ROUTINES (851- they destroy U.S. Fleet. (CGA) FANTASY 057) Create flow­ dBasel1l and Lotus compati­ ULTIMA 21 DELUXE (GAM34) ful mailing list program. Cus­ 852) (2 disks) Latest utilities ing graphic Images with ble. Complete P/R system. tomize labels to size. to help you utilize dBase 111+._ Best Blackjack game around. mouse or keyboard. (CGA). EXPRESS CHECK (786) Check Includes Video Poker. FLOWCHARTING (1078-1079) acount with running bal­ FORD SIMULATOR (GAM37) Complete system for flow­ ance. monthly reports. etc. Great driving simulation. charts. organizational. elec­ Prints checks. (CGA) trical. etc., with symbols. FINANCE MANAGER II (774- 775) (2 disks) For personal or MICRO STAR ~' .. RELIGION small business financial man­ 1105 SECOND ST •• ENCINITAS, CA 92024 THE BIBLE (3301-3306) (6 agement. HOURS: Monday - Saturday 7 AM - 5:00 PM. PacifiC TIme disks) Old Testament. King TERMS: We accept MasterCard. VISA Checks (allow 10 days to James version. clear). Money Orders. and COD (add $4.00). THE BIBLE (3307-3308) (2 DOS TUTORIAL (1301) Teaches 3W DISKS: 3Y2" format add $1/disk. disks) New Testament, King you to use DOS. SHIPPING & HANDLING: $3.50 (Total per order). James version. STILL RIVER SHELL (1304) Run MAIL-IN ORDERS: Circle disk numbers. Include name & address. WORD WORKER (3309-3310) DOS commands from a CALL TODAY FOR FREE CATALOG MUSIC (2 disks) Bible search pro­ menu. Makes DOS easy. PIANOMAN 4.0 (301) Turn gram. New Testament. King BATCH FILE TUTORIAL (1305) your keyboard into a piano. James version. Utilize batch file processing. 800·444·1343 Ext. 23 PC-MUSICIAN (302) Co'm­ BIBLEMEN (3330) Excellent MORE DOS TIPS (1318,1323) pose, save, and play music. Bible quiz program. (2 disks) More about DOS. FOREIGN: 619·436-0130 Reader Service Number 120

MICRO CORNUCOPIA, #46, Mar-Apr, 1989 93 Micro Cornucopia Back Issues Is There A Gae In Your Info?

Fill in your Back Issues of Micro C toda~!

ISSUE'1 (8181) Cheap Fast Modem ISSUE 123 (4185) ISSUE t33 (12188) ISSUE 141 (5/88) Power Supply Nevada COBOl Review Automatic Disk Relogglng SOLD OUT Artlflc/."ntellgenc. RAM Protection BBI Printer Interface Interrupt Drive Serial Printer 3-D Graphics Video Wiggle Kaypro Reverse Video Mod low Cost EPROM Eraser ISSUE t34 (2187) Neural Networks 1I2PFM.PRN 44 pages Smart Video Controiler SOLD OUT logic Of Programming 16 pages Review: MlcroSphere RAM Disk Languages ISSUE 114 (10183) Future Tense Begins ISSUE as (4/87) Applying Information Theory ISSUE 12 (10/81) BBII Installation 86 pages SOLD OUT 96 pages Parallel Print Driver The Perfect Terminal Drive Motor Control Interface To Electronic ISSUE 124 (6/85) ISSUE t38 (8/87) ISSUE , 42 (8188) Shugart Jumpers Typewriter C'lng Into Turbo Pascal Afou.e Control ""ntllln'ng PC. Program Storage Above PFM BBI Video Size 8" Drives On The Kaypro Build A Midi Interface Keeping Your Hard Drives 112 PFM.PRN Video Jitter Fix 48 Unes On A BBI For Your PC Running 16 pages Slicer Column Begins 68000 Versus 8Ox86 Designing A Database, Part 2 Troubleshooting PCs Kaypro Color Graphics Review Soldering: The First Steps Interrupts On The PC XT Theory of Operation ISSUE t3 (12181) 48 pages 88 pages Digital To Analog Conversion, Simulating A Bus 4 MHz Mods A Designer's View Ray Tracing Configuring Modem 7 ISSUE 115 (12183) ISSUE 125 (8/85) 96 pages 96 pages Safer Formatter Screen Dump listing Why I Wrote A Debugger Reverse Video Cursor Fixing Serial Ports The 32·Bit Super Chips ISSUE 137 (9/87) ISSUE 143 (9/87) FORTHwords Begins Playing Adventure Programming The 32032 De.ktop Pub/.hlng On A PC BuIlding DId""..". 16 pages SBASIC Column Begins Modula II Build Your Own HI·Res Graphics BuDd a C Database Upgrading Kaypro II To 4 RS·232C: The Interface Scanner For $6, Part 1 Selecting a dBase III ISSUE t4 (2182) Upgrading Kaypro 4 To 8 104 pages Designing A Database, Part 3 Compatible CompHer Keyboard Translation 48 pages Controillng AC Power Working with Paradox More 4 MHz Mods ISSUE 126 (10185) From Your PC Designing Custom PC Cards Modems, lync, and S10s ISSUE 116 (2184) Inside ZCPR3 Expanded Memory On The Accessing dBase III Plus Undoing CP/M ERASE Xerox 820 Column Restarts Two Megabytes On DSI·32 PCIXT/AT Records from Turbo Pascal Keyboard Encoder BBI Double Density SOGIV Uninterruptable Power 96 pages 20 pages BBII SHI8" interface Fix The Future Of Computing Supply For RAM Disks Kaypro ZCPR Patch Graphics In Turbo Pascal 96 pages ISSUEt44(11/88) ISSUE IS (4182) Adding Joystick To Color 104 pages Object-Dr#ented PfDg18mmlng Word Processing Graphics ISSUE t38 (11/87) A Taste of SmaDtalk Two Great Spells Recovering Text From Memory ISSUE 127 (12185) P.,..Uel Proceulng Actor Two Text Editors 52 pages SOLD OUT Laser Printers, Typesetters thinking Objectively Double Density Review And Page Definition Building MlcroCad Scribble, A Formatter ISSUE 117 (4184) ISSUE 128 (2/86) Languages Peripheral Technology- 20 pages Voice Synthesizer Pascal Runoff Winners Build A Graphics Scanner PT68K·2 820 RAM Disk Rescuing Lost Text From For $6, Part 2 Hercules Graphics Printer ISSUE t6 (6182) Kaypro Morse Code Interface Memory Writing A Resident Program Dump BBI EPROM Programmer 68000-Based System Review Introduction To Modula·2 Extractor In C 96 pages Customize Your Chars inside CP/M 86 Inside The PC 96 pages Double Density Update 56 pages 104 pages ISSUE 145(1189) Terminal In FORTH ISSUE 139 (1188) Computet' Aided o.lgn 24 pages ISSUE 118 (6184) ISSUE 129 (4186) PCG18phl" CAD In A Consulting Business Kaypro EPROM Programmer Speeding Up Your XT Drawing The Mandelbrot And Choosing PCB Layout Systems ISSUE t7 (8182) VO Byte: A Primer Importing Systems Julia Sets BuDding Circuits With Your 6 Reviews Of C Kaypro Joystick From Taiwan Desktop Graphics Computer Adding 6K Of RAM Serial To Parallel Interface Prototyplng In C Designing A PC Work· Secrets of Optimization Viewing 50 Hz Business COBOL C Interpreters Reviewed station Board Finding Bargains in the Surplus On Your Own Begins 60 pages Benchmarking The PCs Around the TMS·34010 Market 24 pages 104 pages 96 pages MASM5.1 ISSUE 119 (8184) 96 pages ISSUE IS (10/82) Adding Winchester To BBII ISSUE 130 (6/86) ISSUE t40 (3188) SOLD OUT 6 MHz On The BBI PROLOG On The PC The Gre'" C I• .,e Bulletin Boards Expert Systems 11 C Compilers ISSUE t9 (12182) Track Buffering On Slicer logic Programming Writing A Simple Parser In C B811 EPROM Program 4 MHz For The 820·1 Building Your Own logic C++, An Object Oriented C Relocating Your CP/M 64 pages Analyzer Source Level Debugger For Serial Print Driver 256K RAM For Your 83 Kaypro TurboC Big Board I Fixes ISSUE 120 (10184) PC-DOS For Non-Clones 96 pages Bringing Up WordStar HSC 68000 Co·Processor 104 pages Cheap RAM Disk DynaDlsk For The BBII 32 pages Serial Printer On BBI Sans S10 ISSUE t31 (8/86) Cheap & Dirty Talker For Kaypro RAM Resident PC Speedup To Order: ISSUE '10 (2183) Extended 8" Singie Density Practical Programming In SOLD OUT 72 pages Modula·2 Phone: 1-800-888-8087 Unblinking The PC's Blinkin' Mall: ISSUE '11 (4183) ISSUE 121 (12184) Cursor PO Box 223 SOLD OUT Analog To Digital Interface Game Theory In PROLOG Bend, Oregon 97709 installing Turbo Pascal and C ISSUE '12 (6183) low Intensity BBI Video 104 pages 256K forBBI Turbo Pascal, The Early Days United States, Bringing Up BBII 80 pages ISSUE 132 (10186) Issues #1-34 $3.00 each ppd. dBase II Public Domain 32000: look at Word Star Hardware And Software Issues #35-current $3.95 each ppd. Double Sided Drives for BBI ISSUE 122 (2185) Writing A Printer Driver for Packet Radio Xerox 820·11 To A Kaypro·8 MS·DOS Canada, & Mexico 5 MHz for Kaypro Sound Generator For the Recover A Directory By 40 pages STDBus Reading & Writing Disk All issues $5.00 each ppd. Reviews Of 256K Sectors ISSUE '13 (8183) RAM Expansion 96 pages CP/M Disk Directory In the Public Domain Begins Foreign (air mail) More 256K for BBI 88 pages All Issues $7.00 each ppd. Mini Front Panel ADVERTISERS INDEX Issue 46

Reader • • • • . • • . • • • • . • • • Page 10 Emerald Microware ...... 87 Service .•.••••.•••...Number 93 Erac Company ...... 15 145 Pathfinder Associates ...... 74 112 Garrison, Peter ...... 85 119 Peripheral Tech ...... 35 72 Acquired Intelligence ...... 14 130 GEMS ...... 67 3 PC Tech ...... Back Cover 107 American Cosmotron ...... 31 138 Gibson Research ...... 22 140 PMI ...... 71. 4 Austin Codeworks ...... 45 146 Greenleaf Software ...... 7 139 Quantum Software ...... 18 5 Blaise Computing ...... 13 11 Halted Specialties ...... 23 129 Research Group ...... 5 Capital Software ...... 20 22 Integrand ...... 81 142 RJSwantek ...... 70 15 Cascade Electronics ...... 39 CC Software ...... 35 17 Manx Software Inside Front Cover 127 SemWare ...... 27 C Gazette ...... 59 42 McTek Systems ...... 75 108 SofSolutions ...... 6 105 Computerized Processing Unltd. 65 Micro Cornucopia ...... 94 40 Star-K...... 30 7 CompuView .. Inside Back Cover 37 Microprocessors Unltd ..... 79 141 Sterling Castle ...... 18 2 Microsphere ...... 1 90 Dair Computer Systems .... 79 120 Micro Star ...... 93 101 United Products ...... 63

110 NuMega Technologies ...... 2

...... Contact Advertiser Directly .

Now Available From Micro C Issue #47 Computer Robotics Interfacing with Pascal & C by Bruce Eckel • Do It Yourself Maze-Running Robot • Use your PC parallel port for digital input and output • Writing A Robotics Operating System •. Build an Adapter Card for your PC • Control a stepper motor Controlling Events With C++ • Design and build • electronic circuits • Control AC power • And much, much more • Alternatives In Desktop Publishing

"Simply the best Order From: microcomputer electronics • The Science Of Fractal Images Micro Cornucopia book I've read." Larry Fogg PO Box 223 Bend, OR 97709 Only $30 ppd. 1-800-888-8087 Includes Book & Disk

MICRO CORNUCOPIA, #46,Mar-Apr, 1989 95 By Gary Entsminger 1912 Haussler Dr. Davis, CA 95616

Computer Go - Playing With Rules And Patterns

or "what if I do this, and you do that, lines of C to create Nemesis. Over 3,000 I remember watching the Go games in and I do this ... " scenario is complex in lines of that (almost 1/4) went into the the Tektronix lunchroom. Many of the cafe­ chess (configuration possibilities about user-interface. It takes only 146 teria "masters" had novices pick up their 1012°), but far less complex than in Go. kilobytes and a PC to play it. At $79, food so they could play an extra five In Go, there's only one "play" - Nemesis is affordable (even for non-aca­ minutes. you place a stone on an unoccupied in­ demics). Often the discussion would turn to com­ tersection. At most (at the beginning of Nemesis is as good (or better) a puterizing the game, but the masters always the game), there are 381 possible plays. player than its mainframe ancestor. discouraged the idea. "Too complex," they'd Each move reduces the number of I've had a blast playing (and learn­ say. "Do something easy, like Chess." So possible plays by one, while increasing ing to play) this incredible game. The we'd go back to watching the boards and the complexity of the board by a large beauty of it is that Nemesis helps - fetching food. nonlinear factor. • Each time Nemesis places a stone, Although the rules of Go are simple, it explains its motives, associating the staggering number of possible board them to a rule (or rules). very game has a set of rules configurations (or patterns) make pro­ • I can ask Nemesis to help me which separates it from its sur­ gramming a "smart" Go game very, place a stone and to explain its rounding reality. Most games very difficult. motives. ' Ehave a simple set of rules and Nevertheless, computer Go games • I can edit the board (to a new simple behavior or potential board con­ are improving thanks to the joint efforts position) and ask Nemesis to sug­ figuration. But some games (the most of AI researchers and "smart" program­ gest moves. intriguing ones) have a simple set of mers. • I can take back moves (and so can rules which often lead to extremely According to Walter Reitman and Nemesis). complex boards and patterns. Bruce Wilcox, the designers and pro­ • I can practice (or learn) by play­ One of these, the Asian game "Go," grammers of two "smart" Go games- ing Nemesis on smaller boards (9 has survived 4,000 years of human, and "Skilled human Go play presumes x 9 and 13 x 13). 20 years of computer attempts to master the ability to recognize and make infer­ • I can save and resume games it. ences from many different kinds of later. In Go, two players alternate in plac­ complex patterns - our Go programs For more information - ing stones on a 19x19 grid. Once placed, use a small set of basic scanning and a stone cannot be moved, but it can be recognition mechanisms (rules) to deal Toyogo, Inc. removed (via capture). with these patterns." 76 Bedford St., Suite #34 You win the game by enclosing more Lexington, MA 02173 territory than your opponent. In the Nemesis, Go Master (617) 861-0488 process of enclosing territory, you may Recently, I had the pleasure of play­ capture an opponent's stones by sur­ ing Bruce Wilcox's latest version of Go rounding them. Generally, the fewer - Nemesis, the Go Master (from Toy­ stones either of you has on the board, ogo, Inc., in Lexington, Massachusetts). References the less territory you hold. Nemesis is a clone of POGO, created Reitman, Walter and B. Wilcox. Pat­ The rules of Go are much simpler by Reitman and Wilcox on an IBM tern Recognition and Pattern-Directed In­ than the rules of chess, but a Go board mainframe between 1972 and 1977. That ference In a Program for Playing Go. Aca­ can be much more difficult to decipher Go took seven person-years and 8,000 demic Press. 1978. because of the incredible number of lines of LISP to create. It required 3 Wilcox, Bruce. Reflections On Building possible board configurations (about megabytes of memory to run. Two Go Programs. SIGART Newsletter. 761 10 ). Bruce writes (in Reflections on Build­ October 1985. Number 94. In chess, all pieces are placed on an 8 ing Two Go Programs) that a single game x 8 board before the game starts. Each of mainframe Go costs close to $2,000. play moves a piece to a new location. So eventually, even on an academic • •• The number of legal options can in­ budget, he had to give it up. For­ crease or decrease as the game pro­ tunately, a game with Nemesis on the gresses. PC isn't so expensive. The complexity of the "look ahead," It took Bruce one year and 13,500

96 MICRO CORNUCOPIA, #46, Mar-Apr 1989

------#1 PROGRAMMABLE EDITOR

• Best Multi-Level Undo • Regular Expressions • Pop-Up ASCII Table • Pull-Down Menus • Compiler Support • Column Blocks Until now, if you wanted the best Undo, the best compiler sup­ port, regular expressions and column blocks you chose BRIEpli. If you wanted unlimited keystroke macros, the best ~lm~~ ~~£[bQJJ£uO@G'~ ©@CQ>V * configurability, "off the cuff' command language macros and blazing speed, you chose VEDIT PLUS.® ©cnDD 1) a®@@a~@a~~[Q)OU Now the Choice is Easy The all new VEDIT PLUS 3.0 gives you the best Undo of any editor, the best compiler support, unequaled windows, true • Fully Network Compatible regular expressions and extensive new features. We're lead­ • Call for XENIX and OS/2 versions ing the way with easy to use pull down menus, context sensitive • 30 Day Money-back guarantee help, a pop-up ASCII table, new printing options and much more. Incredibly, VEDIT PLUS 3.0 is now twice as fast as be­ fore and, at only 60K in size, it loads fast! Features of VEDIT PLUS 3.0 • Simultaneously edit up to 37 files of unlimited size. Completely Configurable • Variable sized windows; multiple windows per file. Change a few keys or redefine the entire keyboard, VEDIT • Execute DOS commands and other programs. PLUS adjusts to your editing style in minutes. You can even • Flexible "cut and paste" with 36 "scratch-pad" buffers. create new editing functions using simple keystroke macros or • Block operations by line, character or column. fine tune existing ones. VEDIT PLUS is so configurable that it • Search with pattern matching or regular expressions. • Configuration-determine your own keyboard layout, create easily emulates other editors and word processors (WordStar your own editing functions, support any screen size. and Word Perfect emulation included). Quickly access editing • Select window colors, support 43 line EGA, 50 line VGA. functions with a single key or through the pull-down menus. EASY TO USE Try before You Buy • Modern pull-down menu system. Pop-up ASCII table. We challenge you to experience the dazzling performance and • Context sensitive on-line help is user changeable. • Multi-level Undo (100 to 1000 levels). Undo keystroke by exceptional features that make VEDIT PLUS the best choice. keystroke or line by line. Our evaluation disk includes the complete editor. * Learn • On-line integer calculator (also algebraic expressions). VEDIT PLUS using our extensive "training" macro that gives • Keystroke macros speed editing, menu function "hot keys." instructions in one window while you experiment in another. FOR PROGRAMMERS See for yourself why no other macro language comes close. • Automatic IndentiUndent for "C," PUI, PASCAL. Call for your free evaluation copy today. See why VEDIT PLUS • Match/check nested parentheses, e.g. "I" and "J" for "C." has been the #1 choice of programmers, writers and engineers • Flexible macro runs popular compilers and automatically since 1980. moves cursor to each error in your program. Easily changed to support new compilers and assemblers. Supports the IBM PC, XT, AT and PS/2 including DESQview, FOR WRITERS Microsoft Windows, PC-MOS/386, Concurrent DOS and most • Word wrap, paragraph formatting and justification. networks. Also available for MS-DOS, CP/M-86 and FlexOS. • Convert to/from Wordstar and mainframe files. (Yes! We support windows on CRT terminals.) $185. • Flexible printing; fully adjustable margins and Tab stops. MACRO PROGRAMMING LANGUAGE VEDIT and CompuView are registered trademarks of CompuView Products, Inc. BRIEF is a • If-then-else, looping, testing, string compare, branching, trademark of UnderWare, Inc. PC-MOS/386 is a trademark ofThe Software Link, Inc. CP/M-86 user prompts, keyboard input, 24 bit algebraiC expressions. and FlexOS are trademarks of Digital Research. MS-DOS, OS/2 and XENIX are trademarks of • Flexible windowing-forms entry, select size, color, etc. Microsoft. DESQview is a trademark of Quarterdeck Office Systems. • Simplifies complex text processing, formatting, conversions . • Also available for TI Professional, Tandy 2000, DEC Rainbow, WYSE 700, Amdek 1280 • Extensive 400 page manual with hundreds of examples. and Others. ·Free evaluation disk is fully functional and can even edit small files. Reader Service Number 7

1955 Pauline Blvd., Ann Arbor, MI48103 (313) 996-1299 • Telex 701821 • Fax (313) 996-1308 u iew 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 motherboard and backplane designs in a 100% AT compatible system. Incor­ porating a 16 MHz 80286, the X24 processor Is designed to operate with the PC Tech Advanced System Mother­ board, which contains the peripheral interfaces (hard disk, floppy disk, two serial ports and a parallel port). The X24 processor can also be used wtth other totally passive bus backplanes. Most critical components including the microprocessor and up to 4 m~abytes of fast memory are contained on a single PC size plug·in card. This allows the processor and main system memory to be selViced or upgraded without disturbing other peripherals such as senal 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, l.2m and l.44m • Two serial ports and one parallel port • 8 total expansion slots PC/XT/AT compatible (4 slots have 32 bit bus) The PC Tech Advanced System Motherboard is designed to complement PC Tech's X24 and X32 high performance 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 TMS340t 0 is a true general purpose graphics processor. PC Tech makes the total processing power of the 340t 0 available to both programmers and end users. Our 34010 Monochrome Graphics Adapter is designed to allow programming from the PC/XT/AT host bus. You can completely replace our 340tO software with 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 emulation 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 alternative to native 34010 software development. Ready to run drivers are available for most major applications software packages as well.

Custom Designs Available PC Tech wi ll li cense most products for non-exclusive manufacture. We will also cus­ tomize any of our deSign s to better meet your needs on our in-house CAD systems. All of our standard products are avai lable in private label ve rsions, 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 processo r, memory, and video products. Al l 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, Xl, AT, OOIS, Hercules, and Award BIOS are trademarks or registered trademarks of their respective companies.