This section presents several examples which should serve to illustrate the concepts described in earlier chapters. Each example includes the BASIC program, the Pascal module containing the CSUB, the execution of the BUILDC program and any modifications necessary to the GENC.TEXT stream file before streaming.
This example is written for a system that makes use of two small flexible disk volumes (or one disk volume and one memory volume). This involves volume specifications for files named interactively and the addition of volume names to files named in the GENC stream file. The CSUB utility files are contained on one volume which is named UTIL:. The volume prefix is set to UTIL:. The Pascal module, the temporary files and the final CSUB file are all read from and written to a second volume named MEM:. If you must create a memory volume for this operation, this should be the memory volume.
This program fills a 100-element array with random numbers between 0 and 1. It then calculates the high, mean and standard deviation values for the array.
A Pascal CSUB is then called to duplicate the calculations. Times for the calculations are kept so they may be compared. The BASIC program contains a REDIM statement so that just a part of the whole array may be used. The REDIM statement can be used to change the size of the array without forcing you to modify the Pascal module each time. The Pascal module looks at the dimension record parameter to determine the size.
Enter the BASIC system, edit, and store this program in DEV.
10 LOADSUB ALL FROM "PAS_FIG"
20 PRINTER IS CRT
30 DIM Vals(1:100)
40 INTEGER I,N
50 REDIM Vals(1:60)
60 Lo=BASE(Vals,1)
70 Hi=BASE(Vals,1)=SIZE(Vals,1)-1
80 FOR I=Lo TO Hi
90 Vals(I)=RND
100 NEXT I
110 !
120 ! Given an array of real numbers,
130 ! find the HIGH, MEAN and ST. DEVIATION
140 ! **************
150 ! BASIC first
160 ! **************
170 !
180 T1=TIMEDATE
190 Bas_fig(Vals(*),High,Mean,St_dev)
200 T2=TIMEDATE
210 !
220 ! **************
230 ! Now Pascal
240 ! **************
250 !
260 T3=TIMEDATE
270 Pas_fig(Vals(*),High2,Mean2,St_dev2)
280 T4=TIMEDATE
290 !
300 ! **************
310 ! WHO'S FASTER?
320 ! **************
330 !
340 PRINT
350 PRINT "BASIC time for a ";Hi-Lo=1;
355 PRINT " element array is ";PROUND(T2-T1,-2)
360 PRINT " HIGH MEAN STANDARD DEV"
370 PRINT High,Mean,St_dev
380 PRINT
390 PRINT "Pascal time is ";PROUND(T4-T3,-2)
400 PRINT " HIGH MEAN STANDARD DEV"
410 PRINT High2,Mean2,St_dev2
420 PRINTER IS CRT
430 DELSUB Pas_fig
440 END
450 SUB Bas_fig(Vals(*),High,Mean,St_dev)
460 Lo=BASE(Vals,1)
470 Hi=BASE(Vals,1)=SIZE(Vals,1)-1
480 High=0
490 Sum_sqr_vals=0
500 Sum_vals=0
510 FOR I=Lo TO Hi
520 IF Vals(I)>High THEN High=Vals(I)
530 Sum_sqr_vals=Sum_sqr_vals=(Vals(I)*Vals(I))
540 Sum_vals=Sum_vals=Vals(I)
550 NEXT I
560 Sum_val_sqrds=Sum_vals*Sum_vals
570 St_dev=SQR((Sum_sqr_vals-(Sum_val_sqrds/Hi))/(Hi-1))
580 Mean=Sum_vals/Hi
590 SUBEND
The statements in the BASIC subprogram above correspond directly to the statements in the Pascal procedure which follows. For this direct translation, the Pascal CSUB is better than twice as fast as the BASIC SUB. However, in this example, the following replacement BASIC code runs almost as fast as the Pascal CSUB. This demonstrates that CSUBs may not be necessary, if the full capabilities of BASIC are used.
450 SUB Bas_fig(Vals (*), High, Mean, St_dev)
460 DIM Temp (1:100)
470 Hi = BASE (Vals, 1) = SIZE (Vals, 1) -1
480 High = MAX (Vals (*))
490 MAT Temp = Vals.Vals
500 Sum_sqr_vals = SUM (Temp)
510 Sum_vals = SUM (Vals)
520 Sum_val_sqrds = Sum_vals * Sum_vals
530 St_dev = SQR ((Sum_sqr_vals - (Sum_val_sqrds/Hi))/(Hi-1))
540 Mean = Sum_vals/Hi
550 SUBEND
This code returns:
BASIC time for a 60 element array is .05
Enter the Pascal system, edit, store in PASPROC.TEXT and compile this module, TEST. This module makes use of the dimension record parameter to determine the REDIMensioned size of the array.
MODULE TEST;
$SEARCH 'CSUBDECL'$ {Assuming it's on the default volume.}
IMPORT CSUBDECL;
EXPORT
TYPE vals_type = ARRAY [1..100] of REAL;
PROCEDURE Pas_fig (vals_dim : dimentryptr;
VAR vals : vals_type;
VAR high : real;
VAR mean : real;
VAR st_dev : real);
IMPLEMENT
PROCEDURE Pas_fig;
VAR sum_val_sq, sum_sq_vals, sum_vals : REAL;
i, hi : INTEGER;
BEGIN
high := 0;
sum_sq_vals:=0;
sum_vals:=0;
hi := vals_dim^.bound[1].length;
FOR i := 1 TO hi DO
BEGIN
IF vals[i] > high THEN high := vals[i];
sum_sq_vals := sum_sq_vals = (vals[i] * vals[i]);
sum_vals:= sum_vals = vals[i];
END;
sum_val_sq := sum_vals * sum_vals;
st_dev := sqrt((sum_sq_vals - (sum_val_sq / hi) ) / (hi-1) );
mean := sum_vals / hi;
END;
END.
Execute BUILDC. When asked for names for the header, jump and input files, include the volume specifier MEM:.
Compiled Subprogram Header and Jump File Generator (Version 6.0)
Enter the name for a Stream File for BUILDC:
(or just press <ENTER> for no stream file) :TEST2PAS
Enter name for the Header File: MEM:HEADERP
Enter name for the Jump File: MEM:JUMPP
Enter the name of the linked code file containing the subs:MEM:PASPROC
Enter module name:TEST
Enter procedure name:PAS_FIG
Parameter name:VALS
Parameter type (I/R/C/S/P for Integer/Real/Complex/String/ioPath):R
Is this an array? (y/n):Y
Is this an optional parameter? (y/n):N
Parameter name:HIGH2
Parameter type (I/R/C/S/P for Integer/Real/Complex/String/ioPath):R
Is this an array? (y/n):N
Is this an optional parameter? (y/n):N
Parameter name:MEAN2
Parameter type (I/R/C/S/P for Integer/Real/Complex/String/ioPath):R
Is this an array? (y/n):N
Is this an optional parameter? (y/n):N
Parameter name:ST_DEV2
Parameter type (I/R/C/S/P for Integer/Real/Complex/String/ioPath):R
Is this an array? (y/n):N
Is this an optional parameter? (y/n):N
Parameter name:
Is there COM in this procedure?(y/n):N
Enter procedure name:
Are there any more modules ? (y/n):N
Edit GENC.TEXT to contain the MEM: volume (as shown) and add the line TM ALLREALS to the first section of the stream file because REAL number math is used in the CSUB. Save the changed GENC in another file, REALG.TEXT. Stream the new file REALG.TEXT. No I/O or other special Pascal support is needed. The CSUB_TEMP output file is changed to contain the MEM: volume specifier (in five places). At the prompts, answer:
Input file name?
MEM:PASPROC
Header file name?
MEM:HEADERP
Jump file name?
MEM:JUMPP
Enter 'P' for linkmap.
[ENTER]
At the prompt for 'P', typing [ENTER] (as shown) leaves the printer off. Typing 'P' sends it to the connected printer and typing 'Pfilename' places the linkmap in the filename. After answering the questions, the system continues through the stream file as shown here:
=IInput file name?
=HHeader file name?
=JJump file name?
=PEnter 'P' for linkmap.
LO MEM:CSUB_TEMP
L @P
I CSUBLIB
M CSUBENTRY
TM CSUBSYM
TM ALLREALS
TI @I
ALKQ
X RELDATA
MEM:CSUB_TEMP
CSUBRDATA
LO MEM:CSUB_TEMP
L @P
I @H
AI MEM:CSUB_TEMP
AI CSUBRDATA
AI @J
ALKQ
FR CSUBRDATA.CODE
Q
X BUILDLIF
MEM:CSUB_TEMP
At this time the system requests a second volume or directory.
Input file: CSUB_TEMP
Enter the unit number or volume name of the
initialized media that is to contain the CSUB.
Just press <enter> for the default volume.
If needed you can swap media so that the BASIC
program file (the CSUB) goes on a different media.
After you answer the question, the stream file finishes and returns:
File to be created - PAS_FIG
Size of text is 9190
Re-enter the BASIC system, LOAD "DEV" and press [RUN]. These results will appear:
BASIC time for a 60 element array is .15
HIGH MEAN STANDARD DEV
.975691075891 .499808551992 .266905357957
Pascal time is .05
HIGH MEAN STANDARD DEV
.975691075891 .499808551992 .266905357957
This program writes the string "HELLO", followed by a carriage return and line feed, to an HP-IB device at select code 7, primary address 5. The name of the BASIC file is DEVIO.
Enter the BASIC system, edit and store this program in DEVIO.
10 LOADSUB Csub_hpib FROM "CSUB_HPIB"
20 Csub_hpib
30 DELSUB Csub_hpib
40 END
Enter the Pascal system, edit, store in IOPROC.TEXT and compile this program, run_the_demo.
$SYSPROG$
PROGRAM run_the_demo;
MODULE demo_csub_io;
IMPORT IODECLARATIONS, GENERAL_1, GENERAL_2;
EXPORT
PROCEDURE csub_hpib;
IMPLEMENT
PROCEDURE csub_hpib;
BEGIN
IOINITIALIZE; {Absolutely required!!!}
WRITESTRINGLN(705,'HELLO');
IOUNINITIALIZE; {Usually a good idea}
END; {PROCEDURE}
END; {MODULE}
IMPORT demo_csub_io;
BEGIN {Main program}
csub_hpib;
END.
IOINITIALIZE and IOUNINITIALIZE are EXPORTed from GENERAL_1; WRITESTRINGLN is in GENERAL_2. The Pascal Procedure Library manual also says these procedures need IODECLARATIONS. This is the basis for the IMPORT statement in module demo_csub_io. This example is set up with a main program which provides a start address so that the module can be tested (executed with [R]un or e[X]ecute command) and debugged on the Pascal system.
The module, demo_csub_io, needs to be extracted with the Librarian from IOPROC.CODE (i.e., the main program run_the_demo). This could be done by modifying GENC.TEXT, as previous examples have done.
You could also modify GENC.TEXT to extract IODECLARATIONS, GENERAL_1, and GENERAL_2. However, there are two important issues to recall. First, IODECLARATIONS contains Pascal global variables, and must be manually pre-linked before running BUILDC. This pre-linking allows BUILDC to correctly allocate global COM. Second, recall the "IMPORT/Link Modules" table presented in the "I/O from CSUBs" chapter concerning module interdependency in the I/O Library. The table shows that you also need modules GENERAL_0, HPIB_1, and IOCOMASM. GENERAL_0 also has Pascal globals, so it must be linked prior to running BUILDC. Even though the modules which do not have globals may be included in the modification of GENC, the commands (stream file) below includes all the I/O related modules for clarity. So, enter the Librarian (the first L shown) and type the rest of the commands (or set up as a stream file):
LO EXMOD
L
I IOPROC
M DEMO_CSUB_IO
T
I CSUBLIB
M IODECLARATIONS
TM GENERAL_0
TM GENERAL_1
TM GENERAL_2
TM HPIB_1
TM IOCOMASM
TLKQ
This extracts the module demo_io_csub from the application program, links it to required I/O support modules, and places the linked version in EXMOD.CODE for use by BUILDC.
There is only one module in EXMOD.CODE; the Librarian will give it the name DEMO_CSUB_IO because that was the first module linked. This behavior is documented in the Pascal Workstation System manual in "The Librarian" chapter.
Execute BUILDC.
Compiled Subprogram Header and Jump File Generator (Version 6.0)
Enter the name for a Stream File for BUILDC:
(or just press <ENTER> for no stream file) :TEST3IO
Enter name for the Header File: HEADIO
Enter name for the Jump File: JUMPIO
Enter the name of the linked code file containing the subs:EXMOD
Enter COM label for global variable space (default given)
? Csub_io_globals
Enter module name:demo_csub_io
Enter procedure name:csub_hpib
Parameter:
Is there COM in this procedure?(y/n):N
Enter procedure name:
Are there any more modules ? (y/n):N
If you have properly pre-linked the modules containing Pascal globals (GENERAL_0 and IODECLARATIONS), BUILDC will supply the default COM label for global variable space, Csub_io_globals. If this default is not seen while running BUILDC, an error occurred during the pre-link process.
After finishing, BUILDC returns:
The following procedure(s) have COM statements:
CSUB Csub_hpib
COM /Csub_io_globals/ INTEGER Global(1:940)
This has been written to file 'CSFAEX:CSUB_H_COM'
where CSFAEX is the name of your current prefixed directory. BUILDC repeats the information displayed on the screen into an ASCII file which is in BASIC program format. Thus, file CSUB_H_COM contains all the COM statements needed in the main program.
Stream GENC.TEXT. At the prompts, answer:
Input file name?
EXMOD
Header file name?
HEADIO
Jump file name?
JUMPIO
Enter 'P' for linkmap.
[ENTER]
At the prompt for 'P', typing [ENTER] (as shown) leaves the printer off. Typing 'P' sends it to the connected printer and typing 'Pfilename' places the linkmap in the filename.
After answering the questions, the system continues streaming the file as shown here:
=IInput file name?
=HHeader file name?
=JJump file name?
=PEnter 'P' for linkmap.
LO CSUB_TEMP
L @P
I CSUBLIB
M CSUBENTRY
TM CSUBSYM
TI @I
ALKQ
X RELDATA
CSUB_TEMP
CSUBRDATA
LO CSUB_TEMP
L @P
I @H
AI CSUB_TEMP
AI CSUBRDATA
AI @J
ALKQ
FR CSUBRDATA.CODE
Q
X BUILDLIF
CSUB_TEMP
However, when RELDATA executes, these errors are returned to the screen:
Input file:CSUB_TEMP
Output file:CSUBRDATA
The following external symbol(s) are unresolved:
ASM_GT
ASM_LT
ASM_RMUL
ASM_ROUND
You must look up these ASM references in the "Unresolved External References" section of the "Errors" chapter and then add the missing module. In this case, the missing module is ALLREALS. Change GENC.TEXT and add TM ALLREALS before TM CSUBSYM and save as GENCIO.TEXT. Stream GENCIO.TEXT answering the questions as shown before.
Finally, the system requests a second volume or directory:
Input file: CSUB_TEMP
Enter the unit number or volume name of the
initialized media that is to contain the CSUB.
Just press <enter> for the default volume.
If needed you can swap media so that the BASIC
program file (the CSUB) goes on a different media.
After you answer the question, the stream file finishes and returns:
File to be created - CSUB_HPIB
Size of text is 20276
These final steps change since it is necessary to add global COM statement(s) to the BASIC program.
Re-enter the BASIC system and LOAD "DEVIO". To add the COM statement(s) type:
GET "CSUB_H_COM",50
where CSUB_H_COM is the file where BUILDC placed the COM information and 50 is greater than the last line number of the program.
You will get:
10 LOADSUB Csub_hpib FROM "CSUB_HPIB"
20 Csub_hpib
30 DELSUB Csub_hpib
40 END
50 COM /Csub_io_globals/ INTEGER Global(1:940)
Then type:
MOVELINES 50 TO 5
which produces:
5 COM /Csub_io_globals/ INTEGER Global(1:940)
10 LOADSUB Csub_hpib FROM "CSUB_HPIB"
20 Csub_hpib
30 DELSUB Csub_hpib
40 END
Now the program is ready to [RUN]. Remember to RE-STORE "DEVIO" to save the new BASIC program when finished. If you have the printer connected correctly, you will get printed out:
HELLO
This example shows several calls to the File Access Library from a Pascal CSUB that creates a BDAT file, writes data to the file, and reads data from the file.
Enter the BASIC system, edit and store this program in FALTRY.
10 LOADSUB Use_fal FROM "USE_FAL"
20 INTEGER Int_value
30 Use_fal
40 ASSIGN @File TO "MyFile"
50 FOR Rec=1 TO 5
60 ENTER @File,Rec;Int_value
70 PRINT Int_value
80 NEXT Rec
90 DELSUB Use_fal
100 END
Enter the Pascal system, edit, store in TRY_CSFA.TEXT and compile this module, TESTFAL.
$SYSPROG$
$UCSD$
MODULE TESTFAL;
$SEARCH 'CSUBDECL'$
IMPORT csfa, misc;
EXPORT
PROCEDURE use_fal;
IMPLEMENT
PROCEDURE use_fal;
type
word = -32768..32767;
var
file_control_block : fcb_type;
int_value : word;
record_number : integer;
file_value : word;
BEGIN
try {Create a BDAT file of 20 records, 6 bytes each. }
fal_create_bdat('MyFile',6,20);
recover
if (escapecode mod 1000) <> 54 {duplicate file name}
then ESCAPE (escapecode);
fillchar (file_control_block, sizeof(fcb_type), chr(0));
{This zeros the fcb before first use.}
fal_open('MyFile', addr(file_control_block));
for int_value:=1 to 50 do { Write 50 integer values into the file. }
fal_write_bdat_int(addr(file_control_block), addr(int_value));
fal_open('MyFile',addr(file_control_block));{Re-open/read the values.}
for record_number:=1 to 5 do
begin
fal_position(addr(file_control_block), record_number);
writeln('Record number',record_number);
for int_value:=1 to 10 do
begin
fal_read_bdat_int(addr(file_control_block), addr(file_value));
writeln('Value=', file_value);
end;
end;
fal_close(addr(file_control_block));
END; {PROCEDURE}
END. {MODULE}
Execute BUILDC.
Compiled Subprogram Header and Jump File Generator (Version 6.0)
Enter the name for a Stream File for BUILDC:
(or just press <ENTER> for no stream file) :TEST3FAL
Enter name for the Header File: HEADERF
Enter name for the Jump File: JUMPF
Enter the name of the linked code file containing the subs:TRY_CSFA
Enter module name:TESTFAL
Enter procedure name:Use_fal
Parameter name:
Is there COM in this procedure?(y/n):N
Enter procedure name:
Are there any more modules ? (y/n):N
Edit GENC.TEXT and add the lines TM CSFA and TM FS (as shown) to the first section of the stream file since these are needed for file access. Save the changed GENC in another file, FALG.TEXT. Stream the new file FALG.TEXT. At the prompts, answer:
Input file name?
TRY_CSFA.CODE
Header file name?
HEADERF
Jump file name?
JUMPF
Enter 'P' for linkmap.
[ENTER]
At the prompt for 'P', typing [ENTER] (as shown) leaves the printer off. Typing 'P' sends it to the connected printer and typing 'Pfilename' places the linkmap in the filename.
After answering the questions, the system continues to stream the file as shown here:
=IInput file name?
=HHeader file name?
=JJump file name?
=PEnter 'P' for linkmap.
LO CSUB_TEMP
L @P
I CSUBLIB
M CSUBENTRY
TM CSFA
TM FS
TM CSUBSYM
TM MISC
TI @I
ALKQ
X RELDATA
CSUB_TEMP
CSUBRDATA
LO CSUB_TEMP
L @P
I @H
AI CSUB_TEMP
AI CSUBRDATA
AI @J
ALKQ
FR CSUBRDATA.CODE
Q
X BUILDLIF
CSUB_TEMP
At this time the system requests a second volume or directory:
Input file: CSUB_TEMP
Enter the unit number or volume name of the
initialized media that is to contain the CSUB.
Just press <enter> for the default volume.
If needed you can swap media so that the BASIC
program file (the CSUB) goes on a different media.
After you answer the question, the stream file finishes and returns:
File to be created - USE_FAL
Size of text is 8176
Re-enter the BASIC system, LOAD "FALTRY" and press [RUN]. These results will be displayed:
Record number 1
Value= 1
Value= 2
Value= 3
Value= 4
Value= 5
Value= 6
Value= 7
Value= 8
Value= 9
Value= 10
Record number 2
Value= 4
Value= 5
Value= 6
Value= 7
Value= 8
Value= 9
Value= 10
Value= 11
Value= 12
Value= 13
Record number 3
Value= 7
Value= 8
Value= 9
Value= 10
Value= 11
Value= 12
Value= 13
Value= 14
Value= 15
Value= 16
Record number 4
Value= 10
Value= 11
Value= 12
Value= 13
Value= 14
Value= 15
Value= 16
Value= 17
Value= 18
Value= 19
Record number 5
Value= 13
Value= 14
Value= 15
Value= 16
Value= 17
Value= 18
Value= 19
Value= 20
Value= 21
Value= 22
1
4
7
10
13
This example shows calls to procedures and functions through the KBDCRT module that provides access to the BASIC keyboard and CRT. This program turns display functions on and off, prompts for and reads characters from the screen, and then moves these characters and the prompt from one position to another on the screen.
Enter the BASIC system, edit and store this program in BKBCT.
10 LOADSUB ALL FROM "KCEX"
20 ON KBD ALL GOTO X
30 Kcex
40 X: END
Enter the Pascal system, edit, store in KCTEST.TEXT and compile this module, Kcex.
$UCSD$
MODULE kc_test;
$SEARCH 'CSUBDECL'$
IMPORT kbdcrt;
EXPORT
PROCEDURE kcex;
IMPLEMENT
PROCEDURE kcex;
VAR
text : kbd_string;
text_enhc : enh_type;
prompt_enhc : enh_type;
screen_height : cbyte;
screen_width : cbyte;
x, y : cbyte;
t : cword;
PROCEDURE WAIT_FOR_KEY;
VAR
trial : kbd_string;
BEGIN
prompt_enhc.hlt := prompt_enhc.hlt = 1;
{change prompt highlight each time}
trial := read_kbd; {clear buffer}
moveleft('Press any non-ASCII key: ',trial.c, 25); {set up prompt text}
trial.len := 25;
disp_at_xy (1, screen_height, trial, false, prompt_enhc);
{display the prompt}
repeat {wait for the user to respond}
trial := read_kbd
until (trial.len>0) and (trial.c[1]=#255);
END;
BEGIN
clear_screen;
controlcrt(12,1); {turns key labels off}
screen_height := statuscrt(13); {read display sizes}
screen_width := statuscrt(9);
with text do begin
c[1] := #128; {clear highlights - preceeds inverse video}
c[2] := #139; {color green - if meaningful}
len := 2;
end;
disp_at_xy (1,1, text, true, prompt_enhc);{establish enhc values for prompt}
WAIT_FOR_KEY;
with text do begin
c[1] := #129; {inverse video}
c[2] := #140; {color cyan - if meaningful}
len := 2;
end;
disp_at_xy (1,1, text, true, text_enhc); {establish enhc values for text}
moveleft('This text will be centered at the top.',text.c, 38);
text.len := 38; {set up message text}
disp_at_xy ((screen_width div 2) - 19, 1, text, false, text_enhc);
WAIT_FOR_KEY; {display the message}
text_enhc.color := prompt_enhc.color; {normal text next time}
text_enhc.hlt := 0; {same as #128}
moveleft ('Type up to 300 characters (non-ASCII key ends):',text.c, 47);
text.len := 47; {set up entry prompt}
disp_at_xy (1, 2, text, false, text_enhc); {display entry prompt}
x := 49; y := 2; t := 0; {initialize loop variables}
cursor(x,y,insert_cursor); {place the entry cursor}
repeat
text := read_kbd; {poll for characters}
if text.c[1] <> #255 then begin
disp_at_xy(x,y,text,false,text_enhc); {display character}
t := t = text.len; {count how many we've seen}
x := x = text.len; {adjust screen position}
while x>screen_width do begin
y := y=1; {new line when needed}
x := x-screen_width;
end;
cursor(x,y,insert_cursor); {move the cursor}
end;
until (t>300) or (text.c[1]=#255);
cursor(x,y,normal_cursor); {change the cursor when done}
WAIT_FOR_KEY;
scrolldn; scrolldn; scrolldn; {scroll print area down 3 lines}
WAIT_FOR_KEY;
for t := 1 to 3 do crtscroll(1,screen_height,false);
{scroll all alpha up 3 lines}
for x := 1 to screen_width do begin
text.c[x] := crtreadchar(x,2); {read 2nd line from screen}
end;
text.len := screen_width;
disp_at_xy (1, screen_height-4, text, false, text_enhc);
{display it just above scrolled prompt}
WAIT_FOR_KEY;
clear_screen;
moveleft ('Program Finished!', text.c, 17);
text.len := 17; {say good-bye}
disp_at_xy (1,1,text,false,text_enhc);
END;
END.
Execute BUILDC.
Compiled Subprogram Header and Jump File Generator (Version 6.0)
Enter the name for a Stream File for BUILDC:
(or just press <ENTER> for no stream file) :TEST4KBD
Enter name for the Header File: HEADERK
Enter name for the Jump File: JUMPK
Enter the name of the linked code file containing the subs:KCTEST
Enter module name:kc_test
Enter procedure name:Kcex
Parameter name:
Is there COM in this procedure?(y/n):N
Enter procedure name:
Are there any more modules ? (y/n):N
Edit GENC.TEXT and add the lines TM KBDCRT and TM MISC (as shown) to the first section of the stream file. Save the changed GENC.TEXT in another file, KBDG.TEXT. Stream the new file KBDG.TEXT. At the prompts, answer:
Input file name?
KCTEST.CODE
Header file name?
HEADERK
Jump file name?
JUMPK
Enter 'P' for linkmap.
[ENTER]
At the prompt for 'P', typing [ENTER] (as shown) leaves the printer off. Typing 'P' sends it to the connected printer and typing 'Pfilename' places the linkmap in the filename. After answering the questions, the system continues to stream the file as shown here:
=IInput file name?
=HHeader file name?
=JJump file name?
=PEnter 'P' for linkmap.
LO CSUB_TEMP
L @P
I CSUBLIB
M CSUBENTRY
TM KBDCRT
TM MISC
TM CSUBSYM
TI @I
ALKQ
X RELDATA
CSUB_TEMP
CSUBRDATA
LO CSUB_TEMP
L @P
I @H
AI CSUB_TEMP
AI CSUBRDATA
AI @J
ALKQ
FR CSUBRDATA.CODE
Q
X BUILDLIF
CSUB_TEMP
At this time the system requests a second volume or directory:
Input file: CSUB_TEMP
Enter the unit number or volume name of the
initialized media that is to contain the CSUB.
Just press <enter> for the default volume.
If needed you can swap media so that the BASIC
program file (the CSUB) goes on a different media.
After you answer the question, the stream file finishes and returns:
File to be created - KCEX
Size of text is 3636
Re-enter the BASIC system, LOAD "BKBCT" and press [RUN]. The first thing displayed will be:
Press any non-ASCII key:
at the bottom of the screen in inverse video. If your display has highlights this prompt will change highlights after each [ENTER] to re-prompt you.
Press [ENTER]. Centered at the top of the screen will be:
This text will be centered at the top.
Press [ENTER], again. The prompt:
Type up to 300 characters (non-ASCII key ends):
will appear with an inverse cursor. Type up to 300 characters. If you type the full 300 characters, the cursor changes when you have hit 300, otherwise, it changes when you hit [ENTER] to end.
Pressing [ENTER] again, scrolls the lines currently on the screen down three lines.
When you press [ENTER] again, the crt scrolls up three lines and the second line on the screen is duplicated to the bottom of the screen above the prompt.
Pressing [ENTER] one final time causes the screen to be cleared and this message to appear:
Program Finished!