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
/
JSAGE
/
ZSUS
/
TCJ
/
TCJ48.WS
< prev
next >
Wrap
Text File
|
2000-06-30
|
41KB
|
840 lines
Z-System Corne≥ (c)
by Jay Sage
The Computer Journal, Issue 48
Reproduced with permission
of author and publisher
Patchinτ MEX-Plu≤ anΣ Thσ Word¼ Usinτ ZEX
Fo≥ thi≤ issuσ ╔ havσ ß largσ numbe≥ oµ smal∞ subject≤ t∩ cover« ╔ wil∞ ábegiε ì
witΦ thσ lonτ-promiseΣ patche≤ t∩ ME╪¡ Plus¼ thσ one≤ ╔ los⌠ wheε m∙ harΣ disδ ì
crasheΣ anΣ theε recovereΣ wheε thσ harΣ disδ miraculousl∙ resurrecteΣ itself« ì
╔ haven'⌠ haΣ timσ t∩ incorporatσ al∞ thσ correction≤ anΣ addition≤ tha⌠ áhavσ ì
beeε oε m∙ list¼ bu⌠ thi≤ wil∞ bσ ß gooΣ star⌠ oε aε oε-goinτ project.
Whilσ áoε áthσ subjec⌠ oµ patching¼ ╔ wil∞ enlargσ oε thσ ádiscussioε áoµ áthσ ì
patcΦ át∩ áThσ WorΣ Plu≤ tha⌠ ╔ presenteΣ iε issuσ #45« I⌠ turn≤ ou⌠ átha⌠ áa⌠ ì
leas⌠ átw∩ differen⌠ version≤ oµ TW.CO═ arσ currentl∙ iε circulation¼ anΣ áthσ ì
origina∞ patcΦ work≤ onl∙ witΦ one.
┴ couplσ oµ reader≤ havσ requesteΣ hel≡ witΦ ZEX« The∙ arσ awarσ tha⌠ áBridge≥ ì
Mitchel∞ áprovideΣ áful∞ documentatioε iε hi≤ columε iε issuσ á#38¼ ábu⌠ áthe∙ ì
pointeΣ áou⌠ átha⌠ áthσ ásubjec⌠ i≤ rathe≥ ácomple° áanΣ áwoulΣ ábσ áclarifieΣ ì
considerabl∙ áb∙ ß fe≈ examples« Giveε thσ powe≥ oµ commanΣ alia≤ áscripts¼ á╔ ì
rarel∙ havσ an∙ neeΣ fo≥ ZEX¼ bu⌠ ╔ wil∞ presen⌠ thσ tw∩ ZE╪ script≤ tha⌠ ╔ d∩ ì
usσ regularly« Perhap≤ somσ reader≤ wil∞ hel≡ ou⌠ b∙ sendinτ mσ copie≤ oµ somσ ì
interestinτ script≤ tha⌠ the∙ havσ developeΣ tha⌠ usσ thσ advanceΣ feature≤ oµ ì
ZEX5.
Finally¼ á╔ áwil∞ ácontinuσ m∙ discussioε oµ ZMATE« Rathe≥ áthaε álistinτ áthσ ì
remaininτ command≤ tha⌠ ╔ diΣ no⌠ cove≥ las⌠ time¼ ╔ wil∞ describσ m∙ áspecia∞ ì
autoexeπ ámacr∩ átha⌠ áallow≤ ámσ t∩ pas≤ macr∩ command≤ át∩ áZMAT┼ áfroφ áthσ ì
operatinτ systeφ commanΣ line« Thi≤ provide≤ ß ver∙ powerfu∞ interfacσ betweeε ì
ZMAT┼ anΣ ┌-Systeφ commanΣ alia≤ scripts.
Thi≤ ái≤ áno⌠ thσ onl∙ informatioε abou⌠ ZMAT┼ iε thi≤ issue« ╔ áaφ áhapp∙ át∩ ì
announcσ tha⌠ wσ arσ inauguratinτ ß ne≈ columε b∙ Cliµ Kinnσ oε MAT┼ macros.
Onσ áothe≥ quicδ announcement« Thσ ┌-Systeφ Softwarσ Updatσ Service¼ áproduceΣ ì
b∙ Bil∞ Tishe∙ anΣ Chri≤ McEwen¼ i≤ expandinτ it≤ services« ZSU╙ wil∞ no≈ makσ ì
u≡ ácustoφ ádisk≤ containinτ thσ ful∞ LB╥ release≤ oµ an∙ file≤ áyo⌡ árequest« ì
Therσ wil∞ als∩ sooε bσ specia∞ softwarσ collections« ╔ believσ thσ firs⌠ wil∞ ì
contaiε materia∞ oµ interes⌠ t∩ assembl∙ languagσ programmers« ╔ invitσ yo⌡ t∩ ì
writσ t∩ mσ fo≥ ß ne≈ flye≥ o≥ t∩ looδ fo≥ announcement≤ oε BBSs.
Fixinτ U≡ ME╪-Plus
A≤ áwonderfu∞ a≤ ╔ finΣ ME╪-Plus¼ therσ arσ quitσ ß fe≈ bug≤ tha⌠ neeΣ át∩ ábσ ì
fixeΣ áanΣ quitσ ß fe≈ additiona∞ feature≤ tha⌠ ╔ woulΣ likσ t∩ seσ áadded« á╔ ì
havσ ájus⌠ ágotteε starteΣ oε thi≤ projec⌠ anΣ wil∞ describσ ám∙ áprogres≤ át∩ ì
date.
ME╪ Improvemen⌠ Listè
Beside≤ thσ item≤ tha⌠ m∙ curren⌠ patcΦ deal≤ with¼ thσ followinτ item≤ arσ oε ì
m∙ lis⌠ oµ needeΣ improvements.
Thσ CLON┼ command¼ whicΦ create≤ ß ne≈ cop∙ oµ ME╪ (i.e.¼ ß ne≈ CO═ file⌐ witΦ ì
thσ ácurren⌠ setting≤ a≤ thσ default¼ ha≤ thσ followinτ mino≥ bug║ wheε i⌠ ái≤ ì
entereΣ withou⌠ specifyinτ ß filσ name¼ i⌠ wil∞ makσ ß filσ witΦ exten⌠ á"COMó ì
anΣ ß filσ namσ oµ al∞ spacesí Iε thi≤ case¼ i⌠ woulΣ bσ mucΦ morσ sensiblσ iµ ì
i⌠ eithe≥ (1⌐ defaulteΣ t∩ ß namσ oµ MEX.CO═ o≥ (2⌐ refuseΣ t∩ d∩ anything.
Therσ ái≤ ß ver∙ annoyinτ erro≥ iε thσ wa∙ numerica∞ variable≤ arσ áprocessed« ì
Wheε thσ variable≤ havσ particula≥ values¼ ME╪ report≤ ß synta° error« S∩ áfa≥ ì
╔ áhavσ áno⌠ ábeeε ablσ t∩ determinσ thσ precisσ condition≤ áunde≥ áwhicΦ áthσ ì
probleφ áarises¼ bu⌠ ╔ hopσ tha⌠ witΦ carefu∞ stud∙ oµ thσ codσ ╔ wil∞ áfigurσ ì
ou⌠ áwha⌠ ái≤ áwrong« áM∙ gues≤ i≤ tha⌠ somσ CP╒ áflaτ ái≤ ábeinτ ámi≤-se⌠ áo≥ ì
misinterpreted.
Therσ i≤ ß mino≥ buτ iε thσ DAT┼ command« A≤ thing≤ arσ now¼ TIM┼ anΣ DAT┼ arσ ì
identica∞ áfunctions¼ áanΣ ábotΦ áreturε áthσ átimσ áiε áthσ áVALU┼ ávariable« ì
Obviously¼ DAT┼ shoulΣ returε thσ curren⌠ date.
Iε casσ yo⌡ havσ trieΣ t∩ usσ thσ MENU.MO─ modulσ anΣ havσ founΣ tha⌠ thσ HEL╨ ì
functioε ádoe≤ áno⌠ áwork¼ don'⌠ worry« Yo⌡ arσ no⌠ doinτ áanythinτ áwronτ áo≥ ì
missinτ an∙ piecσ oµ thσ code« Thi≤ functioε wa≤ implementeΣ improperl∙ o≥ no⌠ ì
implementeΣ áa⌠ al∞ iε thσ CP/═ versioε oµ ME╪-Plus« Wσ probabl∙ wil∞ áno⌠ ábσ ì
ablσ át∩ d∩ mucΦ abou⌠ thi≤ unti∞ wσ havσ figureΣ ou⌠ MEX'≤ interfacσ át∩ áthσ ì
externa∞ modules.
╔ woulΣ likσ t∩ mentioε somethinτ tha⌠ causeΣ mσ grieµ recentl∙ witΦ onσ oµ m∙ ì
macros║ áWAI╘ áSTRIN╟ string≤ arσ limiteΣ t∩ 1╢ charactersí ╔ ádon'⌠ áthinδ á╔ ì
woulΣ changσ this¼ bu⌠ onσ mus⌠ bea≥ thi≤ limitatioε iε mind.
Onσ oµ thσ mos⌠ importan⌠ addition≤ woulΣ bσ morσ strinτ variable≤ beyonΣ áthσ ì
si° á(A..F⌐ ácurrentl∙ áimplemented« Eveε tw∩ morσ woulΣ benefi⌠ ásomσ áoµ ám∙ ì
script≤ enormously.
Finally¼ á╔ áwoulΣ álikσ át∩ áreplacσ thσ áfilσ ánamσ áparser¼ áwhicΦ áalread∙ ì
recognize≤ áthσ áDU║ áprefix¼ áwitΦ áonσ átha⌠ áhandle≤ áful∞ á┌-Systeφ ááfilσ ì
specifications.
M∙ ME╪ Patch
M∙ áME╪ patcΦ i≤ showε iε Listinτ 1« I⌠ i≤ heavil∙ commented¼ anΣ ╔ áwil∞ áno⌠ ì
repea⌠ thσ detail≤ iε thσ text« Thσ patcΦ make≤ threσ changes.
ME╪ áha≤ áß áSTA╘ commanΣ tha⌠ turn≤ oε o≥ ofµ ß functioε átha⌠ áconvert≤ áthσ ì
backspacσ ke∙ int∩ ß rubout/deletσ characte≥ (whicΦ wσ wil∞ cal∞ DE╠ froφ áno≈ ì
on)« á╔ áhavσ áalway≤ assumeΣ tha⌠ thi≤ wa≤ includeΣ froφ áoldeε átimes¼ áwheε ì
microcomputer≤ sometime≤ haΣ n∩ DE╠ ke∙ anΣ mainframσ computer≤¡-whicΦ ME╪ wa≤ ì
useΣ t∩ communicatσ witΦ¡-requireΣ tha⌠ ke∙ fo≥ somσ critica∞ functions.
Today¼ thσ situatioε i≤ generall∙ quitσ different« First¼ almos⌠ al∞ computer≤ ìèanΣ áterminal≤ no≈ havσ ß DE╠ key« Second¼ witΦ thσ ┌-System¼ onσ áofteε áuse≤ ì
DE╠ interchangeabl∙ witΦ backspace¼ anΣ ╔ havσ gotteε quitσ useΣ t∩ that« Wheε ì
╔ ácal∞ noε-┌ remotσ acces≤ systems¼ ╔ finΣ i⌠ ß rea∞ nuisancσ wheε áDE╠ ádoe≤ ì
no⌠ work« Tha⌠ i≤ wh∙ ╔ decideΣ t∩ reversσ thσ functioε oµ thi≤ STA╘ command.
Makinτ thσ changσ itselµ wa≤ quitσ simple╗ thσ harΣ par⌠ wa≤ findinτ thσ righ⌠ ì
place≤ iε thσ code« Threσ change≤ arσ required¼ a≤ showε a⌠ thσ enΣ oµ Listinτ ì
1« áOnσ bytσ contain≤ thσ keycodσ oµ thσ ke∙ t∩ bσ intercepted¼ whilσ áanothe≥ ì
bytσ contain≤ thσ keycodσ witΦ whicΦ i⌠ i≤ t∩ bσ replaced« Thσ thirΣ changσ i≤ ì
no⌠ áneedeΣ fo≥ prope≥ operation¼ bu⌠ i⌠ i≤ nicσ t∩ havσ thσ STA╘ RU┬ ámessagσ ì
reflec⌠ thσ ne≈ function.
Thσ ánex⌠ changσ i≤ t∩ thσ STA╘ BU╞ command« ME╪ ver∙ ofteε ha≤ áit≤ ácommand≤ ì
returε iε thσ VALU┼ variablσ somσ informatioε developeΣ b∙ tha⌠ function« áFo≥ ì
example¼ áthσ áDI╥ áfunctioε return≤ thσ numbe≥ oµ matchinτ áfile≤ átha⌠ áwerσ ì
found« áUnfortunately¼ áthσ STA╘ BU╞ commanΣ display≤ áinformatioε áabou⌠ áthσ ì
statu≤ áoµ áthσ ácapturσ áanΣ áke∙ macr∩ ábuffer≤ ábu⌠ ádoe≤ áno⌠ áreturε áan∙ ì
informatioε iε VALUE.
╔ áhaΣ writteε ß scrip⌠ fo≥ callinτ u≡ GEniσ anΣ capturinτ m∙ áemai∞ áletters« ì
Wheε á╔ relieΣ oε XON/XOF╞ flo≈ contro∞ t∩ pausσ GEnie'≤ outpu⌠ whilσ ME╪ áwa≤ ì
flushinτ it≤ buffer¼ ╔ founΣ tha⌠ somσ tex⌠ wa≤ sometime≤ lost« T∩ ge⌠ áarounΣ ì
this¼ á╔ manuall∙ closeΣ anΣ reopeneΣ thσ capturσ buffer« Rathe≥ thaε áwastinτ ì
thσ átimσ t∩ d∩ thi≤ afte≥ eacΦ letter¼ ╔ wanteΣ t∩ checδ thσ amoun⌠ oµ áspacσ ì
remaininτ áiε áthσ capturσ buffer« Iµ thi≤ spacσ droppeΣ belo≈ somσ ávaluσ á(╔ ì
thinδ ╔ useΣ 3K)¼ theε ╔ woulΣ closσ anΣ reopeε thσ buffer.
Implementinτ áthi≤ functioε requireΣ addinτ somσ ne≈ instruction≤ t∩ thσ ácodσ ì
fo≥ áthσ áSTA╘ áBU╞ command« Thi≤ raiseΣ tw∩ problems║ ho≈ át∩ áta≡ áint∩ áthσ ì
origina∞ codσ anΣ wherσ t∩ pu⌠ thσ ne≈ instructions.
Le⌠ áu≤ ástar⌠ witΦ thσ seconΣ problem« WitΦ somσ programs¼ ne≈ ácodσ ácaε ábσ ì
addeΣ a⌠ thσ enΣ oµ thσ origina∞ code« Iµ thσ prograφ place≤ it≤ ruε-timσ datß ì
a⌠ thσ enΣ oµ it≤ code¼ however¼ thi≤ caε obviousl∙ presen⌠ somσ difficulties« ì
Iµ áonσ i≤ patchinτ iε somσ ne≈ initializatioε codσ tha⌠ i≤ performeΣ anΣ ácaε ì
bσ discardeΣ beforσ thσ prograφ start≤ t∩ usσ it≤ datß space¼ theε onσ caε ge⌠ ì
awa∙ áwitΦ this« Wheε ╔ adΣ thi≤ kinΣ oµ patch¼ ╔ tr∙ t∩ havσ i⌠ includσ ácodσ ì
tha⌠ ápatche≤ áou⌠ thσ patcΦ anΣ restore≤ thσ origina∞ ácode« áOtherwise¼ áthσ ì
prograφ canno⌠ safel∙ bσ reruε usinτ thσ G╧ command¼ sincσ thσ patcΦ codσ áma∙ ì
havσ beeε overwritteε b∙ prograφ data« Attemptinτ t∩ executσ datß ha≤ ß wa∙ oµ ì
wreakinτ havoπ witΦ thσ system!
Iε áou≥ presen⌠ case¼ wσ arσ addinτ codσ tha⌠ mus⌠ bσ availablσ a⌠ áan∙ átime¼ ì
anΣ áME╪ ácertainl∙ áwrite≤ ádatß int∩ thσ freσ memor∙ áafte≥ áit≤ áowε ácode« ì
Consequently¼ áwσ áhavσ t∩ finΣ somσ spacσ withiε thσ bound≤ oµ áthσ áorigina∞ ì
program« Thσ techniquσ ╔ havσ useΣ herσ i≤ t∩ stea∞ nonessentia∞ interna∞ datß ì
space.
ME╪ ánormall∙ ásign≤ oε witΦ ß ver∙ elaboratσ screeε displa∙ átha⌠ átake≤ á34│ ì
byte≤¡-enougΦ rooφ fo≥ ß lo⌠ oµ patcΦ codeí Wσ canno⌠ deletσ al∞ oµ it¼ bu⌠ wσ ì
caε áreplacσ i⌠ witΦ ß mucΦ simple≥ signoε message« Thσ ne≈ onσ iε áthσ ápatcΦ ì
use≤ áonl∙ á3▒ ábyte≤ (iµ ╔ counteΣ correctly)« I⌠ let≤ u≤ kno≈ átha⌠ áwσ áarσ ìèrunninτ thσ specia∞ versioε oµ ME╪ anΣ tell≤ u≤ thσ datσ oµ thσ patch.
T∩ ta≡ int∩ thσ origina∞ code¼ wσ choosσ ß convenien⌠ poin⌠ anΣ pu⌠ iε ß ájum≡ ì
instructioε át∩ thσ patcΦ area« Thσ instructioε tha⌠ wσ replaceΣ b∙ tha⌠ ájum≡ ì
i≤ thσ firs⌠ instructioε iε thσ patcΦ area« Theε wσ adΣ thσ additiona∞ codσ t∩ ì
savσ thσ capturσ buffe≥ freσ spacσ valuσ int∩ thσ VALU┼ variable« Finally¼ áwσ ì
returε t∩ thσ origina∞ codσ jus⌠ pas⌠ thσ jum≡ wσ inserted.
Thσ áthirΣ áchangσ implementeΣ iε thσ patcΦ concern≤ thσ áBEL╠ ácommand« áThi≤ ì
commanΣ ái≤ áconvenien⌠ t∩ aler⌠ thσ use≥ t∩ somσ event« I⌠ woulΣ bσ ánicσ át∩ ì
havσ áthσ bel∞ rinτ repeatedl∙ unti∞ thσ use≥ signal≤ tha⌠ hσ i≤ read∙ át∩ ág∩ ì
on« Unfortunately¼ thσ commanΣ "BEL╠ 100ó wil∞ insis⌠ oε ringinτ thσ bel∞ áonσ ì
hundreΣ átimes« "BEL╠ 0ó wil∞ insis⌠ oε ringinτ i⌠ 65,00░ timesí Thσ onl∙ áwa∙ ì
onσ ácaε interrup⌠ thσ bel∞ i≤ t∩ pres≤ contro∞-c¼ bu⌠ thi≤ abort≤ thσ áentirσ ì
script« áThσ ápatcΦ áallow≤ an∙ keypres≤ t∩ abor⌠ áthσ áBEL╠ ácommanΣ áwithou⌠ ì
abortinτ thσ entirσ script.
Thi≤ ápatcΦ work≤ usinτ ß slightl∙ differen⌠ technique« Thσ BEL╠ codσ áalread∙ ì
contain≤ áß ácal∞ t∩ ß routinσ tha⌠ check≤ fo≥ contro∞-c« Wσ jus⌠ áreplacσ ái⌠ ì
witΦ áß cal∞ t∩ ß ne≈ routinσ iε thσ patcΦ areß tha⌠ check≤ fo≥ an∙ ákeypress« ì
Afte≥ áthi≤ call¼ thσ origina∞ codσ performeΣ ß conditiona∞ jum≡ t∩ exi⌠ áfroφ ì
thσ routine¼ bu⌠ fo≥ reason≤ ╔ don'⌠ remember¼ thi≤ patΦ wa≤ neve≥ taken« áFo≥ ì
ou≥ áne≈ ároutine¼ thσ conditiona∞ ha≤ t∩ bσ switcheΣ froφ ß zer∩ checδ át∩ áß ì
nonzer∩ check.
Patchinτ TW.COM
Sincσ wσ arσ alread∙ oε thσ subjec⌠ oµ patching¼ thi≤ seem≤ likσ ß gooΣ áplacσ ì
fo≥ ß follo≈-u≡ discussioε oµ m∙ patcΦ iε issuσ #4╡ t∩ makσ TW.COM¼ thσ maste≥ ì
prograφ oµ Thσ WorΣ Plu≤ spel∞ checkinτ program¼ no⌠ sto≡ anΣ asδ thσ use≥ áiµ ì
thσ ácurren⌠ áconfiguratioε i≤ acceptable« Wheε wσ arσ runninτ froφ áaε áalia≤ ì
script¼ wσ jus⌠ wan⌠ t∩ ge⌠ oε witΦ thσ job.
Severa∞ ápeoplσ trieΣ implementinτ m∙ patcΦ scrip⌠ anΣ complaineΣ tha⌠ i⌠ ádiΣ ì
no⌠ worδ properly« Thi≤ wa≤ strange¼ becausσ ╔ havσ beeε usinτ i⌠ áconstantly« ì
Ha∞ áVoge∞ finall∙ figureΣ ou⌠ wha⌠ wa≤ goinτ wrong« I⌠ seem≤ tha⌠ átherσ áarσ ì
tw∩ áversion≤ áoµ T╫ iε curren⌠ distribution« Mine¼ whicΦ camσ áwitΦ áWordSta≥ ì
Releasσ á4¼ ái≤ versioε 1.21« Othe≥ peoplσ havσ ß late≥ áversion¼ á1.22« áBotΦ ì
displa∙ áß 198▒ copyright¼ anΣ i⌠ seem≤ odΣ tha⌠ thσ ne≈ versioε áoµ áWordSta≥ ì
woulΣ ácomσ witΦ aε olde≥ versioε oµ TW« I⌠ make≤ mσ wonde≥ whicΦ áversioε ái≤ ì
better.
Iε áan∙ ácase¼ versioε 1.2▓ ha≤ threσ byte≤ morσ codσ beforσ m∙ áseconΣ ápatcΦ ì
point¼ anΣ s∩ botΦ thσ addres≤ oµ thσ pokσ anΣ thσ addres≤ pokeΣ iε havσ t∩ bσ ì
incrementeΣ b∙ three« Herσ i≤ thσ origina∞ TWPA╘ alia≤ fo≥ versioε 1.21:
ge⌠ 10░ tw:tw.com
pokσ 10│ c│ 3Γ 01
pokσ 39╡ c│ 2ß 04
g∩ $*
Fo≥ versioε 1.22¼ onl∙ thσ seconΣ pokσ ha≤ t∩ bσ changed:è
pokσ 39╕ c│ 2Σ 04.
Iε ám∙ origina∞ discussion¼ ╔ diΣ no⌠ describσ ho≈ ╔ figureΣ ou⌠ ho≈ t∩ ápatcΦ ì
arounΣ áthσ áprompt« Ha∞ Voge∞ askeΣ abou⌠ m∙ method¼ s∩ ╔ wil∞ sa∙ áß álittlσ ì
abou⌠ i⌠ here« It'≤ thσ leas⌠ ╔ caε d∩ t∩ thanδ hiφ fo≥ solvinτ thσ mystery.
╔ kne≈ tha⌠ thσ offendinτ promp⌠ begaε witΦ "Thesσ arσ thσ curren⌠ ásettings.ó ì
So¼ á╔ ásearcheΣ áwitΦ ß debugge≥ fo≥ tha⌠ text¼ anΣ ╔ founΣ ái⌠ ástartinτ áa⌠ ì
addres≤ 07FFH« Sincσ i⌠ wa≤ par⌠ oµ ß collectioε oµ sucΦ messages¼ al∞ áendinτ ì
witΦ áß ádolla≥ ásign¼ á╔ ákne≈ tha⌠ the∙ werσ áno⌠ ápar⌠ áoµ áiε-linσ ácalls« ì
Therefore¼ áwherσ áthσ ámessagσ áwa≤ actuall∙ ádisplayeΣ átherσ áwoulΣ áalmos⌠ ì
certainl∙ bσ aε instructioε loadinτ thσ addres≤ oµ thσ messagσ int∩ onσ oµ thσ ì
doublσ registers.
╔ áuseΣ thσ DS─ debugger'≤ searcΦ functioε t∩ locatσ occurrence≤ oµ áthσ ábytσ ì
pai≥ FF,07« Thσ firs⌠ onσ wa≤ par⌠ oµ thσ codσ sequence
041π lΣ de,07ff
041µ cal∞ 17bd
042▓ cal∞ 17cb
042╡ c≡ º '
042╖ j≡ z,02a4
042a
I⌠ áwa≤ prett∙ clea≥ tha⌠ 17bΣ wa≤ thσ routinσ fo≥ displayinτ ß ástrinτ áwhosσ ì
addres≤ wa≤ iε registe≥ pai≥ D┼ anΣ tha⌠ 17cΓ wa≤ thσ routinσ t∩ ge⌠ aε áinpu⌠ ì
characte≥ froφ thσ user« T╫ take≤ ß spacσ characte≥ t∩ indicatσ tha⌠ thσ áuse≥ ì
want≤ át∩ makσ ß change¼ whicΦ mus⌠ bσ handleΣ b∙ thσ codσ a⌠ 02a4« An∙ áothe≥ ì
characte≥ áwoulΣ áaccep⌠ áthσ ádefaul⌠ setu≡ anΣ ácontinuσ áa⌠ áaddres≤ á042a« ì
Therefore¼ changinτ thσ codσ a⌠ 042│ to
042│ j≡ 042a
woulΣ b∙-pas≤ thσ user'≤ responsσ anΣ g∩ righ⌠ int∩ thσ spel∞ checking.
However¼ tha⌠ changσ woulΣ stil∞ senΣ thσ displa∙ oµ thσ promp⌠ t∩ thσ screen« ì
Backinτ áu≡ anΣ puttinτ m∙ replacemen⌠ jum≡ instructioε a⌠ addres≤ 041Σ áwoulΣ ì
suppres≤ eveε thσ displa∙ oµ thσ prompt.
A≤ á╔ álookeΣ a⌠ stil∞ earlie≥ code¼ ╔ founΣ instruction≤ tha⌠ ádisplayeΣ áthσ ì
curren⌠ ásettings« áSincσ áwσ reall∙ diΣ no⌠ neeΣ t∩ havσ átheφ ásen⌠ át∩ áthσ ì
screen¼ á╔ continueΣ t∩ worδ bacδ unti∞ ╔ camσ t∩ thσ beginninτ oµ tha⌠ áblocδ ì
oµ codσ a⌠ addres≤ 0395¼ wherσ thσ messagσ "Summary¼ Checkinτ file...ó wa≤ pu⌠ ì
up« B∙ placinτ m∙ jum≡ instructioε there¼ al∞ oµ thi≤ extraneou≤ codσ wa≤ áb∙-ì
passed.
Yo⌡ ámigh⌠ ábσ áwonderinτ áho≈ ╔ founΣ thσ placσ wherσ áthσ áothe≥ ápatcΦ áwa≤ ì
required« áWitΦ thσ maiε patcΦ installed¼ T╫ terminateΣ witΦ aε erro≥ ámessagσ ì
abou⌠ áß corrupteΣ file« Guessinτ tha⌠ ß checδ oµ tha⌠ typσ woulΣ bσ nea≥ áthσ ì
beginninτ oµ thσ code¼ ╔ jus⌠ executeΣ TW.CO═ unde≥ thσ debugger« Thσ áprobleφ ì
wa≤ clea≥ ver∙ quickly.è
Somσ Samplσ ZE╪ Scripts
A≤ á╔ mentioneΣ earlier¼ Bridge≥ Mitchell¼ autho≥ oµ ZE╪ versioε 5.0¼ ácovereΣ ì
thσ áspecification≤ fo≥ thσ prograφ iε hi≤ columε iε issuσ #3╕ oµ TCJ« áHavinτ ì
jus⌠ árereaΣ tha⌠ column¼ ╔ havσ t∩ agreσ witΦ thσ comment≤ ╔ receiveΣ tha⌠ áß ì
fe≈ example≤ arσ needeΣ t∩ appreciatσ wha⌠ ZE╪ caε do« ╔ wil∞ assumσ tha⌠ áthσ ì
reade≥ ái≤ áalread∙ familia≥ witΦ thσ basiπ operatioε oµ ZE╪ anΣ ápresen⌠ áthσ ì
onl∙ tw∩ ZE╪ script≤ tha⌠ ╔ usσ regularly.
Onσ áoµ áthσ áadvantage≤ á╔ go⌠ froφ writinτ áabou⌠ áthesσ áscript≤ ái≤ áthat¼ ì
naturally¼ áiε áthσ coursσ oµ analyzinτ theφ ╔ though⌠ oµ ne≈ áapproache≤ áanΣ ì
havσ ásignificantl∙ árewritteε them« The∙ d∩ seeφ t∩ work¼ bu⌠ yo⌡ áshoulΣ ábσ ì
warneΣ tha⌠ mistake≤ ma∙ havσ crep⌠ in.
Iµ al∞ onσ want≤ t∩ d∩ i≤ ruε ß sequencσ oµ commanΣ lines¼ ╔ don'⌠ thinδ átha⌠ ì
ZE╪ ái≤ thσ righ⌠ approacΦ (thougΦ therσ ma∙ bσ somσ exception≤ tha⌠ á╔ ácan'⌠ ì
thinδ oµ now)« Oε thσ othe≥ hand¼ ZE╪ i≤ appropriatσ¡-iε fact¼ necessar∙¡-wheε ì
onσ áwant≤ no⌠ onl∙ t∩ invokσ ß prograφ bu⌠ als∩ t∩ providσ interactivσ áinpu⌠ ì
t∩ áthσ program« ZE╪ i≤ als∩ usefu∞ fo≥ creatinτ fanc∙ screeε displays¼ ásincσ ì
i⌠ áha≤ thσ abilit∙ t∩ generatσ direc⌠ outpu⌠ t∩ thσ consolσ anΣ át∩ ásuppres≤ ì
outpu⌠ generateΣ b∙ runninτ programs« M∙ tw∩ samplσ script≤ fal∞ primaril∙ áiε ì
thσ forme≥ class.
M∙ áfirs⌠ script¼ MAP.ZEX¼ i≤ showε iε Listinτ 2« A≤ yo⌡ see¼ i⌠ i≤ áextremel∙ ì
simple« áI⌠ ái≤ áuseΣ át∩ invokσ thσ MA╨ utilit∙ tha⌠ i≤ ápar⌠ áoµ áthσ áXBIO╙ ì
extendeΣ áBIO╙ fo≥ thσ SB18░ computer« Thi≤ utilit∙ caε temporaril∙ áse⌠ áeacΦ ì
flopp∙ drivσ t∩ emulatσ onσ oµ ß numbe≥ oµ foreigε formats.
╔ áwanteΣ t∩ havσ simplσ alia≤ commands¼ sucΦ a≤ "KP4ó o≥ "MD3"¼ tha⌠ se⌠ áthσ ì
appropriatσ flopp∙ t∩ thσ Kaypr∩ DSD─ o≥ Morro≈ MD│ format« Unfortunately¼ MA╨ ì
i≤ áß ápurel∙ áinteractivσ program╗ choice≤ canno⌠ bσ passeΣ t∩ ái⌠ áfroφ áthσ ì
commanΣ line¼ anΣ s∩ ARUN┌ i≤ powerless« Thi≤ i≤ wherσ ZE╪ come≤ in.
Thσ áfirs⌠ ásectioε oµ MAP.ZE╪ i≤ aε extendeΣ comment« Wheε áß á'{º ácharacte≥ ì
appear≤ iε thσ firs⌠ columε oµ ß line¼ al∞ tex⌠ u≡ t∩ thσ firs⌠ closinτ ábracσ ì
characte≥ '}º i≤ treateΣ a≤ ß commen⌠ anΣ ignoreΣ b∙ ZEX« ╔ strongl∙ recommenΣ ì
usinτ comment≤ extensively¼ a≤ witΦ an∙ othe≥ programminτ language.
Thσ firs⌠ noε-blank¼ noε-commen⌠ linσ invoke≤ thσ MA╨ program¼ whicΦ ╔ kee≡ iε ì
director∙ áB0:« Thσ nex⌠ linσ i≤ thσ onσ tha⌠ doe≤ thσ specia∞ joΓ átha⌠ áonl∙ ì
ZE╪ ácaε ádo« Line≤ tha⌠ begiε witΦ ß '<º characte≥ iε thσ áfirs⌠ ácolumε áarσ ì
interpreteΣ a≤ prograφ inpu⌠ b∙ ZEX¼ whicΦ proceed≤ t∩ emulatσ you≥ typinτ áa⌠ ì
thσ ákeyboard« áIε thi≤ case¼ thσ firs⌠ characte≥ emulateΣ i≤ 'G'« áThσ áfirs⌠ ì
inpu⌠ tha⌠ MA╨ expect≤ i≤ thσ lette≥ oµ thσ drivσ t∩ configure« Sincσ al∞ áthσ ì
foreigε format≤ ╔ usσ arσ fo≥ 4╕-tpΘ drives¼ ╔ alway≤ usσ m∙ ╟ drive.
Next¼ áMA╨ áwant≤ onσ t∩ selec⌠ ß forma⌠ b∙ number« Thi≤ wσ pas≤ át∩ áthσ áZE╪ ì
scrip⌠ áa≤ áß paramete≥ oε thσ ZE╪ commanΣ line¼ anΣ wσ represen⌠ ái⌠ áiε áthσ ì
scrip⌠ witΦ thσ symbo∞ "$1"« MA╨ theε want≤ ß carriagσ return« ZE╪ i≤ supposeΣ ì
t∩ ignorσ carriagσ return≤ iε thσ script¼ anΣ s∩ wσ shoulΣ includσ thσ specia∞ ì
directivσ á"|CR|"« However¼ fo≥ reason≤ unknowε t∩ me¼ átria∞-anΣ-erro≥ áshow≤ ìètha⌠ áthi≤ ái≤ áno⌠ necessar∙ here╗ ß carriagσ returε ái≤ ásen⌠ áautomaticall∙ ì
whethe≥ wσ wan⌠ onσ o≥ not.
MAP.ZE╪ i≤ aε incredibl∙ simplσ script¼ bu⌠ i⌠ provide≤ ß lo⌠ oµ power« ╔ ácaε ì
no≈ definσ thσ followinτ ARUN┌ aliases:
CLEAR=CL╥ ze° b0:ma≡ 1;msg
KP4=KP1░ /xxma≡ ╕ KP4
MD│ /xxma≡ ╣ MD3
TV,80│ /xxma≡ 2╕ TV803
XXMA╨ ze° b0:ma≡ $1;msτ **¬ Drivσ ╟ ╜ $▓ ***
MS╟ ech∩ ^[f$*
Thesσ áscript≤ áimplemen⌠ thσ nicet∙ oµ puttinτ ß messagσ iε thσ áuppe≥ árigh⌠ ì
specia∞ messagσ areß oε m∙ Wysσ 5░ termina∞ t∩ reminΣ mσ oµ thσ foreigε forma⌠ ì
setting« áI⌠ i≤ no⌠ reasonablσ t∩ tr∙ t∩ remembe≥ thσ specia∞ escapσ ásequencσ ì
fo≥ programminτ thi≤ messagσ area¼ s∩ ╔ providσ thσ alia≤ MS╟ t∩ d∩ this.
┴ áseconΣ ásubroutinσ áalias¼ áXXMAP¼ save≤ spacσ iε áthσ áALIAS.CM─ áfilσ áb∙ ì
handlinτ ácommand≤ ácommoε át∩ áß ánumbe≥ áoµ áothe≥ áaliases« áI⌠ átake≤ átw∩ ì
parameters« áThσ firs⌠ i≤ thσ forma⌠ numbe≥ fo≥ MAP¼ anΣ i⌠ i≤ passeΣ át∩ áthσ ì
MA╨ ZE╪ script« Thσ seconΣ i≤ thσ namσ oµ thσ format¼ anΣ i⌠ i≤ passeΣ t∩ áthσ ì
MS╟ alias« Thσ othe≥ aliases¼ sucΦ a≤ MD3¼ se⌠ u≡ thσ desireΣ disδ format« Thσ ì
alia≤ CL╥ o≥ CLEA╥ restore≤ drivσ ╟ t∩ it≤ defaul⌠ SB18░ forma⌠ (MA╨ selectioε ì
1).
Thσ seconΣ examplσ scrip⌠ i≤ calleΣ FORMAT.ZE╪ i≤ showε iε Listinτ 3« I⌠ work≤ ì
witΦ anothe≥ XBIO╙ utilit∙ program¼ FVC─ (Forma⌠ Verif∙ Cop∙ Duplicate)« áThi≤ ì
prograφ ácaε forma⌠ diskette≤ no⌠ onl∙ iε thσ standarΣ SB18░ format≤ bu⌠ áals∩ ì
iε ásevera∞ foreigε formats« FVCD¼ likσ MAP¼ i≤ ß purel∙ interactivσ áprogram¼ ì
bu⌠ ╔ wan⌠ t∩ bσ ablσ t∩ format¼ say¼ ß Kaypr∩ ▓ disδ b∙ enterinτ jus⌠ "FORMA╘ ì
KP2"« Again¼ ZE╪ save≤ thσ day.
Thi≤ áscrip⌠ ái≤ ámucΦ morσ complicated« Sincσ ╔ wan⌠ al∞ thσ áformat≤ át∩ ábσ ì
handleΣ áb∙ áß ácommoε áalia≤ calleΣ FORMAT¼ thσ áparticula≥ áforma⌠ áwil∞ ábσ ì
designateΣ b∙ ß commanΣ-linσ argumen⌠ anΣ no⌠ b∙ thσ namσ oµ thσ command« Thi≤ ì
require≤ átestinτ áoµ thσ argument¼ ß joΓ tha⌠ caε bσ performeΣ ánicel∙ áb∙ áß ì
sequencσ áoµ áflo≈-contro∞ commands« Tha⌠ mucΦ coulΣ bσ handleΣ b∙ áß ácommanΣ ì
alias¼ ábu⌠ sincσ wσ wil∞ bσ providinτ interactivσ inpu⌠ anyway¼ wσ ámigh⌠ áa≤ ì
wel∞ havσ ZE╪ takσ carσ oµ everything.
A≤ witΦ MAP.ZEX¼ wσ begiε thσ scrip⌠ witΦ ß commen⌠ block« Notσ tha⌠ ß ádoublσ ì
semicoloε ácaε bσ useΣ t∩ ente≥ individua∞ comment≤ oε ß line« Thσ áfirs⌠ átw∩ ì
executablσ line≤ tes⌠ thσ firs⌠ argument¼ "$1"¼ t∩ seσ iµ i⌠ i≤ eithe≥ "Fó áo≥ ì
"F:"« Thσ coloε prefi° beforσ thσ paramete≥ i≤ includeΣ t∩ forcσ thσ áargumen⌠ ì
t∩ ábσ átreateΣ a≤ ß strinτ anΣ no⌠ a≤ ß director∙ specificatioε áeveε áiµ ái⌠ ì
contain≤ áß ácolon« Fo≥ reason≤ ╔ canno⌠ entirel∙ remember¼ thσ áflo≈ ácontro∞ ì
strinτ¡ áequatσ testinτ commanΣ doe≤ no⌠ worδ properl∙ iµ i⌠ begin≤ witΦ ájus⌠ ì
":"« Fo≥ tha⌠ reason¼ ╔ pu⌠ thσ definitσ strinτ firs⌠ anΣ thσ strinτ witΦ áthσ ì
paramete≥ second.
No≈ wσ comσ t∩ ß ver∙ importan⌠ ZE╪ directive║ |iµ true|« Thi≤ directivσ tell≤ ìèZE╪ át∩ áignorσ al∞ character≤ u≡ t∩ thσ closinτ |endifⁿ iµ thσ ácurren⌠ áflo≈ ì
statσ ái≤ false« Yo⌡ migh⌠ wonde≥ wh∙ onσ woulΣ neeΣ this¼ sincσ áthσ ácommanΣ ì
processo≥ woulΣ ignorσ command≤ anyway« Thσ answe≥ i≤ tha⌠ thσ scrip⌠ contain≤ ì
materia∞ othe≥ thaε commands« I⌠ contain≤ interactivσ inpu⌠ anΣ direc⌠ consolσ ì
output« Thσ |iµ trueⁿ anΣ |endifⁿ directive≤ makσ surσ tha⌠ thesσ arσ áignoreΣ ì
a≤ well.
Afte≥ ZE╪ processe≤ ß command¼ sucΦ a≤ thσ linσ "b0:fvcd"¼ anΣ send≤ i⌠ t∩ thσ ì
commanΣ áprocessor¼ ái⌠ álook≤ áa⌠ thσ nex⌠ line« Iµ ái⌠ ábegin≤ áwitΦ áß á'<º ì
characte≥ iε thσ firs⌠ column¼ theε al∞ thσ character≤ oε tha⌠ linσ u≡ t∩ ábu⌠ ì
no⌠ áincludinτ thσ endinτ carriagσ returε arσ loadeΣ int∩ ß ákeystrokσ ábuffe≥ ì
anΣ áfed¼ a≤ requested¼ a≤ interactivσ inpu⌠ t∩ thσ runninτ program« áIε áthi≤ ì
example¼ wσ senΣ "OSXTFF2"¼ jus⌠ a≤ iµ wσ presseΣ thosσ seveε key≤ manually.
Wσ als∩ senΣ ß carriagσ return¼ specifieΣ b∙ thσ |crⁿ directive« A≤ noteΣ witΦ ì
thσ áMAP.ZE╪ script¼ ZE╪ automaticall∙ send≤ onσ carriagσ return¼ bu⌠ wσ áneeΣ ì
tw∩ áfo≥ thi≤ operation« Wσ won'⌠ bothe≥ t∩ explaiε wha⌠ al∞ thosσ ácharacter≤ ì
d∩ iε FVCD« T∩ figurσ ou⌠ wha⌠ t∩ include¼ onσ jus⌠ run≤ thσ prograφ ámanuall∙ ì
anΣ make≤ notσ oµ ever∙ ke∙ pressed.
Thi≤ simulateΣ inpu⌠ start≤ thσ firs⌠ diskettσ formatting« Wheε tha⌠ operatioε ì
i≤ ácomplete¼ áFVC─ want≤ morσ use≥ input« Sincσ thσ nex⌠ ZE╪ álinσ ádoe≤ áno⌠ ì
begiε witΦ ß '<'¼ ZE╪ n∩ longe≥ supplie≤ thσ inpu⌠ anΣ return≤ contro∞ t∩ áthσ ì
user« Morσ diskette≤ caε bσ formatteΣ manually.
Wheε áonσ eventuall∙ exit≤ froφ FVCD¼ thσ ZE╪ scrip⌠ continue≤ witΦ áthσ álinσ ì
"|say|"« áThi≤ áturn≤ áoε direc⌠ consolσ output« áText¼ áthi≤ átimσ áincludinτ ì
carriagσ returns¼ linσ feeds¼ anΣ almos⌠ al∞ othe≥ character≤ iε thσ file¼ ái≤ ì
sen⌠ ádirectl∙ át∩ thσ screen¼ unti∞ thσ terminatinτ |enΣ ásayⁿ ádirectivσ ái≤ ì
encountered« áThσ directivσ |"|¼ seeε late≥ iε thσ script¼ i≤ ß ámorσ ácompac⌠ ì
alternativσ át∩ á|sayⁿ áanΣ |enΣ say|« I⌠ automaticall∙ átoggle≤ áthσ áconsolσ ì
outpu⌠ state.
Wσ coulΣ havσ useΣ thσ ECH╧ commanΣ t∩ displa∙ thi≤ message¼ bu⌠ ZEX'≤ ádirec⌠ ì
screeε outpu⌠ i≤ easie≥ anΣ morσ convenient¼ a≤ i⌠ i≤ casσ sensitive« Yo⌡ jus⌠ ì
writσ thing≤ a≤ yo⌡ wan⌠ theφ t∩ looδ oε thσ screen.
Oncσ áwσ áarσ finisheΣ witΦ thσ formatting¼ wσ caε terminatσ áthσ áZE╪ áscrip⌠ ì
immediately« Thi≤ i≤ donσ witΦ thσ |abortⁿ directive« I⌠ automaticall∙ return≤ ì
thσ flo≈ statσ t∩ it≤ origina∞ condition¼ s∩ wσ d∩ no⌠ havσ t∩ worr∙ abou⌠ thσ ì
fac⌠ thσ wσ havσ no⌠ executeΣ thσ "FIó commanΣ tha⌠ balance≤ thσ "IFó ácommanΣ ì
earlier.
Thσ áres⌠ oµ thσ scrip⌠ jus⌠ proceed≤ t∩ tes⌠ fo≥ othe≥ argument≤ anΣ t∩ ápas≤ ì
thσ áappropriatσ áinpu⌠ át∩ áFVCD« Thσ onl∙ onσ oµ áthesσ áothe≥ ácase≤ áwortΦ ì
commentinτ áoε i≤ thσ manua∞ formattinτ casσ nea≥ thσ enΣ oµ thσ script« áHerσ ì
wσ ásimulatσ inpu⌠ onl∙ t∩ pu⌠ FVC─ iε forma⌠ modσ witΦ automatiπ áDateStampe≥ ì
initializatioε enableΣ bu⌠ no⌠ t∩ selec⌠ an∙ forma⌠ o≥ t∩ star⌠ thσ operation« ì
Wσ ámus⌠ suppres≤ thσ automatiπ carriagσ returε tha⌠ ZE╪ generate≤ á(otherwisσ ì
formattinτ áwil∞ ástar⌠ áimmediatel∙ áiε somσ ádefaul⌠ áformat)« áThσ á|untilⁿ ì
directivσ stop≤ simulateΣ inpu⌠ unti∞ ß carriagσ returε i≤ entered.
èM∙ ZMAT┼ Autoexeπ Macro
Thσ tw∩ ZE╪ script≤ werσ needeΣ primaril∙ becausσ thσ tw∩ program≤ MAP.CO═ anΣ ì
FVCD.CO═ ádiΣ áno⌠ providσ ß facilit∙ fo≥ designatinτ option≤ oε áthσ ácommanΣ ì
line« áAmpr∩ alway≤ madσ ß particula≥ poin⌠ oµ providinτ sucΦ ß facilit∙ áwitΦ ì
it≤ utilit∙ programs¼ anΣ ╔ wisΦ al∞ author≤ woulΣ d∩ that« I⌠ i≤ nicσ t∩ havσ ì
interactivσ programs¼ bu⌠ i⌠ shoulΣ bσ possiblσ t∩ ruε theφ "batcΦ modeó too.
WitΦ áß worΣ processo≥ o≥ edito≥ onσ expect≤ thσ commanΣ linσ tai∞ t∩ áincludσ ì
thσ áname≤ oµ an∙ file≤ t∩ worδ with« Indeed¼ thi≤ i≤ ZMATE'≤ defaul⌠ áaction« ì
However¼ átherσ áarσ man∙ situation≤ iε whicΦ onσ woulΣ likσ t∩ d∩ ámore« áFo≥ ì
example¼ onσ migh⌠ wan⌠ t∩ star⌠ ZMAT┼ witΦ ß macr∩ alread∙ loadeΣ int∩ onσ oµ ì
thσ áauxiliar∙ ábuffers« áOnσ ámigh⌠ áeveε wan⌠ átha⌠ ámacr∩ át∩ ábσ áexecuteΣ ì
immediately« áTha⌠ macr∩ migh⌠ eveε carr∙ thing≤ t∩ thσ poin⌠ oµ áclosinτ áthσ ì
filσ anΣ exitinτ froφ ZMATEí Iε tha⌠ wa∙ onσ coulΣ usσ ZMAT┼ t∩ creatσ ácustoφ ì
tex⌠ processors.
Ho≈ ái≤ thi≤ done┐ Iε aε earlie≥ columε ╔ describeΣ thσ permanen⌠ ámacr∩ áareß ì
(PMA⌐ iε thσ ZMAT┼ tex⌠ editor« Thi≤ buffe≥ areß iε thσ codσ contain≤ ß se⌠ oµ ì
macro≤ átha⌠ becomσ ß permanen⌠ par⌠ oµ ZMAT┼ anΣ arσ availablσ a⌠ al∞ átimes« ì
Thσ firs⌠ macr∩ iε thσ PM┴ caε bσ designateΣ a≤ aε autoexeπ macr∩ b∙ placinτ ß ì
contro∞-╙ iε fron⌠ oµ i⌠ insteaΣ oµ thσ usua∞ contro∞-X« A≤ sooε a≤ ZMAT┼ áha≤ ì
loadeΣ anΣ initializeΣ itselµ¡-anΣ beforσ i⌠ open≤ an∙ file≤¡-i⌠ execute≤ thi≤ ì
autoexeπ macro.
Herσ ái≤ áß áver∙ simplσ examplσ oµ ß tex⌠ filte≥ ácreateΣ áusinτ áthi≤ áZMAT┼ ì
facility« Supposσ wσ havσ ß macr∩ tha⌠ open≤ ß file¼ goe≤ througΦ i⌠ áchanginτ ì
eacΦ áoµ áit≤ character≤ t∩ uppe≥ case¼ save≤ thσ file¼ anΣ exits« Iµ áwσ ápu⌠ ì
thi≤ ámacr∩ int∩ thσ PM┴ a≤ thσ autoexeπ macr∩ anΣ theε clonσ ZMAT┼ áwitΦ áthσ ì
commanΣ "XDupcase$"¼ wσ wil∞ havσ ß filσ calleΣ UPCASE.COM« Theε wσ caε áente≥ ì
ß commanΣ like
upcasσ infilσ outfile
t∩ perforφ thσ casσ conversioε oε ß file« Thi≤ i≤ jus⌠ ß trivia∞ example« WitΦ ì
thσ áful∞ facilitie≤ oµ ZMAT┼ macros¼ onσ caε easil∙ writσ somσ ver∙ ápowerfu∞ ì
filters.
Wha⌠ ╔ wan⌠ t∩ describσ no≈ i≤ thσ autoexeπ macr∩ tha⌠ ╔ havσ installeΣ iε ám∙ ì
standarΣ áversioε áoµ áZMAT┼ (nameΣ EDIT.COM)« Wσ migh⌠ cal∞ ái⌠ áaε áindirec⌠ ì
macro¼ ásincσ i⌠ allow≤ onσ t∩ specif∙ ß macr∩ fo≥ automatiπ executioε oε áthσ ì
commanΣ line« Somσ samplσ command≤ wil∞ illustratσ ho≈ thi≤ works.
edi⌠ source.z8░ ñ b9σ xicomment.matñ bte
Thσ ápar⌠ áoµ áthσ ácommanΣ u≡ t∩ ß firs⌠ dolla≥ sigε i≤ átakeε áa≤ áthσ áfilσ ì
specification« áIε áthi≤ case¼ thσ assemble≥ sourcσ filσ áSOURCE.Z8░ áwil∞ ábσ ì
opened« áIε áaddition¼ thσ macr∩ followinτ thσ dolla≥ sigε wil∞ ábσ áexecuted« ì
Thi≤ ámacr∩ goe≤ t∩ edi⌠ buffe≥ 9¼ read≤ iε thσ filσ COMMENT.MA╘ containinτ áß ì
macr∩ áfo≥ reformattinτ assembl∙ codσ comments¼ anΣ theε return≤ t∩ áthσ ámaiε ì
editinτ buffer« Thσ followinτ ARUN┌ alia≤ caε automatσ thi≤ (remembe≥ tha⌠ onσ ì
need≤ doublσ dolla≥ sign≤ t∩ represen⌠ ß singlσ '$º characte≥ iε thσ áexpandeΣ ìèscript):
ZED,I╘ edi⌠ $1.z8░ $ñ b9σ xicomment.mat$ñ bte
No≈ wheε ╔ wan⌠ t∩ worδ oε ß Z8░ assemble≥ prograφ filσ calleΣ PROG.Z80¼ ╔ caε ì
ente≥ thσ simplσ command
zeΣ prog
Herσ ái≤ áß samplσ commanΣ linσ fo≥ editinτ m∙ ALIAS.CM─ filσ áwitΦ áautomatiπ ì
searchinτ fo≥ thσ alia≤ definitioε wσ jus⌠ showed.
aleΣ zed
Thσ definitioε fo≥ ALE─ is
ALE─ iµ n⌡ $1;edi⌠ ram:alias.cmd;else;
edi⌠ ram:alias.cmΣ $ñ σ s^m$1$$;fi
Iµ án∩ ásearcΦ ástrinτ i≤ given¼ thσ alia≤ jus⌠ edit≤ thσ file« áIµ áß ástrinτ ì
argumen⌠ ái≤ given¼ theε ZMAT┼ i≤ passeΣ ß macr∩ t∩ searcΦ fo≥ thσ ástrinτ áa⌠ ì
thσ ábeginninτ áoµ ß line« Thσ care⌠ followeΣ b∙ aε 'mº i≤ áinterpreteΣ áa≤ áß ì
contro∞-═ o≥ carriagσ return.
┴ full∙ commenteΣ versioε oµ thσ autoexeπ alia≤ i≤ giveε iε Listinτ 4« Sincσ ╔ ì
tenΣ t∩ usσ buffer≤ froφ botΦ ends¼ keepinτ tex⌠ iε thσ lo≈-numbe≥ buffer≤ anΣ ì
macro≤ áiε áthσ higΦ-numbereΣ buffers¼ fo≥ thσ autoexeπ macr∩ ╔ usσ áß ámiddlσ ì
buffer¼ ánumbe≥ á5« áThσ ámacr∩ switche≤ t∩ i⌠ anΣ átheε áinsert≤ áthσ ástrinτ ì
argumen⌠ passeΣ oε thσ ZMAT┼ commanΣ line« ZMAT┼ ha≤ thσ specia∞ strinτ symbo∞ ì
contro∞-┴-coloε fo≥ this« [Iε thσ listing¼ contro∞ character≤ arσ indicateΣ b∙ ì
leadinτ carets¼ anΣ escapσ character≤ arσ showε a≤ dolla≥ signs« However¼ somσ ì
oµ áthσ ácharacter≤ reall∙ arσ dolla≥ signs¼ anΣ yo⌡ wil∞ áhavσ át∩ ádeterminσ ì
whicΦ arσ whicΦ b∙ thσ context.]
Thσ ánex⌠ áblocδ oµ codσ iε thσ macr∩ remove≤ an∙ leadinτ space« Iµ átherσ ái≤ ì
theε ánothinτ áleft¼ áthσ maiε tex⌠ buffe≥ i≤ reselected¼ áanΣ áthσ ámacr∩ ái≤ ì
aborted.
Thσ ánex⌠ tasδ i≤ t∩ spli⌠ an∙ argument≤ passeΣ int∩ thosσ tha⌠ specif∙ áfile≤ ì
anΣ áthosσ átha⌠ ácomprisσ ß macr∩ t∩ execute« Thσ ácodσ ábegin≤ áb∙ ácheckinτ ì
whethe≥ áthσ firs⌠ characte≥ i≤ ß dolla≥ sigε anΣ savinτ thi≤ áinformatioε áoε ì
thσ stack« Iµ thσ firs⌠ characte≥ i≤ '$'¼ theε n∩ edi⌠ filσ wa≤ specified¼ anΣ ì
thσ áres⌠ áoµ thσ linσ i≤ ß macro« Otherwise¼ wσ tr∙ searchinτ áfo≥ áß ádolla≥ ì
sign« áIµ áonσ i≤ found¼ everythinτ beforσ i⌠¡-whicΦ specifie≤ áthσ áfile≤ át∩ ì
opeε¡-i≤ ámoveΣ át∩ buffe≥ 0« Iµ nonσ i≤ found¼ wσ wil∞ bσ a⌠ thσ enΣ áoµ áthσ ì
buffer¼ anΣ thσ entirσ tex⌠ wil∞ bσ treateΣ a≤ thσ filσ specification.
Thσ ánex⌠ áblocδ áoµ codσ perform≤ somσ specia∞ interpretatioε áoε áan∙ ámacr∩ ì
commanΣ tha⌠ remains« Sincσ thσ CP/═ commanΣ linσ impose≤ somσ limitation≤ áoε ì
thσ character≤ tha⌠ caε bσ passed¼ wσ providσ mean≤ fo≥ indicatinτ thosσ átha⌠ ì
canno⌠ ábσ pu⌠ int∩ thσ commanΣ line« Wheε ß doublσ quotσ characte≥ i≤ áfound¼ ì
i⌠ áái≤ ádeleted¼ áanΣ áthσ ánex⌠ ácharacte≥ ái≤ áalloweΣ át∩ áápas≤ ááwithou⌠ ìèinterpretation« áOtherwise¼ thσ followinτ specia∞ conversion≤ takσ place║ á(1⌐ ì
al∞ áalphabetiπ ácharacter≤ arσ converteΣ froφ uppe≥ casσ t∩ lowe≥ ácase╗ á(2⌐ ì
dolla≥ ásign≤ arσ converteΣ t∩ escapσ characters╗ (3⌐ ß care⌠ i≤ ádeleteΣ áanΣ ì
thσ characte≥ afte≥ i⌠ i≤ converteΣ int∩ thσ correspondinτ contro∞ character.
Oncσ áthσ macr∩ iε buffe≥ ╡ ha≤ beeε full∙ interpreted¼ wσ switcΦ bacδ t∩ áthσ ì
maiε áeditinτ buffer« Iµ thσ Booleaε valuσ oε thσ stacδ i≤ true¼ theε wσ áopeε ì
thσ file≤ (usinτ thσ "XFó macro⌐ specifieΣ b∙ thσ strinτ iε buffe≥ 0« ╔ ádon'⌠ ì
thinδ áwσ átalkeΣ abou⌠ thi≤ beforσ¡-a⌠ leas⌠ no⌠ iε detai∞¡-bu⌠ áthi≤ ái≤ áaε ì
examplσ áoµ thσ wa∙ ZMAT┼ caε usσ thσ content≤ oµ buffer≤ a≤ strinτ áargument≤ ì
fo≥ othe≥ macr∩ commands« Thi≤ greatl∙ enhance≤ ZMATE'≤ power.
Thσ ámacr∩ complete≤ it≤ worδ witΦ threσ morσ steps« Buffe≥ ░ i≤ cleareΣ áout« ì
Theε áthσ ámacr∩ iε buffe≥ ╡ i≤ executed« Finally¼ buffe≥ ╡ ái≤ ácleareΣ áout« ì
That'≤ al∞ fo≥ thσ macro¼ anΣ that'≤ al∞ fo≥ thi≤ columní Seσ yo⌡ agaiε iε thσ ì
nex⌠ issue«
LISTIN╟ 1
╗ Program║ MEXPAT.Z80
╗ Author║ Ja∙ Sage
╗ Created║ Junσ 10¼ 1990
╗ Las⌠ Modified║ Octobe≥ 8¼ 1990
╗ Thi≤ filσ contain≤ ß collectioε oµ patche≤ madσ t∩ Me°-
╗ Plus¼ versioε 1.65.
╗ Thσ followinτ patche≤ arσ included:
;
╗ 1« Changσ thσ functioε oµ thσ backspacσ-t∩-rubout
╗ conversioε functioε t∩ d∩ thσ reversσ ¡¡ make
╗ pressinτ thσ rubout/deletσ ke∙ generatσ ß backspace
╗ character« Thi≤ patcΦ coulΣ bσ useΣ t∩ perforφ the
╗ conversioε oµ an∙ singlσ characte≥ int∩ an∙ other
╗ singlσ character« Thi≤ functioε i≤ invokeΣ b∙ the
╗ STA╘ RU┬ [ON|OFF▌ command.
;
╗ 2« Augmen⌠ thσ STA╘ BUFFE╥ commanΣ s∩ tha⌠ thσ amount
╗ oµ freσ spacσ iε thσ capturσ buffe≥ i≤ returneΣ in
╗ thσ VALU┼ variable« ME╪ script≤ caε theε checδ on
╗ thσ remaininτ spacσ anΣ decidσ t∩ flusΦ thσ buffer
╗ manuall∙ a⌠ convenien⌠ time≤ anΣ t∩ avoiΣ overflow
╗ problem≤ tha⌠ caε occu≥ wheε relyinτ oε XON/XOFF
╗ control.
;
╗ 3« Augmen⌠ thσ BEL╠ commanΣ s∩ tha⌠ pressinτ an∙ key
╗ wil∞ terminatσ it« Thσ standarΣ ME╪ BEL╠ command
╗ caε bσ cancelleΣ onl∙ b∙ contro∞-C¼ bu⌠ this
╗ terminate≤ thσ entirσ script« No≈ thσ bel∞ can
╗ sounΣ unti∞ thσ operato≥ presse≤ ß noε-abor⌠ key¼ at
╗ whicΦ poin⌠ thσ scrip⌠ wil∞ proceed.
╗ Addresse≤ iε standarΣ codeè
ilprin⌠ eq⌡ 0724fΦ ╗ Iε-linσ print
hlsubde2 equ 0417ah ; Subtraction of DE from HL
capstats equ 06eafh ; CAPSTATS function
scrollconin equ 049d3h ; Console input
getconstat equ 049c5h ; Console status
bell2 equ 046c2h ; BELL2 entry point
val equ 00d64h ; VALUE variable
logo equ 02662h ; LOGO entry point
endlogo equ 027b9h ; First byte past LOGO code
saycap equ 06ea6h ; Point to patch in
; ...SAYCAPSTATS
bellins equ 046aeh + 10 ; Point to patch in BELL
oldkey equ 5351h ; Place where key typed by
; ...user is detected
newkey equ 535dh ; Place where new character
; ...is substituted
idstr equ 62a6h ; Place where STAT command
; ...message is defined
bs equ 8 ; Backspace character
lf equ 10 ; Linefeed
cr equ 13 ; Carriage return
rubout equ 127 ; Rubout character
; ---------------------------------------------------------
; Standard MEX-Plus has a very elaborate signon screen that
; affords a perfect place to put the code we need for our
; patches. The first thing we do is to replace the LOGO
; routine with a minimal message.
org logo
call ilprint
db cr,lf
db 'MEX v 1.65Z, 06/10/90'
db cr,lf,lf,0
ret
; Make the STAT BUFFER command put the amount of free
; capture buffer space into the VALUE variable. We do this
; by patching some extra code into the SAYCAPSTATS routine.
cappat:
call capstats ; Get status info on capture
; ...buffer
push hlè ld h,b ; Free space (BC) into HL
ld l,c
ld (val),hl ; Put it into VALUE
pop hl
jp capcont
; This is a new routine that checks to see if ANY key has
; been pressed, not just control-c. It will be used in the
; patched BELL routine.
chkchar:
call getconstat ; See if key pressed
ret z ; Return now if not
flush:
call scrollconin ; Read in the character
or a ; Set flag to nonzero
ret
; ---------------------------------------------------------
; Code for cutting into the original code in CAPSTATS
org saycap
jp cappat
capcont:
; ---------------------------------------------------------
; Code for patching the original code in BELL
org bellins
call chkchar ; See if key pressed
jp nz,bell2 ; If so, cancel BELL command
; ---------------------------------------------------------
; Patch to backspace-to-rubout conversion function
org oldkey
db rubout
org newkey
db bs
org idstr
; 'bs-to-rub conversn' ; String in standard MEX
db 'rub-to-bs conversn' ; You must fill same space
endè
LISTIN╟ 2
{
MAP.ZEX
This ZEX5 script runs the XBIOS MAP utility that sets
a drive to a designated virtual disk format. Since
MAP itself does not allow command-line parameters, ZEX
is used to pass a parameter. We use foreign formats
only on the 48-tpi drive G: and hence always supply the
input "G". The argument to the script is the number of
the desired format.
}
b0:map
<G$1
LISTIN╟ 3
{
FORMAT.ZEX
This ZEX5 script invokes the XBIOS format program FVCD
and feeds it input to perform the desired diskette
formatting operation. The following arguments are
recognized:
<none> manual operation of FVCD
F or F: SB180 DSQD format in drive F
G or G: SB180 DSDD format in drive G
KP2 or KP2: Kaypro SSDD format in drive G
}
;; SB180 DSQD Formatting
if eq :f: :$1 ;; Test for "F:"
or eq :f :$1 ;; Test for "F"
|if true|
b0:fvcd
<OSXTFF2|cr|
|say|
Formatting in SB180 DSQD format complete.
|end say|
|abort|
|endif|
fi
;; SB180 DSDD Formatting
if eq :g: :$1 ;; Test for "G:"
or eq :g :$1 ;; Test for "G"
|if true|èb0:fvcd
<OSXTGF
|"|
Formatting in SB180 DSDD format complete.
|"|
|abort|
|endif|
fi
;; Kaypro SSDD Formatting
if eq :kp2: :$1 ;; Test for "KP2:"
or eq :kp2 :$1 ;; Test for "KP2"
|if true|
b0:fvcd
<OSXTGF6|cr|
|"|
Formatting in Kaypro 2 (SSDD) format complete.
|"|
|abort|
|endif|
fi
;; Manual Formatting
if eq :$1 : ;; Test for no argument
|if true|
b0:fvcd
<OSXTGF|until|
|"|
Formatting in interactive mode complete.
|"|
|abort|
|endif|
fi
;; We get here if an illegal argument was given
|"|
--> Illegal format specification given: $1 $2 $3
|"|
LISTIN╟ 4
;Autoexec Macro
; This macro allows ZMATE to be invoked with a macro on the
; command line. The syntax is as follows:
;
; ZMATE [infile [outfile]][$<macro>]è;
; The macro line is processed using a special syntax. All
; letters are normally converted to lower case; characters
; following a '^' are converted to the corresponding control
; character and dollar signs are converted to escape
; characters. However, a character following a '"' is taken
; literally so that upper case characters, dollar signs, and
; carets can be entered.
B5E ; go to buffer 5
I^A: ; read in command tail
A ; go to beginning
T ; tag it
[@T>" _M] ; move to first non-space, non-
; ...control character
#D ; delete the white space
@T=0{ ; IF nothing left
BTE ; go to T buffer
% ; terminate this macro
} ; ENDIF
@T="${ ; IF line starts with dollar sign
D ; delete it
0, ; push 0 (false ) onto stack
}{ ; ELSE
-1, ; push -1 (true) onto the stack
E ; suppress error trapping
S$$ ; search for a '$' separator
@E{ ; IF none found
Z ; go to end of buffer
}{ ; ELSE
-D ; delete the '$' separator
} ; ENDIF
#B0M ; move file name specs to buffer 0
} ; ENDIF
[ ; REPEAT
@T<"A!(@T>"Z)'{ ; IF upper case letter
@T!96R ; replace with lower case
^ ; loop back
} ; ENDIF
@T=""{ ; IF character is double quote
D ; delete it
M ; move past next character
^ ; loop back
} ; ENDIF
@T="^{ ; IF character is caret
D ; delete it
@T&31R ; convert next char to control
^ ; loop back
} ; ENDIFè @T="${ ; IF character is dollar sign
"$R ; replace it by escape char
^ ; loop back
} ; ENDIF
M ; (otherwise) move past the char
@T=0] ; UNTIL end of text
BTE ; go to T buffer
@S{ ; IF stack was true
XF^A@0$ ; open the file spec in buffer 0
} ; ENDIF
B0K ; clear buffer 0
.5 ; execute macro in buffer 5
B5K ; clear buffer 5
EN─ O╞ LISTINGS
[This article was originally published in issue 48 of The Computer Journal,
P.O. Box 12, South Plainfield, NJ 07080-0012 and is reproduced with the
permission of the author and the publishe≥« Furthe≥ reproductioε fo≥ non-
commercia∞ purpose≤ i≤ authorizeΣ« Thi≤ copyrigh⌠ noticσ mus⌠ bσ retained.
(c⌐ Copyrigh⌠ 1990¼ 199▒ Socrate≤ Pres≤ anΣ respectivσ authors]