Hello, everyone, I am new here and I vary glad I join this group. I've been looking around for
tools to compile code however been unsuccessful I have tried many tools and none have seemed to work I am using windows 8.1. I also was wondering if anyone can help me find any tools that work on my operating system? if so thank you for helping me
My laptop is Windows 8.1. They (the assemblers, and cc65) work fine.
Are you familiar with a 'command line program'?
I am not, unfortunately
In
Before the basics, read the articles linked from "Command-line interface" on down.
do you have to use cmd to code the compiler? or can I find tools?
I write a .bat batch file, and double click that to compile.
Alternatively you can use Gnu Make and write a makefile.
Still confused
Are you looking for a specialized text editor that lets you type in code, checks the syntax and spelling of variable names in real time, and gives you a big friendly button marked "Run"? Something like what you'd get with Visual Studio?
Have you ever programmed assembly? Have any interest in learning 6502 assembly? I recommend asm6.
If not, you might want to try cc65 c compiler.
All of the above are command line tools. They have no GUI interface. You can use them by typing commands in the command line. Batch files / makefiles kind of automate this, and are preferred... especially if there are multiple source files.
Also get YY-CHR or Tile Layer Pro.
Also, get NES Screen Tool.
Also, have 100+ hours of free time.
I have never programmed in assembly but I know how to code in c++, c# and java although I just wanted to start creating nes games. I have used YY-CHR before to hack snes games. I also use a hex editor HxD. I want to code a nes game but I need a compiler for it because I know you can't just magically make it work without one. I also have Notepad++ and Microsoft visual studio
Quoting myself...
Quote:
look for a download on this page
https://shiru.untergrund.net/articles/p ... s_in_c.htm...called "these small example programs"
Notepad++ should work fine.
I also wrote a relevant tutorial.
Apparently the link is broken for the download but I am checking out your tutorials
AlterAnubis wrote:
I need a compiler for it because I know you can't just magically make it work without one.
Actually, there's one crazy member here that writes programs directly in hex. I seriously advise against this practice though, because maintainability pretty much goes down the drain.
Quote:
Apparently the link is broken for the download but I am checking out your tutorials
Try it again.
Ah, now it works. Thank you!
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.
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 :/
Do you know what a command-line tool is? They're executed from the command line, not clicked on.
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?
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:
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:
..\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.
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.
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.
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.
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).
None of the assemblers seem to work for me :/
What error message do you get? Or what do you see that interferes with your ability to read the error message?
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.
How are you trying to run them?
Clicking it open, still trying to find out how to make a .bat that will open it
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...
Quote:
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...
Quote:
asm6 test.asm test.nes
pause
That's it. Save this text file as 'compile.bat'
Or, if you want to get fancy...
Quote:
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.
When I use cc65.exe and / or ca65.exe, I get nothing in the command prompt, unless there is an error.
Nothing. Nothing seems to happen. It doesn't say a thing. But, it built me a file. I look in the folder. There it is.
That's just how these tools work.
dougeff wrote:
When I use cc65.exe and / or ca65.exe, I get nothing in the command prompt, unless there is an error.
Nothing. Nothing seems to happen. It doesn't say a thing. But, it built me a file. I look in the folder. There it is.
That's just how these tools work.
That's strange. That's definitely not how they work for me:
Attachment:
cc65_command_line_test.png [ 13.13 KiB | Viewed 2023 times ]
No arguments gives me an error for both (and both cases are errorlevel 1).
What file is it supposed to build with no arguments?
I typed a line WITH several arguments. (For cc65) It compiled correctly, but no indication from the command line dialog box.
I think you missed my point. I'm trying to reassure the new guy.
Edit, fixed 1 typo
Oh, yes that's what it supposed to do when everything's fine. No comment and errorlevel 0.
I think most compilers are silent when there's no error (or other requested output).
If you do want confirmation though, you can add errorlevel checking and/or a pause to your batch file. Example:
Code:
cc65\bin\ca65 bank0.s -g -o temp\bank0.o
@IF ERRORLEVEL 1 GOTO badbuild
cc65\bin\ca65 bank1.s -g -o temp\bank1.o
@IF ERRORLEVEL 1 GOTO badbuild
cc65\bin\ca65 bank2.s -g -o temp\bank2.o
@IF ERRORLEVEL 1 GOTO badbuild
@echo.
@echo.
@echo Build complete and successful!
@pause
@GOTO endbuild
:badbuild
@echo.
@echo.
@echo Build error!
@pause
:endbuild
rainwarrior wrote:
Oh, yes that's what it supposed to do when everything's fine. No comment and errorlevel 0.
I think most compilers are silent when there's no error (or other requested output).
It goes further than this: most (if not all?) UNIX tools are silent on success, except when being told to be verbose, if that's available. So for example,
gcc has most of its warnings deactivated by default, and outputs nothing on success, as expected. Other small commands, like
cp,
mv,
rm,
mkdir, etc. print nothing at all on normal circumstances. Note that shell scripts don't echo lines of execution by default, so again, except when errors occur, you may see nothing on the screen upon its execution.
Contrast this with MS-DOS and Windows, where for example
copy outputs " X file(s) copied", batch files echo lines by default, and
the Microsoft C/C++ compiler prints a banner, unless told otherwise.
I put the test asm in the same folder as the asm6 what do I do from there? I have no clue as to what to put into the cmd
Then you're not reading the replies. I gave you all the information necessary to create a batch file for ASM6, but you insisted on just clicking the assemblers, after being told that wouldn't work.
If you're not willing to read the replies and spend any effort on learning, people will soon stop responding. I know I felt pretty disappointed to read that you kept double clicking .exe's after after my fairly detailed reply.
The absolute minimal setup you need to create a working ROM will need asm6.exe, assemble.bat and source.asm in the same folder. The batch file should contain at lest this:
Code:
asm6 source.asm game.nes
pause
The source file should contain a valid NES program made for ASM6. Each assembler has different features and rules that make source code incompatible between them without modifications.
You can search these forums for my ASM6 templates, which have the valid structure to create NES files, but don't contain any code. This means that the assembler will generate a valid ROM file that you can open in emulators, but nothing will happen because there's no program to do anything. You have to write the program yourself.
Note that the NROM template requires an 8kb CHR file. You can make one in YYCHR or rip the CHR-ROM from an existing game.
Then you can just double-click assemble.bat.
tokumaru wrote:
The absolute minimal setup you need to create a working ROM will need asm6.exe, assemble.bat and source.asm in the same folder. The batch file should contain at lest this:
Code:
asm6 source.asm game.nes
pause
The source file should contain a valid NES program made for ASM6. Each assembler has different features and rules that make source code incompatible between them without modifications.
You can search these forums for my ASM6 templates, which have the valid structure to create NES files, but don't contain any code. This means that the assembler will generate a valid ROM file that you can open in emulators, but nothing will happen because there's no program to do anything. You have to write the program yourself.
Note that the NROM template requires an 8kb CHR file. You can make one in YYCHR or rip the CHR-ROM from an existing game.
Then you can just double-click assemble.bat.
Sorry, I am just having a rough day, I just made the bat file and it said
pass 1.. nothing to do! getting excited about it
dougeff wrote:
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...
Quote:
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...
Quote:
asm6 test.asm test.nes
pause
That's it. Save this text file as 'compile.bat'
Or, if you want to get fancy...
Quote:
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.
I tried the more technical one and seemed to create the .lst file
I guess that means you figured out .bat files.
Now, to write a source file that actually works. Feel free to read old forum posts for exactly this subject. Search also for "asm6" and "template". And read the wiki. And spend some time over at 6502.org.
Good luck.
Wait the masm listing file is correct? I thought I needed a .nes not a .lst file
the .nes (or .bin which is default if you don't name the extension as .nes) is your binary program. the optional .lst is your list file for review.
FrankenGraphics wrote:
the .nes (or .bin which is default if you don't name the extension as .nes) is your binary program. the optional .lst is your list file for review.
For the batch file I put
set name="test"
asm6 %name%.asm %name%.nes -l
pause
%name%.nes
cc65\bin\ca65 bank0.s -g -o temp\bank0.o
@IF ERRORLEVEL 1 GOTO badbuild
cc65\bin\ca65 bank1.s -g -o temp\bank1.o
@IF ERRORLEVEL 1 GOTO badbuild
cc65\bin\ca65 bank2.s -g -o temp\bank2.o
@IF ERRORLEVEL 1 GOTO badbuild
@echo.
@echo.
@echo Build complete and successful!
@pause
@GOTO endbuild
:badbuild
@echo.
@echo.
@echo Build error!
@pause
:endbuildthat in it, I also made a Test.asm file with the tutorial that was made on the forum. I don't really know if I did anything wrong.. I mean I just copied and pasted the code
the first paragraph is for using asm6. Place it in your folder containing asm6 and your asm file. Run it from there.
the rest is for error handling specific to ca65 (and not a complete batch file for baking a program with ca65). They shouldn't be written together.
FrankenGraphics wrote:
the first paragraph is for using asm6. Place it in your folder containing asm6 and your asm file. Run it from there.
the rest is for error handling specific to ca65 (and not a complete batch file for baking a program with ca65). They shouldn't be written together.
Thank you I got it fixed and it worked. Same with putting code into the .asm file that acctually works
Cool, congratulations! That's all there is to setting up asm6.
in cc65/ca65, should you wish to switch, it's a little more complicated. Code is expected to be organized in a number of so called object files (pieces of code or data, could for example be organized in banks or smaller chunks), which another program called a linker (in this case ld65) will stitch together into one cohesive binary. the cc65 suite gives you more control over how the code is written and assembled, but at the price of a fiddlier setup.