It is currently Mon May 20, 2019 8:15 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Mar 25, 2019 11:23 am 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
So, i'm new to the NES development culture, I got the basic jest of how to code in assembly, I installed nesicide, but the only thing that's keeping me from developing is an error in the ld65 compiler.

The compiling log says the point of error is from the linker config for ld65. Here's the code.

Code:
MEMORY {

    # First 28 bytes of the zero page are used by NES library
    ZP: start = $28, size = $d8, type = rw, define = yes;

    # INES Cartridge Header
    HEADER: start = $0, size = $10, file = %O ,fill = yes;
    # 2 16K ROM Banks
    # - startup
    # - code
    # - rodata
    # - data (load)

    PRG: start = $8000, size = $3f00, file = %O ,fill = yes, define = yes;
    # NROM256
    # PRG: start = $8000, size = $7f00, file = %O ,fill = yes, define = yes;
    # DPCM Samples at end of the ROM
    DMC: start = $7f00, size = $fa, file = %O, fill = yes;
    # NROM256
    # DMC: start = $ff00, size = $fa, file = %O, fill = yes;
    # Hardware Vectors at end of the ROM
    VECTORS: start = $7ffa, size = $6, file = %O, fill = yes;
    # NROM256
    # VECTORS: start = $fffa, size = $6, file = %O, fill = yes;
    # 1 8K CHR Bank
    CHR: start = $0000, size = $2000, file = %O, fill = yes;
    # standard 2K SRAM (-zeropage)
    # $0100 famitone, palette, cpu stack
    # $0200 oam buffer
    # $0300..$800 ca65 stack
    RAM: start = $0300, size = $0500, define = yes;
    # Use this definition instead if you going to use extra 8K RAM
    # RAM: start = $6000, size = $2000, define = yes;
}


SEGMENTS {

    HEADER: load = HEADER, type = ro;
    STARTUP: load = PRG, type = ro, define = yes;
    LOWCODE: load = PRG, type = ro, optional = yes;
    INIT: load = PRG, type = ro, define = yes, optional = yes;
    CODE: load = PRG, type = ro, define = yes;
    RODATA: load = PRG, type = ro, define = yes;
    DATA: load = PRG, run = RAM, type = rw, define = yes;
    VECTORS: load = VECTORS, type = rw;
    SAMPLES: load = DMC, type = rw;
    CHARS: load = CHR, type = rw;
    BSS: load = RAM, type = bss, define = yes;
    HEAP: load = RAM, type = bss, optional = yes;
    ZEROPAGE: load = ZP, type = zp;

}


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

SYMBOLS {
   __STACKSIZE__ : type = weak, value = $0500;
}

Here's the compiling log:
Code:
Project build started.
Building: CHR/newgame.chr
Constructing 'Bank 0':
   Adding: chrrom.bin(8192 bytes)
Building: PRG/newgame.prg
make all
cl65 -C LINKER.cfg -Wl --dbgfile,newgame.dbg ./main.o -o PRG/newgame.prg
ld65: Error: LINKER.cfg(101): Block identifier expected, got 'VALUE'
make: *** [PRG/newgame.prg] Error 1
Build failed.

And here's the versions of programs I'm using
    NESICIDE Application version:
    V1.007 RELEASE

    NESICIDE Emulator Library version:
    V1.003 RELEASE

    Versions of external dependencies:
    cc65:
    cc65 V2.17 - Git 2cd4b51

    ca65
    ca65 V2.17 - Git 2cd4b51

    ld65
    ld65 V2.17 - Git 2cd4b51

    make
    GNU Make 3.81
If anybody has an idea of what I'm doing wrong, please don;t hesitate to say. :) :)

EDIT: I decided to move away from cc65 and decided to use nesasm3. So far i was able to follow up to Week 6 of Nerdy Nights. However i need help with one project. http://forums.nesdev.com/viewtopic.php?f=10&t=18647


Last edited by radishking27 on Thu Mar 28, 2019 2:34 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Mar 25, 2019 12:04 pm 
Offline
User avatar

Joined: Fri Nov 24, 2017 2:40 pm
Posts: 153
You sure that .cfg file you posted is right? It says the error is on line 101, but you only posted 70 lines.


Top
 Profile  
 
PostPosted: Mon Mar 25, 2019 1:08 pm 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
slembcke wrote:
You sure that .cfg file you posted is right? It says the error is on line 101, but you only posted 70 lines.


sorry here's the updated config. This is where the extra config lines went.
Code:
MEMORY {

    # First 28 bytes of the zero page are used by NES library
    ZP: start = $28, size = $d8, type = rw, define = yes;

    # INES Cartridge Header
    HEADER: start = $0, size = $10, file = %O ,fill = yes;
    # 2 16K ROM Banks
    # - startup
    # - code
    # - rodata
    # - data (load)

    PRG: start = $8000, size = $3f00, file = %O ,fill = yes, define = yes;
    # NROM256
    # PRG: start = $8000, size = $7f00, file = %O ,fill = yes, define = yes;
    # DPCM Samples at end of the ROM
    DMC: start = $7f00, size = $fa, file = %O, fill = yes;
    # NROM256
    # DMC: start = $ff00, size = $fa, file = %O, fill = yes;
    # Hardware Vectors at end of the ROM
    VECTORS: start = $7ffa, size = $6, file = %O, fill = yes;
    # NROM256
    # VECTORS: start = $fffa, size = $6, file = %O, fill = yes;
    # 1 8K CHR Bank
    CHR: start = $0000, size = $2000, file = %O, fill = yes;
    # standard 2K SRAM (-zeropage)
    # $0100 famitone, palette, cpu stack
    # $0200 oam buffer
    # $0300..$800 ca65 stack
    RAM: start = $0300, size = $0500, define = yes;
    # Use this definition instead if you going to use extra 8K RAM
    # RAM: start = $6000, size = $2000, define = yes;
}


