Benchmark Your Atari 8-Bit Computers Using BASIC (15-30 mins)

Task: Benchmark Your Atari 8-Bit Computers Using BASICĀ 

Needed: Atari BASIC, the benchmark ATR file, one or more 8-bit computers, SIO2PC or FujiNet

Time: 15-30 minutes

Introduction

During the early 1980s, as home computers exploded on the scene, programmers naturally wanted to know which systems and programming languages were fastest. This led to the development of several standardized benchmark programs that measured the execution speed of common computational tasks. Rather than focusing on graphics or sound, these benchmarks typically emphasized the performance of BASIC interpreters by timing loops, arithmetic operations, branching, and prime number generation. Some popular general benchmarks in BASIC included Rugg/Feldman, BYTE Sieve, and Ahl’s Simple Benchmark.

Here is an article from Compute! magazine (issue 57, 1985) on Atari benchmarks by Bill Wilkinson. He examined why Atari BASIC performed poorly on popular benchmarks such as the BYTE Sieve despite the Atari’s capable hardware. He explained that much of the slowdown stemmed from design decisions within the Atari BASIC interpreter (e.g. inefficient integer conversions and loop handling) and cautioned that benchmark results should be interpreted carefully because factors such as operating system overhead could significantly affect execution times.

In this project, I created a simple set of 12 benchmarks in Atari BASIC that run in about 90 seconds. I created this benchmark because I was curious how it would run across the different 8-bit computers. It is meant to be fun and not a thorough exercise in benchmarking the Atari hardware. I perform a bunch of loops with math functions, array and string operations, etc. No graphics or sound. The code is included at the end of the post and in a ZIP file with ATR.

Instructions

First, download this ZIP file (Basic Atari BASIC Benchmark) that contains a text file with the Atari BASIC code and an ATR file with the BASIC program.

Second, load the ATR file onto FujiNet for booting on original hardware. Alternatively, you can make a floppy disk with the ATR using SIO2PC and RespeQT which is what I did.

Third, boot the ATR and LOAD “D:BABB.BAS” from BASIC. Type RUN.

Below are my results on an Atari 800, 800XL, and 130XE all stock. I used a BASIC cartridge with revision A (PEEK 43234 = 162) on all computers. I include the code at the end of the post.

Benchmark Running on an Atari 800
Benchmark Running on an Atari 800
Benchmark Running on an Atari 800XL
Benchmark Running on an Atari 800XL
Benchmark Running on an Atari 130XE
Benchmark Running on an Atari 130XE

Comments

I honestly expected to see a little more of a difference between the three systems. The Atari 800 was about a half second slower than the 800XL and 130XE which were both very close to each other. Note there is a tiny bit of variability from run to run because of the random number benchmark. I should have probably removed that. You could delete that code (line 170) when you do your testing.

What does the benchmark look like on a 400, 1200, and XEGS? How about different version of BASIC?

Here is the code:

10 REM ATARI BASIC COMPUTATIONAL BENCHMARK SUITE
15 REM BY JASON MOORE FOR ATARIPROJECTS.ORG
20 REM EACH TEST HAS ITS OWN TIMER
30 REM USES RTCLOK AT LOCATIONS 18,19,20
40 GRAPHICS 0:POKE 752,1
50 DIM A(200),S$(255),T$(255),NM$(20)
55 TIMESUM=0
60 PRINT “BASIC ATARI BASIC BENCHMARK (BABB)”
70 PRINT “———————————-”
80 PRINT “TIMES ARE IN SECONDS”
90 PRINT

100 N=500:NM$=”FOR/NEXT LOOP”:GOSUB 1000
110 N=500:NM$=”ADD/SUBTRACT”:GOSUB 1100
120 N=500:NM$=”MULTIPLY/DIVIDE”:GOSUB 1200
130 N=300:NM$=”INTEGER MATH”:GOSUB 1300
140 N=300:NM$=”FLOATING POINT MATH”:GOSUB 1400
150 N=100:NM$=”SIN/COS”:GOSUB 1500
160 N=100:NM$=”SQUARE ROOTS”:GOSUB 1600
170 N=300:NM$=”RANDOM NUMBERS”:GOSUB 1700
180 N=10:NM$=”ARRAY FILL”:GOSUB 1800
190 N=10:NM$=”ARRAY SUM”:GOSUB 1900
200 N=100:NM$=”BRANCH TEST”:GOSUB 2000
210 N=100:NM$=”STRING BUILD”:GOSUB 2100

