Following my earlier PAL-2 experiments, including getting CP/M-65 running on the physical machine, I wanted a quicker way to write small hardware-oriented 6502 programs without moving too far away from the processor itself.
The result is Tantal, a small compiled language for the NMOS 6502. I developed the first version with Claude Code, but the language design is driven by the limitations of the real target: my PAL-2, a KIM-1-compatible computer running at 1 MHz.
The original inspiration was Action! for the Atari. I encountered it almost by accident in a Czech series on Root.cz and liked the idea of a structured language whose constructs remain recognisably close to the machine.
One central design decision is to avoid using the 6502 hardware stack for parameters and local variables. Procedure frames have fixed addresses, and frames belonging to procedures that cannot be active at the same time can share memory. The compiler calculates this overlay from the call graph. The first three parameter bytes are passed in A, X and Y; additional parameters use frame slots. A byte result is returned in A and a 16-bit result in A/X. Recursion is consequently a compile-time error.
The first intended application is a simple logic analyser for relatively slow signals on the PAL-2 user port. This led to explicit language constructs for waiting on ports and pins:
ring byte[256] log noinit
byte PAD_OLD, cur
card changes
PADD = $00
PAD_OLD = PAD
clear(log)
do
cur = wait change PAD from PAD_OLD timeout 2 s
if timedout then exit fi
log <- cur
changes += 1
od
wait change PAD from PAD_OLD compares the current port value with the caller-supplied previous value, returns the complete new port byte, and updates PAD_OLD. There are also wait rising and wait falling forms for individual bits. Optional timeouts use the user RIOT timer and set the built-in timedout value.
The compiler is written in Go and includes its own assembler and 6502 emulator. It emits a raw binary, Intel HEX, KIM-1 paper-tape format, an assembly listing with cycle counts, a memory map, and a symbol table. The built-in PAL-2 target describes the memory map, both RIOTs, monitor routines, and the IRQ/NMI vectors.
I have now tested the display.tantal example both in the KIM-1 simulator and on the physical PAL-2. The program writes directly to the system RIOT and multiplexes the six LED digits; the real board successfully displays HELLO.
The display.tantal example running on the physical PAL-2.
The project is still version 0.1. It currently supports unsigned byte and 16-bit values, fixed-address I/O registers, named bits and bit fields, procedures, interrupts, inline assembly, strings, ring buffers, and the signal-oriented wait forms. Signed types, 65C02 instructions, automatic serial upload, and enforcement of .cycles limits are not implemented yet.
Code, documentation, examples, and the compiler source:
A longer description of the design and the PAL-2 test:
The earlier PAL-2 thread that led into this work:
Do you think there is still a need for a new 6502 language like Tantal? If not, what do you currently use to write 6502 software, and what makes it a better fit?
