CP/M User
Veteran Member
krebizfan wrote:
IIRC, the OpenGEM collection includes Locomotive Basic along with all the other GEM software allowed to be freely distributed now.
From that point of view that's good. Cause it's been so long since I've used it, I cannot remember if it was an Interpreted BASIC like the earlier versions, or if it could Compile Legitimate Executable Programs for GEM.
deathshadow wrote:
That's typical of inkey$ in all basic flavors, and the keyboard handling in pascal dialects too as TP4/later uses keypressed/readkey and tp3/earlier use keywaiting and read -- all of which basically wrap the DOS interrupts.
TP3 actually has Keypressed, Appendix K of the Turbo Pascal 3 manual explains Keyboard Return Codes and has this routine:
BUT -- there is a trick... paku paku for example uses int $21 for the keyboard having all those same 'problems' of press a key, move once, hold the key and you have to wait for the key-repeat. The trick? when they press the direction key just set the direction and do NOT stop moving until they hit something (like a wall) or another valid direction. If you read the keyboard often enough (your main untimed loop) you can trap all keypresses and keep the buffer clear... and the user is none-the wiser.
int $21 being the DOS specific Interrupt. This was the Readkey routine I came across which I could use in CP/M-86, from memory though I cannot remember how quick it would act, though it works due to it using Hardware Interrupt $16.
IIRC, the OpenGEM collection includes Locomotive Basic along with all the other GEM software allowed to be freely distributed now.
From that point of view that's good. Cause it's been so long since I've used it, I cannot remember if it was an Interpreted BASIC like the earlier versions, or if it could Compile Legitimate Executable Programs for GEM.
deathshadow wrote:
That's typical of inkey$ in all basic flavors, and the keyboard handling in pascal dialects too as TP4/later uses keypressed/readkey and tp3/earlier use keywaiting and read -- all of which basically wrap the DOS interrupts.
TP3 actually has Keypressed, Appendix K of the Turbo Pascal 3 manual explains Keyboard Return Codes and has this routine:
Code:
if KeyPressed then
begin
Read(Kbd,Ch) { ch is char }
if (ch=#27) and keypressed then { one more char? }
begin
Read(Kbd,Ch)
FuncKey := True; { FuncKey is Boolean }
end
end;
BUT -- there is a trick... paku paku for example uses int $21 for the keyboard having all those same 'problems' of press a key, move once, hold the key and you have to wait for the key-repeat. The trick? when they press the direction key just set the direction and do NOT stop moving until they hit something (like a wall) or another valid direction. If you read the keyboard often enough (your main untimed loop) you can trap all keypresses and keep the buffer clear... and the user is none-the wiser.
int $21 being the DOS specific Interrupt. This was the Readkey routine I came across which I could use in CP/M-86, from memory though I cannot remember how quick it would act, though it works due to it using Hardware Interrupt $16.
Code:
CONST PendingKey : BYTE = 0;
TYPE Registers = Record
CASE Integer Of
1 : (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer);
2 : (AL,AH,BL,BH,CL,CH,DL,DH : Byte);
END;
FUNCTION ReadKey : Char;
VAR Regs : Registers;
BEGIN
IF PendingKey<>0 THEN BEGIN
ReadKey:=CHR(PendingKey);
PendingKey:=0;
END
ELSE BEGIN
Regs.AH:=0;
INTR($16,Regs);
IF Regs.AL=0 THEN PendingKey:=Regs.AH;
ReadKey:=CHR(Regs.AL);
END;
END;