Thanks Wayne,
I do have a lot of questions.........
I am happy to continue this discussion here, or within an issue entry in your github project? What's your preference?
> It looks like you are using the Zeta 2 MMU, which is ideal as a mechanism for this.
I am? I basically just copied the standard config for RCZ80. I went through and disabled all the drivers etc for the time being. Then added mine for the eZ80 uart. I also added a new CPUFAM and PLATFORM
Also went through the start-up code and just wrapped my changes in #IF (CPUFAM == EZ80)....
> A couple of decent macros may make this more palatable.
Yep - my thoughts also - part of the challenge is there is no assembly support for the new 24bit and other instructions of the eZ80.
1. In the implementation of HBX_BNKSEL, can I use the stack?
I need to use the OUT (C), r instruction --- which is technically OUT (BC), r.
This necessitated the use of BC register - so I had saved it onto the stack - then i was wondering if I was having a stack issue. I did try saving it in the alt registers (EXX). I think pushing onto the stack would work - but at the time of coding, I was having a hardware issue. (hardware issue since resolved). But yet to test this fully. But I do wonder if I can use the stack at all in the function? What if the function is swapping the segment with the stack ? If I cant use the stack, I can probably just use a couple of bytes in the on-chip's RAM.
Just as I type, I am wondering if I can implement a pseudo function to enable doing the i/o with out need to set the B register - hmmm - I think the ez80 even has hooks for illegal instructions - so hmm wondering... thinking....
2. I created a new CPUFAM and PLATFORM, but I am not sure what's the best conditional variable to use here
PLATFORM .EQU PLT_RCEZ80
CPUFAM .EQU CPU_EZ80
But I have only used CPUFAM for the conditional test --- as mentioned above, not sure what would be best approach here.
3. What function belong in the on-chip ROM and what belongs in the RomWBW image?
The eZ80 will boot into its on-chip ROM (its initially mapped at address $000000). The on-chip ROM and RAM will be super fast - with minimal wait-states, unlike the external RC2014 ram module.
So I am thinking that the 'firmware' on the eZ80 is responsible for booting, setting up RAM/IO address ranges, wait states, address modes, and the configures all on-chip services (uarts, timers & counters, interrupts, the RTC, etc.). It should be 'agnostic' of RC2014 module configurations.
Once its ready, it then jumps to the first byte in the external 64K RAM address
Perhaps an interface within the firmware could be made available for code such as HBIOS/RomWBW to call. This will be a table of jump functions --- allowing on-chip device configurations (baud rates etc). Also maybe a feature to copy and execute a block of code in the fast on-chip RAM.
The RomWBW would just need to initiate a far call (CALL.LIL) to access these functions.
Dev tool chains could be targeted for the specific platform -- I understand that the preferred approach for developing eZ80 code is to use a variant of clang that targets the eZ80 -- similar to how what has been developed for the Agon. I have not got that setup yet though. Just using the Zilog IDE which has a very old version of C (C98) but it does have an assembler to target the eZ80 instructions. This IDE is windows only (wine might work) - but it does have a nifty debugger.
4. No idea what i am going to do for interrupts
At the moment, I disabled INTs in the configuration. But there will be some complexity with INT management. The eZ80 mixed mode might work - but the handling of the correct version of RETI I think will be important.
I will need to do some experimenting on this.
5. Dual CPU Mode
I dont have the hardware wired up for the Dual CPU configuration. Have no idea if my idea will even work. This will be a little bit down the track. But the general idea will be the Z80 and the eZ80 can run side by side. Only 1 processor has access to the bus (the Z80 is sent the BUSREQ to remove it, but when the Z80 is controlling the bus, the eZ80 will be isolated by buffers, with it continuing to run on its internal ROM/RAM).
Thanks again Wayne.
Cheers
Dean