Jump to content



2

Session 19: Addressing modes


26 replies to this topic

#26 supercat OFFLINE  

supercat

    Quadrunner

  • 6,367 posts

Posted Fri Jun 3, 2005 1:18 AM

Christopher Tumber, on Mon Jul 7, 2003 2:25 AM, said:

lda $80,y

Should throw up an "Illegal Addressing Mode" error.

I've seen different 6502 assemblers handle this issue differently. My preferred approach is to have four-letter mnemonics which explicitly specify zero-page or non-zero-page addressing, and otherwise have the addressing mode be inferred based upon the numerical value of the operand. Trying to use the way in which the operand is written to make such inference can be dangerous unless the assembler distinguishes among eight-bit labels, sixteen-bit labels, and numeric quantities. For example, suppose I write the following:
foo equ $FF
bar equ foo+1
  lda (bar-1)
What addressing mode should be generated?

BTW, I would suggest that when coding for the Atari, a good way to address the TIA or RAM using absolute addressing mode would be to simply add 256 to the address, since addresses $0100-$01FF map to $0000-$00FF.

#27 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

  • 16,745 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany

Posted Fri Jun 3, 2005 1:44 AM

supercat, on Fri Jun 3, 2005 9:18 AM, said:

My preferred approach is to have four-letter mnemonics which explicitly specify zero-page or non-zero-page addressing, and otherwise have the addressing mode be inferred based upon the numerical value of the operand.
:idea: DASM can use modifiers like .w, .wx, .wy.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users