Nice link, Ed! The 6809 can be quite versatile in the hands of a true 8-bit hacker, but the technique described is very closely coupled to the 6809 architecture. Although I always somewhat admired the 6800 as "the grand-daddy" of all the 6xxx family (with which my brain feels the most comfortable) it can't be ignored that its instruction set can be brutally inefficient for some of the simplest tasks. Another example is pushing and pulling the X register:
Code:
... from Bob Uiterwyk's 6800 BASIC interpreter ...
02CA DF 38 PUSHX STX PUSHTX
02CC DE 3A LDX XSTACK
02CE 09 DEX
02CF 09 DEX
02D0 DF 3A STX XSTACK
02D2 36 PSHA
02D3 96 38 LDAA PUSHTX
02D5 A7 00 STAA 0,X
02D7 96 39 LDAA PUSHTX+1
02D9 A7 01 STAA 1,X
02DB 32 PULA
02DC DE 38 LDX PUSHTX
02DE 39 RTS
02DF DE 3A PULLX LDX XSTACK
02E1 EE 00 LDX 0,X
02E3 7C 00 3B INC XSTACK+1
02E6 7C 00 3B INC XSTACK+1
02E9 39 RTS
The 6809 equivalents would benefit by at least an order of magnitude from the availability of the U register, with a simple
pshu X and
pulu X.
Similar things can be stated regarding 6502 vs. 65802. Garth and saipan59 discussed this at length
here, but the best message that I got from it is that the updated versions of each family were much improved from the originals, in a variety of ways.
Mike