MASTERING TURBOC MASTERING TURBOC ® SeconEdd ition STANK ELLY-BOOTLE SAN fRANCISCO PARISD USSELDORfL ONDON • • • Covedre sigbnyT homasI ngal+l Ass sociates Coveprh otograbpyhD ya viBdi shop Bookd esigbnyJ ulBiiel ski IllustrabtyJi eofnGfsi ese Screerne productpiroondsu cebdyX enoFont AT&Ta ndU NIXa ret rademaorfkA sm ericaTne lephoannedT elegrCaop.h( BeLlalb oratories). TurbCo i sa trademaorfBk o rlaInndt ernatiIonnca.l , HerculGersa phics Adiasap ttreard emaorfHk erculCeosm puteTre chnol.o gy Intiesla trademaorfIk n tCeolr poration. IBM,I BMP c.P C/AT, PCP/SX/T2,P, C -DOSa,n dP Cjra ret rademarokfIs n ternatiBounsailn ess Machines Corporation. MicrosaonfdtM S-DOSa ret rademaorfkM si crosCoofrtp oration. WordStiasrt rademaorfMk i croPIrnot ernatCioornpaolr ation. SpartXaXni sa trade'moafSr ukp remTee chnetroCnoircpso ration. XenoFoinsta trademaorfXk e noSoft. SYBEXi sa registetrreadd emaorfSk Y BEXI nc. SYBEXi sn ota ffiliwaitteahdn ym anufacturer. Evereyf fohratsb eenm adet os upplcyo mpleatned a ccurate infoHromwaetvieorSn,Y. B EXa ssumes nor esponsibfiolirit utssy e n,o rf oarn yi nfringemoefpn attse notrso therri ghotfts h irpda rtiwehsi ch woulrde sult. Firesdti ticoonp yright©b1y9S 8Y8B EXI,n c. Copyright©1S9Y8B9E X In2c0.2,1C hallengDerirv #e1 00A,l amedaC,A 94501W.o rldr ights reservNeod .p aorftt hipsu blicamtaiyob ne s torienda r etriesvyaslt etmr,a nsmitotrre edp,r oduced ina nyw ay,i ncludbiuntgn otl imitteopd h otocopphy,o togrampahg,n etoirco therre corwdi,t hout thep rioarg reemeanntd w rittpeenr missoifot nh ep ublisher. LibraorfyC ongreCsasr dN umber: 89-80007 ISBN0 -89588-595-6 Manufactuirnet dh eU niteSdt atoefsA merica 10 9 8 7 6 3 25 4 Anothqeura lityb ys can KfemialnedVk o chomllrka To wifeI,w onak my ACKNOWLEDGMENTS .� � Iw oluldei ktthoka nwaon dfelurc erwa tS YBXEw houe sdsi tcsak ncda r roittnsh gee enstftlah sioDn.rR. u doLlapnh,go enoretf o hsrea erxeue tceisv inc ompuetro-okbp ublnigws hhoki nwosc opmuetrasn ldvo easl blo oks, fritst raepdmp ei tnot hpiorsej c.Nt owt htia tc'omspl teeIa, m g ldha ew as so persuasive. VniceLnetno ew amsy d veeloptmaeeldno irmt;yt hkastn oh ifmro h is cotnnasstp uproatn gdu idanntoec cxel,u dtihsnepg on tgot fai lmlym sinsig seimoclo(nhIso e p)a nudwn atnecdo mmas. A wrodo fp reat ioast rsitJslu iBleis akniCd h atrtClearo tCehre,V regyali n typtenis,gae ntSdy lTvowineasn fdro p rffor-eidn.Ak pepndGi rxe cesiepved cihaelfl rpoM mih caJeY.lou gnw,h soeo wnS YBXEb ooSksy,t ePmrsor gam minignT urbCo ,i asn taruasleu qetlom ien.Ia mg rtaelft uoR hoda SimmonEsr,Si tncoe H,id laV anG endearneNdna ,ny O c'Donnefrolt lhr e i copyeindtgi apnrfdor oeianadgn tdoT ed Laukxi,on fgt hDeP i dnxeers. WanyeB alck twhatecse h cnairle viferowt ehrbi osko ,C hrMioskc lep or viddt eimteylnpy,gia nJdo ceRleyynn oalnBddos Mb y rdenit dh weo rd porcseisng. ThSeYB XEp epole wwohkroe odn t hsee ncdoe ditwieorVneni cent Lenoed,vee loepnmteadlir tR;oh oSdiamm oncso,ype doirCt;h rMioskc le anJdo lcyeRney nolwdosrp,dor cerssOs;oli vSihnaio mtoot,y persA;em tit e M.K nopxor,o freerHa;ed lBernnuo a,trs itJ;oF norr etsceth,cn airlee vwire; anTded L auixdn,xe e.r FinIa lnwlttay, ot hkat nhgeo opde polaetB orlIatnrnendtia onBaarld, SlievrebrPga,Wt il almisa,nN da Bno rrensi opnar itcu,f lrota hrre nifepi rod utcasn udfn algiis npuport. ....C ONTENTSA TA GLANCE.. .. � INTRODUCTION xxiii � CHAPTE1R firfsatl terStienpgs 1 � CHAPTER2 DatTa ypology 43 � CHAPTE3R ReaNlu mberasn d StraCnhgaer aders 75 � CHAPTER4 Controllitnhgef low 111 � CHAPTE5R CompleDxa tTa ypesT:a ppitnhgPe o weorf C 151 � CHAPTE6R Struduraensd U nionAsd:a ptiDnagt a Typest oY ouArp plications 189 � CHAPTE7R StoragCel assStersa:t egfioeDrsa taI ntegri2t2y7 � CHAPTE8R filIe/ Of:u llSt reamA head 257 � CHAPTE9R TheG raphTiocoslbox OpeneWdi de 291 � CHAPTE1R0 Odds&&5ods 361 � CHAPTE1R1 Debugginwgi tThu rbCo 397 � APPENDIXA ASCIIC odeC hart 425 � APPENIDXB InstallaSutmimoanr y 427 � APPENDIXCp rin)ta fn(ds can)ff (o rmats 439 � APPENDIDX ComputeMra thB asics 453 � APPENDIXE PrecedeanncdeA ssociaTtaibvliet y 465 � APPENIDXf 8088/80R8e6g istLeorws-:L eStvueffl 469 � APPENDIXGC ompleftuen dioRne ference 479 � APPENDIHX TurbCo R esourLcies t 585 � INDEX 587 TABLOEf CONTENTS � � Foreword � � xxi Introduction � � xxiii HitsoLreys ns o xxiii Scucess xxiii TurobP acsaRlul eOsK ! xxiv BuCtI Dsi effre.n.t . xxiv ThCeM ytsqiue xxiv WhyC? xxv EtneTrur ob C xxvi Jonti hEeil te xvxii CHAPTER1 :F irFsatl teStreipnsg � � 1 SorucCeo d-eExetnsion .C DriectainvIdcen ulsd Feli es 2 ObjcCte odeE-xetns.iOo)Bn 3 ExueatcbCloed eE-xetns.iXEoEn 3 ThMea ntdoaFrriysP tr ogram 4 IsnatlltaiRoemnni der 4 Exprnligo Ittenhgetr eaDde evloptmE ennvirto nmen 5 ThSem aPlrnlitE ngleadr 5 Kesy-Hota nCdo ld 6 ThMea iMne nu 10 LoiagdnY ourFr isPtr ogram 11 OtheLro iagdnO ptoins 15 Ednigat niSda nvgaiF ile 15 Driecrtyao nCdh aenD gir 16 Setti/nSgnavgti hCeo pmilLneiekrrO/ ptoins 16 RunngiH nELOL.C 19 ThReu Int self 19 HELOL.C-AntamoyL esns o 19 Commetn(s Li1n)e 20