Troubles when planning to make a FDS template with CA65

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

Moderator: Moderators

User avatar
Hamtaro126
Posts: 763
Joined: Thu Jan 19, 2006 5:08 pm

Troubles when planning to make a FDS template with CA65

Post by Hamtaro126 » Wed Apr 12, 2017 5:07 am

For example, I plan on porting a plain-jane copy of SMB2jDIS (Super Mario Bros Lost Levels Disassembly By Doppelganger) to CA65 instead of ASM6,

But first... I need to make a working template for a .FDS Image as a base, But it looks like a simple CFG file won't do it alone.

Would someone find a way around this?
AKA SmilyMZX/AtariHacker.

Pokun
Posts: 1270
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Troubles when planning to make a FDS template with CA65

Post by Pokun » Thu Apr 13, 2017 3:08 am

I've seen no ca65 FDS projects but there are for asm6 here: viewtopic.php?f=2&t=15169

User avatar
Hamtaro126
Posts: 763
Joined: Thu Jan 19, 2006 5:08 pm

Re: Troubles when planning to make a FDS template with CA65

Post by Hamtaro126 » Thu Apr 13, 2017 7:50 am

Didn't I already make it clear from the beginning?

ASM6 is what I have just already known and talked about for use with FDS,
CA65 may be a good assembler to switch to when needed.

It is not very possible right now due to the specifics on how the CFG must be setup.

I tried contacting the current CA65 Github Issues page about this, It's a No Go!
AKA SmilyMZX/AtariHacker.

User avatar
tokumaru
Posts: 11466
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Troubles when planning to make a FDS template with CA65

Post by tokumaru » Thu Apr 13, 2017 8:40 am

What exactly makes ca65 unable to assemble an FDS project?

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by thefox » Thu Apr 13, 2017 9:57 am

Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

Revenant
Posts: 440
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: Troubles when planning to make a FDS template with CA65

Post by Revenant » Thu Apr 13, 2017 10:13 am

I generally agree with the other commenters in that GitHub issue that an assembler is not really an appropriate tool to use for generating a disk image.

Is there an existing command-line tool to generate FDS images from individual files? I think integrating that into the build process would work much better and would require much less assembler-specific configuration for projects in general.

tepples
Posts: 21750
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by tepples » Thu Apr 13, 2017 10:16 am

You'd probably need a specialized linker script anyway to spit out a separate file for each overlay segment, which segments the command-line builder combines into a .fds/.qd file.

And then you'd need to distribute the builder to anyone who wants to build your project, and the method by which that is done depends on the language in which the builder is written. Do more people have, or are more people willing to install, a Python 3 interpreter or a C++ compiler?

User avatar
Hamtaro126
Posts: 763
Joined: Thu Jan 19, 2006 5:08 pm

Re: Troubles when planning to make a FDS template with CA65

Post by Hamtaro126 » Thu Apr 13, 2017 11:56 am

If anyone is willing (this is not forced), try to make it with C.
AKA SmilyMZX/AtariHacker.

User avatar
nicklausw
Posts: 371
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by nicklausw » Thu Apr 13, 2017 1:22 pm

thefox wrote:For reference: https://github.com/cc65/cc65/issues/419
A similar reference: https://github.com/cc65/cc65/pull/259

So would this tool just have to link a bunch of .bin files together and slap a header at the beginning?

lidnariq
Posts: 8780
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Troubles when planning to make a FDS template with CA65

Post by lidnariq » Thu Apr 13, 2017 1:38 pm

Mostly?
Each file has a bunch of attributes, though; more than just a filename and a size.

ccovell has already adapted an existing FDS lister to be able to extract the actual data blocks, but there isn't a great place to put the extra metadata for reassembly.

User avatar
nicklausw
Posts: 371
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by nicklausw » Thu Apr 13, 2017 1:50 pm

I took a look at an asm6 fds example, and I don't think that ca65 is really the right tool for the job.

You could use segments for the different files on the disk, but then you'd be modifying the cfg file constantly. Especially since the files don't seem to have a set size, and I don't think ld65 will take a rom segment without a size (note: don't think).

There's also using just one module for the whole project and then the cfg file is pretty simple, but then you'd need pad commands which the assembler doesn't seem to have either.

Maybe I'm not the right person to be trying this but afaik asm6 is the way to go for making fds files no matter how you intend to do it.

tepples
Posts: 21750
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by tepples » Thu Apr 13, 2017 2:48 pm

nicklausw wrote:You could use segments for the different files on the disk, but then you'd be modifying the cfg file constantly. Especially since the files don't seem to have a set size, and I don't think ld65 will take a rom segment without a size (note: don't think).
If you don't specify fill=yes in a MEMORY area, the size is treated as the maximum size of that memory area, not its exact size.
you'd need pad commands which the assembler doesn't seem to have either.
ca65 has .res, which adds a particular number of bytes rather than adding enough bytes to get to a particular address.

User avatar
rainwarrior
Posts: 7671
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by rainwarrior » Thu Apr 13, 2017 4:46 pm

nicklausw wrote:You could use segments for the different files on the disk, but then you'd be modifying the cfg file constantly. Especially since the files don't seem to have a set size, and I don't think ld65 will take a rom segment without a size (note: don't think).
The linker is allowed to define symbols about the segment size which you can use in the code (they get patched in at link time, just like all other linked symbols). See: define = yes.

User avatar
nicklausw
Posts: 371
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by nicklausw » Thu Apr 13, 2017 6:13 pm

I did try to make an old fds asm6 example compatible with ca65. It's...alright, I guess.

A big problem is that the way I did things, files use a config called file.cfg and the final fds uses fds.cfg. For files, I'm just blindly assuming they'll all be size=$4000, and for the final fds I got lazy and ended up setting the size=$4000+8548. If dynamic segment sizes were a thing, my set-up would probably be alright but I can't find anything even like that.

If anyone here wants to mess with it, I'll upload.

EDIT: sorry, I didn't see tepples' post above somehow! Trying his suggestion now.

User avatar
nicklausw
Posts: 371
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: Troubles when planning to make a FDS template with CA65

Post by nicklausw » Thu Apr 13, 2017 6:49 pm

I might as well just upload my disaster here for anyone who wants to see. Running the fds gives a disk error. The code is very sloppy in that it uses previously made and bloated cfg files, gross looking code (not an insult to original creator but I haven't been going for cleanliness), and pretty sure I put ".segment "CODE"" three times in a row somewhere in there...but this is just annoying me. Maybe it'll fill in some blanks for someone else trying to do this with ca65.

Build with build.sh, windows users just rename it to build.bat and run that. Just please don't try using this as a template. You won't get very far :wink: .

Edit, I just figured out why it doesn't work but am not at my computer...didn't pad the fds header to be 16 bytes.
Attachments
fdstemp.tar.gz
(15.39 KiB) Downloaded 228 times

Post Reply