Discussion:
FPC - trying again :(
(too old to reply)
Robert AH Prins
2012-01-09 15:50:53 UTC
Permalink
Although I'm quite happy using Virtual Pascal, I've decided to give FPC
(on W32) another try and, again, I'm not a very happy bunny.

I've got a program that compiles and runs cleanly in VP, yet it fails
miserably in VP, and the unpleasant thing is that running it in the IDE
gives me a

"Run Time Error 4297603" with an
"Error address $00000000"

on a "reset(liftin)" statement.

Running the program, which compiles with just two warnings about
uninitialized variables, from the command-line, will not show up this
error, but it now abends with a 216 in the next routine,

_hash_tr:= maxint;
list_ptr:= list_top;

repeat
if list_ptr^.cday[3] = '#' then <--- 216
_hash_tr:= pred(list_ptr^.tr);

list_ptr:= list_ptr^.list_nxt;
until (_hash_tr <> maxint) or
(list_ptr = nil);

which would indicate that the list that is supposed to be build in the
earlier routine that reads the file is not built, but given that I
cannot even get to this step in the IDE, that's pretty hard to confirm,
although pretty obvious.

Any hints as how to proceed?

Robert

PS: The code generated for some (if not most) routines is just as
horribly bad as the code generated by BP and VP - don't take this too
personally, IBM's commercial PL/I compiler for Windows generates code
that's just as horrible, if not even worse (and this despite the fact
that an IBM'er told me two years ago that IBM was well ahead of the FOSS
pack when it came to compiler optimizations...)

PS2: The VP executable, with full debugging info comes to 110K, the FPC
version is a few bits more bloated at 299K...
--
Robert AH Prins
robert(a)prino(d)org
Bart
2012-01-09 16:54:43 UTC
Permalink
Op Mon, 09 Jan 2012 15:50:53 +0000 schreef Robert AH Prins
Post by Robert AH Prins
repeat
if list_ptr^.cday[3] = '#' then <--- 216
_hash_tr:= pred(list_ptr^.tr);
list_ptr:= list_ptr^.list_nxt;
until (_hash_tr <> maxint) or
(list_ptr = nil);
RTE 216 = GPF I think?
if list_ptr = nil on entry the code will crash

if (list_ptr <> nil) and (list_ptr^.cday[3] = '#') then
_hash_tr:= pred(list_ptr^.tr)
else writeln('lsit_ptr = nil'); //debug

See what that comes up with?

Bart
--
Bart Broersma
***@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Robert AH Prins
2012-01-09 19:42:46 UTC
Permalink
Post by Bart
Op Mon, 09 Jan 2012 15:50:53 +0000 schreef Robert AH Prins
Post by Robert AH Prins
repeat
if list_ptr^.cday[3] = '#' then<--- 216
_hash_tr:= pred(list_ptr^.tr);
list_ptr:= list_ptr^.list_nxt;
until (_hash_tr<> maxint) or
(list_ptr = nil);
RTE 216 = GPF I think?
if list_ptr = nil on entry the code will crash
if (list_ptr<> nil) and (list_ptr^.cday[3] = '#') then
_hash_tr:= pred(list_ptr^.tr)
else writeln('lsit_ptr = nil'); //debug
See what that comes up with?
To be quite honest, I don't see the point in adding extra code to detect
something that cannot occur unless there is a failure earlier in the
program. What I really need is a clue as to why the "reset(liftin)"
fails when I'm running the program inside the IDE.

FWIW, full source can be found in "lift32bit.rar" in the Files section
of the hitching group on Yahoo!
<http://groups.yahoo.com/group/hitching/files/Robert%27s%20programs/>
The sources contain two parts, pure Pascal and assemblerized Pascal
{$ifdef asm} Input data is in liftdat.rar at the same location. In the
FPC version I had to comment out the code in the "write_time" procedure,
need to look at the differences in parameters between VP and FPC, VP
uses longint's in GetTime, FPC doesn't like them.

Other than the fact that the programs are meant to process hitchhike
data, they might serve as a prime example as to what can be done using
VP's built-in assembler, the assemblerized version of "lift" is around
15k smaller than the Pascal version, which tells you something about the
quality of the VP generated code, which is really, really bad. (And the
FPC generated code is, as I already mentioned, not a lot better...)

