How do I assemble assembly code?
Moderator: Moderators
-
- Posts: 5
- Joined: Thu Mar 07, 2019 11:18 am
Re: How do I assemble assembly code?
How do I assemble assembly code, I'd like to code in 6502 assembly, not in C
Re: How do I assemble assembly code?
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.
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
Re: How do I assemble assembly code?
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:
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:
- Compile the assembler written in C using a C compiler, producing the assembler in executable form.
- Run the assembler in executable form on your assembly language program, producing your program in executable form.
Re: How do I assemble assembly code?
This is a block of text that can be added to posts you make. There is a 255 character limit.
Re: How do I assemble assembly code?
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.ASM6 is not "a Windows assembler".
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
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
-
- Posts: 1318
- Joined: Thu Apr 23, 2009 11:21 pm
- Location: cypress, texas
Re: How do I assemble assembly code?
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:
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
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
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.
Re: How do I assemble assembly code?
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.
-
- Posts: 1318
- Joined: Thu Apr 23, 2009 11:21 pm
- Location: cypress, texas
Re: How do I assemble assembly code?
Ooh, sigh, 4 years old; sorry Sir Fiskbit.
Re: How do I assemble assembly code?
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.
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Re: How do I assemble assembly code?
Until a developer of NESASM comes in and gives the real answer, I'm going to unofficially go with "Famicom named symbol" for now.
Re: How do I assemble assembly code?
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:
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