[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Writing emulator...
Dosius, some more SoftCard information for you:
I did a little poking around on my IIgs after booting CP/M (having a gs made
this really easy, since you can still get into the control panel from CP/M
:)
I visited the monitor from CP/M and looked at the Z80/6502 switching code,
and here's what I've derived:
Upon RESET, the 6502 and the Z80 are reset. The Z80 is suspended at this
time, and the 6502 is allowed to run.
A write to the $Cn00 space of the SoftCard will activate the Z80. As soon
as the Z80 has valid addressing data, the SoftCard asserts the DMA line on
the bus, suspending the 6502 processor.
At this point the Z80 is executing instructions and the 6502 is suspended.
If the Z80 writes to the En00H ($Cn00 from the 6502's point of view) space
of the SoftCard, the Z80 goes to sleep, and 6502 execution resumes at the
point where it stopped.
As each processor toggles the SoftCard, the other picks up where it had last
been, unless something Special happens, like a RESET.
I wrote a little code to test this out. I started up the GS with no disk in
the drive, hit RESET, CALL -151, and entered the following code:
6502 Code:
0300: A9 20 LDA #$20 ; prove we got here
0302: 8D 20 03 STA $0320 ; by storing value
0305: 8D 00 C4 STA $C400 ; activate softcard
0308: A9 50 LDA #$50 ; prove we got back
030A: 8D 21 03 STA $0321 ; by storing value
030D: 60 RTS ; back to caller
Z80/8080 Code: (8080 mnemonics)
1000: 38 80 MVI A,80H ; prove Z80 code ran
1002: 32 22 F3 STA F322H ; by storing value
1005: 32 00 E4 STA E400H ; deactivate softcard
*320: 00 00 00
*300G
*320.322
320: 20 50 80
*
Worked.
Mike
Dosius wrote:
> Mike Guidero <mike@bogus.net> wrote in message
> news:<unfhja2mf4uce8@corp.supernews.com>... <SNIP>
>> Address translation table:
>> Z80 address 6502 address
>> $0000-$AFFF $1000-$BFFF
>> $B000-$DFFF $D000-$FFFF
>> $E000-$EFFF $C000-$CFFF
>> $F000-$FFFF $0000-$0FFF
> Well, that gives me my RdZ80() and WrZ80() functions... :) I can
> start work on ds80io.c from there... It's something to start with.
> Thx :)