Robert
--
Robert AH Prins
robert(a)prino(d)org
Marco van de Voort
2012-01-09 21:04:49 UTC
Permalink
Post by Robert AH Prins
FWIW, full source can be found in "lift32bit.rar" in the Files section
of the hitching group on Yahoo!
<http://groups.yahoo.com/group/hitching/files/Robert%27s%20programs/>
That is unaccessable unless you subscribe. Can't you put it up somewhere
else?
Robert AH Prins
2012-01-10 00:51:11 UTC
Permalink
Post by Marco van de Voort
Post by Robert AH Prins
FWIW, full source can be found in "lift32bit.rar" in the Files section
of the hitching group on Yahoo!
<http://groups.yahoo.com/group/hitching/files/Robert%27s%20programs/>
That is unaccessable unless you subscribe. Can't you put it up somewhere
else?
https://rapidshare.com/files/4179083034/lift-fpc.rar

Executables are renamed to .ex, other assumptions, to enable the use of
the supplied VP .VPO files:

VP installed in c:\vp21
Sources installed in c:\01-lift\vp\dev

write_time (in all_supp.pas) needs to have its code commented out, or
the type of variable for ihh/imm/iss/ims needs to be changed, it doesn't
compile with longint's and I could not be bothered to find out what
these need to be.

Default input for the program is 'lift.dat', output files are
summ/lift/trip/days.h-h (and contain DOS CP 473 high-ASCII box characters)

Robert
--
Robert AH Prins
robert(a)prino(d)org
Adrian Devries
2012-01-10 07:58:14 UTC
Permalink
Before I try to compile your sources with fpc, I try to compile it with
vpc. With the following batch

@echo off
:Main
setlocal
set DevDir=c:\01-lift\vp\dev
set VPC=c:\vp21\bin.w32\vpc -M -V%DevDir%
set Progs=chkdat dat2csv dat2txt dayform get-aud h-h2rtf lift \
newlift h-h2wiki
set LogFile=%~dpn0.log
type nul >"%LogFile%"
pushd "%~dp0"
if not exist "%DevDir%" (md "%DevDir%")
copy /y ..\source\*.* "%DevDir%\" 1>nul
copy /y ..\vpo\*.* "%DevDir%\" 1>nul
pushd "%DevDir%"
touch *.pas *.vpo
for %%a in ( %Progs% ) do (
if "%%~a"=="get-aud" (sed -i -r -e "s_d:_c:_g" "%%~a.vpo" & \ del /f /q
sed*.)
%VPC%\%%~a.vpo | tee -a "%LogFile%"
)
popd
popd
endlocal
pause
goto :EOF
:EOF

I get following results:

Virtual Pascal Version 2.1.279 Copyright (C) 2000-2004 vpascal.com
Built in London, UK on 9 May 2004 by ***@vpascal.com

c:\01-lift\vp\dev\chkdat.pas(1)
c:\01-lift\vp\dev\chkdat.pas(27): Error 15: File 'hhcommon.vpi' is not found
hhcommon;
..........^

(...)

The file get-aud.vpo contains incorrect path settings; the batch
corrects it on the fly. But the main problem is the missing hhcommon stuff.

Best regards,
Adrian
Robert AH Prins
2012-01-10 10:04:47 UTC
Permalink
Post by Adrian Devries
Before I try to compile your sources with fpc, I try to compile it with
vpc. With the following batch
@echo off
:Main
setlocal
set DevDir=c:\01-lift\vp\dev
set VPC=c:\vp21\bin.w32\vpc -M -V%DevDir%
set Progs=chkdat dat2csv dat2txt dayform get-aud h-h2rtf lift \
newlift h-h2wiki
set LogFile=%~dpn0.log
type nul>"%LogFile%"
pushd "%~dp0"
if not exist "%DevDir%" (md "%DevDir%")
copy /y ..\source\*.* "%DevDir%\" 1>nul
copy /y ..\vpo\*.* "%DevDir%\" 1>nul
pushd "%DevDir%"
touch *.pas *.vpo
for %%a in ( %Progs% ) do (
if "%%~a"=="get-aud" (sed -i -r -e "s_d:_c:_g" "%%~a.vpo"& \ del /f /q
sed*.)
%VPC%\%%~a.vpo | tee -a "%LogFile%"
)
popd
popd
endlocal
pause
goto :EOF
:EOF
Virtual Pascal Version 2.1.279 Copyright (C) 2000-2004 vpascal.com
c:\01-lift\vp\dev\chkdat.pas(1)
c:\01-lift\vp\dev\chkdat.pas(27): Error 15: File 'hhcommon.vpi' is not found
hhcommon;
..........^
(...)
The file get-aud.vpo contains incorrect path settings; the batch
corrects it on the fly. But the main problem is the missing hhcommon stuff.
hhcommon.pas should compile to hhcommon.vpi/hhcommon.lib, a "Make" (F9)
in the IDE should create the critter, in my case in "C:\vp21\out.w32\units"

