JOY 5+?ÿÿhžàYʶk…òI”z ¶kÐ pÐhLâ9̪I” Y÷%Á³Ðz ¶kZ-–K¥Òi´Z-–KELï$ЦI”z ¶{x ULï$ЦI”z ¶zx ULï$ЦI”z ¶yx ULï$ЦI”z ¶xx ULï$ЦI”z ¶x ULï$ЦI”z ¶~x ULï$ЦI”z ¶}x ULï$ЦI”z ¶|x ULï$ЦI”z ¶sx ULï$ЦI”z ¶rx U€ xLayout 0x U ÈpHomeoftheFree LðChapter5ð€ xLayout 0x U ÈP ,p>>>x€ xLayout 0x U Èx€ xLayout 0x U È€€ xLayout 1x U ÈÜ $Layout 1xˆP #(-27'pseudo-code',whichislaterexecutedbyarun-timemonitor.Also  ž‡likeCBASIC,linenumbersareunnecessary,exceptaslabelstoindicatethedestinationforGOTOandGOSUBstatements. +SincemostofyouwillhavehasexperienceofBASIC,inoneor  otherofitsdialects,IshallnotdetailEBASIC'skeywords.Sufficeto  W@saythattheyweredevisedfromthethen-proposedANSI(AmericanDNationalStandardsInstitute)specificationsforaBASIClanguage.€€x€$Layout 1xˆP #(-27,  <>),therearealsokeywordswhichhavethesameeffect(EQ,LT,GT,  NE).LETismandatory.Allwordsareconvertedautomaticallytoupper  1case,unlessaspecialcompileroptionisset.NotealsothatEBASIC  pYdoesnothaveanyprintformattingstatements,noranymeansofîcallingmachine-coderoutines.  @)Stringsandarraysaredynamicallyallocated.Arraysmayhaveanynumberofsubscriptsandmaybestringornumeric. -Stringsmaybeupto255charactersinlengthandallnumbers  1aretreatedasreal(floating-point).Arithmeticisprecisetoseven  YBsignificantplaces,numbersbeingstoredin32bitswitha98-bitgexponent!!  O8Bothsequentialandrandom-accessfilehandlingissupported  äÍandrecordsizesmaybevariable(knownas'unblocked')orÌuser-defined('blocked').Recordsareseparatedby.  oXCreatinganEBASICprogramtakesthreestages:Firstly,the  lUsourcelistingmustbecreated.ThisisanASCIIfileandmaybe  W@createdwithanytexteditor(evenED,ifyoumust!).IfanEBASIC  statementcannotbecompletedonasingleline,thenyoumustinsert X€x€$Layout 1xˆP #(-27'utilityandproduces.INTfilesasoutput.Thesemaybelinkedinto  S<theprogramorloadedatrun-time,asyouwill.Only8080codeis  †oallowedandtheproceduremustendwithaRETinstruction.The º£followingassemblerdirectivesarerecognised:ORG;SET;EQU;  2IF/ELSE/ENDIF;DB;DW;DS;READ;WRITE.Assemblyoptionsallowyouto  fOhavealistingduringpass1ofcompilationortoproducea.COM  ™‚(directlyexecutable)file,ratherthana.INTone.Aswellas  6standardarithmeticoperators,JRTASMallowsNOT,AND,OR,XOR,MOD,HIGH,LOWandthebooleans,EQ,NE,LT,LE,GT,GE.  CONVERTMtranslatesMicrosoftformat.RELfilesinto.INTformat  files.CRTMAPenablesyoutoquicklyformataterminalscreentoyour M6ownterminal'srequirements.LETTERSgivesthefacilitytoproduceØlargeletters,9lineshighandfrom4to10columnswide. eNJSTATisusedtocomputeseveralbasicstatistics,givenan  ãÌarrayofrealnumbers(upto1000elements)asinput.The iRcomplementaryprogram,JGRAFhasfacilitiestocreateandformat  J3graphicaloutput,eitherasx-yplotsorasscattergraphs.OutputKcanbetoconsoleorprinter,butitisfairlybasic. ;$OneotherfeatureofJRTPASCALisnotanexternalprocedure,  butaninbuiltoption,knownasActivan.Thisisafacilitytomonitor  oXtheexecutionofaPascalprogramandthenprintagraphofthe  )amountoftimespentexecutingeachportionoftheprogram.Thisis  useful,notonlytoassessoverallperformance,butalsotohighlight €x€$Layout 1xˆP #(-27Thiswasbutasimpleexample,buttrycodingthatinBasic!  6PROLOG,asyoucansee,isabletoapplydeductivereasoningandit  8!isthisthatmakesitsodifferentfromotherlanguagesandsuchacpotentiallyusefultool.  ˆqApplicationsforPROLOGinclude:databaseenquiry;natural kTlanguageprocessing;automaticdeduction;artificialintelligence;  'expert'systems.Becauseitsuseofnaturallanguageisonlyslightly  mVconvoluted,itisalsoeasyfornovicestogettogripswithandsuitableforscholasticuse. EPROisnotafull-blownPROLOGimplementation,butitisclose  ^GenoughformanyexistingPROLOGprogramstorun(orbeadapted).  jSArithmeticoperatorsaremissing,butnumbersupto5500maybe  )comparedwiththeLESSpredicate.EPROsyntaxisnotquitethesameÓastheClocksin&Mellishstandard,butadaptationiseasy.ÎEPRObuilt-inpredicatesareasfollows:LESS-comparestwostrings(ornumbers)DLIST-liststhewholedatabaseðREAD-inputsastringfromconsoleordiscfileREADLIST-inputsalistfromconsoleordiscfile0READCHAR-inputsasinglecharacterTWRITE-writesitemstoconsoleordiscfile0WRITECHAR-writesasinglecharacterlOPEN-opensafileforinputàCREATE-createsanewfileforoutput¤APPEND-appendsdatatoanexistingfilelCLOSE-closestheoutputfile¤SAVE-savestheentireprogramtodiscàLOAD-loadsanewprogramfromdisc/-stopsthecurrentpredicatefrombacktrackingbeyondthismarker,whensearchingformatches. EPROcomeswithasampledatabaseanda'whodunnit'logicpuzzle  foryoutosolve.Youalsogetthesourcecodefortheinterpreteras  A*Z80assemblylanguagefiles.Abriefintroductiontextisincluded,Ѐx€$Layout 1xˆP #(-27'Coincidentally,theDutchoverseasradioservice(NOS)hadits  ;$owncomputerprogramandhadbeenbroadcastingshortprograms(as  +cassettetones)forasmallnumberofpopularmicros.Theyhasbeen  approachedbyvariousotherusersforlistings,sothattheprograms<couldbeimplementedontheirmachines. TheresultwasthatNOStookBASICODEandthecassettepatchon  vboardanditspopularitygrew.Atonepoint,theprogramswereGretransmittedbytheBBC. Asastandard,BASICODEwasprettyminimalandprogramstended  pYtowardthetrivial.However,itdidhavetheadvantageofalmost  0totalportabilityandtheNetherlandsCP/MUserGrouphaveputintoX€x€$Layout 1xˆP #(-27'beginwith,althoughacompiledversionisalsoprovided,asisthe’assemblersourcefile.BCBCisnotcapableofcompilingitself!€P€x€$Layout 1xˆP #(-27=tofile<=fromfile ðZ=terminateinput  Thereisalsoa2000-lineeditorandpageformatter,thelattercbeingsimilartoROFF(q.v.Chapter1)inoperation.  ThesourcecodecontainsimplementationroutinesforCP/M,CP/Mø86,ConcurrentDOSandMSDOS.€Ø€x€$Layout 1xˆP #(-27