Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
- Managed C++
- Visual Basic 4 / 5 / 6
- linked list
- hello world
Bios Calls From Delphibios registers turbo pascal
Posted 15 April 2012 - 01:07 PM
procedure lpt_send_char (ch: byte);
var regs: registers;
intr ($17, regs);
until (regs.ah and $80)<>0;
regs.ah:=$0; regs.al:=ch; regs.dx:=0;
intr ($17, regs);
status:=(regs.ah and $29)=0;
if not status then
writeln ('Printer I/O error');
write ('Abort, Retry?');
repeat until keypressed;
a:=upcase(readkey); writeln (a);
if a='A' then halt;
Now is there even a remote chance to make this work in 32-bit/64-bit environment or should I start rewriting the complete printer control segment?
Thank you for your help.
Posted 15 April 2012 - 08:42 PM
First, please wrap codes inside "CODE" tag. Select all the codes and click button with <> icon. Will make it easier to read and comprehend.
If you run this code under NT based Windows (Windows 2000, XP, Vista, 2003, and 7), it will fail. Because these OS prevent direct access to port. But there is way to make the code works, ie. by using "fake" device driver code. Search library called tinyport, or posts related with it.
However, accessing the printer the way you did with your code is not recommended under Windows (i.e. the 32/64 bit OS). Use windows api instead. Since you are using Delphi, you don't have to directly use windows api. You can use TPrinter object declared in Printers unit. I recently posted sample code on how to printing with Delphi.