Recently I've been playing around with an Amstrad CPC emulator. I haven't written BASIC code for years, but back in the day I did actually use a CPC for real.
Anyway, looking at documentation online, I see the CPC has a CALL
command, for executing arbitrary Z80 machine code subroutines. However, I'm having trouble finding much documentation about it; most command lists just say "if you don't know what this is, don't touch it!"
CALL
is followed by the address of the machine code to execute. Presumably a simple return-from-subroutine instruction will take you back to BASIC when you're done.
That leaves the problem of how to pass data between BASIC and machine code. In particular, the CALL
command seems to accept additional parameters after the start address, but it doesn't seem to be documented what these actually do. (Sadly, there doesn't appear to be a way to return results back to BASIC.)