.ASM into .NES assistance

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: .ASM into .NES assistance

Post by lidnariq » Wed May 08, 2013 3:03 pm

You'll need to run "c:\users\whoever\documents\nes maker files\asm6.exe" "c:\users\whoever\documents\nes maker files\input.asm" "c:\users\whoever\documents\nes maker files\output.nes"

Which is to say you'll need to make a file "input.asm" using something like notepad or any other plain text editor.

In that file you put the commands, like ".incbin"

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Wed May 08, 2013 3:11 pm

lidnariq wrote:You'll need to run "c:\users\whoever\documents\nes maker files\asm6.exe" "c:\users\whoever\documents\nes maker files\input.asm" "c:\users\whoever\documents\nes maker files\output.nes"

Which is to say you'll need to make a file "input.asm" using something like notepad or any other plain text editor.

In that file you put the commands, like ".incbin"
By making file, "input.asm" does it also work on ConTEXT? And then what?

By command, like "c:\users\whoever\documents\nes maker files\asm6.exe"".incbin"? Do I have to put " " everytime I want to command the ASM?

The output.nes means any NES that is blank?

(Gosh, I'm terrible at vocabulary...)
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

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

Re: .ASM into .NES assistance

Post by tepples » Wed May 08, 2013 3:22 pm

The .incbin command goes inside a source code file.

Have you ever written a program in any other programming language?

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Wed May 08, 2013 4:34 pm

tepples wrote:The .incbin command goes inside a source code file.

Have you ever written a program in any other programming language?
I don't think so... I read a lot of tutorials about ASM and CMD, and I still can't understand some of those...
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

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

Re: .ASM into .NES assistance

Post by tokumaru » Wed May 08, 2013 5:47 pm

OK, here are the steps for creating a valid NES ROM with ASM6:

1. Go to this post and copy the NROM template;
2. Open Notepad and paste the code you copied;
3. In the last line, change "tiles.chr" to the name of your CHR file;
4. Save the file as "game.asm" to the same folder where ASM6 and the CHR file are;
5. Open another Notepad window ans write the following in it:

Code: Select all

asm6 game.asm game.nes
pause
6. Save this as "compile.bat", in the same folder as the other files;
7. double click "compile.bat";

OBS: When saving files from Notepad, make sure to select (*.*) in the type field, otherwise it may end up putting ".txt" after the file names, and then it won't work.

This should open a command prompt window, but you don't have to type anything in it, because it will automatically execyte the command that are written inside the .bat file. The "pause" command is there to prevent the window from closing before you can see any messages the assembler outputs.

Anyway, after this you will get a valid NES file, but it won't do anything because there's no code to do anything, since the template was blank. You will need to write 6502 code to initialize the system and display something (tip: this code will go right after the "Reset" label, which is where the program begins - don't bother with NMI and IRQ for now). At least you have a place to start now.

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Wed May 08, 2013 6:22 pm

tokumaru wrote:OK, here are the steps for creating a valid NES ROM with ASM6:

1. Go to this post and copy the NROM template;
2. Open Notepad and paste the code you copied;
3. In the last line, change "tiles.chr" to the name of your CHR file;
4. Save the file as "game.asm" to the same folder where ASM6 and the CHR file are;
5. Open another Notepad window ans write the following in it:

Code: Select all

asm6 game.asm game.nes
pause
6. Save this as "compile.bat", in the same folder as the other files;
7. double click "compile.bat";

OBS: When saving files from Notepad, make sure to select (*.*) in the type field, otherwise it may end up putting ".txt" after the file names, and then it won't work.

This should open a command prompt window, but you don't have to type anything in it, because it will automatically execyte the command that are written inside the .bat file. The "pause" command is there to prevent the window from closing before you can see any messages the assembler outputs.

Anyway, after this you will get a valid NES file, but it won't do anything because there's no code to do anything, since the template was blank. You will need to write 6502 code to initialize the system and display something (tip: this code will go right after the "Reset" label, which is where the program begins - don't bother with NMI and IRQ for now). At least you have a place to start now.
aww.PNG
Do I have to replace "game.asm" with the file?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: .ASM into .NES assistance

Post by lidnariq » Wed May 08, 2013 6:29 pm

caramelpuffpuff wrote:Do I have to replace "game.asm" with the file?
Precisely. You should either rename "gametest.asm" to "game.asm", or edit compile.bat to use "gametest" instead of "game"

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Wed May 08, 2013 6:50 pm

lidnariq wrote:
caramelpuffpuff wrote:Do I have to replace "game.asm" with the file?
Precisely. You should either rename "gametest.asm" to "game.asm", or edit compile.bat to use "gametest" instead of "game"
...Muffins?!
...Muffins?!
O3O...!?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Wed May 08, 2013 6:53 pm

..."Anyway, after this you will get a valid NES file, but it won't do anything because there's no code to do anything, since the template was blank. You will need to write 6502 code to initialize the system and display something (tip: this code will go right after the "Reset" label, which is where the program begins - don't bother with NMI and IRQ for now). At least you have a place to start now."

... :lol: Uhh...So this is where I start now...
Attachments
uhhh..PNG
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

3gengames
Formerly 65024U
Posts: 2269
Joined: Sat Mar 27, 2010 12:57 pm

Re: .ASM into .NES assistance

Post by 3gengames » Wed May 08, 2013 7:10 pm

Yep, that's what it shows when you don't do anything to the system. You have to wait for the PPU to be ready, set it up, display graphics, and then make a game. :)

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

Re: .ASM into .NES assistance

Post by tokumaru » Wed May 08, 2013 8:03 pm

But at least you have some structure to work on now (a valid NES ROM with a 16 byte header, 16KB PRG-ROM and 8KB CHR-ROM = 24592 bytes), which you couldn't figure out before. Your tiles are there, ready to be used by the program. You should now look into how to initialize the system (tip: don't just copy and paste it - it might not even work because of assembler differences! - try to understand what's going on), setting palettes and showing some tiles.

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Thu May 09, 2013 1:42 pm

tokumaru wrote:But at least you have some structure to work on now (a valid NES ROM with a 16 byte header, 16KB PRG-ROM and 8KB CHR-ROM = 24592 bytes), which you couldn't figure out before. Your tiles are there, ready to be used by the program. You should now look into how to initialize the system (tip: don't just copy and paste it - it might not even work because of assembler differences! - try to understand what's going on), setting palettes and showing some tiles.
...... :?: Uhhh....can you write the steps like you did on the ASM?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

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

Re: .ASM into .NES assistance

Post by tokumaru » Thu May 09, 2013 1:59 pm

caramelpuffpuff wrote:...... :?: Uhhh....can you write the steps like you did on the ASM?
Not without doing all the work for you... you won't learn anything this way.

User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: .ASM into .NES assistance

Post by caramelpuffpuff » Thu May 09, 2013 2:00 pm

tokumaru wrote:
caramelpuffpuff wrote:...... :?: Uhhh....can you write the steps like you did on the ASM?
Not without doing all the work for you... you won't learn anything this way.
true...what is @vblankwait1 and 2? Do I put this in a notepad and convert it into ASM.? or bat.?
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.

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

Re: .ASM into .NES assistance

Post by tepples » Thu May 09, 2013 2:17 pm

In asm6 and ca65, a label whose name starts with with @ is a "cheap local label" that can't be seen across regular labels. This allows reuse of label names such as "loop" in different parts of a single program.
In the asm6 manual, loopy wrote:Labels are case sensitive. The special '$' label holds the current program address. Labels beginning with '@' are local labels. They have limited scope, visible only between non-local labels. Names of local labels may be reused.
Likewise, the ca65 manual has a section on cheap local labels.

Code: Select all

label1:
  ; stuff
@loop:
  ; stuff
  dey
  bne loop  ; goes to the @loop below label1; can't see @loop below label2
label2:
  ; ...
@loop:
  ; stuff
  dey
  bne loop  ; goes to the @loop below label2; can't see @loop below label1
Yes, you do put the init code in Notepad.

Post Reply