FWIW, my VP install is the one that is created by the VP installer, i.e.
in c:\vp21, with only the CHM (from Ning) documentation added to the
vp21\doc library.

Robert
--
Robert AH Prins
robert(a)prino(d)org
Robert AH Prins
2012-01-10 10:42:53 UTC
Permalink
Post by Adrian Devries
Before I try to compile your sources with fpc, I try to compile it with
vpc. With the following batch
(...)
The file get-aud.vpo contains incorrect path settings; the batch
corrects it on the fly. But the main problem is the missing hhcommon stuff.
get-aud.vpo wasn't changed when I took it from a backup after my desktop
died, I normally use the oxxxxx.vpo files to generate "optimized" (ha,
ha, ha...) code. FWIW, I use the following batch file (in the same
directory as the Pascal sources)

=== CUT ===
del c:\vp21\out.w32\units\hhcommon.lib
del c:\vp21\out.w32\units\hhcommon.vpi

rem Following two lines wrapped by Thunderbird...
del chkdat.exe dat2csv.exe dat2txt.exe dayform.exe get-aud.exe
h-h2rtf.exe lift.exe newlift.exe h-h2wiki.exe
del chkdat.map dat2csv.map dat2txt.map dayform.map get-aud.map
h-h2rtf.map lift.map newlift.map h-h2wiki.map

set vpc=c:\vp21\bin.w32\vpc -M -Vc:\01-lift\vp\dev\

%vpc%ochkdat.vpo
%vpc%odat2csv.vpo
%vpc%odat2txt.vpo
%vpc%odayform.vpo
%vpc%oget-aud.vpo
%vpc%oh-h2rtf.vpo
%vpc%olift.vpo
%vpc%onewlift.vpo
%vpc%oh-h2wiki.vpo

set vpc=
=== CUT ===

and that works without problems.

Robert
--
Robert AH Prins
robert(a)prino(d)org
Marco van de Voort
2012-01-10 10:56:51 UTC
Permalink
Post by Robert AH Prins
Post by Marco van de Voort
That is unaccessable unless you subscribe. Can't you put it up somewhere
else?
https://rapidshare.com/files/4179083034/lift-fpc.rar
Executables are renamed to .ex, other assumptions, to enable the use of
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling lift.pas
Fatal: Can't find unit hhcommon used by lift
Fatal: Compilation aborted
Error: d:\FPC\2.6.0\bin\i386-Win32\ppc386.exe returned an error exitcode
(normal if you did not specify a source file to be compiled
)
Robert AH Prins
2012-01-10 23:48:36 UTC
Permalink
Post by Marco van de Voort
Post by Robert AH Prins
Post by Marco van de Voort
That is unaccessable unless you subscribe. Can't you put it up somewhere
else?
https://rapidshare.com/files/4179083034/lift-fpc.rar
Executables are renamed to .ex, other assumptions, to enable the use of
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling lift.pas
Fatal: Can't find unit hhcommon used by lift
Fatal: Compilation aborted
Error: d:\FPC\2.6.0\bin\i386-Win32\ppc386.exe returned an error exitcode
(normal if you did not specify a source file to be compiled
)
OK, gave it another try:

1) Installation of FPC: accept all suggestions and just install it in
full in the suggested directory, i.e. c:\fpc\2.6.0\etc

Note: the installer updates the PATH, without asking, coming from a z/OS
background, I am vehemently opposed to this kind of behaviour!

2) My files in c:\lift

3) Start fp.exe via the Windows Explorer.

4) Set up environment:

- primary file c:\lift\lift.pas
- assembler style: Intel (but no conditional define of "asm")
- mode debug
- backtrace line info for debugging
- rest all defaults

