Bodge together a fix for some keyboard-related quirks of the CRT unit in Linux

This commit is contained in:
CrazyEttin 2022-08-31 20:06:07 +03:00
parent 4f84079543
commit 39e273d575
2 changed files with 15 additions and 35 deletions

View File

@ -31,7 +31,7 @@ const
{$endif} {$endif}
var var
Hlt, ASCII, Verbose: boolean; //Halt, ASCII, and verbose flags Hlt, Verbose: boolean; //Halt, ASCII, and verbose flags
Op, Regs: 0 .. $f; //Opcode Op, Regs: 0 .. $f; //Opcode
X, Y: 0 .. 3; //Register arguments X, Y: 0 .. 3; //Register arguments
Addr, IP, RP: word; //Immediate or address argument and instruction and return pointers Addr, IP, RP: word; //Immediate or address argument and instruction and return pointers
@ -87,42 +87,22 @@ begin
wait; wait;
{$endif} {$endif}
//Read a keypress //Read a keypress
repeat
Ch := ReadKey; Ch := ReadKey;
//Check for non-ASCII keys //Handle non-character keys
if Ch = ansichar (0) then begin if Ch = ansichar (0) then begin
//Non-ASCII
if keypressed then begin
Scan := ReadKey;
//The delete key inserts the delete character
if Scan = ansichar ($53) then begin
Ch := ansichar ($7f);
ASCII := true;
end
//Unused function keys insert a null
else ASCII := true;
end
//Null
else ASCII := true;
end
//Other ASCII
else ASCII := true;
until ASCII = true;
//Bodge for the home and end keys
if Ch = ansichar ($37) then begin
if keypressed then begin if keypressed then begin
Scan := ReadKey; Scan := ReadKey;
Scan := ReadKey; //The delete key inserts the delete character
Scan := ReadKey; if Scan = ansichar ($53) then Ch := ansichar ($7f);
Ch := ansichar (0);
end; end;
end end
else if Ch = ansichar ($38) then begin //Bodge for the CRT unit not working perfectly in Linux
else if Ch <= ansichar ($7f) then begin
if keypressed then begin if keypressed then begin
Scan := ReadKey;
Scan := ReadKey;
Scan := ReadKey;
Ch := ansichar (0); Ch := ansichar (0);
repeat
scan := ReadKey;
until keypressed = false;
end; end;
end; end;
//Process the keypress //Process the keypress
@ -342,7 +322,7 @@ begin
while Hlt = false do begin while Hlt = false do begin
//Print the CPU state to StdErr //Print the CPU state to StdErr
if Verbose = true then writeln (StdErr, 'IR: ', IntToHex (Op, 1), IntToHex (Regs, 1), IntToHex (Addr, 4), '; IP: ', IntToHex (IP, 4), ', RP: ', IntToHex (RP, 4), '; R0: ', IntToHex (R[0], 2), ', R1: ', IntToHex (R[1], 2), ', R2: ', IntToHex (R[2], 2), ', R3: ', IntToHex (R[3], 2), ansichar ($d)); if Verbose = true then writeln (StdErr, 'IR: ', IntToHex (Op, 1), IntToHex (Regs, 1), IntToHex (Addr, 4), '; IP: ', IntToHex (IP, 4), ', RP: ', IntToHex (RP, 4), '; R0: ', IntToHex (R[0], 2), ', R1: ', IntToHex (R[1], 2), ', R2: ', IntToHex (R[2], 2), ', R3: ', IntToHex (R[3], 2), ansichar ($d));
//Fetch the instruction and increment the instruction pointer //Fetch the instruction and increment the instruction pointer
//Fetch the opcode and register arguments //Fetch the opcode and register arguments

View File

@ -100,10 +100,10 @@ of RAM respectively instead and the speed limitations can be removed
with the argument -dfast. with the argument -dfast.
Input and output are handled by an emulated glass teletype terminal with Input and output are handled by an emulated glass teletype terminal with
local echo. Note that of the control characters only bell, backspace, local echo. Of the control characters only bell, backspace, line feed,
line feed, and carriage return are used by the terminal, and the and carriage return are used by the terminal. The backspace and delete
backspace and delete keys are tied to their respective characters and characters are tied to their respective keys, and non-character keys
non-character keys to null. input 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