Jump to content
IGNORED

CC65 - Error - Unresolved external '__MAIN_START__'


Recommended Posts

I have question about an error I am receiving in CC65.

 

I thought I might try to add speech via FujiNet, to my game Adventure Ponies if I can squeeze enough memory to add it.  However I am running into a problem.  Adventure Ponies was created in an older version of CC65.  I just downloaded the latest version of CC65 and now the game will no longer compile.

 

I get the following error:

 

atari/exehdr.s:10: Error: Unresolved external '__MAIN_START__'

 

The __MAIN_START__ is not in any of my files, I did a quick search, nor can I find atari/exehdr.s in any of the directories under C:\CC65

 

I figure it is legacy related to an earlier version of CC65, maybe something deprecated in my config file:

 

Here is my current config file, if any one has any suggestions:

 

FEATURES {
    STARTADDRESS: default = $4000;
}
SYMBOLS {
    __EXEHDR__:          type = import;
    __SYSTEM_CHECK__:    type = import;  # force inclusion of "system check" load chunk
    __AUTOSTART__:       type = import;  # force inclusion of autostart "trailer"
    __STACKSIZE__:       type = weak, value = $0800; # 2k stack
    __STARTADDRESS__:    type = export, value = %S;
    __RESERVED_MEMORY__: type = weak, value = $0000;
}
MEMORY {
    ZP:            file = "", define = yes, start = $0082, size = $007E;

# file header, just $FFFF
    HEADER:        file = %O,               start = $0000, size = $0002;
	
# Disable Basic
	DISBASHDR:       file = %O,               	start = $0000, size = $0004;
	DISBASIC:      file = %O,               	start = $0400, size = $0048;
	
# Disable Basic INIT	
    DISBASINITHDR:     	file = %O,              start = $0000, size = $0004;
	DISBASINIT: 		file = %O, 				start = $02E2, size = $0002;
		
# Splash Screen
	SPLASHHDR:       file = %O,               	start = $0000, size = $0004;
	SPLASHDATA:      file = %O,               	start = $3100, size = $1460;
	
# Splash INIT	
    SPINITHDR:     	file = %O,              start = $0000, size = $0004;
	SPINIT: 		file = %O, 				start = $02E2, size = $0002;
	
# High RAM Data
	PREHDR:     file = %O,               start = $0000, size = $0004;
    HIRAM:    file = %O,               start = $2000, size = $37CD;
	
# High RAM INIT	
    INITHDR:     	file = %O,              start = $0000, size = $0006;
	HINIT: 			file = %O, 				start = $02E2, size = $0002;

# "system check" load chunk
    SYSCHKHDR:     file = %O,               start = $0000, size = $0004;
    SYSCHKCHNK:    file = %O,               start = $2E00, size = $0300;
    SYSCHKTRL:     file = %O,               start = $0000, size = $0006;

# "main program" load chunk
    FSTHDR:       file = %O,               start = $0000, size = $0004;
    RAM:           file = %O, define = yes, start = %S,    size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;

# DISCARD is set to page 6 for now, because we don't care if that is written to but then again since it goes to file="" it shouldn't matter where it goes
	DISCARD: 	start = $0600, size = $0006, file = ""; 
	
# Char area
	SECHDR:       file = %O,               start = $0000, size = $0004;
	CHAR:		   file = %O,				start = $2400,  size = $0600;
	
# Media area
	THRHDR:       file = %O,               start = $0000, size = $0004;
	MEDIA:		   file = %O,			   start = $2000,  size = $0300;

# Display List Data
	FORHDR:       file = %O,               	start = $0000, size = $0004;
	DL:		  file = %O,				start = $2300,  size = $00FF;
	
# Level Data (LVL must start at page boundry (00) or causes screen tearing due to how the course scroll is implemented)
	FIVHDR:       file = %O,               	start = $0000, size = $0004;
	SETUP:		  file = %O,				start = $2A00,  size = $0700;
	
    TRAILER:       file = %O,               start = $0000, size = $0006;


}
SEGMENTS {
    EXEHDR:    load = HEADER,     type = ro;
    SYSCHKHDR: load = SYSCHKHDR,  type = ro,                optional = yes;
    SYSCHK:    load = SYSCHKCHNK, type = rw,  define = yes, optional = yes;
    SYSCHKTRL: load = SYSCHKTRL,  type = ro,                optional = yes;
    MAINHDR:   load = DISCARD,    type = ro;
	
	NEXEHDR:   load = FSTHDR, type = ro;                  # first load chunk
	DLICODE:   load = RAM,		  type = ro,   align = $100, define = yes;	 
    STARTUP:   load = RAM,        type = ro,  define = yes;
    LOWCODE:   load = RAM,        type = ro,  define = yes, optional = yes;
    INIT:      load = RAM,        type = ro,                optional = yes;
    CODE:      load = RAM,        type = ro,  define = yes;
    RODATA:    load = RAM,        type = ro;
    DATA:      load = RAM,        type = rw;
    BSS:       load = RAM,        type = bss, define = yes;
    ZEROPAGE:  load = ZP,         type = zp;
    EXTZP:     load = ZP,         type = zp,                optional = yes;
		
    CHARHDR:   load = SECHDR, type = ro;                   # second load chunk
	CHARDATA:  load = CHAR,	  type = rw, define = yes;
	MEDIAHDR:   load = THRHDR, type = ro;   # third load chunk
	MEDIADATA:  load = MEDIA,  type = rw, define = yes;	
	DLHDR:   load = FORHDR, type = ro;                   # fourth load chunk
	DLDATA:  load = DL,	  type = rw, define = yes;
	SETUPHDR:   load = FIVHDR, type = ro;               # five load chunk
	SETUPDATA:  load = SETUP,	  type = rw, define = yes;	
	HIRAMHDR:   load = PREHDR, type = ro;               # five load chunk
	HIRAMDATA:  load = HIRAM,	  type = rw, define = yes;	
	HINITHDR:   load = INITHDR, type = ro;               # five load chunk
	HINITDATA:  load = HINIT,	  type = rw, define = yes;	
	SPLASHHDR:	load = SPLASHHDR, type = ro;    #Splash load chunk
	SPLASHDATA:	load = SPLASHDATA, type = rw, define = yes;	    #Splash Data	
	SPINITHDR:  load = SPINITHDR, type = ro;               # five load chunk
	SPINITDATA: load = SPINIT, type = rw,	define=yes;		#splash init
	
	DISBASHDR:	load = DISBASHDR, type = ro;    #Splash load chunk
	DISBASIC:	load = DISBASIC, type = rw, define = yes;	    #Splash Data	
	DISBASINITHDR:  load = DISBASINITHDR, type = ro;               # five load chunk
	DISBASINIT: load = DISBASINIT, type = rw,	define=yes;		#splash init

    AUTOSTRT:  load = TRAILER,    type = ro;
}
	
