Monday, March 28, 2022

prior-art-dept.: 5 letter words (Jim Butterfield's Jotto)

I mentioned the Wordle craze, including the extant ports to the Commodore 64, in our KIMdle sorta-Wordle for the KIM-1. But the Commodore 64, and I suspect this was actually a PET game originally, had a five-letter word game before that. Jim Butterfield's Jotto isn't Wordle — it tells you merely how many letters matched — but it's undeniably an ancestor concept. Jotto appears in the Commodore 64 user's guide on page 145 and is believed to be public domain. It is reproduced in its entirety in this scanned image.

Friday, March 25, 2022

xa 2.3.13 and dxa 0.1.5

I've updated xa, André Fachat's venerable 6502 cross-assembler, to version 2.3.13, but also dxa, its companion disassembler based on Marko Mäkelä's d65, to version 0.1.5. I keep promising version 2.4, but somehow for years we never noticed that // and /* */ in quoted strings get improperly treated as comments instead of part of the string, and that seemed a pretty important bug to fix. A test case is now part of xa's fairly extensive regression analysis suite. 2.3.13 also includes patches for segfaults with parameter handling (but never run xa as root, kids, it kills kittens) and a miscellaneous correctness fix with null file handling. Although its development home platform remains AIX (with gcc) because I'm one of those people, and portability mumble mumble weird operating systems mumble endian, it is also tested and validated on Linux/ppc64le (gcc and clang), NetBSD/macppc and NetBSD/mac68k (gcc), and Mac OS X macOS (gcc on PowerPC, and clang on x86_64 and Apple silicon). Seriously, this is the last 2.3 release, dammit. No fooling. I mean it.

dxa's development was a little more colourful. This started with a file that didn't disassemble correctly (Paradoxon BASIC from 64'er, as it happens) because apparently d65 was never able to handle files that stretched riiiiiiiiiiiight up to the very last addressible byte ($ffff), let alone files that overflowed the addressing space or were bigger than 64K. However, even with that problem fixed, this particular test file also caused dxa to emit completely nonsense branches with unpossible displacements and even jumps to non-existent labels. This violates its core guarantee that you should be able to take dxa's output, feed it back into xa and get the binary you started with. It turns out that this is due to some weird C casts used for interpreting relative branches, so I made them more explicit, plus changes in the C preprocessor that caused the macro to check if a label exists to evaluate to true in one place and false in another. I think this file made a great test vector, so now dxa has a test suite too (make test; xa is naturally required) using it and a DOS wedge routine, and I'll probably throw in more exemplar code in the future. This new test suite is already earning its keep: it found a new bug when dxa is compiled with clang, which required even more reworking of the same section and some nearby code. Interestingly, even though now the test suite passes on all the same platforms as xa, dxa-built-with-clang generates subtly different output than dxa-built-with-gcc despite the fact the assembly files they both generate will yield bitwise identical binaries. Most of this seems to circulate around detecting vectors; clang flavour finds this in some places that gcc doesn't and vice versa. It's deterministic and predictable, but I'm not sure which one of them is "doing it right," so for now it'll be a curiosity until I can dig more into the differences.

Both xa and dxa are available under the GNU Public License v2.