[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing emulator...



Dosius wrote:

> Mike Guidero <mike@bogus.net> wrote in message
> news:<une3bq2g17jf23@corp.supernews.com>...
>> Hey, I can answer some questions about Z80 architecture on the Apple II
>> (Softcard-style), and also can help debug C code, but I've got limited
>> time
>> for that.  I'd love to see a good open-source IIe (or gs :) emulator that
>> did Z80.
>> 
>> I also have some resource of CP/M software to test with.
>> 
>> Mike
>> 
> 
> Sure...
> 
> If you could tell me how the Z80 gets control, etc., I can get an
> open-source Z80 core from the same place as the 65C02 core I am using,
> and write code to interface with it...I don't know how the 6502 and
> the Z80 interface.

Okay, I know the interface involves writing to the $Cn00 slot space.

Ahh yes, I've got it here.  An original Softcard manual :)

"The 6502 microprocessor is enabled from Z80 mode to the slot-depended 
location 0En00H."  (There's a memory translation)  "Z80 mode is selected 
from 6502 mode with a write operation to the same slot-dependent location, 
which his $Cn00 in 6502 mode."

"Upon receipt of a write instruction to the proper area of memory, the 
SoftCard is activated, and the CARD ON LED is turned on.  The Z80 remains 
in wait mode until one memory cycle with SoftCard address information 
occurs.  At this point, the Z80 is released from wait mode and allowed to 
run with no further wait cycles required"

Now, this one has me.  You write to $Cn00, and then it waits for a cycle 
with Z80 address information.  I'm not sure whether this means you put an 
instruction that brings up an address on the data bus or what, but a little 
disassembly should do the trick.

"Receipt of another write instruction to the same area of memory (this time 
from the SoftCard itself) deactivates the SoftCard."

I'm not sure of the 6502 continues from the same address that it was at when 
it went offline, again, a little disassembly work should give the clue.

Other Information:

Address translation table:
Z80 address     6502 address
$0000-$AFFF     $1000-$BFFF
$B000-$DFFF     $D000-$FFFF
$E000-$EFFF     $C000-$CFFF
$F000-$FFFF     $0000-$0FFF

DIP Switches on the SoftCard:
S1-1 ON disables address translation
S1-2 ON enables DMA requests to interrupt the SoftCard
S1-3 ON Z80 responds to NMI interrupts occurring in the Apple
S1-4 ON Z80 responds to IRQ interrupts occurring in the Apple
        The Z80 interrupt handlers should not attempt to service the interrupt,
        but should pass control back to the 6502 for actual processing.
        Regardless of the interrupt mode selected for the Z80, the data byte read
        During interrupt sequence will always be $FF

If I get a chance, I'll take a look at the code and see if I can get the 
specifics on the switching process.

Mike