| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- program t80_realconst;
- { t80 -- a REAL record field assigned from integer constants.
- CALC.INC:163 is `Value := 0'; Value is a 6-byte Real. TP3's layout is
- measured in CALC-PORT.md against the cells holding 1, 2, 3, 4, 5:
- value = (1 + N/2^39) * 2^(E-129)
- byte 0 = E biased by 129, bytes 1..5 = N little-endian, sign in bit 7 of
- byte 5, all-zero = 0.0.
- Only compile-time ordinal constants and 6-byte copies are accepted; real
- arithmetic/formatting is a later stage and is refused loudly. The .out
- checks the fields A and B on either side of V (the store is six bytes, not
- more), and tests/check_realconst.py asserts the six bytes themselves
- against the measured table. }
- type
- Cell = record
- V : real;
- A, B : integer;
- end;
- var
- g : array [1..2, 1..3] of Cell;
- i, j : integer;
- begin
- with g[2,3] do
- begin
- V := 0;
- A := 11;
- B := 12
- end;
- with g[2,3] do
- V := 1;
- i := 2;
- j := 3;
- with g[i,j] do
- V := 1; (* the DI form: C6 45 <off> <byte> *)
- with g[2,3] do
- V := 2;
- with g[2,3] do
- V := 3;
- with g[2,3] do
- V := 5;
- with g[1,1] do
- V := 3;
- with g[i,j] do
- V := g[1,1].V; (* 6-byte copy, destination through DI *)
- with g[2,3] do
- A := A + B;
- writeln (g[2,3].A);
- writeln (g[1,1].A)
- end.
|