It is currently Thu Sep 21, 2017 9:04 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ca65 cfg files
PostPosted: Sun Aug 06, 2017 9:08 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1730
Location: DIGDUG
Does anyone have .cfg files for every standard board? I have NROM. I don't see any others.

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


Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 10:14 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10010
Location: Rio de Janeiro - Brazil
There are more things dictating the structure of .cfg files than just the mapper/board. Even the way variables are declared can affect how the .cfg file looks, and stuff like this depends a lot on personal preference.


Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 10:52 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18992
Location: NE Indiana, USA (NTSC)
dougeff wrote:
Does anyone have .cfg files for every standard board? I have NROM. I don't see any others.

For UNROM, UOROM, SGROM, SNROM, and anything else with a switchable 16 KiB window at $8000, a 16 KiB fixed window at $C000, and CHR RAM, you can use the one in snrom-template, possibly cutting it down to 8 or 4 16 KiB banks.

Which mapper are you using, and how big is the ROM? Are there any other constraints, such as DPCM, switchable DPCM, access to large constant arrays without constantly checking for bank boundaries using pairs of adjacent banks in the $8000 and $A000 windows of an MMC3-class mapper, or needing a pseudo-fixed trampoline at the end of each 32 KiB bank? Otherwise, it'd be a big job to enumerate every combination of board and ROM size.


Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 11:23 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 855
Location: Gothenburg, Sweden
Not taking into account that i don't yet know what RAM allocation/layout is best for me, here's an UNROM template i wrote by figuring things out looking at rainwarriors' NROM example, another NROM config by elseyf, and the ld65 page. Works for me, for now.

Use, modify and distribute as you like.

Some notes:
-Add stack block and other memory layout blocks you'd like defined in the style of how "OAM" is written, both in MEMORY and SEGMENT.
-You need to add lines in the SEGMENT section as you make use of the banks in your code. Just copy and edit the "BANK0_TITLE" line to fit the banks listed in the MEMORY section.
-The cfg assumes you put the bank switching table first in your fixed bank under the "BANKTABLE" segment, though that's probably redundant.
-Fixed bank code (called "CODE_MAIN") and fixed bank RODATA are separated even though that's not necessary.
-You can copy-paste and name another 8 banks in the same style in MEMORY and you'd have UOROM, i think. Or any other number of banks for an "oversize" UNROM.


Attachments:
UNROM.txt [1.45 KiB]
Downloaded 11 times

_________________
http://www.frankengraphics.com - personal NES blog
Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 12:12 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1730
Location: DIGDUG
Thanks, FrankenGraphics, that's helpful.

Quote:
Which mapper are you using?


I'm writing example .cfg files for my blog. Almost done.

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


Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 12:35 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1730
Location: DIGDUG
This is what I came up with (.cfg files for cc65 programming).

http://dl.dropboxusercontent.com/s/0m4p ... xm/CFG.zip

If there is any smart person with free time, please look over these and see if I made any mistakes. I would appreciate it. Thanks.

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


Top
 Profile  
 
 Post subject: Re: ca65 cfg files
PostPosted: Sun Aug 06, 2017 1:56 pm 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 348
Those are mine. They work, but as mentioned, there's a lot of "personal preference" stuff going on.

unrom:
Code:
MEMORY {
   # Zero page
   ZP: start = $00, size = $100, type = rw, define = yes;

   # INES Cartridge Header
   HEADER: start = $0, size = $10, file = %O ,fill = yes;

   # UNROM 64K
   PRG0: start = $8000, size = $4000, file = %O, fill = yes, define = yes;
   PRG1: start = $8000, size = $4000, file = %O, fill = yes, define = yes;
   PRG2: start = $8000, size = $4000, file = %O, fill = yes, define = yes;
   PRG3: start = $C000, size = $3ffa, file = %O, fill = yes, define = yes;

   VECTORS: start = $fffa, size = $6, 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;
}

SEGMENTS {
   HEADER:      load = HEADER,   type = ro;
   ROM0:      load = PRG0,   type = ro,   define = yes;
   ROM1:      load = PRG1,   type = ro,   define = yes;
   ROM2:      load = PRG2,   type = ro,   define = yes;
   STARTUP:   load = PRG3,   type = ro,  define = yes;
   LOWCODE:   load = PRG3,   type = ro,               optional = yes;
   INIT:      load = PRG3,   type = ro,   define = yes,   optional = yes;
   DATA:      load = PRG3, run = RAM, type = rw,  define = yes;
   RODATA:      load = PRG3,   type = ro,   define = yes;
   CODE:      load = PRG3,    type = ro,    define = yes;
   VECTORS:   load = VECTORS,   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;      # 5 pages stack
}


Tkrom

