Add a compiling option to remove speed limitations
This commit is contained in:
parent
6d14b9a5bf
commit
2818ea170e
21
emulator.pas
21
emulator.pas
|
@ -15,8 +15,7 @@ type
|
|||
{$endif}
|
||||
|
||||
const
|
||||
IO = $ffff;
|
||||
LastRAM = $ffef;
|
||||
LastRAM = $ffef; //The last address of RAM
|
||||
|
||||
var
|
||||
Hlt, ASCII, Verbose: boolean; //Halt, ASCII, and verbose flags
|
||||
|
@ -55,12 +54,14 @@ begin
|
|||
end;
|
||||
|
||||
//Wait to emulate CPU speed of ~500 KIPS
|
||||
{$ifndef fast}
|
||||
procedure wait;
|
||||
begin
|
||||
if IC div 500 = 0 then sleep (1)
|
||||
else sleep (IC div 500);
|
||||
IC := 0;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
//Load a byte from memory
|
||||
function LoadByte (W: word): byte;
|
||||
|
@ -68,8 +69,10 @@ var
|
|||
B: byte;
|
||||
begin
|
||||
//Terminal input
|
||||
if W = IO then begin
|
||||
if W = $ffff then begin
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
//Read a keypress
|
||||
repeat
|
||||
Ch := ReadKey;
|
||||
|
@ -116,7 +119,9 @@ begin
|
|||
//Tape reader
|
||||
{$ifdef tape}
|
||||
else if W = $fffd then begin
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
|
||||
//Check the reader state
|
||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
||||
|
@ -162,15 +167,19 @@ end;
|
|||
procedure StoreByte (W: word; B: byte);
|
||||
begin
|
||||
//Terminal output
|
||||
if W = IO then begin
|
||||
if W = $ffff then begin
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
Ch := ansichar (B);
|
||||
Output;
|
||||
end
|
||||
//Printer
|
||||
{$ifdef printer}
|
||||
else if W = $fffe then begin
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
assign (Prn, '/dev/usb/lp0');
|
||||
try
|
||||
rewrite (Prn);
|
||||
|
@ -183,7 +192,9 @@ begin
|
|||
//Tape punch
|
||||
{$ifdef tape}
|
||||
else if W = $fffd then begin
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
assign (State, ExpandFileName ('~/.tapes.thingamajig'));
|
||||
//Check the punch state
|
||||
if FileExists (ExpandFileName ('~/.tapes.thingamajig')) then begin
|
||||
|
@ -413,6 +424,8 @@ begin
|
|||
|
||||
end;
|
||||
|
||||
{$ifndef fast}
|
||||
wait;
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
|
16
readme.md
16
readme.md
|
@ -92,14 +92,16 @@ uninitialised.
|
|||
Emulator
|
||||
--------
|
||||
|
||||
The emulator runs at roughly 500 KIPS and has the full 65520 bytes of
|
||||
RAM.
|
||||
The emulator runs at roughly 500 KIPS, has the full 65520 bytes of 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
|
||||
teletype terminal with local echo. Note that of the control characters
|
||||
only bell, backspace, line feed, and carriage return are used by the
|
||||
terminal, and the backspace and delete keys are tied to their respective
|
||||
characters and non-character keys to null.
|
||||
Input and output are handled by an emulated glass teletype terminal with
|
||||
local echo. Note that of the control characters only bell, backspace,
|
||||
line feed, and carriage return are used by the terminal, and the
|
||||
backspace and delete keys are tied to their respective characters and
|
||||
non-character keys to null.
|
||||
|
||||
In Linux the emulator can be compiled with support for a character
|
||||
printer and an emulated punched tape reader and punch with the arguments
|
||||
|
|
Loading…
Reference in New Issue