Note: It would be very nice to have an option that would write the
entire environment into a simple text file for inclusion in postings, I
haven't been able to figure out where Compiler options are stored, I
expected fp.ini, but changing the state of e.g. Range Checking does not
change fp.ini...

5) F9

6) Result: 8 errors, all to do with write_time in all_supp.pas - replace
the code by

=== CUT ===
procedure write_time;
var ihh: word;
var imm: word;
var iss: word;
var ims: word;

begin
gettime(ihh, imm, iss, ims);

asm
movzx eax, ihh
mov eax, dword [eax * 2 + offset h_desc]
mov word ptr wt_time[1], ax

movzx eax, imm
mov eax, dword [eax * 2 + offset ms_desc]
mov word ptr wt_time[4], ax

movzx eax, iss
mov eax, dword [eax * 2 + offset ms_desc]
mov word ptr wt_time[7], ax

movzx eax, ims
mov eax, dword [eax * 2 + offset ms_desc]
mov word ptr wt_time[10], ax
end;

write(wt_time);
end; {write_time}
=== CUT ===

Q1: Why doesn't FPC allow longint's, like VP that has gettime also
defined with words?

Q2: Why do I have to add dword qualifiers to the
"mov eax, dword [eax * 2 + offset h_desc]" statements, shouldn't it be
clear from the first operand that I'm loading a dword?

7) F9 again: it will just give two warnings of the

Warning: Local variable "..." does not seem to be initialized

kind. Nice to know, but in my case they are harmless.

8) F8-F8-F8 and kaboom... (on the "reset(liftin)" statement)

As it turns out, the incomprehensible error message is just that, but
adding a "Run -> "Parameter..." -> "-ic:\lift\lift.dat" solves the
problem (as does setting the "Run Directory..." to c:\lift) - I
belatedly realized that running the IDE from the installation directory
would obviously try to find the input file in the same. Oops!

9) F9, F8 and now the program 207's on line 62 of speed.pas and from
what I can see, it seems that FPC has a problem with untyped variables
as the "fldl 0x8(%eax)" (Sheesh, AT&T assembler is totally crap, the
debug window should also be able to show Intel syntax...) loads values
that do not make any sense and on the eight, where it should load
94.736..., it loads 1.7164658746958755e+211 and that is obviously far to
big to ever truncate to a longint...

I'm stuck...

Robert
--
Robert AH Prins
robert(a)prino(d)org
Adrian Devries
2012-01-10 23:11:20 UTC
Permalink
Post by Marco van de Voort
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling lift.pas
Fatal: Can't find unit hhcommon used by lift
Fatal: Compilation aborted
Error: d:\FPC\2.6.0\bin\i386-Win32\ppc386.exe returned an error exitcode
(normal if you did not specify a source file to be compiled
)
Would you please provide the file "hhcommon.pas"? Thanks!

Best regards,
Adrian
Robert AH Prins
2012-01-11 00:48:20 UTC
Permalink
Post by Adrian Devries
Post by Marco van de Voort
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling lift.pas
Fatal: Can't find unit hhcommon used by lift
Fatal: Compilation aborted
Error: d:\FPC\2.6.0\bin\i386-Win32\ppc386.exe returned an error exitcode
(normal if you did not specify a source file to be compiled
)
Would you please provide the file "hhcommon.pas"? Thanks!
Oops, I used the the bat file that creates the RAR from the disk of the
dead PC and that didn't yet contain hhcommon.pas. The file can be found
at
<https://docs.google.com/open?id=0B0oygbfs7DsVYTNlM2FkNTQtMTNiMS00OTVlLWE5MzYtYWI1MTE4NzI1ZTVk>