SEGMENTS {

    HEADER: load = HEADER, type = ro;

    STARTUP: load = PRG, type = ro, define = yes;

    LOWCODE: load = PRG, type = ro, optional = yes;

    INIT: load = PRG, type = ro, define = yes, optional = yes;

    CODE: load = PRG, type = ro, define = yes;

    RODATA: load = PRG, type = ro, define = yes;

    DATA: load = PRG, run = RAM, type = rw, define = yes;

    VECTORS: load = VECTORS, type = rw;

    SAMPLES: load = DMC, type = rw;

    CHARS: load = CHR, type = rw;

    BSS: load = RAM, type = bss, define = yes;

    HEAP: load = RAM, type = bss, optional = yes;

    ZEROPAGE: load = ZP, type = zp;

}


FEATURES {

    CONDES: segment = INIT,

            type = constructor,

            label = __CONSTRUCTOR_TABLE__,

            count = __CONSTRUCTOR_COUNT__;

    CONDES: segment = RODATA,

            type = destructor,

            label = __DESTRUCTOR_TABLE__,

            count = __DESTRUCTOR_COUNT__;

    CONDES: type = interruptor,

            segment = RODATA,

            label = __INTERRUPTOR_TABLE__,

            count = __INTERRUPTOR_COUNT__;

}


SYMBOLS {

   __STACKSIZE__ : type = weak, value = $0500;

}


I tried to compiled it again and now i got this compile log
Code:
Project build started.
Building: CHR/newgame.chr
Constructing 'Bank 0':
   Adding: chrrom.bin(8192 bytes)
Building: PRG/newgame.prg
make all
make: Nothing to be done for `all'.
Writing: newgame.nes
Build completed successfully.

However when i run the .nes file in the emulator, this is what i get
Code:
Loading ROM...
Reading NES executable from: newgame.nes
Load failed.


Top
 Profile  
 
PostPosted: Mon Mar 25, 2019 1:10 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2505
Location: DIGDUG
The relevant source code for ld65...

Code:
static const IdentTok BlockNames [] = {
        {   "MEMORY",   CFGTOK_MEMORY   },
        {   "FILES",    CFGTOK_FILES    },
        {   "SEGMENTS", CFGTOK_SEGMENTS },
        {   "FORMATS",  CFGTOK_FORMATS  },
        {   "FEATURES", CFGTOK_FEATURES },
        {   "SYMBOLS",  CFGTOK_SYMBOLS  },
    };
    cfgtok_t BlockTok;

    do {

        /* Read the block ident */
        CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier");
        BlockTok = CfgTok;
        CfgNextTok ();

        /* Expected a curly brace */
        CfgConsume (CFGTOK_LCURLY, "'{' expected");


So, block identifiers are words like MEMORY, SEGMENTS, SYMBOLS.

It somehow saw the word "VALUE" outside of a curly brace area { } which it didn't recognize as a block identifier.


Edit, I see now that you did get it to compile, but failed to load...
Look in the folder, do you see a newgame.nes file? How big is it, in bytes?

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Tue Mar 26, 2019 7:30 am 
Offline
NESICIDE developer
User avatar

Joined: Mon Oct 13, 2008 7:55 pm
Posts: 1089
Location: Minneapolis, MN
radishking27 wrote:
If anybody has an idea of what I'm doing wrong, please don;t hesitate to say. :) :)

I don't know, but that seems to be a very old version...here's the latest in Windows:
NESICIDE Application version:
v2.0.0 RELEASE

NES Emulator Library version:
v2.0.0 RELEASE

Commodore 64 (VICE Interface) Library version:
v2.0.0 RELEASE

Versions of external dependencies:
cc65:
cc65 V2.17 - Git c37582bb

ca65
ca65 V2.17 - Git c37582bb

ld65
ld65 V2.17 - Git c37582bb

make
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-pc-mingw32


Top
 Profile  
 
PostPosted: Tue Apr 02, 2019 8:44 am 
Offline
User avatar

Joined: Sat Sep 01, 2018 12:39 pm
Posts: 9
Location: Gothenburg, Sweden
I can see a number of issues with your config file. First of all, VECTORS and and SAMPLES are in the wrong order in SEGMENTS (the order there defines the order in which they are written to the .nes file), you need to swap their positions. Also, your DMC and VECTOR memory areas starts at $7f00, but that's not at the end of the ROM, that's before the ROM (which starts at $8000). The vectors must always be at $fffa, though with a single 16KB bank on NROM-128 that's a mirror of $bffa. So you probably want to replace those addresses with either $bf00 and $bffa or $ff00 and $fffa

But actually, what mapper/board are you using? I'm just assuming NROM-128 (iNES mapper 0) because of the commented-out NROM-256 lines, and the single 16KB PRG bank.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group