I uploaded an example to
https://pushbx.org/ecm/test/20250621/This is built in this way:
test$ cat ../fpclarge.sh
#! /bin/bash
MYFPCDIR="$(dirname "$0")"
"$MYFPCDIR"/bin/ppcross8086 -vi -Tmsdos -WmLarge \
-Fu"$MYFPCDIR"/lib/fpc/3.2.2/units/msdos/8086-large/rtl \
"$@"
test$ nasm lzss.nas -o lzss.o -P nasm.mac -f obj
test$ ../fpclarge.sh test.pas
The lzss.nas and lzutil.pas files are
from my LZEXE repo. lzutil.pas was changed slightly to build with FreePascal, in lzss.nas I only added the int3 instruction.
This displays 85 warnings all reading the same way:
Warning: Encountered an OMF reference to a section, that has been removed by smartlinking: DATA||
Running the application crashes, apparently because the assembly language code overwrites the function pointers that it uses to call into the main Pascal file's callbacks. I assume that this crash and the "an OMF reference" warnings are related and fixing one may fix the other too. If I delete everything except the LZCOMP public with an empty function from lzss.nas, then the warnings disappear. But I need it to declare and reserve space for its variables.
Searching the warning's text doesn't seem to give me any relevant results.
On the wiki it tells me I should use smartlinking. Trying to disable smartlinking results in this:
test$ ../fpclarge.sh -XX- -CX- test.pas
Free Pascal Compiler version 3.2.2 [2021/05/17] for i8086
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: MS-DOS 16-bit real mode
Compiling test.pas
test.pas(42,1) Warning: Object system.o not found, Linking may fail !
test.pas(42,1) Warning: Object lzutil.o not found, Linking may fail !
Linking test.exe
test.pas(42,1) Warning: Object system.o not found, Linking may fail !
test.pas(42,1) Error: Can't open object file: system.o
test.pas(42,1) Warning: Object lzutil.o not found, Linking may fail !
test.pas(42,1) Error: Can't open object file: lzutil.o
test.pas(42,1) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Should I try to get it work without smartlinking? Or is there a way to make it work with DATA references in the lzss.nas file? Or do I need to put all variables into one of the .pas files and access them from the assembly file using extern?