Robert
--
Robert AH Prins
robert(a)prino(d)org
Adrian Devries
2012-01-11 07:35:35 UTC
Permalink
Post by Robert AH Prins
Post by Adrian Devries
Would you please provide the file "hhcommon.pas"? Thanks!
Oops, I used the the bat file that creates the RAR from the disk of the
dead PC and that didn't yet contain hhcommon.pas. The file can be found
at
<https://docs.google.com/open?id=0B0oygbfs7DsVYTNlM2FkNTQtMTNiMS00OTVlLWE5MzYtYWI1MTE4NzI1ZTVk>
Robert
Would you please provide the other missing source files: "miniwait.pas",
"types.pas" and "untyped.pas"?
Post by Robert AH Prins
Virtual Pascal Version 2.1.279 Copyright (C) 2000-2004 vpascal.com
lift(c).pas(838)
80386all.pas(215)
80386lif.pas(317)
all_supp.pas(476)
liftsupp.pas(1219)
fast_all.pas(59)
fast_sup.pas(1077)
cj.pas(163)
jc.pas(202)
sortwait.pas(334)
1st_last.pas(309)
trip.pas(216)
day.pas(221)
distance.pas(269)
type.pas(176)
country.pas(219)
nat.pas(181)
speed.pas(129)
wait.pas(613)
waitsd.pas(437)
lift.pas(49): Error 15: File 'MINIWAIT.PAS' is not found
Adrian
Robert AH Prins
2012-01-11 13:29:49 UTC
Permalink
Post by Adrian Devries
Post by Robert AH Prins
Post by Adrian Devries
Would you please provide the file "hhcommon.pas"? Thanks!
Oops, I used the the bat file that creates the RAR from the disk of the
dead PC and that didn't yet contain hhcommon.pas. The file can be found
at
<https://docs.google.com/open?id=0B0oygbfs7DsVYTNlM2FkNTQtMTNiMS00OTVlLWE5MzYtYWI1MTE4NzI1ZTVk>
Robert
Would you please provide the other missing source files: "miniwait.pas",
"types.pas" and "untyped.pas"?
Post by Robert AH Prins
Virtual Pascal Version 2.1.279 Copyright (C) 2000-2004 vpascal.com
lift(c).pas(838)
80386all.pas(215)
80386lif.pas(317)
all_supp.pas(476)
liftsupp.pas(1219)
fast_all.pas(59)
fast_sup.pas(1077)
cj.pas(163)
jc.pas(202)
sortwait.pas(334)
1st_last.pas(309)
trip.pas(216)
day.pas(221)
distance.pas(269)
type.pas(176)
country.pas(219)
nat.pas(181)
speed.pas(129)
wait.pas(613)
waitsd.pas(437)
lift.pas(49): Error 15: File 'MINIWAIT.PAS' is not found
I am not having a good day...

miniwait,pas can be found on Google docs,

https://docs.google.com/open?id=0B0oygbfs7DsVMDg3ZTczZDQtMTU2ZC00NGVhLWI2NGItYzQ0NzlmMmE2ZmU0

As for types.pas & untyped.pas that Marco was asking about, they are not
used, having been put into hhcommon.pas. No source file is using them
anymore (unless size.pas slipped through)

Robert
--
Robert AH Prins
robert(a)prino(d)org
Adrian Devries
2012-01-12 23:36:49 UTC
Permalink
Post by Robert AH Prins
I am not having a good day...
miniwait,pas can be found on Google docs,
https://docs.google.com/open?id=0B0oygbfs7DsVMDg3ZTczZDQtMTU2ZC00NGVh...
dat2txt.vpo contains an incorrect "PrimaryFile" entry ("c:\01-lift\vp
\dev\dat2csv.pas"), even in the latest archive (http://
f1.grp.yahoofs.com/v1/8GUPT21c8_XV-
CoSD8Hcwr0dLSQY8UCLVifXGvXeKDuYwgfT--bHELC8VG4H_fATS5AA-yNGiu-
f0bw1K6Bx2FZBivYW50YsAA4carqCFRxVDmFu9UQgiw/Robert%27s%20programs/
lift32bit.rar).

I've managed to compile your sources with both VirtualPascal and
FreePascal.

I provide a diff (http://f1.grp.yahoofs.com/v1/8GUPTw9tGorV-
CoSmkgj76ulviIHarVO3i2igrkSCWY6fGCtKryh9u53aFZTEXWT6m6RoIZ7fS04aeUxo1PWBlwoQQFMERKnAr0lUO4vUX3MUFPz9-
b77g/Robert%27s%20programs/lift32bit.diff), a build script (http://
f1.grp.yahoofs.com/v1/8GUPT_roItLV-
CoSZfkqgTFaB2thfnF98B_El2sCJDmECVh00E6th3u4rRtyF4SQf68fKF3EQxSHw6_pnia5RrhAWrOJGl9tVkt8kIZfMtwTVWJ2aAIwbw/
Robert%27s%20programs/BuildLift.cmd) and a build log (http://
f1.grp.yahoofs.com/v1/8GUPT2Q37P7V-
CoSE_w_VBd3hgdYVd8CAaF_WUFAbthFhf_G2SB3ADmmW8_WmC4VNAXUoTdFX67IcbSEI4bbwXh4hvudn27YRcMwI7H2tyvBNnGqrGjcEA/
Robert%27s%20programs/fpc.log).

