You are on page 1of 48

, . .

.• .'

.,

Rlcha~d L. Slt~~
D.1n~~l ft. h~l<l ~$

7~.J.'S - 029

J iltluary, 1<;19

Departm ent of

APPLIED PHYSICS
and

INFORMATION SCIENCE
.'

,.

University of California at Sar:t--Diego -. La Jolla. Ca. 92093


-. ' -,
(

- UHIVERSAL P-COCE DEfI NIT! ON, v~rSI O ~ (0.2J


It1cha r d L. SHu IncI Il,ntd R. P. rk ~ n"
• J.,,~a,.y . 1919

This dOCUD e" t .,uper"ed., the e.rller C5-029 dOCUDent da ted Octobe~,
1976. No GI.jo r ehan,e .. t>;Iv<: bun .. .cit. but ~e t Y?O correct i ons and
dlfln1tl c nd re{1neroent .. h ... e be .. n a dde<l. ChJln,~" a tl,,',. ttun ty ~ ~re
Olarked with vertic.l bars In til t lurlln. If an enUre Se Ctl on 1s "tun,,,O.
the" the vertic il b ar only OIIrks t~" section headlnl. The ch,nllU ;o re
SUe,.,. ,r! :t ed bel o w.

Sict i o n ad~M; IV.t. ~-"~~


Sec ti on .. C:de<:!: !\' .I1. The
( I'llno r "h.r.~e$ : V. U_code Inst r uet! cr.s.
See~lon' ~d"d ! n. 22!!!
Add t d; App e ndix C. Curr!nt 2!l! and :',..",0.)' Trou .
Ad Cled: Ap~ end !x D. ~..."" ar y 2! Ooti",!zlnS Tr.nsrQ .... 8t:o ~s.

Th is wcrk h. s be en supported by L ' \ff"nc~ Llv",.::I or e L. ~ or.~ crl es.


under contract n~b~~ ~g62109. and by Los Al .mg~ Scienti fi c Labor a to~y.
under con t r act nucCer 2)22(.

.'
(
A Uo<ode pr OS"_ h re:>r ~".nt~d as , rile of CM.~"ctc .. s_ The rile Is
s,,_ , rft ed int o ll~es or tCI t. Ir~ elc~ line looks like In o .. dlr.f~ Y
uUOl=ly l. n s ~, e st~teQcnt. U-<>ode Is Intended t4 b y rc~ r esen t .d In

ASC!!, but other ch.r.c~er seU «WIldn!", it le.st
Gl i a S. 51n,1I qUelte , period • • nO:: b l ank wH I do .


Th er e are two d itter ent kinds of fi elds In • U-eod c l 1na : ( I ) rl , ld"
wtt h • s.~ .n tt c Interpretati on , . nd (2) f i eld s wh ieh .rc c~pl et.l y
",nln t e rp reted , c%c e pt for n lct ,utcl'l wit h .. ,, \11th .. n .ld on a no t he ,.
. .
li ne. The ti rst kind Dr ri d d in d ud u opeodes , lI ~ory_ and ".e. -typ e
des l ln.to '-5, .nd In t e,ers . Thes e flcl ds eonSlst only o f uppe r -ca. e
lette r s or dtg!t ", The seco" d ~l "J
\ " .. l U1lu "ha ... cte,. string" . 1IDel&,
Ind .. cencnt". Th.~ . fi elds cln usually conta in .n y c h a r a ct e .. I t I l l .
Th~' , ehar.eters outzide the ~pper _ ca ,e ASC I I ,e t May OCCY r only In
vnlnterpreted fhl(!s.

Line, of U-code are e x pect e d ~ be var labl e-le nsth ASCII . deliMited
oy <c r >. (If> . or (crlf> . or wna te~er oatc~e, t he definition o f IOLN I n

c th' .orre'p"r.ding Pued l... plftllen tatlon. rhe(!- len &t ~ ( bl~ n k _~dded)
l i nt' are pos, lbl e. bYt no con t ~n Latlon line conven t:on is su~ported.
Th e upper Oour.d on t he h nlth of I IJ -ccd e Hne t!lO ezsenthll y detRral.n...:l
by t he 51:e o f t he I . r ;:tst possible set or charlcter st r ln,. p i ", tno ,,;:h
charaeter s (or opc"de and del~1II1ter s. O.t IJCSO. IJ-code ~Ines are se;o.rat:<i!
by (e r > • • nd t ~.e lo n;: est pout ble U ne is 255 cnlr~cterz. A ll: l t of 1:'<3
cha r a cte r s 1!lO d efi ni t ely too ~1l1 for char~cter str~nBS and !lO e U. )

li' lthin ~ line, rldds . r t delimited b y one Or ,"O r e blanks. The UStL
Ch ld is first. (oHowd by the OFCOn. (ollo" ed by 'l'e ro o r .. ore OPE~AIIO
(le !ds . f o l!,,,.fl! by a COl'lH[M T rhld. n.. label fi ~ld ," u st ~tar t "I th th,
f 1rst charaet~r o f th~ lin e. 50 • ltn ~ starti n g with a blank hiS no l .be l
t!e l~ . for eaell 5~eeitlc o peed l, tiler ..... I fi xed n.."ber o f o per and5 .
so no ubisui ty UI5t5 about ho .. . any operand Ci~ld, to upo!ct.
follo wing th" ope r ancl5 . tllere is a camoent field " lIieh I , nplJ c !tly
relainej by dl U-code proce ssor •. Th i !lO field nt ends frOCl! t he
• deli:,.I :!ng bl anks on the left t o tnd-of-l1ne On tl'le riiht. Tl'lUl ,
cc~~e nt' c~n~o t cont ain le'd in, blan k!lO . bu~ t h.y ~a y contiin ~O . dd~

.' bl .n k . . The c=tnt rleld ), ;on " es cape v alve" f or Fass ins txtra
unlr.t .r ;:r e t e d Infor"''' tl on I n t tl .. ij-co<:e.

The hbel r ield h restricte< to a "" n;", .., of a


ch.rlCters ( u u ns!cn
to 12 or 16 wi ll be con, i d,r,d) • • nd ... a y centa!n
, any cha r ac ter5 ex cep t
bl.nk5. lmpleo:ilfnt o r, u e enecur •• <'d. ho we v er . t o .t i e l< to upper .nd lower
caoe tHter • • <I! .. i t , . underscore. dollar .ISO. ~nd per~ od . Ll b.e l. are

r U3R(! for thru


ter" "pr ocedure"
pur~3 e~:

d~T '
(1) pr oc..aun n~ e, {nQtt : In th; , p~p.,r,

lIIuns "pr oee dure Ol" function" ~ltu furt!'! .. r


th e

q u~ l;fl e~l. (~l v ;trhO le n ~"' u In the SY~b ,, 1 table !nstruc:lon , an<l {3J

the tir ;e t s o f J=~ I nstruc ti ons. utel" hue g lobsl scope ( .. it:"l t ~.e
• possl bh nee I'll"" of 51:1 l~bd. ). SO tile J L1:IP hr,e~ " AI" and the
pr oc~ur e n.III " "A I " are not both .llo~" In th e l ao e progr . ... ~n

par:l" u1 ... , J~ P ta r g.ts must be unique over an .nt: ... U_ code pro§r~, not
• J~t .ntl1in nell procf;f .... e •

The opcode rleld consists of 1__ characters , .nd must con tain UPP E~­
ease letters or digits only.

The "1"".-aIl4 C1elds consi st o f s i ngl e UPP£II-can htte rs. Intelers,


l .b, h, quat~ st r ings , r ul n.... bers . or digit strll\i" re present ,l n, s ets.
Oper.nd~ are blan k delim i ted. with the ~dd itl o na l provl,lon th~ t quot . d
,trlnKs are deliQlted Dy , lnKl. q uotes (an In t . rnal quote Is repr.s.nted
Dy tuo slngl. quotes In a r o w). 101111., th e fore at>' of "' O.lo t rtel ,js ' ar e
el.ar, a few deserve ",.ntlon, The (orDa t of re ~l numbers I s un s.eeif!ed .
S'" the repre, ent nlon ro a y ¥ary [r oft iQph".,nt. tl on t o 1nIplt... ~t~ :lon, th e
representati On o f a s . t eons ta nt eo nslsts or • l ong ~trln s of ones an d
zeros, with no delimiters other th. n t~ e usual bl ank;. (R. ~r~s ent. : lon In
r octal will be considered . but this .. ~ y i ntrO<!u" . Ir, 2",b ~ ;;~!ty a~ou: t he
len,tn of tn. ut, l

The ce...,;.~ t rt.ld " lIS d escri b ed .bov e. r f pr esent. I t "~y e:," : lI~ ~ .
any char.eters at .11 .

.'
tt. S~que net of Llne~

II. Seouence o f L1n~~.

A U-<ode prosr .... eon~\~ts of a BG:I (be,in) I ~ structlon, z e r o or ,"or~


proc~uru, an STP (s t op) Instruction . and an tn<!-of-file.

A U-<:<><I . ~roeedure con~l~t3 of an ~lT (,nter) Instruction . a


pr oced ur e body, and ,n [NO In~ lruetion. The orOt' of procedure~ in U-eod •
• 1s not ~I,n ine a nt . No ~nln B of I""0ced ..... es h .11o",d . and no Juops•
bet",en procedures Ire .llollf'd . The onl, Int.rprCCedur' re(er .nc e~
.ll owed Ire ca lls t.o othe r I""oc edures a nd acc"s to non-local ¥.r hblu .

Wi thin, U-code procedure , there .'Y be Yarlou~ t ab les o f s ta·tic


in(on:l.tlon as~oci.t.<! wl. th that proeedUl'"e, such u actiut10n .. cord ~lzt
definitlon(s), s~ bol table, ~ Ide ef f ects lists. ,tc. Th~se table~ "I l l
occu r In eit her of t va places (or bo t h): · .xactly ,fte r the p!T inst ruction.
or exaotl y berore the ENO Instruct.ion. 110 such U ble infonia"t!:on IIUI
occur In the bo<Iy of the pr oc edure code. Th. plact':lent o f t ab!"• .
info r:eat~OI'I Is not sl&ntrle.nt, so a one- pau COlO I' ll,,. I s free to put

Ir.fo ,.~'tlon ...ner e v er conveni ent . • nd an opti"!:er Is free t o .. ave ~ll 5ue~

hbh~ to the tront of , pn><:cdure .

, Aside Cr COl Ubl~ lr.fo~""t.iOl'l, th e I>od~ of , U-code ,~occd .. r. $t;r~,


w1th , 5e~::H cf rST~ ( pseudo-store ) In5t~uc~~,,~ fo ~ th~ par Bl t~trs, an~
er.ds .nth a Serlt3 or PLOD (ps eudo-lo,d) ins tru c~lons.rQr the rnu ! :
v alu . {s) , follOWed bV a RET ( return) \n5truc t !on. The PST R insu:.Jc : \ens "
.. at ch (In r.V~rse ord.r) the " '..... enU ~"shcd ontO t~e sac k bercr e the
proctdu r " it ca l l.~ . ""il. the PlOD In'truc t lons Il~ teh the r e,ul ts
n~Cttd to ~. pu.hed onto t ile stack "ft. ,. · the proc~ure returnS. E1the~
"(lut"ce .. ay be ""' pty.

Withi" the cede body o f a procedure, bet~'een the PSTfts and the PlOts.
Instruct!ons .. ay O<:"ur In al..ost ,ny order. so lor., ~ s oper,nds pushe<l on
tht na<:k .... tch Ueir ope r ato rs, 'n~ so toni!, as The S,lel; I S fJ1I'TT AT EAC~
JUMP . This llcpliu tha t the st~k :IIust .130 be ""pt Y at eac h label. jus t
before In !'ST (IIir ~ sU<:k J lnnructl on, just .fbr the PSTRs, and just
befo ~. the PLODs. The stack "'1st also neur un<l erno ". Thus . • • tr aia~t­
line piec e cf eO~e ( ba.le block) al""y. be,~o. and ff".i!$ vl th an ,"",pt"/
~tac ~. but "' Y lI"ve ar~itra"Y .tack .... nipuhtion5 ,,!thi n it. inclvd :ni a

nor._~p ty stack 2r ter 2 ~tore . Us e o r the CUP in~ t ryctjon and other
"
op t ,=i;at ~"n~ ",ay have t he effect or ~ut~:~& ," O~e ent, iu on t~e ~tu~

th an cne ",:,nt u~ ee t. ~nr infornu;on whi c h Is On tne staCK and is ~ o be


~reH~veo 2cro ", a e,:i or J""p OuSt b. storM In : c sooe C'O)liei~ .. =cr,

lcc~tion . ~ ken ret rleve<3 after "a,·~s.

'.
. .'-
.....=..-.,-,,:."- .
-- I!! . Tho U_"'Do! ~ Ha ct.1n~

tIl. Tho 1J...; c: d ~ Hac h:r.,. •

r Tho U-code .,~chlne


a hypotl:.etical c=puter In "" leh a ll ?a~cal
"
ccr::.putatlcn lJ f'Xp re S3~. A~ suc h, th" ll-code c:ll chl". uacLl1 dlc utes
oohn for,., of !","ocess ir.; (and he"""
cptiodntlon of tha t pr ocess!n;) can
be upresn<l In U_ ce<lt. and wh.ot !o~s .. u~t be ·under the :over .". For
el ~ple. the U_code •• chine can eJplic!tly re~re~e~t rttc~lni t~~ o~er.nd.

• aM addl ...r; tht<'l, but It doe. not upl1c1tly re~r~Hnt !.plt".,\ul!on t!',.
of non_local addressing. So .11 ~anlpulatlon of possible displ ay
registers, , t a t ic link., etc. \, under the COver. and "annot be directly
optimized at the U-code level. If done at all. It ..u. t b. done In " .
l1clted ~y by the "Translator' fro= U_cod e to •• ehln. languaGe.

IIl . A. ~ Elore.,lon ~.

The np,e.,len stack Is used f O,. th. evduati on Of III n;ores,, !olls.
It ",un be "'pty at j=p point". 11'1 .. any t",pl~tnt3t!on". It ...111 be an
uttn,{on of th e run_tl ... SUck o f activation reco~d", but this Is
nei th.r up~cted ner r tquirK. lr. thh p.por, the ttn:l "stack" 1JIll
al"ays .. un "uvession sUck" , ~il e the t er .. "r u"-tc<:'l' stack " will be
und t o r efer t o t),.
s Uc~ of act1viiUon records.

(
It.",,, of different datu,.p.s .. ay ~e pu~h.d c" ~o t~. s~ ac k. t~~
op"c anc and dUaty!>"s ,"ust al"a Y5 "lteh in :!l.e U_ c od e . so the
ope~atcr

I",ph",. ~t ation of the stack nHd IlQt \nc lrJd e ta, s. rt Is poulb:'o for
vor,. larE. It ... ,. such Is .n entire re eor~. to be ~u"n~ ontO the s : a c k .
IHhou,h ...... y IJ-<:Od e ,enerators ... 11 try to av oid t~ls by pushbl
addr.ss., instead and usi~... Indirect !n'trucHons such as i'tOV ( .. ov e).

Part o r the .. otivation behind the "empty ~tack ~t a Ju:p" ~nd ~'S;R"
to .,atch pa r.".tus" lc1us ~s th~t the st i ck .,ay t> ~ l..,pleote nte<l I n •
variety of ~rd ~' l re re,hhr~. ror ~;.. .,ple, on an IBI1 310 . the ~tlck lillY
be ~~rtly in the g . n . ~al P""JIO"" re,iste~3 (CP R3), p~rtly in the nOiLin,
point nglsttr3 ( FP~s) •• nd partl y in .. ain ...... cry. IJncl. r these
c lr c ~~st.nces. if the stack cont~ln3 3 objects . but their dati typ es are
nct \<no ...". the n It Is 1<:~u lb lf t~ t ell i f the first cbject is I n ~ GP~
or i n FPI. If th e:e th~~~ cbjec : 3 are to be le rt e n t~. s t i ck ac ro sS ..
J""I'. tht d atlty ~ e ' or all three ob jec ts must be df'~db'd at tile label
"h ie!! Is the j,-",,~ t a r .. e ~. ~o i tr3n sla tor cs n flQur e out "h lC~ rc, is t er,
oro I n ~st at :~. It ls ~eL Th;s is ~,slblf. but ...1< .., , : (o r j~-::s. ror
~ r:c~~ce call~, tt.' nack h nec~ss.r':7 use<:! to 1'1S3 p.r ..... urs. 30
eu c,l y t~e u~uc~ ce of d.tatypes on tne st ack 1s " e~ ~ .~ a t t.~. t ,"r~H
( psn,

,
-,' _.... ., ~ .-- .. .. -. . .... 7.-
tI r. The U_e od e )bc lline

The U_,e ~!ne "" ap ls u~~ fo r .. lloe~tl.on of (I)"I'. ao:e. non - b l oe ~ ­


.tr"e ... " re~ .t or ~ ge . T ~e HE\; in,uuetlon all oc~u ... reeo r<;! o f .. 6i~fn

. I:e i n t~e hup .n!:! rHU~~~ .. !:oi ~"'fr to I t . I'ol:'l tfr s in~o the ~f'"
al~' .. y. ~ oin t to the f rent or a reCON!. wi th the sin,le 9 . c~pt,en tha t I t

i, le,al to pa" an d Hlen t or • no n-Dac kfd Tecord as a r eferenee.


p;r;u,eter . ar.d the It e .. ac t ua l 11 pa,sed e an be • pai n ter to the " ld~le of
• re cord. The opt! .. l~atlon 1= pl l cations of thl. are di.eu •• ~ In saet i o n
IV. G.

Th e U_~chlne ~ .I nt.lns In a<tlvltlon record . tac k a t run t l~e.


pu.h!", a ne w activa t ion rec ord ueh tI:e a proced ure I . ealll!"!. ar.d
peppin, on e a t each re t ur n. In g eneral , code In • proee<lur e may refer no t
only to it. loc a l ~.rllble •• bu t 11.0 to g lobal var iable. In staticall y-
ene",pl •• ing ~roeed .... e./bloe ~ • . I n add ftian. t here may ~ e .. an y , ctl vat!cn
re car d. whleh ~ re ,lob1l1 t o an ont:r. pro&r ~::I . • uc~ .~ p a r ~ . o t t ~e hu.o.
ar cCII::,.on (In the rorH an .en.e l b10e\l; 5 .

Th e acti vat i on reco d :or ~ l iven prece~url wi ll I n ~' ~f ~ .l eon~l!.t


ar • hi..r~r~~y of SUb-Ie:: "' at ! "n reco r d~ . The sub -act:·"tlar. Te co r~ .
slQ p1y re~r esent ~lrre r ent pleet' ot t h e ent i r e ac!l va tien r ecer d . but
U"Y ar, in~e tlded t o be _pped i r.to d!:r~r e .~t regh~~r. or ",=ory Ire:!.s
in ! ~ e t a rg et ':lchlne. Thu!I . an aet iv lt!en recard .. ar be sp~i t I nto thr~e
ple"es . having ,.nary t:n>e. A, I • • ~~ C. '11 th per~lp, piece A In tend e:! ~o
bf Illoca ted In IndU regi.te rs , B In noa Un g_poln t . register' • • nd C ! n
"' l in ~e",ory. AIL of t~~~ .peeltlc .Ue"lt! on h ~una. r tl':e eove rs· in the
stns. thn :t.• ~ef1t1Hlon of U_ cod e and the corree:".", at a pro,r.,', do
tlot deper-d an t his lu?"lng . Co~".ptually . th e ple e. , .I.. S. I na C a re just
ditrerent arus ot the ac thlt:on recor~ far. , tun proefdl,1re .

No d ata OOjec: l:Ia y spa n ~ r ou t " o sub _ ac t i vation record'. th iS


,u.r an tee~ that the sut-act!v.t :on recor~s m3Y be allocat~ t o ~hysical

Jter a ~e ar~u 1 1\(le~endeMt o f !IC:> other . A 'Ub-3~ ~i "a t j,on 'feo r:! is
<I,.~~::at~ by t"-e p<lir ( " e!lor1 type, ~lcck n\:fl~.") . ... here m,..,ory t :t~ e is

one of ~. ~ • • r.d C Jtc·/e . • n~ :>lec k nl':"I>~~ is a ~":~,,e aetl'/at!" n recor:


n~ ... ~e ~. In , 'Mer . !. any .,nll!e e~pl! 3 ! letter eJn be u s e~ U a ".."o~:t
~:'~e. ~M 4ny ~OSl,~ ;v e (nor. -:er e) Jr.ccger can !:Ie \,'s.,~ ~, a un :""e blc c ic

~"",eec.
IiI. Th. U-coc. M, chlr.~

( ... ce~t fer c=on blockS ~n<I h ~ap tlo~k', ~~ u;l l~!ne-:l IH~r ) . H Q~t
cc;mpller~ ns' ~n unl""e """,,~O!'r3 to U~II prOC~dure. but not ,,11 P_ c(>d e
progr=3 ha ..... t ht~t n..,b"rs r~cQrd~ j~ CQn .... n:.~nt plac~~. CQnsi<l~r ~I'.'
~r Qc.du re str uctu r~ 3h<>~-n below'

?l; __ _ (block II)


,&: _____ (blgck 12)
PC: ----- (bloc~ f! ) •

PD: (bl<><:k ,~)


,
,.

The 1<><:11 var:abhs (gr p1"oce:1ur. PA Ue in block I . (gr P!! in bl<><:k 2.


etc. Cod~ within ~ c ~n re{ erenct loca l ~"Ti3ble5 (rGG block J , and .15 0
,lc~1l "~r "oh ~ f rOOl bl<><: k3 2 ~nd 1, bu t usu"lIy not variabl es In black
Q. COd ~ ~ i : hln PO ~a n u5u~lly Qr.ly acce~ $ l <><:al ~"ri~blt$ in ~l oc k 4 .od

,1OOds In block I. ror the pur;>osu o f cod. r;.n.rn le n. t h ~~e nhr~ncu


~re ~ sulll"j (In vadeus P_c<xl~~) cosccibtd I>y a static ,,~n'"'& leyel.
d~he" ab=lute ecunt1 ~., b rr e ... H . or rt\n ive, ~~ ~n~i ~.; o ut frc," :r.~
~~rr . ~ t ~r oc~ur~. l~ ' ~dt~~e~, r ef,,~enc ~~ :0 the eute r =en Hock ;,ue

d!~t~nc~ P-eace epcQd es in ~any in"le=~tat lons (LCO .S. LOO. Sft~ ~5.
SiRl . r e r t.'"pu r pcs", er opt:",l,;n;cn. it Is .. ere ~ .. ~r:4nt thH c.aCh .
~ped fle dau object '~Y'-1l.ere In , ?r~&~' " hHC , .... ~" l.: ! ~a::Ie. ~O 1~ t~.e
U_~od. statIc ~eHlnii levels an not use-:!. ar.d un!""" bloc k nl.Cl!>~rs . r e.

--This I,,",T s ntus th,t a rcrtrt~~e to • v.rhbh X d~chred \ n PA ( bl<><:\c I)


is refere nc ed USing n~~tly the sac natle by ~oXe In FA . In PC. ~nd In 'D.
It ~lse B"""a nnes th at the epti.,lar can SOrt cut the Interae :i ens If X
is p'SSI!'<! .S ~ p.:.r-.octcr te 'S, "Mch passes i t o~ a~ • pa r_H .r tQ pc .
which Fas3es ! t on tnc PO. ~l eh alsQ rerers tQ X as a si .. pl" s lQ~al
~ari.~:c. II. can~ot .c ~.:tvc thb ~Slng onl y stalic nest,ns leve ls I n CIl'
ebject n''''es.

It ~ U-eodc preST"'" centains :.=. ccn:oon bloc k3, they can be ;:!ve"
n_.S just ~~kc ether s~b_.ct~ v~t! ~n r eoords ~y e~.es;f.i 3=e .. emory ty~e.
say F (rO" f"e~lrar. ~C<:".," ~nl, rer ~C"'"C~ blecks. and usign ~ .~. ,a~!:
n3m edfb!an~ ceo,.""n bloc~ 3 uni"Uf ,lock "=ber. T!:u~. if cc=on b~ock
r~R!-:l.~ !~ as~';;~"d un1:'~c ~lCCI( n=~e- 99. r"rcr'".~~s tc y~r~a01CS in
rH~t~ ,.. :!! u:::" t ~e ~air <;.~~~ . In a si " t!lr ..... y. ',ar;CU$ r~cc r~ t1~u
~ ~ ~!l .. t.up "'~y ~~ ~s sl~" ed ~~lr~ (S.:;;>. (H.97>. t~c. !t... usf er t~.eSf
hnp t1~es ~Q re!ol"~ ~~.f 'ld~ cffec~z or p",' ''t ef - !~~r~~c.s ·. E! bt
d:,cusse<l In .. e r e cctaH ;n section !'J.i;.
..

Wi.t !l;'n a ''''''''''Y t>~m'k. deH&na,(~ In a <.. er:.or1 t),~ ••


p~rl ~ cular
1I1oc ~ nlJl:".~er> ~ ir
... spe cHle d"ta object 1$ dnllnHed bJ a n (o( fs et .
hr-i,t,,) pa ,,', ~o tnt~rp"Hati"n {~ t .. po~ cd on t~ ~ U$~ ro r the

O r~$et Ind lo" ~ t!l. b ut typ ic all y t::e~~ ... ill h \lOrd s , bytes. or b i t ~. Tr. ..
.. !fut is urc:--orlSln [ .(111 tr.e front o f t he ",,,:,,,"y blOCk. T ~.e h r."ll> o f
• no..::.~ daa obJKt .. ""t be 8r .ater t~.3l'l ~ .. ro: n ro Is reser 'Jr- t o me;"
~unk"o"", hngth", 110 bound ar, .11:;;r:::Ien~ '>r obJe~t patr!n, Is lnher .,, : In
tho U-ccx:e. dtho ... ,h.
sOClle 1.IIplfllenut ions .. ay ,enerata code in ...nit" i ll
obJecu a r e appr oprUte ly dl,ned.

In S'''''''7 ... !!!1! objec t III .n~hln, thH can be rc fe red t o In •


hscal pr Olr .... and It Is spec1t1ed in U· "o<Ie by • quadruple;

<.. cory t ype . block " uc~ .r, offsH . 1enlth>

I hnlth of zero lIIe ans ~ unkr.o " n·, "Id "hue th~ .. ""ory tn'• • no .
\llIe n
b1~k nuo~er ~ay rer.r to ~r t or .n ~ctlv~tion record. ~ C~~O n ~lock. or
a hnp r eeorcclns. heh obj~ot luis a uni,<o.:e n!",~ . ,~ this n""e is the
only one used to refe r to that object.

!n &en er,l. two Objects OIJY r efer to ov, r l~pping Storage. For
o eu~ ple . RECA .,.y
be. recor4 co~ tain1r., oX ar.~ R'!. \(nih t~. e ob j ects n:
and ~ r do not overlap. t t:e cbJec~ R(C~ ou r laps beth of th.:>. ~~se. H
RrCl co nains -arhn t subflelds Rll Jo4 RZ:;, rd unces t.O t~.e~e .. ay
C'Otrl.p lien other. ihlS Is al l ea;>tured b1 the appropri Ue offse tS .nc
hnsth S . which Ire crl&indly o a lculn .. d by t t .• cC'IIpiltr U It ;u~s
s,crage.

'",I I MH C;E~ ; , 0 AS!lL'ME


• arn
Sr.tS o)

P.~CA
R!:!. L:
~[CC R D
,
( 0 AS!lIl:-l[

IlIi[G~ a ;
• s o)

"" ,IN TEG;;R;


CAS E HZ; !t1~E C[R .,.
0; {HI: RDL; Rl2 : RHLl:
1: CRO ; IN1EG~R; R: a ; RHLI
[liD ; Co UCl oJ
R;> ~!AL;

;:h ea ud .bl es ,"I& ~.: be . ll oc a tt ~ ,n .,.,,:or, :ype .~. bl=~ n=~ e r 2 S.


In ,,"' c ~ C~ a n.e II- ecc e n.."e" c f :t... vari~~! u ~r e:
,
I II. Th e lI-<:ode ~.ac hl n~

,
Varia b le U_c od~
,•
na.~e


aEC':' "" "" "• "
1\ ~5
8

"'" "" "" "" ••


"
'" "" "" "'" • 8

'"
'"". "" "" ,." •• •

" "" " "" • 8

"
(lIot, : this r epres~nlatton ""'1\ .
"
not completely una...b11UOIIS
b.c~us, of reCllrslon • • ui tl ph .ct lv a tlo n re cords ulst to' <0, .~,
pr o cedure, and a v lrlabl~ nalll e frCUI an old actlv.tlo n ree<>rd 15 passed
n • reference par_ete. t o a pl!c~ wh ich us ~s tnt sarllt n ..". to r e f e r to a
ne ..... r act ivation record. Th e Opti:nher nandhs this I=billll~y In I
c ons ervat i ve way.)

So 10n; as the s tat ic nestlnl struc t ur e o f prec edures h kno ...". ther~
Is In obvious za pp ing betw~en unique bl oc k n~bers and stat!c nesting
lev ~ls (s e~ the ltl Instr uc t ion In s tet Ion V),

( It Is an=~ In U- code thu 0) l ccal acceU tS via. s.,e cif ic qu,d.


( Ii) &tobd 1I<:ceSS v ia t~ e sa .. e ~ua d • • nd ( iE) • LDA Cl".d adc!r en ) of
t~ e s.at «u.d . p e r ll.~ thcn p us~ H I ~ar a.::lete r. follo,",ed by ~n
! ndlrec t accesS UND o r STO) •• 11 lllru rnull I n ,""c es s to t~.e U <lt dnA
object. Translator :"'ple!llcnntlcns whi c~. sc:>etl""u ~u J) an oOje" ,. in •
rer;hter ~nd - .-SOtn eti.es in "''''"or y ....st "'I~e ~lIr. l~.• t t.-lli, anl,lZ::!'ti on ' ls
not v iol a ttd . Trln slators ire li s' re spo ns ib le for asking su~ e thi t no
loglcd proble .. , Ire tn<;o unt ered If • sub-activation rec o rd Is a lloc ate d
to non-een ~ tl uoUS l oca t ions (reglSttrs) . for u .... ple. a Cr ay _l
''' pitt-e nt.tion migl'\t hav e a U-code mt!S ory type S " i th ons ets O. 1. 2 • • rod
3 ( wo r t! s ) rul'p ~ into I'\ ar<: " a re rtglst~r' SI . S2 . s6. a nd S7. The
Tr. n sh t o r "ust I'lan d le a lIlA of S ,,6 1 2 (tllO _" o rd Object startir.& It U_
c OC: e o ffs~ e I) f o llowtd by a IIOV 2. Juch that t l'\e ac tua l code rt fc ren ces
52 ind 56. ODvlous l y. su c h dlscon tinu i t lts are diff ieult t o ~.nd! e If
array l"dU i •. , I s t nv oh~,

A d.t~ objt~~ has a da t a type o f I~ t ege~. rt31 . • rr31, r.c~rd, e tc,


ne d ,,:a t ypo. 1~ !,en" pr:::l:l.e Sf:' (!. e, net .. us e~ - <lcf:nt1 da:atypf
I •. ! he fa!!"1 1 ,ense). A <h!i "~.i •• t is s~fq.! !.d in a "' toIo r ] rc fe r.n ce
ins!r~ c t~cn by g ivir, both ! t. dst.t :Of ar.<l an ad drtSS! ng .. ua~. T,".er~ is

"""e SOI all r~l:".d.nc y bet" een daU ! ]!,c and lengt:. o f ~he ctlJtc t, byt th ts
! I!. The IJ-cod~ I'.;ocnlne Pa ~ e 10

~~"~<:a~cy I s no: caop!~te. A $i ,"~ le d3l~tl~e $UC~ ~s hl l ,.. , a l '~~ys


• I., ply a partlcu l ~~ . to",;t),. b ut a d~Utype o r "qeco~~ does rIOt ':l r~y such an
llIIpllcatlCI\. Al 30. a d3tatype such as Integer lIay c=e I n uclous
h n't1>~. .ucn as 9 . I!. :;6. Or n bits. A particular I" .. le::~ntn :c~ "omlc:.
I ~ bas~ on • free " hard .. are con_ec.ion. b e ~ .. ~.n ~h e.e va rtou~ len,,~.s ~,y

u~e onl y a .Ing!e dnatype. I . ""l1e anOth.r :",pl e.. entatlon ..tllch "'''5 t

actuallY ,e ne r ote co~~ to co n.e r t bet"cen !er~~n.J ( s uch a. la~ ;70 .hor~
• at:d l ong n onln , p;> ,: nt l . . , u.e dlHerent oat a types fnr the vlrieus
hr",th~ . Th ere 13 no t a preferlOCl fo~ In the U-code d.eflnltlon.

lILt. I n.tructl ons .

The U--rn ;oc htne n"s varl .. ". sUe k-orlenud Instr uction" wh ich are
de~crlbal in d~t~1l In s.ct.lon V. ro~ the tic '" 1I~ln&. t he only poi nt to
be .,I'de Is that tMese Instructions rall Into five bro ad cla ~ses. depe ndh:,
on t heir .r r ec ~ on the V_achlne . Then cl:;s~e5 are:

(1) Jump In. !ructlon ~ • ..tll c h dter tt.e flo " o r control.
(2) Cill I~st~uctlons. whlcb .Iter botM th flo ll or control and the
dlt. ~n.lro"'"tnt.
(3 ) lo~d/Store ln~ t r uctlon$ . .. hich aCC e SS data In ~em cr y .

(l ) Stack : ~ struc~ic~., " hlen o::CX:!fy the sue k but non.i~.. else.
(5) Table instruc!!ons. ,""I".len il "/e st~tjc info~.tlor. . bout a
proctd"rt.

,

h ; t 11

r IV. Spt d~1 Top":s.

eel o w h ~n asso r u",nt or ~t"lo u i hts on certa i n bro~ d topi cS gr U_co:!e


de (!nHlorI ~ <1d ,,~e. Thue d l~us s;on • • r~ a p~~!ud e t o the ~ I_h.bet!~il
list l n. cf U _c gd~ Ins: .-uc:icn. in act~ on 'I . \/e ~ry h e re to o:ot! ute 'CIO t
or the con sid erations ~ehi<1d the ~ . 'c~ d e r~n~ t:on •.

-
IV.'. I'roced .... e Calls.

• U-code proc.d .... e elll Is done by the sequ.nce HST <.,ark sntld.
pus h par .... ter •. call, USe result •. f~r~eter. and results are both
passed on the .tac k. "The HST :lust be don " '11t h an ""'pt y sta c k . Each '
expression which c~lcul~te. a p.r .. eter .,ay optIcnally be roll o l<"" by the
PU 'p,or ~et lr) unary o~ra:or. TIM call~ proc edure .,,,st return ( 1. •• i t
mus t not I%ecute a COTD ou t of Its prccldure body ) .

\/l thin ,cdle<! ~ ocedure. earlhr ve rsi on . of I'-cOCle h.d the


p.r~ete r s :I" icaLl1 ip~.r In so". local v,r L. bh . . In U_code , t he~.
"l us t be upllcit ps'ia in s tr uc ti ons t" shew the CQrrt~ l'o nde nce o( the
p~r.~et ers on tnt ~tiCk to I cc~1 va ri able.. Th:. i. an I r e a In w~lc~
current c","pil e r , t:uy not supply e""'I .~ 1n(or,.. t;oo; 10 I'art ,c '" l~r t~ey
"'Y not ~uPF l y t he d.tat 1P'" o f th e par=eten .

It is expli ci tly lnUMed that t~e O~t~c !:er wiE c!lan ge SCI"" cal: _ b ~_
r ef~rence par = tter~ t o c all_ by_va!ue_ re, ult. The two are e <:u!vl ~tn t ~ !"
th e re (e r enc. p"r~ f ur t. not ,Iso a C<' e.Std by 'n o t~.tr naJII I i : .t. I S •
.Jl o~al var h bl.e __ pr ~no,t.ber par_ehrl. Co nvertin. to val ue_re~ ult ca n ~ut
do,," On \.ht nll:lber o( object . requ i red t o be In fuln ",,,,,, cr y. In, t ..<1 0;'

r eg isttr s. The U-code Imp l ication of .1 1 t~i5 \5 t ha t there ~'Y ~e ~ orf
than ont fLO!) t o re turn ul~es It the end of a proctd\ll'" The .tick
.a t c hing 1. done e • • c ~ly l i ke th e pa ramet t r s.

..... ocedure cal! I' done. tile se t of acctssibl • •c tlv a tlon


"'''t n tv e ~
rtccrd, .. ~y c hange. the display ",,,,,h anl,,, or whatever h u:o ,d for this
cust all be do ne " UI1der t he covers", dri ve n ~ y t he .U ti c "tstir. g level
nucte r. on t~e ENT a nd ~ S T :n~!ructions.

c.,.,~n ~~ I.I -~o~e ~(;~ l:.e GS~ ~l" ~ .,,,e~ ~ ~ 1;> I~i),l y ;~cl~e ~ .,,:"10 r~r.;.
~~. "" ~ tr. ;. bet",.. t t.e f:n al X~P ins trJc t:"" . To en a" le tr.e Opt~I~~ r t o
• r e":O'a redu~~.n ~ c" ~" k ~ "., !t :s .. ~ar"e~ ~~ C>'n ~h e XJP Itse lf l~ U-co~e .
n .• U-cc~e XJ? don onl y I ",u: : ;-" iH br ~ n c~ . u : ;r.; ~ u,."-or: ,,ir. i~dU on
..

The t.o t>;'~ of UJ?, tued ~y .n IJ1' i.s p.-~c""~ by .. ruB (c~"e l .a:>d)
l n~~r",ctl"n In.sLe;ol of t he u.s",1 UB. Thl~ allo"" an U~lIdl c" .. nt of

the n"",,!'.., .. of "ntnt.s In t~.e t~blt. and i t d.so all""," .. iranshtor t o


.ake 'un that all n.t b.. . ncr.<lZ .rt tile $=t l~ni : h on ",.cnln .. "lt ~ lor..;
Ind. ~ort b .. . nc ".es.

The " Inl" checki ng t>efo re tht XJP usua lly c a n be done lli t h CHI< • ••
dl ~uut<l In the ntlt stet Ion. hU- tllr oultl to In ElS[ eta u •• Uk.,
explici t tutin; an<! br.nching .

-
IV.C. Che<:k I nstruc t ion.s.

Th. CHK Instr uction or tar!itr P-codt ' hi.s betn br oke n Into t~
Instr",ctl o~" I n U_c~e: CHKH (ch Kk Min) , and Ol KL tcheek lo .. l. !hl.s
allows lht Opt ill h ... to ...,"ave one or both c h,c k. it the y are .114Y.s tr ue .
A.s ori g inally dul,n~, CHK did .sub,cd pt_ rar.," ,, ~ .c k lnl (or rind-bound.s
.rray.s . ilI!.s No.s b un ex t en(!ed to cheek for nil poin ~ e r s , to che ek slz""
of ~. ·. S. and l r;> c t.tek tag fl~lds In v arllnt r ~eord~ . If a Jusuble-~o u~~ $
Inays ' re f"t" Introdu~~d. CHI{ u lll h;1ve t" bt u:."de~ fur th er.

I t is Im~or~.nt th .. t C~I{ nct be re~l .. e,"" with ncr::oal c=p .rl ~oru ;I •. d
J,,"pl . because such cons~ructs do !\;It hoo ". t~. e p ro~~ r eIII;>hasl~ tt:;lt th.
vs: ~ not fan. In pJrttcul;lr , t he Optbl:.r I~ t r ee t r;> ::lOVe ;1 c:,);
r;>ut r;>f .. loop If it Cln dH.""'in. t .u t c~.eclt:in s out .sl~. t~,. loop " H I
lntreduc~ no t.",i .n at ions " hlch would not . h". h .. ppen~ .. n,. ..... y (I •• , in
FOR ;:: ~1 tr;> N CO A(l] : ~ 0; the ran i ' check on I Dill'll as " d l be done
befc r ~ the l oo p: i f N h t oo lar&e. the unoptl. olzt<l .prO&.aoI would dlt ~ oon
t no"s h In yw .. y). But the Opti., la r I s I\Q t (r ee t.o :oo... e arbitrary
c or,dl ti o n il j<=ps ou ts ide of loo P'"

fo "10" ~or n .e furth.r e lttn sion or CH I(, 11><1 . lso t o pr~ser v . i t .~


I n operation " hieh Is InUn~KI o,",r t r;> flil, U_cO<!. In t .. cx!ue.~ tYO ltIort
v .. d . ll on" (in addition to CHIOl and CHKl abovt). Thue ar. CliK"T (eh.ck
tr ue) .00 CHKf {chee k (als~ l. 1oI/lieh • • ;:eet a boolea" ... ~Iue r;>n thc "tick.
j<.:n like !J? ;1M fJP . ~HKT verifLe:< ~ h;1t ~he bor;>I~." value I s nUi: and
tic." pO~" it orf the "t .. c~: If the u l ue Is fal s e. t~t en.ckln~ (ails 3n~
t~.~ ,,~~ .. l U~ "' :na:!o" 13 t~;;it·ed. "'.y.
CHI::'" "o .. ~s :" a sj:::ilar 7l-.us.
al: 'Ir;>n- r.r,t . el'.• c k!~-& ag. ir.:~ censt.an~ tcur-,=, can be put In to ~~e ",ole
of c~.lultl.or. o( . n ar~;~r " ~:1 boole.n e.pr."i"n . fcllc"c~ by one of
t~.e,," rot " C~. i:$. If tr.e e~c~ki~~ succ or-so t~ . br;>o!un !s rer.oc·,~ f .. <r- ~~f
stack . '>0 ,t <lccsn ' t i et in t~e " . y o f fur '_~r ~r<lce5sir.g.

.. .....--
- - ---
IV . Special Topic s

IV .D . Non-co cal A ddre~sins .

U-cod c ln3tr u<: e:O"~ ""Y rer~r t o nc~_l cc~ l urUOle~ Oy J"st ".!,,~
• tke appro pri aU un tq..,. ac:lvn!on re co rd n=~er. It h u;> t o t~e
Tr an slat or to sup;> l1 ~~dres 3 101 1!ty for ~uch r . h' l ~cIs. Typi cally , th:s
will be don~ "'Ith sca, 30r ~ of d ispla y ... ec~.a l'li.s:o., b"t all such
• a l n~p"lat!ons ar e Inv i s ib le it the U-cod c . A stvtre con sc q"tnct oT this
Is t h~t the us. o f dls;>l a 1 po i nter. c anl'lot be o ptl ... l1ed at t he U_Codt
l evel, dthouSh the Opti .. 1ter _ i,ht supply to the Translato r I list o f
those Slobd .dd ressll1i levels .. hich I r l heutIy usod In I proctdure .
this i s stt l l an open probl.m. ..

IV.E . A ~dreu [xpressl on $.

The bulo: c oncept of '1'1 "'dre:. In lI..(:ode h better e.lled • windo",:


I t consl.t. o f In (ad~ress, lens t h> pair. Add re.s a r lt~et!= ca n then be
de:c rl btd In tCrQS of each instruction's effe ct. on both components of the
" indo... . The LOA. LC A, .nc KEW "per3tors creatt ne" .. indows. The S7R and
laO opera t ors '*'en appl~ed to acl~r~~. quantities co ~y .. I,'d"" !n ror" .. tion
(rem/ t o t he H ack, bu~ !"se tr.e ler.o;th In t he proeB~. TM I~C. DE~. IX:'.
and other lr!t~J:1e tl= ,,~erato r s alt e r o.Ii~do\o/S, a t"oCl the ! n~ lre" t oper atcr s
IND and S TO firs! r",.." ~ suostt of a windo" , thtn "5e i t r or a~ In~ :ree~
acces~. The e the r tnd !r ect Ol1e r :;; tors MeV, IEC!! , !LES. ttc. JUSt "se t~,e .
" ind" " prtuntfli. A datny~ Is spe ci !led or,ly In ln~tr" " ~i ons wh!=~,
ac t ually ae"ess data, s o LOA and lli have n" d~tltyp e '. .tile" r tCe,. t" t!: e
fin. l rere rence<!: obj ec ~ . Thl l ecgth I. needed On LOA SO th.t the a<!drus
"r a r ecord ~ss ed as a para.ooeter .,an be pt"operly r ec",~1 ltd 15 a
pot entia l Ust " f tha t entire recQrd, not J u st the r~rst object I n it.
Si",il,r rtuonlng appll e. t o the l.DA as,,,,,lated '-lit h .. n ar ,. ,y 'cc css: t:-'e
LOA specl f le. the leng th of the .nt :re array.

Constant address arH~.... ul., cay have the sld e_eCfe c t t ha t the offset
I~ .n LOA l nstr"c tl o~ b teCCes neSltlve. Consider. r"r ex .. ple . the array
A[I,. 10) aliccHed It ofrS ft O. A fetch o f A( K ] ""'uld IlenlaHy Ip pe ~r In
u_c ,,~ e as:

u" ,, (~~r Hs ,. ".


Let. "" " " 0
) '. j( : " 1.
intese. , cffsH""'" :ype
".
bil<
leng~h J)
len >OJ

Cf.Y.L
CHKE , ( chec~
(eh c~k
10". in t e g er)
h! &-. • :"te~er)
" 1
'"
I NO , ,
lU
( ::~ke
("~~r e ss
1 :t-" -od&:n )
" ~(!:!J
{;,{K]: or.e-"crd Sea l :

--
IV. Spee l~l Topi'a

• co. , -,
,
co, , ,, " "
("l nud ortiln or A( all

CHin.
, " " '"
{He .l

,<. , ," ,
e ll;:11

INO

Thi~ M, .. Uve ofh~t "il l il"'y~ ~n u lt In I ""n-n~IIt1"e offset a"fte~ t ~e
ad<ir'S3 a~tthmette . but there aU3t be a ,r"e!ful >qy fOI"" •• ch
imple .. enUti o n t.o t.oh~at. neg" Uve offsets. !lote ah.o that the LDA nO
l onger eor~."tly 4.s e~tbe", th~ dlta area whl e h Is potentl,lly used I n the
INO l n str uetl on: t o " .... er thi s <i:>ut>le duty o f sp. elrylni par t Of ,n
address e.lc ul" tl on and .lso 3pe~lry lr. , the dat~ a rf fc t e~. w~ ~uSt spil t
up the ruponslbll1t1u "bi t . In thi s ease. the ..,b1. g uU y en h@
rfso lv~ by Insert:,." • . 00.1. (dat . obj.et .r r.e t e d l Instr ue ti"n:

H 26 _1 0
'"
"'.
U>O ...
11 2ti a 10

Th. 001. Instr uc: t ~on h f urt".,. nph\ned at t ", ~nd of this sec tion.

(
IV.f. S-mbol Tab!e .

The U-eed e S·t:1 ~nstruct:on dce s no Ul in& <r.ore t~an ,ssoeiate its lab,,1
fl~ !d (pr,St.:..,.bly plr~ of a J.Ourcc vari able n"",') " Ilh ; 4'1t. ob; e~~

'!u'n tup le. consis t ing or diUt"!pe. :l e::lo rytyp •. bleclc n""D,r, or~set •• r.~
ler-i th . Any Ito r age re_.pping done by uie Opt blu r .. Ill also r ..... _1' t~.
ope ra ndS of the ·Sft1 !hstruction. lIot. t hat "ultll'l~ SYl'! In~truc:tl c ns
could have tM ~arn e a<!dress bu t ,""."IDl y dlffer,nt d·at~typ. ~ "aM n ;I
variant r.eo r~ .

IV.C. 'o lnU 's .

po ~nte r Is c sed In t~C! U_eed •• t~ere is very l it tl~


""h,n a
InrO<.:lH ~ O"lbcut "hn it poinu t o . T"" Pascil< st.t .... ent 7;.X:,5:
be,,=es H ... U-<:OCC! :

LO' ;, t~ ~ 5 12 1 (~: C:~tHi'''C! A. offat 12. ct.:.)


Lee i; CleM eon S~iln t. lnte~.r)
S7C I" (Io,, ~ e lr.<!. ~.e ~. '3SU"':q: X II
ot" r~.~ " (rell ?)
I
!~u

U...,ede cHt" r ~3 ~!l.e {Jet t~H X !~ • r e~dr"! f !t~': I t of ~s u ~ '"r e=
!~... {re nt of tr.. record . ~" t it rIO"'".• r! ~~c~rd3 !!:t Pascal .:.:!E! o f ~~.e
I V. Sp~e ial T"plc~

~~ c~ r~ This ,.... ns th ~~ the Optlnl:~r "U~l i~~o.:o~ t h at tha


invo lved .
~~ sl'Mt~ nt I.Q ': .X
.,ig ht ~15C c h3n~~ Q~.Y, If J I ~ at off s H ~ I n SeQ"
o thu nco~d d ~cl~ra t ~ on . thIs is l lv.l>h. but OAlfortunat ely p~ssl"'I.:~c
It P .nd Q .l',,-.ys ?Oint }o dlrr~r~p t ..~: _J 1~ ~ S .
. ~.,

To n ode l po~n ~ e r ~ ~n~ ~u!at lon'-oore acc u~ ate11, the U-code Yn IC~ ,.
ln~ut t o t h~ Opt! .. ~ ur ,"ust illd ud. ~croe ._ 1 o~ 3p eclfyl.,. th~ recc ~ 1

typn Inv ohed. Ona 14Y to do th ts vitll uisttnlt .. echlnl"",s 13 to


Irt l fl el.lly d~flne a set o f ( 3u b-) .c tlv atlon rec o rds , 3~y ot .. ~ ory t ype
H ( f or heap), wi th a dtfferent bloc k numbe r ."stl ned to eac h po~~ l bl e
r ec~rd ty~ \ n a p~ o lr"" AU Indl ~ect ~e t"rencu 1n the U-ecde the n eln
I nclude .. 001 I ns tr l,lc tl on 3p"c lfyl n, Iotllch ~r tltl cll 1 a et l u tlon ~"c = rd Is
usedl~et , so thit t he int erac tions be t ~e en dltt~~ent po ln t .r ty~" s ca n be
f o11e,..d ~<:.~u~ate1'1.

In the above U ,tople. u5une f ur t hr t ha t P Is of typ e ~R £C l, an d 0


I s o f type r u ;CS, and the sub- .ct hatl on re co ~ d <H 99) 1~ ass och t.-:l
!lEtA .nd <H tf) with R[C 9. The~ "tt., a s sl,tlIO""t above would b.cCle:

LO' AJoI2612

,, ,. '" R[C~)

I
""
'"
H 99 0 10 (hnSth 10,hnKth o f

'"
(~edi f !.~ a ~ !,!!eiJl loe ~t~o n H O~ ~ I)

A
""
~ tor' Into 0:. 1 ~U ld .ffec t , di fferen~ ~ rtj!l ci l l obje ct (K ga • 11, $<:.

It will be clu r to the opt~"iar ~t.olt ~ st:re Into one nud ne t :..::,1 ,
c"""on s u bupre3s1en ~~ vohl nB t toe en.e ~.

The s e art , rtelal .. eo.o~y arus (..tIl ch ore rully .qulv a l ence classes
r .presentlr~ ALL re cord3 of type REC~. IIECS . etc . ) . 130 liv" us t~e n e .e,~
.. ec~an 15" t.o ~eecrd the side eHee:s of ~ Pl" OcMu~ e c. ll \/h en t!:a t
~ ~ oee<lur. u s~M$'U scm.. o f t h. r.~o~ds In the h".p . The , ... e "' rchanl.",
can be used to de sc ~ lb. ae~ .. ss to <:.=on bloc~3 acrO ~3 fort,- "n suo ~ oc :: "e
c.J,ls .

Sid .. I'>Cte: I t 15 possible In '.sc3 1 to d~c la~ e V1ft V: REC ~ ~n d t hen


\la 5 ~ V by r .. f~rtnc~ to a parZlll~ur R. tn thl~ ca$ ~, th e pr oce dure does~'t
knc " If it~ Ict"a l part".,t e r Is en t~e T\:,, - UO:le ~t ll C~ o~ In t h., he .:>
( sl~e e p~ QC~! ~ have l;I~,"n ~.~sed. " h~re P is o f type : RZC ~I. fr"", t~e
~c:~t of vie ... "t Opt:Cli:3:\cn . i t : s ~i"'? !1 n eC ~"J ry ~o rt ~or~ H .... ~ : c [
t !:. s i d. ~ff ~c :~ of :h~ t ~~oe.dc~~ t!"..,t ~ t ~o~!: ""coif; •• V .no:! ,"n .:r.:ev.~
P ~olnu to. i .•. <l1 99010>. or " h~t tve" . rnr ic~al object co~r."o r.r:: to
.11 t h., ;'[CA. cn :I:e he3p . TIl ;. ~a v . r~ 'I;: ~aas .

N Cr::l.!l~, i ~rog r "'" '~ ;ll


no t .o"t~ln ;o\n~.rs to the ::.It!dl. of
reccr:~. ~n ~r a fI~lc of 3 reCQr c:! i~ ~a~,.d by r ,, (.~.nce. s cc:'l" :>0 " ,:"
I " . Spechl Top!",

is cr e a l l!<! .In t ~.e edl "" ~ r o".dure. ~ny a ~3!g ,.,."nt using lhl" r"re~~~ ~ ..
par 300e lC r ,"u3" be "",,=ed b7 th. Optimize. t o bll . 11 upr t""ion,
Ir.voldng ft e ld$ ot ~ r ecord, unleu c~n rul in fo ,.", ~ tlon b ~ t Pt.
Thl3 Is sufficitn t ly unfor tun He tha t tht Opti",I:;"r \lill at l"nt k" e? on ..
bi t \IlIlch ny! "no r .,., oN:! n,,!d \ s p a ~" e-j as a re(" r"n c e p a r .ru :e,. .-


In o pt l .. 1ted cod e, 1t \1111 of Un b e the c as e t ha t the nlue o r 3OI.'Ie
c =o n s ub u pr e"l on needS to I:'t be , eve<! for h t e. rt u se vlthout
dl,t ur b l ng tI:t current u'e o f that iJUb upr usion . In t hi s c::t rc .... ' hnc e.
the NSTR ( no n_de s tr uc tive ,tor t ) in st r ucti on wil l be , e ncrated t o copy the
lOP of $t"c k ul ue to so=e .,,,,,, or y 10000a ti on wUhou t po ooln& I t or r l ~
st ~k . l ate r , . norna l LOO wil l [ e t ch t he value f or re- u~e.

It t he h t e r LCD I s I n t he d ght pl .c. In the sa",,, basic bl ock , U I s


possi.ble te replace t he NS'iR wtth • DUP (du pll catd I ns tru cH on a nd
e U", in a a t he LCD tnU rely . Th is onl y wo r k~ If t he u tr a v al"" hrt on
th. s u ck by DUP 0",,""" up te t he tel' . sa ln J ust when t he LOO. ,,", u l d be
, .ner a t ed. But on occau!on~ i,1c en th i~ i .. po~~ jbl •• we ~a v~ Cl l,O;h ",ore
< th a n just the LCD Instruction: ~... u v~ t he o rr- sUc k t ""por a ry. " M ell :: a y
In t urn ~"I' ,
v dua!> i ~ fan r e!llte~ "'h~c:! co"ld be ~rontai)ly allcc at e~
to other uus r: .•. en, e r "=0.'1 subU ;lreH~OnS) . Th l " c :on re5 ul t i n
si gnificant l y btUe r ec:4. On :scm e t a r;et ." cH n ....

IV. I . Esca,,' Va l veS.

The.e a r e two ".Jor e se , o' val v e' In the U-code. de~!n !t lo:!. both
in t e nded t o allo ll V .e in t rc:4u"tion of n~ " Idea .. in U-code w i~~ut
r eGulrln g "" Jor re_wo r k of .~is t l n g pr oc" .... o r ...

I hl fl r~ t escape valv e I ~ ttl" UN/: ( un kno \ln) Inn ructt on . Aerer rin,
ba" k to t he I nst r uc t io n cl, .... " .. In .. ec t i on III .E., UH K Is a stack
o perater. "Ith no flo", or control .. jde- erhe ~ .. I r.d no (Pasc a l) ,..,,",ory
leeeSS. The '''0 ope rands o r UNK spec if y the n=be r or ope rsr.d5 pOHe'!
o rr t he .uc ..... nd the n,..,b" . of re.u ! ts PUS".1!"l b.ek on . n .c I~tfntion
h th3t any ne .. binar y o r ~n l ry ,Uck o pen:or c~n b" descr~~ e~ i n u_c:x: "
.~ ~n UNK \l i t ~ t~~ ;;~~ro~rl~a Q~ . rlr.ds. ~ ".c ~~.e re~l opecat<:r ~u ~ !" t".e

,O<"..<:: ent 3 fiel~. U:H( i3 :nen p~~;,e th rOU;j.h L"I !~tu;;reu d (a n ~ !lC> t u3ed IS
a e"",:,en .. ~bu pr es~i,") by th" Op t \ai:e ~.
I
Tl:c ,e~,r,~ .. ~c~~, Is tr.• e" "",,,,,:,· ~i e!d of ,.eh u _"e: e
'~ lve

in str," c t: cn. ~ny n<:~·~ t ~n4ard oper~~' us«l ~ , , par ~leul~r 1<I ? I ..:a~!a~ !o~
·.

, e~n be put In t~... eClm<!~ts f ield . to be p"~ ..d throuiri Un Interpreted ,


without net"! to OI",Hfy t~... Co ..... al U-code definition.

tv.J . The 00'\ in3Vuction.


- --
The OOl (diU object .Heet"d ) lnstr\lc~l o n Is , un "" op .. ~ato r ",,"on
op"r ancl on tM stack h an .ddr.33 u ...... "slon. The DOA sp .. elf~ .. " "hit -It
thb addreu h ~~ In a .. I lldlreet ol'eratlon, the foHoon .. , data object
h artected,· where tl'le objeet 15 speclfte<! :as a qu~ In th. op.r.nd ridd
of the Instruction. The DOl In no w;y .odlflts ta. value o f the orl llnll
address eKp ... sslon __ DOl '''''erates no cod e.

n."
1" .. behind [XlA Is to add It t o ttl. cod e """never .n ad~r.• ~~jn,
u pre3s101l Is uob!guous and lIIore In fo'''Iutlon Is In (act k nolJl\ , Ttl ..
e =pH er "oul d l"ner a U roll to duerlbe dtfhrent rt<: ord t ypes In
pointer .... nlpuht!ol'l. n .• OpUCI\ur eoul d " ""raU DOAs to desed,be the
actual array when subsc r ipt b.se a<!dre~~in, b chang<'<i . or .men i
,ubscrlpt calculation \nsid" I l oop b entirely r~p hc <"<! with a poi:l ter t e>
the ua<;t data Item (st r en,t h r~duettonl. The Opti .. ln r covld al s o
,enerate OOAs to desc ribe aliases: fo r u"'II~le . to descri be t~.at • store

r into ~r • .,ete~ 1 a l ~o afree ts p.r;;~ettr 3 Ind gl oba l va .. iablt~ X 3n~ !


(s~.d!"led U q\ladsl .

An othe r un of 001. is to force tht , r ou~ l~ s of laqie """,O)r, ar~ a$: a


OOA e"countt r~ when the suck Is Cc:r:1;11ete l, e:lpty {a na~.a OOAl ac~s ~S' I
NO? uc .pt that It dOU Include SUIt qUid IS It ~ oFe r a"d. If th i s .... ad
spec!fles • Demory area that ovft~~a~ . s.y. a sroup of three .lri2bl es • .
then th"s. three Vlrtalliu llill lie trea ted u fields within an I r~ !~lci.l
rtcord speci fied by t~e DOl.. Th h In turn "I ll preunt the three
vlr::a!>1ts (rOIl! teinB re- In.~p"d llith respect to nch o t he r if stor.ge b
re-1l10cated by n .• Optj",iu r . A naked OOA ~1',clfylr.B dl of • cCC'.:o.on
bl o~ W "ill p~~v.nt i t f'r0l:l being ,..-,.. p~~'; I t all. and a na~~d OO~

enc~l'ass 1 r.g two .rray! " Ill keep th~ to,el her • • 1tho us h they ~ay be
~oved to • ~itrer~n t pla ~ e In the ae.or y hler.rchy.

iI'. ~
!:,;P C ~"a~) ir.:~ru~~:cn b l:'Iter.~e~ ' ''::'111 for u;re.u~ g rev"rn
.ubtraction a"': rever:e div i.s!on , bu t 1~ can ocCur In any Q t~ er con~u:
al~o, To r..cuc~ tt.e ;tac~ ~etgh: "" e;:ed :n .. ~r~"lon evalu~tlon , !h.
C;;!::::i:er ,;ill I061c." ~y char-ge

• (e' c ) ~_ ...

u" ,• u" c ,
u" co, •
co, c
'" '"
u" •
."
'"' '"'
• n suck hel'ht • 3
----
.n "t ~e k l':el811t • ,
l\lp. SUB uqll elK ~ st.o w rn<! r~ ~ ,ubtractlon. Till" ",.","" •
If ,, ~~

'"
,~

better tunln, ~h an Int ,. cduc l. r.~ ~ e u r 5t ( ., ,.,,.,. o f ill binuy operator". The
O;>tll'llur ~ 'Y ,,""rate S"oI? befo re c=utattv. o~r.tor·". or In par ..,eter
lht " . Fo r c (ml:1l1uthe operators. tM~ u o lds the Optl .. her 1ow"1,,,
euct!y " hl eh b l nu y op er ators .... e c =utative (IIIO t iv . tlon : rlon!n&;- pa l r.t
.",ltl p lyon the tr a y- I I s no t N;nr.ut 4 t l ve ). In ,ene,.. l. • Tr ' ~"lat o r
s ho uld ~ g"n e rau any c od e fo r S''''?; inst u d, 1t s hou ld Jus t
, ' cte rchanll t th e o per a"o. of t he corres po nd I " , nu t o per a ~ o r.

l
-- - -
IV . L. Po s itl" , 01'1 a nd liCO.

I n ver s ion ( 0, 1] o f :I>i " <lee ",""": , po s~ t~·/e _ o ~~r .ar.d _ on!7 fe r.1S of
DIV. 1100. aM ~ O (dl v.... od ) "e n lr.clu~ e<I . so th a t . r,. . n. h t o; " "ui d
, .ner . t~ b . t ~ ec "ode. In par t i c ~lar. gn a two ' s-c om~l~tnt ... ~ ~i~,.
-7/100 a .. ay ,he - 3 IIII.n c dcul it <'<l via • dhillon . and 1 ..h.n Ci lc ullt.d
vi a l ~ 01 n6 gf ~ I II tilt the tllO low-or der b i t s . Un fort un. te l y. th .. PIS ".!
d~ r ~n l tjon dotS not s ptci fy t h. t In ~t,.r di vi s ion mll Sl tr unc a l . to wl rd
.. In" , infi nHy. thus d i olling t r:. - 1 r~su l t! Wors t ye t . s ""' ~
~p h .... nt ltic ns r ec'J lr~ t!lat - 3 be live n . 1 hi~ tH fC tiv el y pr t clud ts
us in g AND for 11)0 b y I po..., r of t wo . and usln, SHI FTHGHT f or OIY by ..
po .. . r o f t '-'O. OI VP. I!COP . and i::f :JP !Jfr t an .tt ..:np t t o "Ikf it usy re r
t he T ran s l ~ t Q r to Ust AHD ar.d S!! IFiiUGiU ,"'t n t:.~ OP"r3n,U were .11
pos i t:·, ~.

Sine .. t ht ~u b l : cH:on of ",s,o'> [ 0.1 !. t~" SU~far"-l er cq. II H


b~~ ~d~cp-j I "",. .. a '~ '~ ll ~nc~-n.!tH ; vt ln U I H" dalUy;>t I Fl. Un o f
. :.:on ~ d a l ~ti'~ . can·l e,. ~ ~ • • ~",e :r.fc",'~t:c n ~n ~ ~l~!n .. r "" V. :0 DJ 'Ii'.
:~ ~DP. ~r.d t: ~ ~ ? ~.~ " . h" n ~toHe-:: frer:: v. ~s :on [ c.21 . ! :lo t. l~.H . E o r
(
' ~.ls h r~ J ;!J cf roO cc~c. c ~ to :~.• Opt : =, : e r . "r.,, ~. : :H;O~'" no
l n~.~ ; r" ~ 3 t l"~ on ~~•• d~t~~] ; n.)
r - -Men-
1'/ .1'.. TM P~ "u~(l -CO.

A lI~t or ;>ItEr (.,uu,,:.. ~t<>"3S~ def~nltion) P3flKlo-OP5 I s used to


• <!~.cr~bf t~ .tor~'f tI!"~3rc~1 or the Uq;H " .. chlne . Thh descr\pt~cn : •
l c!ieally optlcnal I" th n~.e lhH \l ,uy .~y Jut that ttlere is a
.I n, l" lui n "''''''c',/ or •..,i_inr!"!!! s: :e. bu t i"ca relis te r u.a" for
• t " r~.t lI..,hin'$ w1.th r.,i"ters orl. ll be prOClloted by. <""reful 110E, T
desc rl ptioll. In In y ca .... the re ,"U:l t be an i'l 0(: for ,:a cn dirf,ren t ."",or1
typ e .. ent l on..:! In a U-co.le prOS":', .nd tM offsets , l .nll tls . e nd PErs in
" pros,. ... ,"ust not ucecd the uPP'" bollnd ,hen in ttle lene t !! ".,._"t'" or
the MOCr. An HCE F 1, In efrec t until another HOE!' f o r the sa", ,, ...,,, or y
t ype h ,hen.

TIlere ~ be a ,T OI,I" or :-lilt, pseudo-ops at the b'l!nnl"& or u cl\


U-code progriI:CI, lind th .. orderLtli. o~ t!':e HOE!', ", I t hin thl" ,,.o "p \"
~i, nHlcant. Oth,r HOE,,, "'''Y O<:cur It the belinnin, of any p" OC~""'f. In
t he Inltl .1 sro"p of tt DEf~, the fa s te st or ~ost de.lr2ble le~.1 of the
l1 e::lory h1"r ~ r cl':y 1. d,,'cdbcd !1,."t . • nd Ule . lo..e.t or Inst d".lnble
lt v e! 1. de.crib .. ~ h.t.

Fo,. ucr. ...... o r )' t ~ pe. the .. In"....." .. H~cltion p.. ~";:e!er !ivo. t~.e
( ", 1::::0<=1 "u",b.r ot .torlg. unit. to o • • llcc'~'d ~t on"~ . HI l1!o<:at~~
variables 11\.11 have otrse~. that Ice ::.ult:pl •• of n.!' Xloun t C.nd l'~ne.
will bt I ll in.-;!).

The "u~"'u:I all&f,"'cnl ~.ra::l ett ,. live. the "' . . I::"•..." boundary IUge.::e::!
thH i" Int . ~ .st! ", t o the ~afl.n hard,.. re. \oIh en ',"d.bh" ' ''~
re.llo<:.ud . their l1!i!'"e~ t. U? t.c thi. nl,:lber, wi l l be pre'e!'ved.

The ne of dat .. typ • • pI ,. "",.ter I ... l i . t ot 1_25 lttter •• I; jth no


... b~~.d bhn ~. or oth.r punctuat!cn. Thi. set S:vu all tht ,I<.Utype.
t.~at In allO lol e<l to ~e alleeue<! to the a!~cn .,e:.c!'y type. Three
c on~l d e. ~t~ on3 are .eluen t ~nen selecti ng t :-'i. lis t : (1) xo:>e tariH
,u~~ ine3 haYe speeial! z e<! r.ii.hr~ _ a flo.ting+po:" t ",-",Ocr 1oI. ,.,'t O t
inte In ind u rt,~st"r. Ind it couid not be o~ rltf~ upon nen if It lIic
rlt: (2) .aoe t a rg e t .. . chln~~ do not aHe .. SU~3c~ipt1~g in to r"&i~u~s. :0
In .. ys "ust !'KI t b . . . l!o"!c to raIl into lho~e .. "", cr y ty;>es cc r ~ .. ic"~ i r.;
to .yen re&::ters; ar.c (3) i t 1~ .. good ~a[eti "ove to :pedfy III
dotH 'I~ ~ S A+Z to :II.t:r: ~~ e !.,t ::Ie,.,,,r, tr.:c c e~~r !':!c~ (u3 "alli "'.:!I

"e:c, y) .
., len IIln .n
"
- (,Ineral purpose r~s "
--
IHIEf CO R
,
,Uoc aliin
,
, , --- ~ .- ---
J.eCUCS (~
. .rrays. r e<:or~s ...
(flOltins point re,,)
(dlrec~ .dd,..sH blel
P'l ocr
1
~ CEf 0 " , ,• •
, ""
(, • rr.ys)
J.IIC arreilI .oK L:WOI'QRSiU\-JX':'~
(".1 nl:l ,"",or yl HDE:f

1500000 0 ABCDHGii I ~"X!"~~IOPO~STUV'.lX'I' Z

ThU u . . ple U'UIIIU u •• t 8 o r the 16 Cl'h are I va Uabh ( or Uw Cc-pUe,.


Or Optl=lur... to dlocatl url.btu/U1ll~. ,.,lth the reo .lnlnl e (or un br
t~ Translltor fcr bll. ,..,I a t,,.s, ,ubroutlne li nk". , dlap!,y, .~

u ","usloll ".IUlIt l"n lUck tOt. SI .. il.rly. Z " h ue I.rt (er the
Trlns htw. ,n" 256 bytu or the ~'C directly .ddrt'.nbl . . . e::>Or1 In an
..,tlvatlon ,. = 0, 01.

"

"

"

,
V. ~ l ~~ ~ b et l cal L t ~t of U-cod c In ~ tr uct j ons
,

!n 't r uc t io n N""~
- S
------------------.
A!lS Ot
------------
v.toe
Ab so l u~e T <- :T :
S ADO <It ~,
T <_T _l .T
S AN D T <_ ! _1 l,T
C
S
nillClle eCI{
' CiiKf'
""
B~ l ln
CheCk r. ln Ir T.r- he th.n pop
, "'K' ht,,,
du blow up
Ir T<=hb then ok
, dsa blow u p

S
' OIKl dt lb

CHIQI

' CHK1'
Check

Che ck
".
~<

Ch ec k t r Ve
,"
1r I b<. T t"hen ok
dse tll ow
Ir T<>n ll
d 3. b l o w ·
lr h~ .. ue t h en
"' th ~ n

"' "'"
..
,, m Ch a r .e ~er
du blnw
T <_ T "'
,,,
· cu.e
'''''''
c ount Cue t a bl e la bel
C""""en t
I count •
•"
en t r :e31

,,
' CS ,"
' eu?
' 0[.1.0 o~ bIlen
po ~

o~f
pu,1I
"".,c pop
,.,
. '"
Ci lL ,U nda r d pr oc

. Call u3C r I"'" oc'~","c


I),ud H r l.,blc(s}
,, '" " ''"
' OE, 0<
of ! o.crt'Ocn t
Do nn e
T<-T - o f f
le",~r. of ~, r ,

,, DI f
OJ'I
"
0\ r rC;" " C., . , c t $
01 v I ~e
TC-T- l
TC _ T_ l / T
,

' on o
" Di ~ / .. C'd TC- T-l /T . t hb

,, "" ",-, ." ,.,


T ( - T_l ."'" T
.< blkn On . object 'frec t e d
' OU P ' P''1, lleatc - T <-~U5hT
E~D

"". . '"
[..a o f pr OC M " ,. e
n.... · £JIT
" lh,e vel
,, ~

,, [~t'r proc t'<lurc


, <. ,., • ,
"" "'" [~u.l

,, '"' f •• n jo.n;o
" ,.
,.,
dse
T=h1 5e t hen PO P,.<:=!;:>
~.

,,
'CO
FLT
Fl oat
noat ,, ,. ,. , !loa t IT-1l
fl oat{ T)
<- ,-,
,, '" "" ''"
'n
' ! [CU
I e;.
Cr C'ter Or
Grca t e r th,n
c ~u . l

, ,- n , ,.• In
T ,- T· , T
' Ie<:o " ''"
Ir><! l r c ct e qu a l _1 1

, • ten " ,,, ,.<. n , '"


" ''"
. '.<:li rec t g ru t er o r eq T (T - 1 1
Ic,c ~ r~ct gr eater t.~~n T In_1)

,,,
S ' Il';:~
• !L[ S "" ! en
1
en ! "cic ~ct le~s o r e ou ~l
l ~ ~ ! r ~ct l ~ ~~ thin
T
T ,.
<- (T - 1 J
(,,_11
"< IT)

IlIe
" ,of!..-- l .,n I~c.~~nt T <. T • o tf '"
,, ,,, •, <- n _1 )
• I ~I D

""
Indir~<:t I OA= IT · o f~ )
' 1:IE '~ :nC : r ~ c ~ n<;l~ ~qu~l <- (T 1
,, I~:;
:n, . l """.~t
In :n T <. T-:
•" ,T
"T
,
I~;
I C~
m h ,
!r. u cs .ctton ', Ut3
!,clus i v e 0'
I •• d e>
,, ,.,.,-
T ~ _1
i _\
T _1 • T Ole n
, ,

• J
,,
Ibl ' u.s
Lo> quote<! 3tr~na lD'~ constant acdress
{count. , o f br.n,,~cs
t o t.J'I.ls l.bell
T (. htrin,
,, LO ..
LOC
lit ~ll<n
dt Y.l~~
ctr len Load acldr~~s
L:>ad ConS t~nt
T (. '<<;u.<:1)
T ( ••• lut
, '"L£S dt len
dt l~n
LUI than or I<:ual
ttSI th an
1 <_;.I<OT
T(-';"-I(T
T ' L!X hve1 bl.:.m L~slcal lcY~l
T ' Ltv"[ at blkn of( :tn Ltv. variable ls) ,
"
, ""
LO'
0"<I t lit bl~n len
Lo<:ation
Lo~
(Orr.nlll "...,bu)
t <_ «quI<:!»
T len
' HDEF Dt .In IIU dtl l :st

,, Mu""...... dtf1n1tlo n

,, '"''
"" l.~
,~

!'oye In.Hr.-<:l
T (. T·' reoo T
(T -l) <- IT)

'"
"" "
Multipl y 1<-1-1 ' J

,,,
levo.1 Kirk stick
,~
Multipl e n t T <_ (T.l:.T)

, ""
.,.,
'" dt litn
IIt,n.
Hot eQu,1
T (. -T
T C·T.l0!
,, ." dt""
II, .. record
." T (. "'.ut'
T <- .,.
,, ' HSTR
CO,
~t blkn ott len Hon_ de s truct tve Slor.
'"
,,,
".", (- T, no
T (_ c<l<l(T)
~p

T '"
' OnN dt ofr
PAR c:t btl<:'! orr
Opt:ons
T (_ 1

l.n
" lit P.r~",ntr (:.o.y stor.
.~t!y.t:O" ~ecoc~.
!n~o c.....

,, ' PLOO dt Ol e blkn otf l"n PUlido 10.<1


or "'.Y co.w.rt .:It)

,, ' PSi~ dt .. t bl:.m ott len Ps.udo stor e


RET RHurn

,, '"SQ. dt
S!n,!non u t
S(I",ar"
j
1 (_
<- (1 1
r • 1
S1'O ,n. ott lion Store in<lirl!<:t (1-1o-cf(J <- T

,,,
m o~. Step pre!,. ...

'"
'" "
<It .t blkn off len Store

' SII P <It 1 dt.2


Subtract
Su_ p
.~ <-
1 <-1-1 _ 1
1 _1 ( __ ) 1
j

T n<l2lc ' Sn'. <It ",t bl~n off len S Y"'~ ol taCh
J
,, no
TJ>
'" True ju:lP

1runc.te
tf T. t"",.
d~.
1 <_
~op
tn,"dTl
t~.~~ ;:op. j=p

m 1 <_ T
,,,
• OJ, "'" 1yp". n.... <lat.t)?<'
Un~0'1odl tl on 31 ju:?
un Unton. 5etS T (_ 1 : 1
' U:;i( PCP push Unl<"""" oper,tor
J ' XJ? l~! T!lO". td j1.:'lp

C~e~."~ ~:
, ~l;"~ blocl< """ttt' Inu,~r ).1
COI.;nt
O~
'Cc3r.c::u t:>
~~ta: 1~t
.,.,
Ina,,,,.
. ),oJ

dt!~:: ~au l)"l:' 11~ t ll~t or ;ll l o"'f~ ~UJ t,·; • . r.o ~ e!l:l.tf~S.
ir.tt,tr

,
•• Alp~ .~ctleal Ll ~t or IJ-<:oe~ In~lru<:t1on~ Page 2J

,. 10" boullCl inug er


label 8 ch~r~
'"
,,"
.... ....,"
l ength lnte8~r >00
leul ne st In, level ln uEe ~) :0
Int.ger , ,0

".
.lll,""' .. "t
.,", alloc a tion
",,,,,,ory .-,
in tt~~r hO

na '"
'f<
n.", ,, of pro<:
orrnt
ch.rs
integer • •
' popped (,,"try) Inteler hO
'"
pU S!!
vilue
' pusheo (,.,turn)trlte,. " >00
data ulue int.,er. reh., u t ,quoted .trlng

lIote.:
• OHD (dlv/ .. odl r eturns both results rr OCl! • IIlY!,lo". The 1400 "du. h
on t~.e i.op of the $tack (o"Y be (ollowe<! by SW PI .
• LDe II 0 - Lo.d const .nt .l".y~ h'S ~ oper .nd3. for IHI. d .....,.""y
uro ope ra nd .oust M pr ...nt.
• A .. r.oory type of l Is u • .,d In LIVE. OCAO, and 000\ to 'ia"try ".11
IIft'1or y types " , Slmlh dy " :ero b lock " ... ber ",,, .ns " ,11 bloeks',
.nd a neg.tl ye blod: n1.JO>!::er _II .. uns ".11 b loc~ II".
• The """fit on • hbd dh," Tr .n.la t or. to tha t the n o ...
5t~""t ... ~e ts st .. ph: If th~re is euctly one branch to • hbel. In"
tM Tr.nslator hu sue~ • br.nch in Its buffe r. It I~ lu:arant ~ed
th~ t n.tr e are no .,ore '",CS In the rlow ,ra~h. J.. cOunt o f tero .. uns
· ...,I<no\lll" .
• OPT]I s~ec:ir1e5 one of 26 optior., A-l. ar.~ • nU::Iter usochte~ \11th
(
th at op t ~on . l ~ s use i~ net fur~~.• r "e!!ne~. but it ;5 I ntH~e~
for cat.CI:lllcatir,. OP:!C M to var io us U-eoae proce ssl~iI P'=ii~:a",s.

r
VI. O~~n Ou~.t! on~/I •• ue ••


Til. euc~ yu of LIVE ~nd D~A~. Ind tile n 11 e o f NX!'.z:I~'tI I<:. ti n&
proo:e<:ure . id~ etre<: ~ . will no t ~~ t1 ~ dc''''' IInt :l ve r.lcn (0 .)1 •
• pproli .. nely l~nl . l'1H .
.
'

5o<:oe ..... y t. needr.! tc .p.c:~y tll~t a P'"ccfdur~ h cal1~ ~ror:\ ou t "~ e

of t ile pr c .er.t U_cOd e ~r O'rl CI (e't er~al ref~~~ ~ce). A c er~ne<l oP .. :r IS on e


soilltion .

E%ten. lc n. f or varlable _ hnltll nrln& operations can """,~t1 .. u b~

upre.,ed vh tIIIK. but t ile Load~ and St or u prcbably " .. n't be •

.
I ' -'"l:i:";::'~-;::
Ap J) ~ nd h A. Stanfo r o - I P·~ode <__ > U-code

(
Stanford PAIL-1 P~~cal CO<! .. to UCSO On!v~-nl ?~sc .. 1 Code
Tr ... sr" ,,",3t ~on I>oc= ent


Onlv~rsl~y of California. S.n DI .. &o
C_Ol~

La J olla. California 92093


The tr.n~fo .... ation of Stan ford PA!l_3 fuel! Code (P...,od,,) to UC~D
Universal P3~c~1 Ccd" (U_c~de) can be ac~cc'li5r.e:l ~or t~.e :::ost ,.r: on a 1:1:1
by line basis. r<luUy. one ·....,")d lilee to ~:~as5.",bl" a ? -cod . t nst ...:ct ~ on
l~to scverd ' buckets' .nc then ,u","lIh a u-cod"" f",, truct ion frClll the
lnfo .... tlon conUlned in th ese ' buckets'. R"alL>t1cally , w,,";l1 need to
a"!pe nt these our 'b""ket5' with ~e special tr"p'5~ tabies ane: dgorl:r.';Is.
Tl',' t a ble that follows deerfb"s the gene~ al " ; ppl n& cf a P- codt lns t~ cut~on
In t o a U_ cede ins~r"c t~cn alon<l " ith 5~" dat C3~. co,u:~era tl on5 for "'1~~I~g
inforTO.tion,
,
~PP'"d 1>. •• SUl'IfOn:l_1 , .-cOOle (--> U -Co,'', h~. 2~

• CC'I.r al Iflst"lcti."., III DOI"S

."h , -c0C!~ :nH~'.IC:~IO" C"'·-.s~ond I 1'15 U-Co<Ic: Inst,..".,::,,"


.., ,
...'" ~I!S
,
'"
'" . .
.•
'",.
~,
!

'" .. dUll ... lve •

, '"' "" ,
CHK ~.lb . 1A.>
,"
CI!¥L
CHIG~
"' •

,
C!lR
'" ,
, '" ,;>roc: "" ,
sproe pus~
""
m t.:'I~r:ln . .. proc m bl ~no "proc push ~, flP"""(!

, '" t .off ,
""CET , ."
• hbd DE, lt~
[ ;ID
'.0
up • ...,

01; Di r

OV! DI 'I ,
,
'"or. '" ,
~ uproc t.l ... . ds.ld.l.t.d \/proc E~T
L!:X ,
,
hvel b:kno
bl~
push pop pl,u

..
I>l~
...
PSi3 , • blkno orr "0
'5TH
...
blkno orr "0
, EQU t.ltn
'" ,, "0
(od !ECU "0
en
'"
'LO
h~.l

, to
l~od

Fl. _.
r' '''
, ,-. " . : en
<- c<:~ , Ie"
(or! !et: ~ t
"0
- -.
. . . -.
.'

•• St.nrord_1
..
"' ~p~nd l ~ P- eMe ( ._- ) U-~Od~
n
,
P .~~

• (;. 7 t • l ~n CiT ,, ,
Cod IG"T ,,"
IIIC t ,off ,
, '"011 l en
I!lC

• ! ~l 0

I:i~
t , ofr

- j:tl D

r:1 ~
- In I:fT •
,0< ".
III 011 IU 011

T
label '-',
'-'0 011

CO, ~tr1ng
i _bel '-"
CO.
0

• , 011 , ..
CO< "trlns
T CO, In , o f! CO,
T ,I< I I<
° b)kn o
'" l~"

T UIlI t .o l f , • , oU hn
""
LEe , ltn
5
'" t.l~"
(or ) IL~Q, hr-
, lES t. le" lOS , I,"
,
( or) rL~S I,"
IOC 011
T 1.00 t . h~ ,o tr
'" , •
"0
011

bl kno 011 I,"


,
' 00

'"
, .. "0

"" ,I,"
"" '"pr
"" 11

r~si1..r~siz .

," '" le •.
'" ,levd rc~;z.r::> $I !

( or ) rnD ,
"EO t.J en len
II! ':
• ,'"
11(',1 ,~
!It..' len
IIG; N ~'::; •
SG, :1 ( (0 , l

)10 . :101
. App~r.dix ,. Sta~ f e r C _ l P -COl)<! e <---} U-<I)<!~
PJ'~ 2S

( 000 000

0"'
, '"' ,
'" , '" ,
• '" "-" II bl~"o ef~ lfn
"- on .
• ,
'" UNJI;

, ,""
,
• .--
~- S.U':--. ~
"" • '" 'n
.;
'" ,
'" ''''
'" sua •
,co
'"
'" ". ,
". ". •, ,
7
'" t .ofr sn • ." 1 en
(
" '" , t .pr Qe , ltv , 2.3 . ~.5 UNK 0 o ~ST t .~~Qe .l ~ •. 2.~,~,5

• '" '" , err Itr.


7
'"
m t .ltv ,ef f
'"
m , 0 bl~r.Q err hn

• <OF U~~JI; o 0 TOf


,o
• Tall UNK TOil

no no
". laDel '" l~bel

, '" '" ,
'" h~~l ell:\!. 7
G;;r. 7
m
Y~lu~
I~Del

(
APP<lnd1 . ,A. S ~a nf"c~- 1 P_eOOe <---> U- eode

Sp eeia l Ca su

1. Da ta !H'" ace • • ;>li clt i n U-eC>!e . Ther"for~. P- eode Inst.r uctions suc .~ IS
AB R and t.SI ... ! t t:1"plielt data types ire In'afor:::~ Int:> AD D R and ,, ::0 1
r.sp t eth" l,. Th is , .nc rallut ion ... 111 .110'" tho! Optl.. lt.er to handle " an y
dHferent data t)"l''''' •

2. In crder ror the Opti .. lur to 60 In effi cient job o f eli_inattn,


unn.e e •• ar, chee k In stru~ tlcns. the P- codl CHK Instruetlon Is broken up
i n t o a CHKL. Q!KH pai r . llheneHr po ssib le. th e Op tblinr will· r.,. oye
eithe r or both o f U.ese chec k ••

3. The P-cor:lt CS P fnztr ucUon don not haye I~fftchr.t Inror.:o.tton f or


tr ans (o,.,..Jt!on Into tt's U...,oc!e ce unte r~ u t. TIle 'dditi onal Infor-ution
r equ ired co nsist. of a type (or the prrxe<!ure. nuober o f pariolll"ter' passe1
(popped ) to the proced ..... . and nlnbU ef par.a:oc t cr. re turned (puShed) by
the pr c~e1urt . Thh I n fo r::: ~ tl C11'1 is be st :rI1:nta!ned In .. special ~repass
tatll~ '.hl c h is !ndued by th~ st a ndar d procedure n_e .

Tr an. lltion o f the I'_eo<!. CUI' Inst r yc ticn Is ",c~. dlf rleu!t. The "iui~,
inf~r",nlcn h er~ Is a u:lIque bl c~k n=ee~ for th~ ~roc~d"'T~, par . ",et er'
POP~.-;!. and ; ar...,. tors pushed. An al"ontN!l is described below \Ih! c!1 .. I!l
calcu lnc the tll oel< n=ber. f o r [NT and ..."" er, nf.ren e e i nstruc tions.
Un fort unauly . the nu:e er, rHur ned by thi s Ilt;or itt"" ~o no t "'.t~" t ho ••
o r .ny one pau al aor !t~ (or c~ lcuh tic'K th e blocl< n"""bers en CUI'
I ns tr ue ttons because of rcr " ard r .fe r .ncu · to i proetdur 'i:- ' Yor the t :.ce
bein g tile pr epa s, will h. ye t.o Uk. a 5eecr.d pus .nd rill In t t:ue block
nwobers . In the 1o", run i t .. auld be bett er ror · the cOOIp lltr t o out;>ut
t he bl oc ~ nu:ller \lith the CUP in structlen and a1:.o the LEX ' nnr uctie n •
.. hleh .. II r ef teet the stat,e nesting .ranl~. nt (or eac h pr ocodur e.The
;>op~ed !nfo..",ation .. ,y be r ~o~tructe d bY si ::",lnln g a run- U:1Ie .uc k

and inq uirl fli abo ut It's depth at t M point o f .,.11. The pushed
i nfortnH l o n is eull y obulned by rec.t ling t hJt i t Is syn oncaou s Io1th t he
proeed~r. t ype.

~. Th ~ P-code SS; inH~ uction i~ tnnsfo r",ed to a zer :e . of U_,,-oce orr


in~tcuet!ons ",.~cn reflect allocatlo:n o r t he actlv. tt on reeor';.
U~f Ort',".H ~~y. t~~se instruet ,ens ,"uH lor de l 3yed ....,tll the ~_eQde :::iT
i., s!,",;c~ien hn be .. r:~~e ~ cut. sl~ce t~e P-ee<:r SS7 pr~c~dn the P _ ~c: e

E.~7 In~~ruttlon. In ,)<I~' t ion . t~" s.:!.7 In~ t rac~:on Moult: ~~oba bly ~e
transfor.::e-= onto a U_ccd " U:I1( I ns tcuct!on .lr.o" t~.e ~ T een ~ .: :u

i~~or.:.!'c n '"tlic~ =u. t be ... v~ In o r t:cr 'to recor.>t n.ct I t l~ter.


Ap;~ndix A. SUnfo rd _ \ P-<:cde ( __ ) U-<:ode

E~c~ pr cc~"n h~l .a yery of ent", jn.t'uc~:ons !;Irick. Un;


~p~dal l~~

( I t's coc~. n.~ ElIT !."'!ruot~on sig·"ab th~ ~., !nnlr.i of. procedure and
r~ qu lr. s thi t lh~ '-~Cde .u~ply the blcck n"",te r, POPI'~ 1,,(oor::l,,1.:Qn . .and
pu.t>ed In ~oo=at io n .

1h. fo11Q"'''& a l ioorit~... " Ill k~ep t ric ~ Qr the . u ti c neH. \nl of ;r ~c~ur.
bled( """,bu. fe r , pa r tlc uliC pr Qcor.ur~. The uray LE;{( J I. !"d.fxed by
the .ta1. \e level .ta rtl "& ....H~ one. The yalua in each Icc&lion I s the
block n"",ber curr e ntly a •• oc:ht.~ ..nth that partlc..,l.r display level.
Th.u' , the bl oc k n .... b.r fOr • n.... procedure Is the ul.,. in U:Z(luel]
. f ter neeut\ng the .1&er1t~"" .

•. Inlt.Ulutl en 1'( hl&h d.1Sphy (HD) and hllh procedure ( Hi').

liP :~ I:
liD : ~ I:

b. Ea Ch lillie a OIl in.troction b encountered. pe .. re..,. thl. code


u.io, the 5tH !c n.st:." lev.l (LEVEl.) r.. "" the l ns~ri.l~ti.cn.

tr U:',"EL >a 110 TIlEN


FOR I : K HD itI tE"ltl. DO
eEGI~
r..EXU ] :~ Hi':
liP := liP • •.
( EII D:

HD :. U:VEI.;

Unfort unatel y. th'" bloc~ n .... !;I~,., I re d!ffer ent rrao tho,. or the
" ... pil . .. ""en ~ ~roeed ... e 1~ ~ edare" fer ..... rd. The only "~y to o!;luin
unl~u, block n"",!;Iers " nien .. &tch tno,,, o f V .e e""pller 1. to the the

cemp!ler ou t p~t th .~ to st~ .. t " I t h .

Th~ POI'I'~d
l" f"""' HlOO 13 di fficult to oi>!~,,, 'Ine~ the only plaet i t !s
ua lla ble aft ... uUllnlng ... ..- k ,U<:k call1n; s.~uenee f or the p .. oc..d ur.
in <l.uest1oro. In t he ea.e or fo .. ;.~rd proeed .... c all. th is infom.tlon hi.
r.ot been s u". I n orde,. to avoid. using a t"O-p~s, a li od t ~, i t I . be~t

If the ccnopilu .upp ly tl:i~ Infor"'~!I"n ""Ieh \. no .... ally s ,,~plied \n the
[~T Inst .. uc! lor. oy P2 V... tarot Pa~eal C""p :h ....

rollo'<lr.~ :~. !'IT !r.~ tr;Jet!c" u. a .~r,e. of '. EX ~~ue<ic :c.~, cue :~e r •
.. nlC~ refh e t t~.• • t~t~c ~!';>hY f e .. !~.e pr:=eo::u,.~. n.e ~~ ce~ n""'~."
a.s:;".~~ to uch s:~tie h~~l ,,:11 h.v" a\r.,e)" ~e~~ ~o;n~~a ~ Ul!".' :~."

abe'" al,er::~",.

- -
, ·_-:'!."'_"·"T_.
• Page II

"o r r~$pond to t~... p~r""fter


Hore seq""nc .. "p<:l" prcc«ure Mtr1. The
"""' ber or ~ra," fur~ pep pe d indicate the n!.alb, .. of P5T~ Innruct!ons
nGulrt<!. !Iowev"" th type In ror:o.at:cn is r~quirf d ror Uch p~r.., .. ler I~ d
t l'lis b c~lr ,vliilbi .. tl'lrauir> the :.,1< . ~ ac k ,,;o!llr., $"'r.J~~Cf li3!~. In
'd,H t ;cn, tile loca t ion. Into " hiell tI':I I)lr~ter3 a . e to be coplt<! are not
Uill, c,~. At ll\i~ I'Qln: "'" do I\Qt roilV" 'ny pract: e ,! so l ut:ons to t;,is
problno.

The /'....,od .. IU:T instru<:Uon :$ lr ans(o .... ed as fo ll o ws. I f t he proct~ure
.. tturn. a re sul t, the a PLOD Instruction h _ ttt ed to pUSh till return
val ue onto , the .stack, .nd tills Is f ollowe<l by t he RET lnsvvetton. I f
the proced ure Is not .. (uncOcn then only th" RET Instr"'" tiM 'h "",I~ted.

!hi! 1'-:0<1" ocr i nstr uction I" trlnsr" ..",,,d In t o .. U-code 0(, in'~ruct!on
and rol!o ~ ed by 1 U_~od. [»D in~tr u~ tlon ~h lc~ $I,nl l$ th~ end of the
pr o~~~ r •.

S. tn ord~~ to tran sro .... t he P·~cw1 e rel~t~onll In$tru~tlon~ Into u_cedt


relat !.onal l"structior.. I prepass side table will be need~ to supply
t he length s .."I~h oorrt$P9n~ t o tht vari,,!:. dati types. thiS tlbl~ will
.bo be helFrul in s!:pplyIn, t~.t Itn~t t..s for t ht "ma ry rd~rtnct
In~trl:c t !."ns. If th~ r tln:on bvclvos I Hr!.~i. U .. :I t~~ '~.~:r,ct
relztior.I " ~1l1 ~e II$~ In't~~ o f th~ diren rtlit iC~ll,.

6. r nt P-CCdt 1:ID u.d SiO Indir .~t t"st r u~ticn. 'Jill 3lsa .. a~. u,. ar t!'.
tabh "'.r.ti one<l to su~ply t~t l.n~t h', I n t ~t ~ase of r~ cercs . se t t i r.s
ene Itr.~ th to : •• 0 'Jill slBUI tht C~ti"'iH" t hat the ~er. ;t ~ !. ",,~na...,...
lho I. a d i splrity In the P·code dtflnition In th e tHD has .n •• soci . to~
of f nt and STO does nat. Fo ..... the point of tht ~repa." the orr~~t ...111
be set t.o the U~Stlr.B orru t for an !lfO t ~.• t~uc't;"~a" .r.d set ta z e~O ror
the SlO Instruc : ion .

1. In U-cO<l., tht only dht:nc:ion b~ t"e~n lccal .t'ld global ",,.,,, ory re rer et'let
lnstr\l~~ ions Is In t he blo ck n .... b er . Thus. tht P-code 10<:.1 instructions
are ~ a p~ea Into U-code instructions \11t h a bloc k n~Der groater !hln one
a~ the ,leba. instr u~ttons ~r e .,appe<l In : o t ho bJoek n""ber Ont itself.

EaCh ::oe:oory rtrertn~tInst r uction can ta in. ~ ""~",,orl Guadr~ple . Tho m.",er y
ty ~e (,. ty~t) wlH 11"~ ys be It ",..tll t ho eCC:>i!.r is ehanae<! te reflect t ~e
o t"t~ "'","or ', Itv t' s. The b :cc~ n=ter can De Inru r td f~= t~•• ,~a::c
Ie"'.' l~d::lte<l in !~e P·ce.t i~':r\;c:;cn ;,;n, t~t infor:-:atiet'l ~lro.;;e1
, ~r tstn! in tt.o UX{ ] arr .. y.7ht off~et :. t~. u,.It an;! t~. ~t"!:~' I.
eons~r\;e~.~ u.l~; t~. C:H~ t'l;t illfor=:at;;.,.


8. Th.er~ ~re(our P-C'de l,ulrucUons "h ich ~o .... t .. . p into an y specific
In~tructicns. Acco rdlngl,. thoy are lIIapp.d Into t he UN!: Insuuctlon. The
poppc-:l and pu z!:ed \nfc"""tlon should be lulnUlne:l In a prepS$' table.

9. The for!lat of a U _ c~e lJP I ns:ruct.lon sequ.nee is a rlnge chec:' sequ~~~.


'," i.eh brane!!" . If out af range . tht XJP Inn r ""t~on. Ind the ea~ . tl bh.
Th" ca." tab"e 15 hn~ed by a .au hod (Cu. a) ..... Ie!> npHdtly .tltu
", ler.gth o f the cue table. •

P-Cod" U--Cod. ~urce

'" " CHKL

"'" "" CASE INf Of"

"2:"
X5 LAB '" "
X5 L.J.B :

'" '"
£110 :
'" '"
X6 UB 16 U.B

...., "
• "%1 '"
'"'" "" '"
" "" " •

,,
UI! OL" l
12 OH
X3 DEF
"
"" "
'" " ""
"" ""
....,
" "" "
UJP
L:'B "
'"
fht I nt e n~ed transfornaUon 1. to ."k t t!te range checklnC upli c; t. ai:d to u'"
th CL~B In~ tru et1on to 1.not.. the be,inni". aNI ex ":..~t of the ju:::p t ab!e.
At preunt. I prlt t led al,orlthcl Cor pero"'ln& the i nUnde" trallsht:on,
10 stHI un<ler In.,.sUlttlon.


A pp~nd! 1 A. Sla n{erd-I 1'''''00' {---} U-cod~ Pa&~ H

• I. Supply the ~l=k II\1<1C~rs "' i t~ ne ll CUP Instruc:icn •

3. Supply t~, LEX p~eudo Instruotion l"rore>lti ell fer uch pr oc edur e This
In(ol''lflati on should a ppear ~,rore any ef tht eode {or the procedure.

Q. Supply the PSTR and PLOD Ins~~ uc tl e ns associated with .ac h ~r ee edure .

5. Introd uc~ tM thr ee level .. e:o.cry h1e~.rchy.


2. Co ns id~r
regl!.ter Il !. oc a tioll alons tht lints dlsc"sse~ In :~.~ CU'[-l
r.,ister allocation.

,
.. .-
Lo~ Al""'''' Fl5e,1 Cc<:le t o UC~:l lJ~i"H5 ~ 1 P~~cal C>:Ide
T r~""fo ,""at:o " Ccc=~,,~


UniVel",ity or edifor "I., ~" Dh!o
C-ol~

L.. Jo ll a, Cal1tornh 92093

nl. transCo,.::l s t ion of Los u ..,,~ " Ptscal Code ( P-cueJ to UC:;O Unber- •• l
Puc,) Code (U - COdt) u n ~e ~c ~:;rn ;>l!s~td for th e mo,t ~ar ~ ~n I l;:~" b y 'l Ine
bU t . . Uul!7. one ....,,,1<1 l;:~~ to di.aza"' b l~ a P-<: o~e ln3~' U~ ~ :O " in tJ
.t~er.l 'buckHl' and then a •• e .. bh aU _cDc. In.:ructlon trQ!: t~e infor.:.t !OM
cont'i n~ in t he ... 'buci<ets'. Rn l13ticllly . lie wll l ne!d t o aUgI::""t ~he.e
our 'b""kets' with , croe sped,,} 1"""1"" t .t>I " , and al l 0r-iUns. The ta ble th.~
rollo ~ dec~::bes th e Bt".,,. ,,l !uppin , o f , P-<:Ode in:.trcut ion In t o " U- cOde

Instruction Ilong with s pecial cue conside r- atior.• fo r :.:sslr., infor.:atl on .


hge 35

ADO t
.., ,
Co r r ~S:lC r.oin ~ tJ_C.x ~

U)D t
In ~t n'c ti on


'" '"
, CUP t blkno " "". puah pcp ~ !!.!!!
, CF? t,l,~el,b l kn o.n.",e ell? t bllm o n,me push pc" ill le~~l

tllK ( l or a l,n2O!e,ub , n CHlt ( 1 or ~) l b "..",


CHKH ( 1 01' ~) ub n.:l e

CI1K q,n a=e , cf f .sl:e ,v.! 1 11 0 off len


""
CO, I u l

"'" I . I: ~
CI1KT na:lf

CH i( u.n iI<C e

C-<l i: n,,,_Ole
CHR
'"DEr C sl:= ~

I.rnK I I C~ O"

, '"
, CUP t ~lkc.o u~r"e p".1> pOI' le~ ~!

UNK 00 CI S vol""

DEC t, o r~

l DEr 8 ~
• DO= T t
• ~[, :l"
(:ID na =e

-,-
"
~I '1 ~ D!"' , t

.. . Te e !:rr t : e. et bll<l'Q "U~~, ~el'


L~X I ~l!<
App~ndj.
•• Cray _ 1 P...,od" <._.> U...:,<le Page 36

UX , :..:;..
~ ... ,, •
I'SH
PS'? •
bl kno
~l ~ r,o
."
o~r
h'
l~~


~.!f" ECe ,, h'
''" lor) I£ ~ h'

'" lab.!
'" l lbd •

"" F'"
m m
,hll CZO ,, h,
'" t
lor) 10<:0 h'
on ,,
IGa T ''"
,len
~
(cr) '" h,

'"
val ue
-- ~~ '" ,, , -
IeT va,u"

'"' Loff I HC
."
• !liD , of' h,
'"' l.On

• W" 1:1!I

lH I1li

lOR
'" •

'" of' W
.,"
lab,,!
"'. hbel
"'.
,,.
S
"" "" off ,blkr>O • bl ~ M 'off ,,'
!.C~ ,u:ng st r ins

S ,,. '" • blk no of'


eo,
r.e~t

t,conH
," • 0 rr , bl kno
'" , CQnzt
lit:

'" ,
S ' 00 ~,l!:e,~,ofr,t>lk""
"" '" blkno of' ",
LEO , l en ,, ",
'"
t

LE5- ~ ,:~"
lod lEO
''"
• :,,"
I or)
LES
lL£! , :"n
'"
eo,
~ ~~

t,5':<' ,~e>t .::. ,on ,~ l ;.:no


Lee

'" , .
o[ ~

t>l:Cno off It"


A p;:er.~ II Criy-I <---)
•• P- ~o<:e U-cod ..
Pae ~

-'. II :=<) , ' 00 , "


'" ,"0 '" "0

'" 11 P'!

'"' leyd
'"'
• "" op, liST Iud

"" l.lt" '" - -
o 0 HAM "_.

"" '" •• 100


(or) I11EO
"0

100
"" "" 10,
' EO • ' EO •
'"
000
NO.
000
,"0 0"'

3 t.ne ~t.:'I.Orr.bllmo orr


• "" PLOD t " blkno len

""
3
'" • a.::T
,
""
sua ,
'" o St,

'" •
"" '" ,
"" U)lK
-.
D Sl'1L

, '" • "" •
1,,,
'"' t, ~i:e.," ,orf . ~l ~"" m •• ~lkno orr

• '" t,oU
'" t o rr hn

m S7P
, S7 R t ,;:,:e . n .. s< . ", ,o[[.t 1 "".0 m , .. b l k:;o 0(( ' 00

m v.l"" U:I);; 0 o SYS val" ..


TJ? I.. b .. l

";aC
'"
·r.~C
I .te'

7~? , 1~? .,
UJP lobe!
'" ! ~b~l

.. . ~;:-----

~ ~p~~d"
•• CrOr- 1 P -<O<l~ {- -.> U-<od " P ~g~ 38

r
,
UN !
'"'
0"" ,
W Ia~ 1 < l~~Z, oJ!> .;;U~, tb ,Up
,"
C;! r.;.t

, "'."
!IS-;~ 't~ "p'

'"'" • '.0
W ll~l
• ' t~'"P '
""
oro , en
'"
I Ilub
1

'"
"" ""
, ' hOII"

'"m '"
I .b I
... ••
-,
ta:> 1 OL" st l ~

1.b2 ..... 0

, •

-. - .
</If' SD ~e!i l Ca" ~ s

1. T~. ~ ~·ce<!e C~ K I I""tn;ct~o"


I, tr 3r.$for.:ed ;nta • lI - cD<l~ GtKL. Cil i(il pal .. .
Th~ P-c~e ~~j( Q r~ cG rd tal varl.nt ~n.:r~etl o n '" tran$ro~ ~ Int" the
cOde to per~a", the rtlat l onll cccpari~o" • ta, (allowed by a U-¢ .... ~ ClIlC.F
• 1".t rcct~on. The P·cOde CHIC U b~c=e. a 10~4 o r • boolnn fain fo11""4
by. CHKF. Fi nal ly. the '·cod. CHI( H Instruc ti on \s the .~. 13 It ' 3
uc:ocIe coun te rp;or t. tn 311 case • • the n.... or t h~ pr oc~ure to be c,!led
In U~ the cheek 111 r,u$ h ta",...
onto the end of th~ ... rlou. U_co(e
ch.c~ In,trucHan ••

2. The P-cocle proced".. " c.ll lnsvo c tl on s .r~ us.nttdly the s U.e. foth C£?
.nd Cf? He tran.fared Into lI·cOde cup instr uction, with CtP or CF? lau;ed
Into the ca.ent fIdei of tne CLIP I nst ructi o n. The sUtlc nuti~, leve l
Is .IM) taU.? Into the c=ent fidel. 'repass t.blu "'Y be used to
'quire the Infor .. a tlon ~bcut the tYP~. n.."..Der of para"etor. popped u~on
entry • • nd nu .. ber of p.r, .. et,", push~ upon retUrn fa,.,. t~e proc ~ure.

3. hel\ U...,...::. pr oc ~dure


Is b,.acl<e~ed by " v~ry sp.~trle sequence of
< !r. str uc ~ !on'. ~
procedure b~ljn' "I~h ~h. !YT ir.struc ti a~ "";C.~ an!y
requ lr u ~ ~.e a4~i;;~on c( " pusll~d n o! a. ' oll""'ng ~r.e o..'IT lr.st ~ uc : !Ol\ Is
• uries l~X pseut:o InstTuctlons "hl c~ ' r ~ u.~ to r~n~et tl'le su~ ~e
display for the procedure. tn turn. theu are fol!ed by 3 lerles o! ;:LOO
\n.t,.uc ~ ~on •. These tns uuc tions "r ~ t~e u~ l!c ~t storn rer t~.e
p,. ... H.~S jnt~ t~c locll activation r~~" r d.

The P-ccdc OEF in,tructl"" which IPPC", at t~.e end of " pr D~ed""~ Is
tranfo,..,.td (nto , se r i.~. at U_cOd e OEf' innruc : lons. All procedures are
ur .. in"ud by tile £:10 In,.ruet:'on.

If t he I"' "c .~ure Is to ret ... " " ~d"e. an .p~ro~rl.te PLOO Ins truc::on js
.. ecuted . In elt~.er case . • U_c<><le R£T instruction Is then ~Hted .

• Th e P-eO<l . I:lt) ana STO !.,.trcut\o ns arc .. iui"g the hnst~ field. For t~e
tl:o. ~e tr.i! the Pre,.u '.1111 p lace a :.ro Into tt:ese f i eld . "'"1CI'l ,,,111 l n
turn slg"~i t~e O!)~ ,,,,lar t~. at tn~ !.~sth is ""kno ......

• S. Th. "' '''''~·Y .. ne~ ! r.st ~ ":t!"n" ~re cs,<,,,t:al1y t~e ~~:=- •• ee ;>t th~
r~~ .

t.~e dht ~ ~.~ t: e n be~ __ e~n ,! ,,~d il M ICCll iled~!~SI" 6 ~." tn •. u.~.ed ~f!
!~ ~o ~".• ~:c~k r.~"~e •• fer :~.e ~r".e~"r.. "".e 6~atal !>!cc ~ c.....,b~~ !.
, iI~S~""": to !oe en •.

A ~pendix B. C.. ~y_l P-<:od. ( _ __ ) U-code

- 6. t ile ("m.t o f ~ U_<: <:d. U P lostru<:t ion sequence .is ~ rar., . e l'leck uquenc:~
which brioch e s If out of ra r. ~e, the lJP Instruc t ion, and the c ~se t abl e.
111t ca3. t;~ le \ S h.a~ ~ ~y ~ c ~ 5 . t ,bel (e LA B) ~h ;ch .x~!!ci~ly s:. t • •
the lenlth of ti,. c~s" U bi" .

U_ cod e Scur ce

XJP Il,X2.,lb.gub,lb,ub ,,"'- I tNf or


"
(.1.$[

"''' I ~l ,
IISTR 'tMlP ' ",
I ,ltl "
END:
""
IS' 1 hn
W
,,>0 "
' te::lll'

""
on
I ,uti
I hn
W

""
"
't,,",p'
DEC I ,Ib
'-',
13 u. X3 U, D "
u~ p

u, " '"'" " 0

XI
'''' "
"" sl :. Xl '" ,"
CLUI

"" " '"'" "
u. "
"" U. "
" " 0

-The IntendO<! tr. n. ror.llat. ~on \s to ""h the r ;n, . chK~tng n plte\t ' n~ to us .
lhe CUS In.truct!Qr: t<> cl enat. the bes:nn ln l a nd nunl of the jl." " t l bl ••
At ~r •• • nt, I ;rlct!cll alicr\U", for pefo"" l", tM Int e"et<! tran.ln i on.
I. 5t ill "",de l' Inves t igatIon .

. .-
Pa ge ~ I


,
.. Supply ttl ..
tn3trUCt1on! .
PST~ Lnror.:latlcn " Met! b assoo1zt..:! wit h ... ell ~~IT

2.

,
.'

,
5t~nr()r<:l _ 1 Crly.l

,
- - --- -._------- ------- .----------
• 3ddr~~ s addr.ss A_re,s •

,• boolun
"hooT. c t a ,.
bCloha n
ch.oracter
B-re&.,
C - ~""...

,,
D doubh
'"' direct .~

,,
,, Ilalf Int
In te l _· Inte!". •

, Indu ~r.ort Int

,
.
I
IDe<lor7 strins "lin mP.II I>aln .,~

",
0
oU
" oU
".
pr""'~II1"' 1""0".<:1.."."
qu arter r ecord
0

,• '"'
do~bl t r eal rol l •• ,ls t e r s
,oC S_ r.~3
'"
,,
T T_r., s

, 'I - ress

• 31n&1. !l~

,
T

N<>t.~ ;

,
-Indu- and -¥.o r t Intt,.,.- ,ene' a ll y ...an ~dr.ss-si~. In t egers cf 2~ . ~2 .
or ;6 bit:;, -11."'"r1- datat1~. Is us e<! fo r arr~ys. str:r_!>:; , a ~d r eco r dS f or
• tr.• S- ;.

lPn~rotx 0
SU~"~HY or OptiI'1IZI~IG n~;I SrO RI\I.7IO;IS

St ~c k He!ght !O'ducnon. Rn~ru tt:~ order or Ol'erand3 ( or .. ~ln.r"l


opern or SO tt:n llle hr;~r upre,u , cn 1s the hft 1'1"'''"1'1<1. C~.nl~
tht operator to .. eth et tho .. tverzt1 Ol'e~ .. ncI~. h:ilOple : A _ ,9"
• bec . . n B" C R_ A, '*'ere .~ •• denote' the Ruers. SuDtr.el o~r.tor.
This tr.n'ro .... atlon .11'11,111'105 the helshl o f an ev aluation sue:'
nuded t.o .... ;u.te tho upre'slon In strict left_to_rilhl order.
Alte rna td, . tke " ...... t.ransro,."..,tlon .. !nlal:as U,. nu=bt .. of
... ,tlters nee<led ror upressl on ual ... tlon. Note thet ttl •
• • ~pre"sl ons are nner re"soclato<l, I.e. A. (SoC) Is not chlnied to
(1,.8)-«:: tnste":. i t h .. I.. ngot<! to (B.e) R. A. Nou .1:><> U ,at no
operator need bt considered e=:nutative. and that blt_tor_bl':.
id enth,d floatbit-pOint rnu lts can be gu.rantee<! . Inehldin, the
pre~enee or ~b~~nc, of over(lo .../o.:nd.rrlo ... . nll~ i~ ,trictly ~ en-n,.

In the order ot evdu~ticn. Art e ~ stack height r.-juctlon. III


e~pr-e nlon~ cont.ining (2 " :11-1 o r fe...,r Op" r and, can b. ev.luated
... itt> • SUCk height of 1/ (O~ ... I~!'> 1/ resl,ters). 1h1:o I, • tliht
er.oug~ u~per t>our.d that a stick of I..,) entdes Is ~urfi"ie"t fo r dl
r U50n~blf u~n55lons (15'''~5 operar.(~l.

COn,tant Ar l ~~.::>et1 ". Repl a"e .n oper,t or " ith con,ant 0Fer.n~' ~y t~.e
COnStan t resul!. E.... pl~; 3. 5 b""o:o.s a.
In addition to t he nOr.lil

n":: e!" j~al operate:-s. a lso reduce l' ~:ID rALS~ to ~.\ LS!. a nd

conditlon.l j..."p, basO<l On "cn5tlnt~ to un"onC:i tlon .~ J~P or null


Instr \lct~ons. If "nythih, gees .... on' during the e''"~tant aritt:IDetlc.
SUC h as ov"rrloll, luv t the up~""'IO<I untrar.sfo=~ and issue •
""rning cuu!:e. It t~e •• presslon i, then ."i"al l y encolmared
during u"cution. the over flo ... 11 111 cecur Just as tho"g" no
opti::oiutielO hod been .tt""~ted.

Opera t or SliIopllf tca tlcn. Change one op"rato r to a sl.pl",. on~. Ex_pl~'
A ~ , beccnoes deer~ent ( A) . This t .. ansfo~Itlo n Is dep"nC:ent on
the ".act se t of o~er ators ayall'Ole.

Loell C="tO~ Sul>npr-es~icr.s. "'i~hi :\a ph"" of n~.i&ht_lj,,,, eod".


• rephc" duplicate eY;l~atl on ~ o~ th" ,_e "'lIre~sion "tth a sl~6~e

.. t""~Slon ev~l ~t:"r. roH ~ "~ by ",ult~pl" uses of t""


re sultln~
v.l~". Ex"...,plt: A" 9oC; 0;' C' tS . C); ~"CCCles 7 :,S OC; A ;,1";
0" < '1";. !"!II' tr~n;~or::OHlcn is """'''~::l es call~ CI~C :>u ~:C: i~ 6.
be c!~s .. It cr.a<.;~, ;, ~roup of ~x:r~H:en tr.es into a ~ir~c~td

acyclic i~a .. n (~~ -:;) . i.e. a !tro up of tr e~, ·~ith share" su~-~"'ee, .
G l ~t>;ol C=OIl SuI;lUpc e Z:S(OIl S. H _'ld c(l:WlOcn .u bn preSSlons acn,.s basic
f bJ <><:ks ( pi .. "" . of $~rai g l\t-lIn" cod e .nth no b r anche" o r labtl s ).
E. ~:"~ l,,: h th" so,"" ~s \ n Local C"''''''OII Sub" J ~r"sslons. n oe pl t~ t
til" two s ~n ""'''nts are In tllffer tnt b .. s l " ~ loc~ s. 7nls l rans ror.u~ i()n
, Is typl c o11y "'P""s;v ~ t D pe r f o "" par tly b,, "~uS" i t I nv oh t .
pr ece ss ... , an ent !r e proced ure at once .

,
Is very snort, .nd put Its code In11n ... I t th" preeNur''' t...,. .ny \o<:al
urhbhs , they lIun b" .. er,"" Into the loc.l varlablts o r tht c.ller.

Activation ft. ""rd Merline. ror '" pro""': ..... ,, vM e h Is ",lIN !Dort tluln on" e.
Its code "an not be put In llne, but Its l ocal var i ab le . Can s t ili be
."rged Into t he activati on rt cor<l s (coll ect ion of 10<:11 u.~lIbl.,,)
or 1 l$ " a lltrs . ~ long as 1:. loc.l s are put at " c o ~ sI 5t t~l addre~$
(""", e offu t) 1~ all ~uch .cU vaH o n r~cor4 s . Aftt~ this
tr.nsfo ..... tlon Is done. t i'll! pro clf<lu r~ lInka.,;' cod. n~~dlf<l re r , cal l
t o th e givcn pl" oc tK!"r~ c.n b. $i"' ;lcll r hd: nO ne .. acti v a ti on ~ ...,ord
net<ls t o be .lloc a t~ . .,-od pfrlups no db ;> by regist~r u!'<!atlnc Is
nt ed ~d . If $Omc l oed Yirl a bles irt kept in fis t r e l ist e rs, thc se
nt Cd r.Qt bt Sivtd/ rC5tor t1 around the "'ll.
For a , ro up or no r._
rtc"~$i"l! pro- " ,dure s . ~ cthatio n Rec o rd IlHiinii; " a n do • "ca plete

sUtl" storag" alloc ation (I. h rnr t ran) . d i.ci n8t;'r., the ne ..:: rnr
r un _t ~ "' t sta c k ," .. n ai~tnt. bu ~ pre servi ng t he <l. ta "" =,, r1 3t.• ri ~g

.m ien i.s i nner cnt In a :'lock otruc~u,..~ la r,!;u . " " .



Lnop Ind U"~~lIn E~;>r es,l ens . Ch,n!e linnr
In"rKl.nt~l .. pressions. E.u",ple :

FOR ! :~ 1 TO M DO
U1] :,2 ' 1 - 1 ;

.
"" ". '" -- ,".
:
2 .~ (Hm it)

13 ; h [ 11 : (aldress or A(I])
WHIL! T \ <. T2 DO
(Tjl : :T1 ($tor~ !n<l:r e ct )
T3; : T ) · 1 ;
Tl ;.11 .2;
r :', (Tl_ 1) DTV 2:

T!l:s t~3n,torcHicn r~"oYu t~,e n Hd :.0 rec.:c"l ... a ~ub~cc,~~ u ~ res ­


s:~n, .. r.~ o t .... e~ !!~~~ r u"~.""cr., ~ h e"~ver :~e ba,e ~ar~~ole c~ 3r ,"e3 .
rlea ::-.~ t t~.~ ta!e var:lb!e (I 1n t !lis case) c~" De r ec" .. ~ .~ ar:er
Ica v,n. :he 1001',
• •


M ()~:ng Sub"e~ iptranse Ch eck ;",. f M sulacripu whl C ~ are linear
CX ;rtS5:ons . ....... the r an, .. checkin g w t of a l oop. Eum pl,,: In t he
above 1""1> . c hang" th" c h ~k of I In ~[ Il 1",:<1 .. til" loop t.nto a
cllede of 1 and /I j~t beror . "ntulng t~." loop. th i s Uln3(or:utlon
=",st be don" In conjunc~lon " 'th t he Zero I t e r ation Trst

tr ansfo,"",.UC)II below. ro r . l eop "" Iel\ \ s tu"utrd at h,,:;t e nc e, "
.ubs<:rip tra" , ,, error ,,,11 occur on san e Iter a tion If .1>4 on ly If o ne
• of ~h" lllO utr ..",,, ul~s o f the l1nur . ub:s.crtpt u;><"ru\on 13 out
or .. 0",,". The,e two ... nl" ChKks "an b• • ,dt b.fore .ntedn, th"
loop . Ir ,ithe r check rau •• th. "r r o r auu8" InvolY~ will b"
Ilye" .oon",. t ~ln ullaptl"t "u d code, b\l t th i s I s usu.ll,
Irreluant , 30 l OIll~s no fizup-.nd-retry .."" h, nl ... u lsts.

Zero l ter.tl on Test. Ch.n,,,. loop with 1.141 n& tt~~ Into. l oop wi:h
_I ..din, ~~. ro 1t., .1l" n~ M un plU3 • trailing ~ eont1 nm' lool>insM
tut. [Umph :

\I llItE loJ 00 •••

L 1: IF IJJ Tl'iE.~ GOTO L 1


If IIJ THEM COTO L2 L2:
...
coro Ll If I =J TIi£:1 caro L2
L2 : L 1:

Th1~ tr~n~ror:ntior. In genenl luku t he code a 11tt ~. bi'iU b.e~u ! e


t he ex i t tnt h d u;>llcate1, b ut i t hiS .sue,- al "'V&'\l~,u: (I) the
tral1 i r~ te~t el!cln~te~ ~ n unc ondlt!on.l br.ne~ . t the end o f the
l oo p . (2) th e trailing lut_ . nd_br a nc h oftRII .... tch e~ ~ l.Ir,.t
. ,eh lne '3 l oo p- el031r.g ln3tr Qe~lon. and f )) there 13 • pl.ee betveen
the hadi ng lt~t .n~ l2 t o c cve code to, ~UC:h t~.at n .• CD<lt 13 cnly
uec uud If the leop .c t " , llr l t e r ate~ at lun o nce . yet t~. e<XI.
1, ou t s i de t he loop . 110 such pi , •• edns In the untr.n ,ro,.,.ed
loop.

Cod. Hotion Out of Laoe • . t!o ve . ry upru.sion ""leh 1S • loop Invariant


• .nd guaranteed to t e u "",uteO t o a place out, ide o f t he loop. Th!3
tr an,ro r:'l ~t1cn h~s ~ n o~viou, high p"yof r f o r z~e ~d lns u" In ner lC<)ps .


Hci s tlr.i; . ~CH ~n:t n;: ren;cn " hid, b ~v ~l uJl~d on ~Il bra",,~.u o f , ~ if
or ns£ to a ;.1,ee J"' ~ beCc re l~e ~rlneh llOin t . Th!s does no t .pt'td
up V ... ~r o s r ~, but It r<!<luces the ar:1ount of toee nude'.
(

Live R&~ ~ ~ S~r:~~~ l e . •~c"e t~.e (lr , t a 'Jil r..;,,".t \0 a Hr:~bh do,"",. Or
t he last U~e up : n a ~re&r~ . "'" tr.at th~ live ran ~e of t~ e . ar\'~lo
is y.",l1c~. ihi s : ran~rC"".~tICn :shou ld only t:le done ir the '"O~""C,,:
dOeS not utend SOllIe o t~c r v .. do b le's lhc ranli e. £' :>'!1 pi cs' an
Ini tializing assl g ""cnt of I =cnHar. t, A ,. '5. can t:>c OI"ved do,," i f!.
a pre;; ..... cIon to tM firs: ~u of the "a,. lIbl .. ; In .",,11=''' < sue::
as A :; Ii • C. ~ nlch I,. the 1•• t "se of both Ii ~ C, ca n be .oycd
Ul' clc.e .. e.G the l.st d'(! ni H"r. Of Ii or C. Shnn ki.' i t"", r ang es
(9 \ C) ca:l~enSUe" (or n;>.r.(1ng ~he r.nif of A. All such .Qv "",e~t
.. u:st be to .. point In the pr O&r:; .. ""'l e ll Is necuted no ", or e

fr equently than th e c ril l n. l sUUme nt. Thi s tr .. ":s (o n", t ion pay:s o f f
wil en .. ""'0lrllll has two or lion distinc t poort" udnl distinc t
varl .bles . with .11 .... rllbl as init l a l i z04 It the be& lnnln& of the

.
...
·
~
~ •.. -
entt r e prOlraa . Mevl", th4 laltlll l - . , tlon o f the v. rlab l es ~ . d
only by t h .. se cond p. r t do...,
It pc ~ slble for Ya rhbh~
to the fr()nt o f the ~e<:ond par t .,.,y lIake
rr Ctl t he t wo part~ t o sh.r e storal" . Se.
Storale .I.11 "".t l ol"l bdow.

S t or." (Re gist er) Allocation . Re-map the sto r ale locatio ns of al l variabl es.
bas..:! on fr equency of ,",~e an<! r, oli" of un. SO that fr ,que"tly_used
uriablu ,Tt al l oca t e ': to (1). : U'" r"tes t l e ul of any 1I~"ry h1 ,r.rc~.y.
and (,2) t he .sm aUut Orr~"t3 ... (tMn t hei r respecti ". h ... el. this spud S
up a" c ess to tho n frequent uriables, In creases the l i kel ihood of
,d d r e s~I"~ the:! via s hor~ ,lIdr e" n ll<ls . anll In<:r •• ses the local1 t y

,r of r.ftr . "c" Seen by any =.c~. or !'>II:n; ",""han!s ,". :Ih.~ e t~. 11·'e
r.r. g. , of two v,r l.b les 00 not ov"rlap . '" 'I'
th~ ~,, ~ o the ~ lc c3:!cn.
Thi s p~o="ss i s o ft.n c.l1ed '.,;st . r Al l "ca tl o n, but ," i a~t 2 3 ~~l l be
.ppll..:! to aU l e"ds or s:"r . ;;e. Th i s tr ,nsfo nut j"n Slves st~r a V!
spac e. but e.o~" 1::l1lor t. n t I1 . it ,110..-s lOore ~ar i:o) l e~ ~o be aUoc:;uC
to r .. st locations.

Forced Cepit>. H.. ke ras t _~" ces s c Df'h' o f s"", ,, v ~rhb ! es whi c h ~r. s l o,",
to ac ceU. hample:

FOR I : . 1 to 100 00 R :. 1'1 ;


1'1 :=)! ~ A(Il: t OR I : = 1 to 100 CO
R: = R ~ "' ( l );
1'1 :. R;

IInere .~ Is to be i n , (an ( reglstarl locl t ion. Ind :1 Is In I Z\OW


(., . mor y) loc at !on . This tr lnsior", atiofl ~... ndles the ~rc!1 _ ty;>ical
~ce '-"HIl ltc~ ~rc~l"" aDove. b ut it can te us ed ..he"t.~ r tt:erc ~r~
," ul~,;>h r eferer.cu ~o a slo .. _.e:~ :;s .,arhble. ; or n""7\pl ~. tl>is
t~~ ~ st<lI":::H'Cr. c ar. ," ~~e , c~~y of .1 ;lc~.~ V;;~lst:~ . fllch 1.1 ref-

er .. ,,::ed "" . ny ~! .c. s In I ;ar~ .~ :ul;r ;:roeedure. Th,. :: an savt ~ : .~.t .


a~~ .1:" CC ~e :: ~ ~c e If a a l::: .. l r "f. r e~:e ~ en"rH~S ~cre (cr l.r;td
!r.s t - ~c::sr.s t ~. ~n I lccsl rerat !)c e .

, .- ~ . ~ -.--
\Jnre~d'l~~le Code, R=ov~ any ~a~i<' block .. Meh na ~ no pred~ceHor~, rnb
.. ~y in t urn ma ke other ~I O<: k 5 "" rea c h~ble , This transforCl.tion.1S
orten e ffective ",nen In IF test is ~nc"" t o ~e trlJel{alse at optic!!!
tillie, since one of the br.nencs or the IF Is therefore un;e.e~bl.,

Branch lelle. Chaflge ~ll boolean upr!:nlcns In~ohir'i AIID .nd OR to br ~~~~
10l le , so that I{ the Itrt oper2 nd :C:lpl !tely ~ ele~"lnes the v.l~e or
the upruslon, the rllht oper.nd Is nOt evaluated. Do tills ,en11 Ir
t h e rllht operafld has no sl~ e . efhet .. (suc h n • e=on sU'b.. ~ess lon
definition), Also known n s hort_el r eul t udunlon, This 'pplies
to .11 boolean n pr u,si ou , but POlYS orr ,"ostly vitI'! boolnn
ul><'esslons used n t h . op,.....nd of • eondltion.l S"'p. Subs .... ed in
thts t r.nsron. . tlon Is the idn ttl.t NOT lener,tes no code (only .,
revers,l or target br.neh ,~crress.s), This tr.nsfo~.tlon ccmbln,d
with constant .rH~,"etic will turn IF ( A>8) AND /DFlH.r;.SI, whe;.
DEBUG Is the constaflt 6, Into FALSE,

Test o,hlon, I f ' test is leno .... to have t he value T~U£ o r FALSE·(or
If a sp~lrte c.s. Is kno .... for • C~SE brand'), thtn r ... o~. ttle
~st c~ t irtly, and rt-ecnntct ~h t rio .. gnph approprhttly . In
Icne~al . thl~ trlnstor= a tion eln either crtatt In inner Loop or r~ove

I loop {roo. progrllll. It ean ttlrn ~ 5truc~ured WHItt se.rch loop


.. Ith bco l e.n ~.rllbLe' !n t o . taster d l re=~~~%it-GOtO loop "'l~~ U :
boo h.n var!~blu.

..

You might also like