VIRTUAÌ SYSTEMS      Beî Grey¬ Cedaò Milì Z-Nodå 24     Thió columî wilì bå devoteä tï thå continueä developmenô oæ CP/Í (tm© �     compatiblå operatinç systemó likå PZDOS¬ anä ZRDOÓ (tm)® Wå wilì learî �     ho÷ tï writå programó tï ruî undeò CP/Í anä ZRDOS¬ anä wilì develoð �     specifiã utilitù programó usinç standarä libraries® Somå oæ whaô wilì �     bå discusseä wilì bå "old¢ news¬ anä á fe÷ readeró maù finä iô boring® �     Stilì therå arå otheró whï neeä tï understanä thå ho÷ anä whù oæ �     operatinç systemó anä thå hardwarå wå use¬ no÷ anä iî thå future.     É decideä oî thå column'ó titlå becauså iô wilì allo÷ uó tï discusó �     botè operationaì anä theoreticaì systems® It wilì permiô uó tï develoð �     á conceptuaì systeí thaô wå wilì bå ablå tï implemenô usinç existing�     Z8° anä HD6418° anä Z28° microprocessors® Wå wilì coveò botè hardwarå �     anä softwarå design¬ and¬ establisè somå badlù needeä standards.     Whilå thió columî ió noô intendeä tï bå á tutorial¬ mucè oæ whaô wå �     wilì discusó wilì bå oæ thió nature® Understandinç directories¬ disë �     allocation¬ thå Consolå Commanä Processoò (CCP/ZCPR)¬ thå Basiã Disë �     Operatinç Systeí (BDOS/ZRDOS)¬ anä thå BIOÓ wilì alì bå includeä iî �     conceptuaì anä topicaì discussions.     Sï beforå wå begiî lookinç aô conceptuaì issues¬ let'ó takå á brieæ �     looë aô thå historù oæ computeró anä theiò operatinç systems® Thå pasô �     twentù yearó havå seeî manù spectaculaò changeó iî computinç equipment¬ �     programó anä technology.     Twentù yearó ago¬ centraì processinç unitó performeä instructionó iî �     thousandthó oæ á second® Today¬ computeró executå instructionó iî �     billionthó oæ á second® Iî á systeí likå thå IBÍ 1401¬ maiî storagå �     sizeó rangeä froí 140° tï 16,00° locationó (bytes)® Iî morå moderî �     computers¬ maiî storagå sizeó rangå froí 64Ë tï oveò 1¶ millioî bytes®     Thå datá transfeò rateó foò somå ne÷ tapå drivå modeló arå uð tï twentù �     timeó fasteò thaî earlù tapå drives® Storagå capacitieó oî ne÷ harä �     disë driveó caî ruî aó higè aó 76° millioî bytes® Thå transfeò rateó �     arå uð tï 1¶ timeó fasteò thaî earlù floppù disë drives® Improvementó �     jusô aó dramatiã havå beeî madå foò printeró anä telecommunicationó �     equipment.     Á largå amounô oæ softwarå developmenô haó accompanieä thió hardwarå �     evolution® Witè earlù computers¬ programmeró useä absolutå machinå �     language® Theù haä tï kno÷ machinå codå tï uså theså systems® Theî camå �     thå assemblers¬ compileró anä input/outpuô controì systems® Theså haä �     thå effecô oæ movinç thå programmeò fartheò froí machinå code¬ lettinç �     hií spenä morå timå solvinç applicatioî problems® Computeró stilì �     executeä programó onå aô á time® Eacè prograí waó seô uð anä ruî �     independentlù bù thå system'ó operator. Š    Thå firsô operatinç systemó enableä useró tï batcè jobó anä ruî theí iî �     á singlå stream® Jobó executeä onå aô á timå anä therå waó á smootheò �     transitioî froí joâ tï joâ witè somå assistancå froí thå operatinç �     system® Thió madå thå operator'ó job¬ anä systeí operation¬ easier® Aó �     CPÕ speedó becamå fasteò anä maiî storagå morå abundant¬ operatinç �     systemó expandeä iî scope® Theså ne÷ operatinç systemó leô useró ruî �     multiplå jobó concurrentlù ­­ multiprogramminç ­­ bù sharinç thå CPU¬ �     reaì storagå anä otheò systeí resourceó amonç activå jobs® Theù alsï �     madå possiblå teleprocessinç applicationó thaô controì remotå computinç �     anä datá entrù operationó froí onå centraì location.     Theså technicaì developmenôs havå meanô significanô benefitó foò �     computeò useró anä theiò peoplå ­­ systeí analysts¬ programmers¬ �     computeò operators¬ anä sï forth® Computeò useró caî no÷ develoð �     completå systemó foò operationaì controì anä managemenô informatioî iî �     contrasô tï thå typicaì payrolì anä billinç applicationó oæ fifteen tï �     twenty yearó ago®    Systeí resourceó arå shareä amonç severaì jobó iî multiprogramminç �     systems¬ anä amonç multiplå useró iî timå sharinç systems® Programmeró �     uså applicatioî-orienteä languageó likå COBOL¬ FORTRAN¬ anä PASCAL® Aó �     á result¬ programmeró caî devotå morå timå tï probleí solutions®     Operatinç systemó handlå mucè oæ thå joâ preparatioî anä joâ-tï-joâ �     transitioî thaô formerlù occupieä sï mucè oæ á computeò operator'ó �     time® Operatoró no÷ spenä timå directinç systeí activity¬ keepinç thå �     systeí "productive"® Thus¬ thå programmeró anä operatoró whï worë witè �     computers¬ thå scopå oæ applicatioî developed¬ anä iî general¬ computeò �     useró havå benefiteä á greaô amounô froí thå pasô developmentó iî �     hardwarå anä software.     Wå havå brieflù examineä ho÷ wå arriveä aô thå currenô modå oæ computeò �     operation® Wherå caî wå gï froí here¿ Whaô woulä youò objectiveó bå iæ �     yoõ werå designinç ne÷ featureó anä functionó foò aî operatinç system® �     Takå á momenô anä thinë abouô it® Thå followinç lisô oæ objectives¬ �     thougè theù maù bå somewhaô differenô thaî yours¬ wilì providå uó witè �     á commoî referencå point.      1® Programmeró shoulä havå thå amounô oæ maiî storagå thaô theù �               neeä foò designinç programó withouô havinç tï uså planneä �               overlaù oò dynamiã managemenô techniques® Eveî thougè thå �               sizå oæ availablå computeò maiî stragå haó increaseä �               tremendously¬ useró cuô theiò storagå intï partitionó oò �               regionó foò multiprogramminç efficiency®              Programmers¬ then¬ arå restricteä tï thå sizå oæ thå largesô �               partitioî oò regioî useä iî theiò system® Thió ofteî requireó �               breakinç á prograí uð intï separatå stepó oò usinç speciaì �               overlaù techniqueó tï makå programó "fit¢ intï á regioî oò �               partition® Alì oæ theså desigî requirementó adä overheaä tï �               solvinç á problem.      2.   Iæ á prograí ió toï largå foò maiî storagå size¬ iô ió thå �               operatinç system¬ noô thå programmer¬ thaô shoulä makå thå �               prograí "fit¢ intï maiî storage. Š      3.   Programó shoulä uså systeí resourceó ­­ especiallù maiî �               storagå ­­ onlù aó requireä durinç execution® Foò example¬ á �               prograí thaô needó 82,00° byteó oæ maiî storagå wheî fullù �               loaded¬ maù referencå onlù 22,00° byteó durinç onå parô oæ �               processing® Durinç thió time¬ therå ió nï neeä foò thå �               operatinç systeí tï commiô maiî storagå tï 60,00° �               unreferrenceä bytes® Aî examplå oæ sucè á situatioî ió á �               teleprocessinç applicatioî runninç aô lesó thaî it'ó maximuí �               load.      4.   Thå operatinç systeí shoulä noô allo÷ maiî storagå tï becomå �               fragmented® Assumå thaô severaì programó arå executing¬ eacè �               iî itó owî contiguouó areá oæ maiî storage® Threå 15Ë-bytå �               areaó iî maiî storagå arå idlå (nonå oæ thå executinç �               programó occupù theså areas)® Iæ thå smallesô prograí waitinç �               tï begiî needó 30Ë byteó oæ contiguouó maiî storage¬ iô musô �               waiô untiì 30Ë byteó oæ contiguouó maiî storagå becomeó �               available® Untiì then¬ á totaì oæ 45Ë byteó oæ maiî storagå �               arå idlå becauså oæ storagå fragmentation® Theù arå wasted.      5. Aî operatinç systeí shoulä controì systeí resourceó likå maiî �               storagå iî sucè á waù thaô yoõ automaticallù geô á �               performancå improvemenô bù addinç morå maiî storage® Foò �               example¬ iæ yoõ havå á prograí thaô musô uså overlayó becauså �               iô won'ô fiô intï maiî storage¬ addinç morå maiî storagå �               won'ô helð aô alì unlesó yoõ redesigî anä recodå thå program® �               Iô woulä bå nicå iæ thå operatinç systeí coulä someho÷ "autï-�               matically¢ overlaù programó anä "automatically¢ uså addeä �               maiî storage.      6® Á computeò useò shoulä bå independenô oæ thå sizå oæ thå maiî �               storagå iî whicè programó executå anä iî whicè thå operatinç �               systeí ió structured® Hå shoulä bå ablå tï structurå á systeí �               morå accordinç tï hió "needs¢ thaî tï thå sizå oæ maiî �               storage.      7.   Maiî storagå shoulä bå shareä dynamicallù amonç thå activå �               jobó iî thå system® Programó shoulä geô thå maiî storagå thaô �               theù neeä wheî theù neeä it® Iî otheò words¬ thå systeí �               shoulä bå adaptivå tï thå demandó oæ thå system'ó activities.      8. Schedulinç anä operatinç á systeí shoulä bå easier® Operatinç �               systemó requirå á largå amounô oæ useò participatioî tï �               schedulå jobó anä controì systeí resources® Á ne÷ systeí �               shoulä requirå lesó useò participatioî tï achievå gooä �               schedulinç anä operatioî results.     Mosô itemó iî thió lisô oæ objectiveó relatå iî somå waù tï ho÷ aî �     operatinç systeí manageó á computer'ó maiî storage® Theså objectiveó �     caî bå fulfilleä bù aî operatinç systeí thaô supportó á virtuaì �     storage® Thå techniqueó oæ virtuaì storagå anä ho÷ iô fulfilló ouò �     objectiveó wilì bå fullù dåvelopeä iî lateò columns. Š    Thå remaindeò oæ thió firsô columî wilì bå devoteä tï establishinç thå �     tooló anä fileó wå wilì bå usinç tï dï ouò developmenô iî thå future® �     Theså includå standarä librarù routines¬ assemblers¬ anä linkers®     Thå librarù routineó wå wilì bå usinç arå founä iî BUFFERS¬ SYSLIB36¬ �     VLIB11¬ anä Z3LIB13® Thå codå wilì bå writteî iî Ziloç Z8° mnemonicó �     suitablå foò assemblù witè M80¬ ZAÓ oò SLÒ Systems§ assemblers® All�     programó requirå linkinç witè L8° oò SLRNK¬ oò anù otheò compatibles.     Whaô arå theså libraries¿    Theù arå thå librarieó oæ ZCPR³ anä consisô oæ SYSLI (SYSteí LIBrarù ­ �     noî-ZCPR³  specific)¬ VLI (Videï LIBrarù ­ screeî orienteä  routines)¬ �     anä  Z3LI (ZCPR³ specifiã routines)® BUFFERÓ ió anotheò collectioî  oæ �     routineó  (noî-ZCPR³ specific© tï managå maiî storage® Theså  librarieó �     arå  intendeä tï relievå thå programmeò oæ thå tasë oæ frequentlù  "rå-�     inventinç thå wheel¢ anä tï providå hií witè aî environmenô oæ reliablå �     tooló whicè encourageó structureä programminç aô thå assemblù  languagå �     level.     Eacè routinå iî thå librarieó caî bå vieweä aó á reliablå "blacë box.¢ �     Mosô oæ thå routineó wilì bå completelù documenteä withiî thió columî �     anä thå helð files¬ anä thå programmeò wilì bå consistentlù provideä �     witè thå followinç information:      1® Namå oæ subroutine      2® Functioî iô performs      3® Whaô itó inputó are      4® Whaô itó outputó are      5® Whaô registeró arå affecteä bù it      6® Whaô otheò librarù routineó iô calló upon      7® Whaô erroró caî occuò anä ho÷ iô handleó them.     Thå routineó arå designeä tï worë togetheò anä complemenô eacè other® �     Parameteò passinç ió consistenô betweeî thå variouó subroutines® Foò �     instance¬ alì routineó whicè neeä tï bå passeä á pointeò tï á Filå �     Controì Blocë arå passeä thaô pointeò iî thå DÅ registeò pair® Aó á �     generaì rule¬ iæ á registeò ió noô returneä aó aî outpuô froí thå �     routine¬ theî itó valuå ió noô affecteä (iô haó thå samå valuå wheî thå �     routinå ió exiteä aó iô haä wheî thå routinå waó called).     Thå librarieó arå relocatablå objecô moduleó createä iî thå MicroSofô �     M8° relocatablå objecô format® Thå M80¬ SLÒ oò ZAÓ assembleró caî bå �     useä tï creatå anä minipulatå relocatablå objecô modules® Alì routineó �     arå groupeä withiî functionallù-relateä modules® Oncå á routinå ió �     referenceä (bù thå EXÔ statement)¬ itó modulå ió loadeä anä iô ió �     availablå tï thå programmeò bù meanó oæ á simplå subroutinå call® Alì �     otheò subroutineó withiî thaô particulaò modulå arå alsï loaded¬ buô �     theù arå noô availablå tï thå programmeò unlesó hå haó alsï referenceä �     theí bù EXÔ statements® Thå modulå ió loadeä onlù once¬ regardlesó oæ �     ho÷ manù routineó withiî thå modulå arå referenced® Foò thió reason¬ �     eacè modulå waó designeä tï contaiî routineó whicè arå frequentlù useä �     togetheò oò arå calleä bù eacè otheò (onå routinå withiî thå modulå �     calló anotheò routinå withiî thå module). Š    Whaô ió needeä tï uså thå libraries?     Yoõ neeä aî 8080¬ Z80¬ NSC800¬ oò HD6418°-baseä microcomputeò witè aô �     leasô 48Ë byteó oæ contiguouó memorù runninç ZCPR³ oò Ú-Systeí (ZCPR³ �     anä ZRDOS)¬ thå Microsofô M8° assembeò tooì seô (specificallù M8° anä �     thå L8° Linker)¬ thå Echelon ZAÓ tooì seô (specificallù ZAÓ assembleò �     anä ZLINË linker© oò thå SLÒ tooló seô (specificallù SLRASÍ anä SLRNK© �     oò thå SLÒ virtuaì tooì seô (SLR180« anä SLRNK+)¬ anä thå usuaì seô oæ �     softwarå developmenô tooló (aî editor¬ and¬ preferably¬ á debugger© tï �     uså thå libraries.     Whaô dï thå librarieó buù you?     Tï thå experienceä programmer¬ thå librarieó havå thå potentiaì oæ �     beinç á significanô tooì whicè enableó hií to:      1.   Solvå hió programminç tasë quickly               ­­ becauså hå spendó lesó timå writinç commonlù-useä �               subroutineó anä worryinç abouô ho÷ hió registeró arå affecteä �               bù theså subroutineó anä morå timå concentratinç oî thå �               probleí aô hand.      2.   Writå space­ anä speed-efficienô code               ­­ becauså alì oæ thå routineó havå beeî gonå oveò timå anä �               timå agaiî tï reducå theiò sizå anä makå theí morå efficienô �               iî termó oæ speed® Foò example¬ thå SORÔ routinå ió á Shelì �               Sorô thaô caî bå calleä tï perforí thå sorô usinç pointeró �               (iî whicè caså iô exchangeó pointeró ratheò thaî recordó wheî �               iô neeä tï dï á swap© oò perforí thå sorô withouô usinç �               pointeòs (wheî spacå ió á factoò anä therå maù noô bå enougè �               rooí foò á pointeò table).      3® Writå morå maintainablå code               ­­ becauså thå librarieó arå designeä witè structureä �               programminç philosophù iî mind® Eacè subroutineó ió �               equivalenô tï á procesó box¬ havinç (1© onlù onå entrancå anä �               onå exit¬ (2© á preciselù-defineä function¬ anä (3© á �               preciselù-defineä seô oæ inpuô anä outpuô parameters® Havinç �               useä thå librarieó foò somå timå now¬ thå authoò haó noteä �               thaô hió programminç thoughô processeó anä prograí designó �               havå tendeä morå anä morå towarä "enä-in¢ (toð-dowî froí thå �               objectivå poinô oæ vie÷ anä bottoí-uð froí thå librarù �               subroutinå poinô oæ view)¬ structureä designó thaô hå caî gï �               bacë tï aô á lateò datå anä readilù decipheò anä modify.      4.   Reducå thå programminç effort               ­­ becauså thå librarieó providå á numbeò oæ verù involveä �               routineó whicè would¬ iî themselves¬ takå quitå somå timå tï �               code® Foò example¬ thå DIRÆ routineó wilì loaä thå directorù �               oæ á disë intï memory¬ selecô á seô oæ fileó froí thaô loadeä �               directorù aó specified bù á Filå Controì Blocë (FCB© anä á �               flaç whicè indicateó whetheò tï includå Systeí oò Noî-Systeí �               fileó anä whaô useò areá ió tï bå examined¬ packó thå loadeä �               directorù (removinç entrieó noô selecteä froí thå memorù �               buffer)¬ alphabetizeó thå directorù entrieó bù filå namå anä �Š              typå oò bù filå typå anä name¬ anä returnó á pointeò tï thå �               firsô entrù anä á counô oæ thå nubmeò oæ entrieó selected.     Iî manù ways¬ thå librarieó brinç advantageó oæ programminç iî á Higè-�     Ordeò Language¬ likå à oò Pascal¬ tï thå assemblù languagå programmer® �     Theù allo÷ hií tï maintaiî thå smalleò codå sizå anä greateò efficiency�     whicè caî bå realizeä iî assemblù languagå programming¬ anä �     simultaneously¬ realizå á reduceä lifå-cyclå cosô (froí developmenô tï �     fieldinç tï posô-fieldinç maintenancå anä modification© oveò assemblù �     languagå programminç withouô á similaò toïì set.     Ho÷ tï learî tï uså thå librarieó effectively?     Thió ió opinion¬ oæ course¬ buô É feeì thaô thå besô waù tï learî ho÷ �     tï uså thå librarieó woulä involvå thå followinç steps:      1.   Studù theså columî articleó iî aî overvie÷ fashion¬ �               familiarize yourselæ witè thå functionó oæ thå subroutineó �               available.      2. Study iî somå detail¬ thå samplå sourcå programs¬ jumpinç �               bacë tï theså articleó froí timå tï time¬ tï seå whù anä thå �               waù É useä thå routines®      3. Trù codinç á couplå oæ routineó froí thió column¬ copyinç �               theí verbatií anä assemblinç them.      4® Trù makinç uð á fe÷ simplå problemó oæ youò owî anä uså thå �               librarieó tï codå them.      5.   Applù thå librarieó tï á significanô prograí yoõ wanô tï �               write.     É aí á stronç advocatå oæ writinç programó iî ordeò tï learî ho÷ tï �     program¬ anä É feeì thaô iô ió mosô importanô tï (1© gaiî aó mucè �     familiaritù witè thå routineó aó yoõ caî anä (2© tï writå programó �     usinç theså routines.