Friday, November 4, 2022

Ahl's Benchmark Revisited

 Ahl's Benchmark is a short BASIC program written by David H. Ahl, and published in Creative Computing.  It was used to compare the speed of different machines back in the 1980s, and results were published for a lot of machines.  The benchmark, and results for many machines can be found in the March 1984 issue.

With the addition of the hardware multiply patch, and 6309 native mode, the CoCo 3 emulator turns on a time of just under 28.6 seconds, and that includes the time to POKE the code into RAM.
 
The IBM PC turned in a time of 24 seconds, and the Amiga 22 (or 14?) seconds.
I timed the 4 MHz Apple IIc Plus at around 31 seconds.
Considering the difference in clock speeds, these results are pretty respectable.




0 TIMER=0:POKE 65497,0

REM GET BASIC TOPRAM POINTER, SUBTRACT SIZE OF USER CODE
1 AD=PEEK(116)*256+PEEK(117)-24

REM RESERVE MEMORY FOR USR CODE
2 CLEAR 100,AD

REM VARIABLES ERASED BY CLEAR, SO REDO AD, POKE USR CODE INTO RAM
3 AD=PEEK(116)*256+PEEK(117):FOR I=0 TO 23:READ B$:A=VAL("&H"+B$):POKE AD+I,A:NEXT

REM DEFINE USR ROUTINES
4 DEFUSR0=AD:DEFUSR1=AD+12

REM ENABLE 6309 NATIVE MODE
5 A=USR0(0)

REM INSTALL HARDWARE MULTIPLY PATCH
6 GOSUB 10000


10 REM Ahl_s simple benchmark
20 FOR N = 1 TO 100: A = N
30 FOR I = 1 TO 10
40 A = SQR(A): R = R + RND(1)
50 NEXT I
60 FOR I = 1 TO 10
70 A = A^2: R = R + RND(1)
80 NEXT I
90 S = S + A: NEXT N
100 PRINT "Accuracy ";ABS (1010-S/5)
110 PRINT "Random ";ABS (1000-R)
120 PRINT "TIMER=";TIMER/60

REM DISABLE 6309 NATIVE MODE
130 A=USR1(0)
140 END


REM USR functions to enable/disable 6309 native mode
9000 DATA CC,FF,FF,10,4F,5D,26,03,11,3D,01,39,CC,FF,FF,10,4F,5D,26,03,11,3D,00,39

REM COCO3 HARDWARE MULTIPLY PATCH.
REM JUST ADD A GOSUB 10000 AT THE TOP OF YOUR CODE TO ADD IT

REM ADDRESS WE ARE STORING THE MULTIPLY PATCH IN RAM
10000 AD=VAL("&HFA0C")

REM POKE THE MULTIPLY PATCH INTO RAM.
10001 FORI=0 TO 64:READ B$:A=VAL("&H"+B$):POKE AD+I,A:NEXT

REM MAKE BASIC JUMP TO OUR MULTIPY INSTEAD OF USING IT'S CODE. $BB00 JMP $FA0C
10002 POKE VAL("&HBB02"),VAL("&H7E"):POKE VAL("&HBB03"),VAL("&HFA"):POKE VAL("&HBB04"),VAL("&H0C")

10003 RETURN

10005 DATA 32,79,E7,60,96,60,3D,ED,63,E6,60,96,5E,3D,ED,61,E6,60,96,5D
10006 DATA 3D,ED,65,E6,60,96,5F,3D,E3,62,ED,62,EC,65,E9,61,89,00,ED,60
10007 DATA EC,63,D3,15,97,16,D7,63,EC,61,D9,14,99,13,DD,14,A6,60,89,00
10008 DATA 97,13,32,67,39

1 comment:

  1. The time for the Amiga was hand written on the scan I have of the results that were published. It's also written in around 14 seconds.

    ReplyDelete