Monday, 30 April 2012

My Work in Print: 1987

Previously: 1985

DISZ80 - a Z80 Disassembler

Delighted today, to receive a comment from Geoff Wearmouth on that previous Personal Computer World: Sub Set article. Geoff it was, who first typed my 1094-byte Z80 disassembler DISZ80 into a Sinclair Spectrum some quarter century ago. His site http://www.wearmouth.demon.co.uk/ gathers Sinclair ZX Spectrum ROMs, as well as emulation tools for the related ZX80, ZX81, and the eternally awe-inducing Jupiter Cantab Ace.

Geoff's own Spectrum Globeplotter, featured in The Register Hardware's Basic Instinct last week, and itself more than a quarter century old, proves us to be PCW stablemates. Whilst presented as a BASIC listing, this spinning-sphere-transpoising, sinusoidal-Mercator-projecting screen plotter actually employs untold amounts of custom crafted machine code.

Some ten years ago, Geoff made appeals in comp.sys.sinclair for any further information about PCW back issues. And just today, Stephen Parry-Thomas of http://jupiter-ace.co.uk/ has replied, with full scans of Sub Set from February-May 1987. At last, the extensive line comments can be restored to my crusty old utility!

February 1987

Click to big. In "Z80 Radix Conversion" David Barrow starts off with CONVHL, which is used at various points within the main disassembler to convert 16-bit integers to various bases (binary, octal, decimal, hex) for readable output. He remarks upon the "quite ingenious" optimised method used to convert raw digits to ASCII.

I remember being quite happy with the way David had split out the various modular components of the program. Publishing these in multiple datasheets over several months resulted in a steady stream of payments, giving a pleasant illusion of gainfully paid employment!

March 1987

March saw the publication of routine XTRACT, designed to read and print strings from a table. As David correctly notes, this too is pathologically storage space optimised, for both code and data table size.

April 1987

The I/O fest continued in April with a set of five connected utilities dealing with the output of hex data and addresses. This is the point at which David, having correctly diagnosed my space optimisation compulsion, shows where I could have saved one program byte, two stack bytes and 14 clock cycles. Though 25 years later I've still to validate the assertion, respect for David's manifest expertise compels me to believe it, albeit truculently.

May 1987

The May edition was given over to just the two remaining big routines, spread across five new datasheets / appendices, and completing the 1094-byte Z80 disassembler.

So, once again: hooge thanks to the guys, Geoff Wearmouth and Stephen Parry-Thomas, who got these page scans to me - I do hope you'll both understand and forgive the indecent haste with which I've posted them here.

Try It Out!

Finally, Geoff's just been in touch again to tell me that DISZ80 is actually live online, and has been for years, embedded in his ZX Spectrum Emulator. How cool is that? Click here to run it. I just tried it out using Internet Explorer 8, 64-bit (!) version. Click the "screen" then press Enter for instructions. The Disassembler itself can be disassembled (!!) by typing the address $5100 then pressing Enter. The code you see starting at that address is actually the DISZ80 entry point, as illustrated in the first of the May 1987 pages above. Mind = Blown!

1 comment:

  1. Respect. Nibbles, clock cycles, jump tables. This was when programming was HARD - I remember POKEing my Spectrum to cheat at games but had no idea what I was doing.
    To think, most of today's "brogrammers" don't even know how to set up a Facebook app, let alone worry about the "endian-ness" of a byte stream! *NERD*

    ReplyDelete