ASM6 syntax

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

Post Reply
User avatar
picccca
Posts: 44
Joined: Wed Nov 24, 2010 12:51 am
Location: Finland
Contact:

ASM6 syntax

Post by picccca »

Hi, some questions about ASM6, in NESASM you write:

Code: Select all

LDA #HIGH(background)
to load the accumulator with the high byte of address to label "background". But how do you write in ASM6? do you write

Code: Select all

LDA >background
Is this correct? then I also have one more question :roll:

I have used tokumaru's ASM6 NROM template from this thread. My question is where in this code can I put the nametable, attributetable and palettes? is it normal to put them right before NMI label?
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Example:

Code: Select all

GFX_FONT:
	.incbin "Font.CHR"

	LDA #>GFX_FONT	; Load High Byte of Font Address
	LDA #<GFX_FONT	; Load Low Byte of Font Address

You can include data whereever you want in your ROM. If you have 32K or less of PRG, it doesn't matter at all where you put things. But when you start using memory mapper hardware you'll want to put critical code and data in the Fixed/Permanent program bank and data and code only accessed at certain times into the swappable banks.[/code]
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: ASM6 syntax

Post by tokumaru »

picccca wrote:My question is where in this code can I put the nametable, attributetable and palettes? is it normal to put them right before NMI label?
You can put it anywhere where it won't be accidentally interpreted as code (yeah, I've seen people including data right in the middle of a block of instructions).

Personally, I like to place the data before the code, from the beginning of the ROM up. I guess I do this because it's easier to page-align data that shouldn't cross pages.

If I put the data after the code it would be pushed up in the ROM as the code grew... I guess I just like to have more control over what data goes where, which is easier to do if I place it at the beginning.
User avatar
picccca
Posts: 44
Joined: Wed Nov 24, 2010 12:51 am
Location: Finland
Contact:

Post by picccca »

Ok, thanks for the help. It's difficult somethimes :D
I also found another line that was wrong in my code. It is easy to mix up when following NESASM examples and using ASM6 assembler. But you learn all the time.

NESASM:

Code: Select all

LDA [pointerLo], y
ASM6:

Code: Select all

LDA (pointerLo), y
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

picccca wrote:NESASM:

Code: Select all

LDA [pointerLo], y
ASM6:

Code: Select all

LDA (pointerLo), y
This is probably the biggest discrepancy of NESASM, as it's the only 6502 assembler to use [] for indirection, all others, not only ASM6, use ().
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

You should double check your statements.
Wla works with either [] or (). You can even use [) if you want.
Useless, lumbering half-wits don't scare us.
Post Reply