home *** CD-ROM | disk | FTP | other *** search
/ Brotikasten / BROTCD01.iso / cpm / salias16.lbr / ALIAS.NZT / ALIAS.NOT
Text File  |  1990-10-01  |  10KB  |  244 lines

  1.  
  2.                             Alia≤ 1.5
  3.                  b∙ Joσ Wrigh⌠  ▒ Septembe≥ 1990
  4.  
  5.  
  6. ALIAS░ ái≤ thσ actua∞ alia≤ modulσ writteε t∩ disk« I⌠ áha≤ ábeeε ì
  7. enhanceΣ ásomewha⌠ át∩ áallo≈ al∞ fivσ ásysteφ áfilename≤ át∩ ábσ ì
  8. addressed¼ á$F░ beinτ thσ prototypσ SH.VA╥ shel∞ ávariablσ áfile«  ì
  9. Thσ á'Tº áfiletypσ operato≥ wa≤ pu⌠ bacδ iε sucΦ átha⌠ á$T░ áwil∞ ì
  10. poin⌠ át∩ VAR«  Thσ 'Tº variablσ wa≤ removeΣ iε versioε á1.▒ áfo≥ ì
  11. somσ reasoε tha⌠ ╔ don'⌠ understand«  Iε an∙ case¼ ╔ havσ pu⌠ ái⌠ ì
  12. bacδ in.
  13.  
  14. A≤ ábefore¼ áALIA╙ ha≤ onσ 'escapeº character¼ '$º ádollar« á Thσ ì
  15. character≤ followinτ '$º arσ interpreteΣ t∩ mean..
  16.  
  17.      $ε   Wherσ ε varie≤ ░ througΦ 9«
  18.           $░   return≤ thσ NAM┼ oµ thi≤ alia≤ (froφ EXTFCB)
  19.           $▒   return≤ thσ firs⌠ tokeε oε thσ commanΣ line
  20.           $╣   return≤ thσ nintΦ tokeε oε thσ commanΣ line
  21.  
  22. An∙ á$ε whicΦ doe≤ no⌠ havσ ß correspondinτ tokeε return≤ ß áNUL╠ ì
  23. string¼ nothing.
  24.  
  25.      $¬   Thσ entirσ commanΣ linσ withou⌠ furthe≥ translatioε
  26.      $─   Thσ curren⌠ drivσ letter
  27.      $╒   Thσ curren⌠ use≥ number
  28.  
  29. Fo≥ áF¼ á╬ anΣ T¼ n=░ i≤ thσ SH.VA╥ filenamσ anΣ n=1..┤ áarσ áthσ ì
  30. standarΣ Systeφ Filσ names.
  31.  
  32.      $Fε  Systeφ Filσ ε Namσ anΣ Typσ a≤ NAME.TY╨    (ε i≤ 0..4)
  33.      $Nε  Systeφ Filσ ε Namσ a≤ simpl∙ NAM┼          (ε i≤ 0..4)
  34.      $Tε  Systeφ Filσ ε Typσ a≤ simpl∙ TY╨           (ε i≤ 0..4)
  35.      $ñ   Simpl∙ returε onσ '$º t∩ thσ commanΣ line
  36.  
  37. ALIAS1╡ implemen⌠s ß ne≈ Pointe≥ paramete≥ whicΦ wil∞ expanΣ t∩ ß ì
  38. hexadecima∞ áaddress«  Thσ Pointe≥ wil∞ allo≈ acces≤ át∩ ádynamiπ ì
  39. memor∙ value≤ withiε ß knowε datß structurσ (thσ basσ pagσ o≥ thσ ì
  40. environmen⌠ descriptor¼ ß jum≡ table¼ etc.)«  
  41.  
  42.                 Syntax║  $.ADDR[[[.OFF].OFF]+OFF]
  43.  
  44. Thσ alia≤ paramete≥ i≤ formeΣ witΦ ß '$º followeΣ b∙ ß '.º ápoin⌠ ì
  45. followeΣ b∙ aε address«  Oε expansion¼ i⌠ wil∞ returε thσ WorΣ a⌠ ì
  46. thσ áaddress« á Fo≥ áexample¼ á'$.6º wil∞ áreturε áthσ ávaluσ áiε ì
  47. location≤ á╢ áanΣ á╖ oµ thσ basσ ápage¼ áthσ á'protecteΣ ámemoryº ì
  48. address¼ somethinτ likσ C70╢ o≥ whateve≥ thσ BDO╙ entr∙ is«  
  49.  
  50. Wσ caε als∩ finΣ thσ Z│ Environment«  Thσ alia≤ itselµ i≤ ß ZCPR│ ì
  51. Typσ á▒ filσ witΦ ß standarΣ Z│ header«  Thσ addres≤ oµ Z3EN╓ ái≤ ì
  52. alway≤ áa⌠ 109Φ iε sucΦ ß file«  Thσ forφ '$.109º wil∞ expanΣ át∩ ì
  53. thσ he° addres≤ oµ thσ Environmen⌠ (E78░ iε m∙ case).
  54.  
  55. T∩ áfinΣ áaε áaddres≤ iε thσ áEnvironmen⌠ áDescriptor¼ áZ3C╠ áfo≥ ìèexample¼ ááwσ áappenΣ áit≤ áoffset« á '$.109.18º áwil∞ áge⌠ ááthσ ì
  56. environmen⌠ áaddres≤ a⌠ 109h¼ adΣ 18Φ t∩ i⌠ anΣ returε thσ ávaluσ ì
  57. containeΣ áthere¼ áthσ addres≤ oµ Z3C╠ (E90░ iε ám∙ ácase)« á Thσ ì
  58. valuσ áa⌠ Z3C╠ i≤ thσ NXTCH╥ pointer«  Returε thi≤ witΦ onσ ámorσ ì
  59. leve∞ oµ indirectioε a≤ '$.109.18.0'«  
  60.  
  61. $.▒            (0001H⌐        BIOS+│    D50│      (m∙ system)
  62. $.╢            (0006H⌐        BDO╙      C706
  63.  
  64. $.10╣          (0109H⌐        Z3EN╓     E780
  65. $.109.1╕       (Z3ENV+18⌐     Z3C╠      E900
  66. $.109.18.░     (Z3CL⌐         NXTCH╥    E9nn
  67.  
  68. Let'≤ conside≥ thσ Z3MS╟ buffer.
  69.  
  70. $.109.2▓       (Z3ENV+22⌐     Z3MS╟     E880
  71.  
  72. Thσ Erro≥ Addres≤ a⌠ Z3MSG+┤ i≤ returneΣ with..
  73.  
  74. $.109.22.┤     (Z3MSG+4)
  75.  
  76. Thσ pointer≤ caε havσ a≤ man∙ level≤ oµ indirectioε a≤ ánecessar∙ ì
  77. bu⌠ ╔ usuall∙ gσ⌠ los⌠ afte≥ tw∩ o≥ three.
  78.  
  79. Wσ caε als∩ adΣ aε offse⌠ t∩ ß pointer«  Fo≥ example..
  80.  
  81. $.109.22+╢ áwil∞ poin⌠ t∩ thσ Prograφ Erro≥ flaτ a⌠ Z3MSG+6« á O≥ ì
  82. poin⌠ át∩ Systeφ Filσ ▒ iε thσ environmen⌠ witΦ á'$.109+52'« á Wσ ì
  83. caε áusσ thσ '+º o≥ º-º operator≤ t∩ providσ aε offse⌠ áfroφ áthσ ì
  84. memor∙ ávariable«  Fo≥ example¼ '$.1+3º wil∞ returε áBIOS+6¼ áthσ ì
  85. CONS╘ áentr∙ whilσ '$.▒-3º return≤ BIOS+0¼ thσ beginninτ áoµ áthσ ì
  86. bios« á Wσ caε als∩ usσ thi≤ a≤ thσ basi≤ oµ thσ nex⌠ elemen⌠ áiε ì
  87. thσ Pointe≥ parameter«  Anothe≥ example..
  88.  
  89. Thσ Ampr∩ bio≤ i≤ structureΣ sucΦ tha⌠ thσ Disδ Paramete≥ Header≤ ì
  90. oµ áal∞ sixteeε possiblσ drive≤ reside¼ startinτ witΦ áthσ áfirs⌠ ì
  91. flopp∙ drive¼ a⌠ BIOS+80H«  Wσ caε extrac⌠ an∙ oµ thσ pointer≤ iε ì
  92. an∙ oµ thσ header≤ witΦ somσ simplσ math«  Let'≤ ge⌠ thσ áaddres≤ ì
  93. oµ áthσ áSecto≥ Translatσ Tablσ fo≥ drivσ ┼ (4)« á XLAT┼ ái≤ áthσ ì
  94. firs⌠ pointe≥ iε an∙ DPH.
  95.  
  96. Assuminτ NZCOM¼ i⌠ i≤ thσ CBIO╙ wσ arσ interesteΣ in«  ╔ wil∞ ág∩ ì
  97. througΦ thi≤ ste≡ b∙ ste≡ anΣ simplif∙ thing≤ a⌠ thσ end..
  98.  
  99. $.109.▒                  (Z3ENV+1⌐      CBIOS+╢        EA06
  100. $.109.1-╢                CBIOS+6-╢      CBIO╙          EA00 ì
  101. $.109.1-6+8░             CBIOS+8░       CBIOS+8░       EA80
  102. $.109.1-6+80+4░          CBIOS+C0╚      CBIOS+C0╚      EAC0
  103. $.109.1-6+80+40.░        (CBIOS+C0H⌐    EXLAT┼         EC22
  104.  
  105. Wσ simplif∙ thσ matΦ with..
  106.  
  107. $.109.1+BA.░ á anΣ áwσ havσ it«  ╔ aφ no⌠ surσ áho≈ áusefu∞ áthi≤ ì
  108. reall∙ i≤ bu⌠ i⌠ i≤ therσ iµ wσ eve≥ neeΣ it.
  109. èThσ alia≤ createΣ b∙ ALIAS1╡ i≤ seveε record≤ long«  Thσ standarΣ ì
  110. alia≤ áwa≤ áeigh⌠ árecord≤ anΣ n∩ alia≤ áma∙ ábσ álonger« á Alia≤ ì
  111. editor≤ iε genera∞ wil∞ rejec⌠ ß filσ oµ ninσ o≥ morσ record≤ anΣ ì
  112. declarσ i⌠ 'No⌠ aε Alias'«  Thi≤ eigh⌠-recorΣ lengtΦ i≤ arbitrar∙ ì
  113. bu⌠ historical«  
  114.  
  115. Thσ alia≤ wil∞ builΣ ß CC╨ commanΣ iε ß loca∞ buffe≥ accordinτ t∩ ì
  116. it≤ áargument≤ anΣ thσ tai∞ passeΣ t∩ i⌠ a≤ i⌠ wa≤ ácalled« á An∙ ì
  117. pendinτ command≤ iε thσ MC╠ wil∞ bσ appendeΣ t∩ thi≤ loca∞ buffe≥ ì
  118. anΣ átheε thσ entirσ buffe≥ copieΣ t∩ thσ beginninτ oµ áthσ áMCL«  ì
  119. Thσ alia≤ theε 'returnsº t∩ thσ CC╨ (ZCPR3⌐ fo≥ execution.ì
  120.  
  121. VALIA╙ áanΣ áSALIA╙ implementeΣ ß Modσ contro∞ iε áthσ áalia≤ áa≤ ì
  122. Norma∞ o≥ Recursive«  Iε Recursivσ Modσ thσ alia≤ wil∞ clea≥ áthσ ì
  123. res⌠ áoµ thσ MC╠ anΣ cop∙ onl∙ it≤ expansioε t∩ thσ beginninτ áoµ ì
  124. thσ áMCL«  BotΦ VALIA╙ anΣ SALIA╙ maintaiε thi≤ flaτ a⌠ á10CΦ áiε ì
  125. thσ áalia≤ a≤ 00Φ iµ Norma∞ anΣ 0FFΦ iµ recursive¼ anΣ ß 46Φ á'Fº ì
  126. characte≥ a⌠ 10Bh«  
  127.  
  128. Thσ commanΣ tai∞ oµ ß giveε alia≤ entr∙ ma∙ bσ n∩ longe≥ thaε 12╢ ì
  129. character≤ becausσ oµ thσ constraint≤ oµ thσ TBUF╞ size«  Iµ áthσ ì
  130. expansioε oµ ß particula≥ alia≤ linσ i≤ longe≥ thaε 12╢ byte≤ áwσ ì
  131. flaτ aε Ovf∞ erro≥ anΣ d∩ NO╘ movσ thσ alia≤ int∩ thσ MCL.
  132.  
  133. No≈ át∩ thσ subjec⌠ oµ recursivσ aliases«  Recursioε occur≤ áwheε ì
  134. aε áalia≤ ácall≤ áitself« á Thi≤ migh⌠ ábσ áusefu∞ áiε áaε áEDIT¼ ì
  135. ASSEMBLE¼ LIN╦ sessioε wherσ aε erro≥ flaggeΣ b∙ thσ assemble≥ o≥ ì
  136. linke≥ áwoulΣ áautomaticall∙ pu⌠ yo⌡ bacδ iε you≥ edito≥ át∩ átr∙ ì
  137. agaiε áanΣ áthσ absencσ oµ error≤ woulΣ linδ anΣ áexit« á ╔ áwil∞ ì
  138. leavσ thσ usσ oµ 'recursionº t∩ thσ reade≥ anΣ concentratσ oε ho≈ ì
  139. t∩ writσ aliae≤ whicΦ arσ properl∙ recursive.
  140.  
  141. A⌠ áfirs⌠ áblush¼ i⌠ woulΣ seeφ tha⌠ wσ coulΣ d∩ ásomethinτ álikσ ì
  142. this..
  143.  
  144. FOO║ PROGRA═        Somσ prograφ whicΦ set≤ thσ Erro≥ flag
  145.      I╞ E╥          No≈ checδ fo≥ Error
  146.      FO╧            Re-ruε FO╧ oε error
  147.      F╔             Closσ thσ IF
  148.  
  149. AnΣ áwσ can¼ almost«  Iµ therσ i≤ aε error¼ FO╧ i≤ árerun« á Thi≤ ì
  150. leave≤ aε unresolveΣ I╞ oε thσ Flo≈ stacδ anΣ append≤ thσ las⌠ F╔ ì
  151. t∩ thσ 'newº alia≤ iε thσ MCL«  EacΦ iteratioε pushe≤ anothe≥ áI╞ ì
  152. ont∩ áthσ Flo≈ stacδ anΣ add≤ anothe≥ F╔ t∩ thσ MCL« á Everythinτ ì
  153. i≤ finσ unti∞ eithe≥ thσ Flo≈ stacδ overflow≤ (eigh⌠ IF'≤ max⌐ o≥ ì
  154. thσ áMC╠ fill≤ u≡ witΦ al∞ thσ FI's«  No⌠ reall∙ coo∞ becausσ áwσ ì
  155. neve≥ kno≈ ho≈ man∙ time≤ wσ reruε FO╧ no≥ ho≈ mucΦ rooφ wσ áhavσ ì
  156. iε thσ MCL«  
  157.  
  158. Thσ ásolutioε ái≤ ásimplσ ábu⌠ árequire≤ áß álittlσ áexplanation«  ì
  159. Rewritσ áthσ alia≤ s∩ tha⌠ it≤ 'recursionº neithe≥ overflow≤ áthσ ì
  160. Flo≈ stacδ no≥ thσ MCL«  Consider..
  161.  
  162. FOO║ F╔        Closσ I╞ ER
  163.      PROGRAMè     I╞ ER
  164.      FO╧       Reruε thi≤ alias
  165.  
  166. Thi≤ onσ ha≤ n∩ pendinτ F╔ t∩ overflo≈ thσ MC╠ anΣ wil∞ kee≡ áthσ ì
  167. Flo≈ ástacδ ástraigh⌠ whilσ i⌠ i≤ 'recurring'«  Thσ firs⌠ áF╔ ái≤ ì
  168. balanceΣ b∙ callinτ i⌠ correctl∙ witΦ anothe≥ alias¼ likσ this..
  169.  
  170. RUN║ I╞ ╘      Impres≤ Truσ oε thσ Flo≈ stack
  171.      FO╧       Executσ FOO
  172.      F╔        Closσ thσ IF
  173.  
  174. WatcΦ ho≈ nicel∙ thi≤ expands..
  175.  
  176. RUN║ I╞ ╘      Se⌠ Flo≈ True
  177. FOO║ F╔        Closσ I╞ ╘ froφ RU╬ o≥ I╞ E╥ froφ FOO
  178.      PROGRA═   Clear≤ (anΣ maybσ sets⌐ Erro≥ flag
  179.      I╞ ER
  180.      FO╧       Ruε FO╧ agaiε iµ ER
  181.      F╔        Froφ RUN¼ Closσ I╞ E╥ froφ FO╧ wheε n∩ Error
  182.  
  183. Perfectl∙ ábalanced«  Writteε thi≤ way¼ recursivσ aliase≤ d∩ áno⌠ ì
  184. corrup⌠ eithe≥ thσ Flo≈ stacδ o≥ thσ MCL«  Yo⌡ caε ente≥ command≤ ì
  185. followinτ áRU╬ oε