Advertisement
cloudmax

Nintendo 64 opcodes

Feb 2nd, 2014
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 98.94 KB | None | 0 0
  1. Nintendo 64 opcodes v0.3 by anarko <[email protected]>
  2.  
  3. Part A: Brief list released on 98-02-19
  4. ----------------------------------------------------------------------------
  5.  
  6.  
  7. ****************************************************************************
  8. ** Load and Store Instructions **
  9. ****************************************************************************
  10. LB rt,offset(base) Load Byte
  11. LBU rt,offset(base) Load Byte Unsigned
  12. LD rt,offset(base) Load Doubleword
  13. LDL rt,offset(base) Load Doubleword Left
  14. LDR rt,offset(base) Load Doubleword Right
  15. LH rt,offset(base) Load Halfword
  16. LHU rt,offset(base) Load Halfword Unsigned
  17. LL rt,offset(base) Load Linked word
  18. LLD rt,offset(base) Load Linked Doubleword
  19. LW rt,offset(base) Load Word
  20. LWL rt,offset(base) Load Word Left
  21. LWR rt,offset(base) Load Word Right
  22. LWU rt,offset(base) Load Word Unsigned
  23. SB rt,offset(base) Store Byte
  24. SC rt,offset(base) Store Conditional word
  25. SCD rt,offset(base) Store Conditional Doubleword
  26. SD rt,offset(base) Store Doubleword
  27. SDL rt,offset(base) Store Doubleword Left
  28. SDR rt,offset(base) Store Doubleword Right
  29. SH rt,offset(base) Store Halfword
  30. SW rt,offset(base) Store Word
  31. SWL rt,offset(base) Store Word Left
  32. SWR rt,offset(base) Store Word Right
  33. SYNC SYNChronize shared memory
  34.  
  35. ****************************************************************************
  36. ** Atithmetic Instructions **
  37. ****************************************************************************
  38. ADD rd,rs,rt ADD word
  39. ADDI rt,rs,immediate ADD Immediate word
  40. ADDIU rt,rs,immediate Add Immediate Unsigned word
  41. ADDU rd,rs,rt Add Unsigned word
  42. AND rd,rs,rt AND
  43. ANDI rt,rs,immediate AND Immediate
  44. DADD rd,rs,rt Doubleword ADD
  45. DADDI rt,rs,immediate Doubleword ADD Immediate
  46. DADDIU rt,rs,immediate Doubleword ADD Immediate Unsigned
  47. DADDU rd,rs,rt Doubleword ADD Unsigned
  48. DDIV rs,rt Doubleword DIVide
  49. DDIVU rs,rt Doubleword DIVide Unsigned
  50. DIV rs,rt DIVide word
  51. DIVU rs,rt DIVide Unsigned word
  52. DMULT rs,rt Doubleword MULTiply
  53. DMULTU rs,rt Doubleword MULTiply Unsigned
  54. DSLL rd,rt,sa Doubleword Shift Left Logical
  55. DSLL32 rd,rt,sa Doubleword Shift Left Logical +32
  56. DSLLV rd,rt,rs Doubleword Shift Left Logical Variable
  57. DSRA rd,rt,sa Doubleword Shift Right Arithmetic
  58. DSRA32 rd,rt,sa Doubleword Shift Right Arithmetic +32
  59. DSRAV rd,rt,rs Doubleword Shift Right Arithmetic Variable
  60. DSRL rd,rt,sa Doubleword Shift Right Logical
  61. DSRL32 rd,rt,sa Doubleword Shift Right Logical +32
  62. DSRLV rd,rt,rs Doubleword Shift Right Logical Variable
  63. DSUB rd,rs,rt Doubleword SUBtract
  64. DSUBU rd,rs,rt Doubleword SUBtract Unsigned
  65. LUI rt,immediate Load Upper Immediate
  66. MFHI rd Move From HI register
  67. MFLO rd Move From LO register
  68. MTHI rd Move To HI register
  69. MTLO rd Move To LO register
  70. MULT rs,rt MULTiply word
  71. MULTU rs,rt MULTiply Unsigned word
  72. NOR rd,rs,rt Not OR
  73. OR rd,rs,rt OR
  74. ORI rt,rs,immediate OR Immediate
  75. SLL rd,rt,sa Shift word Left Logical
  76. SLLV rd,rt,rs Shift word Left Logical Variable
  77. SLT rd,rs,rt Set on Less Than
  78. SLTI rt,rs,immediate Set on Less Than Immediate
  79. SLTIU rt,rs,immediate Set on Less Than Immediate Unsigned
  80. SLTU rd,rs,rt Set on Less Than Unsigned
  81. SRA rd,rt,sa Shift word Right Arithmetic
  82. SRAV rd,rt,rs Shift word Right Arithmetic Variable
  83. SRL rd,rt,sa Shift word Right Logical
  84. SRLV rd,rt,rs Shift word Right Logical Variable
  85. SUB rd,rs,rt SUBtract word
  86. SUBU rd,rs,rt SUBtract Unsigned word
  87. XOR rd,rs,rt eXclusive OR
  88. XORI rt,rs,immediate eXclusive OR Immediate
  89.  
  90. ****************************************************************************
  91. ** Jump and Branch Instructions **
  92. ****************************************************************************
  93. BEQ rs,rt,offset Branch on EQual
  94. BEQL rs,rt,offset Branch on EQual Likely
  95. BGEZ rs,offset Branch on Greater than or Equal to Zero
  96. BGEZAL rs,offset Branch on Greater than or Equal to Zero And Link
  97. BGEZALL rs,offset Branch on Greater than or Equal to Zero And Link Likely
  98. BGEZL rs,offset Branch on Greater than or Equal to Zero Likely
  99. BGTZ rs,offset Branch on Greater than Zero
  100. BGTZL rs,offset Branch on Greater than Zero Likely
  101. BLEZ rs,offset Branch on Less than or Equal to Zero
  102. BLEZL rs,offset Branch on Less than or Equal to Zero Likely
  103. BLTZ rs,offset Branch on Less than Zero
  104. BLTZAL rs,offset Branch on Less than Zero And Link
  105. BLTZALL rs,offset Branch on Less than Zero And Link Likely
  106. BLTZL rs,offset Branch on Less than Zero Likely
  107. BNE rs,rt,offset Branch on Not Equal
  108. BNEL rs,rt,offset Branch on Not Equal Likely
  109. J target Jump
  110. JAL target Jump And Link
  111. JALR rs,rd Jump And Link Register
  112. JR rs Jump Register
  113.  
  114. ****************************************************************************
  115. ** Special Instructions **
  116. ****************************************************************************
  117. BREAK offset BREAKpoint
  118. SYSCALL offset SYStem CALL
  119.  
  120. ****************************************************************************
  121. ** Exception Instructions **
  122. ****************************************************************************
  123. TEQ rs,rt Trap if EQual
  124. TEQI rs,immediate Trap if EQual Immediate
  125. TGE rs,rt Trap if Greater Than or Equal
  126. TGEI rs,immediate Trap if Greater Than or Equal Immediate
  127. TGEIU rs,immediate Trap if Greater Than or Equal Immediate Unsigned
  128. TGEU rs,rt Trap if Greater Than or Equal Unsigned
  129. TLT rs,rt Trap if Less Than
  130. TLTI rs,immediate Trap if Less Than Immediate
  131. TLTIU rs,immediate Trap if Less Than Immediate Unsigned
  132. TLTU rs,rt Trap if Less Than Unsigned
  133. TNE rs,rt Trap if not Equal
  134. TNEI rs,immediate Trap if not Equal Immediate
  135.  
  136. ****************************************************************************
  137. ** System Control Processor (COP0) Instructions **
  138. ****************************************************************************
  139. CACHE op,offset(base) CACHE
  140. DMFC0 rt,fs Doubleword Move From CP0
  141. DMTC0 rt,fs Doubleword Move To CP0
  142. ERET Return from Exception
  143. MFC0 rt,fs Move Word From CP0
  144. MTC0 rt,fs Move Word To CP0
  145. TLBP Probe TLB for Matching Entry
  146. TLBR Read Indexed TLB Entry
  147. TLBWI Write Indexed TLB Entry
  148. TLBWR Write Random TLB Entry
  149.  
  150. ****************************************************************************
  151. ** Floating-point Unit (COP1) instructions **
  152. ****************************************************************************
  153. ABS.fmt fd,fs floating-point ABSolute value
  154. ADD.fmt fd,fs,ft floating-point ADD
  155. BC1F offset Branch on FP False
  156. BC1FL offset Branch on FP False Likely
  157. BC1T offset Branch on FP True
  158. BC1TL offset Branch on FP True Likely
  159. C.cond.fmt fs,ft floating-point floating point Compare
  160. CEIL.L.fmt fd,fs floating-point CEILing convert to Long fixed-point
  161. CEIL.W.fmt fd,fs floating-point CEILing convert to Word fixed-point
  162. CFC1 rt,fs Move control word From Floating-Point
  163. CTC1 rt,fs Move control word To Floating-Point
  164. CVT.D.fmt fd,fs floating-point ConVerT to Double floating-point
  165. CVT.L.fmt fd,fs floating-point ConVerT to Long fixed-point
  166. CVT.S.fmt fd,fs floating-point ConVerT to Single floating-point
  167. CVT.W.fmt fd,fs floating-point ConVerT to Word fixed-point
  168. DIV.fmt fd,fs,ft floating-point DIVide
  169. DMFC1 rt,fs Doubleword Move From Floating-Point
  170. DMTC1 rt,fs Doubleword Move To Floating-Point
  171. FLOOR.L.fmt fd,fs floating-point FLOOR convert to Long fixed-point
  172. FLOOR.W.fmt fd,fs floating-point FLOOR convert to Word fixed-point
  173. LDC1 rt,offset(base) Load Doubleword to Floating-Point
  174. LWC1 rt,offset(base) Load Word to Floating-Point
  175. MFC1 rt,fs Move Word From Floating-Point
  176. MOV.fmt fd,fs floating-point MOVe
  177. MTC1 rt,fs Move Word To Floating-Point
  178. MUL.fmt fd,fs,ft floating-point MULtiply
  179. NEG.fmt fd,fs floating-point NEGate
  180. ROUND.L.fmt fd,fs floating-point ROUND to Long fixed-point
  181. ROUND.W.fmt fd,fs floating-point ROUND to Word fixed-point
  182. SDC1 rt,offset(base) Store Doubleword from Floating-Point
  183. SQRT.fmt fd,fs floating-point SQuare RooT
  184. SUB.fmt fd,fs,ft floating-point SUBtract
  185. SWC1 rt,offset(base) Store Word from Floating-Point
  186. TRUNC.L.fmt fd,fs floating-point TRUNCate to Long fixed-point
  187. TRUNC.W.fmt fd,fs floating-point TRUNCate to Word fixed-point
  188.  
  189. Part B: Detailed list released on 98-02-19
  190. ----------------------------------------------------------------------------
  191.  
  192.  
  193. I need information/answers about the following:
  194.  
  195. * Info about COP1 registers.
  196. * Information about COP2!!! instructions, anything!!
  197. * How do i correctly decode address of 26-bit Jump instructions (J, JAL) ?
  198. * How do i correctly decode address of 16-bit Branch instructions?
  199.  
  200. If you can help, please mail me at [email protected]
  201. ----------------------------------------------------------------------------
  202.  
  203. COP0 registers:
  204. ---------------
  205. 00h = Index 08h = BadVAddr 10h = Config 18h = *RESERVED*
  206. 01h = Random 09h = Count 11h = LLAddr 19h = *RESERVED*
  207. 02h = EntryLo0 0Ah = EntryHi 12h = WatchLo 1Ah = PErr
  208. 03h = EntryLo1 0Bh = Compare 13h = WatchHi 1Bh = CacheErr
  209. 04h = Context 0Ch = Status 14h = XContext 1Ch = TagLo
  210. 05h = PageMask 0Dh = Cause 15h = *RESERVED* 1Dh = TagHi
  211. 06h = Wired 0Eh = EPC 16h = *RESERVED* 1Eh = ErrorEPC
  212. 07h = *RESERVED* 0Fh = PRevID 17h = *RESERVED* 1Fh = *RESERVED*
  213.  
  214. Main CPU registers:
  215. -------------------
  216. 00h = r0/reg0 08h = t0/reg8 10h = s0/reg16 18h = t8/reg24
  217. 01h = at/reg1 09h = t1/reg9 11h = s1/reg17 19h = t9/reg25
  218. 02h = v0/reg2 0Ah = t2/reg10 12h = s2/reg18 1Ah = k0/reg26
  219. 03h = v1/reg3 0Bh = t3/reg11 13h = s3/reg19 1Bh = k1/reg27
  220. 04h = a0/reg4 0Ch = t4/reg12 14h = s4/reg20 1Ch = gp/reg28
  221. 05h = a1/reg5 0Dh = t5/reg13 15h = s5/reg21 1Dh = sp/reg29
  222. 06h = a2/reg6 0Eh = t6/reg14 16h = s6/reg22 1Eh = s8/reg30
  223. 07h = a3/reg7 0Fh = t7/reg15 17h = s7/reg23 1Fh = ra/reg31
  224.  
  225. ****************************************************************************
  226. ** Load and Store Instructions **
  227. ****************************************************************************
  228. -----------------------------------------------------------------
  229. | LB | Load Byte |
  230. |-----------|---------------------------------------------------|
  231. |100000 (32)| base | rt | offset |
  232. ------6----------5---------5-------------------16----------------
  233. Format: LBU rt, offset(base)
  234. Purpose: To load a byte from memory as a signed value.
  235. Descrip: rt = byte[base+offset]
  236.  
  237. -----------------------------------------------------------------
  238. | LBU | Load Byte Unsigned |
  239. |-----------|---------------------------------------------------|
  240. |100100 (36)| base | rt | offset |
  241. ------6----------5---------5-------------------16----------------
  242. Format: LBU rt, offset(base)
  243. Purpose: To load a byte from memory as an unsigned value.
  244. Descrip: rt = byte[base+offset]
  245.  
  246. -----------------------------------------------------------------
  247. | LD | Load Doubleword |
  248. |-----------|---------------------------------------------------|
  249. |110111 (55)| base | rt | offset |
  250. ------6----------5---------5-------------------16----------------
  251. Format: LD rt, offset(base)
  252. Purpose: To load a doubleword from memory.
  253. Descrip: rt = doubleword[base+offset]
  254.  
  255. -----------------------------------------------------------------
  256. | LDL | Load Doubleword Left |
  257. |-----------|---------------------------------------------------|
  258. |011010 (26)| base | rt | offset |
  259. ------6----------5---------5-------------------16----------------
  260. Format: LDL rt, offset(base)
  261. Purpose: To load the most-significant part of a doubleword from
  262. an unaligned memory address.
  263. Descrip: left(rt) = right[base+offset]
  264.  
  265. -----------------------------------------------------------------
  266. | LDR | Load Doubleword Right |
  267. |-----------|---------------------------------------------------|
  268. |011011 (27)| base | rt | offset |
  269. ------6----------5---------5-------------------16----------------
  270. Format: LDR rt, offset(base)
  271. Purpose: To load the least-significant part of a doubleword from
  272. an unaligned memory address.
  273. Descrip: right(rt) = left[base+offset]
  274.  
  275. -----------------------------------------------------------------
  276. | LH | Load Halfword |
  277. |-----------|---------------------------------------------------|
  278. |100001 (33)| base | rt | offset |
  279. ------6----------5---------5-------------------16----------------
  280. Format: LH rt, offset(base)
  281. Purpose: To load a halfword from memory as a signed value.
  282. Descrip: rt = halfword[base+offset]
  283.  
  284. -----------------------------------------------------------------
  285. | LHU | Load Halfword Unsigned |
  286. |-----------|---------------------------------------------------|
  287. |100101 (37)| base | rt | offset |
  288. ------6----------5---------5-------------------16----------------
  289. Format: LHU rt, offset(base)
  290. Purpose: To load a halfword from memory as an unsigned value.
  291. Descrip: rt = halfword[base+offset]
  292.  
  293. -----------------------------------------------------------------
  294. | LL | Load Linked Word |
  295. |-----------|---------------------------------------------------|
  296. |110000 (48)| base | rt | offset |
  297. ------6----------5---------5-------------------16----------------
  298. Format: LL rt, offset(base)
  299. Purpose: To load a word from memory for an atomic read-modify-write.
  300.  
  301. -----------------------------------------------------------------
  302. | LLD | Load Linked Doubleword |
  303. |-----------|---------------------------------------------------|
  304. |110100 (52)| base | rt | offset |
  305. ------6----------5---------5-------------------16----------------
  306. Format: LLD rt, offset(base)
  307. Purpose: To load a doubleword from memory for an atomic read-modify-write.
  308.  
  309. -----------------------------------------------------------------
  310. | LW | Load Word |
  311. |-----------|---------------------------------------------------|
  312. |100011 (35)| base | rt | offset |
  313. ------6----------5---------5-------------------16----------------
  314. Format: LW rt, offset(base)
  315. Purpose: To load a word from memory as a signed value.
  316. Descrip: rt = word[base+offset]
  317.  
  318. -----------------------------------------------------------------
  319. | LWL | Load Word Left |
  320. |-----------|---------------------------------------------------|
  321. |100010 (34)| base | rt | offset |
  322. ------6----------5---------5-------------------16----------------
  323. Format: LWL rt, offset(base)
  324. Purpose: To load the most-significant part of a word as a
  325. signed value from an unaligned memory address.
  326. Descrip: left(rt) = right[base+offset]
  327.  
  328. -----------------------------------------------------------------
  329. | LWR | Load Word Right |
  330. |-----------|---------------------------------------------------|
  331. |100110 (38)| base | rt | offset |
  332. ------6----------5---------5-------------------16----------------
  333. Format: LWR rt, offset(base)
  334. Purpose: To load the least-significant part of a word from an
  335. unaligned memory address as a signed value.
  336. Descrip: right(rt) = left[base+offset]
  337.  
  338. -----------------------------------------------------------------
  339. | LWU | Load Word Unsigned |
  340. |-----------|---------------------------------------------------|
  341. |100111 (39)| base | rt | offset |
  342. ------6----------5---------5-------------------16----------------
  343. Format: LWU rt, offset(base)
  344. Purpose: To load a word from memory as an unsigned value.
  345. Descrip: rt = word[base+offset]
  346.  
  347. -----------------------------------------------------------------
  348. | SB | Store Byte |
  349. |-----------|---------------------------------------------------|
  350. |101000 (40)| base | rt | offset |
  351. ------6----------5---------5-------------------16----------------
  352. Format: SB rt, offset(base)
  353. Purpose: To store a byte to memory.
  354. Descrip: byte[base+offset] = rt
  355.  
  356. -----------------------------------------------------------------
  357. | SC | Store Conditional Word |
  358. |-----------|---------------------------------------------------|
  359. |111000 (56)| base | rt | offset |
  360. ------6----------5---------5-------------------16----------------
  361. Format: SC rt, offset(base)
  362. Purpose: To store a word to memory to complete an atomic read-modify-write.
  363.  
  364. -----------------------------------------------------------------
  365. | SCD | Store Conditional Doubleword |
  366. |-----------|---------------------------------------------------|
  367. |111100 (60)| base | rt | offset |
  368. ------6----------5---------5-------------------16----------------
  369. Format: SCD rt, offset(base)
  370. Purpose: To store a doubleword to memory to complete an atomic
  371. read-modify-write.
  372.  
  373. -----------------------------------------------------------------
  374. | SD | Store Doubleword |
  375. |-----------|---------------------------------------------------|
  376. |111111 (63)| base | rt | offset |
  377. ------6----------5---------5-------------------16----------------
  378. Format: SD rt, offset(base)
  379. Purpose: To store a doubleword to memory.
  380. Descrip: doulbeword[base+offset] = rt
  381.  
  382. -----------------------------------------------------------------
  383. | SDL | Store Doubleword Left |
  384. |-----------|---------------------------------------------------|
  385. |101100 (44)| base | rt | offset |
  386. ------6----------5---------5-------------------16----------------
  387. Format: SDL rt, offset(base)
  388. Purpose: To store the most-significant part of a doubleword to
  389. an unaligned memory address.
  390. Descrip: right[base+offset] = left(rt)
  391.  
  392. -----------------------------------------------------------------
  393. | SDR | Store Doubleword Right |
  394. |-----------|---------------------------------------------------|
  395. |101101 (45)| base | rt | offset |
  396. ------6----------5---------5-------------------16----------------
  397. Format: SDR rt, offset(base)
  398. Purpose: To store the least-significant part of a doubleword to
  399. an unaligned memory address.
  400. Descrip: left[base+offset] = right(rt)
  401.  
  402. -----------------------------------------------------------------
  403. | SH | Store Halfword |
  404. |-----------|---------------------------------------------------|
  405. |101001 (41)| base | rt | offset |
  406. ------6----------5---------5-------------------16----------------
  407. Format: SH rt, offset(base)
  408. Purpose: To store a halfword to memory.
  409. Descrip: halfword[base+offset] = rt
  410.  
  411. -----------------------------------------------------------------
  412. | SW | Store Word |
  413. |-----------|---------------------------------------------------|
  414. |101011 (43)| base | rt | offset |
  415. ------6----------5---------5-------------------16----------------
  416. Format: SW rt, offset(base)
  417. Purpose: To store a word to memory.
  418. Descrip: word[base+offset] = rt
  419.  
  420. -----------------------------------------------------------------
  421. | SWL | Store Word Left |
  422. |-----------|---------------------------------------------------|
  423. |101010 (42)| base | rt | offset |
  424. ------6----------5---------5-------------------16----------------
  425. Format: SWL rt, offset(base)
  426. Purpose: To store the most-significant part of a word to an
  427. unaligned memory address.
  428. Descrip: right[base+offset] = left(rt)
  429.  
  430. -----------------------------------------------------------------
  431. | SWR | Store Word Right |
  432. |-----------|---------------------------------------------------|
  433. |101110 (46)| base | rt | offset |
  434. ------6----------5---------5-------------------16----------------
  435. Format: SWR rt, offset(base)
  436. Purpose: To store the least-significant part of a word to an
  437. unaligned memory address.
  438. Descrip: left[base+offset] = right(rt)
  439.  
  440. -----------------------------------------------------------------
  441. | SYNC | SYNChronize shared memory |
  442. |-----------|---------------------------------------------------|
  443. | 000000 | 0000 0000 0000 000 | stype |001111 (15)|
  444. ------6-------------------15-------------------5---------6-------
  445. Format: SYNC (stype = 0 implied)
  446. Purpose: To order loads and stores to shared memory in a
  447. multiprocessor system.
  448.  
  449.  
  450. ****************************************************************************
  451. ** Atithmetic Instructions **
  452. ****************************************************************************
  453. -----------------------------------------------------------------
  454. | ADD | ADD word |
  455. |-----------|---------------------------------------------------|
  456. | 000000 | rs | rt | rd | 00000 |100000 (32)|
  457. ------6----------5---------5---------5---------5----------6------
  458. Format: ADD rd, rs, rt
  459. Purpose: To add 32-bit integers. If overflow occurs, then trap.
  460. Descrip: rd = rs + rt
  461.  
  462. -----------------------------------------------------------------
  463. | ADDI | ADD Immediate word |
  464. |-----------|---------------------------------------------------|
  465. |001000 (8) | rs | rt | immediate |
  466. ------6----------5---------5-------------------16----------------
  467. Format: ADDI rt, rs, immediate
  468. Purpose: To add a constant to a 32-bit integer.
  469. If overflow occurs, then trap.
  470. Descrip: rt = rs + immediate
  471.  
  472. -----------------------------------------------------------------
  473. | ADDIU | ADD Immediate Unsigned word |
  474. |-----------|---------------------------------------------------|
  475. |001001 (9) | rs | rt | immediate |
  476. ------6----------5---------5-------------------16----------------
  477. Format: ADDIU rt, rs, immediate
  478. Purpose: To add a constant to a 32-bit integer.
  479. Descrip: rt = rs + immediate
  480.  
  481. -----------------------------------------------------------------
  482. | ADDU | ADD Unsigned word |
  483. |-----------|---------------------------------------------------|
  484. | 000000 | rs | rt | rd | 00000 |100001 (33)|
  485. ------6----------5---------5---------5---------5----------6------
  486. Format: ADDU rd, rs, rt
  487. Purpose: To add 32-bit integers.
  488. Descrip: rd = rs + rt
  489.  
  490. -----------------------------------------------------------------
  491. | AND | AND |
  492. |-----------|---------------------------------------------------|
  493. | 000000 | rs | rt | rd | 00000 |100100 (36)|
  494. ------6----------5---------5---------5---------5----------6------
  495. Format: AND rd, rs, rt
  496. Purpose: To do a bitwise logical AND.
  497. Descrip: rd = (rs AND rt)
  498.  
  499. -----------------------------------------------------------------
  500. | ANDI | AND Immediate |
  501. |-----------|---------------------------------------------------|
  502. |001100 (12)| rs | rt | immediate |
  503. ------6----------5---------5-------------------16----------------
  504. Format: ANDI rt, rs, immediate
  505. Purpose: To do a bitwise logical AND with a constant.
  506. Descrip: rd = (rs AND immediate)
  507.  
  508. -----------------------------------------------------------------
  509. | DADD | Doubleword ADD |
  510. |-----------|---------------------------------------------------|
  511. | 000000 | rs | rt | rd | 00000 |101100 (44)|
  512. ------6----------5---------5---------5---------5----------6------
  513. Format: DADD rd, rs, rt
  514. Purpose: To add 64-bit integers. If overflow occurs, then trap.
  515. Descrip: rd = rs + rt
  516.  
  517. -----------------------------------------------------------------
  518. | DADDI | Doubleword ADD Immediate |
  519. |-----------|---------------------------------------------------|
  520. |011000 (24)| rs | rt | immediate |
  521. ------6----------5---------5-------------------16----------------
  522. Format: DADDI rt, rs, immediate
  523. Purpose: To add a constant to a 64-bit integer.
  524. If overflow occurs, then trap.
  525. Descrip: rt = rs + immediate
  526.  
  527. -----------------------------------------------------------------
  528. | DADDIU | Doubleword ADD Immediate Unsigned |
  529. |-----------|---------------------------------------------------|
  530. |011001 (25)| rs | rt | immediate |
  531. ------6----------5---------5-------------------16----------------
  532. Format: DADDIU rt, rs, immediate
  533. Purpose: To add a constant to a 64-bit integer.
  534. Descrip: rt = rs + immediate
  535.  
  536. -----------------------------------------------------------------
  537. | DADDU | Doubleword ADD Unsigned |
  538. |-----------|---------------------------------------------------|
  539. | 000000 | rs | rt | rd | 00000 |101101 (45)|
  540. ------6----------5---------5---------5---------5----------6------
  541. Format: DADDU rd, rs, rt
  542. Purpose: To add 64-bit integers.
  543. Descrip: rd = rs + rt
  544.  
  545. -----------------------------------------------------------------
  546. | DDIV | Doubleword DIVide |
  547. |-----------|---------------------------------------------------|
  548. | 000000 | rs | rt | 0000 0000 00 |011110 (30)|
  549. ------6----------5---------5--------------10--------------6------
  550. Format: DDIV rs, rt
  551. Purpose: To divide 64-bit signed integers.
  552. Descrip: LO = rs / rt; HI = rs MOD rt
  553.  
  554. -----------------------------------------------------------------
  555. | DDIVU | Doubleword DIVide Unsigned |
  556. |-----------|---------------------------------------------------|
  557. | 000000 | rs | rt | 0000 0000 00 |011111 (31)|
  558. ------6----------5---------5--------------10--------------6------
  559. Format: DDIVU rs, rt
  560. Purpose: To divide 64-bit unsigned integers.
  561. Descrip: LO = rs / rt; HI = rs MOD rt
  562.  
  563. -----------------------------------------------------------------
  564. | DIV | DIVide word |
  565. |-----------|---------------------------------------------------|
  566. | 000000 | rs | rt | 0000 0000 00 |011010 (26)|
  567. ------6----------5---------5--------------10--------------6------
  568. Format: DIV rs, rt
  569. Purpose: To divide 32-bit signed integers.
  570. Descrip: LO = rs / rt; HI = rs MOD rt
  571.  
  572. -----------------------------------------------------------------
  573. | DIVU | DIVide Unsigned word |
  574. |-----------|---------------------------------------------------|
  575. | 000000 | rs | rt | 0000 0000 00 |011011 (27)|
  576. ------6----------5---------5--------------10--------------6------
  577. Format: DIVU rs, rt
  578. Purpose: To divide 32-bit unsigned integers.
  579. Descrip: LO = rs / rt; HI = rs MOD rt
  580.  
  581. -----------------------------------------------------------------
  582. | DMULT | Doubleword MULTiply |
  583. |-----------|---------------------------------------------------|
  584. | 000000 | rs | rt | 0000 0000 00 |011100 (28)|
  585. ------6----------5---------5--------------10--------------6------
  586. Format: DMULT rs, rt
  587. Purpose: To multiply 64-bit signed integers.
  588. Descrip: LO = low(rs*rt); HI = high(rs*rt)
  589.  
  590. -----------------------------------------------------------------
  591. | DMULTU | Doubleword MULTiply Unsigned |
  592. |-----------|---------------------------------------------------|
  593. | 000000 | rs | rt | 0000 0000 00 |011101 (28)|
  594. ------6----------5---------5--------------10--------------6------
  595. Format: DMULTU rs, rt
  596. Purpose: To multiply 64-bit unsigned integers.
  597. Descrip: LO = low(rs*rt); HI = high(rs*rt)
  598.  
  599. -----------------------------------------------------------------
  600. | DSLL | Doubleword Shift Left Logical |
  601. |-----------|---------------------------------------------------|
  602. | 000000 | 00000 | rt | rd | sa |111000 (56)|
  603. ------6----------5---------5---------5---------5----------6------
  604. Format: DSLL rd, rt, sa
  605. Purpose: To left shift a doubleword by a fixed amount -- 0 to 31 bits.
  606. Descrip: rd = rt << sa
  607.  
  608. -----------------------------------------------------------------
  609. | DSLL32 | Doubleword Shift Left Logical +32 |
  610. |-----------|---------------------------------------------------|
  611. | 000000 | 00000 | rt | rd | sa |111100 (60)|
  612. ------6----------5---------5---------5---------5----------6------
  613. Format: DSLL32 rd, rt, sa
  614. Purpose: To left shift a doubleword by a fixed amount -- 32 to 63 bits.
  615. Descrip: rd = rt << (sa+32)
  616.  
  617. -----------------------------------------------------------------
  618. | DSLLV | Doubleword Shift Left Logical Variable |
  619. |-----------|---------------------------------------------------|
  620. | 000000 | rs | rt | rd | 00000 |010100 (20)|
  621. ------6----------5---------5---------5---------5----------6------
  622. Format: DSLLV rd, rt, rs
  623. Purpose: To left shift a doubleword by a variable number of bits.
  624. Descrip: rd = rt << rs
  625.  
  626. -----------------------------------------------------------------
  627. | DSRA | Doubleword Shift Right Arithmetic |
  628. |-----------|---------------------------------------------------|
  629. | 000000 | 00000 | rt | rd | sa |111011 (59)|
  630. ------6----------5---------5---------5---------5----------6------
  631. Format: DSRA rd, rt, sa
  632. Purpose: To arithmetic right shift a doubleword by a fixed
  633. amount -- 0 to 31 bits.
  634. Descrip: rd = rt >> sa
  635.  
  636. -----------------------------------------------------------------
  637. | DSRA32 | Doubleword Shift Right Arithmetic +32 |
  638. |-----------|---------------------------------------------------|
  639. | 000000 | 00000 | rt | rd | sa |111111 (63)|
  640. ------6----------5---------5---------5---------5----------6------
  641. Format: DSRA32 rd, rt, sa
  642. Purpose: To arithmetic right shift a doubleword by a fixed
  643. amount -- 32-63 bits.
  644. Descrip: rd = rt >> (sa+32)
  645.  
  646. -----------------------------------------------------------------
  647. | DSRAV | Doubleword Shift Right Arithmetic Variable |
  648. |-----------|---------------------------------------------------|
  649. | 000000 | 00000 | rt | rd | sa |010111 (23)|
  650. ------6----------5---------5---------5---------5----------6------
  651. Format: DSRAV rd, rt, rs
  652. Purpose: To arithmetic right shift a doubleword by a variable
  653. number of bits.
  654. Descrip: rd = rt >> sa
  655.  
  656. -----------------------------------------------------------------
  657. | DSRL | Doubleword Shift Right Logical |
  658. |-----------|---------------------------------------------------|
  659. | 000000 | 00000 | rt | rd | sa |111010 (58)|
  660. ------6----------5---------5---------5---------5----------6------
  661. Format: DSRL rd, rt, sa
  662. Purpose: To logical right shift a doubleword by a fixed amount
  663. -- 0 to 31 bits.
  664. Descrip: rd = rt >> sa
  665.  
  666. -----------------------------------------------------------------
  667. | DSRL32 | Doubleword Shift Right Logical +32 |
  668. |-----------|---------------------------------------------------|
  669. | 000000 | 00000 | rt | rd | sa |111110 (62)|
  670. ------6----------5---------5---------5---------5----------6------
  671. Format: DSRL32 rd, rt, sa
  672. Purpose: To logical right shift a doubleword by a fixed amount
  673. -- 32 to 63 bits.
  674. Descrip: rd = rt >> (sa+32)
  675.  
  676. -----------------------------------------------------------------
  677. | DSRLV | Doubleword Shift Right Logical Variable |
  678. |-----------|---------------------------------------------------|
  679. | 000000 | 00000 | rt | rd | sa |010110 (22)|
  680. ------6----------5---------5---------5---------5----------6------
  681. Format: DSRLV rd, rt, rs
  682. Purpose: To logical right shift a doubleword by a variable number of bits.
  683. Descrip: rd = rt >> sa
  684.  
  685. -----------------------------------------------------------------
  686. | DSUB | Doubleword SUBtract |
  687. |-----------|---------------------------------------------------|
  688. | 000000 | rs | rt | rd | 00000 |101110 (46)|
  689. ------6----------5---------5---------5---------5----------6------
  690. Format: DSUB rd, rs, rt
  691. Purpose: To subtract 64-bit integers; trap if overflow.
  692. Descrip: rd = rs - rt
  693.  
  694. -----------------------------------------------------------------
  695. | DSUBU | Doubleword SUBtract Unsigned |
  696. |-----------|---------------------------------------------------|
  697. | 000000 | rs | rt | rd | 00000 |101111 (47)|
  698. ------6----------5---------5---------5---------5----------6------
  699. Format: DSUBU rd, rs, rt
  700. Purpose: To subtract 64-bit integers.
  701. Descrip: rd = rs - rt
  702.  
  703. -----------------------------------------------------------------
  704. | LUI | Load Upper Immediate |
  705. |-----------|---------------------------------------------------|
  706. |001111 (15)| 00000 | rt | immediate |
  707. ------6----------5---------5-------------------16----------------
  708. Format: LUI rt, immediate
  709. Purpose: To load a constant into the upper half of a word.
  710. Descrip: rt = immediate * 10000h
  711.  
  712. -----------------------------------------------------------------
  713. | MFHI | Move From HI register |
  714. |-----------|---------------------------------------------------|
  715. | 000000 | 0000 0000 00 | rd | 00000 |010000 (16)|
  716. ------6---------------10-------------5---------5----------6------
  717. Format: MFHI rd
  718. Purpose: To copy the special purpose HI register to a GPR.
  719. Descrip: rd = HI
  720.  
  721. -----------------------------------------------------------------
  722. | MFLO | Move From LO register |
  723. |-----------|---------------------------------------------------|
  724. | 000000 | 0000 0000 00 | rd | 00000 |010010 (18)|
  725. ------6---------------10-------------5---------5----------6------
  726. Format: MFLO rd
  727. Purpose: To copy the special purpose LO register to a GPR.
  728. Descrip: rd = LO
  729.  
  730. -----------------------------------------------------------------
  731. | MTHI | Move To HI register |
  732. |-----------|---------------------------------------------------|
  733. | 000000 | rs | 0000 0000 0000 000 |010001 (17)|
  734. ------6----------5------------------15--------------------6------
  735. Format: MTHI rs
  736. Purpose: To copy a GPR to the special purpose HI register.
  737.  
  738. -----------------------------------------------------------------
  739. | MTLO | Move To LO register |
  740. |-----------|---------------------------------------------------|
  741. | 000000 | rs | 0000 0000 0000 000 |010011 (19)|
  742. ------6----------5------------------15--------------------6------
  743. Format: MTLO rs
  744. Purpose: To copy a GPR to the special purpose LO register.
  745.  
  746. -----------------------------------------------------------------
  747. | MULT | MULTiply word |
  748. |-----------|---------------------------------------------------|
  749. | 000000 | rs | rt | 0000 0000 00 |011000 (24)|
  750. ------6----------5---------5--------------10--------------6------
  751. Format: MULT rs, rt
  752. Purpose: To multiply 32-bit signed integers.
  753. Descrip: LO = low(rs*rt); HI = high(rs*rt)
  754.  
  755. -----------------------------------------------------------------
  756. | MULTU | MULTiply Unsigned word |
  757. |-----------|---------------------------------------------------|
  758. | 000000 | rs | rt | 0000 0000 00 |011001 (25)|
  759. ------6----------5---------5--------------10--------------6------
  760. Format: MULTU rs, rt
  761. Purpose: To multiply 32-bit unsigned integers.
  762. Descrip: LO = low(rs*rt); HI = high(rs*rt)
  763.  
  764. -----------------------------------------------------------------
  765. | NOR | Not OR |
  766. |-----------|---------------------------------------------------|
  767. | 000000 | rs | rt | rd | 00000 |100111 (39)|
  768. ------6----------5---------5---------5---------5----------6------
  769. Format: NOR rd, rs, rt
  770. Purpose: To do a bitwise logical NOT OR.
  771. Descrip: rd = (rs NOR rt)
  772.  
  773. -----------------------------------------------------------------
  774. | OR | OR |
  775. |-----------|---------------------------------------------------|
  776. | 000000 | rs | rt | rd | 00000 |100101 (37)|
  777. ------6----------5---------5---------5---------5----------6------
  778. Format: OR rd, rs, rt
  779. Purpose: To do a bitwise logical OR.
  780. Descrip: rd = (rs OR rt)
  781.  
  782. -----------------------------------------------------------------
  783. | ORI | OR Immediate |
  784. |-----------|---------------------------------------------------|
  785. |001101 (13)| rs | rt | immediate |
  786. ------6----------5---------5-------------------16----------------
  787. Format: ORI rt, rs, immediate
  788. Purpose: To do a bitwise logical OR with a constant.
  789. Descrip: rt = (rs NOR immediate)
  790.  
  791. -----------------------------------------------------------------
  792. | SLL | Shift word Left Logical |
  793. |-----------|---------------------------------------------------|
  794. | 000000 | 00000 | rt | rd | sa |000000 (0) |
  795. ------6----------5---------5---------5---------5----------6------
  796. Format: SLL rd, rt, sa
  797. Purpose: To left shift a word by a fixed number of bits.
  798. Comment: SLL r0, r0, r0 is equal to a NOP (No OPeration)
  799. Descrip: rd = rt << sa
  800.  
  801. -----------------------------------------------------------------
  802. | SLLV | Shift word Left Logical Variable |
  803. |-----------|---------------------------------------------------|
  804. | 000000 | rs | rt | rd | 00000 |000100 (4) |
  805. ------6----------5---------5---------5---------5----------6------
  806. Format: SLLV rd, rt, rs
  807. Purpose: To left shift a word by a variable number of bits.
  808. Descrip: rd = rt << sa
  809.  
  810. -----------------------------------------------------------------
  811. | SLT | Set on Less Than |
  812. |-----------|---------------------------------------------------|
  813. | 000000 | rs | rt | rd | 00000 |101010 (42)|
  814. ------6----------5---------5---------5---------5----------6------
  815. Format: SLT rd, rs, rt
  816. Purpose: To record the result of a less-than comparison.
  817. Descrip: if rs < rt then rd = 1 else rd = 0
  818.  
  819. -----------------------------------------------------------------
  820. | SLTI | Set on Less Than Immediate |
  821. |-----------|---------------------------------------------------|
  822. |001010 (10)| rs | rt | immediate |
  823. ------6----------5---------5-------------------16----------------
  824. Format: SLTI rt, rs, immediate
  825. Purpose: To record the result of a less-than comparison with a constant.
  826. Descrip: if rs < immediate then rd = 1 else rd = 0
  827.  
  828. -----------------------------------------------------------------
  829. | SLTIU | Set on Less Than Immediate Unsigned |
  830. |-----------|---------------------------------------------------|
  831. |001011 (11)| rs | rt | immediate |
  832. ------6----------5---------5-------------------16----------------
  833. Format: SLTIU rt, rs, immediate
  834. Purpose: To record the result of an unsigned less-than
  835. comparison with a constant.
  836. Descrip: if rs < immediate then rd = 1 else rd = 0
  837.  
  838. -----------------------------------------------------------------
  839. | SLTU | Set on Less Than Unsigned |
  840. |-----------|---------------------------------------------------|
  841. | 000000 | rs | rt | rd | 00000 |101011 (43)|
  842. ------6----------5---------5---------5---------5----------6------
  843. Format: SLTU rd, rs, rt
  844. Purpose: To record the result of an unsigned less-than comparison.
  845. Descrip: if rs < rt then rd = 1 else rd = 0
  846.  
  847. -----------------------------------------------------------------
  848. | SRA | Shift word Right Arithmetic |
  849. |-----------|---------------------------------------------------|
  850. | 000000 | 00000 | rt | rd | sa |000011 (3) |
  851. ------6----------5---------5---------5---------5----------6------
  852. Format: SRA rd, rt, sa
  853. Purpose: To arithmetic right shift a word by a fixed number of bits.
  854. Descrip: rd = rt >> sa
  855.  
  856. -----------------------------------------------------------------
  857. | SRAV | Shift word Right Arithmetic Variable |
  858. |-----------|---------------------------------------------------|
  859. | 000000 | rs | rt | rd | 00000 |000111 (7) |
  860. ------6----------5---------5---------5---------5----------6------
  861. Format: SRAV rd, rt, rs
  862. Purpose: To arithmetic right shift a word by a variable number of bits.
  863. Descrip: rd = rt >> rs
  864.  
  865. -----------------------------------------------------------------
  866. | SRL | Shift word Right Logical |
  867. |-----------|---------------------------------------------------|
  868. | 000000 | 00000 | rt | rd | sa |000010 (2) |
  869. ------6----------5---------5---------5---------5----------6------
  870. Format: SRL rd, rt, sa
  871. Purpose: To logical right shift a word by a fixed number of bits.
  872. Descrip: rd = rt >> sa
  873.  
  874. -----------------------------------------------------------------
  875. | SRLV | Shift word Right Logical Variable |
  876. |-----------|---------------------------------------------------|
  877. | 000000 | rs | rt | rd | 00000 |000110 (6) |
  878. ------6----------5---------5---------5---------5----------6------
  879. Format: SRLV rd, rt, rs
  880. Purpose: To logical right shift a word by a variable number of bits.
  881. Descrip: rd = rt >> rs
  882.  
  883. -----------------------------------------------------------------
  884. | SUB | SUBtract word |
  885. |-----------|---------------------------------------------------|
  886. | 000000 | rs | rt | rd | 00000 |100010 (34)|
  887. ------6----------5---------5---------5---------5----------6------
  888. Format: SUB rd, rs, rt
  889. Purpose: To subtract 32-bit integers. If overflow occurs, then trap.
  890. Descrip: rd = rs - rt
  891.  
  892. -----------------------------------------------------------------
  893. | SUBU | SUBtract Unsigned word |
  894. |-----------|---------------------------------------------------|
  895. | 000000 | rs | rt | rd | 00000 |100011 (35)|
  896. ------6----------5---------5---------5---------5----------6------
  897. Format: SUBU rd, rs, rt
  898. Purpose: To subtract 32-bit integers. No trap on overflow.
  899. Descrip: rd = rs - rt
  900.  
  901. -----------------------------------------------------------------
  902. | XOR | eXclusive OR |
  903. |-----------|---------------------------------------------------|
  904. | 000000 | rs | rt | rd | 00000 |100110 (38)|
  905. ------6----------5---------5---------5---------5----------6------
  906. Format: XOR rd, rs, rt
  907. Purpose: To do a bitwise logical EXCLUSIVE OR.
  908. Descrip: rd = (rs XOR rt)
  909.  
  910. -----------------------------------------------------------------
  911. | XORI | eXclusive OR Immediate |
  912. |-----------|---------------------------------------------------|
  913. |001110 (14)| rs | rt | immediate |
  914. ------6----------5---------5-------------------16----------------
  915. Format: XORI rt, rs, immediate
  916. Purpose: To do a bitwise logical EXCLUSIVE OR with a constant.
  917. Descrip: rd = (rs XOR immediate)
  918.  
  919.  
  920. ****************************************************************************
  921. ** Jump and Branch Instructions **
  922. ****************************************************************************
  923. -----------------------------------------------------------------
  924. | BEQ | Branch on EQual |
  925. |-----------|---------------------------------------------------|
  926. |000100 (4) | rs | rt | offset |
  927. ------6----------5---------5-------------------16----------------
  928. Format: BEQ rs, rt, offset
  929. Purpose: To compare GPRs then do a PC-relative conditional branch.
  930. Descrip: branch if rs = rt
  931.  
  932. -----------------------------------------------------------------
  933. | BEQL | Branch on EQual Likley |
  934. |-----------|---------------------------------------------------|
  935. |010100 (20)| rs | rt | offset |
  936. ------6----------5---------5-------------------16----------------
  937. Format: BEQL rs, rt, offset
  938. Purpose: To compare GPRs then do a PC-relative conditional branch;
  939. execute the delay slot only if the branch is taken.
  940. Descrip: branch if rs = rt
  941.  
  942. -----------------------------------------------------------------
  943. | BGEZ | Branch on Greater than or Equal to Zero |
  944. |-----------|---------------------------------------------------|
  945. | 000001 | rs |00001 (1)| offset |
  946. ------6----------5---------5-------------------16----------------
  947. Format: BGEZ rs, offset
  948. Purpose: To test a GPR then do a PC-relative conditional branch.
  949. Descrip: branch if rs >= 0 (signed)
  950.  
  951. -----------------------------------------------------------------
  952. | BGEZAL | Branch on Greater than or Equal to Zero And Link |
  953. |-----------|---------------------------------------------------|
  954. | 000001 | rs |10001(17)| offset |
  955. ------6----------5---------5-------------------16----------------
  956. Format: BGEZAL rs, offset
  957. Purpose: To test a GPR then do a PC-relative conditional procedure call.
  958. Descrip: branch if rs >= 0 (signed) (return address in ra)
  959.  
  960. -----------------------------------------------------------------
  961. | BGEZALL | Branch on Greater than or Equal to Zero And Link Likley
  962. |-----------|---------------------------------------------------|
  963. | 000001 | rs |10011(19)| offset |
  964. ------6----------5---------5-------------------16----------------
  965. Format: BGEZALL rs, offset
  966. Purpose: To test a GPR then do a PC-relative conditional procedure call;
  967. execute the delay slot only if the branch is taken.
  968. Descrip: branch if rs >= 0 (signed) (return address in ra)
  969.  
  970. -----------------------------------------------------------------
  971. | BGEZL | Branch on Greater than or Equal to Zero Likley |
  972. |-----------|---------------------------------------------------|
  973. | 000001 | rs |00011 (3)| offset |
  974. ------6----------5---------5-------------------16----------------
  975. Format: BGEZL rs, offset
  976. Purpose: To test a GPR then do a PC-relative conditional branch;
  977. execute the delay slot only if the branch is taken.
  978. Descrip: branch if rs >= 0 (signed)
  979.  
  980. -----------------------------------------------------------------
  981. | BGTZ | Branch on Greater than Zero |
  982. |-----------|---------------------------------------------------|
  983. |000111 (7) | rs | 00000 | offset |
  984. ------6----------5---------5-------------------16----------------
  985. Format: BGTZ rs, offset
  986. Purpose: To test a GPR then do a PC-relative conditional branch.
  987. Descrip: branch if rs > 0 (signed)
  988.  
  989. -----------------------------------------------------------------
  990. | BGTZL | Branch on Greater Than Zero Likley |
  991. |-----------|---------------------------------------------------|
  992. |010111 (23)| rs | 00000 | offset |
  993. ------6----------5---------5-------------------16----------------
  994. Format: BGTZL rs, offset
  995. Purpose: To test a GPR then do a PC-relative conditional branch;
  996. execute the delay slot only if the branch is taken.
  997. Descrip: branch if rs > 0 (signed)
  998.  
  999. -----------------------------------------------------------------
  1000. | BLEZ | Branch on Less than or Equal to Zero |
  1001. |-----------|---------------------------------------------------|
  1002. |000110 (6) | rs | 00000 | offset |
  1003. ------6----------5---------5-------------------16----------------
  1004. Format: BLEZ rs, offset
  1005. Purpose: To test a GPR then do a PC-relative conditional branch.
  1006. Descrip: branch if rs <= 0 (signed)
  1007.  
  1008. -----------------------------------------------------------------
  1009. | BLEZL | Branch on Less than or Equal to Zero Likley |
  1010. |-----------|---------------------------------------------------|
  1011. |010110 (22)| rs | 00000 | offset |
  1012. ------6----------5---------5-------------------16----------------
  1013. Format: BLEZL rs, offset
  1014. Purpose: To test a GPR then do a PC-relative conditional branch;
  1015. execute the delay slot only if the branch is taken.
  1016. Descrip: branch if rs <= 0 (signed)
  1017.  
  1018. -----------------------------------------------------------------
  1019. | BLTZ | Branch on Less Than Zero |
  1020. |-----------|---------------------------------------------------|
  1021. | 000001 | rs | 00000 | offset |
  1022. ------6----------5---------5-------------------16----------------
  1023. Format: BLTZ rs, offset
  1024. Purpose: To test a GPR then do a PC-relative conditional branch.
  1025. Descrip: branch if rs < 0 (signed)
  1026.  
  1027. -----------------------------------------------------------------
  1028. | BLTZAL | Branch on Less Than Zero And Link |
  1029. |-----------|---------------------------------------------------|
  1030. | 000001 | rs | 10000 | offset |
  1031. ------6----------5---------5-------------------16----------------
  1032. Format: BLTZAL rs, offset
  1033. Purpose: To test a GPR then do a PC-relative conditional procedure call.
  1034. Descrip: branch if rs < 0 (signed) (return address in ra)
  1035.  
  1036. -----------------------------------------------------------------
  1037. | BLTZALL | Branch on Less Than Zero And Link Likley |
  1038. |-----------|---------------------------------------------------|
  1039. | 000001 | rs | 10010 | offset |
  1040. ------6----------5---------5-------------------16----------------
  1041. Format: BLTZALL rs, offset
  1042. Purpose: To test a GPR then do a PC-relative conditional procedure
  1043. call; execute the delay slot only if the branch is taken.
  1044. Descrip: branch if rs < 0 (signed) (return address in ra)
  1045.  
  1046. -----------------------------------------------------------------
  1047. | BLTZL | Branch on Less Than Zero Likley |
  1048. |-----------|---------------------------------------------------|
  1049. | 000001 | rs |00010 (2)| offset |
  1050. ------6----------5---------5-------------------16----------------
  1051. Format: BLTZL rs, offset
  1052. Purpose: To test a GPR then do a PC-relative conditional branch;
  1053. execute the delay slot only if the branch is taken.
  1054. Descrip: branch if rs < 0 (signed)
  1055.  
  1056. -----------------------------------------------------------------
  1057. | BNE | Branch on Not Equal |
  1058. |-----------|---------------------------------------------------|
  1059. |000101 (5) | rs | rt | offset |
  1060. ------6----------5---------5-------------------16----------------
  1061. Format: BNE rs, rt, offset
  1062. Purpose: To compare GPRs then do a PC-relative conditional branch.
  1063. Descrip: branch if rs <> rt
  1064.  
  1065. -----------------------------------------------------------------
  1066. | BNEL | Branch on Not Equal Likley |
  1067. |-----------|---------------------------------------------------|
  1068. |010101 (21)| rs | rt | offset |
  1069. ------6----------5---------5-------------------16----------------
  1070. Format: BNEL rs, rt, offset
  1071. Purpose: To compare GPRs then do a PC-relative conditional branch;
  1072. execute the delay slot only if the branch is taken.
  1073. Descrip: branch if rs <> rt
  1074.  
  1075. -----------------------------------------------------------------
  1076. | J | Jump |
  1077. |-----------|---------------------------------------------------|
  1078. |000010 (2) | instr_index |
  1079. ------6-------------------------------26-------------------------
  1080. Format: J target
  1081. Purpose: To branch within the current 256 MB aligned region.
  1082.  
  1083. -----------------------------------------------------------------
  1084. | JAL | Jump And Link |
  1085. |-----------|---------------------------------------------------|
  1086. |000011 (3) | instr_index |
  1087. ------6-------------------------------26-------------------------
  1088. Format: JAL target
  1089. Purpose: To procedure call within the current 256 MB aligned region.
  1090. Descrip: return address in ra
  1091.  
  1092. -----------------------------------------------------------------
  1093. | JALR | Jump And Link Register |
  1094. |-----------|---------------------------------------------------|
  1095. | 000000 | rs | 00000 | rd | 00000 |001001 (9) |
  1096. ------6----------5---------5---------5---------5----------6------
  1097. Format: JALR rs, rd
  1098. Purpose: To procedure call to an instruction address in a register.
  1099. Descrip: return address in rd
  1100.  
  1101. -----------------------------------------------------------------
  1102. | JR | Jump Register |
  1103. |-----------|---------------------------------------------------|
  1104. | 000000 | rs | 0000 0000 0000 000 |001000 (8) |
  1105. ------6----------5------------------15--------------------6------
  1106. Format: JR rs
  1107. Purpose: To branch to an instruction address in a register.
  1108.  
  1109.  
  1110. ****************************************************************************
  1111. ** Special instructions **
  1112. ****************************************************************************
  1113. -----------------------------------------------------------------
  1114. | BREAK | BREAKpoint |
  1115. |-----------|---------------------------------------------------|
  1116. | 000000 | code |001101 (13)|
  1117. ------6--------------------------20-----------------------6------
  1118. Format: BREAK offset
  1119. Purpose: To cause a Breakpoint exception.
  1120.  
  1121. -----------------------------------------------------------------
  1122. | SYSCALL | SYStem CALL |
  1123. |-----------|---------------------------------------------------|
  1124. | 000000 | code |001100 (12)|
  1125. ------6--------------------------20-----------------------6------
  1126. Format: SYSCALL offset
  1127. Purpose: To cause a System Call exception.
  1128.  
  1129.  
  1130. ****************************************************************************
  1131. ** Exception Instructions **
  1132. ****************************************************************************
  1133. -----------------------------------------------------------------
  1134. | TEQ | Trap if EQual |
  1135. |-----------|---------------------------------------------------|
  1136. | 000000 | rs | rt | code |110100 (52)|
  1137. ------6----------5---------5--------------10--------------6------
  1138. Format: TEQ rs, rt
  1139. Purpose: To compare GPRs and do a conditional Trap.
  1140. Descrip: if rs = rt then trap
  1141.  
  1142. -----------------------------------------------------------------
  1143. | TEQI | Trap if EQual Immediate |
  1144. |-----------|---------------------------------------------------|
  1145. | 000001 | rs |01100(12)| immediate |
  1146. ------6----------5---------5-------------------16----------------
  1147. Format: TEQI rs, immediate
  1148. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1149. Descrip: if rs = immediate then trap
  1150.  
  1151. -----------------------------------------------------------------
  1152. | TGE | Trap if Greater or Equal |
  1153. |-----------|---------------------------------------------------|
  1154. | 000000 | rs | rt | code |110000 (48)|
  1155. ------6----------5---------5--------------10--------------6------
  1156. Format: TGE rs, rt
  1157. Purpose: To compare GPRs and do a conditional Trap.
  1158. Descrip: if rs >= rt then trap
  1159.  
  1160. -----------------------------------------------------------------
  1161. | TGEI | Trap if Greater or Equal Immediate |
  1162. |-----------|---------------------------------------------------|
  1163. | 000001 | rs |01000 (8)| immediate |
  1164. ------6----------5---------5-------------------16----------------
  1165. Format: TGEI rs, immediate
  1166. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1167. Descrip: if rs >= immediate then trap
  1168.  
  1169. -----------------------------------------------------------------
  1170. | TGEIU | Trap if Greater or Equal Immediate Unsigned |
  1171. |-----------|---------------------------------------------------|
  1172. | 000001 | rs |01001 (9)| immediate |
  1173. ------6----------5---------5-------------------16----------------
  1174. Format: TGEIU rs, immediate
  1175. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1176. Descrip: if rs >= immediate then trap
  1177.  
  1178. -----------------------------------------------------------------
  1179. | TGEU | Trap if Greater or Equal Unsigned |
  1180. |-----------|---------------------------------------------------|
  1181. | 000000 | rs | rt | code |110001 (49)|
  1182. ------6----------5---------5--------------10--------------6------
  1183. Format: TGEU rs, rt
  1184. Purpose: To compare GPRs and do a conditional Trap.
  1185. Descrip: if rs >= rt then trap
  1186.  
  1187. -----------------------------------------------------------------
  1188. | TLT | Trap if Less Than |
  1189. |-----------|---------------------------------------------------|
  1190. | 000000 | rs | rt | code |110010 (50)|
  1191. ------6----------5---------5--------------10--------------6------
  1192. Format: TLT rs, rt
  1193. Purpose: To compare GPRs and do a conditional Trap.
  1194. Descrip: if rs < rt then trap
  1195.  
  1196. -----------------------------------------------------------------
  1197. | TLTI | Trap if Less Than Immediate |
  1198. |-----------|---------------------------------------------------|
  1199. | 000001 | rs |01010(10)| immediate |
  1200. ------6----------5---------5-------------------16----------------
  1201. Format: TLTI rs, immediate
  1202. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1203. Descrip: if rs < immediate then trap (signed)
  1204.  
  1205. -----------------------------------------------------------------
  1206. | TLTIU | Trap if Less Than Immediate Unsigned |
  1207. |-----------|---------------------------------------------------|
  1208. | 000001 | rs |01011(11)| immediate |
  1209. ------6----------5---------5-------------------16----------------
  1210. Format: TLTIU rs, immediate
  1211. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1212. Descrip: if rs < immediate then trap
  1213.  
  1214. -----------------------------------------------------------------
  1215. | TLTU | Trap if Less Than Unsigned |
  1216. |-----------|---------------------------------------------------|
  1217. | 000000 | rs | rt | code |110011 (51)|
  1218. ------6----------5---------5--------------10--------------6------
  1219. Format: TLTU rs, rt
  1220. Purpose: To compare GPRs and do a conditional Trap.
  1221. Descrip: if rs < rt then trap
  1222.  
  1223. -----------------------------------------------------------------
  1224. | TNE | Trap if Not Equal |
  1225. |-----------|---------------------------------------------------|
  1226. | 000000 | rs | rt | code |110110 (54)|
  1227. ------6----------5---------5--------------10--------------6------
  1228. Format: TNE rs, rt
  1229. Purpose: To compare GPRs and do a conditional Trap.
  1230. Descrip: if rs <> rt then trap
  1231.  
  1232. -----------------------------------------------------------------
  1233. | TNEI | Trap if Not Equal Immediate |
  1234. |-----------|---------------------------------------------------|
  1235. | 000001 | rs |01110(14)| immediate |
  1236. ------6----------5---------5-------------------16----------------
  1237. Format: TNEI rs, immediate
  1238. Purpose: To compare a GPR to a constant and do a conditional Trap.
  1239. Descrip: if rs <> immediate then trap
  1240.  
  1241. ****************************************************************************
  1242. ** System Control Processor (COP0) Instructions **
  1243. ****************************************************************************
  1244. -----------------------------------------------------------------
  1245. | CACHE | CACHE |
  1246. |-----------|---------------------------------------------------|
  1247. |101111 (47)| base | op | offset |
  1248. ------6----------5---------5-------------------16----------------
  1249. Format: CACHE op, offset(base)
  1250. Purpose: The 16-bit offset is sign-extended and added to the contents of
  1251. general register base to form a virtual address. The virtual
  1252. address is translated to a physical address using the TLB, and the
  1253. 5-bit sub-opcode specifies a cache operation for that address.
  1254.  
  1255. -----------------------------------------------------------------
  1256. | DMFC0 | Doubleword Move From CP0 |
  1257. |-----------|---------------------------------------------------|
  1258. | 010000 |00001 (1)| rt | fs | 0000 0000 000 |
  1259. ------6----------5---------5---------5--------------11-----------
  1260. Format: DMFC0 rt, rd
  1261. Purpose: To copy a doubleword from an FPR to a GPR.
  1262.  
  1263. -----------------------------------------------------------------
  1264. | DMTC0 | Doubleword Move To CP0 |
  1265. |-----------|---------------------------------------------------|
  1266. | 010000 |00101 (5)| rt | fs | 0000 0000 000 |
  1267. ------6----------5---------5---------5--------------11-----------
  1268. Format: DMTC0 rt, rd
  1269. Purpose: To copy a doubleword from a GPR to an FPR.
  1270.  
  1271. -----------------------------------------------------------------
  1272. | ERET | Return from Exception |
  1273. |-----------|---------------------------------------------------|
  1274. | 010000 |CO| 0000 0000 0000 0000 000 |011000 (24)|
  1275. ------6------1-------------------19-----------------------6------
  1276. Format: ERET
  1277. Purpose: ERET is the R4300 instruction for returning from an interrupt,
  1278. exception, or error trap. Unlike a branch or jump instruction,
  1279. ERET does not execute the next instruction.
  1280.  
  1281. -----------------------------------------------------------------
  1282. | MFC0 | Move word From CP0 |
  1283. |-----------|---------------------------------------------------|
  1284. | 010000 |00000 (0)| rt | fs | 0000 0000 000 |
  1285. ------6----------5---------5---------5--------------11-----------
  1286. Format: MFC0 rt, rd
  1287. Purpose: To copy a word from an FPU (CP1) general register to a GPR.
  1288. Descrip: rt = COP rd
  1289.  
  1290. -----------------------------------------------------------------
  1291. | MTC0 | Move word to CP0 |
  1292. |-----------|---------------------------------------------------|
  1293. | 010000 |00100 (4)| rt | fs | 0000 0000 000 |
  1294. ------6----------5---------5---------5--------------11-----------
  1295. Format: MTC0 rt, rd
  1296. Purpose: To copy a word from a GPR to an FPU (CP1) general register.
  1297. Descrip: COP rd = rt
  1298.  
  1299. -----------------------------------------------------------------
  1300. | TLBP | Translation Lookaside Buffer Probe |
  1301. |-----------|---------------------------------------------------|
  1302. | 010000 |CO| 0000 0000 0000 0000 000 | 001000 (8)|
  1303. ------6------1-------------------19-----------------------6------
  1304. Format: TLBP
  1305. Purpose: The Index register is loaded with the address of the TLB entry
  1306. whose contents match the contents of the EntryHi register. If no
  1307. TLB entry matches, the high-order bit of the Index register is set.
  1308. The architecture does not specify the operation of memory references
  1309. associated with the instruction immediately after a TLBP instruction,
  1310. nor is the operation specified if more than one TLB entry matches.
  1311.  
  1312. -----------------------------------------------------------------
  1313. | TLBR | Translation Lookaside Buffer Read |
  1314. |-----------|---------------------------------------------------|
  1315. | 010000 |CO| 0000 0000 0000 0000 000 | 000001 (1)|
  1316. ------6------1-------------------19-----------------------6------
  1317. Format: TLBR
  1318. Purpose: The G bit (which controls ASID matching) read from the TLB is
  1319. written into both of the EntryLo0 and EntryLo1 registers.
  1320. The EntryHi and EntryLo registers are loaded with the contents of
  1321. the TLB entry pointed at by the contents of the TLB Index register.
  1322. The operation is invalid (and the results are unspecified) if the
  1323. contents of the TLB Index register are greater than the number of
  1324. TLB entries in the processor.
  1325.  
  1326. -----------------------------------------------------------------
  1327. | TLBWI | Translation Lookaside Buffer Write Index |
  1328. |-----------|---------------------------------------------------|
  1329. | 010000 |CO| 0000 0000 0000 0000 000 | 000010 (2)|
  1330. ------6------1-------------------19-----------------------6------
  1331. Format: TLBWI
  1332. Purpose: The G bit of the TLB is written with the logical AND of the G bits
  1333. in the EntryLo0 and EntryLo1 registers. The TLB entry pointed at by
  1334. the contents of the TLB Index register is loaded with the contents
  1335. of the EntryHi and EntryLo registers. The operation is invalid (and
  1336. the results are unspecified) if the contents of the TLB Index
  1337. register are greater than the number of TLB entries in the processor.
  1338.  
  1339. -----------------------------------------------------------------
  1340. | TLBWR | Translation Lookaside Buffer Write Random |
  1341. |-----------|---------------------------------------------------|
  1342. | 010000 |CO| 0000 0000 0000 0000 000 | 000110 (6)|
  1343. ------6------1-------------------19-----------------------6------
  1344. Format: TLBWR
  1345. Purpose: The G bit of the TLB is written with the logical AND of the G bits
  1346. in the EntryLo0 and EntryLo1 registers. The TLB entry pointed at by
  1347. the contents of the TLB Random register is loaded with the contents
  1348. of the EntryHi and EntryLo registers.
  1349.  
  1350.  
  1351. ****************************************************************************
  1352. ** Floating-point Unit (COP1) instructions **
  1353. ****************************************************************************
  1354. fmt = 10000b (.S, Single) fmt = 10001b (.D, Double)
  1355. fmt = 10100b (.W, Word) fmt = 10101b (.L, Long)
  1356.  
  1357. -----------------------------------------------------------------
  1358. | ABS.fmt | floating-point ABSolute value |
  1359. |-----------|---------------------------------------------------|
  1360. | 010001 | fmt | 00000 | fs | fd | 000101 (5)|
  1361. ------6----------5---------5---------5---------5----------6------
  1362. Format: ABS.S fd, fs
  1363. ABS.D fd, fs
  1364. Purpose: To compute the absolute value of an FP value.
  1365.  
  1366. -----------------------------------------------------------------
  1367. | ADD.fmt | floating-point ADD |
  1368. |-----------|---------------------------------------------------|
  1369. | 010001 | fmt | ft | fs | fd | 000000 (0)|
  1370. ------6----------5---------5---------5---------5----------6------
  1371. Format: ADD.S fd, fs, ft
  1372. ADD.D fd, fs, ft
  1373. Purpose: To add FP values.
  1374.  
  1375. -----------------------------------------------------------------
  1376. | BC1F | Branch on FP False |
  1377. |-----------|---------------------------------------------------|
  1378. | 010001 |01000 (8)| cc |nd|tf| offset |
  1379. | | | | 0| 0| |
  1380. ------6----------5-------3---1--1--------------16----------------
  1381. Format: BC1F offset (cc = 0 implied)
  1382. BC1F cc, offset
  1383. Purpose: To test an FP condition code and do a PC-relative
  1384. conditional branch.
  1385.  
  1386. -----------------------------------------------------------------
  1387. | BC1FL | Branch on FP False Likley |
  1388. |-----------|---------------------------------------------------|
  1389. | 010001 |01000 (8)| cc |nd|tf| offset |
  1390. | | | | 1| 0| |
  1391. ------6----------5-------3---1--1--------------16----------------
  1392. Format: BC1FL offset (cc = 0 implied)
  1393. BC1FL cc, offset
  1394. Purpose: To test an FP condition code and do a PC-relative conditional
  1395. branch; execute the delay slot only if the branch is taken.
  1396.  
  1397. -----------------------------------------------------------------
  1398. | BC1T | Branch on FP True |
  1399. |-----------|---------------------------------------------------|
  1400. | 010001 |01000 (8)| cc |nd|tf| offset |
  1401. | | | | 0| 1| |
  1402. ------6----------5-------3---1--1--------------16----------------
  1403. Format: BC1T offset (cc = 0 implied)
  1404. BC1T cc, offset
  1405. Purpose: To test an FP condition code and do a PC-relative
  1406. conditional branch.
  1407.  
  1408. -----------------------------------------------------------------
  1409. | BC1TL | Branch on FP True Likley |
  1410. |-----------|---------------------------------------------------|
  1411. | 010001 |01000 (8)| cc |nd|tf| offset |
  1412. | | | | 1| 1| |
  1413. ------6----------5-------3---1--1--------------16----------------
  1414. Format: BC1TL offset (cc = 0 implied)
  1415. BC1TL cc, offset
  1416. Purpose: To test an FP condition code and do a PC-relative conditional
  1417. branch; execute the delay slot only if the branch is taken.
  1418.  
  1419. -----------------------------------------------------------------
  1420. | C.cond.fmt| floating-point Compare |
  1421. |-----------|---------------------------------------------------|
  1422. | 010001 | fmt | ft | fs | cc |00 |11 | cond |
  1423. ------6----------5---------5---------5-------3----2---2-----4----
  1424. cond: 0000 = F (False)
  1425. 0001 = UN (Unordered)
  1426. 0010 = EQ (Equal)
  1427. 0011 = UEQ (Unordered or Equal)
  1428. 0100 = OLT (Ordered or Less Than)
  1429. 0101 = ULT (Unordered or Less Than)
  1430. 0110 = OLE (Ordered or Less than or Equal)
  1431. 0111 = ULE (Unordered or Less than or Equal)
  1432. 1000 = SF (Signaling False)
  1433. 1001 = NGLE (Not Greater than or Less than or Equal)
  1434. 1010 = SEQ (Signaling Equal)
  1435. 1011 = NGL (Not Greater than or Less than)
  1436. 1100 = LT (Less Than)
  1437. 1101 = NGE (Not Greater than or Equal)
  1438. 1110 = LE (Less than or Equal)
  1439. 1111 = NGT (Not Greater Than)
  1440. Format: C.cond.S fs, ft
  1441. C.cond.D fs, ft
  1442. Purpose: To compare FP values and record the Boolean result in
  1443. a condition code.
  1444.  
  1445. -----------------------------------------------------------------
  1446. | CEIL.L.fmt| floating-point CEILing convert to Long fixed-point|
  1447. |-----------|---------------------------------------------------|
  1448. | 010001 | fmt | 00000 | fs | fd |001010 (10)|
  1449. ------6----------5---------5---------5---------5----------6------
  1450. Format: CEIL.L.S fd, fs
  1451. CEIL.L.D fd, fs
  1452. Purpose: To convert an FP value to 64-bit fixed-point, rounding up.
  1453.  
  1454. -----------------------------------------------------------------
  1455. | CEIL.W.fmt| floating-point CEILing convert to Word fixed-point|
  1456. |-----------|---------------------------------------------------|
  1457. | 010001 | fmt | 00000 | fs | fd |001110 (14)|
  1458. ------6----------5---------5---------5---------5----------6------
  1459. Format: CEIL.W.S fd, fs
  1460. CEIL.W.D fd, fs
  1461. Purpose: To convert an FP value to 32-bit fixed-point, rounding up.
  1462.  
  1463. -----------------------------------------------------------------
  1464. | CFC1 | Move control word From Floating-Point |
  1465. |-----------|---------------------------------------------------|
  1466. | 010001 |00010 (2)| rt | fs | 0000 0000 000 |
  1467. ------6----------5---------5---------5--------------11-----------
  1468. Format: CFC1 rt, fs
  1469. Purpose: To copy a word from an FPU control register to a GPR.
  1470. Descrip: rt = fs
  1471.  
  1472. -----------------------------------------------------------------
  1473. | CTC1 | Move control word To Floating-Point |
  1474. |-----------|---------------------------------------------------|
  1475. | 010001 |00110 (6)| rt | fs | 0000 0000 000 |
  1476. ------6----------5---------5---------5--------------11-----------
  1477. Format: CTC1 rt, fs
  1478. Purpose: To copy a word from a GPR to an FPU control register.
  1479. Descrip: fs = rt
  1480.  
  1481. -----------------------------------------------------------------
  1482. | CVT.D.fmt | floating-point ConVerT to Double floating-point |
  1483. |-----------|---------------------------------------------------|
  1484. | 010001 | fmt | 00000 | fs | fd |100001 (33)|
  1485. ------6----------5---------5---------5---------5----------6------
  1486. Format: CVT.D.S fd, fs
  1487. CVT.D.W fd, fs
  1488. CVT.D.L fd, fs
  1489. Purpose: To convert an FP or fixed-point value to double FP.
  1490.  
  1491. -----------------------------------------------------------------
  1492. | CVT.L.fmt | floating-point ConVerT to Long fixed-point |
  1493. |-----------|---------------------------------------------------|
  1494. | 010001 | fmt | 00000 | fs | fd |100101 (37)|
  1495. ------6----------5---------5---------5---------5----------6------
  1496. Format: CVT.L.S fd, fs
  1497. CVT.L.D fd, fs
  1498. Purpose: To convert an FP value to a 64-bit fixed-point.
  1499.  
  1500. -----------------------------------------------------------------
  1501. | CVT.S.fmt | floating-point ConVerT to Single floating-point |
  1502. |-----------|---------------------------------------------------|
  1503. | 010001 | fmt | 00000 | fs | fd |100000 (32)|
  1504. ------6----------5---------5---------5---------5----------6------
  1505. Format: CVT.S.D fd, fs
  1506. CVT.S.W fd, fs
  1507. CVT.S.L fd, fs
  1508. Purpose: To convert an FP or fixed-point value to single FP.
  1509.  
  1510. -----------------------------------------------------------------
  1511. | CVT.W.fmt | floating-point ConVerT to Word fixed-point |
  1512. |-----------|---------------------------------------------------|
  1513. | 010001 | fmt | 00000 | fs | fd |100100 (36)|
  1514. ------6----------5---------5---------5---------5----------6------
  1515. Format: CVT.W.S fd, fs
  1516. CVT.W.D fd, fs
  1517. Purpose: To convert an FP value to 32-bit fixed-point.
  1518.  
  1519. -----------------------------------------------------------------
  1520. | DIV.fmt | floating-point DIVide |
  1521. |-----------|---------------------------------------------------|
  1522. | 010001 | fmt | ft | fs | fd | 000011 (3)|
  1523. ------6----------5---------5---------5---------5----------6------
  1524. Format: DIV.S fd, fs, ft
  1525. DIV.D fd, fs, ft
  1526. Purpose: To divide FP values.
  1527.  
  1528. -----------------------------------------------------------------
  1529. | DMFC1 | Doubleword Move From Floating-Point |
  1530. |-----------|---------------------------------------------------|
  1531. | 010001 |00001 (1)| rt | fs | 0000 0000 000 |
  1532. ------6----------5---------5---------5--------------11-----------
  1533. Format: DMFC1 rt, fs
  1534. Purpose: To copy a doubleword from an FPR to a GPR.
  1535.  
  1536. -----------------------------------------------------------------
  1537. | DMTC1 | Doubleword Move To Floating-Point |
  1538. |-----------|---------------------------------------------------|
  1539. | 010001 |00101 (5)| rt | fs | 0000 0000 000 |
  1540. ------6----------5---------5---------5--------------11-----------
  1541. Format: DMTC1 rt, fs
  1542. Purpose: To copy a doubleword from a GPR to an FPR.
  1543.  
  1544. -----------------------------------------------------------------
  1545. |FLOOR.L.fmt| floating-point FLOOR convert to Long fixed-point |
  1546. |-----------|---------------------------------------------------|
  1547. | 010001 | fmt | 00000 | fs | fd |001011 (11)|
  1548. ------6----------5---------5---------5---------5----------6------
  1549. Format: FLOOR.L.S fd, fs
  1550. FLOOR.L.D fd, fs
  1551. Purpose: To convert an FP value to 64-bit fixed-point, rounding down.
  1552.  
  1553. -----------------------------------------------------------------
  1554. |FLOOR.W.fmt| floating-point FLOOR convert to Word fixed-point |
  1555. |-----------|---------------------------------------------------|
  1556. | 010001 | fmt | 00000 | fs | fd |001111 (15)|
  1557. ------6----------5---------5---------5---------5----------6------
  1558. Format: FLOOR.W.S fd, fs
  1559. FLOOR.W.D fd, fs
  1560. Purpose: To convert an FP value to 32-bit fixed-point, rounding down.
  1561.  
  1562. -----------------------------------------------------------------
  1563. | LDC1 | Load Doubleword to Floating-Point |
  1564. |-----------|---------------------------------------------------|
  1565. |110101 (53)| base | ft | offset |
  1566. ------6----------5---------5-------------------16----------------
  1567. Format: LDC1 ft, offset(base)
  1568. Purpose: To load a doubleword from memory to an FPR.
  1569. Descrip: COP ft = doubleword[base+offset]
  1570.  
  1571. -----------------------------------------------------------------
  1572. | LWC1 | Load Word to Floating-Point |
  1573. |-----------|---------------------------------------------------|
  1574. |110001 (49)| base | ft | offset |
  1575. ------6----------5---------5-------------------16----------------
  1576. Format: LWC1 ft, offset(base)
  1577. Purpose: To load a word from memory to an FPR.
  1578. Descrip: COP ft = word[base+offset]
  1579.  
  1580. -----------------------------------------------------------------
  1581. | MFC1 | Move Word From Floating-Point |
  1582. |-----------|---------------------------------------------------|
  1583. | 010001 |00000 (0)| rt | fs | 0000 0000 000 |
  1584. ------6----------5---------5---------5--------------11-----------
  1585. Format: MFC1 rt, fs
  1586. Purpose: To copy a word from an FPU (CP1) general register to a GPR.
  1587. Descrip: rt = COP fs
  1588.  
  1589. -----------------------------------------------------------------
  1590. | MOV.fmt | floating-point MOVe |
  1591. |-----------|---------------------------------------------------|
  1592. | 010001 | fmt | 00000 | fs | fd | 000110 (6)|
  1593. ------6----------5---------5---------5---------5----------6------
  1594. Format: MOV.S fd, fs
  1595. MOV.D fd, fs
  1596. Purpose: To move an FP value between FPRs.
  1597.  
  1598. -----------------------------------------------------------------
  1599. | MTC1 | Move Word to Floating-Point |
  1600. |-----------|---------------------------------------------------|
  1601. | 010001 |00100 (4)| rt | fs | 0000 0000 000 |
  1602. ------6----------5---------5---------5--------------11-----------
  1603. Format: MTC1 rt, fs
  1604. Purpose: To copy a word from a GPR to an FPU (CP1) general register.
  1605. Descrip: COP fs = rt
  1606.  
  1607. -----------------------------------------------------------------
  1608. | MUL.fmt | floating-point MULtiply |
  1609. |-----------|---------------------------------------------------|
  1610. | 010001 | fmt | ft | fs | fd | 000010 (2)|
  1611. ------6----------5---------5---------5---------5----------6------
  1612. Format: MUL.S fd, fs, ft
  1613. MUL.D fd, fs, ft
  1614. Purpose: To multiply FP values.
  1615.  
  1616. -----------------------------------------------------------------
  1617. | NEG.fmt | floating-point NEGate |
  1618. |-----------|---------------------------------------------------|
  1619. | 010001 | fmt | 00000 | fs | fd | 000111 (7)|
  1620. ------6----------5---------5---------5---------5----------6------
  1621. Format: NEG.S fd, fs
  1622. NEG.D fd, fs
  1623. Purpose: To negate an FP value.
  1624.  
  1625. -----------------------------------------------------------------
  1626. |ROUND.L.fmt| floating-point ROUND to Long fixed-point |
  1627. |-----------|---------------------------------------------------|
  1628. | 010001 | fmt | 00000 | fs | fd | 001000 (8)|
  1629. ------6----------5---------5---------5---------5----------6------
  1630. Format: ROUND.L.S fd, fs
  1631. ROUND.L.D fd, fs
  1632. Purpose: To convert an FP value to 64-bit fixed-point, rounding to nearest.
  1633.  
  1634. -----------------------------------------------------------------
  1635. |ROUND.W.fmt| floating-point ROUND to Word fixed-point |
  1636. |-----------|---------------------------------------------------|
  1637. | 010001 | fmt | 00000 | fs | fd |001100 (12)|
  1638. ------6----------5---------5---------5---------5----------6------
  1639. Format: ROUND.W.S fd, fs
  1640. ROUND.W.D fd, fs
  1641. Purpose: To convert an FP value to 32-bit fixed-point, rounding to nearest.
  1642.  
  1643. -----------------------------------------------------------------
  1644. | SDC1 | Store Doubleword from Floating-Point |
  1645. |-----------|---------------------------------------------------|
  1646. |111101 (61)| base | ft | offset |
  1647. ------6----------5---------5-------------------16----------------
  1648. Format: SDC1 ft, offset(base)
  1649. Purpose: To store a doubleword from an FPR to memory.
  1650. Descrip: doubleword[base+offset] = COP rt
  1651.  
  1652. -----------------------------------------------------------------
  1653. | SQRT.fmt | floating-point SQuare RooT |
  1654. |-----------|---------------------------------------------------|
  1655. | 010001 | fmt | 00000 | fs | fd | 000100 (4)|
  1656. ------6----------5---------5---------5---------5----------6------
  1657. Format: SQRT.S fd, fs
  1658. SQRT.D fd, fs
  1659. Purpose: To compute the square root of an FP value.
  1660.  
  1661. -----------------------------------------------------------------
  1662. | SUB.fmt | floating-point SUBtract |
  1663. |-----------|---------------------------------------------------|
  1664. | 010001 | fmt | ft | fs | fd | 000001 (1)|
  1665. ------6----------5---------5---------5---------5----------6------
  1666. Format: SUB.S fd, fs, ft
  1667. SUB.D fd, fs, ft
  1668. Purpose: To subtract FP values.
  1669.  
  1670. -----------------------------------------------------------------
  1671. | SWC1 | Store Word from Floating-Point |
  1672. |-----------|---------------------------------------------------|
  1673. |111001 (57)| base | ft | offset |
  1674. ------6----------5---------5-------------------16----------------
  1675. Format: SWC1 ft, offset(base)
  1676. Purpose: To store a word from an FPR to memory.
  1677. Descrip: word[base+offset] = COP rt
  1678.  
  1679. -----------------------------------------------------------------
  1680. |TRUNC.L.fmt| floating-point TRUNCate to Long fixed-point |
  1681. |-----------|---------------------------------------------------|
  1682. | 010001 | fmt | 00000 | fs | fd | 001001 (9)|
  1683. ------6----------5---------5---------5---------5----------6------
  1684. Format: TRUNC.L.S fd, fs
  1685. TRUNC.L.D fd, fs
  1686. Purpose: To convert an FP value to 64-bit fixed-point, rounding toward zero.
  1687.  
  1688. -----------------------------------------------------------------
  1689. |TRUNC.W.fmt| floating-point TRUNCate to Word fixed-point |
  1690. |-----------|---------------------------------------------------|
  1691. | 010001 | fmt | 00000 | fs | fd |001101 (13)|
  1692. ------6----------5---------5---------5---------5----------6------
  1693. Format: TRUNC.W.S fd, fs
  1694. TRUNC.W.D fd, fs
  1695. Purpose: To convert an FP value to 32-bit fixed-point, rounding toward zero.
  1696.  
  1697. ---------------------------------------------------------
  1698. Resources:
  1699.  
  1700. R4300i documentation from MIPS Technologies, Inc.
  1701. R4000 Instructions from Silicon Graphics
  1702. Project UnReality by Michael Tedder
  1703. Disa64 by TRILILI
  1704.  
  1705. Nintendo 64 opcodes v0.3 by anarko <[email protected]>
  1706.  
  1707. Part C: R4300 Command set released on 98-02-19
  1708. ----------------------------------------------------------------------------
  1709.  
  1710.  
  1711. ****************************************************************************
  1712. ** Main CPU **
  1713. ****************************************************************************
  1714.  
  1715. CPU: Instructions encoded by opcode field.
  1716. 31---------26---------------------------------------------------0
  1717. | opcode | |
  1718. ------6----------------------------------------------------------
  1719. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1720. 000 | *1 | *2 | J | JAL | BEQ | BNE | BLEZ | BGTZ |
  1721. 001 | ADDI | ADDIU | SLTI | SLTIU | ANDI | ORI | XORI | LUI |
  1722. 010 | *3 | *4 | *5 | | BEQL | BNEL | BLEZL | BGTZL |
  1723. 011 | DADDI |DADDIU | LDL | LDR | | | | |
  1724. 100 | LB | LH | LWL | LW | LBU | LHU | LWR | LWU |
  1725. 101 | SB | SH | SWL | SW | SDL | SDR | SWR | CACHE |
  1726. 110 | LL | LWC1 | LWC2 | | LLD | LDC1 | LDC2 | LD |
  1727. 111 | SC | SWC1 | SWC2 | | SCD | SDC1 | SDC2 | SD |
  1728. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1729. *1 = SPECIAL, see SPECIAL list *2 = REGIMM, see REGIMM list
  1730. *3 = COP0 *4 = COP1 *5 = COP2
  1731.  
  1732. SPECIAL: Instr. encoded by function field when opcode field = SPECIAL.
  1733. 31---------26------------------------------------------5--------0
  1734. | = SPECIAL | | function|
  1735. ------6----------------------------------------------------6-----
  1736. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1737. 000 | SLL | | SRL | SRA | SLLV | | SRLV | SRAV |
  1738. 001 | JR | JALR | | |SYSCALL| BREAK | | SYNC |
  1739. 010 | MFHI | MTHI | MFLO | MTLO | DSLLV | | DSRLV | DSRAV |
  1740. 011 | MULT | MULTU | DIV | DIVU | DMULT | DMULTU| DDIV | DDIVU |
  1741. 100 | ADD | ADDU | SUB | SUBU | AND | OR | XOR | NOR |
  1742. 101 | | | SLT | SLTU | DADD | DADDU | DSUB | DSUBU |
  1743. 110 | TGE | TGEU | TLT | TLTU | TEQ | | TNE | |
  1744. 111 | DSLL | | DSRL | DSRA |DSLL32 | |DSRL32 |DSRA32 |
  1745. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1746.  
  1747. REGIMM: Instructions encoded by the rt field when opcode field = REGIMM.
  1748. 31---------26----------20-------16------------------------------0
  1749. | = REGIMM | | rt | |
  1750. ------6---------------------5------------------------------------
  1751. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1752. 00 | BLTZ | BGEZ | BLTZL | BGEZL | | | | |
  1753. 01 | TGEI | TGEIU | TLTI | TLTIU | TEQI | | TNEI | |
  1754. 10 | BLTZAL| BGEZAL|BLTZALL|BGEZALL| | | | |
  1755. 11 | | | | | | | | |
  1756. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1757.  
  1758.  
  1759. ****************************************************************************
  1760. ** COP0 **
  1761. ****************************************************************************
  1762.  
  1763. COP0: Instructions encoded by the fmt field when opcode = COP0.
  1764. 31--------26-25------21 ----------------------------------------0
  1765. | = COP0 | fmt | |
  1766. ------6----------5-----------------------------------------------
  1767. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1768. 00 | MFC0 | DMFC0 | CFC0 | | MTC0 | DMTC0 | CTC0 | |
  1769. 01 | *1 | | | | | | | |
  1770. 10 | *2 | | | | | | | |
  1771. 11 | | | | | | | | |
  1772. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1773. *1 = BC instr, see BC0 list *2 = TLB instr, see TLB list
  1774.  
  1775. BC0: Instructions encoded by the nd and tf fields when opcode
  1776. = COP0 and fmt = BC.
  1777. 31--------26-25------21 ---17--16-------------------------------0
  1778. | = COP0 | = BC | |nd|tf| |
  1779. ------6----------5-----------1--1--------------------------------
  1780. |---0---|---1---| tf
  1781. 0 | BC0F | BC0T |
  1782. 1 | BC0FL | BC0TL |
  1783. nd |-------|-------|
  1784.  
  1785. TLB: Instructions encoded by the function field when opcode
  1786. = COP0 and fmt = TLB.
  1787. 31--------26-25------21 -------------------------------5--------0
  1788. | = COP0 | = TLB | | function|
  1789. ------6----------5-----------------------------------------6-----
  1790. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1791. 000 | | TLBR | TLBWI | | | | TLBWR | |
  1792. 001 | TLBP | | | | | | | |
  1793. 010 | | | | | | | | |
  1794. 011 | ERET | | | | | | | |
  1795. 100 | | | | | | | | |
  1796. 101 | | | | | | | | |
  1797. 110 | | | | | | | | |
  1798. 111 | | | | | | | | |
  1799. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1800.  
  1801.  
  1802. ****************************************************************************
  1803. ** COP1 - Floating Point Unit **
  1804. ****************************************************************************
  1805.  
  1806. COP1: Instructions encoded by the fmt field when opcode = COP1.
  1807. 31--------26-25------21 ----------------------------------------0
  1808. | = COP1 | fmt | |
  1809. ------6----------5-----------------------------------------------
  1810. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1811. 00 | MFC1 | DMFC1 | CFC1 | | MTC1 | DMTC1 | CTC1 | |
  1812. 01 | *1 | | | | | | | |
  1813. 10 | *2 | *3 | | | *4 | *5 | | |
  1814. 11 | | | | | | | | |
  1815. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1816. *1 = BC instructions, see BC1 list
  1817. *2 = S instr, see FPU list *3 = D instr, see FPU list
  1818. *4 = W instr, see FPU list *5 = L instr, see FPU list
  1819.  
  1820. BC1: Instructions encoded by the nd and tf fields when opcode
  1821. = COP1 and fmt = BC
  1822. 31--------26-25------21 ---17--16-------------------------------0
  1823. | = COP1 | = BC | |nd|tf| |
  1824. ------6----------5-----------1--1--------------------------------
  1825. |---0---|---1---| tf
  1826. 0 | BC1F | BC1T |
  1827. 1 | BC1FL | BC1TL |
  1828. nd |-------|-------|
  1829.  
  1830. FPU: Instructions encoded by the function field when opcode = COP1
  1831. and fmt = S, D, W or L
  1832. 31--------26-25------21 ----------------------------------------0
  1833. | = COP1 | = S | |
  1834. ------6----------5-----------------------------------------------
  1835. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1836. 000 | ADD | SUB | MUL | DIV | SQRT | ABS | MOV | NEG |
  1837. 001 |ROUND.L|TRUNC.L| CEIL.L|FLOOR.L|ROUND.W|TRUNC.W| CEIL.W|FLOOR.W|
  1838. 010 | | | | | | | | |
  1839. 011 | | | | | | | | |
  1840. 100 | | CVT.D | | | CVT.W | CVT.L | | |
  1841. 101 | | | | | | | | |
  1842. 110 | C.F | C.UN | C.EQ | C.UEQ | C.OLT | C.ULT | C.OLE | C.ULE |
  1843. 111 | C.SF | C.NGLE| C.SEQ | C.NGL | C.LT | C.NGE | C.LE | C.NGT |
  1844. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1845.  
  1846. 31--------26-25------21 ----------------------------------------0
  1847. | = COP1 | = D | |
  1848. ------6----------5-----------------------------------------------
  1849. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1850. 000 | ADD | SUB | MUL | DIV | SQRT | ABS | MOV | NEG |
  1851. 001 |ROUND.L|TRUNC.L| CEIL.L|FLOOR.L|ROUND.W|TRUNC.W| CEIL.W|FLOOR.W|
  1852. 010 | | | | | | | | |
  1853. 011 | | | | | | | | |
  1854. 100 | CVT.S | | | | CVT.W | CVT.L | | |
  1855. 101 | | | | | | | | |
  1856. 110 | C.F | C.UN | C.EQ | C.UEQ | C.OLT | C.ULT | C.OLE | C.ULE |
  1857. 111 | C.SF | C.NGLE| C.SEQ | C.NGL | C.LT | C.NGE | C.LE | C.NGT |
  1858. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1859.  
  1860. 31--------26-25------21 ----------------------------------------0
  1861. | = COP1 | = W, L | |
  1862. ------6----------5-----------------------------------------------
  1863. |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
  1864. 000 | | | | | | | | |
  1865. 001 | | | | | | | | |
  1866. 010 | | | | | | | | |
  1867. 011 | | | | | | | | |
  1868. 100 | CVT.S | CVT.D | | | | | | |
  1869. 101 | | | | | | | | |
  1870. 110 | | | | | | | | |
  1871. 111 | | | | | | | | |
  1872. hi |-------|-------|-------|-------|-------|-------|-------|-------|
  1873.  
  1874. Nintendo 64 opcodes v0.3 by anarko <[email protected]>
  1875.  
  1876. Part D: ROM header released on 98-02-19
  1877. ----------------------------------------------------------------------------
  1878.  
  1879.  
  1880. * Mr Backup Z64 (.BIN or .Z64 files) uses a Low/High byte format
  1881. (Little Endian), wich is the "correct" format to read from.
  1882.  
  1883. * Doctor V64 (.V64, .N64 or .U64 files) uses a High/Low byte format
  1884. (Big Endian), so each word are byte flipped, like this:
  1885. "ETTSNI G"
  1886. When it should look like this:
  1887. "TESTING "
  1888. To solve this, rotate the word to left/right by 8 bits.
  1889.  
  1890. ----------------------------------------------------------------------------
  1891. The addresses below is only valid for ROM's in Low/High
  1892. format, eg: Mr Backup Z64 ROM's. You have to byteswap Doctor
  1893. V64 ROM's before you can read data that makes any sense.
  1894. ----------------------------------------------------------------------------
  1895. 0000h - 0001h (1 word): 8037h
  1896. Can be used to validate ROM, if the word is
  1897. mirrored, it means that you have a byteswapped
  1898. ROM image to deal with.
  1899. 0002h (1 byte): Is ROM image compressed or not? (RTool standard)
  1900. 12h = Uncompressed
  1901. 13h = Compressed
  1902. 0003h - 0008h (5 bytes): 400000000Fh
  1903. 0008h - 000Ch (1 dword): Game address (also called Entry point)
  1904. I don't know what this is for, as the
  1905. Game code always starts at 1000h.
  1906. 000Ch - 000Fh (3 bytes): 000014h
  1907. 000Fh (1 byte): Don't know the meaning of this byte.
  1908. 44h (Darkrift, Fire demo)
  1909. 46h (Waverace64)
  1910. 48h (Bomber64, Duke64, TetPal)
  1911. 0010h - 0014h (1 dword): CRC1
  1912. 0014h - 0018h (1 dword): CRC2
  1913. 0018h - 001Fh (8 bytes): 0000000000000000h
  1914. 0020h - 0033h (20 bytes): Image name
  1915. Padded with 00h or spaces (20h)
  1916. 0034h - 003Ah (7 bytes): 00000000000000h
  1917. 003Bh (1 byte): Manufacturer ID
  1918. 4Eh 'N' = Nintendo
  1919. 003Ch - 003Dh (2 bytes): Cartridge ID
  1920. 003Eh (1 byte): Country code
  1921. 44h 'D' = Germany
  1922. 45h 'E' = USA
  1923. 4Ah 'J' = Japan
  1924. 50h 'P' = Europe
  1925. 55h 'U' = Australia (maybe)
  1926. 003Fh (1 byte): 00h
  1927. 0040h - 0FFFh (1008 dword): Boot code starts here.
  1928. Pretty much the same code on most of
  1929. the ROM's, Starfox64 differs.
  1930. 1000h (rest of file): Game code starts here.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement