Call a foreign-language function: Difference between revisions

Content added Content deleted
Line 22: Line 22:


The Genesis uses a Z80 coprocessor to interface with its sound hardware. The Z80 executes its code from RAM, so before starting this, you have to <code>memcpy</code> the compiled program code from the Genesis cartridge ROM to the shared RAM area at $A00000. Since this task is about calling a function, we'll show the z80 code necessary to do that. Thanks to [https://www.chibiakumas.com/68000/platform2.php#LessonP20 this tutorial] for guidance on how this all works.
The Genesis uses a Z80 coprocessor to interface with its sound hardware. The Z80 executes its code from RAM, so before starting this, you have to <code>memcpy</code> the compiled program code from the Genesis cartridge ROM to the shared RAM area at $A00000. Since this task is about calling a function, we'll show the z80 code necessary to do that. Thanks to [https://www.chibiakumas.com/68000/platform2.php#LessonP20 this tutorial] for guidance on how this all works.

(Technically, the 68000 isn't calling the function itself, since it doesn't understand Z80 code at all; rather, it's instructing the Z80 to call and execute the function on its behalf. But this is probably as close as we'll ever get.)


<lang z80>
<lang z80>