ff3:ff3us:doc:snes:opcode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
ff3:ff3us:doc:snes:opcode [2016/03/06 19:11]
hatzen08 created
ff3:ff3us:doc:snes:opcode [2022/09/20 16:28]
strotlog cmp long,X is length 4 (checked other references)
Line 68: Line 68:
 The STZ opcode will always store the value of zero in the designed memory address. Unlike the STA, STX and STY opcodes, the STZ opcode doesn't affect flags. It also doesn't affect the A or C register. The STZ opcode will always store the value of zero in the designed memory address. Unlike the STA, STX and STY opcodes, the STZ opcode doesn't affect flags. It also doesn't affect the A or C register.
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|   81      |STA (dp,X)        |                                   | +|   81      |STA (dp,X)          |                                   | 
-|   83      |STA sr,S          |                                   | +|   83      |STA sr,S            |                                   | 
-|   85      |STA dp            |                                   | +|   85      |STA dp              |                                   | 
-|   87      |STA [dp]          |                                   | +|   87      |STA [dp]            |                                   | 
-|   8D      |STA addr          |                                   | +|   8D      |STA addr            |                                   | 
-|   8F      |STA long          |                                   | +|   8F      |STA long            |                                   | 
-|   91      |STA (dp),       |                                   | +|   91      |STA (dp),         |                                   | 
-|   92      |STA (dp)          |                                   | +|   92      |STA (dp)            |                                   | 
-|   93      |STA (sr,S),     |                                   | +|   93      |STA (sr,S),       |                                   | 
-|   95      |STA dp,X          |                                   | +|   95      |STA dp,X            |                                   | 
-|   97      |STA [dp],       |                                   | +|   97      |STA [dp],         |                                   | 
-|   99      |STA addr,       |                                   | +|   99      |STA addr,         |                                   | 
-|   9D      |STA addr,       |                                   | +|   9D      |STA addr,         |                                   | 
-|   9F      |STA long,       |                                   |+|   9F      |STA long,         |                                   |
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|  86       |STX dp            |                                   | +|  86       |STX dp              |                                   | 
-|  8E       |STX addr          |                                   | +|  8E       |STX addr            |                                   | 
-|  96       |STX dp,Y          |                                   |+|  96       |STX dp,Y            |                                   |
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|  84       |STY dp            |                                   | +|  84       |STY dp              |                                   | 
-|  8C       |STY addr          |                                   | +|  8C       |STY addr            |                                   | 
-|  94       |STY dp,X          |                                   |+|  94       |STY dp,X            |                                   |
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|  64       |STZ dp            |                                   | +|  64       |STZ dp              |                                   | 
-|  74       |STZ dp,X          |                                   | +|  74       |STZ dp,X            |                                   | 
-|  9C       |STZ addr          |                                   | +|  9C       |STZ addr            |                                   | 
-|  9E       |STZ addr,       |                                   |+|  9E       |STZ addr,         |                                   |
  
 ===== TRB, TSB ===== ===== TRB, TSB =====
Line 104: Line 104:
 Test all bits in the A or C register. For all bits set in the A or C register, the correspondent bits will be set or unset in the designed memory address. TSB will set the correspondent bits and TRB will reset the correspondent bits. All clear bits in the A or C register will be ignored and their correspondent bits in the designed address will not be altered. Test all bits in the A or C register. For all bits set in the A or C register, the correspondent bits will be set or unset in the designed memory address. TSB will set the correspondent bits and TRB will reset the correspondent bits. All clear bits in the A or C register will be ignored and their correspondent bits in the designed address will not be altered.
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|  14       |TRB dp            |                                   | +|  14       |TRB dp              |                                   | 
-|  1C       |TRB addr          |                                   |+|  1C       |TRB addr            |                                   |
  
-^  Opcode   ^Syntax         ^ Bytes ^Notes                              | +^  Opcode   ^Syntax          Bytes  ^Notes                              | 
-|  04       |TSB dp            |                                   | +|  04       |TSB dp              |                                   | 
-|  0C       |TSB addr          |                                   |+|  0C       |TSB addr            |                                   |
  
 ===== ADC, SBC ===== ===== ADC, SBC =====
Line 116: Line 116:
 Add or subtract the value in the A or C register with the value in the designed memory address. ADC will add the value and SBC will subtract the value. Add or subtract the value in the A or C register with the value in the designed memory address. ADC will add the value and SBC will subtract the value.
  
-When the carry flag is set, a value of one will be added in the addition or subtraction operation.+When the carry flag is unset, a value of one will be added in the addition or subtraction operation.
  
 The operation can overflow or underflow. It is the coder responsibility to check these cases and adjust the resulting value. A common method is to check the carry flag for overflow or underflow and cap the value to a prefixed setting. The operation can overflow or underflow. It is the coder responsibility to check these cases and adjust the resulting value. A common method is to check the carry flag for overflow or underflow and cap the value to a prefixed setting.
Line 124: Line 124:
 |v set if signed overflow?                  | |v set if signed overflow?                  |
 |z set if result is zero                    | |z set if result is zero                    |
-|c set if overflow or underflow             |+|c set if not overflow or underflow         |
  
 ^  Opcode   ^Syntax         ^ Bytes ^Notes                              | ^  Opcode   ^Syntax         ^ Bytes ^Notes                              |
Line 251: Line 251:
 ===== BIT ===== ===== BIT =====
  
-Does a binary AND between the A or C register and the memory. Unlike the AND opcode, the binary AND operation only is done for the bits sets in the A or C register. All clear bits in the A or C register will be left clear after the operation.+Does a binary AND between the A or C register and the memory. Unlike the AND opcode, the binary AND operation doesn't alter the A or C register. 
  
 ^flags                                                  ^ ^flags                                                  ^
Line 289: Line 289:
 |   D9      |CMP addr,                                              | |   D9      |CMP addr,                                              |
 |   DD      |CMP addr,                                              | |   DD      |CMP addr,                                              |
-|   DF      |CMP long,        |                                       |+|   DF      |CMP long,        |                                       |
  
 ^  Opcode   ^Syntax         ^ Bytes ^Notes                                  | ^  Opcode   ^Syntax         ^ Bytes ^Notes                                  |
  • ff3/ff3us/doc/snes/opcode.txt
  • Last modified: 21 months ago
  • by strotlog