Not sure if it is a problem of Free Pascal or DOSBox, but
WriteLn isn't working correctly in that emulator. It does in Windows XP.
See next simple program:
program test;
begin
WriteLn ('This is a test program. Should write text in the console.');
WriteLn ('This is a test program.', ' Should write text in the console.')
end.
Compiling for DOS 32bit Go32V2 and executing in DOSBox it look like the attached file. See that first WriteLn renders incorrectly, while second renders correctly.
Also see that heaptrc output has issues too.
Maybe that's why FPC doesn't work in DOSBox (internal error 2004121202)?