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 / ENTERPRS / CPM / UTILS / S / 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ε thσ commanΣ linσ anΣ the∙ wil∞ áremaiε ápendinτ ì
  186. unti∞ RU╬ i≤ finisheΣ anΣ theε bσ executeΣ automatically.
  187.  
  188. Therσ ái≤ án∩ apparen⌠ neeΣ fo≥ ß 'Recursivσ áModeº áalia≤ áwhicΦ ì
  189. clear≤ ápendinτ command≤ froφ thσ MC╠ a≤ i⌠ runs«  'Norma∞ áModeº ì
  190. work≤ quitσ nicely¼ thanδ you«  
  191.  
  192. RoΓ FriefelΣ ha≤ appriseΣ mσ oµ aε articlσ iε TC╩ 2╕ b∙ Ja∙ áSagσ ì
  193. whicΦ present≤ thσ samσ argumen⌠ oε recursioε a≤ above«  ╔ swear¼ ì
  194. ╔ ádidn'⌠ áreaΣ tha⌠ article«  Maybσ 'grea⌠ ámindsº áthinδ áalikσ ì
  195. afte≥ all«  Perhap≤ ╔ caε offe≥ 'nestingº oµ aliases..
  196.  
  197. RUN:
  198.      I╞ ╘           PusΦ Truσ ont∩ thσ Flo≈ stack
  199.      MAI╬           Ruε MAIN
  200.      F╔             Po≡ thσ Flo≈ stacδ anΣ resumσ MC╠ commands
  201.  
  202. MAIN:
  203.      F╔             Po≡ thσ Flo≈ stack
  204.      PROG▒          D∩ something«  Se⌠ E╥ iµ wσ neeΣ FOO.
  205.      I╞ ER
  206.      FO╧            Ruε FO╧ iµ an∙ error
  207.      FI
  208.      I╞ E╥          FO╧ return≤ E╥ t∩ forcσ onσ morσ PROG1è     MAIN
  209.  
  210. FOO:
  211.      FI
  212.      PROG▓          D∩ something«  Clea≥ E╥ t∩ d∩ PROG▓ again.
  213.      I╞ ~E╥         Checδ thσ E╥ flag
  214.      FO╧            Reruε PROG2
  215.  
  216. Iε áthi≤ scenario¼ PROG▒ wil∞ bσ ruε anΣ oε error¼ PROG▓ i≤ árun«  ì
  217. Iµ áPROG▓ i≤ run¼ i⌠ wil∞ repea⌠ unti∞ i⌠ set≤ E╥ anΣ theε áPROG▒ ì
  218. wil∞ ábσ ruε again«  Thi≤ keep≤ u≡ unti∞ PROG▒ doe≤ no⌠ áse⌠ áthσ ì
  219. erro≥ flag.
  220.  
  221. ╔ áwil∞ áleavσ i⌠ t∩ thσ reade≥ discerε ß usσ fo≥ this¼ ábu⌠ áthσ ì
  222. forφ oµ thσ aliase≤ i≤ correc⌠ anΣ allow≤ yo⌡ t∩ appenΣ ácommand≤ ì
  223. t∩ RU╬ t∩ thσ exten⌠ oµ thσ MC╠ lengtΦ«  I⌠ expand≤ likσ this..
  224.  
  225. RUN:
  226.      I╞ ╘           PusΦ Truσ ont∩ thσ Flo≈ stack
  227. MAIN:
  228.      F╔             Po≡ thσ Flo≈ stack
  229.      PROG▒          D∩ something«  Se⌠ E╥ iµ wσ neeΣ FOO.
  230.      I╞ E╥          Ruε FO╧ iµ an∙ error
  231. FOO:
  232.      FI
  233.      PROG▓          D∩ something«  Clea≥ E╥ t∩ d∩ PROG▓ again.
  234.      I╞ ~E╥         Checδ thσ E╥ flag
  235.      FO╧            Reruε FO╧ iµ n∩ error
  236.  
  237.      FI
  238.      I╞ E╥          FO╧ return≤ E╥ t∩ forcσ onσ morσ PROG1
  239.      MAI╬           Ruε MAIN
  240.  
  241.      F╔             Po≡ thσ Flo≈ stacδ anΣ resumσ MC╠ commands
  242.  
  243.  
  244.