Re: [cc65] Need help getting started with cc65 NES

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2005-11-16 23:42:14
On Wed, Nov 16, 2005 at 04:32:13PM -0600, PH wrote:
> There is RAM at those locations, but it is Save RAM (I'm not sure what
> the specific use is), so maybe that is ok.  When it jumps there, the
> condes code isn't there that I can see.  The line it hits is a BRK.

Ok. If there is no code, it cannot be executed:-) So either there's no RAM, or
the copy operation fails for some reason. If you look at the startup code in
the crt0.s file, you will notice a block of code that starts with

        ; Copy the .data segment to RAM

This is the code that copies that initialization data from the ROM into the
RAM. Please check if this code works (it probably won't). That means, if a
copied byte does actually appear at the target location. Unfortunately, I
don't have any ideas what might be wrong besides missing or non writable RAM
at $6000.

> As far as simpler programs, I don't think I could get much more
> simplified.  I would maybe have to compile without the -t nes option and
> try something else that doesn't include any startup code, but I don't
> know what that would be.  I do wish I had the option of what init code
> is called, such as having to call an Init() function if I want to use
> the built in init code.

The startup code is always needed, because it does things like initialize the
bss segment, setup the stack and so on. Without the startup code, the
translated C code won't work. Simpler code (like the one from my earlier mail)
will still have the startup code prepended, but almost no additional library
initialization code added. The library initialization code is what is called
from the initlib routine. Using explicit calls to init routines is a bad idea.
For one, it is difficult to oversee, which calls are needed, because this
depends on the target platform and which library routines are used. Second, a
special calling order has to be used. And third, the compiler would violate
the standard, because a simple

        #include <stdlib.h>
        #include <stdio.h>

        int main (void)
        {
            printf ("hello world!\n");
            return EXIT_SUCCESS;
        }

would no longer work.

Regards


        Uz


-- 
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 Wed Nov 16 23:42:28 2005

This archive was generated by hypermail 2.1.8 : 2005-11-16 23:42:30 CET