diff --git a/emulator.pas b/emulator.pas index e44ef1f..113b23a 100644 --- a/emulator.pas +++ b/emulator.pas @@ -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. diff --git a/readme.md b/readme.md index 764bfcf..9306d72 100644 --- a/readme.md +++ b/readme.md @@ -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 ----------------------