13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

68Pascal Implementation: Compiler and Asset&/InterpreterAssembler/Interpreter Listing 695/5859store ; array 10..overml ofrecord case datatypa of60 int .(v1 :integer), 12461 reel .(vr :real), 12562 bool :(vb .boolean), 12663 sett :(vs :set of 0..47)1 12764 car 1(c :char); 12865 adr :(va :address); 12966 ("address in store") 13061 mark t(vm :integer) 13160 end; 13269 mp,sp,np,ep : address. (A address registers A) 13370 ("mp points to beginning of a data segment 13471 sp points to top of the stack 13572 ep points to the maximum extent of the stack 136)) np points to top of the dynamically allocated area") 13774 13075 interpreting. boolean; 13976 prd,prr ; text;("prd for read only prr for write only A) 14077 14178 inatr : array(bit61 of alfa; (A mnemonic instruction codes A) 14279 cop I array(bit6) of integer; 14380 sptable I array(0..201 of alfa; ("standard functions and procedures") 14481 14582 ("locally used for interpreting one instruction") 14683 ad,adl : address; 14784 b 1 boolean; 14885 i,j,i1,12 ; integer; 14986 c 1 char) 15087 15188 (" A)15289 15390 procedure load; 15491 co<strong>net</strong> maxlabel 1050; 15592 type labelst (entered,deftned); ("label situation") 15693 labelrg « 0..moxlebel; ("label range") 157-94 lebelrec record15095 val.: address; 15996 at: labelst 16097 end; 16198 var icp,rcp,scp,bcp,mcp : addreae; ("pointers to next free position") 16299 word . array(1..101 of char; 1 integer; ch : char; 1631UU labeltab: arrayllabolrg) of labelrec; 164101 labelvalue: address, 1651U2 166103 procedure lnit; 167104 var i: integer; 168105 begin instr( 011 ■ 'Iod instr( 1 1-'ldo 169106 instr( inatr( 3 1..'sro 170107 instr( instr( 5 t.i'lao171100 instr( 6)1.e i sto instr( 7 t.'ldc1172;109 instr( 8)1.'... instr( 9 :m i ind173110 instr(1011m'inc instr(11 174instr(12)t.'cup instr(13 ...ant 175112 instr(14)1-'rat i<strong>net</strong>r115 :-'cep 176113 instr(16)1- l ixe i<strong>net</strong>r(17 177114 instr(1811..'nee instr(19 1.. 1 gaq 178115 instr(20): ■ 'grt instr121 1-'1eq 179116 instr(2211•'les instr123 t•'u.i1) 180Ill instr(24)1-'f)p instr(25 i. e xjp 181•118 i<strong>net</strong>r(26)swichk instr(27 102119 instr(2811 ■ 'sdi instrI29 ps'adr 183120 instr(30): ■ 'sbl i<strong>net</strong>rI31 s-'sbr 184121122123instr(321:-'sgsinstr(33);"'fltinstr(341:..'floinstr(35)s.'trcinstr(36):-'n8ii<strong>net</strong>r(37)10'ngrinstr(3011- • eqi i<strong>net</strong>r(39):-.'sqri<strong>net</strong>r14011A'abiinstr(41):.'abri<strong>net</strong>r(42):-'notinstr(431t.'andinstr14411.. s ior instr(45):-'difinstr(46)P.'inti<strong>net</strong>r(47)r-'uniinstr(48): ■ i inn instr14911 ■ 'modinstr(50)1-'oddinstr(51);.'mplinstr(5211..'mprinstr(53):s'dviinstr(54)1m'dvrinatr1551: ■ 'movInstr(56):-.'lca ; instr(57):...decinstr(501:-'etpinstr(59):..'ordinstr(60):-'chrinstr(61):-'ujcsptable( 0eptable( 2sptable( 4sptable( 6eptable( 8eptable(10aptable(12sptable114eptablo116eptable(18eptable120:-'retts i wrieptable( 1eptable( 3sptable( 5eptable( 7eptable( 9eptable(111- i rdr eptable(13aptablo(15'; aptable(17eptable(19cop( 0) 105; cop( 11 ;- 65;cop( 2) 70; cop( 3) 1- 75;cop( 61 ;is 60; cop( 9) 1.. 85;cop(10) 1- 90; cop(26)cop(571 100;95;pc begincodelicp ta umiak + 1;rcp 1. overt + 11acp overr + 1;bcp overa + 2;mep overb + 1;for 11. 1 to 10 do word(i):-. 'for 0 to maxlabel dowith labeltabli1 do begin vall-r-1;roset(prd);end,("init"):A'put:-'rin:A'wln;.'wrr; ■ 'rdi: - 'rdc:.'logprocedure errorl(stringt beta), ("error in loading")begin writoln;write(atring),haltend; ("errorl")entered end;proceduri update(xt labelrg); (*when • label definition lx is found")var curr,succs -1..pcmax; ("rasp. current element and successor elementof • list of future references")endlisti boolean;beginif labeltab(x).st.definod then errorl.(' duplicated labelelse beginif labeltab(x).val0-1 then ("forword'roference(s)")begin cum.. labeltablx).vall endlists. false;while not endlist dowith cods(curr cli,v 2) dobegin

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!