Add more detail to the readme, reword tapectl instructions slightly, and modify the behaviour at the buffer end in Echo

This commit is contained in:
CrazyEttin 2022-09-22 01:02:56 +03:00
parent 2feaba4ee9
commit 0b07a2b214
4 changed files with 41 additions and 41 deletions

View File

@ -40,7 +40,7 @@ var
Prog{$ifdef printer}, Prn{$endif}{$ifdef tape}, TapeIn, TapeOut{$endif}: file of byte; //Program file, line printer, and tape reader and punch tapes
{$ifdef tape}
Reader, Punch: Tape; //States of the tape reader and punch
State: file of Tape; //File storing the states of the tape reader and punch
Tapes: file of Tape; //File storing the states of the tape reader and punch
{$endif}
Ch, Scan: ansichar; //Character for input and output and scancode for non-ASCII keys
Verbose, IC, LFX: integer; //Verbose flag, instruction counter for CPU speed, and line feed position marker
@ -66,8 +66,8 @@ begin
else write (Ch);
end;
//Wait to emulate CPU speed of roughly 500 KIPS
{$ifndef fast}
//Wait to emulate CPU speed of roughly 500 KIPS
procedure wait;
begin
if IC div 500 = 0 then sleep (1)
@ -112,21 +112,21 @@ begin
if Echo then Output; //Local echo
B := byte (Ch);
end
//Tape reader
{$ifdef tape}
//Tape reader
else if W = $fffd then begin
{$ifndef fast}
wait;
sleep (1);
{$endif}
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
assign (Tapes, ExpandFileName ('~/.thingamajig/tapes'));
//Check the reader state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
try
reset (State);
read (State, Reader);
read (State, Punch);
close (State);
reset (Tapes);
read (Tapes, Reader);
read (Tapes, Punch);
close (Tapes);
except
end;
end;
@ -142,12 +142,12 @@ begin
B := $ff;
end;
//Save the reader state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
try
rewrite (State);
write (State, Reader);
write (State, Punch);
close (State);
rewrite (Tapes);
write (Tapes, Reader);
write (Tapes, Punch);
close (Tapes);
except
end;
end;
@ -173,8 +173,8 @@ begin
if Ch = ansichar ($12) then Echo := true;
if Ch = ansichar ($14) then Echo := false;
end
//Printer
{$ifdef printer}
//Printer
else if W = $fffe then begin
assign (Prn, '/dev/usb/lp0');
try
@ -185,21 +185,21 @@ begin
end;
end
{$endif}
//Tape punch
{$ifdef tape}
//Tape punch
else if W = $fffd then begin
{$ifndef fast}
wait;
sleep (19);
{$endif}
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
assign (Tapes, ExpandFileName ('~/.thingamajig/tapes'));
//Check the punch state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
try
reset (State);
read (State, Reader);
read (State, Punch);
close (State);
reset (Tapes);
read (Tapes, Reader);
read (Tapes, Punch);
close (Tapes);
except
end;
end;
@ -235,12 +235,12 @@ begin
end;
end;
//Save the punch state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
try
rewrite (State);
write (State, Reader);
write (State, Punch);
close (State);
rewrite (Tapes);
write (Tapes, Reader);
write (Tapes, Punch);
close (Tapes);
except
end;
end;
@ -271,8 +271,8 @@ begin
RP := LastRAM + 1;
IC := 0;
//Initialise the tape reader and punch
{$ifdef tape}
//Initialise the tape reader and punch
Reader.Path := '';
Reader.Reset := true;
Reader.Pos := 0;

View File

@ -41,8 +41,8 @@ inloop: load r1, ffff
load r2, bfsize
brneq r0, r2, chstor
;Backtrack if at the buffer end
load r2, #8
;Ignore the input and print an underscore if at the buffer end
load r2, #5f
store ffff, r2
breq r0, r0, inloop

View File

@ -97,7 +97,7 @@ Emulator and Tapectl
Usage:
* emulator (-v) program (2> verbose_output)
* tapectl (-r reader_file) (-p punch_file)
* tapectl (-r tape) (-p tape)
By default the emulator runs at roughly 500 KIPS and has 2 KiB of RAM.
The arguments -dRAM4, -dRAM8, -dRAM16, -dRAM32, and -dRAM64 can be used
@ -118,11 +118,11 @@ characters and non-character keys null.
In Linux the emulator can be compiled with support for a character
printer and an emulated high speed (roughly 500 CPS in and 50 CPS out)
paper tape reader and punch with the arguments -dprinter and -dtape
respectively. The printer is mapped to address FFFE and the tape reader
and punch to FFFD. The printer prints into /dev/usb/lp0 and the tape
files read from and punched to are (re)set using the program tapectl
with the arguments -r and -p respectively.
8-bit paper tape reader and punch with the arguments -dprinter and
-dtape respectively. The printer is mapped to address FFFE and the tape
reader and punch to FFFD. The printer prints into /dev/usb/lp0 and the
tape files read from and punched to are (re)set using the program
tapectl with the arguments -r and -p respectively.
The IPL loads the program specified as an argument when running the
emulator.

View File

@ -21,11 +21,11 @@ begin
//Check the arguments
if ParamCount > 4 then begin
writeln ('Usage: tapectl (-r reader_file) (-p punch_file)');
writeln ('Usage: tapectl (-r tape) (-p tape)');
halt (1);
end
else if ParamCount mod 2 <> 0 then begin
writeln ('Usage: tapectl (-r reader_file) (-p punch_file)');
writeln ('Usage: tapectl (-r tape) (-p tape)');
halt (1);
end;
if ParamStr (1) = '-r' then begin
@ -41,15 +41,15 @@ begin
if ParamStr (3) = '-r' then DoRead := 4;
end
else begin
writeln ('Usage: tapectl (-r reader_file) (-p punch_file)');
writeln ('Usage: tapectl (-r tape) (-p tape)');
halt (1);
end;
//Assign the state file
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
assign (State, ExpandFileName ('~/.thingamajig/tapes'));
//Read existing state if any
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
try
reset (State);
read (State, Reader);