Marinchip 9900 Pascal User Guide

Table o� contents

Introduction -2 1. 1. Acknowledgem-ents - 2

Pascal - references 2

Using Pascal program -3 3. 1. Writins the -3 Comp i ng 3. 2. 11 th e program -3 3. 3. Executing the program -4 C-f' Program 3. 3.1. compatibilityparameters -4 3. 4. File rile usage -5 3.5. temporary -5 Pascal J4. Changes to the Sequential language -5 Scanner changes 4. 1. lower -5 4. 1. 1. Upper and operatorcase -5 4.1.2. Standard characters -5 delimiters '-1 4.4.1.1. 4.3. CommentOdd length -6 strings -6 Errol' messages -6 5. 1. Run-tIme errors -6 5. 1. 1. Overflow -6 inter errol' - 5. 1. 2. Po or 6 5. 1. 3. Case subscript out Or range -6 incorrect for variant reference 5. 1.4. Tag fieldoverflow -6 5. 1. 5. Heap -7 overf 5. 1. 6. Stac k I ow -7 5. 2. errol' System messagesname -7 5.2. 1. ,Bad program -7 5.2. 2. Huh? p -7 '�'\ 5.2. 3. Bad arameter -7 S. 2. 4. I/O error -7 I/O errol' on rile -7 5.2. 5. Kernel se en i u 5. 2.6. i callederror by q t al program -7 5. 3. Comp ler messages -7 U 5. 3. 1. Try again -8 5. 3.2. Temporary file missing -8 Object fIle lost 5. 3. 3. Source file .... 8 5. 3. 4. unknown -8 Destination - ' 5. 3. 5. Compilation errorsHIe-unknown 8 5. 3.6. -8

U

.> .' � . J

i arin p Pascal User Guide M chi 9900

Introduction \

Pascal an a apta io of the 9900 is d t n equential Pascal for the Marinchie com t system. Sequential 9900 pu r c, ascal a minicomputer-based v r on programming language Pascal, :-larinchiPis e Sl of which is widely regarded as the l a in language ein use toaay 'or the e d development of reliable software throughg the techniques st u u d the of r ct re · rogramming. contains th� features found in other programming Pascal an gua g es such as tran , and , DASIC, For Algol, but adds the following � o tant capabilities: ·J m p r Pascal allows the user to define new data types. and to thereby extend la gu g . The error-prone coding p rog explicitthe numbers n a e eliminated. of ram items as 1S ,'-.1 Pascal allows st uc es data to be built. This allows the definition and convenientr tu use0' tables containing various kinds of that are essentialr in software0' development. data Pascal has extensive compile-time checking of program correctness. The o i er detects all inconsistencies in use of types, whichc mp cl tc hes most of the frequently-made e ror s invariable For tran. DASIC. or Assemb anguag e prog ramm i ng. r a 1 y I Pascal provides i ter variables and dynamic st rag e allocation. These fe'atures p opermitn v i rt ally all systems .programmingo (e. g. , compiler and )u tasks to e irel be written n � y in Pascal. Pascal provid es pro�ram control statements which eliminate the d forpowerful the "go to Programs written without "go nto"e s tat ments are statement.m c h easier to und erstand and e e u debug. Systems integrated Pascal into Marinchip isc the D Executive, I Pascal r g a s may be i e any program the 0 other that The Pascalp p r m comp i r calledis al Pascalk program that runswithin under I�i]arinChiP ystem. has l e -control the Disc Executive. the ' of e

Acknowledgements :�}. 1. Marinchip Pascal s s te based upon the Sequential Pascal c ompil er y m is by Per r in h Hansen and i mp e m n ed by Alfred Hartmann on a at t e CaliforniaB c ofl Technology.e t The C.design of the .�cl�he DP 11/45 Institute : esigned runtime system which interfaces Pascal programs to the Mar i nchip - ascal Disc dra s upon the d ig the Solo o er t i g system. Executive h w n of p a and implemented Per esBrinch Hansen, and the Concurrent Pascal and kerneL writtenby Robert Deverill and Tom Zepko. ,i'lIesigned ] by n cf' Pascal references ' hiS manual will attempt to teach the language Pascal. The is not � the following re'erences for a description the language.user to 0' ;i The references will be citeCl by the numbers given throughout the text of .1 referredthis manual.

