# Difference between revisions of "S1C88 InstructionSet"

From SublabWiki

(Starting to move to S1C88 naming) |
m |
||

Line 1: | Line 1: | ||

= 8-bit arithmetic and logic operation = | = 8-bit arithmetic and logic operation = | ||

− | == ''ADD'' Addition == | + | == '''ADD''': Addition == |

− | == ''ADC'' Addition with carry == | + | == '''ADC''': Addition with carry == |

− | == ''SUB'' Subtraction == | + | == '''SUB''': Subtraction == |

− | == ''SBC'' Subtraction with carry == | + | == '''SBC''': Subtraction with carry == |

− | == ''AND'' Logical product == | + | == '''AND''': Logical product == |

− | == ''OR'' Logical sum == | + | == '''OR''': Logical sum == |

− | == ''XOR'' Exclusive OR == | + | == '''XOR''': Exclusive OR == |

− | == ''CP'' Comparison == | + | == '''CP''': Comparison == |

− | == ''BIT'' Bit test == | + | == '''BIT''': Bit test == |

− | == ''INC'' 1 increment == | + | == '''INC''': 1 increment == |

− | == ''DEC'' 1 decrement == | + | == '''DEC''': 1 decrement == |

− | == ''MLT'' Multiplication == | + | == '''MLT''': Multiplication == |

− | == ''DIV'' Division == | + | == '''DIV''': Division == |

− | == ''CPL'' Complement of 1 == | + | == '''CPL''': Complement of 1 == |

− | == ''NEG'' Complement of 2 == | + | == '''NEG''': Complement of 2 == |

= 8-bit transfer = | = 8-bit transfer = | ||

− | == ''LD'' Load == | + | == '''LD''': Load == |

− | == ''EX'' Byte exchange == | + | == '''EX''': Byte exchange == |

− | == ''SWAP'' Nibble exchange == | + | == '''SWAP''': Nibble exchange == |

= Rotate/shift = | = Rotate/shift = | ||

− | == ''RL'' Rotate to left == | + | == '''RL''': Rotate to left == |

− | == ''RLC'' Rotate to left with carry == | + | == '''RLC''': Rotate to left with carry == |

− | == ''RR'' Rotate to right == | + | == '''RR''': Rotate to right == |

− | == ''RRC'' Rotate to right with carry == | + | == '''RRC''': Rotate to right with carry == |

− | == ''SLA'' Arithmetic shift to left == | + | == '''SLA''': Arithmetic shift to left == |

− | == ''SLL'' Logical shift to left == | + | == '''SLL''': Logical shift to left == |

− | == ''SRA'' Arithmetic shift to right == | + | == '''SRA''': Arithmetic shift to right == |

− | == ''SRL'' Logical shift to right == | + | == '''SRL''': Logical shift to right == |

= Auxiliary operation = | = Auxiliary operation = | ||

− | == ''PACK'' Pack == | + | == '''PACK''': Pack == |

− | == ''UPCK'' Unpack == | + | == '''UPCK''': Unpack == |

− | == ''SEP'' Code extension == | + | == '''SEP''': Code extension == |

= 16-bit arithmetic operation = | = 16-bit arithmetic operation = | ||

− | == ''ADD'' Addition == | + | == '''ADD''': Addition == |

− | == ''ADC'' Addition with carry == | + | == '''ADC''': Addition with carry == |

− | == ''SUB'' Subtraction == | + | == '''SUB''': Subtraction == |

− | == ''SBC'' Subtraction with carry == | + | == '''SBC''': Subtraction with carry == |

− | == ''CP'' Comparison == | + | == '''CP''': Comparison == |

− | == ''INC'' 1 increment == | + | == '''INC''': 1 increment == |

− | == ''DEC'' 1 decrement == | + | == '''DEC''': 1 decrement == |

= 16-bit transfer = | = 16-bit transfer = | ||

− | == ''LD'' Load == | + | == '''LD''': Load == |

− | == ''EX'' Word exchange == | + | == '''EX''': Word exchange == |

= Stack Control = | = Stack Control = | ||

− | == ''PUSH'' Push == | + | == '''PUSH''': Push == |

− | == ''POP'' Pop == | + | == '''POP''': Pop == |

= Branch = | = Branch = | ||

− | == ''JRS'' Relative short jump == | + | == '''JRS''': Relative short jump == |

− | == ''JRL'' Relative long jump == | + | == '''JRL''': Relative long jump == |

− | == ''JP'' Indirect jump == | + | == '''JP''': Indirect jump == |

− | == ''DJR'' Loop == | + | == '''DJR''': Loop == |

− | == ''CARS'' Relative short call == | + | == '''CARS''': Relative short call == |

