RosettaCodeData/Task/Call-a-foreign-language-fun.../68000-Assembly/call-a-foreign-language-fun...

17 lines
591 B
Plaintext

Z80_Call:
MOVE.W #$100,$A11100 ;write: z80 reset
.wait:
BTST #8,$A11100 ;read: check bit 8 to see if the z80 is busy
BNE .wait ;loop until not busy
;now we write the function address
;z80 is little-endian so we need to reverse the byte order.
;also 68000 cannot safely write words at odd addresses so we need to write as bytes.
MOVE.B #$72,$A0006D
MOVE.B #$00,$A0006E ;this changes the "call &0000" above to "call ExampleFunction"
MOVE.B #$FF,$A01F01 ;unlock the semaphore
MOVE.W #0,$A11100 ;Z80 Bus Request - after this write, the Z80 will start executing code.