Simplify code for writing out extended constants.
This removes the need for the CnvSX function, so it is removed.
This commit is contained in:
parent
ba57d51500
commit
0b3f48157e
39
CGC.asm
39
CGC.asm
|
@ -1,42 +1,6 @@
|
||||||
mcopy cgc.macros
|
mcopy cgc.macros
|
||||||
****************************************************************
|
****************************************************************
|
||||||
*
|
*
|
||||||
* CnvSX - Convert floating point to SANE extended
|
|
||||||
*
|
|
||||||
* Inputs:
|
|
||||||
* rec - pointer to a record
|
|
||||||
*
|
|
||||||
****************************************************************
|
|
||||||
*
|
|
||||||
CnvSX start cg
|
|
||||||
rec equ 8 record containing values
|
|
||||||
extptr equ 1 pointer to rec_ext field of rec
|
|
||||||
rec_real equ 0 disp to real (extended) value
|
|
||||||
rec_ext equ 10 disp to extended (SANE) value
|
|
||||||
|
|
||||||
pha set up DP
|
|
||||||
pha
|
|
||||||
tsc
|
|
||||||
phd
|
|
||||||
tcd
|
|
||||||
add4 rec,#rec_ext,extptr copy the number
|
|
||||||
ldy #8
|
|
||||||
lp lda [rec],y
|
|
||||||
sta [extptr],y
|
|
||||||
dey
|
|
||||||
dey
|
|
||||||
bpl lp
|
|
||||||
move4 4,8 return
|
|
||||||
pld
|
|
||||||
pla
|
|
||||||
pla
|
|
||||||
pla
|
|
||||||
pla
|
|
||||||
rtl
|
|
||||||
end
|
|
||||||
|
|
||||||
****************************************************************
|
|
||||||
*
|
|
||||||
* CnvSC - Convert floating point to SANE comp
|
* CnvSC - Convert floating point to SANE comp
|
||||||
*
|
*
|
||||||
* Inputs:
|
* Inputs:
|
||||||
|
@ -50,8 +14,7 @@ lp lda [rec],y
|
||||||
CnvSC start cg
|
CnvSC start cg
|
||||||
rec equ 4 record containing values
|
rec equ 4 record containing values
|
||||||
rec_real equ 0 disp to real (extended) value
|
rec_real equ 0 disp to real (extended) value
|
||||||
rec_ext equ 10 disp to extended (SANE) value
|
rec_cmp equ 10 disp to comp (SANE) value
|
||||||
rec_cmp equ 20 disp to comp (SANE) value
|
|
||||||
|
|
||||||
tsc set up DP
|
tsc set up DP
|
||||||
phd
|
phd
|
||||||
|
|
12
CGC.pas
12
CGC.pas
|
@ -31,9 +31,8 @@ uses CCommon, CGI;
|
||||||
type
|
type
|
||||||
{pcode code generation}
|
{pcode code generation}
|
||||||
{---------------------}
|
{---------------------}
|
||||||
realrec = record {used to convert from real to in-SANE}
|
realrec = record {used to convert from real to comp}
|
||||||
itsReal: extended;
|
itsReal: extended;
|
||||||
inSANE: packed array[1..10] of byte;
|
|
||||||
inCOMP: packed array[1..8] of byte;
|
inCOMP: packed array[1..8] of byte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -58,15 +57,6 @@ procedure CnvSC (rec: realrec); extern;
|
||||||
{ has space for the result }
|
{ has space for the result }
|
||||||
|
|
||||||
|
|
||||||
procedure CnvSX (rec: realrec); extern;
|
|
||||||
|
|
||||||
{ convert a real number to SANE extended format }
|
|
||||||
{ }
|
|
||||||
{ parameters: }
|
|
||||||
{ rec - record containing the value to convert; also }
|
|
||||||
{ has space for the result }
|
|
||||||
|
|
||||||
|
|
||||||
procedure CnvXLL (var result: longlong; val: extended); extern;
|
procedure CnvXLL (var result: longlong; val: extended); extern;
|
||||||
|
|
||||||
{ convert a real number to long long }
|
{ convert a real number to long long }
|
||||||
|
|
15
Native.pas
15
Native.pas
|
@ -357,7 +357,7 @@ procedure WriteNative (opcode: integer; mode: addressingMode; operand: integer;
|
||||||
label 1;
|
label 1;
|
||||||
|
|
||||||
type
|
type
|
||||||
rkind = (k1,k2,k3,k4); {cnv record types}
|
rkind = (k1,k2,k3,k4,k5); {cnv record types}
|
||||||
|
|
||||||
var
|
var
|
||||||
bp: ^byte; {byte pointer}
|
bp: ^byte; {byte pointer}
|
||||||
|
@ -368,7 +368,8 @@ var
|
||||||
k1: (rval: real;);
|
k1: (rval: real;);
|
||||||
k2: (dval: double;);
|
k2: (dval: double;);
|
||||||
k3: (qval: longlong);
|
k3: (qval: longlong);
|
||||||
k4: (ival1,ival2,ival3,ival4: integer;);
|
k4: (eval: extended);
|
||||||
|
k5: (ival1,ival2,ival3,ival4,ival5: integer;);
|
||||||
end;
|
end;
|
||||||
count: integer; {number of constants to repeat}
|
count: integer; {number of constants to repeat}
|
||||||
i,j,k: integer; {loop variables}
|
i,j,k: integer; {loop variables}
|
||||||
|
@ -666,10 +667,12 @@ case mode of
|
||||||
CnOut(cns.inCOMP[j]);
|
CnOut(cns.inCOMP[j]);
|
||||||
end;
|
end;
|
||||||
cgExtended : begin
|
cgExtended : begin
|
||||||
cns.itsReal := icptr(name)^.rval;
|
cnv.eval := icptr(name)^.rval;
|
||||||
CnvSX(cns);
|
CnOut2(cnv.ival1);
|
||||||
for j := 1 to 10 do
|
CnOut2(cnv.ival2);
|
||||||
CnOut(cns.inSANE[j]);
|
CnOut2(cnv.ival3);
|
||||||
|
CnOut2(cnv.ival4);
|
||||||
|
CnOut2(cnv.ival5);
|
||||||
end;
|
end;
|
||||||
cgString : begin
|
cgString : begin
|
||||||
if not icptr(name)^.isByteSeq then begin
|
if not icptr(name)^.isByteSeq then begin
|
||||||
|
|
|
@ -310,7 +310,6 @@ type
|
||||||
{From CGC.pas}
|
{From CGC.pas}
|
||||||
realrec = record {used to convert from real to in-SANE}
|
realrec = record {used to convert from real to in-SANE}
|
||||||
itsReal: extended;
|
itsReal: extended;
|
||||||
inSANE: packed array[1..10] of byte;
|
|
||||||
inCOMP: packed array[1..8] of byte;
|
inCOMP: packed array[1..8] of byte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue