dispatch tables generated now, layout improvements

This commit is contained in:
ceriel 1987-03-31 07:54:43 +00:00
parent 8e4718c760
commit ceb3fb4ed3
5 changed files with 36 additions and 84 deletions

View file

@ -130,7 +130,7 @@ negative 16-bit argument
negative 16-bit argument divided by the wordsize negative 16-bit argument divided by the wordsize
.PT .s<num> .PT .s<num>
shortie with <num> as high order argument byte shortie with <num> as high order argument byte
.PT .sw<num> .PT .w<num>
shortie with argument divided by the wordsize shortie with argument divided by the wordsize
.PT .<num> .PT .<num>
mini with <num> as argument mini with <num> as argument
@ -141,68 +141,13 @@ mini with <num>*wordsize as argument
.VS 1 1 .VS 1 1
.IE .IE
The dispatch table for the 256 primary opcodes: The dispatch table for the 256 primary opcodes:
.DS B .N 1
.ta 7n 16n 25n 34n 43n 52n 61n 70n .so dispat1
0 loc.0 loc.1 loc.2 loc.3 loc.4 loc.5 loc.6 loc.7 .N 2
8 loc.8 loc.9 loc.10 loc.11 loc.12 loc.13 loc.14 loc.15
16 loc.16 loc.17 loc.18 loc.19 loc.20 loc.21 loc.22 loc.23
24 loc.24 loc.25 loc.26 loc.27 loc.28 loc.29 loc.30 loc.31
32 loc.32 loc.33 aar.1W adf.s0 adi.1W adi.2W adp.l adp.1
40 adp.2 adp.s0 adp.s\-1 ads.1W and.1W asp.1W asp.2W asp.3W
48 asp.4W asp.5W asp.w0 beq.l beq.s0 bge.s0 bgt.s0 ble.s0
56 blm.s0 blt.s0 bne.s0 bra.l bra.s\-1 bra.s\-2 bra.s0 bra.s1
64 cal.1 cal.2 cal.3 cal.4 cal.5 cal.6 cal.7 cal.8
72 cal.9 cal.10 cal.11 cal.12 cal.13 cal.14 cal.15 cal.16
80 cal.17 cal.18 cal.19 cal.20 cal.21 cal.22 cal.23 cal.24
88 cal.25 cal.26 cal.27 cal.28 cal.s0 cff.z cif.z cii.z
96 cmf.s0 cmi.1W cmi.2W cmp.z cms.s0 csa.1W csb.1W dec.z
104 dee.w0 del.w\-1 dup.1W dvf.s0 dvi.1W fil.l inc.z ine.lw
112 ine.w0 inl.\-1W inl.\-2W inl.\-3W inl.w\-1 inn.s0 ior.1W ior.s0
120 lae.l lae.w0 lae.w1 lae.w2 lae.w3 lae.w4 lae.w5 lae.w6
128 lal.p lal.n lal.0 lal.\-1 lal.w0 lal.w\-1 lal.w\-2 lar.W
136 ldc.0 lde.lw lde.w0 ldl.0 ldl.w\-1 lfr.1W lfr.2W lfr.s0
144 lil.w\-1 lil.w0 lil.0 lil.1W lin.l lin.s0 lni.z loc.l
152 loc.\-1 loc.s0 loc.s\-1 loe.lw loe.w0 loe.w1 loe.w2 loe.w3
160 loe.w4 lof.l lof.1W lof.2W lof.3W lof.4W lof.s0 loi.l
168 loi.1 loi.1W loi.2W loi.3W loi.4W loi.s0 lol.pw lol.nw
176 lol.0 lol.1W lol.2W lol.3W lol.\-1W lol.\-2W lol.\-3W lol.\-4W
184 lol.\-5W lol.\-6W lol.\-7W lol.\-8W lol.w0 lol.w\-1 lxa.1 lxl.1
192 lxl.2 mlf.s0 mli.1W mli.2W rck.1W ret.0 ret.1W ret.s0
200 rmi.1W sar.1W sbf.s0 sbi.1W sbi.2W sdl.w\-1 set.s0 sil.w\-1
208 sil.w0 sli.1W ste.lw ste.w0 ste.w1 ste.w2 stf.l stf.W
216 stf.2W stf.s0 sti.1 sti.1W sti.2W sti.3W sti.4W sti.s0
224 stl.pw stl.nw stl.0 stl.1W stl.\-1W stl.\-2W stl.\-3W stl.\-4W
232 stl.\-5W stl.w\-1 teq.z tgt.z tlt.z tne.z zeq.l zeq.s0
240 zeq.s1 zer.s0 zge.s0 zgt.s0 zle.s0 zlt.s0 zne.s0 zne.s\-1
248 zre.lw zre.w0 zrl.\-1W zrl.\-2W zrl.w\-1 zrl.nw escape1 escape2
.DE 2
The list of secondary opcodes (escape1): The list of secondary opcodes (escape1):
.N 1 .N 1
.DS B .so dispat2
.ta 7n 16n 25n 34n 43n 52n 61n 70n .N 2
0 aar.l aar.z adf.l adf.z adi.l adi.z ads.l ads.z
8 adu.l adu.z and.l and.z asp.lw ass.l ass.z bge.l
16 bgt.l ble.l blm.l bls.l bls.z blt.l bne.l cai.z
24 cal.l cfi.z cfu.z ciu.z cmf.l cmf.z cmi.l cmi.z
32 cms.l cms.z cmu.l cmu.z com.l com.z csa.l csa.z
40 csb.l csb.z cuf.z cui.z cuu.z dee.lw del.pw del.nw
48 dup.l dus.l dus.z dvf.l dvf.z dvi.l dvi.z dvu.l
56 dvu.z fef.l fef.z fif.l fif.z inl.pw inl.nw inn.l
64 inn.z ior.l ior.z lar.l lar.z ldc.l ldf.l ldl.pw
72 ldl.nw lfr.l lil.pw lil.nw lim.z los.l los.z lor.s0
80 lpi.l lxa.l lxl.l mlf.l mlf.z mli.l mli.z mlu.l
88 mlu.z mon.z ngf.l ngf.z ngi.l ngi.z nop.z rck.l
96 rck.z ret.l rmi.l rmi.z rmu.l rmu.z rol.l rol.z
104 ror.l ror.z rtt.z sar.l sar.z sbf.l sbf.z sbi.l
112 sbi.z sbs.l sbs.z sbu.l sbu.z sde.l sdf.l sdl.pw
120 sdl.nw set.l set.z sig.z sil.pw sil.nw sim.z sli.l
128 sli.z slu.l slu.z sri.l sri.z sru.l sru.z sti.l
136 sts.l sts.z str.s0 tge.z tle.z trp.z xor.l xor.z
144 zer.l zer.z zge.l zgt.l zle.l zlt.l zne.l zrf.l
152 zrf.z zrl.pw dch.z exg.s0 exg.l exg.z lpb.z gto.l
.DE 2
Finally, the list of opcodes with four byte arguments (escape2). Finally, the list of opcodes with four byte arguments (escape2).
.DS .N 1
.ta 7n 16n 25n 34n 43n 52n 61n 70n .so dispat3
0 loc
.DE 0

