Difference between revisions of "Jump"

From Intellivision Wiki
Jump to: navigation, search
m (Protected "Jump" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite)))
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:CP1610]]
 
[[Category:CP1610]]
Jump is a three-decle opcode that is represented as one of several different possible mnemonics, depending on the flags indicated in the second decle of the opcode.  The opcode breaks down as follows.
+
<table border>
 +
<tr><td>Instruction Name</td><td>Jump</td></tr>
 +
<tr><td>Mnemonics</td><td>J/JE/JD/JSR/JSRE/JSRD/CALL</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>
 +
<tr><td>Input Flags</td><td>None</td></tr>
 +
<tr><td>Output Flags</td><td>[[Interrupt Enable Flag]]</td></tr>
 +
<tr><td>Addressing Mode</td><td>Special</td></tr>
 +
</table><br/>
  
     Format - Decle #1     Format - Decle #2     Format - Decle #3
+
Jump is a family of three-decle instructions that all map to the $0004 opcode and are represented as any of several different possible mnemonics, depending on the flags indicated in the second decle of the opcode.  The opcode format breaks down as follows.
 +
 
 +
     Format - Decle #1   Format - Decle #2   Format - Decle #3
 
     0000:0000:0000:0100  0000:00rr:aaaa:aaff  0000:00aa:aaaa:aaaa<br/>
 
     0000:0000:0000:0100  0000:00rr:aaaa:aaff  0000:00aa:aaaa:aaaa<br/>
 
     where:<br/>
 
     where:<br/>
Line 10: Line 21:
 
                   rr == 01    indicates register R5
 
                   rr == 01    indicates register R5
 
                   rr == 10    indicates register R6
 
                   rr == 10    indicates register R6
                   rr == 11    indicates that the CP1610 should not store the  
+
                   rr == 11    indicates that the [[CP1610]] should not store the  
 
                               return address, signaling a Jump without return<br/>
 
                               return address, signaling a Jump without return<br/>
         ff    indicates how to affect the Interrupt (I) flag in the CP1610
+
         ff    indicates how to affect the Interrupt (I) flag in the [[CP1610]]
 
               such that:
 
               such that:
 
                   ff == 00    indicates not to affect the Interrupt flag
 
                   ff == 00    indicates not to affect the Interrupt flag
Line 20: Line 31:
 
         aaaaaaaaaaaaaaaa    indicates the address to where the [[CP1610]] should Jump
 
         aaaaaaaaaaaaaaaa    indicates the address to where the [[CP1610]] should Jump
  
This opcode is often represented as many different mnemonics, to make life a little easier for the programmer.  The mnemonic used depends on the combination of the rr and ff parameters mentioned above, according to the following chart.<br/><br/>
+
Note that if the return address is stored in a register, the address stored in that 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 after the Jump opcode.  Some routines use the fact that R4 and R5 are incrementing counters, and so will place data after the Jump instruction.  See [[Calling Conventions]] for more details on function calls.<br/>
 +
 
 +
The Jump opcode is often represented as many different mnemonics, to make life a little easier for the programmer.  The mnemonic used to represent this opcode depends on the combination of the rr and ff parameters mentioned above, according to the following charts.  Also, the instruction <TT>CALL <I>label</I></TT> is an alias for <TT>JSR R5, <I>label</I></TT>.<br/><br/>
 +
 
 +
<strong>Mnemonics To Parameters</strong><br/>
 +
<table border>
 +
<tr><th>Mnemonic</th><th>rr</th><th>ff</th></tr>
 +
<tr><td>[[JSR]]</td><td>00,01,10</td><td>00</td></tr>
 +
<tr><td>[[JSRE]]</td><td>00,01,10</td><td>01</td></tr>
 +
<tr><td>[[JSRD]]</td><td>00,01,10</td><td>10</td></tr>
 +
<tr><td>[[J]]</td><td>11</td><td>00</td></tr>
 +
<tr><td>[[JE]]</td><td>11</td><td>01</td></tr>
 +
<tr><td>[[JD]]</td><td>11</td><td>10</td></tr>
 +
<tr><td>unknown opcodes</td><td>00,01,10,11</td><td>11</td></tr>
 +