Hansen. Architecture of Concurrent Programs. Prentice J[1] HalLBrinch Englewood Per. The New .:Jersey, book describes Solo operating systemCliffs, and the Concurrent1977. PascalThis language. Thethe- Solo operating system environment is simulated Pascal, so this r e e ce user-levelby Marinchip pr�gramming in ;Se�uentialbook is th�Pascal. definitive The informationf er n onon the language Concurrent Pascal is Marinchip Concurrent Pascal, om availableitself applicablethe to This is one the anotherb�oks c aboutpiler for also operating M9900.system software designof bestlarge systems developinggeneral that has ever written. and the 0' in been _ lj Marinchip l User 9900 P c as a Guide the a u e on w t e to be a l n a exists It r 1'19900.a or a i t t is g g as-for it any serlousg theuser o-f tis l n used as re-ference to the lan uage, not u i in Pascal. It indispensable Pascal. and - [3] Jensen, K. , N., Pascal Manual s , York. 1974. i THE tutorial e' Wirth, aUser compiler and Report (Second ,cl l edit6600 ionwhich>. Springer-Verlag,respects New from the This mp r in Sequential manual for Pascal. It describes a P sca for the Controc l Data the 1'19900, still is an to P al for users dif-fers someothe r Paswellcal asco thoseile '-for butwith excellent introduction as familiar �rogramming languages as learning programming in Pascal.of I Finally. users become allif e s Pascal, y programsa work the exhortIng llikest e mostr on forever, you ou Pascal fanatic, andp uicontinuen the wonder�newsletter of writlngshould containing the t hat �'lGroup,first which bl ishe all the Pascaltime workingthe world. This majorJoin forum Pascalreporting User�s is s a quarterly implementations, commentarynews \ �'labout'regarding from around use, and proposedthe modi.pications.for To Join, implementations,for one yearexperienc� using and send $4 the language,membership its ofGroup, to: University Computer Mickel 227 EX Pascal UnIonUser�s Street c/o Andy 208 SE of Center: MinneapolIs.University MNMinnesota 55455

Using 3. Pascal

to compile, Pascal r t , run programs on ;lThiS t e m familiar of M9900 sy s The to be the -\he chapter describes. how w i e Text and The the Editor. Disc systemuser o m p ise assumes d withrespective use o ' is Marinchipfor thoseExecutive and nt is reader who .' Guides with c n refe rred to the User r,]UnfamiliarL. . more information regarding them. program the Writing program Pascal accordinga r to n o the the in h 2. t with Editor. is written pt othe elanguager spe cificatiofree-form,ns thein references to the mpil is :rext need not be given c e and entere d iwhen system the . ser with J.' Since input Pascal c totally defines the I ny with which interface between concernethe d column operatingalignments entering the data.must Pascal system. This seque ntialto a program beginsit compiled.a "prefix" This easily be is is most program and the the t prefix by the "RF" te x The user the of theprogram file, be.poree er Ii�JccOmpliShedi a addedtop and ' .. command in editor. should go nt the command: RF PREFIX where nam e or 'rile y em the PREFIX the on s R a pre (The standard supplied ! i-scc 0text t editor,i n .pis i x the x is the st � Systems by name). This will c�py the rloarinchip in g the astandard file that . pre.p i by before line prefix the in the command requiredfirst of user program. with � the Concurrentis compiler,explicitly can define systems e he operating , I user different to to add prefixIn to programs beca�sePascal having order to J:he Pascal the user the new c n to be run interfaces new programs. ability to allowha ge ,', m s be complete of the prefix u these . refix it available.under A be .poundsystems. in of standard the • jrogramsxplaining may section 5. 2 r�ference [1], t definition line by line 11.2. Compiling the program has stored a Pile it Pascal with the Text ��ncema� c i bethe om le withprogram the Pascalbeen Compiler. The compiler is calledEditor, from the in e n S e ,11 p d (' t t : y t h ta b b p :> i :�. ,i ��, � : � �: .::J 0 m:; : � .�:_ : : � : : >�: : : : � : : Pascal Us er Guide - Marinchip 9900

here t file containing the Pascal program, is he source

the file where the compilation listing h ld be p ac e d , and is s ou l j the which the code wil be written by the �ile Thein l i ingexecutablefile may obJecti t her a discl or a devic e ile ompiier. < s t > be e file f )�� . as console or a p r inter . the ist i n file spec i fication is �).such the If l g L0 c- mitted (only. two c mmas appear etwe i and file o b en the < put> no program listing e ate d . Errorn messages. G r names),still be printed will besyst g enem example, to compileif any. on the console. For a i rogra CALC, ac n g the executable co e a d m named pl i d in file name XCALC, and :-'Jill compile to the ons l e , command be: · enii�g. the listing c o the would PASCAL(CALC.CONS. DEV.XCALC)