FEATURES {
    CONDES: type    = constructor,
            label   = __CONSTRUCTOR_TABLE__,
            count   = __CONSTRUCTOR_COUNT__,
            segment = INIT;
    CONDES: type    = destructor,
            label   = __DESTRUCTOR_TABLE__,
            count   = __DESTRUCTOR_COUNT__,
            segment = RODATA;
    CONDES: type    = interruptor,
            label   = __INTERRUPTOR_TABLE__,
            count   = __INTERRUPTOR_COUNT__,
            segment = RODATA,
            import  = __CALLI;
}

 

Thanks for any suggestions.

Link to comment
Share on other sites

6 minutes ago, Wrathchild said:

Should be being generated by the linker but you don't have a MAIN segment

It would be referenced within MAINHDR and so that looks like it is not needed and could be removed from your config?

Thanks for the suggestion I tried removing it/commenting it out, but I still received the same error.

 

I did find a previous version of CC65 on one of my flash drives.  I may just use the older version.

Link to comment
Share on other sites

Hi!

6 hours ago, Gibstov said:

I have question about an error I am receiving in CC65.

 

I thought I might try to add speech via FujiNet, to my game Adventure Ponies if I can squeeze enough memory to add it.  However I am running into a problem.  Adventure Ponies was created in an older version of CC65.  I just downloaded the latest version of CC65 and now the game will no longer compile.

 

I get the following error:

 

atari/exehdr.s:10: Error: Unresolved external '__MAIN_START__'

 

The __MAIN_START__ is not in any of my files, I did a quick search, nor can I find atari/exehdr.s in any of the directories under C:\CC65

 

The symbol __MAIN_START__ is defined by the linker, it is the START address of the MAIN memory area...

 

6 hours ago, Gibstov said:

I figure it is legacy related to an earlier version of CC65, maybe something deprecated in my config file:

 

Here is my current config file, if any one has any suggestions:

....

6 hours ago, Gibstov said:

# "main program" load chunk
    FSTHDR:       file = %O,               start = $0000, size = $0004;
    RAM:           file = %O, define = yes, start = %S,    size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;

 

But here, your main memory area is named "RAM".

 

So, changing all instances of "RAM" into "MAIN" will make your program compile.

 

But IMHO, your linker script is too complicated, you are defining many headers, segments, etc., I think you should simplify it:

 

- Do you need the system check?? If you want to do the check, it should be before the splash screen, to show the error as earlier as possible.

- Having so many segments, your linker script would be much simpler by using the ATARI format in the linker script. This format writes the headers automatically, you don´t need to include them manually as extra segments.

 

This is my suggested linker config, note that I don´t know the names of the symbols that should be called from the initializing sections, so I used the names "disable_basic_start", "splash_start" and "hinit_start" respectively. The actual names should be exported in the assembly files, the linker will import them as needed.

 

FEATURES {
    STARTADDRESS: default = $4000;
}

# Here we define the output format as "ATARI" format (the standar XEX file format)
FILES {
    %O: format = atari;
}

