Some time ago, I benchmarked some 8-bit computers to find out the fastest BASIC interpreter. I ended up using the classic SAXPY benchmark, as I didn't want any I/O overhead to fool the measurement: printing on screen is slower for machines that doesn't have a real text mode and always operate in bitmap mode and it doesn't have to do with the BASIC interpreter itself. On the other hand, aritmetic routines play an important part in any BASIC program, so the benchmark does precisely that.

I'd like to add some other machines to this list, so I need to know how to measure time in frames (or equivalent resolution). For other computers, as you can see, the TIME or TIMER function is usually present in most BASIC dialects. For the Spectrum and the SAM Coupé, I already knew about the FRAMES system variable to count frames, but for others, I have to dig into technical documentation, which is not always available or easy to find/read.

Here is the current listing. NOTE: ("Tiempo en segundos" is the spanish for "Time in seconds").

The title says "Results of SAXPY benchmark applied to 80's classic computers".

enter image description here

UPDATE: thanks to Stephen Kitt answer, I can finally place the Atari XL, and it happens to be between the SAM Coupé and the ZX Spectrum.

As Stephen suggests, I will ask separate questions for finding out how to measure time for other micros.

enter image description here

  • 3
    The timing of the C64 variant is incorrect. The variable TI (TIME) counts 1/60 seconds (jiffies) - no difference on between PAL/NTSC. Only the CPU is slower on PAL systems ... it has to be written 100 PRINT "TIME IN SECONDS: ";T/60 Running on my system gives me approx. 1.3 (sometimes 1.283333) seconds. Apr 26 '16 at 11:58
  • Isn't this about different BASIC dialects on Atari, not about the Atari-BASIC dialect?
    – wizzwizz4
    May 18 '16 at 20:22
  • @wizzwizz4 No, but I'll explain further in response to your meta question. May 18 '16 at 20:49
  • Sinclair QL was 16-bit wasn't it?
    – Alan B
    Dec 14 '18 at 13:21

On the Atari 8-bit machines, you'd use the real-time clock memory locations starting at offset 18; these are updated during every vertical blank:

TIME = INT((PEEK(18) * 65536 + PEEK(19) * 256 + PEEK(20))/60)

(on an NTSC system; divide by 50 for PAL).

To measure your own time interval, the safest approach is to POKE all three values to 0 at the start of whatever you wish to measure.

See Mapping the Atari for more details and "links" to example programs.

  • Sorted! Thanks! To mark this answer as accepted, I'd like to know how it is done on an Oric Atmos computer as well. Apr 25 '16 at 11:42
  • 1
    @mcleod_ideafix Of course. I'm not sure many people would know both systems well enough (which highlights the disadvantages of asking multiple questions in one, even when they're closely related). Apr 25 '16 at 11:44
  • I understand that. I will then edit the question to ask only for Atari XL, and will put another question for Oric Atmos, linking to this question Apr 25 '16 at 11:49
  • This method creates a race condition. To safely read the value, first disable interrupts, or else synchronize your reads to avoid spanning a vertical blank (the C64 has the handy WAIT command to do this; I'm not sure about the Atari). To safely set the value to 0, it should be sufficient to POKE the least significant byte first.
    – Hugh Allen
    Oct 6 '16 at 4:59
  • Also, I would ignore the value in 18. The byte in 20 is only ~4 seconds, so you need to read 19 to be safe and then you have 1100 seconds to work in. It's unlikely you'll run over 18 minutes and need to use 18. Why do I mention this? Because in Action! you just declare 20 as a CARD and the conversion is done for you. May 13 '18 at 17:19

Here, actual screen shot with source, and proper way to reset timer and measure time... all run on 1979 Atari 800 (with Incognito board on Personality slot, enabling all available OS and Basic loads in existence, all the way up to XE/XEGS).

In reality, it is much faster than most of the samples posted here, even with Interpreter-based Basic on 8K rom-space):

Atari 800 / XE OS

Above results with Antic DMA turned OFF. If turned ON, result is 0.66 secs

  • Not quite seeing how this could be so much faster than the Atari version already posted. But the only other comparable machine with a 2 MHz 6502 is the BBC Micro, and its 0.55 s result is with system interrupts enabled
    – scruss
    May 24 at 17:24
  • The performance difference can be explained by the use of the Altirra FP performance pack, which provides floating-point routines that are substantially faster than the originals. Jun 21 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.