no listing were d sired , the comm d would be: e an

PASCAL(CALC •• XCALC)

the comPilation is successful, the compiler will simply exit back f.-]p operating the operating s t em command prompt willto J he . system and y s reapp�ar. c om i er found errors in the p g ram , the message: J If the p l ro Compilation errors

appear on the compilation listing a s been sent to a �l ill console. If the h it must be examined to determine the cause of the errors. l.disc file, program 1].3. Executing the program been successfully com i e d , can c ed , ike Pascalother program has the Executive,p simplyl it by typingbe exthee utn ame anyfile underprogram. Disc Note that it is not ec s a r to link LI-Ince.a f the containing the n e y programs hePore are directly executable after Pascal To theexecution: program XCALCthey compiled above. one would execute s -.-JomPila.tion.imply type: \L XCALC

e e w per tin t em comma pt a p a r s . lJnt h con sol hen the 0 a g s y 5 n d pro m p e C�: Pr o g ra parameters 3. 3. 1. m

I rograms called from the c n ole be passed parameters. s l are e c o ed in o mayf l i g the name the Thesefile n l s parentheses o l w n of L�arameters program. file a es Pascal com p iler the passed are containing)tamp of The n mPr g raom parameto the b e i er e 'ntegers 1 e ( s impleprogram numbers), para meterBooleans. valueso (representedters may e th I b� the words TRUE or identifiers (any non-numeric character st g L.1n r FALSE), rln other than -TRUE or two appear, the p r e e that FALSE). If consecutive commas a am t r in be considered be i te d . and type m willParameters tose paratedo t by commas,its Justwi likell be procedureset to ! arametersILTYPE. Pascal. are struc parameters their use I .�osition in The ture of program and ".C" .. ithin Pascal program explained in the sec ion "Program Parameters" a t is To Pascal reference compatibility between inrograms chapter 5.2and ofprograms written(1]. easeth languages, the in o er parentheses , the t are Renee. the two program l s optional. ,� urrounding parameter :j"ails: i PROG1(OUT, IN. 10) ) an d: PROG OUT, IN, 10

r e e qui val en t . ic_1 '/ .. are allowed Pascal programs in . the other M9900 ·mplementation.ascal programs and programs·to callpass ar ete to pr09 t hey call can p am r s the rams � th e same parameters are entered th e e. "!h a ,jlin manner on C onso I . is . 11 OW5 ascal to called either from another program dlrectly from be or programswithout any modification of the program. allows the as It also '·· ascal to be used dlrectly as the y tem commana language, ... "., s s avoiding con . nee for asp e r 0 c3 9 e .,,'

