Fix some more printing-related bugs

This commit is contained in:
CrazyEttin 2022-08-11 10:34:49 +03:00
parent c89db6c351
commit 69005574f3
1 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,7 @@
program Emulator;
{$MODE OBJFPC}
uses Crt{$ifdef printer}, Printer{$endif};
const
@ -12,7 +14,7 @@ var
Addr, IP, RP: word; //Address argument and instruction and return pointers
R: array [0 .. 3] of byte; //General-purpose registers
Mem: array [0 .. $ffef] of byte; //Memory
Prog{$ifdef printer}, Ptr{$endif}: file of byte; //Program file and printer
Prog{$ifdef printer}, Prn{$endif}: file of byte; //Program file and printer
Ch: ansichar; //Character for input and output
begin
@ -138,10 +140,13 @@ begin
//Printer
{$ifdef printer}
else if Addr = $fffe then begin
assign (Ptr, '/dev/usb/lp0');
rewrite (Ptr);
write (Ptr, R [X]);
close (Ptr);
assign (Prn, '/dev/usb/lp0');
try
rewrite (Prn);
write (Prn, R [X]);
close (Prn);
except
end;
end
{$endif}
//Regular store