����                            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.