|
@@ -121,7 +121,7 @@ CONST
|
|
|
BI_ClrScr = 6 ; BI_GotoXY = 7 ; BI_LowVideo = 8 ;
|
|
BI_ClrScr = 6 ; BI_GotoXY = 7 ; BI_LowVideo = 8 ;
|
|
|
BI_NormVideo = 9 ; BI_ClrEol = 10 ; BI_Delay = 11 ;
|
|
BI_NormVideo = 9 ; BI_ClrEol = 10 ; BI_Delay = 11 ;
|
|
|
(* the sub-codes EmCrtSeq takes *)
|
|
(* the sub-codes EmCrtSeq takes *)
|
|
|
- CrtClr = 0 ; CrtDl = 1 ; CrtDh = 2 ; CrtCaret = 3 ;
|
|
|
|
|
|
|
+ CrtClr = 0 ; CrtDl = 1 ; CrtDh = 2 ; CrtCaret = 3 ; CrtEol = 4 ;
|
|
|
|
|
|
|
|
(* keyword tokens *)
|
|
(* keyword tokens *)
|
|
|
TkNone = 0 ; TkProgram = 1 ; TkBegin = 2 ; TkEnd = 3 ;
|
|
TkNone = 0 ; TkProgram = 1 ; TkBegin = 2 ; TkEnd = 3 ;
|
|
@@ -179,6 +179,7 @@ TYPE
|
|
|
arrIdx : CARDINAL ; (* an ARRAY type's shape in ArrRec (0 = no) *)
|
|
arrIdx : CARDINAL ; (* an ARRAY type's shape in ArrRec (0 = no) *)
|
|
|
parmFirst, parmCount : CARDINAL ; (* a PROCEDURE/FUNCTION's parameters:
|
|
parmFirst, parmCount : CARDINAL ; (* a PROCEDURE/FUNCTION's parameters:
|
|
|
symtab indices, in declaration order *)
|
|
symtab indices, in declaration order *)
|
|
|
|
|
+ isKbd : BOOLEAN ; (* the predefined KBD file: reads are console *)
|
|
|
level : CARDINAL ;
|
|
level : CARDINAL ;
|
|
|
local : BOOLEAN ;
|
|
local : BOOLEAN ;
|
|
|
resvar : CARDINAL ;
|
|
resvar : CARDINAL ;
|
|
@@ -1495,6 +1496,7 @@ BEGIN
|
|
|
e.arrIdx := 0 ;
|
|
e.arrIdx := 0 ;
|
|
|
e.parmFirst := 0 ;
|
|
e.parmFirst := 0 ;
|
|
|
e.parmCount := 0 ;
|
|
e.parmCount := 0 ;
|
|
|
|
|
+ e.isKbd := FALSE ;
|
|
|
e.level := lexnest ;
|
|
e.level := lexnest ;
|
|
|
e.local := local ;
|
|
e.local := local ;
|
|
|
e.resvar := 0 ;
|
|
e.resvar := 0 ;
|
|
@@ -3652,6 +3654,15 @@ BEGIN
|
|
|
ELSIF which = CrtDh THEN
|
|
ELSIF which = CrtDh THEN
|
|
|
Ebyte (48H) ; (* DEC AX *)
|
|
Ebyte (48H) ; (* DEC AX *)
|
|
|
Ebyte (88H) ; Ebyte (0C6H) (* MOV DH,AL *)
|
|
Ebyte (88H) ; Ebyte (0C6H) (* MOV DH,AL *)
|
|
|
|
|
+ ELSIF which = CrtEol THEN
|
|
|
|
|
+ Ebyte (0B4H) ; Ebyte (03H) ; (* MOV AH,03h get cursor *)
|
|
|
|
|
+ Ebyte (0B7H) ; Ebyte (00H) ; (* MOV BH,00h *)
|
|
|
|
|
+ Ebyte (0CDH) ; Ebyte (10H) ; (* INT 10h -> DH,DL *)
|
|
|
|
|
+ Ebyte (89H) ; Ebyte (0D1H) ; (* MOV CX,DX upper-left *)
|
|
|
|
|
+ Ebyte (0B2H) ; Ebyte (4FH) ; (* MOV DL,4Fh col 79 *)
|
|
|
|
|
+ Ebyte (0B8H) ; Ebyte (00H) ; Ebyte (06H) ; (* MOV AX,0600h blank *)
|
|
|
|
|
+ Ebyte (0B7H) ; Ebyte (07H) ; (* MOV BH,07h attribute *)
|
|
|
|
|
+ Ebyte (0CDH) ; Ebyte (10H) (* INT 10h *)
|
|
|
ELSE
|
|
ELSE
|
|
|
Ebyte (0B4H) ; Ebyte (02H) ; (* MOV AH,02h *)
|
|
Ebyte (0B4H) ; Ebyte (02H) ; (* MOV AH,02h *)
|
|
|
Ebyte (0B7H) ; Ebyte (00H) ; (* MOV BH,00h *)
|
|
Ebyte (0B7H) ; Ebyte (00H) ; (* MOV BH,00h *)
|
|
@@ -3674,6 +3685,7 @@ VAR arg : ERes ;
|
|
|
nArgs, ent, which, acls : CARDINAL ;
|
|
nArgs, ent, which, acls : CARDINAL ;
|
|
|
reading : BOOLEAN ;
|
|
reading : BOOLEAN ;
|
|
|
pushed : BOOLEAN ;
|
|
pushed : BOOLEAN ;
|
|
|
|
|
+ skipArg : BOOLEAN ;
|
|
|
n : CARDINAL ;
|
|
n : CARDINAL ;
|
|
|
dummy : ERes ;
|
|
dummy : ERes ;
|
|
|
BEGIN
|
|
BEGIN
|
|
@@ -3690,6 +3702,13 @@ BEGIN
|
|
|
EmCrtSeq (CrtClr) ;
|
|
EmCrtSeq (CrtClr) ;
|
|
|
RETURN
|
|
RETURN
|
|
|
END ;
|
|
END ;
|
|
|
|
|
+ IF which = BI_ClrEol THEN
|
|
|
|
|
+ (* clear from the cursor to the end of the line - a real INT 10h call,
|
|
|
|
|
+ not a no-op: AH=03 reads the cursor, CX := it, DL := 79, AH=06 blanks
|
|
|
|
|
+ that window. *)
|
|
|
|
|
+ EmCrtSeq (CrtEol) ;
|
|
|
|
|
+ RETURN
|
|
|
|
|
+ END ;
|
|
|
IF which = BI_GotoXY THEN
|
|
IF which = BI_GotoXY THEN
|
|
|
(* GotoXY (x, y): 1-based; evaluate x first and park it, then y, so the
|
|
(* GotoXY (x, y): 1-based; evaluate x first and park it, then y, so the
|
|
|
code for y cannot clobber DL. *)
|
|
code for y cannot clobber DL. *)
|
|
@@ -3715,7 +3734,7 @@ BEGIN
|
|
|
RETURN
|
|
RETURN
|
|
|
END ;
|
|
END ;
|
|
|
IF (which = BI_LowVideo) OR (which = BI_NormVideo) OR
|
|
IF (which = BI_LowVideo) OR (which = BI_NormVideo) OR
|
|
|
- (which = BI_ClrEol) OR (which = BI_Delay) THEN
|
|
|
|
|
|
|
+ (which = BI_Delay) THEN
|
|
|
(* Catalogued, and LOUD. Their screen behaviour is a later question
|
|
(* Catalogued, and LOUD. Their screen behaviour is a later question
|
|
|
(CALC-COMPILE.md Stage 14: a compiling CALC needs them to resolve, a
|
|
(CALC-COMPILE.md Stage 14: a compiling CALC needs them to resolve, a
|
|
|
RUNNING one needs them right), but a silent no-op would be exactly the
|
|
RUNNING one needs them right), but a silent no-op would be exactly the
|
|
@@ -3757,6 +3776,26 @@ BEGIN
|
|
|
the whole list first and emitting afterwards printed the first
|
|
the whole list first and emitting afterwards printed the first
|
|
|
argument as the last argument's value, and pushed an argument
|
|
argument as the last argument's value, and pushed an argument
|
|
|
that an earlier inline string's call had already overwritten. *)
|
|
that an earlier inline string's call had already overwritten. *)
|
|
|
|
|
+ skipArg := FALSE ;
|
|
|
|
|
+ IF (nArgs = 0) AND ((arg.cls = TText) OR (arg.cls = TFile)) THEN
|
|
|
|
|
+ (* A leading FILE argument: `Read(Kbd, Ch)'. KBD is the console
|
|
|
|
|
+ keyboard and this runtime's read entries already read the
|
|
|
|
|
+ console, so the file is dropped and the rest of the argument
|
|
|
|
|
+ list is read exactly as without it. A real file is not
|
|
|
|
|
+ implemented yet - loud, rather than silently reading the file
|
|
|
|
|
+ variable as a data argument. *)
|
|
|
|
|
+ IF reading AND (arg.kind = 1) AND symtab [arg.idx].isKbd THEN
|
|
|
|
|
+ IF NOT MatchDelim (',') THEN
|
|
|
|
|
+ Err (ENoSemi) ;
|
|
|
|
|
+ RETURN
|
|
|
|
|
+ END ;
|
|
|
|
|
+ skipArg := TRUE
|
|
|
|
|
+ ELSE
|
|
|
|
|
+ Err (ENoLib) ;
|
|
|
|
|
+ RETURN
|
|
|
|
|
+ END
|
|
|
|
|
+ END ;
|
|
|
|
|
+ IF NOT skipArg THEN
|
|
|
pushed := TRUE ; (* default: value is on the stack -> call + pop *)
|
|
pushed := TRUE ; (* default: value is on the stack -> call + pop *)
|
|
|
IF reading THEN
|
|
IF reading THEN
|
|
|
IF (arg.kind # 1) AND (arg.kind # 5) THEN
|
|
IF (arg.kind # 1) AND (arg.kind # 5) THEN
|
|
@@ -3888,9 +3927,12 @@ BEGIN
|
|
|
DropC (EmCall (ent)) ;
|
|
DropC (EmCall (ent)) ;
|
|
|
EmAddSp (2) (* one 16-bit argument *)
|
|
EmAddSp (2) (* one 16-bit argument *)
|
|
|
END ;
|
|
END ;
|
|
|
- INC (nArgs) ;
|
|
|
|
|
- IF NOT MatchDelim (',') THEN
|
|
|
|
|
- EXIT
|
|
|
|
|
|
|
+ INC (nArgs)
|
|
|
|
|
+ END ;
|
|
|
|
|
+ IF NOT skipArg THEN
|
|
|
|
|
+ IF NOT MatchDelim (',') THEN
|
|
|
|
|
+ EXIT
|
|
|
|
|
+ END
|
|
|
END
|
|
END
|
|
|
END ;
|
|
END ;
|
|
|
IF NOT MatchDelim (')') THEN
|
|
IF NOT MatchDelim (')') THEN
|
|
@@ -5213,7 +5255,12 @@ BEGIN
|
|
|
i := NewSym ("CLREOL" , KBuiltin, BI_ClrEol , 0, 0, 0, 0, FALSE) ;
|
|
i := NewSym ("CLREOL" , KBuiltin, BI_ClrEol , 0, 0, 0, 0, FALSE) ;
|
|
|
symtab [i].defnd := TRUE ;
|
|
symtab [i].defnd := TRUE ;
|
|
|
i := NewSym ("DELAY" , KBuiltin, BI_Delay , 0, 0, 0, 0, FALSE) ;
|
|
i := NewSym ("DELAY" , KBuiltin, BI_Delay , 0, 0, 0, 0, FALSE) ;
|
|
|
- symtab [i].defnd := TRUE
|
|
|
|
|
|
|
+ symtab [i].defnd := TRUE ;
|
|
|
|
|
+ (* KBD: the console keyboard as a TEXT file. This runtime's read entries
|
|
|
|
|
+ already read the console, so `Read(Kbd, Ch)' drops the file argument and
|
|
|
|
|
+ reads a character exactly as `Read(Ch)' does. *)
|
|
|
|
|
+ i := NewSym ("KBD", KVar, TText, FileVarSize, 1, 0, 0, FALSE) ;
|
|
|
|
|
+ symtab [i].isKbd := TRUE
|
|
|
END DefBuiltins ;
|
|
END DefBuiltins ;
|
|
|
|
|
|
|
|
PROCEDURE Inittur () ;
|
|
PROCEDURE Inittur () ;
|