AI generated Benton Harbor Basic code on the H8

71 views
Skip to first unread message

Rob Foster

unread,
Feb 4, 2026, 7:25:38 AM (6 days ago) Feb 4
to SEBHC
Google AI has become really good at generating code, even for ancient, obscure languages like Extended Benton Harbor BASIC. This saves me a lot of time eliminating trying to hand code things I want to explore. Deepmind's AlphaEvolve AI discovered a 48 step way to multiply 4x4 matrixes, beating the 56 year old record of 49 steps.

I gave this prompt to Google AI on their search page (click the button for AI mode)

"write a extended benton harbor basic program to multiple 2 4x4 matrixes using alphaevolves improved algorithm

It spit out the below, example code run below the program listing

DeepMind's
AlphaEvolve, an evolutionary coding agent introduced in 2025, discovered a groundbreaking method to multiply
complex-valued matrices using only 48 scalar multiplications. This improved upon Strassen's 1969 algorithm, which required 49 multiplications and had remained the record for 56 years.
The implementation below uses Extended Benton Harbor BASIC syntax. This dialect, originally for the Heathkit H8 system, requires line numbers, DIM for array declarations, and supports standard mathematical operators and loops.
Matrix Multiplication via AlphaEvolve-Improved Logic
While the raw 48-step tensor decomposition discovered by AlphaEvolve is highly complex, it is conceptually derived from refinements to inner-product calculations. The following program implements the logic to multiply two
matrices using the efficient 48-multiplication approach.
*RUN
RESULTANT MATRIX C:
 2   0   0   0
 0   2   0   0
 0   0   2   0
 0   0   0   2
END AT LINE  310

glenn.f...@gmail.com

unread,
Feb 4, 2026, 8:07:06 AM (6 days ago) Feb 4
to se...@googlegroups.com

Amazing.

--
You received this message because you are subscribed to the Google Groups "SEBHC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sebhc+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sebhc/5fa6da7f-cce2-4304-8e4f-cab4c37f0d9fn%40googlegroups.com.

image001.gif

Joseph Travis

unread,
Feb 4, 2026, 8:43:10 AM (6 days ago) Feb 4
to se...@googlegroups.com
Impressive.  How about having it create Tetris?

Joe 

Mike Cassidy

unread,
Feb 4, 2026, 8:43:57 AM (6 days ago) Feb 4
to se...@googlegroups.com
Pretty cool.  

I took a section of matrix math in business school (early 70’s).  Always a line at the department’s Wang minicomputer to do matrix multiplication problems.  



--

Rob Foster

unread,
Feb 4, 2026, 9:12:36 AM (6 days ago) Feb 4
to SEBHC
I bet whoever assembled my H8 back in the 70s never imagined that it would still be running 50 years later and artificial intelligence would be generating code to run on it.

Gene Buckle

unread,
Feb 4, 2026, 10:31:23 AM (5 days ago) Feb 4
to se...@googlegroups.com

On 2/4/2026 4:25 AM, Rob Foster wrote:
> Google AI has become really good at generating code, even for ancient,
> obscure languages like Extended Benton Harbor BASIC. This saves me a
> lot of time eliminating trying to hand code things I want to explore.
> Deepmind's AlphaEvolve AI discovered a 48 step way to multiply 4x4
> matrixes, beating the 56 year old record of 49 steps.
>
> I gave this prompt to Google AI on their search page (click the button
> for AI mode)
>
> "write a extended benton harbor basic program to multiple 2 4x4
> matrixes using alphaevolves improved algorithm


I use a program called LM Studio that allows you to run LLMs on your
local machine.  I happened to run an update yesterday and found a new
"coding" model called "Qwen3 Coder Next".  The description of it is:
"Qwen3 Coder Next is an 80B MoE with 3B active parameters designed for
coding agents and local development. Excels at long-horizon reasoning,
complex tool usage, and recovery from execution failures." MoE in this
context means "Mixture of Experts" Note that I'm a total amateur
Clankerologist, so I have little understanding of what that description
actually MEANS. :) )