</table><br/>
  
 +
<strong>Parameters To Mnemonics</strong><br/>
 
<table border>
 
<table border>
 
<tr><td></td><td>rr == 00</td><td>rr == 01</td><td>rr == 10</td><td>rr == 11</td></tr>
 
<tr><td></td><td>rr == 00</td><td>rr == 01</td><td>rr == 10</td><td>rr == 11</td></tr>
<tr><td>ff == 00</td><td>JSR R4, $aaaa</td><td>JSR R5, $aaaa</td><td>JSR R6, $aaaa</td><td>J $aaaa</td></tr>
+
<tr><td>ff == 00</td><td>[[JSR]] R4, $aaaa</td><td>[[JSR]] R5, $aaaa</td><td>[[JSR]] R6, $aaaa</td><td>[[J]] $aaaa</td></tr>
<tr><td>ff == 01</td><td>JSRE R4, $aaaa</td><td>JSRE R5, $aaaa</td><td>JSRE R6, $aaaa</td><td>JE $aaaa</td></tr>
+
<tr><td>ff == 01</td><td>[[JSRE]] R4, $aaaa</td><td>[[JSRE]] R5, $aaaa</td><td>[[JSRE]] R6, $aaaa</td><td>[[JE]] $aaaa</td></tr>
<tr><td>ff == 10</td><td>JSRD R4, $aaaa</td><td>JSRD R5, $aaaa</td><td>JSRD R6, $aaaa</td><td>JD $aaaa</td></tr>
+
<tr><td>ff == 10</td><td>[[JSRD]] R4, $aaaa</td><td>[[JSRD]] R5, $aaaa</td><td>[[JSRD]] R6, $aaaa</td><td>[[JD]] $aaaa</td></tr>
 
<tr><td>ff == 11</td><td align=center colspan=4>unknown opcodes</td></tr>
 
<tr><td>ff == 11</td><td align=center colspan=4>unknown opcodes</td></tr>
 
</table>
 
</table>

Latest revision as of 08:45, 4 December 2010

Instruction NameJump
MnemonicsJ/JE/JD/JSR/JSRE/JSRD/CALL
CP1610 Clock Cycles12
InterruptibleYes
Opcode Range$0004
Input FlagsNone
Output FlagsInterrupt Enable Flag
Addressing ModeSpecial

Jump is a family of three-decle instructions that all map to the $0004 opcode and are represented as any of several different possible mnemonics, depending on the flags indicated in the second decle of the opcode. The opcode format breaks down as follows.

   Format - Decle #1    Format - Decle #2    Format - Decle #3
   0000:0000:0000:0100  0000:00rr:aaaa:aaff  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 a Jump without return
ff indicates how to affect the Interrupt (I) flag in the CP1610 such that: ff == 00 indicates not to affect the Interrupt flag ff == 01 indicates to set the Interrupt flag ff == 10 indicates to clear the Interrupt flag ff == 11 unknown opcode (behavior unknown!!)
aaaaaaaaaaaaaaaa indicates the address to where the CP1610 should Jump

Note that if the return address is stored in a register, the address stored in that 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 after the Jump opcode. Some routines use the fact that R4 and R5 are incrementing counters, and so will place data after the Jump instruction. See Calling Conventions for more details on function calls.

The Jump opcode is often represented as many different mnemonics, to make life a little easier for the programmer. The mnemonic used to represent this opcode depends on the combination of the rr and ff parameters mentioned above, according to the following charts. Also, the instruction CALL label is an alias for JSR R5, label.

Mnemonics To Parameters

Mnemonicrrff
JSR00,01,1000
JSRE00,01,1001
JSRD00,01,1010
J1100
JE1101
JD1110
unknown opcodes00,01,10,1111

Parameters To Mnemonics

rr == 00rr == 01rr == 10rr == 11
ff == 00JSR R4, $aaaaJSR R5, $aaaaJSR R6, $aaaaJ $aaaa
ff == 01JSRE R4, $aaaaJSRE R5, $aaaaJSRE R6, $aaaaJE $aaaa
ff == 10JSRD R4, $aaaaJSRD R5, $aaaaJSRD R6, $aaaaJD $aaaa
ff == 11unknown opcodes