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:
parent
2feaba4ee9
commit
0b07a2b214
56
emulator.pas
56
emulator.pas
|
@ -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
|
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}
|
{$ifdef tape}
|
||||||
Reader, Punch: Tape; //States of the tape reader and punch
|
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}
|
{$endif}
|
||||||
Ch, Scan: ansichar; //Character for input and output and scancode for non-ASCII keys
|
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
|
Verbose, IC, LFX: integer; //Verbose flag, instruction counter for CPU speed, and line feed position marker
|
||||||
|
@ -66,8 +66,8 @@ begin
|
||||||
else write (Ch);
|
else write (Ch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Wait to emulate CPU speed of roughly 500 KIPS
|
|
||||||
{$ifndef fast}
|
{$ifndef fast}
|
||||||
|
//Wait to emulate CPU speed of roughly 500 KIPS
|
||||||
procedure wait;
|
procedure wait;
|
||||||
begin
|
begin
|
||||||
if IC div 500 = 0 then sleep (1)
|
if IC div 500 = 0 then sleep (1)
|
||||||
|
@ -112,21 +112,21 @@ begin
|
||||||
if Echo then Output; //Local echo
|
if Echo then Output; //Local echo
|
||||||
B := byte (Ch);
|
B := byte (Ch);
|
||||||
end
|
end
|
||||||
//Tape reader
|
|
||||||
{$ifdef tape}
|
{$ifdef tape}
|
||||||
|
//Tape reader
|
||||||
else if W = $fffd then begin
|
else if W = $fffd then begin
|
||||||
{$ifndef fast}
|
{$ifndef fast}
|
||||||
wait;
|
wait;
|
||||||
sleep (1);
|
sleep (1);
|
||||||
{$endif}
|
{$endif}
|
||||||
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
|
assign (Tapes, ExpandFileName ('~/.thingamajig/tapes'));
|
||||||
//Check the reader state
|
//Check the reader state
|
||||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
|
||||||
try
|
try
|
||||||
reset (State);
|
reset (Tapes);
|
||||||
read (State, Reader);
|
read (Tapes, Reader);
|
||||||
read (State, Punch);
|
read (Tapes, Punch);
|
||||||
close (State);
|
close (Tapes);
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -142,12 +142,12 @@ begin
|
||||||
B := $ff;
|
B := $ff;
|
||||||
end;
|
end;
|
||||||
//Save the reader state
|
//Save the reader state
|
||||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
|
||||||
try
|
try
|
||||||
rewrite (State);
|
rewrite (Tapes);
|
||||||
write (State, Reader);
|
write (Tapes, Reader);
|
||||||
write (State, Punch);
|
write (Tapes, Punch);
|
||||||
close (State);
|
close (Tapes);
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -173,8 +173,8 @@ begin
|
||||||
if Ch = ansichar ($12) then Echo := true;
|
if Ch = ansichar ($12) then Echo := true;
|
||||||
if Ch = ansichar ($14) then Echo := false;
|
if Ch = ansichar ($14) then Echo := false;
|
||||||
end
|
end
|
||||||
//Printer
|
|
||||||
{$ifdef printer}
|
{$ifdef printer}
|
||||||
|
//Printer
|
||||||
else if W = $fffe then begin
|
else if W = $fffe then begin
|
||||||
assign (Prn, '/dev/usb/lp0');
|
assign (Prn, '/dev/usb/lp0');
|
||||||
try
|
try
|
||||||
|
@ -185,21 +185,21 @@ begin
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
{$endif}
|
{$endif}
|
||||||
//Tape punch
|
|
||||||
{$ifdef tape}
|
{$ifdef tape}
|
||||||
|
//Tape punch
|
||||||
else if W = $fffd then begin
|
else if W = $fffd then begin
|
||||||
{$ifndef fast}
|
{$ifndef fast}
|
||||||
wait;
|
wait;
|
||||||
sleep (19);
|
sleep (19);
|
||||||
{$endif}
|
{$endif}
|
||||||
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
|
assign (Tapes, ExpandFileName ('~/.thingamajig/tapes'));
|
||||||
//Check the punch state
|
//Check the punch state
|
||||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
|
||||||
try
|
try
|
||||||
reset (State);
|
reset (Tapes);
|
||||||
read (State, Reader);
|
read (Tapes, Reader);
|
||||||
read (State, Punch);
|
read (Tapes, Punch);
|
||||||
close (State);
|
close (Tapes);
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -235,12 +235,12 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//Save the punch state
|
//Save the punch state
|
||||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
|
||||||
try
|
try
|
||||||
rewrite (State);
|
rewrite (Tapes);
|
||||||
write (State, Reader);
|
write (Tapes, Reader);
|
||||||
write (State, Punch);
|
write (Tapes, Punch);
|
||||||
close (State);
|
close (Tapes);
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -271,8 +271,8 @@ begin
|
||||||
RP := LastRAM + 1;
|
RP := LastRAM + 1;
|
||||||
IC := 0;
|
IC := 0;
|
||||||
|
|
||||||
//Initialise the tape reader and punch
|
|
||||||
{$ifdef tape}
|
{$ifdef tape}
|
||||||
|
//Initialise the tape reader and punch
|
||||||
Reader.Path := '';
|
Reader.Path := '';
|
||||||
Reader.Reset := true;
|
Reader.Reset := true;
|
||||||
Reader.Pos := 0;
|
Reader.Pos := 0;
|
||||||
|
|
|
@ -41,8 +41,8 @@ inloop: load r1, ffff
|
||||||
load r2, bfsize
|
load r2, bfsize
|
||||||
brneq r0, r2, chstor
|
brneq r0, r2, chstor
|
||||||
|
|
||||||
;Backtrack if at the buffer end
|
;Ignore the input and print an underscore if at the buffer end
|
||||||
load r2, #8
|
load r2, #5f
|
||||||
store ffff, r2
|
store ffff, r2
|
||||||
breq r0, r0, inloop
|
breq r0, r0, inloop
|
||||||
|
|
||||||
|
|
12
readme.md
12
readme.md
|
@ -97,7 +97,7 @@ Emulator and Tapectl
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
* emulator (-v) program (2> verbose_output)
|
* 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.
|
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
|
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
|
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)
|
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
|
8-bit paper tape reader and punch with the arguments -dprinter and
|
||||||
respectively. The printer is mapped to address FFFE and the tape reader
|
-dtape respectively. The printer is mapped to address FFFE and the tape
|
||||||
and punch to FFFD. The printer prints into /dev/usb/lp0 and the tape
|
reader and punch to FFFD. The printer prints into /dev/usb/lp0 and the
|
||||||
files read from and punched to are (re)set using the program tapectl
|
tape files read from and punched to are (re)set using the program
|
||||||
with the arguments -r and -p respectively.
|
tapectl with the arguments -r and -p respectively.
|
||||||
|
|
||||||
The IPL loads the program specified as an argument when running the
|
The IPL loads the program specified as an argument when running the
|
||||||
emulator.
|
emulator.
|
||||||
|
|
10
tapectl.pas
10
tapectl.pas
|
@ -21,11 +21,11 @@ begin
|
||||||
|
|
||||||
//Check the arguments
|
//Check the arguments
|
||||||
if ParamCount > 4 then begin
|
if ParamCount > 4 then begin
|
||||||
writeln ('Usage: tapectl (-r reader_file) (-p punch_file)');
|
writeln ('Usage: tapectl (-r tape) (-p tape)');
|
||||||
halt (1);
|
halt (1);
|
||||||
end
|
end
|
||||||
else if ParamCount mod 2 <> 0 then begin
|
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);
|
halt (1);
|
||||||
end;
|
end;
|
||||||
if ParamStr (1) = '-r' then begin
|
if ParamStr (1) = '-r' then begin
|
||||||
|
@ -41,15 +41,15 @@ begin
|
||||||
if ParamStr (3) = '-r' then DoRead := 4;
|
if ParamStr (3) = '-r' then DoRead := 4;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
writeln ('Usage: tapectl (-r reader_file) (-p punch_file)');
|
writeln ('Usage: tapectl (-r tape) (-p tape)');
|
||||||
halt (1);
|
halt (1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Assign the state file
|
//Assign the state file
|
||||||
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
|
assign (State, ExpandFileName ('~/.thingamajig/tapes'));
|
||||||
|
|
||||||
//Read existing state if any
|
//Read existing state if any
|
||||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
if FileExists (ExpandFileName ('~/.thingamajig/tapes')) then begin
|
||||||
try
|
try
|
||||||
reset (State);
|
reset (State);
|
||||||
read (State, Reader);
|
read (State, Reader);
|
||||||
|
|
Loading…
Reference in New Issue