Code:
MEMORY {
   # Zero page
   ZP: start = $00, size = $100, type = rw, define = yes;

   # INES Cartridge Header
   HEADER: start = $0, size = $10, file = %O ,fill = yes;

   # TKROM 256K
   
   # PRG0: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   # PRG1: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   # Trick: I need to work with PRG0 + PRG1 together for this game.
   PRG0001: start = $8000, size = $4000, file = %O, fill = yes, define = yes;

   # I'm going to use these for data. Four is enough
   PRG02: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG03: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG04: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG05: start = $8000, size = $2000, file = %O, fill = yes, define = yes;

   # Next four, for code, which comes handy to share existence with data, so
   PRG06: start = $a000, size = $2000, file = %O, fill = yes, define = yes;
   PRG07: start = $a000, size = $2000, file = %O, fill = yes, define = yes;
   PRG08: start = $a000, size = $2000, file = %O, fill = yes, define = yes;
   PRG09: start = $a000, size = $2000, file = %O, fill = yes, define = yes;

   # I'm not going to use these and/or don't care
   PRG0A: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG0B: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG0C: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG0D: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG0E: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG0F: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG10: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG11: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG12: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG13: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG14: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG15: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG16: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG17: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG18: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG19: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG1A: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG1B: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG1C: start = $8000, size = $2000, file = %O, fill = yes, define = yes;
   PRG1D: start = $8000, size = $2000, file = %O, fill = yes, define = yes;

   # PRG1E and PRG1F go together.
   # This is not guaranteed at startup, but I will enforce it via sorcery.
   PRG1E1F: start = $c000, size = $3fc0, file = %O, fill = yes, define = yes;

   # Here I will enforce 8K+8K+Fixed 16K scheme on startup
   # And will page in 0 1 1e 1f
   SETUP: start = $ffc0, size = $3a, file = %O, fill = yes;
   
   VECTORS: start = $fffa, size = $6, file = %O, fill = yes;

   # 1 8K CHR Bank
    CHR: start = $0000, size = $20000, file = %O, fill = yes;

   # Extra 8K RAM
   RAM: start = $6000, size = $2000, define = yes;
}

SEGMENTS {
   HEADER:      load = HEADER,            type = ro;
   ROM0001:   load = PRG0001,            type = ro,   define = yes;
   ROM02:      load = PRG02,            type = ro,   define = yes;
   ROM03:      load = PRG03,            type = ro,   define = yes;
   ROM04:      load = PRG04,            type = ro,   define = yes;
   ROM05:      load = PRG05,            type = ro,   define = yes;
   ROM06:      load = PRG06,            type = ro,   define = yes;
   ROM07:      load = PRG07,            type = ro,   define = yes;
   ROM08:      load = PRG08,            type = ro,   define = yes;
   ROM09:      load = PRG09,            type = ro,   define = yes;
   ROM0A:      load = PRG0A,            type = ro,   define = yes;
   ROM0B:      load = PRG0B,            type = ro,   define = yes;
   ROM0C:      load = PRG0C,            type = ro,   define = yes;
   ROM0D:      load = PRG0D,            type = ro,   define = yes;
   ROM0E:      load = PRG0E,            type = ro,   define = yes;
   ROM0F:      load = PRG0F,            type = ro,   define = yes;
   ROM10:      load = PRG10,            type = ro,   define = yes;
   ROM11:      load = PRG11,            type = ro,   define = yes;
   ROM12:      load = PRG12,            type = ro,   define = yes;
   ROM13:      load = PRG13,            type = ro,   define = yes;
   ROM14:      load = PRG14,            type = ro,   define = yes;
   ROM15:      load = PRG15,            type = ro,   define = yes;
   ROM16:      load = PRG16,            type = ro,   define = yes;
   ROM17:      load = PRG17,            type = ro,   define = yes;
   ROM18:      load = PRG18,            type = ro,   define = yes;
   ROM19:      load = PRG19,            type = ro,   define = yes;
   ROM1A:      load = PRG1A,            type = ro,   define = yes;
   ROM1B:      load = PRG1B,            type = ro,   define = yes;
   ROM1C:      load = PRG1C,            type = ro,   define = yes;
   ROM1D:      load = PRG1D,            type = ro,   define = yes;
   STARTUP:   load = PRG1E1F,            type = ro,  define = yes;
   LOWCODE:   load = PRG1E1F,            type = ro,               optional = yes;
   INIT:      load = PRG1E1F,            type = ro,   define = yes,   optional = yes;
   DATA:      load = PRG1E1F, run = RAM,   type = rw,   define = yes;
   RODATA:      load = PRG1E1F,            type = ro,   define = yes;
   CODE:      load = PRG1E1F,          type = ro,    define = yes;
   SETUP:       load = SETUP,             type = ro,   define = yes;
   VECTORS:   load = VECTORS,            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;      # 5 pages stack
}

_________________
http://www.mojontwins.com


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 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