$3.00 June-July 1986 Special AI Issue PROLOG On The PC ................................... 6 A thorough comparison of PROLOGS available on the PC. Expert Systems and Logic Programming ................. 12 Expert systems designers are handing out numbers to prospective customers. Opening Bids In Bridge ............................... . 18 A great example of how AI works. Grab your PROLOG and start coding. And More Building Your Own Logic Analyzer .............................. 26 Can't afford a commercial 32-channel logic analyzer? You can afford this one. 86 World ....................................................... 36 Our man in Turkey trots all over Asia looking for the complete supplier of drives, systems, boa_rds. '° 0 ,., 256K RAM For Your 83 Kaypro .................................. 44 Finally, a do-it-yourself RAM upgrade for this venerable Z80 machine. co co M °' ~ PC-DOS For Non-Clones ........................................ 54 0 "- Write a PC BIOS for your 8086-8088 system. ~ ~ "- 0 Brep-by-step tutorial, demo programs with source code included! Turbo Prolog 1.0 Borland introduces Turbo Prolog, Technical SpecitJ.cations ProgzmnmiDt 8yst,em .libatures f!:1' Compiler. Incremental rompller gen the natural language of erating Illl.tlVe ln-llne cxxle and llnkable oQJect malules. The l1nk1ng fonnat la romµit.lble with the FCOOS linker. large memmymcxiel support. Complies over 2600 Artificial Intelligence. llnea per minute on a standard !EM ro. f!:1' Int.eracttve 1'4tt.or: The E\)'Bt.em lnCludes a p:iwerful lnterect!Ve 1\J!l-rereen text editor. If the rompller detects an error, the ed!tor auoomatlCalzy pooltJona the curoor epproprlately In the rource cxxle. At Prolog is probably the most run-t!me, Turlxl Prolog ~can call the edit.or, and v1eW the runrung PI'®'Wil's powerful computer programming oouroe cxxle. f!:1' 7Jpe 8yBt:8m: A flexible oQJect,orWnted language ever conceived, which is cype E\)'Bt.em la supported. f!:1' wbywe've made it our second W1Ddowtng Bupport: The E\)'Bt.em supports !xJth graphic and text WlndowB. language-and ''turbocharged" it to f!:1' Input/Output: Full I/O fac111t!ea, create Turbo Prolog ... Including formatted I/0, streams, and random aooeaa files. Our new Turbo Prolog brings f!:1' .Numeric P.a.nges: Integel'B: -32:lf!7 to 32767; Reala: lE-307 to IE+zre supercomputer power to your IBM® f!:1' , .Debugg1Dg: Complete bullt-tn trare de , PC and introduces you step-by-step to buggtng CB.IW111t!ea allow1ng Single ........... st.eppJng of~ the fascinating new world of Artificial Intelligence. And does all this for an YES astounding $99.95. I I I !~a~~st Turbo Pascal the wey you I • I could compare Turbo Pascal w I I @ :f:/::~fi :ir~ _Q;;J=~:;;~e::, machine language. $Tur9bo P9rolo.g a9t on5ly: = = Pascal® is to Pa.sca.1! ~ our free tutorial will $ You get the complete Our Turbo Pascal aston1Bhoo get you st;a.rt;ed right away Turbo Prolog I To order by phone, 1 eavse ':Jcuysotn ae nwohtho etrh olaungghuta ogfe P:'a Wscea l beYcaouus'lel gweet shtaavrtee tdn crllguhdet da wa ay f;'=~~~Bsystem II Caolrl f o(r 8a0 de0a)le r 2ne5ar5es-t 8yo0u,0 8 1I Pchaasncagle 1d8 tahlle t dhea fta-caton dw onrolwdw Tiduerb o pcoamrtp olfe tthe es tmep-pbya-gsteep T tuurtboor iaPlr oalso g PrYolooug gdeetv ae lcoopmmpelnett es yTsuterbmo II in CA call (800) 742-1133. II standard, With hundreds of Reference Manual Our tuwrl.al tnclud!ng: I Send me_ Turbo Prolog at $ __ I l#WtWh' o!uI•As anf• di' s·c ·! o uaf nneidnvt ehurussesi1trisae ss1t,nB wWteainl lc ethae kdyeo w uy oek uvn eobrwyy ttahhbieno ghu aty Tnoduur 'rabeno l dik ely tt•nnTtcehrreaemc ltietgvnhetta nTl1 ucnrogbm-of paPsirlteo Trlo uagrnb edod tiPhtoreor .l og III ACOm4u toasuimdnet MeUnASc Arloe assde. dda: d $d1 0a pppelicr acbolpe ys ales tax $$ ____ III ··· •· · -V•. I. ... ·{: .; rceesnetaerrsc,h ProFloorg e axnamd pa.lret:t lolcniacle iynoteul\lrieg ence. m• Tanheu aml wphaicghe t nrecfleurdeensc teh e step I PaymTheisn tp rice VinIScAlu desM sChi ppinBg atnok a Dll rUafSt citieCsh eck I 1 schools, completed the tutorial, you '11 be by-step Turbo Prolog tuwrial. I Credit card expiration date:--'- I L< and With pro- able to desJgn your own expert • The free GeoBaseTM natural I Card~ I I I I I I I I I fessional program systems ut111zlng Turbo Prolog's query language database I 11111111 I "' anmde hrso,b bsytu1dsteBn. ts, pcaopwaebrifluitli epsr.o blem-oolv!ng ctnocdleu doinn dg 1csokm-rmeaedntye tdo ocooumrcpeil e. II b1tfs" ;5J ~V:,:, !8!' or 1111e corrpatible nmina II You can expect at least the Th1nk of Turbo Prolog as a GeoBare 1s a complete database My cO/TfJUlers name artJ model is: I same impact from Turbo Prolog, Wgh-speed electronic detect1V8. deslgn.ed and developed around • because while Turbo Prolog 1s the First you feed it information and U.S. geography. It tncludes cities, 1 Thedislrsizeluseis·D3'1/ DSW mproogstr ar.ernv.ornlurntigo nlaanryg uaangde ,n iatt 1usr aallo o t"etha1cnhk ist" r uthlees .p rTohbelenm T uthrbroo uPgroh1 og manodu cnotamtness, croivmeprsl,e taen Wd iWth gnhawtueyras,l II *60-DANYO MT OCNOEPYY- BPARCOKTE GCUTAERDA NTEE II a complete development enV1ron and comes up With all the query language. Use GeoBase I Name.- I. ment-juBt like Turbo Pascal reasonable answers-almost immediately "as 18," or mod!zy it Shipping Address· Turbo Prolog radically alters tnstantly. to fit your own tnteresta. I I banradv ed rnaemwa wticoarlldly o ifm ap.rrtotlvlceisa lt he amIfay zoinug t,h yionuk j tuhsat tn tehe1da w18 seScoo ndodn-g't edte Tlauyrb-od oPnro'tlo wga nsotew a. II SCtiatyt.e-: lip: II intelligence-and 1nV1tes you tnw remember that Turbo Prolog ls a $99.9518 an amaz1ng]y small I ·T elephone: I thhuamta f.ansJ.cyt ntnattetnllgig uennitv $e9r9se.9 f5o. r a 5ththe -kgiennde roaft liaonng luaanggeu tahgaet -2a1nsdt pimricmee wdiap teey a tuo tbheocrOlcmye- aann instant II ~In~temrcnaftiio,na~l~ P5aJss/aAl OMlodn:eJy eOwr:rl;er~. ~[b~e:r:iff:~~ II croeunttiunreyly c. oImn fpauctte, ryso Wu icll auns e Texhpe e2r1t sotn c ea.nrtt1ufircy1 a1ls ionntelyll iogneen ce! II :*Y E~S,i i~f cw:ithein~ s6~0 ;d;ay;s~ off: p:ur;c!hansrea l:hiJ~ :pr~o/du¢c;t 1do;e1s1 II compare Turbo Prolog w phone call awey. I arrangearefund. I ;;:~~~~"'A:.'t~'t requlrem1nt1: I ·.;.'.J ~~Of1¥Jatibles • ;. I 4585 SCOTTS VALLEY OR/VE SUS • ;,.·;.~ (S4C0O8T) T4S3 8V-A8L4L0E0Y . CTE4 L9E5X0 6161 2J1J «'. , ~'$~,< ·<, ,)., --------- " ·Features: NEW LOWER. Kits . All wave Soldered! ! . PRICES .. • 8 MHz 80186 microprocessor with true 16-bit data bus. · · • Full Kit W/O SCSI, serial ports, clock .•. $ 550.00 · • True PC compatability with our own custom • Assembled and Tested ROM BIOS and PC cardslots for the video W/O SCSI, serial ports, clock ••• 1-4 $ 599.00 of your choice. 5-9 $ 525.00 • Standard 512K zero wait DRAM, ·or SCSI Port ................. add $ 20.00 12.50. Serial Ports .......... each -add $ ~ 1 M options.· Real Time Clock and Battery , add $ . ·1~.50 ~8 087 numeric coprocessor support on board. • 112 MEG Add-On ............ :'. ... $ 105.00 . • On-board floppy disk controller for up to • XT Style, Enclosure ............. "$ 75.00 four 5114" drives. • 150 Watt Power Supply, Tested ... $ 105.00. • On-board SCSI hard disk controller port. ~087-2 Coprocessor .............. $ Call ~ Supports WD1002 SHD., WD1003 ACS, ~ OMTI 5100, 5300 ADAPTEC ACB4000. • 2 On-Board Serial Ports. Total Solutions: . . • Battery Back-Up Real Time Clock. Assembled and Tested Systems Designed, Manufactured and Serviced by: • Mono-Chrome System ............ $1,499.00 Includes: 512K, Power Supply, PC Enclosure, Keyboard, Monitor, [CH 1 Two Drives, and Printer· Port, :o~·~i~h ~~h 1 Serial Port, Real Time Clock.· street • Quaritity Discounts Upon'·,Requ~st . Lake City, MN 55041 •Call For Info on Add-Ons, Hard Disks, Etc: (612) 345-4555 COD, VISA, MASTER CARO, CERTIFllSD. FUN CS :;MICRO ·, (}ORNUCOPI/\ EDITORIAL The Micro Technical By David Thompson Journal Over The Wall Editor & Publisher David J. Thompson Operations & Advertising Morrow Computers Says Goodby David Pogue · George Morrow is still around, but Morrow computers, one of the early powers in this industry, has filed Associate Editors Chapter 11. · . .. . Rebecca Ozrelic Gary Entsminger In his book Quotations From Chpirmqn :Morrow George wrote, '.'Money is the only lethal drug ·available on a non- Accounting prescription basis.'' . . Sandra Thompson "We pissed away $11 milliori,". he commented after the filing. (Something not experienced by·many.) Office Manager If someone doesn't come forth shortiy·with ·something Tracey Anthony that's green and folds and interests bankers, there won't be· another chapter. ~ ,, ,. Technical Department Larry Fogg Mirror Says A Lot Be careful when you sue somecme - you might just be Staff Assistants doing t~em a favor. Crosstalk is' suing Softklone over its Laura Logan Cary Gatton Mirror communications package for the Compatibles, but Renee Katter publicity from the suit could be a super boost for Softklone's new product. I called Softklone to see what the fuss was about. It turns out that Mirror will emulate Crosstalk, from MICRO CORNl]COPIA (ISSN 0747-587X) is communications protocol to configuration files. Mirror published bi-monthly for $16 per year by will also speak Christianson (CRC ·or checksum), Hayes, Micro Cornucopia Inc. 155 NW Hawthorne and Kermit protocols. · · Bend, OR 97701. Second-class postage paid at Bend, OR and additional mailing offices. It has. a built.:in text eoitor, password .p rotection, data POSTMASTER: Send address changes to encoding/ decoding, plus it runs in the background. Gust MICRO CORNUCOPIA, PO Box 223, Bend · hit both shift keys and the transfer continues in the OR 97709. " background while you use the system for other. tasks. Hit SUBSCRIPTION RATES: the shifts ·again and you're back in Mfuor.) ... 1 yr.(6 issues) ...................... $16.00 2 yr.(12 issues) ..................... $30.00 · Mirror. supports practically every· auto or manual dial 3 yr.(18 issues) ................ : .... $42.00 modem· (Hayes compatible and non-compatible). It will 1 yr.(Canada & Mexico) ............. $22.00 even turn a PC into a VT-100 terminal if you wish. 1 yr.(Other foreign) ................. $30.00 Make all orders payable in U.S. funds on a I ordered one. After it arrived I tried it out on U.S. bank, please. · everything . I .c ould find. I'd been using Mite and Modem740, but. I musf say, this is better, much better. CHANGE OF ADDRESS: Please send your old lcibel and new address. One problem I found is that it holds up the sender while it's writing to disk (in 4K blocks). At 9600 baud this delay MICRO CORNUCOPIA becomes significant and reduces the effective transfer rate P.O. Box 223 to about 5000 baud ·( rurulir\g on a clone and writing orito · Bend, Oregon 97709 · ·a Seagate winchester).. · . · CUSTOMER SERVICE: For orders & sub However, at $49.95 (not copy protected),· it's definitely the best deal in scription problems call 503-382-5060, 9 am to commercial modem software I've seen. 5 pm,· Pacific time, M -F. For technical help call 503-382-8048, 9 am to Solid noon, Pacific time, M -F. I have a 'Holliston XT-186 board, and it's turned out· to be a. quick, :·very RBBS -24 hrs. 300-1200-2400 baud dependable performer. Though it doesn't have the video speed or the built-in 503-382-7643 floppy interface of PC Tech' s X-16, it certainly holds. its. own in the processing Copyright 1986 by Micro Cornucopia Inc. All rights reserved (continued on page 90) ISSN 0747-587X · 2 MICRO CORNUCOPIA, #30, June-July 1986 CONTENTS June-July 1986 Issue No. 30 Introduction To PROLOG 68 The Racer's Edge The 68020 is out. Trevor Marshall and Co. tell us how it matches up against the 32032. . 6 PROLOG On The PC There's already quite a collection of compilers and interpreters for this unique new language 94 Fast Step Rate For PC Disk Drives Larry Fogg changes his clone's step rate in software. An easy, quiet mod. 12 Expert KNOWLEDGE · Systems and BASE Logic Programming Knowledge Al:quisltlon Columns An overview of And Refinement expert systems design using PROLOG. NATURA LANGUAC INTERFAC 36 86 World Direct Importing. Laine picks up the baton and runs (all over Asia) with it. Fascinating adventure. 18 Opening Bids In Bridge 44 Kaypro An example PROLOG application. Margaret Sklar lets Folks have been requesting this mod for four years: tin her code do the talking. easy 256K RAM upgrade for the 83 Kaypro II and 4. 48 Pascal Procedures John Jones tries writing a simple draw program for the PC (and enjoys it). More Features 64 C'ing Clearly Porting Code 77 Culture Corner An answer for $7.11. 26 Building Your 78 On Your Own AI recommendations DC15 Own Logic. INt!5 Analyzer DCl4 82 In .the Public Domain . Build your own IN14 Another.CPIM emulator, but this one fogic analyzer for DC13 thinks it's a Z80. How about that peanuts. Part one INt3 of a two-part DC12 86 S-100 Bus Hardware supporting Turbodos IN12 series. 96 Technical Tips 54 PC-DOS For Non-Clones Want to write a custom Pc BIOS for your 8088 system? Want to know what's happening inside your clone BIOS? Future Tense· By Gary Entsminger 72 Split Personalities 98 Tidbits File recovery under MS-DOS and The V Series . the visible computer The V20 & V30 have been hot replacements for the 8088186. What 104 The Last Page It's recursion: can the rest of the series do? again, and again, and again, and ... MICRO CORNUCOPIA, #30, June-July 1986 3 Digs The Duck Next I hooked up a scope to pin 6 know what they're guestimating. They I own a DAK ADC modem and have on the CPU to see what the new expected the Amiga to blow away anything had basically good experiences. The 5MHz signal looked like. The wave less than an 8MHz 80286, especially for only problem I encountered was that form was quite ragged on the uphill screen 110 which is measured in bench 3. one of the DIP switches did not oper side. In addition, the amplitude was See Issue 29 for benchmark details. ate correctly. But since there was an extremely low, just over 2 volts. Just Times are. in seconds. All used 16-bit equivalent command that I could for comparison, I checked the now integers (short ints for Amiga). No speed imbed in my startup file, this was not unused 2.5MHz pin and was amazed optimization was used (like register vars) a big problem. at the difference. The wave had an w~en compiling. · I also found one little "gotcha" amplitude of well over 5 volts and was Benches 1 2 3 which I suspect is not limited to the clean and smooth in appearance. Since Amiga w/Int. 237.9 124.1 225.1 duck. The modem will run in either · I didn't have a replacement for the Amiga w/Short Int. 32.5 21.0 225.0 Atari ST 28.0 18.0 35.5 300 or 1200 baud over the phone line, 74LS293 (U86 on the Micro C schemat 6 HHz AT clone 11.2 7.4 34.2 depending on what it detects coming ic), which provides both the 2.SMHz 4.77 HHz 8088 54.7 28.7 73.6 4 HHz Z80 478.2 244.6 39.0 in. However, I found that when I and the SMHz signal, I couldn't see if dialed a BBS which handles both baud it was a bad chip. Instead, I picked a As for power supplies; boy, you've got rates, the BBS tried 300 first. The duck 4MHz signal from pin 6 on U87 and me. I've seen some of the cheapest switch obediently "quacked" at the lower fed it to the CPU. Eureka! ing power supplies from Taiwan put up rate after initially connecting at 1200. After installing a switch to allow with all kinds of electrical violence without The solution is simple: turn off the transfer from 2.5 to 4MHz, I left the complaint (and without damaging the sys buffered mode (A TBO) before dialing a computer on for about 10 hours. No tem). BBS which you know will handle 1200 failure, and no recurrence. Thanks. The old linear supplies ·(10-20lb 60Hz baud. · Martin Leichtung tranformers and house-warming linear reg Larry Blanchard HRC 4260 Kachemak Dr. ulators) I have on my Big Boards weren't 2018 N Valencia Homer AK 99603 cheap, aren't small, and definitely aren't Santa Ana CA 92706 efficient but after almost 6 years they haven't eaten any processors. Amiga Benchmarks You asked for benchmarks on the Curing Keyboard Lockup Amiga in Issue 29; here are mine: One Out Of Two Ain't So Good .S everal months ago a friend and I Benches 1 2 3 My first order to DAK was satisfac ordered speed-up mods and Pro-8 tory, although it took four weeks for Amiga w/Int. 237.9 124.1 225.1 monitor ROMs from you to upgrade Amiga w/Short Int. 32.5 21.0 225.0 delivery. instead of Mr. Bollinger's four our 2-83s. Using the instructions en All times are in seconds and include days. My second order, however, was closed with the kits we had no trouble floppy disk access time. I used Lattice a nightmare. The printer I received successfully completing the modifica C. The first times were done with the was a defective, used one that had tions to both machines.· program as you listed it. The second already been se~t back by a dissatis-· After about a half hour of continu times were generated with short (16- fied customer in Florida. I found his ous operation my computer developed bit) integers. address label as well as a used candy a case of the dreaded "keyboard lock Now I need some info from you: wrapper in the "factory" packing. up syndrome." Afte:i: several tele how do you protect your system in the Parts of the case were missing, and phone calls to Micro C, Zilog chip event of a power supply failure? I just . the machine never would initialize. dealers, and MicroSphere, and quite a had a supply go out that cost me a Two calls to customer service went few suggestions that sounded good motherboard and winchester, not to unanswered. When I finally got but didn't work, I got my Issue 26 of mention the supply. Fortunately the through, their reply was, "You may Micro C. It contained a Technical Tip case and fan were just fine. send the merchandise back for a re about an aluminum heatsink devel Bob Gobeille fund (sans shipping fees both ways).". oped by an English doctor. 805 Laporte Ave A certified letter to the president of Installation complete, power on, ev Fort Collins CO 80521 the company produced no better re erything looked good .- until an hour sults. had passed. Then my system was off Editor's note: I believe companies which make to la-la land again. I called Micro C for Lance Rutallie also submitted bench mistakes should be willing to correct the third time, and that time, I got to marks almost identical to yours (he also them at their cost instead of making talk to Mr. Thompson. During our 10 used Lattice C V3.02). It's interesting to the customer pay for those errors. or 15 minutes on the phone we cov see the benchmark comparisons between the Needless to say, I will never do busi ered a wide range of possibilities. But Amiga and the Atari ST. ness with DAK again. when I hung up, I had a clear idea of A hunkering of knowledgeable guestima David Randles what I needed to do; tors came up with a set of expected times P .0. Box 8461 First I checked the power supply. for the Amiga that showed beyond a doubt Medford OR 97504 No problem ___: steady 5.045 volts. that knowledgeable guestimators don't (continued on page 88) 4 MICRO CORNUCOPIA, #30, June-July 1986 THE CHALLENGER XT-186 SINGLE BOARD COMPUTER FULLY IBM COMPATIBLE BUT FOUR TIMES FASTER STANDARD FEATURES: •Intel 80186 CPU, 8 MHz •On-board 640K, parity checked RAM memory •8 slots for 1/0 Interface Board 6 · 8 Bit Data 2 · 16 Bit Data •4 channel 8237 OMA •8 channel 8259 Interrupt •3 channel 8253 Timer •IBM PC-AT-like Bus with true 16 bit data path OPTIONAL FEATURES: • 10 MHz operation •8087 Numerical Processor Support •NEW ROM BIOS Version 2.0 --NOW AVAILABLE-- The Challenger XT-186 offers full IBM PC-XT compatibility. It supports industry standard operating systems: MS-DOS, PC XT-88 Turbo Board DOS, 1.0 through 3. 1, CP/ Mand runs all existing software with higher performance. The XT-186 mother board can directly A reliable, low cost mother board with IBM PC-XT compati replace any existing PC or PC-XT mother board, as it has the bility, running 1.8 times faster. 8MHz hardware selectable to same physical dimensions and mounting holes. The Intel 80186 4.7 MHz. On-board 8087 socket ready for co-processor chip $299 and 640K on-board 16 bit path RAM makes the XT-186 the installation. The 8088-2 processor with 8 1/0 fastest PC currently available. slots, 640K RAM and compatible ROM BIOS •.... MOTHER BOARD, 8 MHz, 640K, RAM, 8 1/0 slots $199 No RAM .....••..•. . $695.00 NEW LOWER PRICE AT-286 Mother Board Here's the power you need to get the job done! IBM PC-AT The XT-186 ROM BIOS version 2.0 supports the IBM PC-T compatibility enables you to run a broad range of programs, both personal and professional. The board comes with a built combined Hard Dish/Floppy Controller on the Challenger XT- in Real-time clock and 80287 socket for future co-processor 186 mother board. With the new ROM BIOS installed the insertion. The AT-286 with the Intel 80286 microprocessor XT-186 can support two 1.2 MB floppy drives and two hard disk running at 8MHz with 640K RAM and Phoenix BIOS processes drives with the same fast access time of the IBM PC-AT. No other information faster and more efficiently. Build a high-perform· XT compatible system can offer either the speed or the disk once computer and boost your productivity. storage capacity, (230 Mbytes maximum) of the XT-186. $ Mother Board, 8MHz clock rate, 640K RAM, 995 XT-186 ROM BIOS version 2.0 Upgrade Kit 8 I/ 0 slots, Phoenix ROM BIOS .•............ $50.00 ............. $895 No RAM VISA and MASTERCARD Accepted - Please Add s3.00 Shipping HOLLISTON COMPUTER P.O. Box 615, Chepachet, R. I. 02814 401-568-0522 IBM PC-XT-AT, PC-DOS ore trademarks of International Business Machines Corp .• MC DOS is a registered trademark of Micro-Solt Corp .. CP Mis a registered trademark of Digital Research Inc MICRO CORNUCOPIA, #30, June-July 1986 5 >PRO LOG On The PC By Gary Entsminger Starting Out In PROLOG· PROLOG, what's in it for. you? resemblance to a procedure or function describes the Edinburgh· syntax, "mi What's it· like to work with? Who's in a conventional language like Pascal, cro-PROLOG: Programming in Logic" got the best ·PRO LOG package for with arguments enclosed in parenthes~ by Clark and McCabe, which describes beginners writing expert systems (or es. For example - the micro-PROLOG syntax, (published experts writing beginner systems)? by Prentice~Hall), or· D.E. Cortesi's Gary has dug up some very interest- SUCC{X Y) if excellent article, "A Tour of PRO L SUM{X Y1 Y). . ing information about new implemen OG" (in Dr. Dobb's/March '85). tations of this language. describes the successor relationship in micro-PRO LOG. PROLOG.On The PC: For a more detailed introduction to Currently, a nuinber · of PROLOG PROLOG, see "Programming in interpreters and compilers are avail The idea .. of logic programming PROLOG" by Clocksin and Mellish able for. the PC, ranging in price from , isn't new - PROLOG (for PRO- (published by Springer-Verlag), which a public domain interpreter from Ada gramming in LOGic) was first implemented in Marseilles in 1972 - but its popularity had to wait for the Figure Ta -Turbo PROLOG Program For Reversing A List Using Append Japanese to select it for their Fifth Ge11eration Project language in 1982. domains The Fifth Generation envisions com = integerlist integer• puter hardware engineered for logic processing (earlier generations of com predicates puters were engineered for arithmetic reverse(integerlist,int~gerlist) _p rocessing) and a logic programming append ( integerlist, · ·' · language (i.e. PROLOG) for interact integerlist,integerlist) ing between the logic processing hard generate(integerlist integerlist) 1 ware and the upper level software that clauses implements problem solving strategies. reverse([],[]). reverse([XIY],Z):-· PROLOG Briefly Essentially, a PROLOG program is a reverse(Y,Y1), append.(Y1 ,[X] ,Z) ~ append([],X,X). set of logical definitions about rela append([XIY],Z,[XIW]): tions. Instead of specifying the flow of append(Y,Z,W). actions to be performed (the "how" of generate(O,[]). execution) as we do in a procedural generate(N,[NIY]):- language like Pascal or C, we ·describe M is N-1, "what" is to be executed and leave generate(M,Y). the specifics of implementation to test:- PROLOG. See Figure 1 (benchmark generate(SO,X), tests) and the factorial program in The write ( X), Last Page (this issue) for examples of reverse(X,Y), PROLOG programs. write(Y). Eight fundamental syntactic concepts · compose the PROLOG notation - numbers, variables, constants, lists, Figure Tb -micro-PROLOG Program For Reversing A List w/o Tail-recursion . clauses, .c onjunctions, facts, and rules. A PROLOG program consists of a ( () D-reverse · (_X _X)) database of sentences (made up of ( (_x l_y) D-reverse (_Y _Z) if _ clauses, etc.) that define relations. _ y D-reverse (_Y (_xl.-.Z))) c_x· A clause (or predicate) is the funda reverse _y if mental way of specifying a relation _X D-reverse (_Y ())) ship between terms. For simplicity, you might think of a predicate as a ,· 6 MICRO CORNUCOPIA, #30, June-July 1986 NOW AVAILABLE for MS-DOS PC-DOS CPM-86 CCPM-86 CPM-80 SPEED - POWER - VERSATILITY -EXPRESS 2.0 FULL SCREEN EDITOR HIGH PERFORMANCE AT A FAIR PRICE (also available. on Micro C MS-Disk #19) to the very expensive PROLOG2 Q NL Y $29. 95 $34. 95 compiler from Expert Systems. 8 Bit Versions 16 Bit Versions In this review, I'll quickly outline the features of each of the PROLOG tools DOES YOUR TEXT EDITOR REMIND YOU OF A 1949 PACKARD •••• I tested and indicate which ones will (I Stop abusing yourself. It's time to retire that doggy old clunker! believe) · serve · the beginner .a nd the YOU DESERVE EXPRESS 2.0, the 280-Z of the editor world! applications programmer. ·EXPRESS 2.0 FEATURES In general, PROLOG tools have im • FULL ACCESS TO CP/M USERS AREAS (up to 32) with any editor command! proved significantly during the . past • NAMED DIRECTORIES supported on MSDOS VERSION! year, and all those· tested have merit. • MEMORY MAPPED VIDEO AVAILABLE FOR IBM PC and PC clones! The principal differences in the imple • BU.Ill-IN CP/M LIKE COMMANDS (RENAME, COPY, ERASE, TYPE, DIR, LOG)! .mentations are in syntax, features, • POWERFUL KEYBOARD MACRO'S (as many as you want)! • FULLY RECONFIGURABLE COMMAND KEYS (emulate any other editor if you like)! speed, documentation, and ease of • FAST, FAST, FAST SEARCH! .'use. As usual, ·you get what you pay • TERMINAL DATA BASE •• INSTANTLY configure for over 50 predefined terminals! for, but "higher price" doesn't neces • FILES LARGER THAN MEMORY handled with ease! sarily mean "better product." Read • CONTROL and HIGH BIT CHARACTERS maybe entered and edited I • DYNAMIC WORD WRAP/UNWRAP• FULL CURSOR CONTROL (and then some) on. • EASY ot SET TAB STOPS • GLOBAL/SELECTIVE/LITERAL/IGNORE CASE REPLACE • FULL BLOCK INSTRUCTIONS including PRINT, SAVE, INCLUDE, MOVE, COPY, DELETE AdaPROLOG • VARIABLE SPEED (FAST!) Bl-DIRECTIONAL AUTO SCROLL • GOTO PAGE N/ LINEN Ada comes in several flavors, from a • COMPACT on disk and in RAM. (even the 16 bit versions are only 25kbytes)! beginner's public domain version • NOT COPY PROTECTED! • AFFORDABLE •• High performance at a fair price is our motto . (mentioned earlier) through an educa-: • EXPRESS 1.0 SAMPLER available FREE on your Local Bulletin Board or for only $10.00 from : tional and virtual memory yersion to a us. EXPRESS 1.0 is not just a demo. It is a real working editor with enough of the EXPRESS ·full-featured professional implementa..; 2.0 features to demonstrate the POWER of EXPRESS .. tion. The main differences between Notes: ·them are price and features. CP/M-80 version requires a Z-80 CPU running CP/M 2.2 or greater. For $8 you get an Edinburgh core MSDOS version requires MSDOS/PCDOS 2.0 or higher. PROLOG without floating point, a We can support too many 5 inch disk formats to list them all. If you can't use one of the debugging (or tracing) facility, random listed formats, please try to give us several options. · Please allow 4-6 weeks for delivery. access to files, access to DOS com mands, virtual memory, etc. But, if you're just wanting a very inexpensive Gentlemen .. : .I'm ready to step up to EXPRESS ... please send the following: taste of PROLOG, this might be the ___ copies of EXPRESS 2.0 for CP/M-80 at $29.95 + $5.00 shipping and handling ___ copies of EXPRESS 2.0 for CP/M-86 at $34.95 + $5.00 shipping and handling place to start. Unfortunately, the lack ___ copies of EXPRESS 2.0 for MS/PCDOS at $34.95 + $5.00 shipping and hand Ii rig · of so many crucial features (particular -~-·copies of EXPRESS 1.0 for __ CP /M-80 __. CP /M-86 __ MSDOS/PCDOS ly the debugger) will probably give at $10.00 + $2.00 shipping and handling you a distorted view of PROLOG. If I COD -add $3.50 Wash. Residents add 7.8% state sales tax . wanted to spend as little as possible to Make check or money order Shipping informatiOn: discover what PRO LOG is about, I'd payable to·:· Name spend a little more and get the .FS TCI Address version. 17733 205th Ave. NE City ------State ___ ZIP --- At $49.95, .FS PROLOG includes all Woodinville, Washington 98072 .. the features I mentioned in the last Phone Day Night ----- paragraph except for virtual memory. Disk format desired: __ .Kaypro 2 ssop _Morrow MD2 SSDD . __ 5'.' Xerox SSSD · The syntax is the Edinburgh standard, __ Kaypro 2X/IV /10DSDD __ Morrow MD3 DSDD __ 5". Xerox SSDD so a combination of .FS and· a copy of __ Osborne 1 SSDD _ 5" MS/PCDOS STD SSDD _ 5" Xerox DSDD Clocksin and Mellish will be sUfficient _._Osborne 1 SSSD _ 5" MS/PCDOS STD DSDD - Zenith Z90 SSDD to get you started toward sophisticated __. Epson QX-10 DSDD _ 5" IBM CPM-86 STD SSDD _8"SSSD PROLOG programming. __· Other () ·(continued next page) TOMORROW'S CoMPUTIN°G INNOVATIONS MICRO CORNUCOPIA, #30, June-July 1986 7 Table 7 -Benchmarks PROLOG List Reverse(Tail) Search ( 1000 members) PROLOG2 1 0 ! 50 0:04 0:04 0:06 NOTES: All benchmarks use recursion. The recursion limit was determined by the reverse list test which is heavily stack intensive. Reverse(Tail) uses tail recursion and virtually eliminates the use of the stack. Search is a fundamental speed te~t: searching a 1 rule database. For comparison --the factorial limit of Turbo Pascal using integers is 7!; 33! using reals. All benchmark results shown were executed with interpreters (except Turbo PROLOG). Times for Arity's and Expert's (PROLOG2) compilers are several times faster. PROLOG On The PC (continued from page 7) that has Y as its tail, if X is a member front-end (say, for an expert system). of the tail of the list. The possibilities are limited only by The top of the line model from Ada In micro-PROLOG, we'd write - your imagination. APES, an expert (VMA PROLOG) at $250 is almost full system shell from Programming Logic X member (XIZ) featured - including virtual memory, Systems, is an example of such a shell. X member CYIZ) if X member Z tree structured domains, and access to micro-PROLOG seems to have few DOS commands, which allows you to Notice the lack of brackets, the "if" problems - lack of a compiler to invoke your own choice of editor. Its instead of ":-", and the lack of punc create stand-alone programs and the main drawback is a lack of speed. As tuation. You might think of micro oddball syntax are the main ones. Its the benchmarks show (see Table 1), PROLOG as a bare bones PROLOG, documentation is excellent, and its VMA is the slowest of the PROLOGs perhaps a little harder to read initially, speed in the benchmarks was more tested. So if you're going to spend but in the long run, quite powerful. than adequate. more than $50, you might look else micro-PROLOG Professional is Pro It's $395, and for the money you get where for a PROLOG. gramming Logic Systems' top of the an excellent implementation - worthy line model. It's full-featured, including of beginner or professional. micro-PROLOG Professional a WordStar-like editor, screen cursor micro-PROLOG from Programming control, modules, and the capability PROLOG 1 And 2 Logic Systems is the· oddball in the for interfacing to assembly language. Expert Systems offers two choices of PROLOG world syntactically speaking. subroutines. PROLOGs an interpreter It implements a LISP-like syntax which It comes with a copy of Clark and (PROLOGl) and a compiler/interpreter differs from Edinburgh's in several McCabe's definitive text (a good tutori combination (PROLOG2). The compi ways, in particular in its exclusive use al) and the SIMPLE front-end which is ler increases operating speed signifi of parentheses in list processing. very user friendly. cantly (about 5 times), but does not For example, in the Edinburgh syn SIMPLE is a windowed environment compile to standalone programs. At tax an expression containing a member running above the interpreter which $1895, the compiler is out of reach for and a list might look like this - enables you to load files, trace and run all but the professional developer. programs, add and delete clauses, and PROLOGl, Expert's interpreter, is a member ( X, [XL]) • edit files. good implementation of the Edinburgh member(X,[_IY]) :- member(X,Y). Once you've gotten the hang of syntax, including numerous built-in The brackets indicate a list. Loosely PROLOG, you can bypass SIMPLE predicates for screen and window han translated the expression means - and its menus and interact with the dling and manipulating the database X is a member of a list that has X as interpreter directly, or if you choose via hash tables. At $395 it's competi its head, and X is a member of a list you can write your own interactive tive with other PROLOGs, although 8 MICRO CORNUCOPIA, #30, June-July 1986
Description: