It is currently Wed Oct 16, 2019 1:14 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Mar 07, 2019 11:24 am 
Offline

Joined: Thu Mar 07, 2019 11:18 am
Posts: 5
I feel like it should be obvious, but I don't know how to get from an .asm file to an .nes file. I've found NesAsm, but it spits out an .fns file when I drag my program onto the executable. I just can't find any clear step-by-step instructions on how to get from point A (.asm file) to point B (.nes file). Where can I find this?


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 11:28 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21634
Location: NE Indiana, USA (NTSC)
Correct me if I'm wrong, but by balance of probabilities, I'll assume you're using Windows, not macOS or GNU/Linux. Do you know how to use the Command Prompt?

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 11:35 am 
Offline

Joined: Thu Mar 07, 2019 11:18 am
Posts: 5
I have a Mac, but I'm trying to set up a demo for a teacher at my school, and I work on PCs at school. I have a Mac with me right now, but I'd say PC instructions are more important. I'd like Mac instructions though, so I could make my own programs on my Mac. If you were to direct me to instructions for Mac, would I be able to somewhat transfer the process to working with PC? I don't know much about CMD and terminal, but I do know how to open them. Thanks for the quick reply :D


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 11:44 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21634
Location: NE Indiana, USA (NTSC)
To find your way around Terminal on macOS, search the web for a Bash tutorial such as this one. I'd estimate that over 95 percent of skills in Terminal transfer among macOS, GNU/Linux, and Windows 10 WSL; about three-fourths will transfer to Windows Command Prompt. Once you feel comfortable with at least the cd, ls, cat, cp, mv, rm (be careful), and exit commands, we'll introduce ./nesasm.

I'm confused about where the .fns extension came from. Can anyone else explain?

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 1:15 pm 
Offline

Joined: Thu Mar 07, 2019 11:18 am
Posts: 5
How much am I going to be interacting with command line interfaces when assembling code?


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 1:46 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4210
Location: A world gone mad
You'll be using it 100% of the time. Best get used to it. :)


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 5:56 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11416
Location: Rio de Janeiro - Brazil
You don't need to actively mess with the command line if you can write a script just once that handles everything. Then you can just run that script each time you need to assemble.


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 6:24 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4210
Location: A world gone mad
@tokumaru I'm sorry, I politely disagree. Please look at what the OP was doing in their first post, then tell me they're going to write a "complex" .bat/cmd file. Come on, man. They're not ready for that.

I feel your one-liner simplifies something without thinking of the bigger picture, such as assembly or link-time errors, or even third-party programs that manipulate data. Double-clicking a .bat/cmd file will teach the user nothing about the troubleshooting process -- they see a little black window that pops up and then disappears. You and I both know that doesn't mean something worked. You can try to handle errors -- assuming *every single tool being used* does the right thing with exit codes/errorlevel and implementing a conditional pause so they can see the last thing that errored, and that's a Windows batch/cmd thing that even skilled people still continue to get wrong (if you think I'm kidding, followed by similar madness) -- and that the user has the familiarity with writing such scripts to begin with. Don't mention PowerShell either, because that just complicates the matter even further.

I stand firm on my statement: the developer must get used to the CLI. Trying to avoid it is just asking for trouble, and the result will be literally hours of wasted time asking people here on this forum for what amounts to writing-Windows-batch-file support. Once the developer is familiar with the manually-induced basics, they can make their life easier with a batch file by doing so gradually -- but my above paragraph will prove true the instant they get an error or encounter an anomalous situation.

Visual Studio and the like can sometimes relieve some of this, but that's not the same platform or the same tools. (cpow/nesicide author is probably grinning right now ;-) )


Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 6:38 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7598
Location: Canada
tokumaru wrote:
You don't need to actively mess with the command line if you can write a script just once that handles everything. Then you can just run that script each time you need to assemble.

A script, though, is full of... command lines. ;)

But yeah I don't often use the actual command line shell for NES dev stuff, generally that all goes into batch file scripts and I just run the script when I wanna build. Still, everything in the batch file is actual command lines, and the best place to work out how to use the command line tools is in a command line shell.

