It is currently Tue May 23, 2017 3:38 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: UxROM template project
PostPosted: Tue Oct 18, 2016 1:07 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1240
I threw this template "getting started" project together, with the basic toolchain included "ready to go" for Windows and Linux. The goal is to provide a starting point for people who are totally new and want to start trying things quickly. I'm normally opposed to things like including binaries, but the ones included are 1) rather small and 2) don't require the user to do any environment setup ("What's my 'PATH'?").

A tiny demo program is included, with verbose comments to try to make the purpose behind everything and its organization clear.

https://github.com/mikejmoffitt/nes-template


Top
 Profile  
 
PostPosted: Tue Oct 18, 2016 5:01 pm 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 443
Location: Rive nord de Montréal
Cool!

*checks repo*

Hmm, I remember that unnecessary "file = %O" noise in the linker provided by tepples.

Otherwise, nice demo!

Oh, and nice trick with bank_load. Just a thing: I think it's better to use local labels inside of a macro, I haven't tried, but that anonymous label inside of that macro might confuse a branch to an unnamed label around a macro invokation.

Also, why giving "asm" extension instead of "inc" or "h" to files intended to be included, not assembled?


Top
 Profile  
 
PostPosted: Tue Oct 18, 2016 5:35 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9641
Location: Rio de Janeiro - Brazil
Jarhmander wrote:
Also, why giving "asm" extension instead of "inc" or "h" to files intended to be included, not assembled?

Well, I prefer .asm too. I make the distinction between assembled and included files with a folder structure.


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 5:08 am 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1240
I suppose nes.asm isn't being assembled, but the header file is, so it seems appropriate to at least give that one an asm file extension.


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 5:18 am 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 443
Location: Rive nord de Montréal
tokumaru wrote:
Jarhmander wrote:
Also, why giving "asm" extension instead of "inc" or "h" to files intended to be included, not assembled?

Well, I prefer .asm too. I make the distinction between assembled and included files with a folder structure.

Hmm, you agree with me, but tell that you prefer using the "asm" extension...


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 6:32 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2814
Location: Tampere, Finland
Using .asm for all files can get confusing if/when you start assembling more than one file (cl65 foo.asm bar.asm ...). If you assemble the wrong files, you might end up with multiply defined symbols and other problems. (Especially a problem if you just happen to stumble on some source code and it doesn't include a build script.)

If you plan to only have one "master" file which includes everything else, then I don't see any problem in using .asm for all files.

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


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 6:54 am 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1240
To prevent that from happening, I've been working with one top-level main.asm file, which is responsible for including other things. Coming from a C background, it was irritating to deal with not having even a mechanism like an include guard.


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 6:59 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2814
Location: Tampere, Finland
You can make an include guard in ca65, example: https://github.com/fo-fo/ngin/blob/mast ... /ascii.inc

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


Top
 Profile  
 
PostPosted: Wed Oct 19, 2016 6:21 pm 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 443
Location: Rive nord de Montréal
There's a .ifndef directive that can make you feel even more closer to C that is available in ca65. My personal exemple: https://github.com/Jarhmander/nesgame-001/blob/master/include/audio.inc.

Note that you should use "HEADER_INC = 1" (or equivalent), not ".define HEADER_INC", because .define merely declare a substitution string, not a symbol, whereas .ifndef test for a defined symbol, which can be done with e.g. "symbol = <number expression>. Yeah, it's a bit counterintuitive, and I was bit by that in the past...


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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