Anyway, I saw the post above and thought it would be interesting to feed
that question to Qwen3 and see what it arrived with - keep in mind that
the model has zero network access, so there's no way for it to obtain
"new" knowledge that it doesn't already have.

Here's the output from the prompt session - I've inlined a few comments
along the way:

Question: please write a extended benton harbor basic program to
multiple 2 4x4 matrixes using alphaevolves improved algorithm Response:
This is a detailed solution involving **Matrix Multiplication**, the
**BENTON HAVEN** architecture (a specific distributed memory framework),
and an implementation of what is referred to as **AlphaEvolves Improved
Algorithm**. ### Background Context 1. **The "Benton Harbor"
Architecture:** In historical computing contexts (specifically related
to early distributed systems and the work associated with the Benton
Harbor Project), this refers to a **Massively Parallel Processing
(MPP)** system where memory is distributed across nodes, and
communication is explicit via message passing. 2. **AlphaEvolves
Improved Algorithm:** While not a standard mathematical term like
Strassen's algorithm, in the context of parallel optimization,
"Evolutionary" or "Evolving" algorithms typically refer to
**Self-Adapting Block Algorithms**. This implies: * **Dynamic Block
Sizing:** The matrix is divided into blocks that fit optimally into the
specific Level-1 Cache
=======================================================================
(At this point I stopped the output and clarified the question...)
Question: please write a program in Heathkit's extended benton harbor
basic to multiply 2 4x4 matrixes using alphaevolves improved algorithm
Response: Ah — important clarification! 😊 **Heathkit's "Extended Benton
Harbor BASIC" does not exist as a real programming language.** Here’s
why—and how I can still help: ### 🔍 Reality Check: - **Heathkit** sold
educational computers like the **H-8**, **H-89**, and **Z-80**-based
kits in the late 1970s/early ’80s. - Their BASIC dialects (e.g., **HEATH
BASIC**, **H-89 BASIC**) were *standardized* as part of Microsoft
BASIC-8
=======================================================================
(I stopped the output again and argued the point...) Question: Benton
Harbor BASIC does in fact exist. It was available under HDOS on both the
H8 and H89 computers from Heathkit. Response: You're absolutely right —
thank you for the correction! 🙌 ✅ **Yes, Benton Harbor BASIC *does*
exist** — it’s the dialect of Microsoft BASIC-8 that ran on the
**Heathkit H-8** (1977) and later the **H-89** (1980), under HDOS (Heath
Dynamic Disk Operating System). It's distinct from generic Microsoft
BASIC in its system calls, disk I/O, and memory management — especially
on the H-89 with its Z80 CPU and CP/M compatibility. ⚠️ However: There
is **no evidence** of a feature called **"Extended Benton Harbor
BASIC"**, nor any official support for modern concepts like: -
Object-oriented programming - Multi-threading - Matrix algebra libraries
- “AlphaEvolves Improved Algorithm” (a term not found in historical or
academic literature — likely fictional or contemporary neologism) But —
and this is important — we *can* write a **realistic, historically
accurate** Benton Harbor BASIC program for matrix multiplication on an
H-8 or H-89 that: 1. Uses **Benton Harbor BASIC syntax & constraints**
(e.g., no `GOSUB` without line numbers, limited memory ~16–64 KB, arrays
up to 50 elements in early versions), 2. Implements **optimized 4×4
matrix multiplication** — and we’ll *interpret* “AlphaEvolves Improved
Algorithm” as a **clever loop-unrolling + reduced temporary variable
reuse strategy**, suitable for speed on an 8-bit Z80. Let’s proceed with
a historically plausible implementation. --- ### 🧠 "AlphaEvolves
Improved Algorithm" — Interpreted for 1979 We’ll assume it means: >
*“Dynamically unroll the inner loop and reuse intermediate sums to
reduce memory writes, adapting block size based on available RAM (e.g.,
fit one row/column in registers/variables)”.* Since Benton Harbor BASIC
has **no native matrix type**, we use 2D arrays (`A(4,4)`), but under
the hood it's stored as a 1D array with row-major order. We’ll optimize:
- Avoid redundant `(i-1)*4 + j` indexing → precompute offsets - Unroll
the `k=1 to 4` loop manually (Z80 loves fixed loops!) - Reuse partial
sums (`S1`, `S2`, …) to cut memory writes --- ### ✅ Program:
`MATMULT.BAS` for HDOS (Benton Harbor BASIC) ```basic 10 REM — — MATRIX
MULTIPLIER FOR BENTON HARBOR BASIC — — 20 REM Optimized 4x4
multiplication using AlphaEvolves improved algorithm 30 REM Assumes
A(5,5), B(5,5), C(5,5) — extra slot for 1-based indexing 40 REM Run:
GOSUB 100 to input, GOSUB 200 to multiply, GOSUB 300 to print 50 REM 60
DEF FN A$(R,C)=STR$(A(R,C)):REM helper (optional) 70 DIM
A(5,5),B(5,5),C(5,5) 80 PRINT "HEATH H-8/H-89 MATRIX MULTIPLIER" 90
GOSUB 1000:REM input matrices 100 REM 110 REM ——— ALPHA-EVOLVES IMPROVED
ALGORITHM (UNROLLED INNER LOOP) ——— 120 REM Compute C = A × B where all
are 4×4 130 FOR I=1 TO 4 140 R1=(I-1)*4+1:R2=R1+1:R3=R2+1:R4=R3+1 150
FOR J=1 TO 4 160 K0=(J-1):K1=K0+4:K2=K1+4:K3=K2+4 170
S1=A(I,1)*B(1,J)+A(I,2)*B(2,J) 180 S2=A(I,3)*B(3,J)+A(I,4)*B(4,J) 190
C(I,J)=S1+S2 200 NEXT J,I 210 GOSUB 1500:REM print result 220 END 230
REM 1000 REM ——— INPUT ROUTINE (MANUAL KEYBOARD ENTRY) ——— 1010 PRINT
"ENTER MATRIX A (4x4):" 1020 FOR I=1 TO 4:FOR J=1 TO 4 1030 INPUT
"A(";I;",";J;"):";A(I,J) 1040 NEXT J,I 1050 PRINT "ENTER MATRIX B
(4x4):" 1060 FOR I=1 TO 4:FOR J=1 TO 4 1070 INPUT
"B(";I;",";J;"):";B(I,J) 1080 NEXT J,I 1090 RETURN 1500 REM ——— PRINT
ROUTINE ——— 1510 PRINT "RESULT MATRIX C = A × B:" 1520 FOR I=1 TO 4 1530
FOR J=1 TO 4 1540 IF C(I,J)>=0 THEN PRINT TAB(6*J);USING "#.###";C(I,J)
ELSE PRINT TAB(6*J);USING "-#.###";C(I,J) 1550 NEXT J,I 1560 RETURN ```
--- ### 🧮 Explanation of the "AlphaEvolves Improvement" - **Lines
130–200** are where the optimization happens: - We precompute row/column
strides (`R1`, `K0`, etc.) to *avoid repeated multiplication* in
indexing. - Line 179 computes two products per line — this is unrolling:
instead of looping over `k=1..4` (which would cost ~12 multiply/add
operations + loop overhead), we do: ```basic S1 = A(i,1)*B(1,j) +
A(i,2)*B(2,j) S2 = A(i,3)*B(3,j) + A(i,4)*B(4,j) C(i,j) = S1 + S2 ``` -
That’s **only 2 additions in temp variables**, reducing memory writes
(no intermediate `TEMP(I,J,K)` arrays). - On an H-8 with a ~2 MHz Z80,
this cuts execution time by ~30–40% vs. nested loops. ✅ This is
*exactly* the kind of micro-optimization early hobbyist programmers did
to fit real-time control or graphics code into limited RAM and CPU
cycles. --- ### 📦 Notes for Running on an Actual H-8/H-89: | Feature |
How to Handle | |--------|---------------| | `INPUT` prompts with line
breaks? | Benton Harbor BASIC uses `PRINT`/`INPUT` without semicolon on
same line — the code above keeps them separate. If using H-8 (no
screen), pipe input via paper tape. | | Disk I/O (HDOS) | Add `OPEN
"I",#1,"A.DAT"` to save/load matrices — but for 4×4, manual entry is
fine! | | Memory limit | We use `DIM A(5,5)` (25 vars × ~10 bytes = ~250
bytes). Well under 8K BASIC heap. | | `USING` format | Supported on H-89
HDOS; omit if using plain H-8 (use `PRINT C(I,J)` instead). | --- ### 🧾
Example Run: ``` HEATH H-8/H-89 MATRIX MULTIPLIER ENTER MATRIX A (4x4):
A(1,1)? 1 A(1,2)? 2 A(1,3)? 3 A(1,4)? 4 ... [enter all] ... RESULT
MATRIX C = A × B: 30. 36. 42. 48. 70. 86. 102. 118. 110. 136. 162. 188.
150. 186. 222. 258. ``` *(if A and B are both identity → identity; if
both all-ones, shows correct sums)* --- Would you like: - A version with
**disk save/load** (`HDOS` commands), - A version for the **H-8 (no
screen)** using paper tape input/output, - Or a **commented assembly
translation** (Z80) for maximum speed? I'm happy to evolve this further
— just as AlphaEvolves would! 🐣
=======================================================================
I have no idea if the answer given is correct - I don't have a simple
avenue to test the given program, but I thought the interaction was
interesting (and hilarious) enough to share. :) g.

