How do I assemble assembly code?

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

austinleal8
Posts: 5
Joined: Thu Mar 07, 2019 11:18 am

Re: How do I assemble assembly code?

Post by austinleal8 »

How do I assemble assembly code, I'd like to code in 6502 assembly, not in C
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: How do I assemble assembly code?

Post by dougeff »

He was explaining how to compile an assembler that would work on Mac.

asm6 is an assembler. But it's a windows assembler. Hence, having to recompile it to work on a Mac.

Personally, I would just go to ebay and get a cheap used windows laptop. $50.
nesdoug.com -- blog/tutorial on programming for the NES
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How do I assemble assembly code?

Post by tepples »

ASM6 is not "a Windows assembler". It's written in reasonably portable C and appears to work correctly on my Ubuntu laptop.

Returning to the previous question:
If you have a program written in assembly language and an assembler written in C, you need to do two steps:
  1. Compile the assembler written in C using a C compiler, producing the assembler in executable form.
  2. Run the assembler in executable form on your assembly language program, producing your program in executable form.
User avatar
Punch
Posts: 365
Joined: Sat Feb 16, 2013 11:52 am

Re: How do I assemble assembly code?

Post by Punch »

This is a block of text that can be added to posts you make. There is a 255 character limit.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: How do I assemble assembly code?

Post by dougeff »

ASM6 is not "a Windows assembler".
Funny, I'm looking at the download page, and it says "OS: Win". So, a person looking at that, who wasn't used to compiling their own tools, might conclude that it wasn't a Mac app.

Which is why I said he'd have to recompile.

ca65 would also need to be recompiled to work on a Mac.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

Re: How do I assemble assembly code?

Post by jeffythedragonslayer »

tepples wrote: Thu Mar 07, 2019 11:44 am I'm confused about where the .fns extension came from. Can anyone else explain?
I would also like to know what FNS stands for. Famicom something something?
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I assemble assembly code?

Post by unregistered »

Following tepples advice,

1.) You’d need to compile asm6.c using a C compiler on your Mac.

2.) Then use that Mac ready asm6.exe, created in step1, to assemble your game.asm into a game.nes file.

On windows, I type something like:

Code: Select all

asm6 game.asm game.nes
Though, the asm6 assembler has flags you can insert that will change how the assembler reacts. The description of the flags are in the README.txt file that is included in the asm6 download. i.e. the first line of my assembly .bat file reads something like:
asm6_g -U myMainGameFile.asm game-0028.nes

^That uses a flag -U with my asm6_g.exe assembler… the -U flag will adjust how asm6_g.exe works; asm6_g.exe will start to assemble the entire myMainGameFile.asm’s 6502 assembly code; and, as a result, will try to produce an nes file called game-0028.nes.


However, you will be using an asm6.exe that you’ve compiled for MAC. It won’t have a -U flag, but again, the asm6 flags are listed inside of its README.txt.

Then run your game.nes file… like with an emulator :)


p.s. asm6 is a great assembler :)
Last edited by unregistered on Mon Feb 27, 2023 4:44 pm, edited 1 time in total.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: How do I assemble assembly code?

Post by Fiskbit »

Note that this thread is 4 years old, and the original poster hasn't been active for that long. jeffy, unless you actually need to know what a .fns file is for some reason, I think this is a good example of when not to bump very old threads.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I assemble assembly code?

Post by unregistered »

Ooh, sigh, 4 years old; sorry Sir Fiskbit.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: How do I assemble assembly code?

Post by Fiskbit »

No need to apologize; it's great that you're trying to contribute and reasonable that you didn't realize how old this thread is. I would prefer we avoid bumping old threads unless meaningfully contributing to the conversation, to avoid people wasting their time trying to help someone who is long gone. There is a cost in terms of people's time and attention when surfacing old threads.
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

Re: How do I assemble assembly code?

Post by jeffythedragonslayer »

Until a developer of NESASM comes in and gives the real answer, I'm going to unofficially go with "Famicom named symbol" for now.
cornel
Posts: 4
Joined: Mon Sep 05, 2022 10:21 am
Location: Guatemala
Contact:

Re: How do I assemble assembly code?

Post by cornel »

FNS means functions in this context, the kevinselwyn version of nesasm will generate a .fns file next to the .nes file when using the -f argument.
It contains the addresses of all functions and labels, for example:

Code: Select all

_func_8047                       = $8047
_label_8071                      = $8071
_label_8043                      = $8043
Reset                            = $8000
Post Reply