View file

@ -1,7 +1,9 @@
.BP .BP
.AP "AN EXAMPLE PROGRAM" .AP "AN EXAMPLE PROGRAM"
.DS B .A 1 0
.NA
.ta 4n 8n 12n 16n 20n .ta 4n 8n 12n 16n 20n
.nf
1 program example(output); 1 program example(output);
2 {This program just demonstrates typical EM code.} 2 {This program just demonstrates typical EM code.}
3 type rec = record r1: integer; r2:real; r3: boolean end; 3 type rec = record r1: integer; r2:real; r3: boolean end;
@ -42,14 +44,17 @@
38 mi := 99; 38 mi := 99;
39 test(r) 39 test(r)
40 end. 40 end.
.DE 0 .fi
.AD
.BP .BP
The EM code as produced by the Pascal-VU compiler is given below. Comments The EM code as produced by the Pascal-VU compiler is given below. Comments
have been added manually. Note that this code has already been optimized. have been added manually. Note that this code has already been optimized.
.DS B .A 1 0
.NA
.nf
.ta 1n 24n .ta 1n 24n
mes 2,2,2 ; wordsize 2, pointersize 2 mes 2,2,2 ; wordsize 2, pointersize 2
.1 \&.1
rom 't.p\e000' ; the name of the source file rom 't.p\e000' ; the name of the source file
hol 552,\-32768,0 ; externals and buf occupy 552 bytes hol 552,\-32768,0 ; externals and buf occupy 552 bytes
exp $sum ; sum can be called from other modules exp $sum ; sum can be called from other modules
@ -59,13 +64,13 @@ have been added manually. Note that this code has already been optimized.
adi 2 ; add them adi 2 ; add them
ret 2 ; return the result ret 2 ; return the result
end 2 ; end of procedure ( still two bytes local storage ) end 2 ; end of procedure ( still two bytes local storage )
.2 \&.2
rom 1,99,2 ; descriptor of array a[] rom 1,99,2 ; descriptor of array a[]
exp $test ; the compiler exports all level 0 procedures exp $test ; the compiler exports all level 0 procedures
pro $test,226 ; procedure test, 226 bytes local storage pro $test,226 ; procedure test, 226 bytes local storage
.3 \&.3
rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in
.4 ; global storage \&.4 ; global storage
rom 0.5F8 ; same for 0.5 rom 0.5F8 ; same for 0.5
mes 3,\-226,2,2 ; compiler temporary not referenced by address mes 3,\-226,2,2 ; compiler temporary not referenced by address
mes 3,\-24,2,0 ; the same is true for i, j, b and c in test mes 3,\-24,2,0 ; the same is true for i, j, b and c in test
@ -106,7 +111,7 @@ have been added manually. Note that this code has already been optimized.
lni ; lin 26 prior to optimization lni ; lin 26 prior to optimization
loc 1 loc 1
stl \-2 ; for i:= 1 stl \-2 ; for i:= 1
2 2
lol \-2 lol \-2
dup 2 dup 2
mli 2 ; i*i mli 2 ; i*i
@ -119,7 +124,7 @@ have been added manually. Note that this code has already been optimized.
beq *3 ; to 100 do beq *3 ; to 100 do
inl \-2 ; increment i and loop inl \-2 ; increment i and loop
bra *2 bra *2
3 3
lin 27 lin 27
lol \-4 lol \-4
loc 27 loc 27
@ -146,7 +151,7 @@ have been added manually. Note that this code has already been optimized.
asp 4 ; remove parameters from stack asp 4 ; remove parameters from stack
lfr 2 ; get function result lfr 2 ; get function result
stl \-2 ; i := stl \-2 ; i :=
4 4
lin 31 lin 31
lol \-2 lol \-2
zle *5 ; while i > 0 do zle *5 ; while i > 0 do
@ -156,7 +161,7 @@ have been added manually. Note that this code has already been optimized.
stl \-4 ; j := j + r.r1 stl \-4 ; j := j + r.r1
del \-2 ; i := i - 1 del \-2 ; i := i - 1
bra *4 ; loop bra *4 ; loop
5 5
lin 32 lin 32
lol 0 lol 0
stl \-226 ; make copy of address of r stl \-226 ; make copy of address of r
@ -199,9 +204,9 @@ have been added manually. Note that this code has already been optimized.
end 226 end 226
exp $_main exp $_main
pro $_main,0 ; main program pro $_main,0 ; main program
.6 \&.6
con 2,\-1,22 ; description of external files con 2,\-1,22 ; description of external files
.5 \&.5
rom 15.96F8 rom 15.96F8
fil .1 ; maintain source file name fil .1 ; maintain source file name
lae .6 ; description of external files lae .6 ; description of external files
@ -225,7 +230,9 @@ have been added manually. Note that this code has already been optimized.
asp 2 asp 2
end 0 end 0
mes 5 ; reals were used mes 5 ; reals were used
.DE 0 .fi
.AD
.A 1 0
The compact code corresponding to the above program is listed below. The compact code corresponding to the above program is listed below.
Read it horizontally, line by line, not column by column. Read it horizontally, line by line, not column by column.
Each number represents a byte of compact code, printed in decimal. Each number represents a byte of compact code, printed in decimal.