Adrian
Adrian Devries
2012-01-13 06:39:57 UTC
Permalink
Post by Adrian Devries
I provide a diff (http://f1.grp.yahoofs.com/v1/8GUPTw9tGorV-
CoSmkgj76ulviIHarVO3i2igrkSCWY6fGCtKryh9u53aFZTEXWT6m6RoIZ7fS04aeUxo1PWBlwoQQFMERKnAr0lUO4vUX3MUFPz9-
b77g/Robert%27s%20programs/lift32bit.diff), a build script (http://
f1.grp.yahoofs.com/v1/8GUPT_roItLV-
CoSZfkqgTFaB2thfnF98B_El2sCJDmECVh00E6th3u4rRtyF4SQf68fKF3EQxSHw6_pnia5RrhAWrOJGl9tVkt8kIZfMtwTVWJ2aAIwbw/
Robert%27s%20programs/BuildLift.cmd) and a build log (http://
f1.grp.yahoofs.com/v1/8GUPT2Q37P7V-
CoSE_w_VBd3hgdYVd8CAaF_WUFAbthFhf_G2SB3ADmmW8_WmC4VNAXUoTdFX67IcbSEI4bbwXh4hvudn27YRcMwI7H2tyvBNnGqrGjcEA/
Robert%27s%20programs/fpc.log).
Build script changed (http://f1.grp.yahoofs.com/v1/
YMgPT8o5vWrFnvkU7f82oRiGa_xaTiS6BfERF4Y3fIaGS85ZzD0JgNJ5kAiN7s3ZCHAagjq1qKVpGeM8Np5OtXqOmKwmLg8Zs5dXWr8ZeqxmlauMf49rpA/
Robert%27s%20programs/BuildLift.cmd).

Adrian
Marco van de Voort
2012-01-13 09:22:01 UTC
Permalink
Post by Adrian Devries
I've managed to compile your sources with both VirtualPascal and
FreePascal.
I've succeeded also, but the program crashed. It seems the program assumes
that variables are in sequence in the datasegment, and it uses pointers to
poke into them. Most notably triples of pointers (xxx_nxt, xxx_top, xxx_ptr)

It seems that with the current FPC versions that (wrong) assumption doesn't
apply any more.

The symptom was that lift_top was NIL after readfile, because that pointer
was updated via the above mechanism.

A possible solution would be to enforce grouping with e.g. the following
trick

type PWhateverPointer=pchar;

Type
THetPointerRecord = packed record
nxt,
top,
_ptr : PWhateverPointer;
end;


const
list_dummy :THetPointerRecord = (nxt:nil;top:nil;_ptr:nil);

var
list_nxt : PWhateverPointer absolute list_dummy.nxt;
list_top : PWhateverPointer absolute list_dummy.top;
list_ptr : PWhateverPointer absolute list_dummy._ptr;
Adrian Devries
2012-01-14 01:41:41 UTC
Permalink
Post by Marco van de Voort
I've succeeded also, but the program crashed. It seems the program assumes
that variables are in sequence in the datasegment, and it uses pointers to
poke into them. Most notably triples of pointers (xxx_nxt, xxx_top, xxx_ptr)
New diff file (http://f1.grp.yahoofs.com/v1/
kNMQTy5jD_lyXR5MN4_QNJoOWSnyak12FK-
DubWMxJV3HS5PvwtC8kwkltvPZVhsPxpc_vFH63W58sNPfzGq9dif8SN1VXtc9Fm-
WuRqjRah1vsivL3inQ/Robert%27s%20programs/lift32bit.diff)

Adrian