File compatibility \ 3. 4. Pascal reads files that are compatible with and wr ites ASCII other Marinchij) standard WRITEARG, .,�., those used blJ all software. The C:�lMarinchiPREADARG, and WRITE procedures Sequential Pascal ar used to read and write READ, Both disc and deviceOr files may be used withoute '� The capabilityfiles. to a t e Pascal program as input or ' output problems.from a �se n h ! not currently r i d d in Marinchip Pasc�l: and program is o 'must be files. The READPAGEo p r v ande inp ut are output supported as alternatives READ WRITEPAGEWRITE. I/O also and ' J procedures Th OPEN, CLOSE, to me c an ism Sequen t ia a cal be e PUT, and GET I/O h 1 P '5 � used r a and write anv disc file. The random-access na e maythese lrequeststo ewilld be g e they are use deviceof files. tu r of . \ i n r 1f ACCEPT and o d p oce ure ared on according to the r DISPLAYdo c umentation ford communications implemented with the sy stem consol �lTheI fequential e. Pascalo re accesses the sy st em i e to . The identifier The LOOKUP p e d fi le c .- assed LOOKUPr u fully general file name as describedry in the Disc to may be a d r I xecutive U�erc L � Guide. temporary usage 3. 5. Compiler file

Pascal compiler us�s two y t m standard temporary files, TEMP1$ TEMP2., d in the compilation.the s s eIf for some reason other files are and u g to ��hebe (for example,r when compiling a very large where th e r standardused temporary files are not this programbe acc mpl i specifying the files in the enough',calI on the complIer:ma� o he i l temporary large s d jby PASCAL«input>,

, , ,

in h manner, the compil er will use the named files for its f called t is emporary files.

Ch an es to the Se�uential Pascal language g

chapter des'tribes modifications made to the Sequential Pascal .-- ThislahgUage by Mari n hip Sy stems. Programs wr itten with the intention f I o other machinesthe Sequential Pascal should the eing run n offering avoid I �se c added a in p implementation. o I�_- of the features in the M r c hi

S anne h n c r c a g e s The scanner pha the c m e een mod if ied to permit optional use e OT pil r has b msore like that of standard Pascal. The Sequential Pascal :T·1.or syntax a is accepted withouto modiFication. J�yn tax still and lower case 4. 1. 1. Upper I ) reserved words are accepted in upper and lower both The andcase used in e ter has no e ff ct on matching, case. a e hence ·ckdentifiersidentifiers consideredt now identical by the following are l compiler: the ARGLEBARGLE arglebarge ArgleBargle ArGIEbArGIE

J op erator characters ,4. 1. 2. Standard

Pascal developed on system. so several a standard Pascalwas originally that do not card in the Holl erith of the redefined. Marinchip Pascal accepts both appear code :-keqUentialere operators the standard charac ter as Sequential Pascal circumlocution. ell as the

Sequ�ntial Pasral I 5 U " L.·�l�jlt;����[:,:t��.,:�,:,i���i�l�i�fi�i�t ••ki��p:J;irc;<�� , .

: \ Guide Marinchip 9900 Pascal User

Comment delimiters 4. 1. 3.

Se�uential uses u b e �uote " comments. MarinchipPascal normall� theallows do l the standardcharacter Pascal( , to commentdelimit delimiters to Pascalbe used. alsoThe c l brackets will r brack{ andeted} by double quotes u � ({}) quotesbe ignored in a comment a i n d (), and double wil l be ignored within comme nt whichdef e with curly brackets. Thisde siredallows a llmited nesting of comments, may prove useful when it is to tU'r n off code containing comments.

strings 4. 1. 4. Odd length