# Here, we remove the SYSTEM_CHECK, we would not use it,
# and the AUTOSTART as we don´t need manual headers.
SYMBOLS {
    __STACKSIZE__:       type = weak, value = $0800; # 2k stack
    __STARTADDRESS__:    type = export, value = %S;
    __RESERVED_MEMORY__: type = weak, value = $0000;
}

# Minimal memory areas:
MEMORY {
 # ZP, we always need those. As you don´t use BASIC, you can start at $80 instead of $82:
    ZP:            file = "", define = yes, start = $0080, size = $0080;

 # Disable Basic, header and init are not needed. The size could be bigger,
 # it only needs to be bigger than the actual code.
	DISBASIC:      file = %O,               	start = $0400, size = $0048;

 # Splash Screen, also header and init not needed
	SPLASHDATA:    file = %O,               	start = $3100, size = $1460;

 # High RAM Data.
 # --- Why it is called HI if address $2000 is "lowish"?
    HIRAM:    file = %O,               start = $2000, size = $37CD;

 # "main program" load chunk
    MAIN:     file = %O, define = yes, start = %S,    size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;

 # Char area
	CHAR:		   file = %O,				start = $2400,  size = $0600;
 # Media area
	MEDIA:		   file = %O,			   start = $2000,  size = $0300;
 # Display List Data
	DL:		  file = %O,				start = $2300,  size = $00FF;
 # Level Data (LVL must start at page boundry (00) or causes screen tearing due to how the course scroll is implemented)
	SETUP:		  file = %O,				start = $2A00,  size = $0700;
}

# The segments, as we don´t need headers it is simpler!
SEGMENTS {
	DLICODE:    load = MAIN,        type = ro,   align = $100, define = yes;
	STARTUP:    load = MAIN,        type = ro,  define = yes;
	LOWCODE:    load = MAIN,        type = ro,  define = yes, optional = yes;
	INIT:       load = MAIN,        type = ro,                optional = yes;
	CODE:       load = MAIN,        type = ro,  define = yes;
	RODATA:     load = MAIN,        type = ro;
	DATA:       load = MAIN,        type = rw;
	BSS:        load = MAIN,        type = bss, define = yes;
	ZEROPAGE:   load = ZP,          type = zp;
	EXTZP:      load = ZP,          type = zp,                optional = yes;

	CHARDATA:   load = CHAR,	type = rw, define = yes;
	MEDIADATA:  load = MEDIA,       type = rw, define = yes;
	DLDATA:     load = DL,	        type = rw, define = yes;
	SETUPDATA:  load = SETUP,	type = rw, define = yes;
	HIRAMDATA:  load = HIRAM,	type = rw, define = yes;
	SPLASHDATA: load = SPLASHDATA,  type = rw, define = yes;
	DISBASIC:   load = DISBASIC,    type = rw, define = yes;
}

# Here we specify the init and run addresses for the program. Each memory area that needs
# to run before the main program should be listed:
FORMATS {
    atari: runad = start,
           initad = DISBASIC: disable_basic_start,
           initad = SPLASHDATA: splash_start,
           initad = HIRAM: hinit_start;
}


FEATURES {
    CONDES: type    = constructor,
            label   = __CONSTRUCTOR_TABLE__,
            count   = __CONSTRUCTOR_COUNT__,
            segment = INIT;
    CONDES: type    = destructor,
            label   = __DESTRUCTOR_TABLE__,
            count   = __DESTRUCTOR_COUNT__,
            segment = RODATA;
    CONDES: type    = interruptor,
            label   = __INTERRUPTOR_TABLE__,
            count   = __INTERRUPTOR_COUNT__,
            segment = RODATA,
            import  = __CALLI;
}

 

Have Fun!

  • Like 3
Link to comment
Share on other sites

14 hours ago, dmsc said:

Hi!

 

The symbol __MAIN_START__ is defined by the linker, it is the START address of the MAIN memory area...

 

....

But here, your main memory area is named "RAM".

 

So, changing all instances of "RAM" into "MAIN" will make your program compile.

 

But IMHO, your linker script is too complicated, you are defining many headers, segments, etc., I think you should simplify it:

 

- Do you need the system check?? If you want to do the check, it should be before the splash screen, to show the error as earlier as possible.

- Having so many segments, your linker script would be much simpler by using the ATARI format in the linker script. This format writes the headers automatically, you don´t need to include them manually as extra segments.

 

This is my suggested linker config, note that I don´t know the names of the symbols that should be called from the initializing sections, so I used the names "disable_basic_start", "splash_start" and "hinit_start" respectively. The actual names should be exported in the assembly files, the linker will import them as needed.

 

 

Have Fun!

Thanks with your help with this. I'll try the changes and see if I can get it working, but if it seems like I am going down a rabbit hole, I may just try using the older version of CC65 I found.

 

 

Link to comment
Share on other sites

Hi!

15 minutes ago, Gibstov said:

Thanks with your help with this. I'll try the changes and see if I can get it working, but if it seems like I am going down a rabbit hole, I may just try using the older version of CC65 I found.

 

Try to use the newer version. it is much better. I will try to help you along.

 

Have Fun!

  • Like 2
Link to comment
Share on other sites

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...