68k/Z80 communication: Difference between revisions
m (4 revisions: Import from wikkii) |
mNo edit summary |
||
Line 4: | Line 4: | ||
Any byte can be sent, their meaning are only determined by the way the Z80 code handles them except for 3 special cases, as seen below. | Any byte can be sent, their meaning are only determined by the way the Z80 code handles them except for 3 special cases, as seen below. | ||
When a byte is sent, the corresponding value is buffered in either the [[NEO-SUD]] or [[NEO- | When a byte is sent, the corresponding value is buffered in either the [[NEO-SUD]] or [[NEO-C1]] chip, and an NMI is generated on the Z80 if enabled. It can then be read on port $00. | ||
(What chip is used on first gen chipset?) | |||
== Z80 to 68k == | == Z80 to 68k == | ||
Line 15: | Line 17: | ||
== Special cases == | == Special cases == | ||
Commands $01 and $03 are always expected to be implemented as they are used by the BIOSes for initialization purposes. | Commands $01 and $03 are always expected to be implemented as they are used by the BIOSes for initialization purposes. | ||
Typically, if the Z80 doesn't reply to command $01 in time, the "Z80 ERROR" message is displayed and the system locks up. | Typically, if the Z80 doesn't reply to command $01 in time, the "[[Z80 ERROR]]" message is displayed and the system locks up. | ||
Command $03 is then sent to ask for a soft reset of the Z80, but no replies are expected. | Command $03 is then sent to ask for a soft reset of the Z80, but no replies are expected. |
Revision as of 05:02, 30 June 2011
68k to Z80
Writes to the Z80 are byte-wide and made through $320000.
Any byte can be sent, their meaning are only determined by the way the Z80 code handles them except for 3 special cases, as seen below.
When a byte is sent, the corresponding value is buffered in either the NEO-SUD or NEO-C1 chip, and an NMI is generated on the Z80 if enabled. It can then be read on port $00.
(What chip is used on first gen chipset?)
Z80 to 68k
Port $0C is used to reply to the 68K. The value is also buffered in the same chips, but there's no interrupts generated. The value can be read by using the same register, $320000.
Many drivers acknowledge sound commands by echoing them back with bit 7 set to 1 when they are processed.
Special cases
Commands $01 and $03 are always expected to be implemented as they are used by the BIOSes for initialization purposes. Typically, if the Z80 doesn't reply to command $01 in time, the "Z80 ERROR" message is displayed and the system locks up.
Command $03 is then sent to ask for a soft reset of the Z80, but no replies are expected.
Command $02 is used by cartridge systems to play the boot music. The pattern (melody) was certainly imposed by SNK, but developers often chose their own instruments parameters. Boot music.
These are sufficient handlers for both init commands:
Command01_Handler: ; with the command in A di ; disable interrupts ld sp, $FFFF ; clear call stack out ($0C),a ; echo the command jr NMI_End ; usually POPs, then RETN
Command03_Handler: ; with the command in A di ; disable interrupts ld sp, $FFFF ; clear call stack ld hl,0 push hl retn ; RETN to 0