Re: [cc65] Problems playing Goattracker BIN files

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-11-02 14:12:09
On Thu, Nov 02, 2006 at 01:49:42PM +0100, Sebastian Gutsfeld wrote:
> Wow, thanks for your very quick reply!
>
> Ullrich von Bassewitz <uz@musoftware.de> writes:
>
> > There are several problems: The linker does not prepend the load address in
> > the resulting binary. You have to do this by adding a word in the source and
> > adjusting the load&run addresses in the config.
> > [...]
> >
> > In addition to that, the memory areas are written to the output file in the
> > order in which they're defined in the config. And the segments are also
> > written in this order. So a (hopefully correct) config would be:
> > [...]
>
> I modified my code but it still isn't working. Here are the modified
> sources:

You didn't tell that you're trying to link against the C library. The RAM
segment does already occupy the space at $801, so trying to add more segments
at the same address must fail. There may be more problems due to memory
layout, but placing your code (the PRG segment) into RAM, and limiting the RAM
segment to $1000 does help somewhat. This will limit the size of the program
sincerely, but once you have something working, it is easier to modify it step
by step.

----[ sid_player_ca65.s ]
         .export _main
         .segment "CODE"

         .addr _main

 _main:  lda #$00
[...]

----[ c64.cfg ]
 MEMORY {
     ZP:  start = $0002, size = $001A, type = rw, define = yes;
     RAM: start = $07FF, size = $0801, file = %O, define = yes;
     SIDDATA: start = $1000, size = $1000, file = %O, define = yes;
 }
 SEGMENTS {
     STARTUP:  load = RAM, type = ro;
     LOWCODE:  load = RAM, type = ro,               optional = yes;
     INIT:     load = RAM, type = ro, define = yes, optional = yes;
     CODE:     load = RAM, type = ro;
     RODATA:   load = RAM, type = ro;
     DATA:     load = RAM, type = rw;
     BSS:      load = RAM, type = bss, define = yes;
     HEAP:     load = RAM, type = bss, optional = yes; # must sit just below stack
     ZEROPAGE: load = ZP,  type = zp;
     SID:      load = SIDDATA, type = ro, define = yes;
 }
 FEATURES {
     CONDES: segment = INIT,
     	    type = constructor,
     	    label = __CONSTRUCTOR_TABLE__,
     	    count = __CONSTRUCTOR_COUNT__;
     CONDES: segment = RODATA,
     	    type = destructor,
 	    label = __DESTRUCTOR_TABLE__,
 	    count = __DESTRUCTOR_COUNT__;
     CONDES: segment = RODATA,
 	    type = interruptor,
 	    label = __INTERRUPTOR_TABLE__,
 	    count = __INTERRUPTOR_COUNT__;
 }
 SYMBOLS {
     __STACKSIZE__ = $800;	# 2K stack
 }

Regards


        Uz (not able to answer more mails before at least this evening)

        
-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Nov 2 14:12:19 2006

This archive was generated by hypermail 2.1.8 : 2006-11-02 14:12:21 CET