3 ms·
6502 is a harsher environment than Z80 which CP/M was originally designed for. It's a good candidate for a C64 port too.
by sedatk 8y ago
6502 is a harsher environment than Z80 which CP/M was originally designed for. It's a good candidate for a C64 port too.
- ido 8y agowhat makes it harsher? Also I believe CP/M was originally designed for the i8080.
- flohofwoe 8y agoI guess it's about the 6502's more RISC-like philosophy, which made it a bit more cumbersome to program in assembly code (even though the resulting performance was mostly similar to the Z80 because the 6502 could do more things in fewer cycles). Even with the whole 'extended register set in the zero page', the 6502 didn't have convenient features like 16-bit math, memory block instructions, and even 8-bit math was less convenient (e.g. no separate add/adc, sub/sbc instructions, so you always had to clear the carry flag before a math operation etc...) But I think this didn't matter for porting the operating system CP/M itself to 6502, the actual problem was binary compatibility with applications, and the Z80 was backward compatible with the i8080 (as long as only documented instructions were used). I guess being compatible with the i8080 (and CP/M 'office software') was the whole point why the Z80 was even created (as an i8080 killer), and that it was as successful as it was.
- Narishma 8y agoCP/M predates the Z80 CPU by a few years. It was designed for the 8080.
- pjmlp 8y agoThere was a version for the 128K +3A though.
- flohofwoe 8y agoThe Z80 was designed to be i8080 compatible (for the documented/recommended opcodes), so that it could run unmodified CP/M software. The Z80 instruction set basically added new opcodes where the i8080 instruction set had gaps or redundant opcodes (e.g. the i8080 had 16 identical NOP instructions, and 4 identical CALL instructions, but only the lowest opcode was recommended to be used, if one of the redundant opcodes was used, the program ran on an i8080 but not on a Z80).
- beagle3 8y agoHaving moved to the 6502 from Z80 back in the day, I initially had that feeling too - what? Only 3 8-bit registers on the 6502? The Z-80 had an abundance which is not trivial to describe (7 8-bit ones, 6 of which group into 3 16-bit pairs, an exchangeable shadow register file for them, and two additional 16-bit index registers); Z-80 also had block move instructions and other nice stuff that was missing from the bare bones 6502. And yet, the 6502 eventually comes out at least as useful with the indirect addressing and page-0 -- to the point that it often feels like you have 128 16-bit registers, or 256 8-bit registers, or any combination of those. Z80 is more high-level, but it comes at a cycle/instruction cost, and 6502 indirect indexing goes a very long way.