So, finally (same post is in thread ACE128):
Ok, I try to explain in better - my English is too poor:
Config: Commodore 128 with CP/M cartridge
Available: internal 8502, internal Z80, external Z80 (in CP/M cartridge)
C64 mode: internal 8502, external Z80 (in CP/M cartridge)
---
Config: Commodore 128 with SCPU and with CP/M cartridge
Available: 65816 (replaces 8502), external Z80 (in CP/M cartridge), but internal Z80 unusable
C64 mode: same as above
---
Config without SCPU and without CP/M cartridge is stock Commodore 128
---
CP/M 2.2 works in C64 mode also with SCPU, CP/M 3.0 works in C128 mode without SCPU only.
External Z80 works with SCPU with only one limit - SCPU at 1MHz. It's not so big disadvantage 'cause speed of SCPU is needed to change only at Z80 call and work, after at switch back to 65816 can work at 20MHz. Timing 20MHz can't handle Z80 and also CP/M 2.2
About speed: I found some info
Z80 inside C128 is normally clocked at 4MHz, for VIC-IIe sync is downclocked to 2MHz
Z80 inside CP/M cartridge is model normally clocked at 6MHz, downclocked same type to half freq. = 3MHz
Downclocking is to 1/2 normal frequency in both, but how C64/C128 handles 3MHz I don't know, we were talking on this forum about Z80 inside C128 why is working at 2MHz, it looks ok, but this is only same type of downclocking, not freq.
Programming external Z80:
Internal Z80 has other memory handling than external, so programming is different by memory handling, I mean it can be solved.
Very important is using IRQ handling - internal Z80 must to disable interrupts, external needs it not. But we all know that it's not important when is computer turned to other CPU - more than one CPU can not work at once.
Switch to Z80 is bit different. Internal Z80 starts in other address, but it's not other thing than memory handling.
I tried to call one Z80 by second Z80 directly - it works not or I used wrong way, I attached ZIP with D64 image and sources of Z8064 calling Z8128 and Z8128 calling Z8064. These sources can maybe anybody help to make working, so if anybody do it, please share it with us.
D64 image contains:
Z80S - switching handler:
SYS5120,lo,hi = switches to internal Z80 and calls Z80 code at HILO
$1435 is address to switch back to 8502 with correct PC handling
SYS5184 = switches to external Z80 and calls routine at $1000 where can be placed JP $HILO to jump to own address (this part I update and post later new version)
$1460 is address to switch back to 8502 with correct PC handling
That's for now. The Ace will require recognize type of Z80 and apply handling of apps by Z80 type. I mean SinCore it can to do, but later will know if really can.
Note: Z8064 = external Z80 in CP/M cartridge / Z8128 = internal Z80 in C128
Miro
z80.zip (1.37 KB)
58