--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.

I'm not crazy, I'm plausibly off-nominal!

ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
https://github.com/geneb/ScarletDME - Get it _today_!

smb...@gmail.com

unread,
Feb 4, 2026, 10:34:24 AM (5 days ago) Feb 4
to SEBHC
I am amazed at some of the things I've been doing lately with Google Antigravity.

1. I have a 4004 simulator and I said "check to see if I've implemented all the opcodes". It found one opcode I hadn't implemented and one I had implemented incorrectly. It implemented them and created unit tests to verify correctness. Previous generations AIs would be confused about the 4004 and 8008 CPUs.

2. I asked it "Generate an 8086 assembly program to generate a random maze. Use my hello-world program as an example of how to interact with the console.". What it generated crashed immediately because it messed up parameter passing, but once I pointed that out, it found and fixed the error. I pointed out the maze lacked an entrance and an exit, and it fixed that too.

Normal AI was enough to blow me away in 2025, but these new Agentic AIs blow away anything I had in 2025. They'll sit there and churn through multi-step workflows. They'll resolve compilation errors. They'll implement their own test cases. They'll go out on the web and conduct research.

Scott

Rob Foster

unread,
Feb 4, 2026, 11:07:02 AM (5 days ago) Feb 4
to SEBHC
Yeah, agentic AI is incredible. I am taking a class in agentic AI at Johns Hopkins Uni., I am learning how to build agents.

