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} {$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
//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 begin
//Initialise the halt flag and the pointers //Initialise the halt flag and the pointers
@ -187,7 +203,7 @@ begin
end; end;
end; end;
//Process the keypress //Process the keypress
write (Ch); //Local echo Output; //Local echo
R [X] := byte (Ch); R [X] := byte (Ch);
end end
//Tape reader //Tape reader
@ -225,7 +241,6 @@ begin
except except
end; end;
end; end;
end end
{$endif} {$endif}
//Regular load //Regular load
@ -236,7 +251,7 @@ begin
//Terminal output //Terminal output
if Addr = IO then begin if Addr = IO then begin
Ch := ansichar (R [X]); Ch := ansichar (R [X]);
write (Ch); Output;
end end
//Printer //Printer
{$ifdef printer} {$ifdef printer}

View File

@ -87,7 +87,7 @@ Memory-Mapped Devices
--------------------- ---------------------
Input (when read from) and output (when written to) are mapped to 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. 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 -dprinter and -dtape respectively. The printer is mapped to address FFFE
and the tape reader and punch to FFFD. The printer prints into 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 /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 using the program tape. If you wish to use a different setup you have to
to modify the code yourself. modify the code yourself.
Initial Program Loader Initial Program Loader
---------------------- ----------------------
At boot the initial program loader loads a program to the memory 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 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} {$MODE OBJFPC}
@ -6,22 +6,22 @@ uses SysUtils;
type type
//Tape file path and reset state //Tape file path and reset state
Tape = record TapeState = record
Path: shortstring; Path: shortstring;
Reset: boolean; Reset: boolean;
Pos: integer; Pos: integer;
end; end;
var var
Reader, Punch: Tape; //States of the reader and punch Reader, Punch: TapeState; //States of the reader and punch
State: file of Tape; //File storing the 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 DoRead, DoPunch: boolean; //Whether to reset the reader or the punch
begin begin
//Check whether to set the reader, the punch, or both //Check whether to set the reader, the punch, or both
if ParamCount <> 1 then begin if ParamCount <> 1 then begin
writeln ('Usage: settape reader/punch/both'); writeln ('Usage: tape reader/punch/both');
halt; halt;
end; end;
if ParamStr (1) = 'reader' then begin if ParamStr (1) = 'reader' then begin
@ -37,7 +37,7 @@ begin
DoPunch := true; DoPunch := true;
end end
else begin else begin
writeln ('Usage: settape reader/punch/both'); writeln ('Usage: tape reader/punch/both');
halt; halt;
end; end;