Marco van de Voort
2012-01-10 23:19:09 UTC
Permalink
Post by Robert AH Prins
3) Start fp.exe via the Windows Explorer.
Try a command prompt. Via explorer might not set working dir.
Post by Robert AH Prins
- primary file c:\lift\lift.pas
- assembler style: Intel (but no conditional define of "asm")
- mode debug
- backtrace line info for debugging
- rest all defaults
Note: It would be very nice to have an option that would write the
entire environment into a simple text file for inclusion in postings, I
haven't been able to figure out where Compiler options are stored, I
expected fp.ini, but changing the state of e.g. Range Checking does not
change fp.ini...
1. Clean out redundant assembler. It might have hidden assumptions about
compiler and rtl internals.
2. Provide hh_common and other missing sources so we can actually test?!?
Post by Robert AH Prins
Q1: Why doesn't FPC allow longint's, like VP that has gettime also
defined with words?
Redundant.
Post by Robert AH Prins
Q2: Why do I have to add dword qualifiers to the
"mov eax, dword [eax * 2 + offset h_desc]" statements, shouldn't it be
clear from the first operand that I'm loading a dword?
No idea.
Post by Robert AH Prins
8) F8-F8-F8 and kaboom... (on the "reset(liftin)" statement)
See above. Without a complete set of sources it is hard to test.
Robert AH Prins
2012-01-11 00:59:32 UTC
Permalink
Post by Marco van de Voort
Post by Robert AH Prins
3) Start fp.exe via the Windows Explorer.
Try a command prompt. Via explorer might not set working dir.
Post by Robert AH Prins
- primary file c:\lift\lift.pas
- assembler style: Intel (but no conditional define of "asm")
- mode debug
- backtrace line info for debugging
- rest all defaults
Note: It would be very nice to have an option that would write the
entire environment into a simple text file for inclusion in postings, I
haven't been able to figure out where Compiler options are stored, I
expected fp.ini, but changing the state of e.g. Range Checking does not
change fp.ini...
1. Clean out redundant assembler. It might have hidden assumptions about
compiler and rtl internals.
If you compile without defining "asm", all assembler will be out, with
the exception of the code in write_time, I don't remember why there is
no corresponding pure-Pascal version of that procedure, even the latest
TP3 version I can access right now (no DVD-RAM due to a dead PC) already
used inline "assembler" for that routine.
Post by Marco van de Voort
2. Provide hh_common and other missing sources so we can actually test?!?
See my other reply, hhcommon.pas is on Google docs, what other sources
are missing?

Robert
--
Robert AH Prins
robert(a)prino(d)org
Marco van de Voort
2012-01-11 09:25:53 UTC
Permalink
Post by Robert AH Prins
Post by Marco van de Voort
1. Clean out redundant assembler. It might have hidden assumptions about
compiler and rtl internals.
If you compile without defining "asm", all assembler will be out, with
the exception of the code in write_time, I don't remember why there is
no corresponding pure-Pascal version of that procedure, even the latest
TP3 version I can access right now (no DVD-RAM due to a dead PC) already
used inline "assembler" for that routine.
The second half of 80386all also has assembler only options. Worse, they
seem to have VP specific & directives next to them.
Robert AH Prins
2012-01-11 13:33:45 UTC
Permalink
Post by Marco van de Voort
Post by Robert AH Prins
Post by Marco van de Voort
1. Clean out redundant assembler. It might have hidden assumptions about
compiler and rtl internals.
If you compile without defining "asm", all assembler will be out, with
the exception of the code in write_time, I don't remember why there is
no corresponding pure-Pascal version of that procedure, even the latest
TP3 version I can access right now (no DVD-RAM due to a dead PC) already
used inline "assembler" for that routine.
The second half of 80386all also has assembler only options. Worse, they
seem to have VP specific& directives next to them.
You're right, If you really want, you can just add a {$ifdef asm} ...
{$endif} around them (i.e. core_4_cvi_cvr & stripper).

However, FPC doesn't have any problems with them due to the fact that it
ignores VP specific "{&..." directives...

Robert
--
Robert AH Prins
robert(a)prino(d)org
Marco van de Voort
2012-01-11 17:40:58 UTC
Permalink
Post by Robert AH Prins
PS2: The VP executable, with full debugging info comes to 110K, the FPC
version is a few bits more bloated at 299K...
I got it compiling, and with the proper compiler configuration (-XXs, no
debug), FPC 2.6.0 creates a binary of 134.144 bytes.
Loading...