Add a compiling option to remove speed limitations

This commit is contained in:
CrazyEttin 2022-08-26 19:49:58 +03:00
parent 6d14b9a5bf
commit 2818ea170e
2 changed files with 26 additions and 11 deletions

View File

@ -15,8 +15,7 @@ type
{$endif} {$endif}
const const
IO = $ffff; LastRAM = $ffef; //The last address of RAM
LastRAM = $ffef;
var var
Hlt, ASCII, Verbose: boolean; //Halt, ASCII, and verbose flags Hlt, ASCII, Verbose: boolean; //Halt, ASCII, and verbose flags
@ -55,12 +54,14 @@ begin
end; end;
//Wait to emulate CPU speed of ~500 KIPS //Wait to emulate CPU speed of ~500 KIPS
{$ifndef fast}
procedure wait; procedure wait;
begin begin
if IC div 500 = 0 then sleep (1) if IC div 500 = 0 then sleep (1)
else sleep (IC div 500); else sleep (IC div 500);
IC := 0; IC := 0;
end; end;
{$endif}
//Load a byte from memory //Load a byte from memory
function LoadByte (W: word): byte; function LoadByte (W: word): byte;
@ -68,8 +69,10 @@ var
B: byte; B: byte;
begin begin
//Terminal input //Terminal input
if W = IO then begin if W = $ffff then begin
{$ifndef fast}
wait; wait;
{$endif}
//Read a keypress //Read a keypress
repeat repeat
Ch := ReadKey; Ch := ReadKey;
@ -116,7 +119,9 @@ begin
//Tape reader //Tape reader
{$ifdef tape} {$ifdef tape}
else if W = $fffd then begin else if W = $fffd then begin
{$ifndef fast}
wait; wait;
{$endif}
assign (State, ExpandFileName ('~/.tapes.thingamajig')); assign (State, ExpandFileName ('~/.tapes.thingamajig'));
//Check the reader state //Check the reader state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
@ -162,15 +167,19 @@ end;
procedure StoreByte (W: word; B: byte); procedure StoreByte (W: word; B: byte);
begin begin
//Terminal output //Terminal output
if W = IO then begin if W = $ffff then begin
{$ifndef fast}
wait; wait;
{$endif}
Ch := ansichar (B); Ch := ansichar (B);
Output; Output;
end end
//Printer //Printer
{$ifdef printer} {$ifdef printer}
else if W = $fffe then begin else if W = $fffe then begin
{$ifndef fast}
wait; wait;
{$endif}
assign (Prn, '/dev/usb/lp0'); assign (Prn, '/dev/usb/lp0');
try try
rewrite (Prn); rewrite (Prn);
@ -183,7 +192,9 @@ begin
//Tape punch //Tape punch
{$ifdef tape} {$ifdef tape}
else if W = $fffd then begin else if W = $fffd then begin
{$ifndef fast}
wait; wait;
{$endif}
assign (State, ExpandFileName ('~/.tapes.thingamajig')); assign (State, ExpandFileName ('~/.tapes.thingamajig'));
//Check the punch state //Check the punch state
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
@ -413,6 +424,8 @@ begin
end; end;
{$ifndef fast}
wait; wait;
{$endif}
end. end.

View File

@ -92,14 +92,16 @@ uninitialised.
Emulator Emulator
-------- --------
The emulator runs at roughly 500 KIPS and has the full 65520 bytes of The emulator runs at roughly 500 KIPS, has the full 65520 bytes of RAM,
RAM. and interacts with memory mapped devices at roughly 1000 CPS. The speed
limitations can be removed by compiling the emulator with the argument
-dfast.
Input and output are handled by an emulated roughly 1000 CPS glass Input and output are handled by an emulated glass teletype terminal with
teletype terminal with local echo. Note that of the control characters local echo. Note that of the control characters only bell, backspace,
only bell, backspace, line feed, and carriage return are used by the line feed, and carriage return are used by the terminal, and the
terminal, and the backspace and delete keys are tied to their respective backspace and delete keys are tied to their respective characters and
characters and non-character keys to null. non-character keys to 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 punched tape reader and punch with the arguments printer and an emulated punched tape reader and punch with the arguments