Authors
Publication
Pub Details
Date
Pages
I have been working on using my Timex/Sinclair 2068 to control a 3-axis drilling/routing machine using stepper motors. To make the machine move in arcs and circles I needed to use the sine and cosine functions in the Timex/Sinclair 2068 ROM. After trying some BASIC and machine language — using the floating point interpreter – routines, I found that the program couldn’t run nearly fast enough to keep the machine busy at full speed.
I asked David Solly, who is a long time HiSoft PASCAL user, to write me a test program using its sine/cosine functions so I could test it against Timex/Sinclair 2068 BASIC and compiled BASIC. The test program plots around a circle 100 times.
The results:
| T/S-2068 BASIC | Compiled BASIC (Timachine) | Hi-Soft PASCAL |
|---|---|---|
| 150 seconds | 126 seconds | 18 seconds |
Wow! The PASCAL really flies even when doing floating point math. It has all its own math routines built in so it doesn’t do any ROM calls. That also means that the compiled code can be burnt into an EPROM and run on a Z80 based CPU without the Timex/Sinclair ROM resident.
The compiled BASIC is only slightly faster that regular BASIC when the floating point routines are used. Even calling the Timex/Sinclair 2068 floating point routines from machine code doesn’t make much difference. If you are writing a program that does a lot of calculation such as a spread sheet, 3d graphics, or CAD etc., PASCAL will far out perform BASIC.
Timex/Sinclair 2068 BASIC Circle Listing
5 REM ! OPEN # (Timachine only)
10 LET RAD = 50
20 FOR A=0 TO 628 STEP .5
30 PLOT 80 + RAD * SIN A, 80 + RAD * COS A
40 NEXT A
50 PRINT "END OF PROGRAM"
HiSoft PASCAL Circle Listing
PROGRAM CIRCLE;
PROCEDURE PLOT (ON : BOOLEAN; X, Y : INTEGER);
BEGIN
IF ON THEN WRITE(CHR(21), CHR(0))
ELSE WRITE (CHR(21), CHR(1));
INLINE (#FD, #21, #3A, #5C, #DD, #46, 2, #DD, #4E, 4,
#CD, #E5, #22);
END;
PROCEDURE CIRC;
CONST RAD = 50;
VAR
A : REAL;
ON : BOOLEAN;
BEGIN
A : = 0;
ON := TRUE;
REPEAT
PLOT (ON, ENTIER(80 + RAD * SIN(A)),
ENTIER(80 + RAD * COS(A)));
A : = A + 0.5;
UNTIL A > 628;
END;
BEGIN (*MAIN PROGRAM*)
CIRC;
WRITELN ('END OF PROGRAM');
END.
Products
Downloadable Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.