We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
LJMP (Super FX): Difference between revisions
From SnesLab
(what it stands for) |
(high byte of source register) |
||
(23 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{| class="wikitable" style="float:right;clear:right;width: | {| class="wikitable" style="float:right;clear:right;width:50%" | ||
!colspan="8"|Basic Info | !colspan="8"|Basic Info | ||
|+ | |+ | ||
|'''Addressing Mode''' | |||
|'''Opcode''' | |'''Opcode''' | ||
|'''Length''' | |'''Length''' | ||
Line 8: | Line 9: | ||
|'''Cache Speed''' | |'''Cache Speed''' | ||
|+ | |+ | ||
|[[Absolute Long Implied]] (type 1) | |||
|3D9n | |3D9n | ||
|2 bytes | |2 bytes | ||
Line 16: | Line 18: | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="9"|Flags | !colspan="9"|Flags Affected | ||
|+ | |+ | ||
|B | |[[B Flag|B]] | ||
|ALT1 | |[[ALT1]] | ||
|ALT2 | |[[ALT2]] | ||
|O/V | |[[O/V]] | ||
|S | |[[Sign Flag|S]] | ||
|CY | |[[CY]] | ||
|Z | |[[Zero Flag|Z]] | ||
|+ | |+ | ||
|0 | |0 | ||
Line 37: | Line 39: | ||
'''LJMP''' (Long Jump) is a [[Super FX]] instruction that performs a (possibly interbank) jump. | '''LJMP''' (Long Jump) is a [[Super FX]] instruction that performs a (possibly interbank) jump. | ||
According to [[fullsnes]], the official documentation has the bank and offs operands for LJMP mixed up. <sup>[ | The low byte of the [[source register]] is loaded into the [[program bank register]]. The high byte of the source register is ignored. | ||
According to [[fullsnes]], the official documentation has the bank and offs operands for LJMP mixed up. <sup>[3]</sup> | |||
The operand can be any general register from R<sub>8</sub> to R<sub>13</sub>. The value of this general register is loaded into R<sub>15</sub> (the program counter). | |||
The instruction following LJMP is already in the pipeline (the delay slot) and will be executed before the first instruction at the jump target. | |||
The [[ALT0]] state is restored. All cache flags are reset. | |||
==== Syntax ==== | |||
<pre> | |||
LJMP Rn | |||
</pre> | |||
=== Example === | |||
Let: | |||
R<sub>1</sub> : 0001h | |||
The following program jumps from 00:8006h to 01:0002h: | |||
bank :addr code | |||
00 :8000h IWT R<sub>10</sub>, #0002h | |||
00 :8003h FROM R<sub>1</sub> | |||
00 :8004h LJMP R<sub>10</sub> | |||
00 :8006h NOP | |||
=== See Also === | === See Also === | ||
* [[JMP (Super FX)]] | * [[JMP (Super FX)]] | ||
* [[JMP]] | * [[JMP]] | ||
* [[BRA (Super FX)]] | |||
* [[BRA]] | |||
* [[ALT1]] | |||
=== External Links === | === External Links === | ||
# Official Nintendo documentation on LJMP: [https://archive.org/details/SNESDevManual/book2/page/n225 | # Official Nintendo documentation on LJMP: 9.49 on [https://archive.org/details/SNESDevManual/book2/page/n225 page 2-9-69 of Book II] | ||
# [https://archive.org/details/SNESDevManual/book2/page/n133 page 2-6-11 of Book II], lbid. | |||
# https://problemkaputt.de/fullsnes.htm#snescartgsuncpumisc | # https://problemkaputt.de/fullsnes.htm#snescartgsuncpumisc | ||
[[Category:ASM]] | [[Category:ASM]] | ||
[[Category:Super FX]] | [[Category:Super FX]] | ||
[[Category:Two-byte Instructions]] | |||
[[Category:Instructions with Delay Slots]] |
Latest revision as of 19:55, 31 July 2024
Basic Info | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | ROM Speed | RAM Speed | Cache Speed | ||
Absolute Long Implied (type 1) | 3D9n | 2 bytes | 6 cycles | 6 cycles | 2 cycle |
Flags Affected | ||||||||
---|---|---|---|---|---|---|---|---|
B | ALT1 | ALT2 | O/V | S | CY | Z | ||
0 | 0 | 0 | . | . | . | . |
LJMP (Long Jump) is a Super FX instruction that performs a (possibly interbank) jump.
The low byte of the source register is loaded into the program bank register. The high byte of the source register is ignored.
According to fullsnes, the official documentation has the bank and offs operands for LJMP mixed up. [3]
The operand can be any general register from R8 to R13. The value of this general register is loaded into R15 (the program counter).
The instruction following LJMP is already in the pipeline (the delay slot) and will be executed before the first instruction at the jump target.
The ALT0 state is restored. All cache flags are reset.
Syntax
LJMP Rn
Example
Let:
R1 : 0001h
The following program jumps from 00:8006h to 01:0002h:
bank :addr code 00 :8000h IWT R10, #0002h 00 :8003h FROM R1 00 :8004h LJMP R10 00 :8006h NOP
See Also
External Links
- Official Nintendo documentation on LJMP: 9.49 on page 2-9-69 of Book II
- page 2-6-11 of Book II, lbid.
- https://problemkaputt.de/fullsnes.htm#snescartgsuncpumisc