Enforce the emulated terminal being dumb, rename settape to tape, and reword the readme slightly

This commit is contained in:
CrazyEttin 2022-08-21 10:27:02 +03:00
parent 816d50df34
commit 6c2f866b01
3 changed files with 28 additions and 13 deletions

View File

@ -31,6 +31,22 @@ var
{$endif}
Ch, Scan: ansichar; //Character for input and output and scancode for non-ASCII keys
//Terminal output
procedure Output;
begin
//Do not output most of the control codes
if Ch <= ansichar ($1f) then begin
if Ch = ansichar (7) then write (Ch) //Bell
else if Ch = ansichar (8) then write (Ch) //Backspace
else if Ch = ansichar ($a) then write (Ch) //Line feed
else if Ch = ansichar ($d) then write (Ch) //Carriage return
else write (''); //Others
end
else if Ch = ansichar ($7f) then write ('') //Delete
//Output all regular characters
else write (Ch);
end;
begin
//Initialise the halt flag and the pointers
@ -187,7 +203,7 @@ begin
end;
end;
//Process the keypress
write (Ch); //Local echo
Output; //Local echo
R [X] := byte (Ch);
end
//Tape reader
@ -225,7 +241,6 @@ begin
except
end;
end;
end
{$endif}
//Regular load
@ -236,7 +251,7 @@ begin
//Terminal output
if Addr = IO then begin
Ch := ansichar (R [X]);
write (Ch);
Output;
end
//Printer
{$ifdef printer}

View File

@ -87,7 +87,7 @@ Memory-Mapped Devices
---------------------
Input (when read from) and output (when written to) are mapped to
address FFFF. The emulator emulates a dumb terminal with local echo.
address FFFF. The emulator emulates a glass teletype with local echo.
Arbitrary devices can be mapped to the other reserved addresses.
@ -96,13 +96,13 @@ and an emulated punched 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 settape program. If you wish to use a different setup you have
to modify the code yourself.
using the program tape. If you wish to use a different setup you have to
modify the code yourself.
Initial Program Loader
----------------------
At boot the initial program loader loads a program to the memory
starting from address 0 after which is cedes control to the CPU. The
emulator loads the program from a file.
emulator loads the program from a ROM file.


View File

@ -1,4 +1,4 @@
program Settape;
program Tape;
{$MODE OBJFPC}
@ -6,22 +6,22 @@ uses SysUtils;
type
//Tape file path and reset state
Tape = record
TapeState = record
Path: shortstring;
Reset: boolean;
Pos: integer;
end;
var
Reader, Punch: Tape; //States of the reader and punch
State: file of Tape; //File storing the states of the reader and punch
Reader, Punch: TapeState; //States of the reader and punch
State: file of TapeState; //File storing the states of the reader and punch
DoRead, DoPunch: boolean; //Whether to reset the reader or the punch
begin
//Check whether to set the reader, the punch, or both
if ParamCount <> 1 then begin
writeln ('Usage: settape reader/punch/both');
writeln ('Usage: tape reader/punch/both');
halt;
end;
if ParamStr (1) = 'reader' then begin
@ -37,7 +37,7 @@ begin
DoPunch := true;
end
else begin
writeln ('Usage: settape reader/punch/both');
writeln ('Usage: tape reader/punch/both');
halt;
end;