It is currently Wed Aug 16, 2017 2:50 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri Oct 31, 2014 6:53 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9878
Location: Rio de Janeiro - Brazil
Yes, this and other workarounds have been suggested. It's not like this is impossible to do, but the code is more readable if you don't have to do things like this, and not having to look up opcodes will save some time too.


Top
 Profile  
 
PostPosted: Fri Oct 31, 2014 9:12 pm 
Offline
Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2257
Would the preferred solution to be an assembler that optimizes all instructions for zeropage unless the object is denoted with a $ character preceding the object's name/value? :)


Top
 Profile  
 
PostPosted: Fri Oct 31, 2014 9:29 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18790
Location: NE Indiana, USA (NTSC)
$ is reserved for the hexadecimal constant prefix. I've seen that ca65 optimizes where possible (address is known to be less than $100 before it is used) unless a: is specified.


Top
 Profile  
 
PostPosted: Sat Nov 01, 2014 6:29 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9878
Location: Rio de Janeiro - Brazil
A modifier is certainly the best solution, because it can be applied to anything (hardcoded addresses, variables and expressions) but I never heard of this syntax before (a:). Is it common or just a CA65 thing? I've seen .w appended to the operator a few times before, so I'm not sure which is more common. When you force an addressing mode like this, you're in fact modifying both the operator (different opcode) and the operand (16 bits instead of 8), so both make sense to me.


Top
 Profile  
 
PostPosted: Sat Nov 01, 2014 7:01 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18790
Location: NE Indiana, USA (NTSC)
In 68000 assembly, instructions use .W and the like to specify the size of the data (8, 16, or 32 bits), not the size of the address.


Top
 Profile  
 
PostPosted: Sat Nov 01, 2014 7:13 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9878
Location: Rio de Janeiro - Brazil
tepples wrote:
In 68000 assembly, instructions use .W and the like to specify the size of the data (8, 16, or 32 bits), not the size of the address.

If that's the case, then this really isn't the best option for 6502 assembly.


Top
 Profile  
 
PostPosted: Sat Nov 08, 2014 9:25 am 
Offline

Joined: Thu Aug 28, 2008 1:17 am
Posts: 591
Doesn't ASM6 support macros? It shouldn't be too difficult to write macros for instructions that need to read/write full address or zp addressing.

_________________
__________________________
http://pcedev.wordpress.com


Top
 Profile  
 
PostPosted: Sat Nov 08, 2014 1:50 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 910
Just let it known that I personally happen to prefer the way NESASM does it; zero page addressing is marked explicitly.

_________________
.


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 11:38 am 
Offline

Joined: Wed Jun 07, 2017 7:55 am
Posts: 5
How about:
Code:
LDA (zeroPageAddress + $800), y


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 11:41 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5534
Location: Canada
That's not a valid 6502 instruction. The value within () needs to be < $100. There is no indirect indexed LDA that takes a pointer from outside the zero-page. (Only indirect JMP can do this.)

LDA (zp), Y


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 2:08 pm 
Offline

Joined: Wed Jun 07, 2017 7:55 am
Posts: 5
My bad I meant:
Code:
LDA zeroPageAddress+$800, y


To force opcode $B9.


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 2:15 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5534
Location: Canada
Well, yes you can use mirrored addresses for ZP on the NES, though I don't think it's a good way to do this.

In NESASM it will be absolute anyway if you don't use the < prefix, so it's not relevant.

On ca65 you can force an absolute address with an a: prefix. I think it's better to use this instead of relying on mirroring.
Code:
LDA a:zeroPageAddress, y


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: Pokun and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group