Category:6502 Assembly: Difference between revisions

Content added Content deleted
Line 30: Line 30:
* It is possible that a port that can be read, will be altered after reading it. Furthermore, writing to one port can alter the contents in another. This is often seen in video RAM ports, where writing to the port responsible for storing background graphics will auto-increment the value stored in the port responsible for deciding where those graphics will be stored. (This is how the NES's picture processing unit operates.)
* It is possible that a port that can be read, will be altered after reading it. Furthermore, writing to one port can alter the contents in another. This is often seen in video RAM ports, where writing to the port responsible for storing background graphics will auto-increment the value stored in the port responsible for deciding where those graphics will be stored. (This is how the NES's picture processing unit operates.)


* Writing to ports with commands other than <code>LDA/LDX/LDY</code> will either fail or result in undefined behavior. For example, <code>INC</code> or <code>DEC</code> may not have the desired result.
* Writing to ports with commands other than <code>LDA/LDX/LDY</code> can sometimes fail or result in undefined behavior. For example, <code>INC</code> or <code>DEC</code> may not have the desired result.


* Some registers can only be written to by bit shifting, these so-called "shift registers" require you to load a value into the accumulator, then repeatedly alternating between <code>ROR</code>ing the accumulator and <code>ROL</code>ing the port.
* Some registers can only be written to by bit shifting, these so-called "shift registers" require you to load a value into the accumulator, then repeatedly alternating between <code>ROR</code>ing the accumulator and <code>ROL</code>ing the port.