View file

@ -343,7 +343,7 @@ procedure frames need not be contiguous.
| parameter 0 | <\- SP | parameter 0 | <\- SP
|===============================| |===============================|
.Df .Df
Figure 1. A sample procedure frame and parameters. Figure 1. A sample procedure frame and parameters.
.De .De
.S2 "Heap data area" .S2 "Heap data area"
The heap area starts empty, with HP The heap area starts empty, with HP

View file

@ -1,3 +1,4 @@
{ This is an interpreter for EM. It serves as the official machine { This is an interpreter for EM. It serves as the official machine
definition. This interpreter must run on a machine which supports definition. This interpreter must run on a machine which supports
arithmetic with words and memory offsets. arithmetic with words and memory offsets.
@ -30,7 +31,7 @@
to object size in bits - 1. The effect of a count not in this to object size in bits - 1. The effect of a count not in this
range is undefined. range is undefined.
} }
.BP .bp
{$i256} {$d+} {$i256} {$d+}
program em(tables,prog,input,output); program em(tables,prog,input,output);

View file

@ -81,7 +81,6 @@ toward structured programs consisting of many small
procedures greatly reduces the value of registers to hold local variables procedures greatly reduces the value of registers to hold local variables
because the large number of procedure calls implies a large overhead in because the large number of procedure calls implies a large overhead in
saving and restoring the registers at every call. saving and restoring the registers at every call.
.BP
.P .P
Although there are no general purpose registers, there are a Although there are no general purpose registers, there are a
few internal registers with specific functions as follows: few internal registers with specific functions as follows:
@ -89,10 +88,10 @@ few internal registers with specific functions as follows:
.N 1 .N 1
.TS .TS
tab(:); tab(:);
l 1 l l. l 1 l l l.
PC:\-:Program Counter:Pointer to next instruction PC:\-:Program Counter:Pointer to next instruction
LB:\-:Local Base:Points to base of the local variables \ LB:\-:Local Base:Points to base of the local variables
in the current procedure. :::in the current procedure.
SP:\-:Stack Pointer:Points to the highest occupied word on the stack. SP:\-:Stack Pointer:Points to the highest occupied word on the stack.
HP:\-:Heap Pointer:Points to the top of the heap area. HP:\-:Heap Pointer:Points to the top of the heap area.
.TE 1 .TE 1