• Please review our updated Terms and Rules here

ASCII Video game

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:

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;
 
It appears he was misunderstood. He had seen a CP/M game which he liked to make his own version of, not necessarily running in CP/M. I haven't checked how close FreeBASIC is to the classic dialects, i.e. if skills gained from learning that language will be easily transferred to other, older systems. If it contains very many powerful features, it can simplify the programming task but make it a bigger step to go back to some vintage interpreter. The same probably is true for the compiled CP/M cBasic mentioned above: very useful but may make the developer dependable on features not found elsewhere. If multiple formats are not desired, it won't be a problem of course.

FB has a 100% (well, 99.99999%) QB-compatible compile mode, if you use the -lang qb option

or you can put #lang "qb" on the top of the .bas file.
 
Back
Top