We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

LINK: Difference between revisions

From SnesLab
Jump to: navigation, search
(moved tables up)
(The ALT0 state is restored.)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| class="wikitable" style="float:right;clear:right;width:40%"
{| class="wikitable" style="float:right;clear:right;width:50%"
!colspan="8"|Basic Info
!colspan="8"|Basic Info
|+
|+
Line 9: Line 9:
|'''Cache Speed'''
|'''Cache Speed'''
|+
|+
|immediate
|[[Immediate]]
|9n
|9n
|1 byte
|1 byte
Line 20: Line 20:
!colspan="9"|Flags Affected
!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 37:
|}
|}


'''LINK''' is a [[Super FX]] instruction that stores the sum of R15 and an immediate value into R11.
'''LINK''' is a [[Super FX]] instruction that stores the sum of R<sub>15</sub> (program counter) and an immediate value (n) into R<sub>11</sub>. The operand n is the low nybble of the opcode and may be any integer from 1~4.
 
LINK can be used to store a [[return address]] into R<sub>11</sub> when jumping to a subroutine.
 
The [[ALT0]] state is restored.
 
==== Syntax ====
<pre>
LINK #n
</pre>
 
==== Example ====
Let:
R<sub>15</sub> : 4368h
After executing the following program:
4368 LINK #4
4369 IWT R<sub>15</sub>, #74ffh
436C NOP
436B IBT R<sub>1</sub>, #12h
We have:
R<sub>11</sub> = 4369h + 2 = 436bh
 
=== See Also ===
* [[ADD (Super FX)]]
* [[ADC (Super FX)]]


=== External Links ===
=== External Links ===
* Official Nintendo documentation on LINK: [https://archive.org/details/SNESDevManual/book2/page/n224 Page 2-9-68 of Book II]
* Official Nintendo documentation on LINK: 9.48 on [https://archive.org/details/SNESDevManual/book2/page/n224 Page 2-9-68 of Book II]


[[Category:ASM]]
[[Category:ASM]]
[[Category:Super FX]]
[[Category:Super FX]]

Latest revision as of 00:12, 13 July 2024

Basic Info
Addressing Mode Opcode Length ROM Speed RAM Speed Cache Speed
Immediate 9n 1 byte 3 cycles 3 cycles 1 cycle
Flags Affected
B ALT1 ALT2 O/V S CY Z
0 0 0 . . . .

LINK is a Super FX instruction that stores the sum of R15 (program counter) and an immediate value (n) into R11. The operand n is the low nybble of the opcode and may be any integer from 1~4.

LINK can be used to store a return address into R11 when jumping to a subroutine.

The ALT0 state is restored.

Syntax

LINK #n

Example

Let:

R15 : 4368h

After executing the following program:

4368 LINK #4
4369 IWT R15, #74ffh
436C NOP
436B IBT R1, #12h

We have:

R11 = 4369h + 2 = 436bh

See Also

External Links