NESASM inefficiency when referencing data by ptr-to-ptr?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
pops
Posts: 91
Joined: Sun Apr 04, 2010 4:28 pm

NESASM inefficiency when referencing data by ptr-to-ptr?

Post by pops »

While debugging my implementation of shiru's new famitone library, I noticed that NESASM assembles this:

Code: Select all

	FT_TEMP				= $00	;3 bytes in zeropage used by the library as a scratchpad
	FT_TEMP_PTR			= FT_TEMP		;word
	FT_TEMP_PTR_L		= FT_TEMP_PTR+0
	FT_TEMP_PTR_H		= FT_TEMP_PTR+1

	lda FT_TEMP_PTR_L
	pha
	lda FT_TEMP_PTR_H
	pha
Into this:

Code: Select all

; note lda absolute where lda zp would suffice
	lda $0000
	pha
	lda $0001
	pha
I'm not sure if NESASM is still under development - hopefully someone knows who to forward this to - thanks!
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM inefficiency when referencing data by ptr-to-ptr?

Post by tepples »

You have to explicitly specify zero page mode in NESASM.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM inefficiency when referencing data by ptr-to-ptr?

Post by zzo38 »

Yes, that is correct, you have to explicitly specify zero-page mode by putting < before the operand. (This is the method I prefer over other assemblers that don't do it that way.)
[url=gopher://zzo38computer.org/].[/url]
Post Reply