68k and z80 linking source

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

68k and z80 linking source

Post by Count SymphoniC » Thu Oct 23, 2014 11:06 pm

I figured it's been long enough for me to ask another question.

How is this accomplished? I'm going to go ahead and learn z80 so I can start work on the DAC portion of my tracker, and I have plenty of documentation *cough* for z80 that I found from google *SNEEZEr57*. But I can't seem to find anything on linking these two assembly types, into one program. Is it even called linking? :)

Yes, that was a playful joke by the way, let's not take it too seriously.
Also I will disappear for a reasonable amount of time again once this question has been answered.

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Fri Oct 24, 2014 12:34 am

Generally you create a raw binary of some sort of your Z80 program and include it in your 68K program as you would any other binary file. The only complication is if your Z80 program needs to refer to data at a particular address in your 68K binary (loading DAC samples through the banked area for instance). I'm not aware of a great solution to that problem.

EDIT: Actually invoking the Z80 portion is the responsibility of your 68K code. Basically involves bus requesting the Z80, copying the data and releasing the bus request (and maybe resetting the Z80 too for good measure).

Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Post by Count SymphoniC » Fri Oct 24, 2014 12:53 am

Mask of Destiny wrote:Generally you create a raw binary of some sort of your Z80 program and include it in your 68K program as you would any other binary file. The only complication is if your Z80 program needs to refer to data at a particular address in your 68K binary (loading DAC samples through the banked area for instance). I'm not aware of a great solution to that problem.

EDIT: Actually invoking the Z80 portion is the responsibility of your 68K code. Basically involves bus requesting the Z80, copying the data and releasing the bus request (and maybe resetting the Z80 too for good measure).
Alright thanks. Good thing I already have bus requests and resets figured out. I'll have to find some source code that does what you describe and understand how it's done from there. That should suffice I think. If I'm unable to figure it out (I don't see why that would be the case) I'll return here. Thanks again.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Oct 24, 2014 8:49 am

Count SymphoniC wrote: Alright thanks. Good thing I already have bus requests and resets figured out. I'll have to find some source code that does what you describe and understand how it's done from there. That should suffice I think. If I'm unable to figure it out (I don't see why that would be the case) I'll return here. Thanks again.
Again you can find all that in SGDK sources ;)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Oct 24, 2014 6:05 pm

A little summary... suppose you need to play a PCM effect via the Z80. The Z80 may need to know the start of the PCM samples, the length, and the rate to play at. Rather than try to have the Z80 read that info from lists in the rom, you instead define set locations in the Z80 sram and have the 68000 fill in those locations with the proper info. It's simple to have the 68000 read the lists in rom since the linker works on the 68000, so have it retrieve the data for the Z80. Doing things that way make it simple to coordinate the Z80 and 68000.

Post Reply