Out of date tools?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

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

Re: Out of date tools?

Post by Pokun » Thu Mar 30, 2017 4:07 am

Should you eventually get interested in programming in assembly, there are always the Nerdy Nights tutorials. It also teaches you how to make batch files.
It uses NESASM instead of ASM6 (which I recommend over NESASM) though, but it shouldn't be too hard to switch assembler once you learned the basics (I did exactly that).

Also it teaches a few bad things, that you'll discover if you continue reading this forum, but it is really the best tutorial out there right now so that can't be helped.

User avatar
AlterAnubis
Posts: 19
Joined: Wed Mar 29, 2017 3:11 pm

Re: Out of date tools?

Post by AlterAnubis » Thu Mar 30, 2017 10:51 am

Pokun wrote:Should you eventually get interested in programming in assembly, there are always the Nerdy Nights tutorials. It also teaches you how to make batch files.
It uses NESASM instead of ASM6 (which I recommend over NESASM) though, but it shouldn't be too hard to switch assembler once you learned the basics (I did exactly that).

Also it teaches a few bad things, that you'll discover if you continue reading this forum, but it is really the best tutorial out there right now so that can't be helped.
Thank you, I will check it out I have also heard of NESASM but never tried it out

asm6 just opens then closes :/

calima
Posts: 1219
Joined: Tue Oct 06, 2015 10:16 am

Re: Out of date tools?

Post by calima » Thu Mar 30, 2017 11:38 am

Do you know what a command-line tool is? They're executed from the command line, not clicked on.

User avatar
AlterAnubis
Posts: 19
Joined: Wed Mar 29, 2017 3:11 pm

Re: Out of date tools?

Post by AlterAnubis » Thu Mar 30, 2017 11:42 am

calima wrote:Do you know what a command-line tool is? They're executed from the command line, not clicked on.
do you use cmd to open it from the programs directory using dir, like how dos uses it to play games?

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

Re: Out of date tools?

Post by tokumaru » Thu Mar 30, 2017 12:06 pm

As mentioned in the first reply of this thread, assemblers are command line tools, which have no graphical interface. Command line programs usually receive a number of input parameters (in the case of assemblers, one or more files containing the source code, plus options) based on which they generate output files (in this case, an NES ROM) or information. Double-clicking such programs doesn't work because this causes them to be called without any parameters, meaning they have nothing to so they immediately exit.

