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
/
TCJ45.LBR
/
TCJ45.WZ
/
TCJ45.WS
Wrap
Text File
|
2000-06-30
|
26KB
|
479 lines
Z-System Corne≥ (c)
by Jay Sage
The Computer Journal, Issue 45
Reproduced with permission
of author and publisher
A Mex-Plus Script for Using PC-Pursuit
Las⌠ timσ wσ gavσ yo⌡ ß prett∙ thorougΦ presentatioε oµ thσ scrip⌠ languagσ ì
froφ áthσ ME╪-Plu≤ telecommunication≤ program« However¼ a≤ necessar∙ a≤ ásucΦ ì
documentatioε áis¼ i⌠ doe≤ no⌠ reall∙ teacΦ onσ ho≈ t∩ makσ effectivσ áusσ áoµ ì
thσ language« S∩ thi≤ timσ wσ wil∞ presen⌠ a≤ ß teachinτ examplσ ásignifican⌠ ì
portion≤ áoµ thσ scrip⌠ suitσ tha⌠ ╔ usσ fo≥ almos⌠ al∞ ám∙ átelecommunicatioε ì
work« á I⌠ ái≤ thσ mos⌠ comple° scrip⌠ tha⌠ ╔ havσ eve≥ áwritten¼ áillustrate≤ ì
man∙ techniques¼ anΣ migh⌠ bσ ver∙ usefu∞ t∩ man∙ oµ yo⌡ a≤ well.
Thi≤ áscrip⌠ i≤ fa≥ froφ perfect« Ever∙ timσ ╔ worδ witΦ ME╪-Plu≤ ╔ álearε ì
somethinτ ámorσ áabou⌠ áit¼ anΣ tha⌠ wa≤ ß largσ par⌠ áoµ ám∙ ámotivatioε áfo≥ ì
writinτ áthesσ átw∩ columns« A≤ usual¼ ╔ hopσ tha⌠ somσ astutσ áreader≤ áwil∞ ì
noticσ way≤ t∩ improvσ oε m∙ script.
More MEX Commands
Beforσ ágettinτ áint∩ thσ scrip⌠ itself¼ ╔ havσ ß fe≈ item≤ t∩ adΣ át∩ áthσ ì
discussioε froφ las⌠ time« First¼ ╔ forgo⌠ t∩ mentioε onσ extremel∙ importan⌠ ì
ME╪ ácommand╗ second¼ jus⌠ toda∙ ╔ discovereΣ somσ morσ undocumenteΣ ácommand≤ ì
tha⌠ appea≥ t∩ bσ quitσ interesting.
Thσ WAI╘ Command
Thσ WAI╘ commanΣ i≤ onσ oµ MEX'≤ mos⌠ importan⌠ commands« I⌠ allow≤ ME╪ t∩ ì
monito≥ áthσ characte≥ streaφ cominτ bacδ froφ thσ remotσ systeφ anΣ át∩ átakσ ì
variou≤ áaction≤ ádependinτ oε wha⌠ i⌠ sees« Therσ arσ fou≥ variant≤ áoµ áthσ ì
command║ WAI╘ DATE¼ WAI╘ TIME¼ WAI╘ SILENCE¼ anΣ WAI╘ STRING.
Thσ áfirs⌠ átw∩ form≤ causσ thσ scrip⌠ t∩ pausσ unti∞ ß specifieΣ ádatσ áo≥ ì
timσ áarrives« á Obviously¼ yo⌡ mus⌠ havσ ß rea∞-timσ clocδ anΣ áß áME╪ áclocδ ì
modulσ installeΣ fo≥ thesσ command≤ t∩ work« Thσ commanΣ form≤ are:
WAI╘ DAT┼ mm/dd
WAI╘ TIM┼ hh:mm
Thesσ ácommand≤ áwoulΣ bσ usefu∞ fo≥ ß scrip⌠ t∩ automaticall∙ áplacσ áß ácal∞ ì
durinτ thσ middlσ oµ thσ nigh⌠ wheε phonσ rate≤ arσ lower
Thσ WAI╘ SILENC┼ commanΣ wait≤ unti∞ n∩ character≤ havσ beeε receiveΣ áfroφ ì
thσ ámodeφ fo≥ ß specifieΣ timσ interval« Thi≤ i≤ onσ wa∙ t∩ infe≥ átha⌠ áthσ ì
remotσ ásysteφ ha≤ finisheΣ wha⌠ i⌠ wa≤ doinτ anΣ i≤ read∙ fo≥ ß commanΣ áfroφ ì
you« Thσ synta° is
è WAI╘ SILENC┼ [time]
Thσ mos⌠ powerfu∞ oµ thσ WAI╘ command≤ i≤ WAI╘ STRING¼ whosσ ful∞ synta° is
WAI╘ STRIN╟ [time▌ string▒ [string▓ string│ string4]
Thi≤ commanΣ take≤ froφ onσ t∩ fou≥ strinτ expression≤ anΣ aε optiona∞ wai⌠ ì
time¼ whicΦ otherwisσ default≤ t∩ value≤ se⌠ b∙ STA╘ parameters« Thσ ácommanΣ ì
terminate≤ áa≤ ásooε áa≤ áonσ oµ thσ string≤ i≤ detecteΣ áo≥ áthσ átimσ álimi⌠ ì
expires« á Thσ VALU┼ variablσ tell≤ yo⌡ thσ result« I⌠ wil∞ bσ ░ iµ thσ átimσ ì
limi⌠ wa≤ reacheΣ o≥ 1¼ 2¼ 3¼ o≥ ┤ dependinτ oε whicΦ strinτ wa≤ matched« Yo⌡ ì
wil∞ áseσ áß numbe≥ oµ example≤ oµ thσ usσ oµ thi≤ commanΣ áiε ám∙ áP├-Pursui⌠ ì
script.
UndocumenteΣ Commands
ME╪ áha≤ quitσ ß numbe≥ oµ undocumenteΣ commands« Thesσ caε bσ ádiscovereΣ ì
b∙ doinτ ß memor∙ dum≡ oµ MEX.CO═ anΣ lookinτ fo≥ thσ commanΣ dispatcΦ átable« ì
Scanninτ áprogramsº commanΣ table≤ t∩ seσ wha⌠ goodie≤ migh⌠ havσ ábeeε ábuil⌠ ì
int∩ theφ tha⌠ thσ author≤ ¡¡ fo≥ onσ reasoε o≥ anothe≥ ¡-decideΣ no⌠ t∩ átel∞ ì
yo⌡ áabou⌠ i≤ ß grea⌠ sport« ╔ wil∞ mentioε onl∙ ß fe≈ oµ thσ ME╪ command≤ á╔ ì
discovereΣ thi≤ way.
First¼ therσ arσ somσ command≤ tha⌠ arσ jus⌠ alternatσ name≤ fo≥ documenteΣ ì
functions« á Fo≥ example¼ therσ i≤ ß RENAM┼ commanΣ tha⌠ vector≤ t∩ áthσ ásamσ ì
codσ tha⌠ thσ RE╬ commanΣ does.
Since¼ áa≤ ╔ mentioneΣ las⌠ time¼ therσ seemeΣ t∩ bσ ß paucit∙ oµ áway≤ át∩ ì
ge⌠ áou⌠ oµ ME╪ (onl∙ abou⌠ si° commands!)¼ ╔ wa≤ quitσ relieveΣ át∩ ádiscove≥ ì
thσ ácommanΣ áABORTMEX¼ whicΦ appear≤ t∩ offe≥ ye⌠ anothe≥ wayí á Actually¼ á╔ ì
havσ ááß áárecollectioε áoµ áhavinτ áseeε átha⌠ ácommanΣ ásomewherσ ááiε ááthσ ì
documentation¼ ábu⌠ i⌠ i≤ no⌠ listeΣ iε thσ inde° anΣ ╔ canno⌠ finΣ i⌠ áagain« ì
Froφ examininτ thσ dispatcΦ vectors¼ ╔ caε tel∞ tha⌠ ABORTME╪ i≤ no⌠ thσ ásamσ ì
thinτ a≤ CPM¼ EXIT¼ QUIT¼ anΣ s∩ on¼ bu⌠ i⌠ seem≤ t∩ d∩ thσ samσ thing.
Onσ commanΣ tha⌠ ╔ thinδ wil∞ provσ quitσ usefu∞ i≤ thσ PAUS┼ command« áIt≤ ì
synta° appear≤ t∩ bσ likσ tha⌠ oµ thσ undocumenteΣ PRINT« Whateve≥ tex⌠ come≤ ì
afte≥ i⌠ i≤ echoeΣ t∩ thσ screen¼ anΣ thσ scrip⌠ theε pause≤ unti∞ an∙ ke∙ ái≤ ì
pressed.
Thσ áME═ ácommanΣ lookeΣ a≤ thougΦ i⌠ wa≤ goinτ t∩ bσ quitσ useful¼ áa≤ ái⌠ ì
display≤ áthσ statu≤ oµ MEX'≤ memor∙ buffer« Thσ troublσ is¼ ╔ havσ no⌠ ábeeε ì
ablσ át∩ figurσ ou⌠ wha⌠ buffe≥ thi≤ isí ╔ starteΣ ß capturσ buffer¼ anΣ áME═ ì
stil∞ showeΣ thσ samσ value≤ anΣ reporteΣ tha⌠ nonσ oµ thσ buffe≥ wa≤ iε áuse« ì
Theε á╔ pu⌠ thσ commanΣ iε ß scrip⌠ file¼ thinkinτ i⌠ migh⌠ repor⌠ thσ ástatu≤ ì
oµ áthσ scrip⌠ buffer« Alas¼ thσ repor⌠ wa≤ stil∞ thσ same« Perhap≤ thi≤ ái≤ ì
jus⌠ áß commanΣ tha⌠ wa≤ neve≥ full∙ coded« Al∞ ╔ caε sa∙ i≤ tha⌠ thσ ábuffe≥ ì
sizσ reporteΣ doe≤ depenΣ oε thσ sizσ oµ one'≤ TPA.
Anothe≥ áver∙ áinterestinτ ácommanΣ i≤ WIN« It≤ ánamσ ásuggesteΣ átha⌠ ái⌠ ì
createΣ ásomσ ákinΣ áoµ áwindow¼ áanΣ indeeΣ i⌠ ádoes« á I⌠ ái≤ áprobabl∙ áno⌠ ì
documenteΣ ábecausσ i⌠ doe≤ no⌠ seeφ t∩ worδ completel∙ correctly« ╔ áentereΣ ìèthσ command
WI╬ ╡ ╡ 1▓ 75
anΣ áME╪ ádre≈ ß partia∞ bo° oµ thσ sor⌠ tha⌠ "BO╪ ╡ ╡ 1▓ 75ó woulΣ áhavσ áanΣ ì
theε ápu⌠ áit≤ ápromp⌠ a⌠ thσ uppe≥ lef⌠ corne≥ oµ thσ áwindow« á Afte≥ áthat¼ ì
screeε áoutpu⌠ áwa≤ árestricteΣ t∩ thσ line≤ iε thσ window¼ ábu⌠ áthσ álatera∞ ì
limit≤ áoµ thσ windo≈ werσ no⌠ observed╗ tex⌠ stil∞ raε acros≤ thσ ful∞ áwidtΦ ì
oµ thσ screen« Thσ STA╘ commanΣ woulΣ fil∞ jus⌠ thσ windo≈ anΣ theε wai⌠ áfo≥ ì
ß keypres≤ t∩ continue« Oµ course¼ ╔ diΣ m∙ test≤ froφ thσ commanΣ line¼ áanΣ ì
WI╬ ma∙ ac⌠ differentl∙ iµ invokeΣ froφ ß scrip⌠ file.
Thσ á"@ó ácommanΣ curso≥ addressinτ coulΣ stil∞ takσ onσ áanywherσ áoε áthσ ì
screen« á Thus¼ ái⌠ look≤ a≤ thougΦ thσ WI╬ commanΣ migh⌠ bσ áusefu∞ áiε ásomσ ì
specia∞ ácase≤ áwherσ áonσ want≤ t∩ kee≡ certaiε ástatu≤ áinformatioε áoε áthσ ì
screen« á Thσ áwindo≈ ácoulΣ bσ se⌠ t∩ thσ las⌠ 2░ line≤ oε áthσ áscreen¼ áanΣ ì
statu≤ áinformatioε coulΣ bσ writteε usinτ "└ SAYó t∩ thσ region≤ outsidσ áthσ ì
window.
Anothe≥ ácommanΣ áwhosσ áfunctioε ╔ though⌠ ╔ coulΣ águes≤ áwa≤ áFLUSH« á ╔ ì
assumeΣ tha⌠ i⌠ flushe≤ thσ content≤ oµ ß buffer¼ perhap≤ thσ capturσ ábuffer« ì
However¼ á╔ átrieΣ ái⌠ witΦ ß capturσ buffer¼ anΣ nothinτ áseemeΣ át∩ áhappen« ì
Therσ mus⌠ bσ somethinτ morσ subtlσ abou⌠ it.
Finally¼ therσ arσ thσ command≤ DUPE¼ RESTORE¼ TRAP¼ LIB¼ EXEC¼ OVRINI╘ anΣ ì
probabl∙ ß fe≈ others.
┴ Challenge
╔ wil∞ offe≥ aε unspecifieΣ prizσ t∩ thσ use≥ wh∩ doe≤ somσ detectivσ áworδ ì
anΣ ásend≤ mσ thσ mos⌠ completσ documentatioε oε thesσ undocumenteΣ ácommands« ì
┴ áfreσ cop∙ oµ thσ Me°-Pacδ termina∞ emulatioε anΣ remotσ áoperatioε ámodule≤ ì
migh⌠ ábσ áß áfittinτ prize« O≥ perhap≤ ß cop∙ oµ thσ ne≈ áZMAT┼ ámacr∩ átex⌠ ì
editor.
╔ áals∩ havσ somσ recollectioε tha⌠ someonσ oncσ figureΣ ou⌠ ß wa∙ át∩ áusσ ì
eithe≥ áthσ ástring≤ assigneΣ t∩ key≤ o≥ thσ name≤ iε thσ phonσ ádirector∙ áa≤ ì
strinτ variables« S∩ far¼ however¼ ╔ havσ no⌠ beeε ablσ t∩ figurσ ou⌠ ho≈ át∩ ì
d∩ áit« We'l∞ includσ tha⌠ anΣ an∙ othe≥ undocumenteΣ informatioε abou⌠ áME╪-ì
Plu≤ withiε thσ frameworδ oµ thi≤ challenge.
No≈ let'≤ begiε thσ looδ a⌠ thσ PC╨ script.
The PC-Pursuit Script
Thσ Purpose
Thσ purposσ oµ thi≤ suitσ oµ ME╪ script≤ i≤ t∩ makσ lifσ witΦ P├-
Pursui⌠ áeasier« á Beforσ áthσ árecen⌠ change≤ iε policy¼ áusinτ áPC╨ áwa≤ áaε ì
enormousl∙ áfrustratinτ áexperience« Thσ outdia∞ modem≤ áwerσ áalmos⌠ áalway≤ ì
busy¼ anΣ i⌠ sometime≤ tooδ dozen≤ o≥ eveε hundred≤ oµ trie≤ t∩ ge⌠ áconnecteΣ ìèt∩ áß ádesireΣ ácit∙ á¡¡ eacΦ tr∙ requirinτ onσ t∩ ente≥ áone'≤ áuse≥ áI─ áanΣ ì
password« Today¼ witΦ thσ 3░-hou≥ limi⌠ oε freσ access¼ thing≤ arσ much¼ mucΦ ì
better¼ ábu⌠ ái⌠ i≤ stil∞ hand∙ t∩ havσ ß scrip⌠ takσ carσ áoµ áthσ áoperatioε ì
automatically.
Herσ ái≤ ábasicall∙ áwha⌠ m∙ scrip⌠ does« I⌠ call≤ u≡ áthσ áloca∞ áTelene⌠ ì
acces≤ poin⌠ anΣ issue≤ thσ command≤ t∩ se⌠ u≡ thσ prope≥ termina∞ mode« áTheε ì
i⌠ negotiate≤ ß connectioε t∩ thσ cit∙ wherσ thσ selecteΣ remotσ acces≤ systeφ ì
(RAS⌐ ái≤ álocated« Iµ al∞ thσ modem≤ iε tha⌠ cit∙ arσ busy¼ thσ áscrip⌠ ácaε ì
kee≡ átrying« Iµ al∞ thσ 240░ bp≤ modem≤ arσ busy¼ i⌠ caε eveε áautomaticall∙ ì
ste≡ dowε anΣ tr∙ thσ 120░ bp≤ modems« Today¼ onσ rarel∙ fail≤ t∩ connec⌠ áoε ì
thσ áfirs⌠ átr∙ áa⌠ 2400¼ bu⌠ iε thσ pas⌠ thσ ámultiplσ átrie≤ áanΣ áautomatiπ ì
stepdowε werσ lifesavers.
Oncσ thσ connectioε t∩ thσ cit∙ ha≤ beeε established¼ thσ scrip⌠ issue≤ thσ ì
command≤ át∩ ápu⌠ thσ remotσ modeφ int∩ Raca∞ Vadiπ modσ anΣ átheε ádial≤ áthσ ì
numbe≥ áfo≥ thσ RAS« Iε Vadiπ mode¼ thσ modeφ issue≤ cal∞ statu≤ reports¼ ás∩ ì
yo⌡ ákno≈ wheε thσ modeφ i≤ dialing¼ wheε thσ phonσ i≤ ringing¼ wheε thσ álinσ ì
i≤ ábusy¼ anΣ wheε thσ cal∞ ha≤ simpl∙ failed« Thσ ME╪ scrip⌠ monitor≤ áthesσ ì
report≤ anΣ respond≤ appropriately.
Oncσ áthσ remotσ systeφ ha≤ beeε reached¼ ß ver∙ shor⌠ scrip⌠ i≤ áinitiateΣ ì
s∩ tha⌠ ß maximuφ amoun⌠ oµ memor∙ wil∞ bσ freσ fo≥ ME╪ t∩ usσ fo≥ it≤ capturσ ì
anΣ filσ transfe≥ buffers« Thσ scrip⌠ als∩ program≤ severa∞ functioε key≤ át∩ ì
makσ logginτ ont∩ thσ RA╙ easier.
I⌠ woulΣ bσ quitσ eas∙ t∩ havσ thσ PC╨ scrip⌠ chaiε t∩ ß scrip⌠ t∩ áperforφ ì
thσ ácompletσ álogiε operation¼ bu⌠ ╔ generall∙ prefe≥ t∩ ád∩ áthi≤ ámanually« ì
Tha⌠ ágive≤ ámσ áß chancσ t∩ noticσ iµ therσ arσ an∙ ne≈ ábulletin≤ áo≥ áothe≥ ì
change≤ iε thσ system.
Desigε Philosophy
Tw∩ ámaiε áprinciple≤ guideΣ thσ desigε oµ thσ scrip⌠ suite« First¼ áa≤ á╔ ì
mentioneΣ las⌠ time¼ ╔ madσ i⌠ highl∙ modular« Thi≤ make≤ writinτ thσ áscrip⌠ ì
easie≥ anΣ cleare≥ but¼ morσ importantly¼ i⌠ overcome≤ memor∙ limitations« B∙ ì
chaininτ áfroφ onσ scrip⌠ t∩ another¼ onl∙ onσ scrip⌠ ha≤ t∩ bσ iε ámemor∙ áa⌠ ì
onσ time« B∙ makinτ thσ las⌠ scrip⌠ ß ver∙ smal∞ one¼ almos⌠ n∩ buffe≥ áspacσ ì
i≤ los⌠ durinτ thσ timσ thσ use≥ i≤ workinτ oε thσ remotσ system¼ eveε áthougΦ ì
ß scrip⌠ i≤ stil∞ iε operation.
Thσ seconΣ principlσ i≤ t∩ providσ a≤ mucΦ erro≥ checkinτ a≤ possible« áFo≥ ì
example¼ a⌠ thσ ver∙ beginning¼ thσ scrip⌠ check≤ t∩ makσ surσ tha⌠ thσ áloca∞ ì
modeφ ái≤ áconnected¼ turneΣ on¼ anΣ responding« ╔ learneΣ t∩ d∩ áthi≤ áafte≥ ì
tryinτ man∙ time≤ t∩ ruε thi≤ anΣ othe≥ script≤ witΦ thσ modeφ turneΣ off.
Iε it≤ presen⌠ form¼ wheε aε erro≥ i≤ detected¼ thσ scrip⌠ normall∙ áissue≤ ì
aε áexplanator∙ ámessagσ anΣ theε terminates« I⌠ woulΣ bσ bette≥ át∩ áprovidσ ì
erro≥ árecover∙ whereve≥ possible« Fo≥ example¼ havinτ discovereΣ áthσ áPAUS┼ ì
command¼ á╔ ámigh⌠ no≈ improvσ thσ scrip⌠ b∙ makinτ i⌠ pausσ áunti∞ áthσ áuse≥ ì
turn≤ thσ modeφ oε anΣ presse≤ ß key« Theε thσ scrip⌠ woulΣ loo≡ bacδ anΣ tr∙ ì
again.è
Therσ áarσ áquitσ ß fe≈ place≤ iε thσ scrip⌠ wherσ i⌠ wil∞ retr∙ áß áfaileΣ ì
operatioε ásevera∞ time≤ beforσ i⌠ give≤ up« Sometime≤ P├-Pursui⌠ jus⌠ áseem≤ ì
t∩ ág∩ ou⌠ t∩ lunch¼ anΣ ╔ havσ beeε unablσ t∩ ge⌠ an∙ responsσ froφ ái⌠ áeveε ì
witΦ ámanuall∙ entereΣ commands« Iε sucΦ cases¼ oµ course¼ therσ ái≤ ánothinτ ì
morσ tha⌠ thσ scrip⌠ caε do.
Architecture
Beforσ talkinτ abou⌠ thσ detaileΣ function≤ oµ eacΦ modulσ iε thσ script¼ ╔ ì
woulΣ álikσ át∩ ádescribσ thσ architecture« Therσ arσ ╢ ámodules¼ áanΣ áthei≥ ì
relationship≤ arσ showε iε Fig« 1.
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
CPM
|
v
PCP.MEX
|
|
v
+-------------> PCPMENU.MEX <----------+
| / | \ |
| / v \ |
| / CPM \ |
| v v |
| PCPDATA.MEX PCPMAN.MEX -->+
| \ / |
| \ / |
| v v |
| PCPCALL ------------->+
| |
| |
| v
+----------------- PCPCONN
Figurσ á1« Thi≤ show≤ thσ architectura∞ organizatioε oµ thσ suitσ áoµ áscrip⌠ ì
file≤ tha⌠ comprisσ thσ completσ thσ PC╨ script.
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Thσ ácentra∞ áscrip⌠ i≤ iε thσ filσ PCPMENU.MEX« á Thσ áinvocatioε áscript¼ ì
PCP.MEX¼ áperform≤ ásomσ áonσ-timσ operation≤ anΣ theε átransfer≤ ácontro∞ át∩ ì
PCPMENU« Afte≥ that¼ contro∞ branche≤ t∩ othe≥ script≤ bu⌠ eventuall∙ return≤ ì
t∩ thσ men⌡ script« I⌠ i≤ onl∙ froφ PCPMEN╒ tha⌠ thσ scrip⌠ caε bσ terminateΣ ì
anΣ contro∞ returneΣ t∩ CP/═ iε ß gracefu∞ fashion.
Thσ datß needeΣ t∩ connec⌠ t∩ ß remotσ systeφ caε bσ supplieΣ iε tw∩ áways« ì
First¼ thσ men⌡ displayeΣ b∙ PCPMEN╒ list≤ man∙ commonl∙ calleΣ systems« Wheε ìèonσ áoµ áthesσ ái≤ áselected¼ contro∞ branche≤ t∩ áPCPDATA¼ áwhicΦ áload≤ áthσ ì
requireΣ datß int∩ ME╪ numerica∞ anΣ strinτ variable≤ anΣ functioε keys.
Alternatively¼ átherσ i≤ ß choicσ fo≥ contactinτ ß RA╙ tha⌠ i≤ no⌠ áoε áthσ ì
menu« á Iε áthi≤ case¼ thσ scrip⌠ PCPMA╬ (shor⌠ fo≥ áPCPMANUAL⌐ áprovide≤ áfo≥ ì
ste≡-b∙-step¼ ámen⌡-driveε áentr∙ oµ thσ requireΣ information« á Iµ áthσ áuse≥ ì
decide≤ áagains⌠ ámakinτ átha⌠ ácall¼ contro∞ ácaε ábσ áreturneΣ át∩ áPCPMENU« ì
Normally¼ however¼ contro∞ froφ eithe≥ PCPDAT┴ o≥ PCPMA╬ flow≤ t∩ PCPCALL.
PCPCAL╠ ácarrie≤ ou⌠ thσ operation≤ requireΣ t∩ makσ P├-Pursui⌠ connec⌠ át∩ ì
thσ árequesteΣ cit∙ anΣ theε dia∞ thσ requesteΣ loca∞ telephonσ ánumber« áWheε ì
eithe≥ áthσ áPC╨ o≥ RA╙ modem≤ i≤ busy¼ thσ scrip⌠ allow≤ thσ use≥ át∩ ádecidσ ì
whethe≥ át∩ ácontinuσ átryinτ áanΣ ho≈ man∙ times« á Iµ áthσ ácal∞ ácanno⌠ ábσ ì
completeΣ áanΣ thσ use≥ doe≤ no⌠ wan⌠ t∩ continuσ trying¼ contro∞ áreturn≤ át∩ ì
PCPMENU.
Iµ áthσ áremotσ systeφ i≤ reached¼ contro∞ i≤ passeΣ t∩ áthσ ásmal∞ áscrip⌠ ì
PCPCON╬ á(shor⌠ áfo≥ áPCPCONNECTED)« Wσ showeΣ thi≤ scrip⌠ áiε áthσ ápreviou≤ ì
column« á I⌠ áput≤ thσ use≥ int∩ termina∞ modσ fo≥ login« Wheneve≥ áthσ áuse≥ ì
exit≤ bacδ t∩ ME╪ commanΣ mode¼ ß promp⌠ i≤ pu⌠ up« Enterinτ thσ commanΣ á"Mó ì
return≤ ácontro∞ t∩ PCPMENU« Othe≥ ME╪ command≤ caε bσ entereΣ a≤ áusua∞ áfo≥ ì
transferrinτ files¼ openinτ capturσ buffers¼ changinτ STA╘ parameters¼ anΣ ás∩ ì
on.
Thi≤ scrip⌠ suitσ doe≤ no⌠ makσ usσ oµ an∙ subroutinσ script≤ invokeΣ usinτ ì
thσ áD╧ command« Iε al∞ cases¼ contro∞ i≤ transferreΣ permanentl∙ t∩ áanothe≥ ì
scrip⌠ áusinτ áthσ áREA─ command« Therσ arσ somσ ásubroutinσ ácommanΣ áblock≤ ì
defineΣ b∙ thσ PRO├ anΣ END╨ commands« Thesσ subroutine≤ arσ containeΣ withiε ì
thσ scrip⌠ filσ becausσ the∙ executσ faste≥ tha⌠ wa∙ anΣ becausσ therσ wa≤ án∩ ì
reasoε iε mos⌠ case≤ t∩ implemen⌠ theφ a≤ separatσ files.
Wσ áwil∞ áno≈ makσ ß fe≈ comment≤ abou⌠ detail≤ oµ áthσ áindividua∞ áscrip⌠ ì
files« Becausσ thσ codσ i≤ quitσ lengthy¼ wσ arσ unablσ t∩ prin⌠ i⌠ al∞ here« ì
Man∙ áwholσ section≤ havσ beeε removed¼ anΣ somσ comment≤ havσ beeε ácu⌠ áout« ì
However¼ átherσ arσ severa∞ way≤ t∩ obtaiε thσ completσ scripts« áFirst¼ áthe∙ ì
wil∞ áprobabl∙ ábσ áincludeΣ oε thσ ZSU╙ (┌-Systeφ áSoftwarσ áUpdatσ áService⌐ ì
subscriptioε ádisδ átha⌠ ái≤ releaseΣ a⌠ abou⌠ thσ timσ áthi≤ áissuσ áappears« ì
Second¼ thσ file≤ wil∞ bσ posteΣ oε RASs« Finally¼ Ar⌠ Carlsoε ha≤ offereΣ t∩ ì
makσ átheφ availablσ t∩ subsriber≤ wh∩ senΣ hiφ ß formatted¼ labeleΣ ádiskettσ ì
witΦ returε postagσ anΣ mailer.
Scrip⌠ PCP.MEX
Thi≤ áscrip⌠ á(Listinτ á1⌐ initialize≤ ß numbe≥ oµ ávariables« á Notσ átha⌠ ì
variable≤ átha⌠ áthσ áuse≥ ái≤ likel∙ t∩ wan⌠ t∩ áchangσ áarσ áplaceΣ áa⌠ áthσ ì
beginninτ áoµ thσ script« Als∩ notσ tha⌠ certaiε value≤ tha⌠ coulΣ havσ ábeeε ì
harΣ codeΣ int∩ thσ script¼ sucΦ a≤ thσ defaul⌠ numbe≥ oµ trie≤ t∩ connec⌠ át∩ ì
ß ácity¼ áarσ storeΣ insteaΣ iε numerica∞ variables« Thi≤ i≤ likσ áusinτ áEQ╒ ì
parameter≤ iε assembl∙ codσ anΣ i≤ ß highl∙ recommendeΣ practice« I⌠ i≤ no⌠ ß ì
baΣ ámaxiφ neve≥ t∩ usσ actua∞ numerica∞ constant≤ iε an∙ program╗ alway≤ áusσ ì
symboliπ constants.è
Tablσ ▒ show≤ ho≈ variable≤ arσ useΣ iε thσ scripts« I'l∞ havσ t∩ áconfes≤ ì
tha⌠ á╔ áprepareΣ mucΦ oµ thi≤ lis⌠ afte≥ thσ fact« Tha⌠ wa≤ áß ámistake« á ╔ ì
woulΣ havσ madσ man∙ fewe≥ codinτ error≤ haΣ ╔ meticulousl∙ documenteΣ thσ usσ ì
oµ ávariable≤ áfroφ thσ ver∙ beginning« Iε fact¼ thσ comment≤ ánex⌠ át∩ áeacΦ ì
variablσ áshoulΣ ábσ ámorσ áextensivσ thaε wha⌠ ╔ ásho≈ áhere« á Somσ áoµ áthσ ì
informatioε i≤ incomplete╗ somσ ma∙ eveε bσ wrong.
Notσ áthσ áwa∙ commanΣ linσ parameter≤ arσ handleΣ iε áPCP.MEX« á Thσ áful∞ ì
synta° fo≥ invocatioε oµ thσ scrip⌠ is
REA─ PC╨ [men⌡ choice▌ [cit∙ tries▌ [RA╙ tries]
Therσ arσ threσ optiona∞ parameters« Thσ firs⌠ i≤ ß men⌡ choice« Iµ yo⌡ kno≈ ì
tha⌠ áyo⌡ áwan⌠ t∩ placσ ß cal∞ t∩ RA╙ numbe≥ ▒ oε thσ menu¼ yo⌡ caε áusσ áthσ ì
commanΣ "REA─ PC╨ 1ó t∩ d∩ s∩ directly« Iε casσ yo⌡ thinδ tha⌠ i⌠ i≤ to∩ harΣ ì
t∩ áremembe≥ thσ numbers¼ yo⌡ arσ right╗ that'≤ wherσ ARUN┌ aliase≤ ácomσ áiní ì
M∙ áLADER┴ alia≤ become≤ "ME╪ REA─ PC╨ 1"« Thσ othe≥ tw∩ parameter≤ áarσ áthσ ì
defaul⌠ ánumbe≥ áoµ átime≤ át∩ áconnec⌠ t∩ ß ácity'≤ áoutdia∞ ámodeφ áanΣ áthσ ì
destinatioε modem¼ respectively.
Thσ paramete≥ value≤ arσ carefull∙ validateΣ iε thσ script« Iµ thσ ávalue≤ ì
arσ áillegal¼ theε thσ buil⌠-iε default≤ arσ used« Validatinτ use≥ áinpu⌠ ái≤ ì
somethinτ tha⌠ nonσ oµ u≤ doe≤ enougΦ of.
Iε thσ par⌠ oµ thσ scrip⌠ tha⌠ check≤ thσ loca∞ modem¼ therσ i≤ thσ command
WAI╘ STRIN╟ ▓ "OKó "0"
Thi≤ ámake≤ thσ scrip⌠ wai⌠ fo≥ u≡ t∩ ▓ second≤ fo≥ thσ modeφ t∩ responΣ áwitΦ ì
eithe≥ "OKó (whicΦ i⌠ wil∞ d∩ iε norma∞ verbosσ mode⌐ o≥ "0ó (whicΦ i⌠ wil∞ d∩ ì
iµ ái⌠ áwa≤ álef⌠ áiε tersσ mode)« I⌠ i≤ alway≤ ß ágooΣ áideß át∩ áhavσ ácodσ ì
anticipatσ anΣ dea∞ witΦ al∞ possiblσ situations.
╔ áhavσ aε MN╨ leve∞-┤ modem¼ anΣ Telene⌠ support≤ MN╨ erro≥ correctioε áa⌠ ì
thσ áindia∞ por⌠ tha⌠ ╔ use« Therefore¼ ╔ pu⌠ thσ modeφ int∩ MN╨ modσ a⌠ áthσ ì
beginninτ oµ thσ PC╨ scrip⌠ anΣ se⌠ i⌠ bacδ t∩ norma∞ modσ oε norma∞ exit« á ╔ ì
havσ omitteΣ thi≤ codσ froφ thσ listing« Iµ yo⌡ d∩ no⌠ havσ aε MN╨ modem¼ yo⌡ ì
would¼ oµ course¼ removσ (commen⌠ out⌐ thi≤ par⌠ oµ thσ script.
Thσ áscrip⌠ ái≤ prett∙ carefull∙ writteε t∩ makσ surσ átha⌠ áeverythinτ ái≤ ì
proceedinτ ácorrectly« á Afte≥ connectinτ t∩ Telenet¼ u≡ t∩ tw∩ áattempt≤ áarσ ì
madσ át∩ áestablisΦ áthσ requireΣ synchronization« á Thi≤ ásamσ átechniquσ áoµ ì
loopinτ áwitΦ áß áma°-trie≤ ácoun⌠ áiε variablσ %· ái≤ áuseΣ áiε áman∙ áplace≤ ì
throughou⌠ thσ scripts« Notσ thσ usσ oµ thσ SLEE╨ commanΣ t∩ introducσ delay≤ ì
wheε ááthσ ásysteφ áyo⌡ áarσ ácommunicatinτ áwitΦ ádoe≤ áno⌠ áalway≤ ááresponΣ ì
immediately.
Scrip⌠ PCPMENU.MEX
Thσ ámen⌡ iε thi≤ scrip⌠ (Listinτ 2⌐ i≤ drawε insidσ ß bo° anΣ ha≤ thσ áRA╙ ìèselection≤ displayeΣ iε threσ columns« Freσ entrie≤ arσ filleΣ iε witΦ ß áro≈ ì
oµ dots« Wσ havσ includeΣ onl∙ enougΦ entrie≤ t∩ sho≈ ho≈ the∙ arσ generated« ì
I⌠ i≤ importan⌠ tha⌠ freσ entrie≤ bσ trappeΣ late≥ iε thσ script.
Thσ ámen⌡ i≤ adaptive« Iµ onσ i≤ currentl∙ connecteΣ t∩ ß city¼ áthσ ácit∙ ì
codσ áanΣ datß ratσ arσ showε iε thσ men⌡ header¼ anΣ thσ men⌡ selection≤ áfo≥ ì
changinτ thσ datß ratσ tha⌠ otherwisσ appea≥ a⌠ thσ bottoφ arσ omitted.
Anothe≥ áexamplσ oµ robus⌠ codinτ i≤ provideΣ b∙ thσ ABOR╘ routinσ áa⌠ áthσ ì
end« á Wheneve≥ thi≤ scrip⌠ i≤ running¼ wσ shoulΣ bσ connecteΣ t∩ áP├-Pursuit« ì
Therefore¼ áthσ áscrip⌠ attempt≤ t∩ disconnec⌠ b∙ sendinτ thσ áHANGU╨ ácommanΣ ì
tha⌠ áPC╨ like≤ t∩ see« Iµ severa∞ attempt≤ t∩ disconnec⌠ iε thi≤ áwa∙ áfail¼ ì
however¼ wσ simpl∙ dro≡ carrier.
Scrip⌠ PCPDATA.MEX
Thi≤ scrip⌠ (Listinτ 3⌐ i≤ quitσ straightforward« I⌠ set≤ somσ defaul⌠ ke∙ ì
definition≤ tha⌠ appl∙ t∩ man∙ systems« Theε i⌠ branche≤ t∩ thσ entr∙ fo≥ thσ ì
RA╙ selecteΣ froφ thσ men⌡ iε PCPMENU« Herσ thσ variable≤ necessar∙ t∩ áplacσ ì
thσ ácal∞ áarσ áse⌠ anΣ an∙ othe≥ functioε ke∙ ádefinition≤ áarσ ámade« á Theε ì
contro∞ i≤ transferreΣ t∩ PCPCALL« Iε thσ listinτ wσ sho≈ thσ entr∙ fo≥ áonl∙ ì
onσ RAS.
Scrip⌠ PCPMAN.MEX
Thi≤ ái≤ thσ seconΣ mos⌠ comple° modulσ iε thσ serie≤ (Listinτ 4)« ╔ áuseΣ ì
t∩ áhavσ ß mucΦ simple≥ anΣ les≤ agreeablσ version╗ iε hono≥ oµ thi≤ columε á╔ ì
jus⌠ árewrotσ it« I⌠ useΣ t∩ requirσ manua∞ entr∙ oµ al∞ information¼ anΣ ái⌠ ì
provideΣ án∩ áchecking« No≈ i⌠ put≤ u≡ ß men⌡ oµ al∞ PC╨ ácitie≤ áanΣ áallow≤ ì
selectioε áb∙ number« I⌠ als∩ keep≤ tracδ oµ thσ areß code≤ covereΣ áb∙ áeacΦ ì
city« á Wheε átherσ i≤ ß seconΣ areß code¼ ß men⌡ let≤ thσ use≥ áchoose« á Thσ ì
scrip⌠ ái≤ áeveε smar⌠ enougΦ t∩ includσ thσ areß codσ a≤ par⌠ áoµ áthσ áloca∞ ì
numbe≥ áwheε needeΣ anΣ t∩ inser⌠ thσ "1ó prefi° fo≥ thosσ phonσ system≤ átha⌠ ì
requirσ it.
Therσ arσ tw∩ majo≥ subroutine≤ iε thi≤ module« Routinσ CITYNAM┼ take≤ thσ ì
cit∙ numbe≥ anΣ produce≤ thσ namσ oµ thσ cit∙ anΣ statσ iε ß strinτ ávariable« ì
Routinσ áPCPCOD┼ generate≤ thσ PC╨ outdia∞ codσ anΣ thσ telephonσ áareß ácode≤ ì
fo≥ áthσ ácity« á Thσ ásamσ CITYNAM┼ subroutinσ i≤ áals∩ áincludeΣ áiε ámodulσ ì
PCPCALL.
Thσ men⌡ oµ PC╨ citie≤ i≤ drawε b∙ callinτ thσ CITYNAM┼ routinσ froφ insidσ ì
ß áloop« Thi≤ i≤ mucΦ slowe≥ thaε drawinτ thσ men⌡ directly« ╔ pu⌠ thσ ácodσ ì
fo≥ áthσ CITYNAM┼ subroutinσ a⌠ thσ beginninτ oµ thσ script¼ sincσ ╔ thinδ ái⌠ ì
execute≤ ß littlσ faste≥ froφ there.
╔ áwrotσ thσ scrip⌠ thi≤ wa∙ fo≥ tw∩ reasons« First¼ i⌠ áillustrate≤ ásomσ ì
interestinτ átechniques¼ sucΦ a≤ iterateΣ loop≤ anΣ computeΣ ácoordinate≤ áfo≥ ì
thσ á"@ó ácommand« Second¼ i⌠ keep≤ informatioε abou⌠ thσ cit∙ name≤ áiε áonσ ì
place« Iµ the∙ arσ kep⌠ iε morσ thaε onσ place¼ theε wheε change≤ arσ madσ iε ì
thσ futurσ the∙ migh⌠ no⌠ bσ madσ everywhere« A≤ i⌠ is¼ thi≤ dange≥ exist≤ iε ì
severa∞ áplace≤ iε thesσ scripts« Fo≥ example¼ thσ men⌡ oµ RAS≤ i≤ ádrawε áiε ìèPCPMENU¼ ábu⌠ thσ datß fo≥ eacΦ RA╙ arσ storeΣ iε PCPDATA« Wheε áchange≤ áarσ ì
made¼ thσ use≥ mus⌠ bσ surσ t∩ kee≡ thσ informatioε synchronized.
Scrip⌠ PCPCALL.MEX
No≈ wσ comσ t∩ thσ mos⌠ comple° modulσ iε thσ scrip⌠ (Listinτ 5)« Thi≤ onσ ì
ha≤ t∩ perforφ ß lo⌠ oµ housekeepinτ anΣ trick∙ operations« I⌠ ha≤ t∩ kno≈ iµ ì
wσ arσ alread∙ connecteΣ t∩ ß cit∙ anΣ iµ s∩ whicΦ one« I⌠ theε ha≤ t∩ decidσ ì
ho≈ át∩ ág∩ áabou⌠ áconnectinτ át∩ áthσ árequesteΣ ácity« á Thi≤ áma∙ árequirσ ì
disconnectinτ froφ thσ curren⌠ cit∙ anΣ theε connectinτ t∩ thσ ne≈ city.
Thσ scrip⌠ ha≤ t∩ allo≈ fo≥ thing≤ no⌠ alway≤ goinτ right¼ a⌠ leas⌠ no⌠ thσ ì
firs⌠ time« Yo⌡ shoulΣ particularl∙ notσ thσ pain≤ i⌠ take≤ t∩ rese⌠ anΣ tes⌠ ì
thσ PC╨ outdia∞ modeφ anΣ t∩ pu⌠ i⌠ int∩ Raca∞-Vadiπ mode.
Iµ thσ outdia∞ modeφ i≤ bus∙ o≥ iµ thσ RA╙ i≤ busy¼ thσ scrip⌠ wil∞ asδ thσ ì
use≥ áwhethe≥ t∩ makσ additiona∞ attempt≤ anΣ iµ s∩ ho≈ many« Thσ áscrip⌠ ái≤ ì
ver∙ carefu∞ t∩ kee≡ thσ use≥ informeΣ oµ exactl∙ wha⌠ i≤ goinτ on.
Iµ áal∞ áwork≤ out¼ wσ eventuall∙ enΣ u≡ connecteΣ t∩ áthσ áremotσ ásystem« ì
PCPCAL╠ theε chain≤ t∩ PCPCON╬ (Listinτ 6)¼ whicΦ drop≤ onσ int∩ termina∞ modσ ì
witΦ thσ functioε key≤ programmeΣ t∩ easσ logginτ in« I⌠ woulΣ no⌠ bσ harΣ t∩ ì
havσ thσ scrip⌠ firs⌠ cal∞ ß subroutinσ scrip⌠ t∩ perforφ thσ logiε áoperatioε ì
automatically« á Thσ áeasies⌠ wa∙ woulΣ bσ t∩ storσ ß numbe≥ áiε áß ánumerica∞ ì
variablσ a≤ ß flaτ anΣ thσ namσ oµ thσ logiε scrip⌠ filσ iε ß strinτ variable« ì
Unfortunately¼ it'≤ no⌠ clea≥ tha⌠ wσ havσ ß freσ strinτ variablσ t∩ use« Onσ ì
possibilit∙ áwoulΣ bσ t∩ usσ thσ systeφ namσ iε variablσ F« Onσ coulΣ ruε ái⌠ ì
usinτ thσ commanΣ "D╧ {F}".
Conclusion
╔ hopσ thi≤ extendeΣ examplσ wil∞ givσ yo⌡ ß bette≥ ideß oµ ho≈ anΣ t∩ wha⌠ ì
exten⌠ áME╪ scrip⌠ command≤ caε bσ useΣ t∩ automatσ telecommunication≤ átasks« ì
Pleasσ le⌠ mσ kno≈ iµ yo⌡ havσ somσ idea≤ t∩ improvσ thesσ scripts.
¬ Includσ thσ followinτ item≤ witΦ thi≤ article:
¡ filσ PCPVAR.TC╩ a≤ Tablσ ▒ witΦ caption:
Tablσ 1« ┴ lis⌠ showinτ ho≈ thσ strinτ anΣ numerica∞ variables
arσ useΣ iε thσ scripts.
¡ filσ PCP.TC╩ a≤ Listinτ ▒ witΦ caption:
Listinτ 1« Scrip⌠ PCP.MEX..
¡ filσ PCPMENU.TC╩ a≤ Listinτ ▓ witΦ caption:
Listinτ 2« Scrip⌠ PCPMENU.MEX.
¡ filσ PCPDATA.TC╩ a≤ Listinτ │ witΦ caption:
è Listinτ 3« Scrip⌠ PCPDATA.MEX.
¡ filσ PCPMAN.TC╩ a≤ Listinτ ┤ witΦ caption:
Listinτ 4« Scrip⌠ PCPMAN.MEX.
¡ filσ PCPCALL.TC╩ a≤ Listinτ ╡ witΦ caption:
Listinτ 5« Scrip⌠ PCPCALL.MEX.
¡ filσ PCPCONN.TC╩ a≤ Listinτ ╢ witΦ caption:
Listinτ 6« Scrip⌠ PCPCONN.MEX.
[This article was originally published in issue 45 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]