13

The C128 was a C64 with an extra CPU as well as extra memory. But the second CPU was a Zilog Z80 while the primary was the usual Commodore CPU, a MOS 6502.

The Z80 was there so that CP/M software could be run and as such the machine has a C64 mode using the 6502 and a CP/M mode using the Z80.

But was it possible to write software for it that ran on the Z80 outside of the CP/M environment, and if so did the Z80 have full access to all the machine's custom hardware such as sprites, SID sound chip, etc?

I believe the Z80 had to run slower than usual on this system, so for performance the 6502 would normally be used. But if you still wanted to code for the Z80 rather than the 6502 could you still use all the system's hardware features?

2

2 Answers 2

14

The Z80 can access all hardware I/O addresses in the C128, with the natural exception of the built-in I/O port (a 6520-style PIA) of the 8502 CPU. That means that, if I remember correctly, the only hardware that is not easily usable from the Z80 is

  1. the cassette
  2. the CAPS LOCK key of the US version (ASCII/DIN in German models, I don't know what it is called in the other internationalized variants).
7
  • Interesting. Is one of the differences between the 6502 and 8502 that it has something a bit like the Z80's IO ports rather than only memory-mapped IO? Did it have extra instructions like the Z80's IN and OUT? Commented Apr 14, 2020 at 7:08
  • 3
    @hippietrail: The Z80 has a separate I/O address space, but in the C128 it is not mapped to anything else than the normal address space IIRC. So you can chose whether to use IN and OUT or normal LD instructions for talking to hardware, whatever is more convenient.
    – TeaRex
    Commented Apr 14, 2020 at 7:09
  • 1
    @TeaRex: I thought the Z80 was designed to have access to all 64K of RAM when using normal LD instructions. Does it not?
    – supercat
    Commented Apr 14, 2020 at 17:00
  • 1
    @supercat Ah, you're saying that the Z80 doesn't use the exactly the same address decoding as the 8502?
    – cjs
    Commented Apr 15, 2020 at 18:18
  • 1
    @cjs: On of the 8502 I/O ports is used to control whether the 8502 address space at 0xD000 is RAM or I/O. The Z80 uses the distinction between LD and IN/OUT for that purpose.
    – supercat
    Commented Apr 15, 2020 at 18:46
3

I do not have enough points reputation to add a comment to @TeaRex post.

You forgot to mention that in C128 CP/M, the Z80 switches the processor back to the 6502/8502 mode to do the disk fetch from the 1571. This made CP/M reads and writes very slow, but still usable with apps such as Wordstar.

2
  • 4
    Tip: Never say "I don't have enough rep to...", this will make reviewers to see your post as not-an-answer from the beginning. Not-an-answer causes deletion. Instead, reformulate your reaction to the other answer as an at least partial answer. Partial answers are okay. Then, you can put in "Extending ...s answer," or "Contrary the answer of ...".
    – peterh
    Commented Jun 11, 2020 at 11:28
  • "..to the 8502 mode to do the disk fetch..". Partly true. The IEC disk command to read (or write) is indeed started through the 8502-subsystem but the actual read-character-from-drive loop is done in with the Z80 and is therefore close to 8502 speed. Of course 1541 bit-banging IO was fully in 8502 code.
    – Martijn
    Commented Oct 27, 2021 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .