Re: [cc65] cfg-files and the linker and so on..

From: Groepaz <groepaz1gmx.net>
Date: 2004-09-25 17:09:48
On Saturday 25 September 2004 16:55, Mats Andrén wrote:
> This works nicely, but the RAM area after the startupcode
> ($08xx-$0fff) is now unused since the editor code segment currently
> starts at $2000. Now let's say that I'd like to be able to simply
> relocate the asm-player-code to some other adress, like $6000 or
> whatever, then I'd obviously like to have some of the editor-code
> going before that segment and some of it after it since the memory
> after the player-code would be to small to hold the complete editor code.
> Is that possible somehow, or am I asking too much? Perhaps I have to
> do this by myself, by changing here and there in my C code where
> different parts of the C code should go, so some of it ends up before
> the player and some of it ends up after it?
> 
> Also, the size of the asm-player-code is not really known, but changes
> as I do changes to the player-code. Could the linker (or something
> else) somehow detect where the playercode ends and automatically make
> the C code start right after it, without me having to explicitly
> define beforehand how big the asm-player-code-segment should be in the
> cfg-file?
> 
> Also, should I really be required to have that "fill = yes"-snippet in
> the cfg-file to make the linker understand that I don't want a binary
> that only contains the code I've actually written, but that I actually
> want it to automatically end up at those places in memory that I have
> specified in the cfg-file, with chunks of empty space in between? I
> thought "load = $xxxx" was supposed to take care of that?
> 
> I am really new to cc65 (even though I have used ca65 a bit before),
> so please bear with me if I'm just confused and do not make sense.
> 
> Any suggestion for a better cfg-file for me?

you are thinking to complicated :) you dont need a special config at all...
write your player like this:

	.export play,init

	.code

init:
	jmp realinit
play:
	jmp realplay

	<playercode here>

	.rodata

	.byte 1,2,3

	<constant data for player>

	.data

	.byte 1,2,3

	<initialized variables for player>

	.bss

	.res 3

	<non initialized variables for player>

note: you probably dont want to use the .data section, since that
would require a startup code later

assemble that, and link it to your c-program...the linker will take
care of relocating it and placing it memory so it fits.

then if you later want to create a "standalone" version of your player
(and music data) -traditionally starting at $1000-, then use a simple
config file that places stuff at $1000 (and dont link the startup code
ofcourse).

mmmh...hope that helps :)

gpz
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Sep 25 17:10:55 2004

This archive was generated by hypermail 2.1.8 : 2004-09-25 17:11:03 CEST