I’ve recently discovered this (I think as an aside from some discussion about Coherent): XYBASIC
It was written by Stephen Ness, who had been a TA to Don Knuth. Stephen also worked with Gary Kildall, mostly because Gary’s computer was the nearest one he could use with a disk drive.
The interpreter comes with full source, and instructions how to build. The default binary that’s part of the distribution includes decimal floating point. There are many other build options, including creating ROMable code and using an Am9511. It’s a smaller binary than any of the MBASIC-80 interpreters that I can find. It comes with a decent manual, too.
I rather like it, and I thought some folks here might like it too.
Great find! (I see it falls into the camp of sophisticated (rather than simple) handling of what the source called “vacuous condition” in FOR..NEXT, as we’ve been discussing in the Back To BASIC: Kemeny & Kurtz’s book from 1985 thread..)
Also of interest, a feature to suppress output while execution continues:
On the other hand, <control-O> actually suppresses console output; execution of your program continues, but output is not sent to the console until the next <control-O> is typed, or until an error occurs or the program returns to direct mode. By repeatedly toggling <control-O> you can watch a TRACE of your program intermittently without the time-consuming delay of writing all the trace information on the console.
Oh, so there is! I should perhaps have noticed that. So it shows exactly how much code is needed to do this trick (around 20 instructions):
for2a: xthl ;entry pointer to HL
pop b ;incr pointer to BC
if for0
push h ;save pointer to incr for FOR0 test
endif
call moveb ;copy increment to entry and return
mvi a,csfor
if not for0
jmp cpush ;build the new CSTACK entry
else
call cpush
;must now check for vacuous condition (e.g. FOR I=1 TO 0) in FOR0 version
lhld lhsad
if float
lda lhsty
cpi sngst
if f9511
cz lod95 ;load floating value to 9511 stack
else
cz fload ;load floating value to FACC
endif
endif
mov c,m
inx h
mov b,m ;fetch integer value to BC
pop d ;incr pointer to DE
lxi h,-fbyts
dad d ;bound pointer to HL
call bdtst ;test FOR condition
rnc ;ok, just return
lhld cstkp
call next6 ;purge the CSTACK entry just built
call eos
mvi b,nextt
call fndst ;find matching NEXT
jnc next7 ;look for following comma, return or do another
error f, F, R ;not found, fatal FR error
endif
Udo Munk put a disk image with several builds of XYBASIC (binary, BCD, and am9511 accelerated floating point arithmetic) here:
The xycpmfp.com binary FP executable is smaller than the BCD one, and handily faster: asciiart in 38 seconds, where the BCD one takes 59 seconds. Microsoft’s mbasic is still faster at 27 seconds, but is more than 8K larger.
(all times on my 37 MHz MinZ-C Z180 thing, which is so small I only just found it on my desk again)