− | == ''CARL'' Relative long call == | + | == '''CARL''': Relative long call == |

− | == ''CALL'' Indirect call == | + | == '''CALL''': Indirect call == |

− | == ''RET'' Return == | + | == '''RET''': Return == |

− | == ''RETE'' Exception processing return == | + | == '''RETE''': Exception processing return == |

− | == ''RETS'' Return and skip == | + | == '''RETS''': Return and skip == |

− | == ''INT'' Software interrupt == | + | == '''INT''': Software interrupt == |

= System Control = | = System Control = | ||

− | == ''NOP'' No operation == | + | == '''NOP''': No operation == |

− | == ''HALT'' Shifts to HALT status == | + | == '''HALT''': Shifts to HALT status == |

− | == ''SLP'' Shifts to SLEEP status == | + | == '''SLP''': Shifts to SLEEP status == |

= Illegal Instructions = | = Illegal Instructions = | ||

− | ''NOTE: This document is now out of date, as should be updated to the new mnemonic and register naming'' | + | '''NOTE: This document is now out of date, as should be updated to the new mnemonic and register naming''' |

The entire opcode table has been evaluated on Pokemon Mini units and new and exotic illegal opcodes have been found. | The entire opcode table has been evaluated on Pokemon Mini units and new and exotic illegal opcodes have been found. |

## Revision as of 00:29, 11 July 2015

## Contents

- 1 8-bit arithmetic and logic operation
- 1.1
**ADD**: Addition - 1.2
**ADC**: Addition with carry - 1.3
**SUB**: Subtraction - 1.4
**SBC**: Subtraction with carry - 1.5
**AND**: Logical product - 1.6
**OR**: Logical sum - 1.7
**XOR**: Exclusive OR - 1.8
**CP**: Comparison - 1.9
**BIT**: Bit test - 1.10
**INC**: 1 increment - 1.11
**DEC**: 1 decrement - 1.12
**MLT**: Multiplication - 1.13
**DIV**: Division - 1.14
**CPL**: Complement of 1 - 1.15
**NEG**: Complement of 2

- 1.1
- 2 8-bit transfer
- 3 Rotate/shift
- 4 Auxiliary operation
- 5 16-bit arithmetic operation
- 6 16-bit transfer
- 7 Stack Control
- 8 Branch
- 9 System Control
- 10 Illegal Instructions

# 8-bit arithmetic and logic operation

**ADD**: Addition

**ADC**: Addition with carry

**SUB**: Subtraction

**SBC**: Subtraction with carry

**AND**: Logical product

**OR**: Logical sum

**XOR**: Exclusive OR

**CP**: Comparison

**BIT**: Bit test

**INC**: 1 increment

**DEC**: 1 decrement

**MLT**: Multiplication

**DIV**: Division

**CPL**: Complement of 1

**NEG**: Complement of 2

# 8-bit transfer

**LD**: Load

**EX**: Byte exchange

**SWAP**: Nibble exchange

# Rotate/shift

**RL**: Rotate to left

**RLC**: Rotate to left with carry

**RR**: Rotate to right

**RRC**: Rotate to right with carry

**SLA**: Arithmetic shift to left

**SLL**: Logical shift to left

**SRA**: Arithmetic shift to right

**SRL**: Logical shift to right

# Auxiliary operation

**PACK**: Pack

**UPCK**: Unpack

**SEP**: Code extension

# 16-bit arithmetic operation

**ADD**: Addition

**ADC**: Addition with carry

**SUB**: Subtraction

**SBC**: Subtraction with carry

**CP**: Comparison

**INC**: 1 increment

**DEC**: 1 decrement

# 16-bit transfer

**LD**: Load

**EX**: Word exchange

# Stack Control

**PUSH**: Push

**POP**: Pop

# Branch

**JRS**: Relative short jump

**JRL**: Relative long jump

**JP**: Indirect jump

**DJR**: Loop

**CARS**: Relative short call

**CARL**: Relative long call

**CALL**: Indirect call

**RET**: Return

**RETE**: Exception processing return

**RETS**: Return and skip

**INT**: Software interrupt

# System Control

**NOP**: No operation

**HALT**: Shifts to HALT status

**SLP**: Shifts to SLEEP status

# Illegal Instructions

**NOTE: This document is now out of date, as should be updated to the new mnemonic and register naming**

The entire opcode table has been evaluated on Pokemon Mini units and new and exotic illegal opcodes have been found.

These opcodes are not officially supported (they are not used by commercial games and not even found in the Pokemon Channel emulator) and can produce random results or crashes in some cases. The illegal opcodes have been documented on this page's Discussion page.