Recently, 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. Here are the results.
Timex/Sinclair 2068 BASIC interpreted ...... 150 seconds Compiled BASIC (Timachine) ...... 126 seconds HI-SOFT PASCAL ...... 18 seconds
Wow! The Pascal really flies even when doing floating point math. It has all its own math routines built in and 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 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.
Anyone interested in Timex/Sinclair 2068 Pascal can leave a message on the Ottawa TS BBS at (613)745-8838. If you have a LKDOS disk system I have converted Pascal’s internal file routines for disk instead of tape. There are also numerous Pascal source files on the BBS.(1)
(1) The version of HiSoft Pascal which has been converted to address the Larken system is 1.7M which requires the use of a Spectrum emulator ROM to run on the Timex/Sinclair 2068. For additional information write to: David Solly, Sysop, Sir Clive’s Castle BBS, 1402-1545 Alta Vista Drive, Ottawa, Ontario, Canada K1G 3P4.
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
1 PROGRAM CIRCLE;
2 PROCEDURE PLOT (ON : BOOLEAN; X,Y : INTEGER);
3 BEGIN
4 IF ON THEN WRITE(CHR(21),CHR(0))
5 ELSE WRITE (CHR(21),CHR(1));
6 INLINE (#FD, #21, #3A, #5C,
7 #DD, #46, 2, #DD, #4E, 4,
8 #CD, #E5, #22);
9 END;
10 PROCEDURE CIRC;
11 CONST RAD =50;
12 VAR
13 A : REAL; ON : BOOLEAN;
14 BEGIN
15 A := 0; ON := TRUE;
16 REPEAT
17 PLOT (ON, ENTIER(80 + RAD * SIN(A)),
18 ENTIER(80 + RAD * COS(A)));
19 A := A + 0.5;
20 UNTIL A > 628;
21 END;
22 BEGIN (*MAIN PROGRAM*)
23 CIRC;
24 WRITELN ('END OF PROGRAM');
25 END.
Products
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.