Add Linux printer support to the emulator

This commit is contained in:
CrazyEttin 2022-08-10 01:01:26 +03:00
parent b4d569d5ee
commit 17cd71f9ed
2 changed files with 34 additions and 2 deletions

View File

@ -1,6 +1,6 @@
program Emulator;
uses Crt;
uses Crt{$ifdef printer}, Printer{$endif};
const
IO = $ffff;
@ -22,6 +22,14 @@ begin
IP := 0;
RP := $fff0;
//Initialise the printer
{$ifdef printer}
AssignLst (Lst, '| lpr');
rewrite (Lst);
Ch := ansichar ($d);
write (Lst, Ch);
{$endif}
//Read a program file and check for errors
if ParamCount <> 1 then begin
writeln ('Usage: emulator program');
@ -135,6 +143,13 @@ begin
Ch := ansichar (R [X]);
write (Ch);
end
//Printer
{$ifdef printer}
else if Addr = $fffe then begin
Ch := ansichar (R [X]);
write (Lst, Ch);
end
{$endif}
//Regular store
else Mem [Addr] := R [X];
end
@ -197,6 +212,11 @@ begin
end;
end;
end
end;
//Close the printer
{$ifdef printer}
close (Lst);
{$endif}
end.

View File

@ -5,6 +5,14 @@ Thingamajig is a RISC-y and MISC-y homebrew computer architecture. Its
git repository can be found at
https://ahti.space/git/crazyettin/Thingamajig.
Included Software
-----------------
The repository includes an emulator implementation of Thingamajig as
well as an assembler and a disassembler, all written in FreePascal. It
also includes couple of simple example programs for Thingamajig written
in Assembly.
Registers and Memory
--------------------
@ -82,6 +90,10 @@ address FFFF. The emulator emulates a dumb terminal for this.
Arbitrary devices can be mapped to the other reserved addresses.
The emulator can be compiled in Linux with support for a dot matrix
printer with the argument -dprinter. The printer must be set as the
default in CUPS and will be mapped to address FFFE in the emulator.
Initial Program Loader
----------------------