rNES - a NES library for cc65 - version 0.1 released

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Buba
Posts: 6
Joined: Sun Oct 10, 2010 12:30 pm

Post by Buba » Sat Nov 06, 2010 10:27 am

Cant compile examples. It seems that nes-chr-ram.cfg is buggy. Linker says

Code: Select all

ld65: Warning: Duplicate external identifier: `_exit'
ld65: Warning: Memory area overflow in `HEADER', segment `HEADER' (16 bytes)
ld65: Warning: Memory area overflow in `ROMV', segment `VECTORS' (12 bytes)
ld65: Error: Cannot generate output due to memory area overflows

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Post by Petruza » Sat Nov 06, 2010 10:50 am

Unfortunately I can't help you, since my understanding of ld65's memory blocks was already weak at its peak, and now it's completely gone due to months not even looking at the code. :(

If you can fix it, let us know, though.
Last edited by Petruza on Mon Mar 28, 2011 2:30 pm, edited 1 time in total.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Sat Nov 06, 2010 12:41 pm

You're linking something more than once. What's your makefile/build script look like?

Buba
Posts: 6
Joined: Sun Oct 10, 2010 12:30 pm

Post by Buba » Sat Nov 06, 2010 1:57 pm

Copypasted from readme and add map file option

Code: Select all

ld65 -C ../tools/nes_chr-ram.cfg  NEStronome.o  ../rNES.o  ../tools/nes_chr-ram.o  nes.lib  atmos.lib -o NEStronome.nes -m map
I dont know if it really need atmos.lib. Remove it have no effect
From map file:

Code: Select all

Segment list:
-------------
Name                  Start   End     Size
--------------------------------------------
CHARS                 000000  000FFF  001000
HEADER                000000  00001F  000020
ZEROPAGE              000002  00001B  00001A
DATA                  006000  0064B7  0004B8
BSS                   0064B8  0064FD  000046
STARTUP               008000  0080B9  0000BA
INIT                  0080BA  0080E9  000030
CODE                  0080EA  0093AC  0012C3
RODATA                0093AD  009524  000178
VECTORS               00FFF6  01000D  000018
Anyway, rNES itself doesnt want to compile:

Code: Select all

rNES.c(97): Error: Invalid right operand for binary operator `+='
rNES.c(209): Error: Invalid right operand for binary operator `+='
Code like this:

Code: Select all

void rNES_copy_vram( byte *source, word length, word target )
{
	byte *top = source;
	top += (byte*)length;
Error in the last line. Is (byte*) really need in this place?

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Sat Nov 06, 2010 2:10 pm

Try removing each of the .o files from the ld65 line to find which one(s) are responsible for the duplicate _exit error and HEADER overflow error. And yeah, that cast is erroneous. Maybe an older version of cc65 was more tolerant of errors like this.

Buba
Posts: 6
Joined: Sun Oct 10, 2010 12:30 pm

Post by Buba » Sat Nov 06, 2010 2:18 pm

There are _exit in nes.lib and nes-chr-ram.o . I turned off exporting _exit in nes-chr-ram and reassembled it. This warning is gone, but other errors and warnings still in place

Buba
Posts: 6
Joined: Sun Oct 10, 2010 12:30 pm

Post by Buba » Mon Mar 28, 2011 1:32 pm

It seems that i managed to compile helloworld with rNES. I used cc65 ver. 2.13.2 and rNES 0.1. Build system of 0.2 is too complex for me now. How to do it:
Use local copy of nes.lib and remove crt0.o from it:

Code: Select all

ar65 d nes.lib crt0.o
Add line

Code: Select all

.export         __STARTUP__ : absolute = 1
to the export part of crt0_chr-ram.s and recompile it:

Code: Select all

ca65 crt0_chr-ram.s
Compile and assemble your program as write in the manual:

Code: Select all

cc65 hello.c
ca65 hello.s
Link it with changed command. I presume that all needed files in the same directory

Code: Select all

ld65 -C nes_chr-ram.cfg  crt0_chr-ram.o  hello.o  rNES.o ./nes.lib -o hello.nes

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Re: rNES - a NES library for cc65 - version 0.1 released

Post by Petruza » Thu Jan 23, 2014 11:26 am

Hi, it's been around 5 years since I stopped development on rNES, so have that in mind, I barely remember any technical details about it.
But some people asked about it since the download links stopped working, so I put it up again in case anyone wants to take a look.
The source is a bit of a mess, you should look for the folder "rNES-0.1", don't let "rNES-0.2" deceive you, it's a work in progress, I don't think it even compiles.

Here:
https://drive.google.com/file/d/0B6N3jO ... sp=sharing

Post Reply