diff --git a/emulator.pas b/emulator.pas index c50d49d..0b71b42 100644 --- a/emulator.pas +++ b/emulator.pas @@ -14,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}, Prn{$endif}{$ifdef tape}, TapeIn, TapeOut{$endif}: file of byte; //Program file, line printer, and punched tape reader and keypunch + Prog{$ifdef printer}, Prn{$endif}{$ifdef tape}, TapeIn, TapeOut{$endif}: file of byte; //Program file, line printer, and punched tape reader and punch {$ifdef tape} TapePos: integer; //Punched tape reader position pointer {$endif} @@ -127,13 +127,13 @@ begin else if Op = 9 then R [X] := R [X] xor R [Y] //Load else if Op = $a then begin - //Dumb terminal input + //Terminal input if Addr = IO then begin Ch := ReadKey; write (Ch); //Local echo R [X] := byte (Ch); end - //Punched tape reader + //Tape reader {$ifdef tape} else if Addr = $fffd then begin assign (TapeIn, 'tapein'); @@ -157,12 +157,12 @@ begin end //Store else if Op = $b then begin - //Dumb terminal output + //Terminal output if Addr = IO then begin Ch := ansichar (R [X]); write (Ch); end - //Line printer + //Printer {$ifdef printer} else if Addr = $fffe then begin assign (Prn, '/dev/usb/lp0'); @@ -174,7 +174,7 @@ begin end; end {$endif} - //Punched tape keypunch + //Tape punch {$ifdef tape} else if Addr = $fffd then begin assign (TapeOut, 'tapeout'); diff --git a/readme.md b/readme.md index 202ddb8..2a04ceb 100644 --- a/readme.md +++ b/readme.md @@ -93,11 +93,11 @@ Arbitrary devices can be mapped to the other reserved addresses. The emulator can be compiled with support for a line printer at /dev/usb/lp0 with the argument -dprinter, and for an emulated punched -tape reader and keypunch at tapein and tapeout respectively with -dtape. +tape reader and punch at tapein and tapeout respectively with -dtape. The printer is mapped to address FFFE in the emulator and the tape -reader and keypunch to FFFD. To reset the tape reader to the beginning -of a tape, for example to change the tape, read once with no file at -tapein. If you wish to use a different setup you have to modify the code +reader and punch to FFFD. To reset the tape reader to the beginning of a +tape, for example to change the tape, read once with no file at tapein. +If you wish to use a different setup you have to modify the code yourself. Initial Program Loader