
In the Turbo course, R compiled your program and ran it, and a mistake dropped you back into the editor with the cursor on it. HiSoft Pascal does neither. You leave XBAS, compile from the 0: prompt, run the result yourself - and when there is a mistake, it tells you where, by line number, and you go back to XBAS to fix it.
With FIRST.ASC saved from S3, leave XBAS with DOS and type:
HPEIN FIRST
The name is given without .ASC. HiSoft Pascal signs on and lists your program as it compiles it:
Hisoft Pascal for the Tatung Einstein
Version of 24 October 1984
Copyright Hisoft 1984.
All rights reserved.
0E41 10 PROGRAM FIRST;
0E41 20 (* THREE NUMBERS *)
0E41 30 VAR A:ARRAY[1..3] OF INTEGER
;
0E42 40 BEGIN
0E6B 50 A[1]:=4; A[2]:=5;
0EB1 60 A[3]:=A[1]*A[2];
0F12 70 WRITELN(A[3])
0F3E 80 END.
End Address: 0F43
0:
Each line starts with the memory address its code begins at, then your XBAS line number, then the line. A line too wide for the screen runs on to the next row, as line 30 does here; that is only the display. End Address is where the program's code ends.
No news is good news: when there are no mistakes, it says no more than that. It has written FIRST.COM to the disc.
Type the name:
FIRST
and it prints 20 and comes back to 0:. That is a complete program that runs on its own - what the Turbo course reached in S37, you have from the start. It is small, too: a four-line program comes to 3,584 bytes, where Turbo's Hello was 8,064.
Compile FIRST a second time and HiSoft Pascal stops at once:
File exists - Delete?
FIRST.COM is already there. Press Y to compile over it. Any other key goes back to 0: and leaves the old FIRST.COM alone.
Since you will compile over the last version nearly every time, you can answer in advance: put ;Y after the name.
HPEIN FIRST;Y
Change line 70 in XBAS to WRITELIN(A[3]), save, and compile. The listing stops at the line:
0F12 70 WRITELIN(A[3])
*ERROR* ^ 3
The ^ points just after the part it could not accept, and 3 is the error's number. The manual's Appendix 1 lists them all; 3 is "Undeclared identifier" - HiSoft Pascal has never heard of WRITELIN.
Then it waits for a key. Press E to go straight back to 0:, or any other key to carry on and find the next mistake. A misspelling like this one usually sets off several more errors after the first, all from the same cause, so E is generally the right answer.
A compile that finds any error writes no .COM - and deletes the old one. After a failed compile, FIRST answers No File.
Then the round trip: XBAS, LOAD "FIRST.ASC", retype line 70, SAVE "FIRST.ASC", DOS, HPEIN FIRST;Y. It is four steps where Turbo had one, and it is the rhythm of working with HiSoft Pascal.
Letters after a semicolon change how HPEIN works. Three besides Y:
| Option | Does |
|---|---|
;B | The file has no line numbers - for a file written some other way than XBAS |
;T | Includes FRAC, SIN, COS and the other maths functions (S6) |
;R | Leaves out real numbers entirely: a four-line program comes to 1,920 bytes |
Several go together, separated by commas: HPEIN FIRST;Y,T. And a different name first makes the .COM under that name: HPEIN TWENTY FIRST compiles FIRST.ASC to TWENTY.COM.
The whole round, from S3's saved FIRST.ASC:
HPEIN FIRST
FIRST
Starting from
FIRST.ASC saved as in S3, the 0: prompt, no FIRST.COM on the disc yet.
What you should see
The sign-on, the eight-line listing and End Address: 0F43, then 0:. FIRST prints:
20
Make each change in XBAS, save, and compile with ;Y:
END. in line 80. What does the compiler say when it reaches the end of the file?WRITELIN(A[3]). Which number does it give, and what happens when you press E? Is FIRST.COM still there?A[4]:=A[1]*A[2];. The array only goes up to 3. Does it compile? What happens when you run it?4.1 Compile and run the program you saved as NAME.ASC in Exercise 3.1.
4.2 Compile FIRST.ASC so that the program is called TWENTY.COM, and run it by its new name.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
No Source File: FIRST .ASC | The file is not on the disc - it was never saved, or saved under another name. |
File exists - Delete? | The .COM is there from last time. Y, or compile with ;Y. |
The compile stops with *ERROR* and nothing happens | It is waiting for a key: E to stop, anything else to go on. |
No more text | The program ran out before END. - usually a missing full stop. |
| The old program runs, not the new one | You answered anything but Y to File exists - Delete?, or the change was never saved. |
No File when you run it | The compile failed, and a failed compile deletes the .COM. |
HPEIN NAME compiles NAME.ASC to NAME.COM, listing every line with its XBAS number; NAME runs it. Recompiling asks File exists - Delete? - Y, or add ;Y. A mistake shows *ERROR*, a ^ and a number, and waits: E stops. A failed compile leaves no .COM. Fix the line in XBAS, save, compile again.
S5, When A Program Stops - the run-time errors, and a difference in how a runaway program is stopped that changes how fast your programs run.