Pascal normally that all constant strings (other than _s_ingleSequential characters> anrequires number of characters. t user tocon.tain even characters unnecessarilSincey. this restriction'orces h e has removedlaboriously coMarinchipunt this contain beennumber in the becomp padded iler. withStrings which an odd of chara�ters will an ASCII NUL I ' c e extend even number ha( : 0:no ) haT'act r to programs,the mt0 anbecause such rofin g characters.have T h' i 5 compil.s impacterrors on existingprevious . st s would caused in

5. Error messages

describes error messages that may appear the This chapterPascal in process of using the syst em.

errors 5. 1. Run-time

The messages indicate err or detected during a an Pascal-flollowing program. All these e s e will execution whichof s a the our ofe line mnumberag s withinbe FollowedPascal by p r linewhere identifies s c the r og am the error occurred.

Overflow 5. 1. 1.

An arithmetic was detected. Integers are limited the +32767,overf low are limited approximately to range -32768 to and reals to +-10E75.

Pointer error 5. 1. 2.

attempt which did Afl was made to use a pointer not point to anyth ing.

Case subscript 5. 1. 3. or out 0' range

Either subscript was uts i d e the of th array was used subscript.a or o boundsin a e statementit failed t� match thethe value of thein expressionstatement. CASE to J any of case labels the Tag incorrect for variant 5. 1. 4. field reference

J An attempt was made a in a variant record when the tag indicated the record containedto use fielda structure than the one used.fi eld different ,) �-', u ":j

6 Marinchi p 9900 User Guide Pascal 15. 1. 5. Heap overflow The has tor ge when al o t n g new data te with the run out of l a i ms runaway allocati on or bad storage management. NEW programcon'truc t. Check for s a c i

overflow 5. 1. 6. Stack

The has run for runaway procedure on . l ur programsi out of execution stack. Check rec System error . \5.2. messages The messages are enera Pascal h y following g e d by the T e may occur the r e s compilation or execution . l in p o s of t system. jeither c 2. name . t. 1. Bad program pr am given to system ogr the is badly formed. The name Huh?

program name given to e e th s� stem cannot be found on th e disc. . Th i J 5. 2. 3. Dad parameter

program p r m te parameters be a a e rs were bad. The -must separated by c s st only s m e int g ers , the Boolean constants TRUE 'I commas, and on of i l e '.' i,···jThe � and identifiers characters or less. FALSE, or i of 12 p 1]5.2.4. liD error error cc u re unrecoverable lID has o r d loading a program. servicing an request by ,, .JAnor lID a program.either Pascal -made 5. 2. 5. liD error <-Filename> on -File error has occurred when using the on namedliD This m GET or PUTcompilation. liD namethed file. ay appear during a I-F the l1n is the t mechanism the obmessagej e file on tfie c�ll to the c�mpiler, I ) is probably to hold generated object code. object file TEMP1$c tooTEMP2$, smallspeciPied required I-F is or larger temporary files to \thecompile program. See the on "Compilerthe " the se t l temporary file usag above for alternate temporary ar-FlIese for information on how to specifyc e the 'jCOmPilation. by sequential program ·5. 2. 6. Kernel called

n r a in be , hiS message indicates an i te n l error the Pascal It may ·caused an object file created by p l is e m r b -F re rexecutioifn. the o i e overwritsystem. ten c o \ Compiler error \5.3. messages are following messages typed by the compiler on the console hen occur. Tfiese not the which indlcate source errors are fhe errors are svstemmeSSAoes ar� program which placed in the messaQeslisti�g Pil�. Thosp Marinchip Pascal Guide 9900 User I � @nerally self-explanatory,

Try again

message is compil@r called parameters. A This given when the is o o r typ@d withfollowing bad this message ca n c l thei the mp il will bethe compiler. -jSamPleindicating proper form 0' a call an I e

Temporary missing file '15.I 3.2.

requires two yfe s. and TEMP2$, oral' !Thepresent compiler disc. temp either oril TEMP these1 $ missing,to be on messagethe will system appe ar. If both of files are I thiS Object file lost 5. 3. 3.

he was to save the the named obJect Ie. � compiler unable object code in fi Source unknown )5. 3. 4. file

file not exist . j The source input specified does

Destination unknown . 1\5. 3. 5. file listing named does not exist. ]The Pile Compilation errors I -5.3.6. ,

c led c,onta i ned user should the program foromp i error errors. The examine 1-1The1�.listing file compile,.. messages. I]

, J J rtr''-�','-,;< � J ' ..