One of the things I did very early on whilst coding gtBASIC was create a test suite of examples and unit tests, to exercise and verify the many commands and their subtle interactions.
One of these tests is a classic benchmark from the early 80's, Sieve of Eratosthenes published in Byte in 1981, (I still have my original copy lying around somewhere): https://en.wikipedia.org/wiki/Byte_Sieve
Original Byte article: https://archive.org/details/byte-magazi ... ew=theater
This is a rather simple test that calculates the first 1899 Prime numbers without using multiply/divide or floating point and was converted to many different languages of the time, (both interpreted and compiled), as well as many different architectures, (8bit, mini, mainframe, etc).
There is a list of results for various languages and architectures and I thought it was finally time that the Gigatron made it's debut, so without further ado, I present:
Here is the code for ROMvX0, to build for ROMv5a just change the line '_codeRomType_ ROMvX0' to '_codeRomType_ ROMv5a':
Code: Select all
_runtimePath_ "../runtime" _runtimeStart_ &hFFFF _arraysStart_ &hFFFF _codeRomType_ ROMvX0 const SIZE = 8190 DIM FLAGS(SIZE) cls : mode 3 init TIME PRINT "10 iterations" set TIMER, 0 FOR IT=0 to 9 COUNT = 0 FOR I=0 TO SIZE FLAGS(I) = 1 NEXT I FOR I=0 TO SIZE IF FLAGS(I) PRIME = I + I + 3 K = I + PRIME WHILE K <= SIZE FLAGS(K) = 0 K = K + PRIME WEND INC COUNT ENDIF NEXT I NEXT IT timer = get("TIMER") PRINT "PRIMES: ";COUNT PRINT "TIME: ";timer/60;" ";timer % 60;"/60"