Primes by Trial Division - Laser 50 BASIC

20 August 2016

This benchmark exposes all kinds of warts deriving from the Laser 50's profound limitations.

  1. FOR..NEXT is a valid construct in this BASIC, but a version of this benchmark which uses FOR..NEXT similarly to the Applesoft reference version stops with no error after finding just 3 primes. I suspect that there is a pathological interaction between the stack and the results array owing to the extremely small memory size, but did not pursue a definite answer. Thus, the version below uses only GOTO.
  2. Although variable names may be longer than one character, the length of a single BASIC line is limited to 40 characters. While that isn't an issue in the final version shown below, it was at certain times while I was experimenting with ways to work around the FOR..NEXT quirk. So this version uses single character variable names even though it wasn't strictly required.
  3. Because the LCD displays only a single line, the machine pauses after each line of output and waits for the user to press a key. To avoid this, we send output to the printer (whether it's attached or not) using LPRINT.

10 DIM P(99)
20 C=2
30 F=0
40 LPRINT C
50 P(F)=C
60 F=F+1
70 IF F>99 THEN GOTO 160
80 C=C+1
90 I=0
100 V=C/P(I)
110 IF INT(V)=V THEN I=F+1
120 IF I>F THEN GOTO 80
130 I=I+1
140 IF I=F THEN GOTO 40
150 GOTO 100
160 END

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026

Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Primes Benchmark Source

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Primes Benchmark Results

Other BASICs

Applesoft BASIC

Atari 2600 BASIC

BBC BASIC

Commodore BASIC

DRI Personal BASIC

HP BASIC/V

IBM 5100 BASIC

IBM PC BASIC

PICK/BASIC

Rocky Mountain BASIC

Sinclair ZX80 BASIC

Spectravideo Compumate

TI 99/4 BASIC

TRS-80 Level 1 BASIC

V-Tech Laser 50

VAX BASIC

Structured BASIC

Amiga BASIC

Dartmouth True BASIC

Microsoft QuickBASIC

Microware Basic09

Topaz S-BASIC