For programs that take only one file as a parameter, you can usually drag and drop this file over the .exe and this file will automatically be passed on as a parameter for the program, which could actually be enough to get simple assemblers like NESASM or ASM6 to work (I haven't checked, though!), but you don't get to select any options, like the name of the output binary file or the creation of listing files, and you also don't get to see any feedback the program might have for you, such as error messages, because the window will close before you have a chance to read anything.

If you look at ASM6's README.TXT, you'll find this:

Code: Select all

Usage:

	asm6 [-options] sourcefile [outputfile] [listfile]

Options:

	-?         Show some help
	-l         Create listing
	-L         Create verbose listing (expand REPT, MACRO)
	-d<name>:  Define a symbol and make it equal to 1
	-q         Quiet mode (suppress all output unless there's an error)
	Default output is <sourcefile>.bin
	Default listing is <sourcefile>.lst
Any command line tool will have its usage documented somewhere (very often, the program itself will give you this information if you call it without any parameters). Based on this information, you can use the command prompt to explicitly type any parameters necessary, but typing long command strings all the time is boring and unproductive, so you can type it all only once in a batch file (.bat) and double click that to assemble your project. Here's what a simple batch file for compiling an ASM6 project might contain:

Code: Select all

..\tools\asm6.exe -L main.asm game.nes game.lst
pause
The path to ASM6 is relative to the project's folder, where the batch file is run from. The "pause" at the end prevents the window from closing until you press any key, this is so you can read the output of the program.

User avatar
mikejmoffitt
Posts: 1352
Joined: Sun May 27, 2012 8:43 pm

Re: Out of date tools?

Post by mikejmoffitt » Thu Mar 30, 2017 12:41 pm

AlterAnubis wrote:
calima wrote:Do you know what a command-line tool is? They're executed from the command line, not clicked on.
do you use cmd to open it from the programs directory using dir, like how dos uses it to play games?
You should read tokumaru's in-depth post, but in short, yes - you are on the right track.

unregistered
Posts: 1098
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Out of date tools?

Post by unregistered » Thu Mar 30, 2017 1:13 pm

tokumaru suggested asm6 to me and that was a great suggestion! The most important part of using asm6 is adding the -L so that it gives you a listing file. tepples let me know that listing files existed. Those .lst files are super helpful with addresses listed at the beginning of each line. When you have compiled a program in C++ and Java it translated the code you wrote into assembly hex codes that ran on the processor of your computer. Using an assembler like asm6 allows you to translate the assembly code you wrote into the assembly hexidecimal equivalent that runs on the 6502 processor of the NES. This .nes file can be run with an emulator like FCEUX on your computer or it can be run with a POWERPAK (from retrozone ~$95.00 if I`m remembering correctly) on a real NES. :)

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2032
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Out of date tools?

Post by FrankenGraphics » Thu Mar 30, 2017 1:55 pm

Actually, you don't necessarily need command line to assemble your text files into binaries. Even though that gives you more control and is very good advise.

You can drag and drop your text file to asm6. If it is written correctly (meaning no syntax errors or asking to do something impossible), it will produce a .bin in the same folder as asm6.exe - rename its extension to .nes and you can run it in an emulator. If there's an error, nothing will be produced. This way you'll know if your text was correctly written or not.

Asm6 will "open and close" this way, nearly not enough time to review the process log to detect errors (and where they are). This is why you should learn to write batch (.bat) files or use cmd.
http://www.frankengraphics.com - personal NES blog

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

Re: Out of date tools?

Post by Pokun » Thu Mar 30, 2017 2:22 pm

Normally you would want to make a batch file though, like mentioned several times before in the thread. It's just a text file where you can specify all your assembly options and stuff, and can then be double clicked. No need to mess with the command line anymore.
unregistered wrote:Using an assembler like asm6 allows you to translate the assembly code you wrote into the assembly hexidecimal equivalent that runs on the 6502 processor of the NES. This .nes file can be run with an emulator like FCEUX on your computer or it can be run with a POWERPAK (from retrozone ~$95.00 if I`m remembering correctly) on a real NES. :)
Yes or you could even make your own cartridge. As long as it was coded properly it will work on real hardware. Easiest way to run on real hardware is to use a flashcart like a Powerpak or Everdrive though. I'd recommend the Everdrive, it's much cheaper and probably even slightly better (both have pros and cons though).

User avatar
AlterAnubis
Posts: 19
Joined: Wed Mar 29, 2017 3:11 pm

Re: Out of date tools?

Post by AlterAnubis » Thu Mar 30, 2017 3:55 pm

None of the assemblers seem to work for me :/

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

Re: Out of date tools?

Post by tepples » Thu Mar 30, 2017 4:34 pm

What error message do you get? Or what do you see that interferes with your ability to read the error message?

User avatar
AlterAnubis
Posts: 19
Joined: Wed Mar 29, 2017 3:11 pm

Re: Out of date tools?

Post by AlterAnubis » Thu Mar 30, 2017 4:55 pm

It would open then close that is all I had, I don't know if the person who made it included return 0; or not but either way I don't know why it closed out I also tried running it as admin but no luck there.

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

Re: Out of date tools?

Post by tokumaru » Thu Mar 30, 2017 5:09 pm

How are you trying to run them?

User avatar
AlterAnubis
Posts: 19
Joined: Wed Mar 29, 2017 3:11 pm

Re: Out of date tools?

Post by AlterAnubis » Thu Mar 30, 2017 5:28 pm

Clicking it open, still trying to find out how to make a .bat that will open it

User avatar
dougeff
Posts: 2764
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Out of date tools?

Post by dougeff » Thu Mar 30, 2017 5:49 pm

With the command box open (for asm6)...

Assuming you have asm6.exe and an assembly file called test.asm, in the same folder...

Simply typing "asm6 test.asm test.nes" would be all you do. If no errors, it would say something like...
pass 1..
pass 2..
test.nes written (16400 bytes).
Then, if you looked in the folder, you will see the output file "test.nes"

EDIT - actual output inserted.

EDIT 2 - if I wanted to make a .bat file do exactly this, I would write a text file (with Notepad++) that said...
asm6 test.asm test.nes
pause
That's it. Save this text file as 'compile.bat'

Or, if you want to get fancy...
set name="test"
asm6 %name%.asm %name%.nes -l
pause
%name%.nes
This would create a listing (-l), and the screen will pause, and wait for a keypress, at which point, it will try to open 'test.nes'...assuming you have .nes files associated with an emulator.
nesdoug.com -- blog/tutorial on programming for the NES

Post Reply