On Thu, 19 Feb 2026 12:21:38 +0000
Paul Flo Williams via cctalk <[email protected]> wrote:

> As far as emulator/simulators go, I've started with Jari Komppa's
> emu8051, which I will no doubt outgrow, but it has a really simple
> ncurses interface that allows me to jump around the code and try out
> various routines to check my understanding of 8051 behaviour.

Three days later, I've outgrown it :-(

emu8051 was producing some strange results on pieces of code that I
knew worked, and then started segfaulting. Looking at the open issues
on Github, it seems it misunderstands direct versus indirect addressing
with the stack pointer and the code to update auxiliary carry in the
arithmetic routines is wrong.

I experienced incorrect results when using the DA A decimal adjust
instruction and, sure enough, the flags weren't updated correctly there
either. Even the MAME 8051 code admits they don't understand the manual
for this instruction, so they get it wrong too.

It’s a bit bizarre that the VT320 even uses DA A, as I normally see BCD
arithmetic in arcade games, but they seem to have picked a _really_
weird method of converting binary to ASCII via repeated BCD addition.

> I'll take a look at Seemanta Dutta's gSim51 at some point. I braved
> the popups of Sourceforge, ignored its "alpha" status and the fact it
> was last updated 13 years ago and downloaded it.

This repository offers two programs: gas51, an assembler, and gSim51.
Neither are functional. Both are very much ‘my first C program,’ with
huge amounts of commented-out ‘I changed my mind’ stuff and hard-coded
filenames of the code to process.

Ugh. I really don't want to write my own core, but it would be simpler
at this point. I have 40 KiB of code to exercise it with!

Finally, I don't suppose anyone still has a VT320 with V1.0 firmware,
do they? There are only three versions: V1.0, 1.1 and 1.2, and 1.1 and
1.2 only differ by the glyphs in 132-character mode. Many years ago, I
took extensive notes on some strange behaviour I could provoke in the
VT320 by using the largely undocumented "Restore Terminal State"
command, but version 1.2 is protected against my messing, which means I
had to have been using V1.0. Only V1.1 and 1.2 are dumped on the web.

Regards,
Paul

Reply via email to