It is currently Sun Dec 17, 2017 8:29 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 5:11 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
This has probably been done before (as I say with every project I do), but I added INES directives to asm6.

https://github.com/nicklausw/asm6n

The 'n' can be for nicklausw, nintendo, nes, whatever. I dunno.

Anyway, here's an NROM example:
Code:
.inesprg 1 ; 1x 16KB bank of PRG code
.ineschr 1 ; 1x 8KB bank of CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring (ignore for now)
.inesins ; put ines header in the file!


Yes, there has to be an insertion directive, because asm6 doesn't make NES support mandatory, and I'd rather keep it that way for now.

Also ANSI compatibility. Not sure why. Just wanted it.

This should work from what I've tested, tell me otherwise.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 6:35 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19355
Location: NE Indiana, USA (NTSC)
It inspired me to make a set of macros for ca65 to build an NES 2.0 header.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 6:51 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1870
Location: DIGDUG
Is there any emulator that makes use of the 2.0 standard?

Nevermind, I see it on the wiki...

BizHawk as of r6313
FCEUX as of r3071
Nintendulator 0.975 Beta
MESS (per BBS post 62428)
no$nes v1.1
PowerMappers v23 for PowerPak

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


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 6:56 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
Glad to see I inspired some macro packs. Actually I forgot to add support for the upper nibble of the mapper number, so that's there now.

How is it suggested that iNES 2.0 be implemented in an assembler? I think Unofficial Magickit might handle this, so I'll take a look.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 11:24 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
This is super cool -- thanks for it! Is there any reason this didn't get added to official asm6? loopy lingers and is contactable in many ways...


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sat May 07, 2016 11:27 pm 
Offline
User avatar

Joined: Sun Dec 12, 2010 10:27 pm
Posts: 298
Location: Hong Kong
I think that's because asm6 wasn't specifically aimed towards the Famicom. I used it more on Apple ][ projects.
That doesn't mean it's not cool to have such extra features though.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 4:08 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
No, asm6 was invented solely for NES/Famicom work, but obviously it's a generic enough assembler that you can use it for anything 6502-based. Quoting the original README:

Code:
--------------------------------------------------------------
ASM6 (v1.6)
A 6502 assembler by loopy (loopy at mm.st)
--------------------------------------------------------------

Yes, it's another 6502 assembler.  I built it to do NES development, but you
can probably use it for just about anything. ...

Anyway, I'll point out that we now have at *least* 2 forks of asm6, which is why I keep asking the question why these features + patches aren't being sent in to loopy to incorporate into asm6 officially:

https://github.com/nicklausw/asm6n
https://github.com/freem/asm6f


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 4:48 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
Frankly, if I was loopy, I wouldn't accept this patch. There's really no need for such directives when the assembler is flexible enough to generate the header with existing directives like .byte. Wrap it in a macro (like tepples did), and you get the same level of usability as well.

It's not too surprising that NESASM had to add those directives, because of the 8 KB bank size requirement.

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


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 7:20 am 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
thefox wrote:
There's really no need for such directives when the assembler is flexible enough to generate the header with existing directives like .byte. Wrap it in a macro (like tepples did), and you get the same level of usability as well.

While people clinging for dear life onto NESASM isn't a major problem as far as I can tell, asm6n does help with "NESASM doesn't NEED macros for that!"

Later on today I'll see about making a command line arg to have asm6n always put a blank header at the beginning for it to fill out later, meaning you don't need .inesins.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 9:06 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
nicklausw wrote:
While people clinging for dear life onto NESASM isn't a major problem as far as I can tell, asm6n does help with "NESASM doesn't NEED macros for that!"

Just to be clear, I wasn't criticizing your work. I just think it's for the better if the mainline asm6 stays platform agnostic.

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


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 10:10 am 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
Yeah, I think asm6 should be clear of an intended platform.

At the same time, I'm interested in merging my changes with freem's; why choose between header directives and illegal opcodes with .nl support when you can have it all?


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 10:40 am 
Offline
User avatar

Joined: Mon Oct 01, 2012 3:47 pm
Posts: 153
Location: freemland (NTSC-U)
koitsu wrote:
Anyway, I'll point out that we now have at *least* 2 forks of asm6, which is why I keep asking the question why these features + patches aren't being sent in to loopy to incorporate into asm6 officially:

https://github.com/nicklausw/asm6n
https://github.com/freem/asm6f


It should be noted that my fork is a "continuation" of sonder's fork (or more accurately, I stole his code for fceux *.nl generation).

nicklausw wrote:
At the same time, I'm interested in merging my changes with freem's; why choose between header directives and illegal opcodes with .nl support when you can have it all?


Even though I'm against the idea of the directives (for reasons mentioned in the thread), I don't see any harm in actually merging them, since you're not forced to use them; feel free to send a pull request to the asm6f repo and I'll look things over. (Personally though, I would hope support for NES 2.0 header fields would get added.)


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 6:19 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
The -i command line option now makes use of INESINS not needed! (Still there, though, of course).

So if you want to, you can just do:

Code:
.inesprg 1 ; 1x 16KB bank of PRG code
.ineschr 1 ; 1x 8KB bank of CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring (ignore for now)


And assuming that's bla.asm, assemble with:

Code:
asm6n -i bla.asm bla.nes


And the header goes in. If you don't like the terminal args, then use the insertion directive, it's up to you.

(On a separate note, the code used to implement this is redundant and kind of hideous, but eh).


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 7:49 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
nicklausw, is there a particular need for this -i flag (or the equivalent .inesins pseudo-op)? It seems to me that inclusion of the 16-byte NES header would be based on any use of .ines{prg,chr,map,mir} directives. Rephrased: use of any of those should enable adding the header to the resulting binary. There should be defaults for each of the respective pseudo-ops as well (the default values should be documented), so that you could literally have a program that just says .inesprg 1 (with no other .inesXXX directives) and gets you a .NES ROM. There is no way to solve every "error condition/usage case", but to me the above is intuitive and how some other assemblers do it.

Just my two cents.


Top
 Profile  
 
 Post subject: Re: asm6 + ines = asm6n
PostPosted: Sun May 08, 2016 8:00 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 368
Location: ...
If the code only needs one pass, then the way asm6 works, either you'd have to do another pass for no reason to add the header bytes at the start of the file, or find a way to add bytes to the beginning of an existing file. Not possible, as far as I know (easily anyway).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

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