home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
Z280
/
232APR88.GZG
/
232APR88.GBG
Wrap
Text File
|
2000-06-30
|
25KB
|
526 lines
áááá VIRTUA╠ SYSTEMS
áááá Beε Grey¼ Ceda≥ Mil∞ Z-Nodσ 24
ááááIε thi≤ month'≤ articlσ wσ arσ goinτ t∩ examinσ thσ dynamic≤ oµ memor∙ ì
áááámanagemen⌠ a≤ i⌠ caε bσ applieΣ t∩ writinτ program≤ fo≥ CP/═ anΣ ZCPR« ì
ááááIε m∙ firs⌠ article¼ wσ briefl∙ toucheΣ oε thσ limitation≤ placeΣ oε ì
ááááprogram≤ becausσ oµ memor∙ sizσ restrictions« Wσ founΣ tha⌠ system≤ ì
ááááwitΦ ß fixeΣ memory¼ let'≤ sa∙ 64K¼ requirσ largσ program≤ t∩ bσ ì
áááásegmented¼ o≥ "overlayedó iµ the∙ arσ t∩ fi⌠ iε thσ availablσ memory« ì
ááááThi≤ ha≤ thσ effec⌠ oµ creatinτ morσ worδ fo≥ thσ programmer« Hσ mus⌠ ì
áááábσ awarσ no⌠ onl∙ oµ thσ program'≤ functionality¼ bu⌠ mus⌠ als∩ bσ ì
ááááconcerneΣ witΦ "fittingó i⌠ int∩ availablσ memory.
ááááTraditionally¼ programmer≤ fo≥ singlσ-user¼ noε-multitaskinτ systems¼ ì
ááááhavσ tendeΣ t∩ assumσ tha⌠ al∞ oµ thσ memor∙ froφ thσ enΣ oµ thσ ì
ááááprograφ codσ t∩ thσ Basiπ Disδ Operatinτ Systeφ (BDOS⌐ wa≤ availablσ t∩ ì
ááááusσ a≤ desired« Thi≤ meant¼ iε reality¼ thσ applicatioε program≤ coulΣ ì
áááá"ove≥-writeó thσ Consolσ CommanΣ Processo≥ (CCP⌐ iε orde≥ t∩ gaiε thσ ì
ááááextrß 2╦ i⌠ occupies.
ááááToday¼ however¼ wσ arσ concerneΣ witΦ maximizinτ thσ programmer'≤ ì
ááááefficienc∙ t∩ solvσ thσ probleφ a⌠ hand¼ anΣ t∩ minimizσ thσ "overheadó ì
ááááhσ mus⌠ encounte≥ t∩ producσ ß workinτ application« Iε othe≥ words¼ wσ ì
ááááwisΦ t∩ allo≈ hiφ t∩ writσ program≤ tha⌠ wil∞ worδ iε ß minimuφ memor∙ ì
áááásize¼ witΦ ver∙ littlσ regarΣ fo≥ managinτ thσ availablσ memor∙ space.
ááááWha⌠ technique≤ arσ available┐ Ho≈ d∩ wσ implemen⌠ them┐ Wh∙ arσ thesσ ì
áááámethod≤ s∩ importan⌠ iε thσ ╕-bi⌠ world┐ Wh∙ can'⌠ wσ g∩ on¼ "will∙-ì
áááánillyó thσ wa∙ wσ havσ donσ fo≥ thσ pas⌠ 1╡ years?
ááááThσ answer≤ t∩ thesσ question≤ arσ no⌠ obvious¼ bu⌠ wσ arσ al∞ ì
áááápainfull∙ awarσ oµ thσ implications« LimiteΣ memor∙ spacσ mean≤ ì
áááárestrictinτ thσ applicatioε program≤ t∩ ruε iε thσ availablσ memor∙ ì
ááááspace« A≤ ß result¼ wσ ofteε compromisσ thσ functionalit∙ oµ aε ì
ááááapplicatioε t∩ conservσ space« Yet¼ wσ wan⌠ thσ prograφ t∩ bσ ì
ááááoperationa∞ oε thσ broades⌠ cros≤-sectioε oµ ╕-bi⌠ CP/═ machine≤ witΦ ì
ááááa≤ mucΦ functionalit∙ a≤ i≤ possible.
ááááBeforσ wσ caε reall∙ conside≥ "howó t∩ d∩ thesσ things¼ wσ mus⌠ firs⌠ ì
áááálooδ a⌠ thσ wa∙ standarΣ CP/═ system≤ currentl∙ "loaΣ anΣ executeó thσ ì
ááááprogram≤ wσ run« AnΣ iε orde≥ t∩ reall∙ looδ a⌠ thi≤ problem¼ wσ reall∙ ì
ááááneeΣ t∩ kno≈ wha⌠ thσ "memor∙ imageó normall∙ look≤ like.
áááá[Therσ arσ severa∞ system≤ tha⌠ d∩ no⌠ adherσ t∩ thσ "generaló rule≤ ╔ ì
ááááwil∞ discuss¼ notabl∙ somσ oµ thσ earl∙ Northsta≥ Systems« However¼ iµ ì
ááááyo⌡ havσ onσ oµ thesσ earl∙ systems¼ yo⌡ alread∙ kno≈ thσ differences.]
ááááMemor∙ iε ╕-bi⌠ computer≤ generall∙ begin≤ a⌠ addres≤ 0000╚ (thσ ╚ ì
áááástand≤ fo≥ hexadecima∞ o≥ basσ 16⌐ anΣ goe≤ t∩ addres≤ FFFFH« Iµ thi≤ ì
ááááhexadecima∞ numbe≥ i≤ converteΣ t∩ it'≤ decima∞ equivalent¼ wσ finΣ ì
áááátha⌠ i⌠ i≤ equa∞ t∩ 65,53╡ o≥ 64╦ (1╦ iε computeresσ ╜ 102┤ bytes).è
ááááIε man∙ curren⌠ systems¼ thσ operatinτ systeφ (OS⌐ build≤ froφ thσ to≡ ì
áááá(FFFFH⌐ dowε towarΣ thσ bottoφ (0000H)« Thσ memor∙ i≤ consecutive¼ o≥ ì
áááásequential¼ o≥ contiguous« Tha⌠ is¼ therσ arσ n∩ gap≤ iε i⌠ froφ thσ ì
áááálowes⌠ bytσ t∩ thσ highes⌠ byte.
ááááMoreover¼ man∙ oµ thσ O╙ segment≤ arσ ß fixeΣ size« Fo≥ example¼ iε thσ ì
áááámos⌠ commoε implementation¼ thσ CC╨ requre≤ ╕ 25╢-bytσ pages¼ o≥ 204╕ ì
áááábytes« Thσ BDOS¼ require≤ 1┤ 25╢-bytσ pages¼ o≥ 3584 bytes« Thσ BIOS¼ ì
ááááoε thσ othe≥ hand¼ ha≤ ß "variableó size¼ anΣ generall∙ run≤ abou⌠ 409╢ ì
áááábytes¼ anΣ disδ buffer≤ perhap≤ a≤ mucΦ a≤ 204╕ bytes« Therσ i≤ onσ ì
áááámorσ area iε memory¼ Pagσ 0¼ tha⌠ i≤ reserveΣ fo≥ "communication≤"ì
áááábetweeε thσ O╙ anΣ applicatioε program¼ i⌠ i≤ fixeΣ a⌠ 25╢ bytes.
ááááFo≥ purpose≤ oµ discussinτ thσ CP/═ (ZRDOS⌐ OS¼ i⌠ i≤ generall∙ easie≥ ì
áááát∩ thinδ oµ memor∙ froφ to≡ t∩ bottom¼ whilσ fo≥ applications¼ wσ wan⌠ ì
áááát∩ conside≥ memor∙ froφ thσ bottoφ t∩ thσ top...
ááááBaseΣ oε thσ previou≤ discussion¼ then¼ wσ finΣ ß "typicaló memor∙ ì
ááááimagσ t∩ looδ somethinτ likσ thσ following:
áááá FFF╞ +-----------------------------+
áááá ⁿ |
áááá ⁿ Disδ Buffer≤ ⁿ 204╕ ¿ 2.0k)
áááá ⁿ |
áááá F800 +-----------------------------+
áááá ⁿ |
áááá ⁿ BIO╙ ⁿ 409╢ ¿ 4.0k)
áááá ⁿ |
áááá E80░ +-----------------------------+
áááá ⁿ |
áááá ⁿ BDO╙ ⁿ 358┤ ¿ 3.5k)
áááá ⁿ |
áááá DA0░ +-----------------------------+
áááá ⁿ |
áááá ⁿ CC╨ ⁿ 204╕ ¿ 2.0k)
áááá ⁿ |
áááá D20░ +-----------------------------+
áááá ⁿ |
áááá | TP┴ ⁿ ■ 5340╡ (52.5K)
áááá ⁿ |
áááá 010░ +-----------------------------+
áááá ⁿ |
áááá ⁿ Pagσ ░ ⁿ 25╢ (0.25k)
áááá ⁿ |
áááá 000░ +-----------------------------+
ááááBea≥ iε mind¼ however¼ thi≤ i≤ ß "theoreticaló systeφ layout¼ anΣ i≤ ì
ááááNO╘ indicativσ oµ thσ systeφ yo⌡ ma∙ bσ using« I⌠ i≤ provideΣ merel∙ ì
ááááfo≥ purpose≤ oµ discussion« Wσ wil∞ develo≡ aε imagσ tha⌠ wil∞ matcΦ ì
ááááyou≥ owε systeφ nex⌠ month« TP┴ stand≤ fo≥ Transien⌠ Prograφ Areß anΣ ì
áááái≤ thσ areß iε memor∙ wherσ applicatioε program≤ load.è
ááááBeforσ wσ caε reall∙ begiε ou≥ project¼ wσ neeΣ t∩ kno≈ jus⌠ ß littlσ ì
áááámorσ abou⌠ thσ pagσ ░ anΣ wha⌠ i⌠ contains« Rathe≥ thaε presen⌠ i⌠ iε ì
áááágraphiπ form¼ I'φ goinτ t∩ illustratσ i⌠ witΦ assemble≥ statement≤ s∩ ì
ááááwσ caε usσ thi≤ informatioε iε writinτ futurσ programs.
áááá╔ d∩ no⌠ intenΣ t∩ explaiε thσ rudiment≤ oµ assemble≥ languagσ syntax¼ ì
ááááyo⌡ shoulΣ stud∙ you≥ manual≤ anΣ yo⌡ shoulΣ fee∞ freσ t∩ contac⌠ mσ ì
ááááwheε yo⌡ havσ questions« ╔ woulΣ prefe≥ yo⌡ d∩ thi≤ b∙ callinτ Ceda≥ ì
ááááMil∞ Z-Nodσ 2┤ [503▌ 644-462▒ anΣ leavinτ ß messagσ t∩ AL╠ USERS.....
áááá[Note║ thσ followinτ codσ examplσ wa≤ produceΣ usinτ WordSta≥ (tm⌐ anΣ ì
ááááshoulΣ no⌠ bσ "extractedó froφ thσ articlσ t∩ assemble« Instead¼ ß ì
ááááseparatσ filσ calleΣ PAGE0.MA├ (o≥ .Z80⌐ wil∞ bσ provideΣ t∩ assemble.]
áááá TITL┼ 'PAG┼ ░ Definition≤ ¡ CP/═ Compute≥ Systems'
áááá╗ Prograφ -------------¡ ╗ Note║ UndefineΣ a⌠ moment
áááá╗ Segmen⌠ Pagσ 0
áááá╗ Autho≥ Beε Grey
áááá╗ Languagσ Z8░ Assembler
áááá╗ Datσ 0┤ AP╥ 88
áááá╗ Previou≤ None
áááá╗ Conditiona∞ Definitions
ááááN╧ EQ╒ 000░ ╗ Definσ NO
ááááYE╙ EQ╒ no⌠ N╧ ╗ Definσ YES
áááá╗ Assemble≥ Definition
ááááM8░ EQ╒ N╧ ╗ MicroSoft
ááááSL╥ EQ╒ ye≤ ╗ SL╥ Systems
ááááZA╙ EQ╒ N╧ ╗ Echelon
áááá╗ Versioε Levels¼ Date
ááááVERS╬ EQ╒ 0░ ╗ Versioε Number
ááááREVS╬ EQ╒ 0░ ╗ Revisioε Level
ááááVMNT╚ EQ╒ 0┤ ╗ Versioε Month
ááááVDAT┼ EQ╒ 0┤ ╗ Versioε Date
ááááVYEA╥ EQ╒ 8╕ ╗ Versioε Year
áááá╗ Operatinτ Systeφ Definitions
ááááCPM2▓ EQ╒ N╧ ╗ CP/═ Versioε 2.2
ááááCPM3░ EQ╒ N╧ ╗ CP/═ Versioε 3.░ (CP/M+)
ááááZCPR│ EQ╒ ye≤ ╗ Usinτ ZCP╥ 3.x
ááááZRDO╙ EQ╒ ye≤ ╗ Usinτ ZRDO╙ 1.x
ááááBAS┼ EQ╒ 000░ ╗ Basσ oµ Memory
ááááCC╨ EQ╒ BASE+0D200╚ ╗ Basσ oµ CCP
ááááBDO╙ EQ╒ CCP+0800╚ ╗ Basσ oµ BDOS
ááááBIO╙ EQ╒ BDOS+0E00╚ ╗ Basσ oµ BIOSè
áááá╗ Star⌠ oµ Pagσ 0
áááá iµ M8░
áááá .Z80
áááá ASEG
áááá OR╟ 0000
áááá endif
ááááRST░ EQ╒ ñ ╗ Restar⌠ Vecto≥ 0
ááááWBOOT║ J╨ BIOS+│ ╗ Warφ Boo⌠ Entry
ááááIOBTYE║ D┬ 0░ ╗ Input/Outpu⌠ Byte
ááááUSRDSK║ D┬ 0░ ╗ M╙ Nybblσ ╜ User¼ L╙ Nybblσ ╜ Disk
ááááBDOSV║ J╨ BDOS+╢ ╗ BDO╙ Functioε Call
ááááRST1║ D╙ ╕ ╗ Restar⌠ Vecto≥ 1
ááááRST2║ D╙ ╕ ╗ Restar⌠ Vecto≥ 2
ááááRST3║ D╙ ╕ ╗ Restar⌠ Vecto≥ 3
ááááRST4║ D╙ ╕ ╗ Restar⌠ Vecto≥ 4
ááááRST5║ D╙ ╕ ╗ Restar⌠ Vecto≥ 5
ááááRST6║ D╙ ╕ ╗ Restar⌠ Vecto≥ 6
ááááRST7║ D╙ ╕ ╗ Restar⌠ Vecto≥ ╖ (Debuτ Utilities)
áááá D╙ 1╢ ╗ 004░ ¡ 004F
áááá D╙ 1▒ ╗ 005░ ¡ 005B
ááááFCB1║ D╙ 1╢ ╗ Defaul⌠ FC┬ 1
ááááFCB2║ D╙ 1╢ ╗ Defaul⌠ FC┬ 2
áááá D╙ 0┤ ╗ 007├ ¡ 007F
ááááDMABFR║ D╙ 12╕ ╗ 008░ ¡ 00FF
áááá END
ááááThi≤ examplσ oµ codσ actuall∙ generate≤ ß Pagσ 0« Thi≤ i≤ NO╘ somethinτ ì
ááááwσ normall∙ neeΣ t∩ d∩ fo≥ ourselves¼ sincσ thσ O╙ wil∞ alway≤ insurσ ì
ááááthσ correc⌠ value≤ arσ storeΣ iε thi≤ area« I⌠ i≤ fo≥ illustratioε onl∙ ì
ááááanΣ i≤ intendeΣ t∩ bσ ß littlσ introductioε a≤ t∩ stylσ anΣ form« Mos⌠ ì
ááááoµ i⌠ i≤ selµ explanatory¼ anΣ ╔ wil∞ minimizσ m∙ descriptioε oµ it.
ááááIε general¼ al∞ program≤ wσ writσ wil∞ begiε thσ samσ way║ ß TITL┼ anΣ ì
ááááß brieµ fe≈ line≤ oµ wha⌠ thσ program'≤ namσ is¼ wh∩ wrotσ it¼ wha⌠ thσ ì
áááálanguagσ useΣ is¼ thσ datσ anΣ somσ commen⌠ abou⌠ previuo≤ versions« Iµ ì
áááádesired¼ ß fe≈ (ver∙ few⌐ line≤ caε bσ addeΣ t∩ addres≤ it≤ function:
áááá╗ Prograφ
áááá╗ Segmen⌠ Pagσ 0
áááá╗ Autho≥ Beε Grey
áááá╗ Languagσ Z8░ Assembler
áááá╗ Datσ 0┤ AP╥ 88
áááá╗ Previou≤ None
èáááá╗ Functioε Thi≤ i≤ ß codσ segmen⌠ t∩ illustratσ thσ content≤ of
áááá╗ thσ CP/═ Pagσ 0« I⌠ i≤ "neveró compileΣ iε rea∞ life.
ááááEveε experienceΣ programmer≤ takσ timσ t∩ creatσ thσ abovσ sectioε iε ì
ááááEVER┘ prograφ the∙ write« Thinδ abou⌠ it..« WoulΣ yo⌡ remembe≥ al∞ oµ ì
ááááthσ stufµ fivσ o≥ eveε teε year≤ froφ now┐ Probabl∙ not¼ anΣ thi≤ bi⌠ ì
ááááoµ documentatioε serve≤ t∩ inforφ thσ reader¼ a≤ wel∞ a≤ refresΦ ou≥ ì
ááááowε memorie≤ iε thσ future« I⌠ i≤ ß gooΣ programminτ practice« D∩ it!
ááááThσ nex⌠ tw∩ statement≤ arσ directive≤ t∩ thσ assembler¼ defininτ tw∩ ì
áááácommonl∙ useΣ values¼ YE╙ anΣ NO« Wσ coulΣ havσ defineΣ O╬ anΣ OF╞ o≥ ì
ááááeveε TRU┼ anΣ FALS┼ iε thσ samσ way.
áááá╗ Conditiona∞ Definitions
ááááN╧ EQ╒ 000░ ╗ Definσ NO
ááááYE╙ EQ╒ no⌠ N╧ ╗ Definσ YES
ááááOF╞ EQ╒ 000░ ╗ Definσ OFF
ááááO╬ EQ╒ no⌠ OF╞ ╗ Definσ ON
ááááO≥ wσ coulΣ d∩ somethinτ likσ this:
ááááTRU┼ EQ╒ YE╙ ╗ Definσ TRUE
ááááFALS┼ EQ╒ N╧ ╗ Definσ FALSE
ááááThesσ statement≤ wil∞ permi⌠ u≤ t∩ conditionall∙ selec⌠ certaiε option≤ ì
ááááiε thσ prograφ a⌠ late≥ points«
ááááThσ followinτ threσ statement≤ definσ whicΦ assemble≥ wσ wil∞ usσ wheε ì
ááááwσ pu⌠ thσ prograφ together« Onl∙ ON┼ oµ thσ option≤ shoulΣ bσ YES¼ thσ ì
ááááres⌠ shoulΣ bσ NO« Already¼ wσ arσ usinτ thσ conditional≤ wσ defineΣ iε ì
ááááthσ las⌠ fe≈ line≤ oµ code« Wh∙ d∩ this┐ Wel∞ becausσ i⌠ i≤ importan⌠ ì
ááááfo≥ other≤ t∩ kno≈ "howó yo⌡ assembleΣ thσ program¼ anΣ wha⌠ assemble≥ ì
ááááyo⌡ used« No⌠ al∞ assembler≤ arσ createΣ equal!
áááá╗ Assemble≥ Definition
ááááM8░ EQ╒ N╧ ╗ MicroSoft
ááááSL╥ EQ╒ ye≤ ╗ SL╥ Systems
ááááZA╙ EQ╒ N╧ ╗ Echelon
ááááIε thi≤ case¼ ╔ usσd onσ oµ thσ SL╥ Systemsº assemblers¼ SLR180+¼ ß ì
áááávirtua∞ memor∙ assembler« Al∞ SL╥ assembler≤ usσ thσ samσ syntax« Iµ ì
ááááyo⌡ arσ usinτ M80¼ theε yo⌡ woulΣ se⌠ M8░ EQ╒ yes¼ anΣ SL╥ EQ╒ NO« Thσ ì
áááásamσ rule≤ prevai∞ iε thσ casσ oµ thσ las⌠ equatσ fo≥ ZAS¼ thσ Echeloε ì
ááááInc.¼ product« Therσ coulΣ bσ other≤ addeΣ t∩ thσ lis⌠ a≤ well¼ bu⌠ fo≥ ì
ááááou≥ purposes¼ thesσ arσ thσ onl∙ threσ assembler≤ tha⌠ wil∞ concerε us.
ááááRecal∞ m∙ discussinτ versioε anΣ revisioε level≤ a≤ ß par⌠ oµ thσ filσ ì
ááááname┐ Wel∞ insidσ thσ prograφ i⌠ i≤ necessar∙ t∩ identif∙ thσ samσ tw∩ ì
áááávalues« Iε addition¼ I'vσ includeΣ thσ Versioε Datσ s∩ wσ caε tel∞ wheε ì
ááááwσ las⌠ modifieΣ thσ program« Yo⌡ shoulΣ ge⌠ iε thσ habi⌠ oµ updatinτ ì
ááááthesσ value≤ EVER┘ timσ yo⌡ edi⌠ thσ program« Iµ desired¼ thσ timσ may
ááááals∩ bσ added¼ alth∩ no⌠ required:è
áááá╗ Versioε Levels¼ Date¼ Time
ááááVERS╬ EQ╒ 0░ ╗ Versioε Number
ááááREVS╬ EQ╒ 0░ ╗ Revisioε Level
ááááVMNT╚ EQ╒ 0┤ ╗ Versioε Month
ááááVDAT┼ EQ╒ 0┤ ╗ Versioε Date
ááááVYEA╥ EQ╒ 8╕ ╗ Versioε Year
ááááVHOU╥ EQ╒ 0╖ ╗ Versioε Hour
ááááVMIN╙ EQ╒ 0░ ╗ Versioε Minutes
ááááVSEC╙ EQ╒ 0░ ╗ Versioε Seconds
ááááSincσ wσ wil∞ bσ writinτ program≤ t∩ ruε unde≥ botΦ CP/═ anΣ ZRDOS¼ anΣ ì
ááááwil∞ probabl∙ bσ usinτ botΦ thσ standarΣ CC╨ anΣ ZCPR¼ wσ shoulΣ definσ ì
ááááthesσ value≤ also« Thi≤ i≤ ß furthe≥ aiΣ t∩ documentation« A⌠ thi≤ ì
áááápoint¼ i⌠ i≤ no⌠ significant¼ bu⌠ late≥ i⌠ wil∞ becomσ quitσ important.
ááááCPM2▓ EQ╒ N╧ ╗ CP/═ Versioε 2.2
ááááCPM3░ EQ╒ N╧ ╗ CP/═ Versioε 3.░ (CP/M+)
ááááZCPR│ EQ╒ ye≤ ╗ Usinτ ZCP╥ 3.x
ááááZRDO╙ EQ╒ ye≤ ╗ Usinτ ZRDO╙ 1.x
ááááThσ nex⌠ se⌠ oµ equate≤ definσ somσ oµ thσ importan⌠ anΣ ofteε useΣ ì
ááááaddresse≤ iε ou≥ systems:
ááááBAS┼ EQ╒ 000░ ╗ Basσ oµ Memory
ááááCC╨ EQ╒ BASE+0D200╚ ╗ Basσ oµ CCP
ááááBDO╙ EQ╒ CCP+0800╚ ╗ Basσ oµ BDOS
ááááBIO╙ EQ╒ BDOS+0E00╚ ╗ Basσ oµ BIOS
ááááBAS┼ define≤ thσ "bottomó o≥ "beginningó oµ memory« Noticσ tha⌠ thσ CC╨ ì
ááááequatσ i≤ defineΣ a≤ thσ BASE+0D200H« Thi≤ i≤ donσ s∩ tha⌠ thσ prograφ ì
áááácaε kno≈ no⌠ onl∙ wherσ thσ CC╨ i≤ located¼ bu⌠ als∩ t∩ kee≡ thσ ì
áááá"symboló CC╨ ß relocatablσ item« (I'l∞ discus≤ relocatabilit∙ later.⌐
ááááLikewise¼ thσ BDO╙ addres≤ i≤ aε "offsetó oµ fixeΣ valuσ froφ thσ CCP¼ ì
ááááanΣ sincσ wσ kno≈ thσ CC╨ i≤ 204╕ bytes¼ o≥ 8*256¼ (notσ tha⌠ 25╢ iε ì
ááááhex i≤ 100⌐ s∩ wσ adΣ 8*10░ (0800H⌐ t∩ thσ CC╨ beginninτ address¼ t∩ ì
ááááfinΣ thσ beginninτ oµ thσ BDOS« Wσ als∩ kno≈ tha⌠ thσ BDO╙ i≤ 1┤ 25╢-ì
áááábytσ page≤ (1┤ iε hex i≤ 0E¼ s∩ 0E*10░ ╜ 0E00H).
ááááIµ wσ als∩ wisheΣ t∩ includσ thσ usua∞ 2╦ oµ buffe≥ spacσ generall∙ ì
ááááfounΣ afte≥ thσ BIOS¼ wσ coulΣ adΣ onσ morσ equatσ ..« however¼ wσ ì
ááááwoulΣ havσ t∩ kno≈ EXACTL┘ ho≈ biτ thσ BIO╙ is¼ anΣ rounΣ i⌠ u≡ t∩ thσ ì
áááánex⌠ eveε 1╦ boundary« Wσ havσ assumeΣ ß 4╦ BIO╙ s∩ wσ woulΣ have:
ááááBAS┼ EQ╒ 000░ ╗ Basσ oµ Memory
ááááCC╨ EQ╒ BASE+0D200╚ ╗ Basσ oµ CCP
ááááBDO╙ EQ╒ CCP+0800╚ ╗ Basσ oµ BDOS
ááááBIO╙ EQ╒ BDOS+0E00╚ ╗ Basσ oµ BIOS
ááááEPRO═ EQ╒ BIOS+1000╚ ╗ Basσ oµ EPRO═ o≥ Buffers
áááá[Note║ iµ 2╦ ╜ 8*256¼ theε 4╦ ╜ 16*256¼ thu≤ 10*10░ ╜ 1000H.)è
ááááConfused┐ ╔ hopσ not« Hexadecima∞ arithmetiπ i≤ discusseΣ iε nearl∙ ì
ááááever∙ compute≥ textbooδ ╔ havσ eve≥ seen« Remember¼ wheε dealinτ witΦ ì
áááácomputers¼ the∙ "thinkó iε basσ 1╢ (hexadecimal)¼ no⌠ basσ 1░ (decimal⌐ ì
áááálikσ wσ do« S∩ yo⌡ ask¼ wh∙ couldn'⌠ wσ usσ decima∞ number≤ t∩ definσ ì
ááááthesσ values┐ Thσ answe≥ i≤ wσ could¼ bu⌠ sincσ wσ arσ talkinτ abou⌠ ì
ááááthσ rea∞ hardware¼ anΣ wil∞ bσ concerneΣ abou⌠ "rea∞ memoryó addresses¼ ì
áááái⌠ i≤ morσ appropriatσ t∩ worδ iε hexadecima∞ values« Afte≥ all¼ thσ ì
ááááoutpu⌠ oµ thσ assembler≤ alway≤ provide≤ u≤ witΦ thσ he° value≤ iε thσ ì
áááálistinτ (NEVE╥ thσ decima∞ ones)...
ááááThσ nex⌠ fe≈ statement≤ arσ significan⌠ iµ yo⌡ arσ usinτ M8░ a≤ thσ ì
ááááassembler« The∙ arσ NO╘ requireΣ fo≥ SL╥ o≥ ZA╙ anΣ thereforσ wσ wan⌠ ì
áááát∩ makσ theφ "conditionaló oε thσ assemble≥ wσ arσ using« Tha⌠ is¼ iµ ì
ááááwσ arσ usinτ M80¼ theε thesσ statement≤ wil∞ bσ used¼ iµ wσ arσ not¼ ì
ááááthe∙ wil∞ no⌠ bσ used« Pleasσ notσ thσ style¼ thσ conditiona∞ "ifó i≤ ì
ááááoffse⌠ onσ column¼ anΣ i≤ iε "lowe≥ case"..« Thi≤ make≤ i⌠ eas∙ t∩ finΣ ì
ááááiε ß largσ listinτ (ditt∩ fo≥ thσ "endif").
áááá iµ M8░
áááá .Z80
áááá ASEG
áááá OR╟ 0000
áááá endif
ááááIε thσ casσ oµ M80¼ whicΦ caε assemblσ botΦ 808░ Inte∞ anΣ Z8░ Ziloτ ì
áááámnemonics¼ wσ neeΣ t∩ inforφ i⌠ whicΦ se⌠ oµ mnemonic≤ wσ arσ using« Iε ì
ááááou≥ case¼ wσ wil∞ ALWAY╙ usσ thσ Ziloτ codes« (Thσ .Z8░ directive)
áááThσ ASE╟ statemen⌠ tell≤ M8░ tha⌠ thi≤ i≤ aε "absoluteó segment« I⌠ i≤ ì
ááááno⌠ requireΣ b∙ thσ othe≥ tw∩ assemblers«
ááááThσ OR╟ statemen⌠ tell≤ M8░ wherσ iε memor∙ wσ wan⌠ thi≤ codσ located« ì
ááááThi≤ directivσ cause≤ M8░ t∩ pu⌠ ß specia∞ valuσ iε thσ relocatablσ ì
ááááfilσ tha⌠ wil∞ bσ generateΣ b∙ thσ assembler¼ s∩ tha⌠ L80¼ thσ linke≥, ì
ááááwil∞ bσ ablσ t∩ "placeó i⌠ iε thσ prope≥ memor∙ area¼ namel∙ Pagσ 0.
ááááNo≈ wσ havσ thσ basiπ definitions¼ wσ wil∞ examinσ jus⌠ wha⌠ i≤ iε Pagσ ì
áááá0¼ anΣ wha⌠ thσ value≤ mean...
ááááRST░ EQ╒ ñ ╗ Restar⌠ Vecto≥ 0
ááááWBOOTE║ J╨ BIOS+│ ╗ Warφ Boo⌠ Entry
ááááIOBTYE║ D┬ 0░ ╗ Input/Outpu⌠ Byte
ááááUSRDSK║ D┬ 0░ ╗ M╙ Nybblσ ╜ User¼ L╙ Nybblσ ╜ Disk
ááááBDOSFV║ J╨ BDOS+╢ ╗ BDO╙ Functioε Call
ááááRST1║ D╙ ╕ ╗ Restar⌠ Vecto≥ 1
ááááRST2║ D╙ ╕ ╗ Restar⌠ Vecto≥ 2
ááááRST3║ D╙ ╕ ╗ Restar⌠ Vecto≥ 3
ááááRST4║ D╙ ╕ ╗ Restar⌠ Vecto≥ 4
ááááRST5║ D╙ ╕ ╗ Restar⌠ Vecto≥ 5
ááááRST6║ D╙ ╕ ╗ Restar⌠ Vecto≥ 6
ááááRST7║ D╙ ╕ ╗ Restar⌠ Vecto≥ ╖ (Debuτ Utilities)
èáááá D╙ 1╢ ╗ 004░ ¡ 004F
áááá D╙ 1▒ ╗ 005░ ¡ 005B
ááááFCB1║ D╙ 1╢ ╗ Defaul⌠ FC┬ 1
ááááFCB2║ D╙ 1╢ ╗ Defaul⌠ FC┬ 2
áááá D╙ 0┤ ╗ 007├ ¡ 007F
ááááDMABFR║ D╙ 12╕ ╗ 008░ ¡ 00FF
áááá END
ááááThσ firs⌠ line¼ define≤ (informationally⌐ wherσ thσ firs⌠ Restar⌠ ì
ááááVecto≥ begins« I⌠ jus⌠ s∩ happens¼ thi≤ i≤ thσ samσ addres≤ wherσ thσ ì
áááájum≡ t∩ thσ BIO╙ Warφ Boo⌠ Entr∙ i≤ found« Thσ EQ╒ ñ say≤: assigε thσ ì
ááááaddres≤ oµ thσ Prograφ Counte≥ (000░ a⌠ thi≤ point⌐ t∩ thσ labe∞ RST0.
ááááRST░ EQ╒ ñ ╗ Restar⌠ Vecto≥ 0
ááááThσ nex⌠ linσ define≤ thσ labe∞ WBOOT┼ (warφ boo⌠ entry⌐ a≤ ß jum≡ (JP⌐ ì
áááát∩ thσ BIOS+3« Iµ yo⌡ lookeΣ a⌠ thσ beginninτ oµ thσ BIOS¼ yo⌡ woulΣ ì
ááááseσ tha⌠ i⌠ begin≤ witΦ ß serie≤ oµ jum≡ instructions¼ pointinτ t∩ thσ ì
áááávariou≤ function≤ thσ BIO╙ provides« Normally¼ wσ d∩ no⌠ concerε ì
ááááourselve≤ witΦ thi≤ information¼ becausσ thσ BDO╙ als∩ know≤ abou⌠ ì
ááááthi≤ jum≡ table¼ anΣ wheε wσ makσ ß functioε cal∞ t∩ BDOS¼ i⌠ locate≤ ì
ááááthσ BIO╙ anΣ provide≤ thσ necessar∙ linkagσ fo≥ us.
ááááWBOOT║ J╨ BIOS+│ ╗ Warφ Boo⌠ Entry
ááááThσ nex⌠ linσ define≤ thσ labe∞ IOBYTE« I⌠ i≤ defineΣ a≤ ß singlσ bytσ ì
áááá(D┬ ╜ Definσ Byte⌐ witΦ ß valuσ iε thσ bytσ oµ 00H« Thi≤ bytσ i≤ ofteε ì
ááááuseΣ b∙ thσ BIO╙ anΣ othe≥ application≤ t∩ "rσ-directó thσ input/outpu⌠ ì
ááááoµ ß program« (Iε standarΣ CP/═ systems¼ thσ STA╘ commanΣ manipulate≤ ì
ááááthσ content≤ oµ thi≤ byte.)
ááááIOBTYE║ D┬ 0░ ╗ Input/Outpu⌠ Byte
ááááThσ labe∞ USRDS╦ define≤ tw∩ values║ thσ fou≥ leftmos⌠ bit≤ contaiε thσ ì
áááácurren⌠ "use≥ areaó anΣ thσ fou≥ rightmos⌠ bit≤ definσ thσ curren⌠ ì
áááá"diskó (thσ loggeΣ iε o≥ defaul⌠ disk)« Wheε ß bytσ i≤ divideΣ int∩ tw∩ ì
áááá┤-bi⌠ values¼ wσ refe≥ t∩ theφ a≤ thσ Mos⌠ Significan⌠ (MS⌐ anΣ Leas⌠ ì
ááááSignifican⌠ (LS⌐ Nybble« Perhap≤ aε illustratioε wil∞ bσ helpful:
ááááUSRDSK║ D┬ 0░ ╗ M╙ Nybblσ ╜ User¼ L╙ Nybblσ ╜ Disk
áááá Use≥ Disk
áááá M╙ Nybblσ --> 000░ 000░ <-¡ L╙ Nybble
áááá Bi⌠ ╖ ----» \---¡ Bi⌠ 0
ááááThσ nex⌠ linσ
ááááBDOSFV║ J╨ BDOS+╢ ╗ BDO╙ Functioε Callè
áááádefine≤ thσ entr∙ poin⌠ t∩ thσ BDO╙ tha⌠ wσ cal∞ t∩ havσ aε O╙ functioε ì
ááááperformeΣ fo≥ us« Mos⌠ program≤ loaΣ ß "functioε codeó int∩ Registe≥ C¼ ì
ááááanΣ appropriatσ informatioε iε thσ othe≥ register≤ anΣ theε perforφ thσ ì
ááááinstruction:
áááá CAL╠ BDOSF╓ ╗ Perforφ Functioε Call
ááááFo≥ example║ supposσ wσ wan⌠ t∩ kno≈ iµ ß characte≥ i≤ waitinτ oε thσ ì
ááááconsolσ fo≥ input« Wσ migh⌠ usσ Functioε Codσ 1▒ (ReaΣ Consolσ Status⌐ ì
áááát∩ determinσ this« Thσ codσ woulΣ be:
áááá L─ C,1▒ ╗ F├ ╜ Consolσ Status
áááá CAL╠ BDOSF╓ ╗ Perforφ O╙ Function
ááááWheε contro∞ i≤ returneΣ t∩ u≤ froφ thσ OS¼ (righ⌠ afte≥ thσ CALL)¼ wσ ì
ááááwil∞ havσ ß valuσ iε Registe≥ A« Iµ i⌠ i≤ 00¼ n∩ characte≥ wa≤ waiting¼ ì
ááááiµ i⌠ i≤ NO╘ 00¼ theε ß characte≥ i≤ waiting« Bu⌠ ╔ digressí Wσ onl∙ ì
ááááhavσ ß fe≈ morσ line≤ oµ codσ t∩ go¼ anΣ wσ wil∞ havσ completeΣ thi≤ ì
ááááarticle...
áááUnfortunately¼ thi≤ kinΣ oµ explanatioε require≤ lot≤ oµ word≤ anΣ ì
ááááexamples« Thσ content≤ oµ Pagσ ░ arσ s∩ ver∙ important¼ ╔ wanteΣ t∩ ì
áááástar⌠ witΦ i⌠ s∩ yo⌡ wil∞ understanΣ somσ oµ thσ morσ rudimentar∙ ì
áááálocation≤ iε you≥ memor∙ image.
ááááThσ nex⌠ seveε line≤ represen⌠ thσ remaininτ Restar⌠ Vectors« Therσ arσ ì
ááááeigh⌠ oµ theφ iε thσ Z8░ machine« Iε genera∞ the∙ arσ unuseΣ a⌠ presen⌠ ì
ááááiε mos⌠ machines« However¼ witΦ thσ ne≈ O╙ anΣ somσ ne≈ applications¼ ì
ááááthesσ byte≤ wil∞ bσ used« (D╙ ╜ Definσ Storagσ iε bytes)
ááááRST1║ D╙ ╕ ╗ Restar⌠ Vecto≥ 1
ááááRST2║ D╙ ╕ ╗ Restar⌠ Vecto≥ 2
ááááRST3║ D╙ ╕ ╗ Restar⌠ Vecto≥ 3
ááááRST4║ D╙ ╕ ╗ Restar⌠ Vecto≥ 4
ááááRST5║ D╙ ╕ ╗ Restar⌠ Vecto≥ 5
ááááRST6║ D╙ ╕ ╗ Restar⌠ Vecto≥ 6
ááááRST7║ D╙ ╕ ╗ Restar⌠ Vecto≥ ╖ (Debuτ Utilities)
áááThσ nex⌠ tw∩ lines¼ merel∙ allocatσ 2╕ byte≤ oµ memory« Nothinτ oµ an∙ ì
ááááinteres⌠ i≤ iε them« Thσ addresse≤ t∩ thσ right¼ iε thσ comment≤ area¼ ì
áááámerel∙ indicatσ wha⌠ "memor∙ locationsó the∙ allocate.
áááá D╙ 1╢ ╗ 004░ ¡ 004F
áááá D╙ 12 ╗ 005░ ¡ 005B
ááááAls∩ locateΣ iε Pagσ ░ arσ tw∩ "defaultó Filσ Contro∞ Blocks¼ a⌠ ì
ááááaddresse≤ 005C╚ anΣ 006CH« Thesσ FCB≤ arσ generall∙ filleΣ iε b∙ thσ ì
ááááCC╨ iµ wσ havσ specifieΣ "argumentsó oε thσ commanΣ line« ╔ wil∞ no⌠ ì
áááábothe≥ witΦ ß discussioε oµ thei≥ structurσ a⌠ thi≤ time« Wσ wil∞ cove≥ ì
áááái⌠ iε detai∞ a⌠ ß late≥ time.
ááááFCB1║ D╙ 1╢ ╗ Defaul⌠ FC┬ 1
ááááFCB2║ D╙ 1╢ ╗ Defaul⌠ FC┬ 2
èááááNext¼ arσ fou≥ bytes¼ merel∙ allocatinτ memor∙ a≤ above:
áááá D╙ 0┤ ╗ 007├ ¡ 007F
ááááAnΣ lastl∙ come≤ thσ defaul⌠ Direc⌠ Memor∙ Acces≤ Buffer« Thi≤ i≤ thσ ì
ááááareß wherσ CP/═ generall∙ store≤ ß recorΣ reaΣ froφ onσ oµ thσ flopp∙ ì
áááádisk≤ (o≥ harΣ disk)« I⌠ i≤ ALWAY╙ 12╕-bytes¼ becausσ CP/═ think≤ ALL ì
ááááphysica∞ record≤ arσ 128-byte≤ iε length«
ááááDMABFR║ D╙ 12╕ ╗ 008░ ¡ 00FF
ááááTheε thσ assemble≥ directive¼ END¼ t∩ definσ thσ obvious¼ thσ enΣ oµ ì
ááááthσ program.
áááá END
ááááIε thi≤ month'≤ article¼ ╔ havσ describeΣ thσ basiπ layou⌠ oµ memor∙ ì
ááááanΣ thσ content≤ oµ Pagσ 0« Nex⌠ month¼ wσ wil∞ begiε ß "realó prograφ ì
ááááanΣ discus≤ morσ memor∙ management« Iµ yo⌡ d∩ no⌠ havσ BUFFERS.DO├ a⌠ ì
ááááthi≤ time¼ yo⌡ migh⌠ retrievσ i⌠ fo≥ nex⌠ month≤ column.
ááááYou≥ assignment║ Yo⌡ shoulΣ tr∙ t∩ assemblσ thi≤ prograφ anΣ prin⌠ ou⌠ ì
ááááthσ resultinτ listing« Kee≡ i⌠ hand∙ fo≥ thσ future¼ a≤ wσ wil∞ refe≥ ì
áááát∩ i⌠ ove≥ anΣ ove≥ again« Iµ yo⌡ d∩ no⌠ havσ M80¼ SL╥ o≥ ZAS¼ yo⌡ caε ì
ááááge⌠ ß cop∙ oµ thσ compileΣ listinτ filσ froφ m∙ ┌-Node«
áááYo⌡ mus⌠ havσ ß printe≥ capablσ oµ printinτ ß minimuφ oµ 12▒ columns« ì
ááááMos⌠ 8░ columε do⌠-matri° machine≤ caε bσ se⌠ t∩ "condensedó modσ anΣ ì
ááááwil∞ worδ fine« Thσ filσ caε bσ printeΣ witΦ PI╨ anΣ ha≤ imbeddeΣ ^╠ ì
áááá(Contro∞-L⌐ a⌠ appropriatσ place≤ t∩ causσ ß Forφ FeeΣ (ne≈ page)« Thσ ì
áááásourcσ codσ fo≥ thi≤ filσ i≤ als∩ availablσ oε m∙ ┌-Node¼ Acces≤ ì
ááááProgramminτ anΣ PE╟-3« Refe≥ t∩ you≥ printe≥ manua∞ o≥ documentatioε oε ì
ááááPI╨ fo≥ morσ printinτ details.
ááááOnσ morσ poin⌠ oµ interest║ Somσ assembler≤ displa∙ thσ assembleΣ ì
ááááaddres≤ a≤ i⌠ i≤ actuall∙ storeΣ iε memory¼ lo≈ byte¼ theε higΦ byte« ì
ááááThσ SL╥ assembler≤ caε displa∙ i⌠ botΦ ways« ╔ chosσ t∩ sho≈ i⌠ a≤ ì
ááááhigΦ-bytσ anΣ lo≈-byte¼ simpl∙ becausσ i⌠ i≤ easie≥ t∩ read« M80¼ ì
ááááhowever¼ doe≤ jus⌠ thσ opposite.