Post Reply 
Zilog Z80 discontinued after nearly 50 years
06-01-2024, 09:22 PM
Post: #11
RE: Zilog Z80 discontinued after nearly 50 years
(06-01-2024 08:35 PM)Thomas Okken Wrote:  
(06-01-2024 08:18 PM)Steve Simpkin Wrote:  “The 6502 was never, and I mean never, talked about as being a CPU (Central Processing Unit) for a computing system,” says Bill Mensch. “The instruction set was picked for controllers. In other words, the controller instruction set was designed specifically to compete with the Intel 4040, which was a two- or three-chip-system solution.”

Now I'm curious as to what the ramifications of "designing it for a computing system" would have been. Because I've done 6502 assembly language programming, on the Commodore PET and on the C64, and I found the experience delightfully easy. I certainly never experienced the kind of frustration I'd expect from using a CPU that was being used for something it wasn't designed for. On the contrary, the 6502 instruction set seems really general-purpose, with the crucial bit of cleverness being a good set of addressing modes, and avoiding the complexity of a large set of registers by off-loading them to page 0 of main RAM. A well-rounded design, so how would they have done it differently if they had been designing a CPU specifically for computers?

I've programmed Z80, 6502, 6809 (but just a bit), MC68000, Sharp ESR-H and ESR-L, x86, MIPS as well as some made-up CPU ISAs for compiler courses and related materials.

The 6502 has a simple orthogonal ISA and it easy to learn. The ISA makes good use of addressing modes. But the early MOS 6502 had some annoying bugs that programmers had to work around. Also, there isn't really one "real" 6502. The most recent incarnation is the 65C02, which is not 100% compatible with the MOS 6502 with respect to instruction cycle counts, so program timings are off (e.g. games won't work). With respect to registers, memory access tends to be slow while register access is really fast. Doing most of the work through page 0 is a simple but bad design choice versus fast registers. The more registers the better, though there are limits because of opcode formats. This has been the general consensus for quite some time now and one can see this in the MC68000 and many modern CPUs. Some CPUs even have register file windows, which shift so you don't even need to push/pop registers on a stack to enter subroutines or to respond to interrupts. By contrast, page 0 is a global register file without a way to efficiently save and restore its values, like on a stack. It's like programming everything using global variables instead of using local variables (registers and stack).

I just happen to like the Z80 for its registers, the pairings and auxiliary ones, which means I can do a lot without involving memory, even more complicated things such as IEEE754 single floating point all in registers and still have IX and IY to spare. You can program a Z80 without any RAM, e.g. a bootloader can check if system RAM is installed and report problems e.g. via LEDs. It is useful to have 16 bit register pairs on the Z80 and operations on them. The downside of Z80 is the non-orthogonal ISA and there are more instructions to memorize. Some that are rarely used, like memory block moves and comparisons (I do use them in my Forth850 for efficiency). Other things that I don't like about the 6502 is that a register loads set the NZ flags, which does not allow for useful programming tricks I've often used in Z80 and other CPUs to do a logic operation or comparison to set flags followed by some load/store combo to move or override the data and then do a conditional jump. Stuff like this happens more often than one might think until you get to program in assembly for a while. Instructions that move data should not affect flags.

The 8-bit CPU I like best is the one I most recently learned to program for Forth500, which is Sharp ESR-L which borrows some really good design choices from the 6809 (orthogonality and two stacks) and some Z80-like features.

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Zilog Z80 discontinued after nearly 50 years - robve - 06-01-2024 09:22 PM



User(s) browsing this thread: 3 Guest(s)