Difference between revisions of "JSR"

From Intellivision Wiki
Jump to: navigation, search
 
m (Protected "JSR" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite)))
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The Jump to Subroutine opcode (JSR) is a three-decle opcode that is a part of the [[Jump]] family of opcodes.  The Jump to Subroutine causes the [[CP1610]] to store the return address in the register specified, and then unconditionally jump to the address specified in the following parameters.<br/>
+
[[Category:CP1610]]
 +
<table border>
 +
<tr><td>Instruction Name</td><td>Jump to Subroutine</td></tr>
 +
<tr><td>Mnemonics</td><td>JSR</td></tr>
 +
<tr><td>CP1610 Clock Cycles</td><td>12</td></tr>
 +
<tr><td>Interruptible</td><td>Yes</td></tr>
 +
<tr><td>Opcode Range</td><td>$0004</td></tr>
 +
</table><br/>
 +
The Jump to Subroutine opcode (JSR) is a three-decle opcode that is a part of the [[Jump]] family of opcodes.  The Jump to Subroutine causes the [[CP1610]] to store the return address in the register specified, and then unconditionally jump to the address specified in the following parameters.<br/><br/>
 +
 
 +
The instruction "CALL <I>label</I>" is an alias for "JSR R5, <I>label</I>".<br/>
  
 
     Format - Decle #1    Format - Decle #2    Format - Decle #3
 
     Format - Decle #1    Format - Decle #2    Format - Decle #3
Line 14: Line 24:
 
         aaaaaaaaaaaaaaaa    indicates the address to where the [[CP1610]] should Jump
 
         aaaaaaaaaaaaaaaa    indicates the address to where the [[CP1610]] should Jump
  
Note that if the address stored in the specified register is the address that is exactly 3 addresses after the start of the Jump to Subroutine opcode, so that the subroutine will return to the next opcode immediately following Jump opcode.<br/>
+
Note that if the address stored in the specified register is the address that is exactly 3 addresses after the start of the Jump opcode, so that the subroutine will return to the next opcode immediately following Jump opcode.<br/>
  
 
See the [[Jump]] opcode family documentation for more information.
 
See the [[Jump]] opcode family documentation for more information.

Latest revision as of 08:08, 4 December 2010

Instruction NameJump to Subroutine
MnemonicsJSR
CP1610 Clock Cycles12
InterruptibleYes
Opcode Range$0004

The Jump to Subroutine opcode (JSR) is a three-decle opcode that is a part of the Jump family of opcodes. The Jump to Subroutine causes the CP1610 to store the return address in the register specified, and then unconditionally jump to the address specified in the following parameters.

The instruction "CALL label" is an alias for "JSR R5, label".

   Format - Decle #1     Format - Decle #2     Format - Decle #3
   0000:0000:0000:0100  0000:00rr:aaaa:aa00  0000:00aa:aaaa:aaaa
where:
rr indicates the register into which to store the return address such that: rr == 00 indicates to store return address in register R4 rr == 01 indicates register R5 rr == 10 indicates register R6 rr == 11 indicates that the CP1610 should not store the return address, signaling an Unconditional Jump rather than a Jump to Subrouting (JSR)
aaaaaaaaaaaaaaaa indicates the address to where the CP1610 should Jump

Note that if the address stored in the specified register is the address that is exactly 3 addresses after the start of the Jump opcode, so that the subroutine will return to the next opcode immediately following Jump opcode.

See the Jump opcode family documentation for more information.