We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
Program Counter Relative Addressing: Difference between revisions
From SnesLab
(ASM category) |
(→Syntax: explain nearlabel) |
||
(20 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Program Counter Relative Addressing''' is supported by nine instructions on the [[65c816]]: | |||
* [[BCC]] | |||
* [[BCS]] | * [[BCC]] (opcode 90) | ||
* [[BEQ]] | * [[BCS]] (opcode B0) | ||
* [[BMI]] | * [[BEQ]] (opcode F0) | ||
* [[BNE]] | * [[BMI]] (opcode 30) | ||
* [[BPL]] | * [[BNE]] (opcode D0) | ||
* [[BRA]] | * [[BPL]] (opcode 10) | ||
* [[BVC]] | * [[BRA]] (opcode 80) | ||
* [[BVS]] | * [[BVC]] (opcode 50) | ||
* [[BVS]] (opcode 70) | |||
All of which are two bytes long. | |||
The '''effective address''' is generated by sign-extending the 8-bit operand to 16 bits and then adding it to the [[program counter]]. The [[program bank register]] remains the same. | |||
==== Syntax ==== | |||
<pre> | |||
BRA nearlabel | |||
</pre> | |||
Where nearlabel is in the range of -128 to 127 bytes away from the next opcode after BRA. | |||
=== See Also === | === See Also === | ||
* [[Program Counter Relative Long Addressing]] | * [[Program Counter Relative Long Addressing]] | ||
=== | === References === | ||
* [[Eyes & Lichty]] | * [[Eyes & Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/399 page 399] | ||
* section 3.5.21 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf | |||
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#5.18 | |||
[[Category:ASM]] | [[Category:ASM]] | ||
[[Category:Addressing Modes]] | [[Category:Addressing Modes]] | ||
[[Category:Inherited from 6502]] |
Latest revision as of 04:44, 9 August 2024
Program Counter Relative Addressing is supported by nine instructions on the 65c816:
- BCC (opcode 90)
- BCS (opcode B0)
- BEQ (opcode F0)
- BMI (opcode 30)
- BNE (opcode D0)
- BPL (opcode 10)
- BRA (opcode 80)
- BVC (opcode 50)
- BVS (opcode 70)
All of which are two bytes long.
The effective address is generated by sign-extending the 8-bit operand to 16 bits and then adding it to the program counter. The program bank register remains the same.
Syntax
BRA nearlabel
Where nearlabel is in the range of -128 to 127 bytes away from the next opcode after BRA.
See Also
References
- Eyes & Lichty, page 399
- section 3.5.21 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf
- Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#5.18