220 PRINT
230 PRINT “BENCHMARK COMPLETE!”
240 PRINT “TOTAL TIME = “;TIMESUM
250 POKE 752,0
260 END

900 REM START TIMER
910 POKE 18,0:POKE 19,0:POKE 20,0
920 RETURN

950 REM STOP TIMER AND PRINT RESULT
955 REM DIVIDE BY 50 FOR PAL IN LINE 970
960 TI=PEEK(18)*65536+PEEK(19)*256+PEEK(20)
970 ES=INT(TI*100/60+.5)/100
975 TIMESUM=TIMESUM+ES
980 PRINT NM$;” = “;ES
990 RETURN

1000 REM EMPTY LOOP
1010 GOSUB 900
1020 FOR I=1 TO N
1030 NEXT I
1040 GOSUB 950
1050 RETURN

1100 REM ADD/SUBTRACT
1110 GOSUB 900
1120 X=0
1130 FOR I=1 TO N
1140 X=X+I
1150 X=X-1
1160 NEXT I
1170 GOSUB 950
1180 RETURN

1200 REM MULTIPLY/DIVIDE
1210 GOSUB 900
1220 X=1.1
1230 FOR I=1 TO N
1240 X=X*1.0001
1250 X=X/1.0001
1260 NEXT I
1270 GOSUB 950
1280 RETURN

1300 REM INTEGER STYLE MATH
1310 GOSUB 900
1320 X=0
1330 FOR I=1 TO N
1340 X=X+10
1350 X=X-5
1360 X=X*2
1370 X=X/2
1380 NEXT I
1390 GOSUB 950
1395 RETURN

1400 REM FLOATING POINT MIX
1410 GOSUB 900
1420 X=1.2345
1430 FOR I=1 TO N
1440 X=(X+3.14159)/1.41421
1450 X=X*1.73205-0.57721
1460 NEXT I
1470 GOSUB 950
1480 RETURN

1500 REM TRIG FUNCTIONS
1510 GOSUB 900
1520 X=0
1530 FOR I=1 TO N
1540 A=I/100
1550 X=X+SIN(A)+COS(A)
1560 NEXT I
1570 GOSUB 950
1580 RETURN

1600 REM SQUARE ROOTS
1610 GOSUB 900
1620 X=0
1630 FOR I=1 TO N
1640 X=X+SQR(I)
1650 NEXT I
1660 GOSUB 950
1670 RETURN

1700 REM RANDOM NUMBERS
1710 GOSUB 900
1720 X=0
1730 FOR I=1 TO N
1740 X=X+RND(0)
1750 NEXT I
1760 GOSUB 950
1770 RETURN

1800 REM ARRAY FILL
1810 GOSUB 900
1820 FOR J=1 TO N
1830 FOR I=1 TO 50
1840 A(I)=I+J
1850 NEXT I
1860 NEXT J
1870 GOSUB 950
1880 RETURN

1900 REM ARRAY SUM
1910 GOSUB 900
1920 X=0
1930 FOR J=1 TO N
1940 FOR I=1 TO 50
1950 X=X+A(I)
1960 NEXT I
1970 NEXT J
1980 GOSUB 950
1990 RETURN

2000 REM BRANCH TEST
2010 GOSUB 900
2020 X=0
2030 FOR I=1 TO N
2040 IF I/2=INT(I/2) THEN X=X+1
2050 IF I/3=INT(I/3) THEN X=X+1
2060 NEXT I
2070 GOSUB 950
2080 RETURN

2100 REM STRING BUILD
2110 GOSUB 900
2120 S$=””
2130 FOR I=1 TO N
2140 T$=”ATARI”
2150 S$(LEN(S$)+1)=T$
2160 IF LEN(S$)>240 THEN S$=””
2170 NEXT I
2180 GOSUB 950
2190 RETURN