From Intellivision Wiki
Revision as of 20:35, 11 January 2005 by Pingaso (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

   Format - Decle #1     Format - Decle #2     Format - Decle #3
   0000:0000:0000:0100  0000:00rr:aaaa:aa00  0000:00aa:aaaa:aaaa
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 to Subroutine opcode, so that the subroutine will return to the next opcode immediately following Jump opcode.

See the Jump opcode family documentation for more information.