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
/
TCJ44.WS
< prev
next >
Wrap
Text File
|
2000-06-30
|
38KB
|
687 lines
Z-System Corne≥ (c)
by Jay Sage
The Computer Journal, Issue 44
Reproduced with permission
of author and publisher
Fo≥ thi≤ issuσ (anΣ thσ next⌐ ╔ aφ goinτ t∩ indulgσ myselµ anΣ writσ áabou⌠ ì
abou⌠ ásomethinτ tha⌠ ╔ enjoy¼ eveε though¼ strictl∙ speaking¼ i⌠ ha≤ ánothinτ ì
t∩ áád∩ áwitΦ á┌-System« á Thi≤ ásubjec⌠ ái≤ áME╪-Plus¼ áthσ áámos⌠ ááadvanceΣ ì
telecommunication≤ ápackagσ availablσ fo≥ CP/═ computers« ╔ supposσ á╔ ácoulΣ ì
arguσ átha⌠ therσ i≤ ß philosophica∞ o≥ spiritua∞ connection¼ ásincσ áME╪-Plu≤ ì
allow≤ áthσ áuse≥ d∩ fo≥ telecommunication≤ man∙ oµ thσ samσ áthing≤ átha⌠ á┌-ì
Systeφ áallow≤ áonσ át∩ d∩ witΦ thσ operatinτ ásystem¼ ánamel∙ áautomate« á Iε ì
particular¼ ╔ wil∞ bσ describinτ ME╪-Plus'≤ scriptinτ capabilities¼ whicΦ áarσ ì
simila≥ iε somσ way≤ t∩ alia≤ anΣ ARUN┌ script≤ iε ┌-System.
╔ haΣ beeε hopinτ tha⌠ ß regula≥ ME╪ columε woulΣ develo≡ herσ iε TCJ¼ ábu⌠ ì
tha⌠ hasn'⌠ happened« Tw∩ oµ thσ peoplσ wh∩ migh⌠ havσ gotteε i⌠ going¼ Brucσ ì
Morgeε áanΣ Ricδ Charnes¼ arσ no≈ employeΣ iε thσ M╙-DO╙ industry¼ and¼ áafte≥ ì
programminτ áal∞ áda∙ professionally¼ the∙ don'⌠ seeφ t∩ havσ a≤ ámucΦ áenerg∙ ì
lef⌠ fo≥ hobb∙ computinτ a≤ the∙ useΣ to« Recently¼ DaviΣ Goodenough¼ áautho≥ ì
oµ áthσ QTER═ telecommunication≤ package¼ camσ ove≥ t∩ m∙ housσ anΣ go⌠ áQTER═ ì
runninτ oε m∙ SB18░ witΦ it≤ Wysσ 5░ terminal« ╔ aφ enormousl∙ impresseΣ witΦ ì
wha⌠ áDaviΣ ha≤ accomplisheΣ witΦ thi≤ program╗ i⌠ i≤ rapidl∙ developinτ áman∙ ì
oµ thσ capabilitie≤ oµ ME╪-Plus« ╔ caε envisioε mucΦ discussioε iε thσ futurσ ì
oµ ábotΦ áME╪-Plu≤ anΣ QTER═ scripts« Yo⌡ caε als∩ expec⌠ aε articlσ áo≥ átw∩ ì
abou⌠ QTERM.
Fo≥ áthi≤ ácolumε ╔ wil∞ givσ aε overvie≈ oµ MEX'≤ commanΣ ástructure¼ áanΣ ì
nex⌠ átimσ ╔ wil∞ describσ iε detai∞ m∙ suitσ oµ script≤ fo≥ usinτ áP├-Pursui⌠ ì
a≤ aε examplσ oµ wha⌠ caε bσ donσ usinτ thosσ commands« (╔ originall∙ planneΣ ì
t∩ ácove≥ ábotΦ áiε onσ article¼ bu⌠ afte≥ finishinτ thσ ádescriptioε áoµ áthσ ì
commands¼ á╔ wa≤ alread∙ a⌠ m∙ limit.⌐ Alonτ thσ wa∙ ╔ wil∞ tr∙ t∩ poin⌠ áou⌠ ì
somσ oµ thσ bug≤ anΣ idiosyncrasie≤ tha⌠ user≤ havσ discovereΣ iε ME╪ command≤ ì
anΣ sugges⌠ mean≤ t∩ ge⌠ arounΣ them« ╔ hopσ tha⌠ m∙ example≤ wil∞ hel≡ ágivσ ì
other≤ idea≤ abou⌠ ho≈ t∩ makσ bette≥ usσ oµ ME╪-Plus« AlthougΦ regrettabl∙ ╔ ì
havσ haΣ ver∙ fe≈ taker≤ iε thσ past¼ ╔ agaiε extenΣ aε invitatioε t∩ áreader≤ ì
t∩ senΣ mσ suggestion≤ anΣ example≤ fo≥ scripts.
Overview of MEX Commands
Thσ áorigina∞ áCP/═ telecommunicatioε prograφ MODEM╖ anΣ áit≤ áderivatives¼ ì
sucΦ áa≤ IMP¼ operatσ iε tw∩ modes║ termina∞ modσ anΣ commanΣ mode« á Termina∞ ì
modσ ái≤ useΣ fo≥ talkinτ t∩ thσ remotσ system¼ whilσ commanΣ modσ i≤ useΣ át∩ ì
contro∞ áthσ áloca∞ ásystem« Thesσ program≤ havσ ß relativel∙ ásmal∞ áse⌠ áoµ ì
command≤ áfallinτ áprincipall∙ áint∩ átw∩ classes║ áthosσ árequireΣ áfo≥ áfilσ ì
transfer≤ anΣ thosσ relateΣ t∩ thσ setu≡ oµ thσ program.
Iε áME╪-Plu≤ thσ arsena∞ oµ command≤ i≤ extendeΣ enormously¼ áanΣ áanythinτ ìètha⌠ ácoulΣ bσ donσ froφ termina∞ modσ caε bσ donσ froφ commanΣ modσ a≤ áwell« ì
(Yo⌡ áwoulΣ no⌠ wan⌠ t∩ ruε aε interactivσ sessioε thi≤ way¼ bu⌠ i⌠ ácoulΣ ábσ ì
done.⌐ á Therσ arσ s∩ man∙ command≤ that¼ thougΦ ╔ wil∞ mentioε almos⌠ al∞ áoµ ì
them¼ á╔ áwil∞ no⌠ bσ ablσ t∩ explaiε theφ al∞ iε detail« Rather¼ ╔ áhopσ át∩ ì
givσ yo⌡ ß genera∞ picturσ oµ thσ kind≤ oµ tool≤ onσ ha≤ t∩ worδ witΦ iε áME╪-ì
Plus« ╔ wil∞ takσ u≡ thσ command≤ iε groups.
Setu≡ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡-
Mos⌠ oµ MEX'≤ configuratioε i≤ controlleΣ b∙ threσ commands║ STAT¼ SET¼ anΣ ì
TSET« á Thσ áSTA╘ commanΣ work≤ witΦ morσ thaε 5░ differen⌠ optionsí á Al∞ áoµ ì
theφ caε displa∙ informatioε abou⌠ ho≈ thσ systeφ i≤ configured¼ anΣ al∞ bu⌠ ß ì
fe≈ als∩ allo≈ thσ configuratioε t∩ bσ changed« Thσ ME╪ STA╘ parameter≤ áfal∞ ì
int∩ fou≥ classes║ switches¼ characters¼ values¼ anΣ miscellaneous.
Switche≤ áhavσ value≤ oµ O╬ o≥ OFF« Onσ examplσ i≤ FILTER¼ whicΦ ácontrol≤ ì
whethe≥ ME╪ wil∞ filte≥ froφ thσ incominτ modeφ streaφ an∙ contro∞ ácharacter≤ ì
othe≥ áthaε átab¼ backspace¼ carriagσ return¼ anΣ linefeed« Iµ onσ áwant≤ át∩ ì
perforφ ful∞ screeε operations¼ thi≤ filte≥ mus⌠ bσ off« Otherwise¼ thσ escapσ ì
character≤ tha⌠ initiatσ ß screeε contro∞ sequencσ wil∞ bσ swalloweΣ b∙ MEX.
Characte≥ STA╘ parameter≤ takσ ß singlσ ASCI╔ characte≥ a≤ thei≥ value« áAε ì
examplσ i≤ SEP¼ thσ multiplσ commanΣ separato≥ (likσ ┌-System¼ ME╪-Plu≤ allow≤ ì
multiplσ command≤ oε ß line)« Valuσ parameter≤ takσ oε numerica∞ values« Fo≥ ì
example¼ áPAG┼ set≤ thσ numbe≥ oµ line≤ iε ß pagσ oε thσ screen¼ anΣ CLOC╦ ái≤ ì
se⌠ t∩ thσ clocδ speeΣ oµ you≥ microprocesso≥ chi≡ s∩ tha⌠ timinτ delay≤ áwil∞ ì
comσ ou⌠ right« Thσ miscellaneou≤ STA╘ parameter≤ mostl∙ contro∞ thσ ádispla∙ ì
oµ group≤ oµ information« "STA╘ ?ó list≤ al∞ thσ STA╘ parameters╗ "STA╘ áVALó ì
show≤ thσ valuσ parameters.
Thσ SE╘ commanΣ control≤ thσ modeφ setup« I⌠ i≤ useΣ fo≥ settinτ thσ ábauΣ ì
rate¼ worΣ length¼ numbe≥ oµ sto≡ bits¼ anΣ parit∙ mode« Thσ TSE╘ commanΣ wa≤ ì
onσ ╔ neve≥ useΣ unti∞ workinτ oε thi≤ article« I⌠ control≤ specia∞ áfeature≤ ì
relateΣ t∩ thσ termina∞ (wha⌠ i≤ doe≤ depend≤ oε thσ termina∞ yo⌡ arσ áusing)« ì
WitΦ m∙ Wysσ 50¼ ß TSE╘ paramete≥ caε forcσ al∞ character≤ t∩ bσ displayeΣ áiε ì
uppe≥ casσ character≤ o≥ iε highlighteΣ vide∩ (tha⌠ shoulΣ givσ yo⌡ somσ áideß ì
oµ wh∙ ╔ havσ neve≥ useΣ thi≤ command).
Operatinτ Systeφ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Anothe≥ grou≡ oµ command≤ deal≤ witΦ thσ interfacσ t∩ thσ operatinτ system.
Naturally¼ átherσ áha≤ át∩ ábσ ß wa∙ t∩ ge⌠ ou⌠ oµ áME╪ áanΣ ábacδ át∩ áthσ ì
operatinτ ásysteφ áprompt« Havσ yo⌡ eve≥ beeε trappeΣ insidσ ß áprogram¼ áno⌠ ì
knowinτ áho≈ át∩ áexit┐ á Well¼ ME╪ autho≥ Roε Fowle≥ mus⌠ áhavσ áhaΣ ásucΦ áß ì
harrowinτ áexperience¼ ábecausσ hσ ha≤ si° (coun⌠ 'em!⌐ command≤ áfo≥ ágettinτ ì
out║ áBYE¼ áEXIT¼ QUIT¼ CPM¼ DOS¼ anΣ SYSTEM« SYSTE═ mus⌠ ácomσ áfroφ áBASIC¼ ì
whicΦ ái≤ áthσ onl∙ CP/═ prograφ ╔ eve≥ becamσ trappeΣ áinside« á ME╪-Plu≤ ái≤ ìèavailablσ iε aε M╙-DO╙ versioε a≤ well¼ anΣ tha⌠ i≤ wherσ thσ exi⌠ commanΣ DO╙ ì
come≤ from« A≤ ß CP/═ diehard¼ ╔ takσ grea⌠ pleasure¼ a≤ yo⌡ caε imagine¼ áiε ì
exitinτ áfroφ ám∙ DO╙ versioε usinτ thσ commanΣ CP═ (i⌠ doesn'⌠ áhel≡ á¡¡ áI'φ ì
stil∞ iε M╙-DO╙ afte≥ ╔ exit).
Therσ áarσ command≤ fo≥ doinτ operatinτ systeφ chores║ DIR¼ REN¼ áER┴ á(or¼ ì
followinτ áM╙-DOS¼ áDEL)¼ TYPE¼ anΣ LO╟ (changσ drive/user)« á Somσ áoµ áthesσ ì
command≤ áno⌠ onl∙ perforφ thei≥ functions╗ the∙ als∩ returε áinformatioε áfo≥ ì
usσ iε ß scrip⌠ file« DIR¼ fo≥ example¼ set≤ ß specia∞ variablσ t∩ thσ numbe≥ ì
oµ ámatchinτ áfile≤ áfound¼ áanΣ áthu≤ caε bσ áuseΣ át∩ ádeterminσ áwhethe≥ áß ì
particula≥ filσ exist≤ o≥ not.
Therσ áarσ thσ command≤ KE┘ fo≥ associatinτ string≤ witΦ an∙ ASCI╔ áke∙ áoε ì
thσ keyboarΣ anΣ PHON┼ fo≥ enterinτ phonσ number≤ int∩ ß dialinτ library« áThσ ì
ke∙ definition≤ anΣ phonσ numbe≥ librar∙ caε bσ storeΣ iε disδ file≤ witΦ áthσ ì
respectivσ extension≤ KE┘ anΣ PHN« Thσ command≤ SAV┼ anΣ LOA─ writσ thσ ádatß ì
t∩ anΣ reaΣ thσ datß froφ thσ files.
ME╪-Plu≤ áha≤ ß facility¼ viß thσ INSTAL╠ command¼ t∩ loaΣ áoptiona∞ áextrß ì
codσ ámodules« á Onσ ásucΦ modulσ (thσ REMOT┼ module⌐ allow≤ áME╪-Plu≤ át∩ ábσ ì
operateΣ áa≤ ß remotσ acces≤ system« ╔ havσ useΣ thi≤ witΦ botΦ ádirec⌠ áwirσ ì
anΣ modeφ connection≤ betweeε machines« Thσ forme≥ i≤ hand∙ wheε tw∩ machine≤ ì
arσ connecteΣ b∙ ß cable¼ a≤ i⌠ relieve≤ onσ oµ thσ neeΣ t∩ ruε bacδ anΣ fortΦ ì
betweeε thσ tw∩ keyboard≤ t∩ issuσ filσ transfe≥ commands« ╔ sometime≤ áleavσ ì
m∙ systeφ a⌠ worδ iε remotσ modσ s∩ tha⌠ ╔ caε cal∞ i⌠ froφ homσ t∩ picδ u≡ áß ì
filσ tha⌠ ╔ forgo⌠ t∩ takσ witΦ me« Othe≥ optiona∞ module≤ suppor⌠ áemulatioε ì
oµ variou≤ terminals¼ includinτ thσ VT100.
Thσ áTER═ anΣ TERM┴ command≤ opeε ß filσ t∩ recorΣ thσ áincominτ ácharacte≥ ì
streaφ áfroφ thσ modem« TER═ create≤ ß ne≈ file¼ whilσ TERM┴ append≤ thσ áne≈ ì
tex⌠ át∩ aε existinτ file« Thσ termina∞ modσ command≤ T¼ L¼ anΣ á┼ ádescribeΣ ì
belo≈ ácaε als∩ takσ aε optiona∞ 'Aº suffi° anΣ capturσ filσ name« á Iε áthosσ ì
cases¼ áoncσ thσ capturσ filσ ha≤ beeε opened¼ ME╪ i≤ pu⌠ int∩ termina∞ ámode« ì
Thσ áTER═ áanΣ áTERM┴ command≤ leavσ ME╪ iε commanΣ modσ áfo≥ áfurthe≥ áscrip⌠ ì
processing« á Thσ VIE╫ commanΣ allow≤ thσ content≤ oµ thσ capturσ filσ át∩ ábσ ì
revieweΣ whilσ online¼ thereb∙ affordinτ somσ scrol∞-bacδ capabilit∙ (tha⌠ is¼ ì
ß áwa∙ t∩ seσ tex⌠ tha⌠ ha≤ alread∙ scrolleΣ ofµ thσ screen)« WR╘ close≤ áthσ ì
capturσ filσ (save≤ it⌐ wheε yo⌡ arσ done╗ DE╠ discard≤ it.
Thσ AL╘ commanΣ specifie≤ aε alternatσ drive/use≥ areß (iε additioε t∩ áthσ ì
currentl∙ áloggeΣ áone⌐ wherσ ME╪ caε searcΦ automaticall∙ áfo≥ áfile≤ á(e.g.¼ ì
scripts¼ phonσ directory¼ etc.)« Thσ SEARC╚ commanΣ tell≤ ME╪ ho≈ t∩ g∩ abou⌠ ì
searchinτ áfo≥ files¼ sucΦ a≤ whethe≥ t∩ searcΦ thσ alternatσ areß ábeforσ áo≥ ì
afte≥ thσ loggeΣ area.
A≤ áyo⌡ ácaε probabl∙ gues≤ already¼ i⌠ i≤ no⌠ eas∙ t∩ remembe≥ áal∞ áthesσ ì
command≤ anΣ thσ synta° the∙ require« Tha⌠ i≤ wherσ thσ HEL╨ commanΣ come≤ iε ì
handy« á I⌠ áaccesse≤ áaε extensivσ HL╨ filσ (ove≥ 70K)« Therσ ái≤ áals∩ áthσ ì
wonderfu∞ áCLON┼ command¼ whicΦ create≤ ß ne≈ versioε oµ ME╪ (i.e.¼ ß ne≈ áCO═ ì
file⌐ áwitΦ thσ curren⌠ configuratioε embeddeΣ ¡¡ afte≥ thσ STAT¼ áSET¼ áTSET¼ ì
anΣ othe≥ command≤ havσ beeε useΣ t∩ changσ parameter≤ t∩ one'≤ liking.
è
Telephonσ Interfacσ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
ME╪-Plu≤ ha≤ tw∩ phonσ-dialinτ commands¼ CAL╠ anΣ DIAL« BotΦ accep⌠ álist≤ ì
oµ áeithe≥ litera∞ telephonσ number≤ o≥ name≤ froφ thσ phonσ library« áNumber≤ ì
anΣ áname≤ áma∙ ábσ mixed« Number≤ iε thσ librar∙ ma∙ áhavσ áassociateΣ ábauΣ ì
rates¼ áwhicΦ áwil∞ bσ selecteΣ automaticall∙ wheε tha⌠ numbe≥ i≤ ádialed« áAε ì
optiona∞ áparamete≥ áspecifie≤ thσ numbe≥ oµ time≤ t∩ tr∙ áconnectinτ át∩ áthσ ì
number≤ ábeforσ givinτ up¼ anΣ thσ command≤ returε ß valuσ t∩ áindicatσ áwhicΦ ì
number¼ iµ any¼ wa≤ reached« Herσ i≤ aε example:
CAL╠ LADER┴ 61╖-96╡-725╣ #3
Thi≤ áwil∞ áalternatel∙ ácalleΣ áthσ Laderß ┌-Nodσ (whosσ ánumbe≥ ái≤ áiε áthσ ì
library⌐ áanΣ ám∙ á┌-Nodσ u≡ t∩ threσ time≤ beforσ givinτ áup« á Thσ ácommand≤ ì
diffe≥ áiε tha⌠ CAL╠ put≤ onσ iε termina∞ modσ afte≥ ß successfu∞ áconnection¼ ì
whilσ DIA╠ leave≤ onσ iε commanΣ modσ fo≥ furthe≥ scrip⌠ processing.
Therσ i≤ als∩ ß wa∙ t∩ ge⌠ ou⌠ oµ ß connection« DS├ wil∞ tel∞ thσ modeφ t∩ ì
dro≡ áthσ connection« I⌠ caε bσ configureΣ (usinτ ß STA╘ command¼ oµ ácourse⌐ ì
t∩ usσ eithe≥ thσ DT╥ (datß termina∞ ready⌐ hardwarσ contro∞ linσ o≥ thσ Haye≤ ì
A╘ hangu≡ command.
Termina∞ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Therσ áarσ áthreσ ácommand≤ áfo≥ enterinτ termina∞ ámode« á Thσ ácommanΣ á╘ ì
(terminal⌐ áset≤ áu≡ áß ful∞-duple° termina∞ mode« Character≤ átypeΣ áa⌠ áthσ ì
keyboarΣ arσ sen⌠ t∩ thσ modem╗ character≤ receiveΣ froφ thσ modeφ arσ sen⌠ t∩ ì
thσ áscreen« á Iµ yo⌡ arσ t∩ seσ wha⌠ yo⌡ arσ typing¼ thσ remotσ ásysteφ ámus⌠ ì
ech∩ bacδ thσ character≤ i⌠ receive≤ froφ you« Mos⌠ microcompute≥ BB╙ system≤ ì
d∩ that.
Thσ á╠ á(loca∞ áecho⌐ commanΣ set≤ u≡ ß áhalµ-duple° átermina∞ ámode« á Thσ ì
differencσ i≤ tha⌠ thσ character≤ tha⌠ yo⌡ typσ arσ no⌠ onl∙ sen⌠ t∩ thσ modeφ ì
fo≥ transmissioε t∩ thσ remotσ system╗ the∙ arσ als∩ echoeΣ locally« Thi≤ modσ ì
woulΣ bσ useΣ witΦ system≤ likσ GEniσ tha⌠ d∩ no⌠ normall∙ ech∩ thσ character≤ ì
the∙ receivσ froφ you.
Finally¼ áthσ á┼ (echo⌐ commanΣ set≤ yo⌡ u≡ a≤ iµ yo⌡ werσ ß áremotσ áhost« ì
Ever∙ ácharacte≥ yo⌡ receivσ i≤ theε echoeΣ bacδ t∩ thσ modem« Iµ tw∩ ápeoplσ ì
runninτ áME╪ ácal∞ áeacΦ othe≥ (o≥ tw∩ machine≤ arσ hookeΣ u≡ b∙ ácablσ áa≤ á╔ ì
mentioneΣ áearlier)¼ áeithe≥ botΦ shoulΣ bσ iε ╠ mode¼ o≥ onσ shoulΣ bσ áiε á╘ ì
modσ áanΣ áthσ áothe≥ áiε á┼ mode« ╔ prefe≥ áthσ álatter¼ ásincσ áseeinτ áthσ ì
character≤ oε thσ screeε oµ thσ machinσ iε ╘ modσ assure≤ tha⌠ thσ áconnectioε ì
i≤ áworking« ╔ leavσ i⌠ a≤ aε exercisσ t∩ thσ reade≥ t∩ figurσ ou⌠ wha⌠ áwil∞ ì
happeε áiµ botΦ machine≤ arσ iε ┼ mode« (Hint║ fee∞ freσ t∩ áexperiment╗ áyo⌡ ì
caε ge⌠ ou⌠ oµ thσ infinitσ loo≡ b∙ exitinτ froφ termina∞ mode╗ yo⌡ don'⌠ havσ ì
t∩ reboot.)
è
Filσ Transfe≥ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
File≤ arσ sen⌠ t∩ thσ othe≥ compute≥ usinτ thσ ╙ command¼ anΣ receiveΣ froφ ì
thσ othe≥ compute≥ usinτ thσ ╥ command« ME╪-Plu≤ support≤ threσ filσ transfe≥ ì
protocols║ áKERMIT¼ XMODEM¼ anΣ YMODEM« Thσ defaul⌠ protoco∞ i≤ se⌠ witΦ áthσ ì
PROT╧ ácommand« Thσ protoco∞ caε als∩ bσ specifieΣ explicitl∙ usinτ ß áprefi° ì
(K¼ M¼ o≥ Y⌐ t∩ thσ ╙ o≥ ╥ command.
Thσ command≤ wil∞ als∩ accep⌠ an∙ oµ severa∞ suffixe≤ a≤ well« Thσ ásuffi° ì
┬ indicate≤ ß batcΦ-modσ transfer« Thσ ╦ suffi° witΦ thσ ╙ commanΣ áindicate≤ ì
tha⌠ thσ filσ shoulΣ bσ sen⌠ iε block≤ oµ 1╦ byte≤ insteaΣ oµ thσ standarΣ 12╕ ì
bytes« á Iµ áyo⌡ áappenΣ áT¼ L¼ o≥ E¼ yo⌡ wil∞ áreturε át∩ áthσ ácorrespondinτ ì
termina∞ modσ afte≥ thσ transfe≥ i≤ completed« Thσ ─ anΣ ╪ suffixe≤ wil∞ tel∞ ì
ME╪ t∩ disconnec⌠ froφ thσ remotσ systeφ afte≥ thσ transfe≥ i≤ finished╗ áwitΦ ì
─ yo⌡ wil∞ returε t∩ MEX¼ whilσ witΦ ╪ yo⌡ wil∞ exi⌠ ME╪ a≤ well« Herσ i≤ áaε ì
example.
YSBK╪ FILE▒ FILE▓ FILE3
Thi≤ wil∞ senΣ thσ threσ file≤ usinτ YMODE═ batcΦ witΦ 1╦ blocks¼ hanτ u≡ áthσ ì
phone¼ anΣ exi⌠ froφ MEX.
Transaction≤ áwitΦ áß hos⌠ iε thσ KERMI╘ serve≥ modσ arσ supporteΣ áwitΦ áß ì
numbe≥ oµ specia∞ command≤ (KGET¼ KPUT¼ KBYE¼ KLOG¼ KFIN).
Vide∩ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡-
Thesσ arσ thσ command≤ tha⌠ Ricδ Charne≤ love≤ soí Therσ arσ command≤ áfo≥ ì
curso≥ áaddressinτ á(@)¼ ábeginninτ anΣ endinτ thσ usσ oµ áu≡ át∩ áfou≥ ávide∩ ì
attribute≤ áá(STAR╘ áanΣ áEND)¼ ádisplayinτ áspecia∞ áálinσ-drawinτ áágraphic≤ ì
character≤ á(DRAW)¼ áanΣ creatinτ line≤ anΣ boxe≤ (HLINE¼ áVLINE¼ áBOX)« á Thσ ì
screeε caε bσ cleareΣ (CLS)« I⌠ caε als∩ bσ turneΣ oε anΣ ofµ (SCREEN⌐ s∩ yo⌡ ì
caε contro∞ wha⌠ outpu⌠ i≤ seeε anΣ wha⌠ i≤ not.
Variables
¡¡¡¡¡¡¡¡-
I⌠ i≤ harΣ t∩ d∩ ver∙ sophisticateΣ processinτ withou⌠ variables« ME╪-Plu≤ ì
offer≤ ávariable≤ oµ tw∩ types║ numerica∞ anΣ string« Thσ forme≥ áarσ á1╢-bi⌠ ì
integer≤ á(i.e.¼ number≤ froφ ░ t∩ 65535)╗ thσ latte≥ arσ string≤ oµ u≡ t∩ á3▓ ì
characters.
Therσ arσ 2╢ numerica∞ use≥ variable≤ designateΣ b∙ ß percen⌠ sigε followeΣ ì
b∙ áß álette≥ (casσ doe≤ no⌠ matter¼ e.g.¼ %ß o≥ %S)« Therσ áarσ ási° ástrinτ ì
variable≤ ádesignateΣ áb∙ áthσ letter≤ ┴ througΦ F« I'vσ áneve≥ áruε áou⌠ áoµ ì
numerica∞ variables¼ bu⌠ ╔ surσ wisΦ therσ werσ morσ strinτ variables.
è Therσ arσ als∩ tw∩ specia∞ numerica∞ variable≤ calleΣ VALU┼ anΣ STACK« áThσ ì
forme≥ ái≤ useΣ t∩ holΣ thσ valuσ returneΣ froφ ß numbe≥ oµ ME╪ command≤ á(DI╥ ì
anΣ áDIAL/CAL╠ werσ mentioneΣ earlier)« STAC╦ i≤ ß morσ álonτ-liveΣ ávariablσ ì
tha⌠ caε bσ exchangeΣ iε variou≤ way≤ witΦ VALU┼ (thσ command≤ PUSH¼ POP¼ áanΣ ì
XCHG)« ╔ thinδ thesσ arσ lef⌠ ove≥ froφ earlie≥ version≤ oµ ME╪ tha⌠ diΣ áno⌠ ì
offe≥ áthσ 2╢ use≥ variables« Therσ i≤ littlσ reasoε t∩ usσ STAC╦ áan∙ ámore« ì
Therσ áarσ threσ specia∞ operation≤ (ADD¼ SUB¼ anΣ XOR⌐ tha⌠ caε bσ áperformeΣ ì
oε thσ VALU┼ variable« I'vσ neve≥ founΣ an∙ usσ fo≥ these¼ either.
ME╪ ácaε áevaluatσ áarithmetiπ expression≤ consistinτ áoµ ácombination≤ áoµ ì
litera∞ ánumbers¼ numerica∞ variables¼ anΣ arithmetiπ operator≤ (½-*/)« á Herσ ì
i≤ aε examplσ tha⌠ return≤ thσ leas⌠ significan⌠ bytσ oµ thσ tw∩-bytσ variablσ ì
%V:
%╓ ¡ 25╢ ¬ ¿ %╓ » 25╢ )
Number≤ ácaε bσ entereΣ iε hexadecima∞ forma⌠ b∙ prefixinτ thσ numbe≥ áwitΦ áß ì
dolla≥ sigε ($10░ i≤ 256).
Thσ valuσ oµ aε expressioε i≤ assigneΣ t∩ ß variablσ b∙ thσ equa∞ áoperato≥ ì
(=⌐ áa≤ áiε %B=%A+3« NOTE║ iε mos⌠ place≤ iε ME╪-Plus¼ extrß áspace≤ áma∙ ábσ ì
includeΣ iε commanΣ expressions« However¼ therσ arσ unfortunatel∙ ß numbe≥ oµ ì
bug≤ áiε áME╪-Plus¼ áanΣ ásomσ rea≥ thei≥ head≤ iε áthi≤ áarea« áTherefore¼ á╔ ì
recommenΣ tha⌠ extrß space≤ bσ omitteΣ iε workinτ script≤ (a≤ opposeΣ t∩ full∙ ì
commenteΣ referencσ versions¼ wherσ extrß space≤ migh⌠ bσ includeΣ t∩ áimprovσ ì
readability).
Litera∞ ástrinτ expression≤ arσ composeΣ b∙ surroundinτ tex⌠ áwitΦ ádoublσ-ì
quotσ character≤ (")« Thσ ME╪ manua∞ say≤ tha⌠ value≤ arσ assigneΣ t∩ ástrinτ ì
variable≤ usinτ thσ STOR┼ commanΣ a≤ in:
STOR┼ "thi≤ i≤ ß testó T╧ A.
Experimen⌠ áshow≤ tha⌠ thσ followinτ simpler¼ undocumenteΣ synta° als∩ áworks║ ì
A="test"« á Herσ ╔ kno≈ froφ bitte≥ experiencσ tha⌠ therσ shoulΣ bσ án∩ áextrß ì
space≤ arounΣ thσ equa∞ sign« I⌠ ofteε works¼ bu⌠ no⌠ always« Mos⌠ ácommand≤ ì
tha⌠ áaccep⌠ quoteΣ litera∞ string≤ wil∞ als∩ accep⌠ strinτ ávariable≤ á(e.g.¼ ì
B=┴ o≥ COM╨ ┴ "yes").
CommanΣ álinσ parameter≤ arσ als∩ availablσ t∩ scripts╗ the∙ arσ passeΣ áiε ì
thσ áforφ áoµ variable≤ representeΣ b∙ thσ number≤ ▒ througΦ ╣ ásurroundeΣ áb∙ ì
curl∙ ábraces« Thesσ variable≤ caε alway≤ ac⌠ a≤ strings« Iµ the∙ expres≤ áß ì
number¼ áthe∙ caε als∩ bσ useΣ a≤ numerica∞ expressions« Thus¼ wσ migh⌠ áhavσ ì
A="{1}ó áo≥ %A={1}« Thσ latte≥ expressioε wil∞ producσ aε erro≥ iµ thσ áfirs⌠ ì
commanΣ linσ tokeε doe≤ no⌠ represen⌠ ß number.
Iµ áthσ scrip⌠ invocatioε commanΣ linσ doe≤ no⌠ havσ ß tokeε referenceΣ áb∙ ì
aε áexpressioε oµ thσ forφ {1}¼ {2}¼ etc.¼ thσ scrip⌠ wil∞ bomΓ witΦ aε áerro≥ ì
message« á Thσ áexpressioε {n:default⌐ allow≤ ß defaul⌠ valuσ t∩ bσ áuseΣ áfo≥ ì
paramete≥ 'nº iµ nonσ i≤ giveε oε thσ commanΣ line« Thi≤ defaul⌠ valuσ caε bσ ì
null¼ a≤ iε {1:}.
è Strinτ ávariable≤ ácan¼ álikσ thσ commanΣ linσ tokens¼ ábσ árepresenteΣ áiε ì
expression≤ áb∙ curl∙ brace≤ arounΣ thσ lette≥ (e.g.¼ {B})« Iε sucΦ áß ácase¼ ì
thσ ávaluσ áoµ thσ expressioε i≤ thσ strinτ oµ character≤ áalone¼ áanΣ ádoublσ ì
quotσ ácharacter≤ mus⌠ surrounΣ thσ expressioε iε mos⌠ situations« Therσ áarσ ì
exceptions« Thσ SA┘ anΣ SENDOU╘ command≤ (describeΣ iε thσ nex⌠ section⌐ ácaε ì
bσ useΣ directl∙ witΦ ß variable¼ a≤ iε SA┘ A« Thσ followinτ tw∩ command≤ arσ ì
equivalent:
SA┘ "Variablσ ┴ ha≤ thσ value║ ",A,"/n"
SA┘ "Variablσ ┴ ha≤ thσ value║ {A}/n"
Thσ curl∙-bracσ expression≤ caε bσ useΣ t∩ concatenatσ text¼ a≤ in
A="{B² anΣ {C}"
Expression≤ áoµ áthi≤ typσ arσ no⌠ documenteΣ anΣ worδ onl∙ iε áscrip⌠ áfiles╗ ì
the∙ áwil∞ áno⌠ worδ iµ entereΣ directl∙ a⌠ thσ ME╪ commanΣ áprompt« á Simila≥ ì
expression≤ caε als∩ bσ useΣ t∩ finessσ variable≤ int∩ command≤ tha⌠ ánormall∙ ì
d∩ no⌠ takσ them« Herσ arσ somσ examples:
se⌠ bauΣ {b² (where¼ say¼ B="1200")
se⌠ bauΣ {c}0░ (where¼ say¼ C="24")
got∩ {1² (where¼ say¼ tokeε ▒ i≤ LOOP)
{a² (where¼ say¼ A="se⌠ bauΣ 1200")
╔ áhavσ no⌠ figureΣ ou⌠ ho≈ t∩ spli⌠ ß strinτ variablσ int∩ part≤ (sucΦ áa≤ ì
words)« ╔ als∩ haΣ neve≥ beeε ablσ t∩ figurσ ou⌠ ß wa∙ t∩ conver⌠ ß numerica∞ ì
variablσ áint∩ ß string« ╔ stil∞ can'⌠ d∩ i⌠ directl∙ (thing≤ likσ B={%B² ád∩ ì
no⌠ áwork)¼ bu⌠ thσ scrip⌠ iε Fig« ▒ doe≤ i⌠ indirectl∙ (invention≤ likσ áthi≤ ì
arσ ápar⌠ áoµ thσ fuε oµ writinτ thi≤ column)« Yo⌡ ma∙ no⌠ bσ ablσ át∩ áfull∙ ì
understanΣ átha⌠ áscrip⌠ unti∞ yo⌡ havσ reaΣ througΦ thσ res⌠ oµ áthσ ácommanΣ ì
descriptions.
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
B="ó initializσ t∩ nul∞ string
%y=%Γ se⌠ u≡ scratcΦ variablσ %y
LABE╠ LOO╨ loop
%x=%∙-10*(%y/10⌐ ge⌠ thσ lowes⌠ digi⌠ ¿ %∙ MO─ 1░ )
iµ %x=░ B="0{B}ó preconcatenatσ thσ appropriatσ digit
iµ %x=▒ B="1{B}"
iµ %x=▓ B="2{B}"
iµ %x=│ B="3{B}"
iµ %x=┤ B="4{B}"
iµ %x=╡ B="5{B}"
iµ %x=╢ B="6{B}"
iµ %x=╖ B="7{B}"
iµ %x=╕ B="8{B}"
iµ %x=╣ B="9{B}"
%y=%y/1░ dividσ numbe≥ b∙ 10
iµ %y>░ GOT╧ LOO╨ continuσ unti∞ numbe≥ i≤ reduceΣ t∩ 0è
Figurσ á1« á CommenteΣ álistinτ oµ ß scrip⌠ tha⌠ wil∞ áconver⌠ áthσ ánumerica∞ ì
variablσ á%┬ int∩ strinτ forφ iε strinτ variablσ B¼ froφ whicΦ i⌠ caε bσ áuseΣ ì
iε ávariou≤ commands¼ sucΦ as║ SE╘ BAU─ {B}« Thi≤ codσ coulΣ bσ madσ áint∩ áß ì
subroutinσ b∙ addinτ thσ commanΣ PRO├ NUM2ST╥ a⌠ thσ beginninτ anΣ END╨ a⌠ thσ ì
end« Iµ yo⌡ tr∙ thi≤ script¼ d∩ no⌠ ente≥ thσ comments¼ oµ course.
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Input/Outpu⌠ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Program≤ ágenerall∙ arσ no⌠ terribl∙ usefu∞ iµ therσ i≤ n∩ wa∙ t∩ ge⌠ ádatß ì
iε o≥ out« Herσ i≤ wha⌠ ME╪-Plu≤ offers.
Thσ áSA┘ commanΣ allow≤ onσ t∩ senΣ character≤ t∩ thσ screen« á I⌠ áaccept≤ ì
argument≤ oµ litera∞ strings¼ strinτ variables¼ anΣ numerica∞ expressions¼ áa≤ ì
in
SA┘ "Thσ suφ is",%A+%B,"/n"
Therσ áarσ specia∞ characte≥ codes¼ sucΦ a≤ "/nó (newline⌐ o≥ á"/ró á(return)« ì
CombineΣ áwitΦ áthσ ávide∩ command≤ mentioneΣ earlier¼ áthσ áSA┘ ácommanΣ ácaε ì
producσ somσ prett∙ fanc∙ displays.
Therσ i≤ als∩ thσ undocumenteΣ PRIN╘ commanΣ tha⌠ doe≤ almos⌠ exactl∙ áwha⌠ ì
SA┘ does¼ excep⌠ tha⌠ i⌠ doe≤ no⌠ neeΣ quotatioε mark≤ arounΣ thσ litera∞ tex⌠ ì
anΣ ádoe≤ áno⌠ interpre⌠ an∙ specia∞ expressions« T∩ PRINT¼ everythinτ ái≤ áß ì
purσ ástring« á Therσ áare¼ thus¼ ß couplσ oµ thing≤ PRIN╘ ácaε ád∩ átha⌠ áSA┘ ì
cannot« Herσ arσ somσ examples:
PRIN╘ Pleasσ ente≥ "Helloó a⌠ thσ prompt.
PRIN╘ Usσ thσ expressioε {1² fo≥ ß token.
Iε áthσ firs⌠ case¼ PRIN╘ allow≤ onσ t∩ senΣ ß doublσ quotσ characte≥ át∩ áthσ ì
screen« Iε thσ seconΣ case¼ ß strinτ tha⌠ woulΣ bσ ß variablσ expressioε ácaε ì
bσ displayed.
Thσ SENDOU╘ commanΣ i≤ useΣ t∩ senΣ litera∞ tex⌠ o≥ thσ content≤ oµ ástrinτ ì
variable≤ t∩ thσ modem« Thσ PREFI╪ anΣ SUFFI╪ command≤ caε bσ useΣ t∩ ádefinσ ì
string≤ átha⌠ arσ automaticall∙ sen⌠ beforσ anΣ afte≥ thσ designateΣ átex⌠ át∩ ì
savσ áonσ áthσ átroublσ áoµ havinτ t∩ includσ ácertaiε ácharacter≤ á(sucΦ áas¼ ì
perhaps¼ ß carriagσ returε anΣ linefeed⌐ explicitl∙ witΦ eacΦ string« Longer¼ ì
fixeΣ string≤ caε bσ sen⌠ usinτ thσ TRANSMI╘ command¼ whicΦ send≤ thσ content≤ ì
oµ áß áfilσ jus⌠ a≤ iµ yo⌡ werσ typinτ i⌠ iε termina∞ mode« ┴ pai≥ áoµ ádela∙ ì
constant≤ control≤ thσ speeΣ witΦ whicΦ thi≤ "automatiπ typistó performs.
Thσ áINPU╘ ácommanΣ allow≤ interactivσ entr∙ oµ thσ valuσ fo≥ áß ánumerica∞ ì
variable╗ ACCEP╘ doe≤ thσ samσ thinτ fo≥ ß strinτ variable« Thσ TIM┼ anΣ DAT┼ ì
command≤ áallo≈ áonσ át∩ acces≤ ß rea∞-timσ áclock« á Beside≤ ádisplayinτ áthσ ì
informatioε oε thσ screen¼ thσ command≤ arσ supposeΣ t∩ pu⌠ thσ ácorrespondinτ ìèdatß int∩ thσ VALU┼ variable« Therσ i≤ ß buτ here¼ anΣ thσ timσ valuσ i≤ useΣ ì
b∙ ábotΦ ácommands« á Therσ appear≤ t∩ bσ n∩ wa∙ t∩ determinσ áthσ ádatσ áfroφ ì
withiε áß script« Thσ PEE╦ anΣ POK┼ command≤ allo≈ onσ t∩ looδ a⌠ anΣ ámodif∙ ì
memor∙ áfo≥ thσ ultimatσ iε hackinτ froφ ß scriptí (Tha⌠ probabl∙ ámean≤ átha⌠ ì
therσ woulΣ bσ ß wa∙ t∩ finΣ thσ datσ iµ onσ reall∙ needeΣ i⌠ badly« I⌠ áals∩ ì
mean≤ tha⌠ thσ completσ ┌-Systeφ environmen⌠ caε bσ accessed.)
Flo≈ Contro∞ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Likσ á┌-System¼ áME╪-Plu≤ ha≤ flo≈ contro∞ command≤ t∩ allo≈ áß áscrip⌠ át∩ ì
perforφ átest≤ anΣ t∩ ac⌠ differentl∙ dependinτ oε thσ results« Therσ i≤ áthσ ì
standarΣ áse⌠ oµ flo≈ command≤ IF¼ ELSE¼ anΣ ENDIF« The∙ suppor⌠ ╕ level≤ áoµ ì
nestinτ (jus⌠ likσ ┌-System)« Herσ i≤ aε example:
I╞ %B=1200
B="1200"
ELSE
B="2400"
ENDIF
Additionally¼ therσ i≤ ß singlσ-linσ I╞ command« I⌠ i≤ distinguisheΣ áfroφ ì
thσ ámultiplσ-linσ áI╞ b∙ ß commanΣ (ß 'thenº clause⌐ tha⌠ i≤ par⌠ oµ áthσ áI╞ ì
statement« Herσ i≤ aε example:
I╞ %B=240░ B="2400";SA┘ "240░ bps";GOT╧ CONTINUE
WitΦ áthσ ásinglσ-linσ IF¼ wheε thσ tes⌠ fails¼ thσ entirσ álinσ ái≤ áignored« ì
Pleasσ notσ tha⌠ haΣ therσ beeε ß semicoloε afte≥ thσ "I╞ %B=2400"¼ theε áthi≤ ì
woulΣ havσ beeε ß multiplσ-linσ I╞ (albei⌠ witΦ severa∞ oµ it≤ 'linesº oε áonσ ì
line).
Thσ ásinglσ-linσ áI╞ ácommanΣ ácome≤ iε especiall∙ áhandy¼ ábecausσ ái⌠ ái≤ ì
generall∙ áawkwarΣ át∩ áperforφ ß GOT╧ jum≡ ou⌠ áoµ áaε áIF/ELSE/ENDI╞ áblock« ì
AlthougΦ áthσ manua∞ warn≤ agains⌠ it¼ therσ i≤ (I'φ prett∙ sure⌐ n∩ harφ ápe≥ ì
sσ áiε doinτ it« I⌠ i≤ jus⌠ tha⌠ yo⌡ havσ t∩ makσ surσ tha⌠ thσ ENDI╞ i≤ áno⌠ ì
skippeΣ les⌠ yo⌡ ge⌠ nesteΣ deepe≥ anΣ deeper« A≤ witΦ ┌-System¼ yo⌡ havσ át∩ ì
makσ surσ thσ IF≤ ge⌠ terminated╗ unfortunately¼ thi≤ i≤ no⌠ s∩ easy¼ because¼ ì
unlikσ á┌-System¼ áME╪-Plu≤ áha≤ án∩ áXI╞ o≥ ZI╞ ácommand« á Herσ ái≤ áß áver∙ ì
convoluteΣ examplσ oµ ß wa∙ iε whicΦ i⌠ coulΣ bσ done:
iµ %b
sa∙ "TRUE/n"
got∩ cont
endif
.
sa∙ "FALSE/n"
got∩ done
.
labe∞ cont
endifè .
labe∞ done
sa∙ "No≈ wσ arσ done/n"
Therσ i≤ als∩ ß SKIPI╞ command« Iµ it≤ tes⌠ i≤ true¼ theε thσ nex⌠ commanΣ ì
i≤ áskipped« Notσ wel∞ tha⌠ whilσ thσ I╞ commanΣ ma∙ ski≡ aε entirσ álinσ áoµ ì
commands¼ áSKIPI╞ áskip≤ áonl∙ onσ command¼ n∩ matte≥ ho≈ áman∙ ácommand≤ áma∙ ì
appea≥ oε thσ samσ line.
Numerica∞ Tests
¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
Flo≈ ácontro∞ woulΣ no⌠ bσ ver∙ usefu∞ withou⌠ way≤ t∩ tes⌠ things« á Firs⌠ ì
wσ wil∞ conside≥ test≤ oε numbers.
Tes⌠ result≤ arσ expresseΣ numerically¼ witΦ ░ representinτ falsσ anΣ ánoε-ì
zer∩ (usuall∙ 1⌐ representinτ true« Yo⌡ caε seσ thi≤ fo≥ yourselµ b∙ enterinτ ì
thσ ácommanΣ "SA┘ 1<2ó o≥ "SA┘ 1>2"« Thσ followinτ logica∞ operator≤ ácaε ábσ ì
useΣ fo≥ comparisons║ equal≤ (=)¼ no⌠ equal≤ (<>)¼ les≤ thaε (<)¼ les≤ thaε o≥ ì
equa∞ t∩ (<╜ o≥ =<)¼ greate≥ thaε (>)¼ o≥ greate≥ thaε o≥ equa∞ t∩ (>╜ o≥ =>)« ì
Notσ tha⌠ thσ ME╪ manua∞ ha≤ ß misprin⌠ iε onσ placσ anΣ give≤ thσ áno⌠-equa∞-ì
t∩ operato≥ a≤ '!'« Tha⌠ i≤ incorrec⌠ anΣ wil∞ no⌠ work.
AlthougΦ ácomparisoε test≤ returε ß numerica∞ value¼ thosσ value≤ fo≥ ásomσ ì
reasoε ácanno⌠ bσ useΣ iε arithmetiπ expressions« Iε othe≥ words¼ áyo⌡ ácan'⌠ ì
havσ á(%A>%B)*(%A<%C)« á A≤ áfa≥ a≤ ╔ caε tell¼ thi≤ ámean≤ átha⌠ áyo⌡ ácanno⌠ ì
perforφ ácompounΣ átests¼ ásucΦ áa≤ "I╞ %A>%┬ áAN─ á%A<%C"« á Performinτ ásucΦ ì
compounΣ test≤ i≤ madσ morσ difficul⌠ b∙ thσ fac⌠ tha⌠ thσ 'thenº clausσ oµ áß ì
singlσ-linσ áI╞ ácanno⌠ ábσ anothe≥ IF« Iµ yo⌡ won'⌠ bσ áusinτ áGOTO¼ ánesteΣ ì
multΘ-linσ I╞ command≤ wil∞ d∩ thσ trick« Otherwise¼ yo⌡ migh⌠ havσ t∩ resor⌠ ì
t∩ somσ explici⌠ arithmetiπ a≤ iε thσ following:
%z=1
if %a<=%b then %z=0
if %a>=%c then %z=0
if %z then ....
Wσ ástarteΣ ou⌠ assuminτ TRU┼ (%z=1)« Theε iµ eithe≥ conditioε wa≤ false¼ áwσ ì
se⌠ %· t∩ false.
Beforσ wσ leavσ thi≤ topiπ (╔ kno≈ we'vσ beeε herσ ß lonτ time)¼ ╔ havσ át∩ ì
mentioε átha⌠ áME╪ áha≤ áß buτ tha⌠ cause≤ i⌠ t∩ áissuσ áfallaciou≤ ábu⌠ áver∙ ì
annoyinτ erro≥ report≤ wheε comparisoε operation≤ arσ performeΣ witΦ numerica∞ ì
variable≤ áhavinτ áparticula≥ ávalues« á ╔ áhavσ ácarrieΣ áou⌠ áß ánumbe≥ ááoµ ì
experiment≤ át∩ átr∙ át∩ determinσ thσ exac⌠ circumstance≤ áunde≥ áwhicΦ áthi≤ ì
probleφ áoccurs¼ ábu⌠ ás∩ fa≥ ╔ canno⌠ fathoφ ß pattern« á Thσ átroublσ áofteε ì
appears¼ however¼ witΦ comparison≤ t∩ standarΣ datß ratσ values¼ sucΦ a≤ á300« ì
T∩ ge⌠ arounΣ thσ problem¼ ╔ sometime≤ dividσ thσ variablσ b∙ 100¼ comparσ ái⌠ ì
t∩ á3¼ 12¼ o≥ 24¼ anΣ theε multipl∙ i⌠ b∙ 10░ t∩ restorσ it≤ áorigina∞ ávalue« ì
Wha⌠ ß pain!
è
Strinτ Tests
¡¡¡¡¡¡¡¡¡¡¡-
String≤ arσ compareΣ usinτ thσ COM╨ command« I⌠ accept≤ tw∩ strings¼ áeacΦ ì
oµ áwhicΦ caε bσ eithe≥ ß litera∞ strinτ o≥ ß strinτ variable« Thσ resul⌠ áoµ ì
thσ comparisoε i≤ returneΣ iε thσ VALU┼ variable¼ whicΦ caε theε bσ testeΣ fo≥ ì
ß ávaluσ oµ ░ o≥ 1« Thσ STA╘ CAS┼ settinτ determine≤ whethe≥ áthσ ácomparisoε ì
wil∞ bσ casσ sensitivσ o≥ not« Therσ i≤ ß buτ witΦ thσ COM╨ command╗ i⌠ áwil∞ ì
no⌠ ágivσ thσ answe≥ ▒ (true⌐ wheε botΦ string≤ arσ nul∞ ("")¼ thougΦ i⌠ áwil∞ ì
worδ áiµ onl∙ onσ strinτ i≤ null« Iµ yo⌡ wan⌠ t∩ seσ iµ ß commanΣ linσ átokeε ì
wa≤ given¼ yo⌡ caε usσ thσ followinτ tests:
COM╨ "{1:² ó ó "
COM╨ "{1:}Xó "X"
Aε extrß characte≥ (spacσ o≥ 'X'⌐ i≤ concatenateΣ t∩ thσ strinτ representeΣ b∙ ì
{1:}« Yo⌡ migh⌠ als∩ use
COM╨ "{1:null}ó "null"
Here¼ áthσ áfirs⌠ áparamete≥ canno⌠ bσ null« Iµ tokeε ▒ ái≤ áno⌠ ágiven¼ áthσ ì
defaul⌠ ávaluσ á"nulló wil∞ bσ useΣ instead« Oµ course¼ iµ áthσ áuse≥ áenter≤ ì
"null"¼ thσ samσ resul⌠ wil∞ bσ obtained« Thσ tw∩ earlie≥ example≤ are¼ thus¼ ì
morσ robust.
Therσ i≤ onσ oddbal∞ commanΣ tha⌠ ╔ don'⌠ kno≈ wherσ t∩ put║ SLEEP« I⌠ ái≤ ì
sor⌠ áoµ áß flo≈ contro∞ command¼ s∩ I'l∞ sticδ i⌠ here« I⌠ ájus⌠ átell≤ áthσ ì
systeφ t∩ g∩ t∩ slee≡ (pause⌐ fo≥ ß designateΣ timσ interval.
Prograφ Contro∞ Commands
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
ME╪-Plu≤ ásupport≤ severa∞ scrip⌠ prograφ structures« Thσ maiε uni⌠ áoµ áß ì
scrip⌠ prograφ i≤ ß scrip⌠ file¼ whicΦ ha≤ ß filσ extensioε oµ MEX« I⌠ caε bσ ì
invokeΣ áa≤ ß maiε prograφ b∙ thσ REA─ command« I⌠ caε als∩ bσ invokeΣ áa≤ áß ì
subprograφ áb∙ áthσ D╧ command¼ whicΦ allow≤ script≤ t∩ bσ nested« ╔ ád∩ áno⌠ ì
kno≈ áho≈ dee≡ thi≤ nestinτ caε be¼ bu⌠ ╔ jus⌠ testeΣ i⌠ t∩ fivσ levels« á Thσ ì
STO╨ ácommanΣ i≤ useΣ t∩ exi⌠ froφ ß REA─ o≥ D╧ command« Iε thσ forme≥ ácase¼ ì
contro∞ return≤ t∩ thσ ME╪ prograφ (possibl∙ iε termina∞ mode)╗ iε thσ latter¼ ì
contro∞ áreturn≤ t∩ thσ scrip⌠ tha⌠ calleΣ thσ curren⌠ script« ┴ scrip⌠ áals∩ ì
terminate≤ áautomaticall∙ a⌠ thσ enΣ-oµ-file« Thσ STO╨ commanΣ áunfortunatel∙ ì
display≤ áaε áannoyinτ ámessagσ áabou⌠ áthσ áscrip⌠ ábeinτ áaborted« áT∩ áexi⌠ ì
gracefully¼ ái⌠ i≤ bette≥ t∩ pu⌠ ß labe∞ a⌠ thσ enΣ (e.g.¼ LABE╠ END⌐ áanΣ át∩ ì
exi⌠ usinτ GOT╧ END.
┴ áREA─ ácommanΣ ma∙ bσ giveε insidσ ß script« Iε thi≤ ácase¼ ácontro∞ ái≤ ì
transferreΣ t∩ thσ ne≈ script¼ whicΦ overwrite≤ thσ olΣ scrip⌠ iε memory« WitΦ ì
thσ áD╧ ácommand¼ áthσ ne≈ scrip⌠ line≤ arσ reaΣ int∩ memor∙ áalonτ áwitΦ áthσ ì
currentl∙ runninτ script.
è ╔ áalway≤ áenjo∙ áwritinτ thesσ column≤ becausσ ╔ enΣ u≡ áaskinτ ásomσ áne≈ ì
question≤ áanΣ learninτ somσ ne≈ answers« Jus⌠ now¼ t∩ seσ ho≈ ME╪ áworks¼ á╔ ì
wa≤ examininτ thσ memor∙ imagσ afte≥ ß ME╪ scrip⌠ filσ ran« First¼ ╔ álearneΣ ì
tha⌠ thσ scrip⌠ tex⌠ i≤ storeΣ backward≤ iε memor∙ startinτ froφ nea≥ thσ top« ì
╔ áverifieΣ átha⌠ afte≥ eacΦ D╧ i≤ finished¼ thσ memor∙ i≤ áreclaimeΣ áanΣ ái≤ ì
availablσ áfo≥ usσ b∙ anothe≥ subroutinσ script« ╔ als∩ discovereΣ átha⌠ áthσ ì
entirσ scrip⌠ file¼ includinτ al∞ comments¼ i≤ reaΣ int∩ memory.
Wσ ácaε dra≈ somσ importan⌠ conclusion≤ froφ thesσ observation≤ áabou⌠ áho≈ ì
comple° script≤ shoulΣ bσ implemented« First¼ therσ arσ severa∞ advantage≤ t∩ ì
usinτ áversion≤ áoµ scrip⌠ file≤ froφ whicΦ comment≤ havσ beeε ástripped« áThσ ì
file≤ will¼ oµ course¼ loaΣ faster¼ anΣ therσ wil∞ als∩ bσ morσ rooφ iε memor∙ ì
fo≥ ásucΦ áthing≤ áa≤ filσ transfe≥ buffers« Man∙ ME╪ áuser≤ áhavσ áruε áint∩ ì
problem≤ oµ insufficien⌠ memor∙ whilσ runninτ comple° scripts« Second¼ i⌠ ái≤ ì
ß ágooΣ áideß át∩ áchaiε áfroφ onσ scrip⌠ át∩ áanothe≥ árathe≥ áthaε ábuildinτ ì
everythinτ áint∩ ß singlσ script« Iε m∙ P├-Pursui⌠ script¼ ╔ chaiε t∩ ß áver∙ ì
smal∞ áscrip⌠ jus⌠ afte≥ thσ remotσ systeφ ha≤ beeε reacheΣ anΣ thσ scrip⌠ ái≤ ì
abou⌠ t∩ pu⌠ mσ int∩ termina∞ mode.
Structurσ i≤ permitteΣ withiε aε individua∞ scrip⌠ filσ a≤ wel∞ iε thσ forφ ì
oµ áinterna∞ subroutines« Subroutine≤ begiε witΦ ß PRO├ á(procedure⌐ ácommanΣ ì
anΣ áenΣ witΦ aε END╨ (enΣ-procedure⌐ command« The∙ arσ invokeΣ b∙ thσ áGOSU┬ ì
command« á Again¼ á╔ ád∩ no⌠ kno≈ ho≈ deepl∙ the∙ ma∙ bσ nested¼ ábu⌠ á╔ ájus⌠ ì
testeΣ theφ t∩ ╣ levels.
Scrip⌠ file≤ ma∙ als∩ contaiε unstructureΣ prograφ grouping≤ (tha⌠ anathemß ì
t∩ moderε structureΣ programming)« Thσ LABE╠ commanΣ allow≤ an∙ poin⌠ iε áthσ ì
scrip⌠ t∩ bσ giveε ß name¼ anΣ thσ GOT╧ commanΣ allow≤ ß brancΦ t∩ tha⌠ point« ì
Thσ manua∞ indicate≤ tha⌠ thσ namσ ma∙ havσ u≡ t∩ 1╢ alphabetiπ character≤ anΣ ì
warn≤ tha⌠ thσ linσ witΦ thσ LABE╠ commanΣ ma∙ no⌠ havσ an∙ othe≥ command≤ áoε ì
thσ line« ╔ kno≈ tha⌠ ╔ havσ ruε afou∞ oµ tha⌠ restrictioε iε thσ past¼ ábut¼ ì
oddl∙ enough¼ iε m∙ testinτ no≈ ╔ wa≤ totall∙ unablσ t∩ generatσ ß problem« ╔ ì
trieΣ everythinτ ╔ coulΣ thinδ of║ aε immediatσ semicolon¼ ß semicoloε afte≥ ß ì
spacσ áo≥ áß tab¼ tab≤ afte≥ thσ semicolon« The∙ al∞ workeΣ ájus⌠ áfinσ á(ho≈ ì
coulΣ ME╪ tel∞ tha⌠ thi≤ wa≤ jus⌠ ß test?).
Thσ ámanua∞ i≤ clearl∙ wronτ wheε i⌠ say≤ tha⌠ onl∙ áalphabetiπ ácharacter≤ ì
caε ábσ áused« á ╔ áassumeΣ átha⌠ i⌠ reall∙ ámean⌠ áalphanumeric¼ ábu⌠ áiε ám∙ ì
experiment≤ á╔ learneΣ tha⌠ absolutel∙ an∙ character≤ caε bσ áused¼ áincludinτ ì
spacesí á Herσ arσ thσ rule≤ tha⌠ emergeΣ froφ m∙ testing« First¼ al∞ áspace≤ ì
anΣ tab≤ afte≥ thσ LABE╠ commanΣ arσ ignored« Tha⌠ poin⌠ mark≤ thσ ábeginninτ ì
oµ áthσ áname« á Nex⌠ áonσ start≤ froφ thσ enΣ oµ áthσ álinσ áo≥ áthσ ácommanΣ ì
separato≥ characte≥ anΣ strip≤ al∞ tab≤ anΣ space≤ backward« Tha⌠ poin⌠ mark≤ ì
thσ enΣ oµ thσ name« Wha⌠ i≤ betweeε thosσ mark≤ i≤ takeε a≤ thσ label« á Fo≥ ì
example¼ áonσ caε havσ ß labe∞ oµ "ENTR┘ 1ó (witΦ thσ embeddeΣ spacσ anΣ áwitΦ ì
o≥ áwithou⌠ thσ quotσ characters¼ iε fact)« MinΣ you¼ ╔ aφ no⌠ b∙ áan∙ ámean≤ ì
suggestinτ tha⌠ yo⌡ usσ sucΦ labels« A≤ ╔ mentioneΣ before¼ ╔ havσ no⌠ alway≤ ì
founΣ áME╪ t∩ behavσ exactl∙ thσ wa∙ i⌠ diΣ iε thesσ experiments« á Iµ áanyonσ ì
caε figurσ thi≤ ou⌠ morσ precisely¼ ╔ woulΣ reall∙ likσ t∩ hea≥ abou⌠ it.
Thσ áothe≥ thinτ ╔ learneΣ froφ thesσ experiment≤ i≤ tha⌠ ME╪ alway≤ áscan≤ ì
fo≥ ß labe∞ froφ thσ beginninτ oµ thσ script« Thi≤ mean≤ tha⌠ iµ yo⌡ usσ áthσ ìèsamσ labe∞ ß seconΣ time¼ thσ seconΣ occurrencσ wil∞ neve≥ bσ found.
Onσ Scrip⌠ Example
╔ ájus⌠ don'⌠ fee∞ righ⌠ abou⌠ presentinτ al∞ thi≤ informatioε áabou⌠ áME╪-ì
Plu≤ command≤ withou⌠ showinτ a⌠ leas⌠ onσ rea∞-lifσ example« Figurσ ▓ áshow≤ ì
thσ áfina∞ áscrip⌠ iε m∙ P├-Pursui⌠ scrip⌠ suite« Oncσ á╔ áhavσ ásuccessfull∙ ì
connecteΣ t∩ thσ outdia∞ cit∙ anΣ reacheΣ thσ remotσ systeφ there¼ ╔ chaiε át∩ ì
thi≤ script« Let'≤ looδ a⌠ i⌠ linσ b∙ line.
Thσ firs⌠ linσ begin≤ witΦ ß period¼ s∩ i⌠ i≤ ß comment« ╔ alway≤ áincludσ ì
ß titlσ linσ anΣ ofteε adΣ somσ descriptioε oµ thσ functioε oµ thσ scrip⌠ áanΣ ì
thσ parameter≤ i⌠ takes.
Thσ rea∞ worδ oµ thσ scrip⌠ begin≤ a⌠ linσ 3« Iε man∙ part≤ oµ thσ script¼ ì
╔ d∩ no⌠ wan⌠ thσ outpu⌠ froφ command≤ t∩ sho≈ oε thσ screen« No≈ ╔ do¼ s∩ á╔ ì
issuσ thσ "SCREE╬ ONó command« I'Σ als∩ likσ t∩ star⌠ witΦ ß cleaε screen¼ s∩ ì
╔ issuσ CLS¼ too.
Iε álinσ 5¼ thσ scrip⌠ tell≤ thσ use≥ thσ namσ oµ thσ systeφ tha⌠ ha≤ ábeeε ì
reacheΣ á(tha⌠ áwa≤ previousl∙ storeΣ iε strinτ variablσ F⌐ anΣ a⌠ áwha⌠ ábauΣ ì
ratσ (previousl∙ storeΣ iε strinτ variablσ B)« Theε thσ scrip⌠ drop≤ onσ int∩ ì
termina∞ mode¼ wherσ onσ caε worδ interactivel∙ a≤ lonτ a≤ onσ likes.
Wheε átermina∞ modσ i≤ exiteΣ (b∙ pressinτ <ESC╛ E)¼ thσ scrip⌠ resume≤ áa⌠ ì
thσ álabe∞ áLOOP« Linσ ╣ prompt≤ thσ use≥ t∩ ente≥ ß command« á Iµ áthσ áuse≥ ì
enter≤ á"M"¼ átheε thσ maiε men⌡ scrip⌠ i≤ run¼ allowinτ onσ t∩ ácal∞ áanothe≥ ì
systeφ iε anothe≥ o≥ thσ samσ city« Linσ 1░ accept≤ thσ answe≥ froφ thσ áuse≥ ì
anΣ place≤ i⌠ int∩ strinτ variablσ A.
Iε álinσ á11¼ thσ user'≤ answe≥ i≤ compareΣ t∩ thσ strinτ "M"« Iµ ái⌠ áwa≤ ì
"M"¼ átheε thσ variablσ VALU┼ wil∞ havσ thσ valuσ ▒ (true)¼ anΣ linσ á1▓ áwil∞ ì
causσ thσ scrip⌠ t∩ chaiε t∩ thσ scrip⌠ filσ PCPMENU.MEX« Iµ thσ use≥ entereΣ ì
anythinτ áothe≥ thaε "M"¼ theε executioε wil∞ continuσ a⌠ linσ 13¼ áwherσ áthσ ì
user'≤ ácommanΣ ái≤ executed« Wheε tha⌠ commanΣ ha≤ completed¼ ácontro∞ áwil∞ ì
returε t∩ linσ 14¼ whicΦ branche≤ bacδ t∩ labe∞ LOO╨ anΣ ß promp⌠ fo≥ áanothe≥ ì
command.
Thσ user'≤ commanΣ caε bσ jus⌠ abou⌠ anything« Fo≥ example¼ iµ i⌠ i≤ á"T"¼ ì
theε áME╪ áwil∞ áente≥ átermina∞ modσ fo≥ ámorσ áinteractivσ áwork« á Thσ áonσ ì
restrictioε á╔ áhavσ found¼ i≤ tha⌠ onl∙ ß singlσ commanΣ caε bσ áentered« á ┴ ì
multiplσ commanΣ line¼ witΦ command≤ separateΣ b∙ semicolon≤ (o≥ whateve≥ áthσ ì
designateΣ áSE╨ ácharacte≥ áis)¼ ádoe≤ áno⌠ worδ fo≥ áreason≤ á╔ ád∩ áno⌠ áye⌠ ì
understand« á Maybσ á╔ wil∞ havσ figureΣ i⌠ ou⌠ (o≥ onσ oµ yo⌡ wil∞ áhave⌐ áb∙ ì
nex⌠ time¼ wheε ╔ wil∞ cove≥ thσ rea∞ gut≤ oµ thσ P├-Pursui⌠ script.
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡-
01 .. PCPCONN SCRIPT -- Connected to Destination System
02
03 screen onè04 cls
05 say "Connected to ",F," at ",B,"00 bps/n/n"
06 t
07
08 LABEL LOOP
09 say "/nEnter single MEX command (or M for menu): "
10 accept A
11 comp A "M"
12 if value=1 READ PCPMENU
13 {A}
14 GOTO LOOP
Figurσ á2« á Thi≤ ái≤ thσ fina∞ scrip⌠ iε m∙ áP├-Pursui⌠ ásuite« á Jus⌠ áafte≥ ì
connectinτ át∩ áß áremotσ system¼ ╔ chaiε t∩ thi≤ scrip⌠ t∩ freσ áu≡ áa≤ ámucΦ ì
memor∙ áa≤ ápossiblσ áfo≥ áothe≥ uses¼ sucΦ a≤ ácapturσ ábuffer≤ áand/o≥ áfilσ ì
transfe≥ buffers« Linσ number≤ havσ beeε addeΣ fo≥ referencσ purpose≤ iε áthσ ì
text.
[This article was originally published in issue 44 of The Computer Journal,
P.O. Box 12, South Plainfield, NJ 07080-0012 and is reproduced with the
permission of the author and the publisher. Further reproduction for non-
commercial purposes is authorized. This copyright notice must be retained.
(c) Copyright 1990, 1991 Socrates Press and respective authors]