[fpc-pascal] Porting from Turbo Pascal to FPC
Alexander Grotewohl
alex at dcclost.com
Thu Apr 30 13:47:49 CEST 2020
Not really sure how you would adapt this to your setup, but I threw this together from a project I did previously. I've only tested it with the Windows 10 builtin XPS and PDF printers so I'm not sure how it will behave on a real printer.
(Hopefully the attachment makes it through..)
--
Alexander Grotewohl
https://dcclost.com
________________________________
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> on behalf of Francisco Glover via fpc-pascal <fpc-pascal at lists.freepascal.org>
Sent: Wednesday, April 29, 2020 4:42 AM
To: fpc-pascal at lists.freepascal.org <fpc-pascal at lists.freepascal.org>
Cc: Francisco Glover <francisco.glover at gmail.com>
Subject: [fpc-pascal] Porting from Turbo Pascal to FPC
Overt the years I have developed programs in Turbo Pascal for student lab use, in which the student can easily send to an attached printer contents of the text or VGA graphics screens. These no longer work on Windows 10. In shifting to FPC , certain key procedures which worked in Turbo Pascal running on Windows XP no longer work in FPC running on Windows 10. Samples are shown below:
=======================================================
Program Sample;
{$ mode TP}
Uses Crt, Dos, Printer;
Var Regs: Registers;
Procedure Print_screen; { Interupt $05 }
Begin
Intr($05, Regs);
End; {Nothing printed, exit code= 0}
Procedure Print_string;
Begin
Writeln('Text Screen');
Writeln(LST, 'String to be printed');
End; {nothing printed, system hangs}
Procedure Print_characters; {Intrupt $17, function 0, char to printer}
Var j: byte;
Msg: String[2];
Begin
Msg := 'A' + #11; { #11 = formfeed }
For j := 1 to 2 do
Begin
Regs.AH := 0; {Function 0, output char}
Regs.AL :=Ord(Msg[j]);
Regs.DX := 0; {default printer}
Intr($17, Regs);
End;
End; {Nothing printed, exit code= 0}
Procedure Print1Char; {Interupt $21, Fcn 5}
Begin
Regs.AH := 5; {print character}
Regs.DL := 'A';
MSDos(Regs);
Regs.AH := 5; {print character}
Regs.DL := #11; {formfeed}
MSDos(Regs);
End; {Nothing printed, exit code= 0}
============================================================
How can I have my FPC programs running on Windows 10 send text and graphics screens direct to an attached printer? Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200430/710ff81e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print.pas
Type: application/octet-stream
Size: 2288 bytes
Desc: print.pas
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200430/710ff81e/attachment.obj>
More information about the fpc-pascal
mailing list