So... either you are going to rely on someone else to write your scripts for you, or you can learn how to use the command line and gain the ability to write and troubleshoot the scripts, and a whole lot more in the process.

If someone else's script is working for you now, you can put off learning it until later, but it's kind of an essential skill in this line of work.


Edit: clarified who I was replying to.


Last edited by rainwarrior on Thu Mar 07, 2019 8:04 pm, edited 3 times in total.

Top
 Profile  
 
PostPosted: Thu Mar 07, 2019 7:10 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11416
Location: Rio de Janeiro - Brazil
He asked how often one normally uses the command line when assembling, and the truth is that not many people type the same lengthy commands every programming session, most people just write scripts once and then double-click them or have the editors they use call them.

I completely agree that it's important to know how the command line works and be able to write the scripts needed for assembling and for other tasks too, but you do not *need* to open the command prompt/terminal manually and type the same commands over and over.


Top
 Profile  
 
PostPosted: Fri Mar 08, 2019 3:31 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 909
Location: Denmark (PAL)
Tools, tools, tools(, and scripts). :)
I assemble plenty of NES stuff, and haven't used the actual command prompt even once.


Anyway, I guess the question at hand is, what is a .fns file, and how do we turn it into a .nes file?
Personally I have no experience with NesAsm, but if it's anything like CA65, there's a linker which takes up to multiple .fns files and turn them into a single assembled build?
Maybe check the "nerdy nights" tutorial, I think it's written to target Nesasm.

Or, just use CA65 :P


Top
 Profile  
 
PostPosted: Fri Mar 08, 2019 4:50 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11416
Location: Rio de Janeiro - Brazil
Sumez wrote:
I have no experience with NesAsm, but if it's anything like CA65

It's not. NESASM should be outputting .NES files directly. The documentation mentions .fns files, but doesn't explain what they are.

Quote:
Or, just use CA65 :P

ca65 is a great assembler, but it's way more complicated to use than NESASM.


Top
 Profile  
 
PostPosted: Fri Mar 08, 2019 6:28 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3737
Location: Indianapolis
the FNS file is a list of labels, which can be useful for debugging. The ROM file isn't being created because NESASM is probably reporting some kind of error, you couldn't see it because the command prompt was closing.

For Windows, create a text file with the following in it:
Code:
del game.nes
nesasm3.exe game.asm
pause

Save that, rename it to "build.bat" or something. The pause command will let you see NESASM's results. The delete game.nes command can be helpful when the build fails, so you can't unknowingly run a previous build.


Top
 Profile  
 
PostPosted: Mon Mar 18, 2019 8:20 am 
Offline

Joined: Thu Mar 07, 2019 11:18 am
Posts: 5
No resource I've found explains how to use NesAsm. Nerdy Nights didn't tell me how to assemble, only how to code. The readme gives curt instruction on how to install it on linux, and update notes, but no guide. I'm going to be using a mac more often than not, so can someone tell me how to compile on mac? How will using terminal commands help me go from an .asm file to a rom file? I've compiled **basic** C++ code before, why isn't assembling ASM as easy as pressing some assemble button, or using one dedicated program?


Top
 Profile  
 
PostPosted: Mon Mar 18, 2019 8:32 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21634
Location: NE Indiana, USA (NTSC)
If your Mac is new enough to be compatible with macOS 10.12 or later, and you are going to be using a lot of command line stuff, I recommend installing the "Homebrew" package manager. (As far as I can tell, its name is unrelated to senses involving beer or hobby console game development.) That should bring in the Xcode command-line tools, which you can use to compile ASM6. Untested, but I'm guessing the command is as follows:
Code:
cc -O -o asm6 asm6.c

# explanation of this command:
# cc is the C compiler, which on macOS is the LLVM-based Clang
# -O (capital letter) enables basic optimization; stronger optimization
# is available as -Os (optimize and minimize code size) or -O3 (optimize
# even if it increases code size, which may be slower given cache)
# -o asm6 (lowercase letter) means produce an executable called "asm6"
# everything after that is source code files


After that, you can assemble a ROM:
Code:
asm6 -o mygame.nes mygame.asm

_________________
Pin Eight | Twitter | GitHub | Patreon


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

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