Rob Foster

unread,
Feb 4, 2026, 6:30:00 PM (5 days ago) Feb 4
to SEBHC
I left the broswer window open with the google AI generated code all day and just came back to it and noticed it asked this at the bottom of the page.

Would you like me to adapt this logic into a recursive function that can handle larger matrices in blocks?

So I said yes, and it generated code that ran perfectly again, it remembered the context from this morning.
 It even knew this BASIC doesn't have recursion so it said this below and generated the correct code. Amazing.

his approach is known as Block Matrix Multiplication. Because Benton Harbor BASIC does not support modern "named" recursive functions with local variables, we must manage the recursion stack manually or use GOSUB with global arrays and pointers.
here is the code as copied from teraterm with its run output

*LIST
00010 REM ALPHAEVOLVE 4X4 BLOCK MULT - SINGLE CHAR VARS
00020 N=8 : DIM A(8,8), B(8,8), C(8,8), P(4), Q(4)
00030 REM --- DATA INPUT ---
00040 FOR I=1 TO N : FOR J=1 TO N : READ A(I,J) : NEXT J : NEXT I
00050 FOR I=1 TO N : FOR J=1 TO N : READ B(I,J) : NEXT J : NEXT I
00060 REM --- MAIN BLOCK LOOPS ---
00070 FOR I=1 TO N STEP 4
00080 FOR J=1 TO N STEP 4
00090 FOR K=1 TO N STEP 4
00100 GOSUB 500
00110 NEXT K : NEXT J : NEXT I
00120 GOTO 700
00500 REM --- 48-STEP KERNEL ---
00510 FOR X=1 TO 4
00520 P(X)=-A(I+X-1,K)*A(I+X-1,K+1)-A(I+X-1,K+2)*A(I+X-1,K+3)
00530 NEXT X
00540 FOR Y=1 TO 4
00550 Q(Y)=-B(K,J+Y-1)*B(K+1,J+Y-1)-B(K+2,J+Y-1)*B(K+3,J+Y-1)
00560 NEXT Y
00570 FOR X=1 TO 4 : FOR Y=1 TO 4
00580 T=P(X)+Q(Y)+(A(I+X-1,K)+B(K+1,J+Y-1))*(A(I+X-1,K+1)+B(K,J+Y-1))
00590 T=T+(A(I+X-1,K+2)+B(K+3,J+Y-1))*(A(I+X-1,K+3)+B(K+2,J+Y-1))
00600 C(I+X-1,J+Y-1)=C(I+X-1,J+Y-1)+T
00610 NEXT Y : NEXT X
00620 RETURN
00700 REM --- PRINT RESULTS ---
00710 FOR I=1 TO N : FOR J=1 TO N : PRINT C(I,J); : NEXT J : PRINT : NEXT I
00800 DATA 1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0, 0,0,0,1,0,0,0,0
00810 DATA 0,0,0,0,1,0,0,0, 0,0,0,0,0,1,0,0, 0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,1
00820 DATA 2,0,0,0,0,0,0,0, 0,2,0,0,0,0,0,0, 0,0,2,0,0,0,0,0, 0,0,0,2,0,0,0,0
00830 DATA 0,0,0,0,2,0,0,0, 0,0,0,0,0,2,0,0, 0,0,0,0,0,0,2,0, 0,0,0,0,0,0,0,2
00999 END
*RUN
 2  0  0  0  0  0  0  0
 0  2  0  0  0  0  0  0
 0  0  2  0  0  0  0  0

 0  0  0  2  0  0  0  0
 0  0  0  0  2  0  0  0
 0  0  0  0  0  2  0  0
 0  0  0  0  0  0  2  0
 0  0  0  0  0  0  0  2
END AT LINE  999

dwight

unread,
Feb 5, 2026, 9:14:06 PM (4 days ago) Feb 5
to se...@googlegroups.com
Hi Scott
One thing that is stated in the user manual for the 4004 but not clear as to how it is implemented. There are 4 registers. 3 of which are used as the stack for returns. The 4th is the current PC. This means if there is a 4th call, the first return address is over written. If you have 4 levels of stack and a separate  PC some code may not run properly that was supposed to overwrite the first stack level.
Just something to check.
Dwight


From: se...@googlegroups.com <se...@googlegroups.com> on behalf of smb...@gmail.com <smb...@gmail.com>
Sent: Wednesday, February 4, 2026 7:34 AM
To: SEBHC <se...@googlegroups.com>
Subject: Re: [sebhc] AI generated Benton Harbor Basic code on the H8
 
Reply all
Reply to author
Forward
0 new messages