Doc Bot

Download | Tutorials | Instruction Set | Hardware Reference
Introduction | About Doc Bot | Site Map | Search | Use License | Contact Us
Download
Screenshots
Table Of Contents | Addressing Modes | Memory Model | External Ports | Instruction Set | Hardware Reference | Turn Cycles | File format
Table Of Contents | Introduction | Types Of Memory | Special Function Registers | Basic Registers | Addressing Modes | Program Flow | Timers | External Ports | Interrupts | Power Control Modes | Hardware Components
Table Of Contents | Calculate Square Roots | Safe Division

Documentation

small logo

Program Flow Instructions

JMP (&|@|@R)op1
  • Opcode: 0x01
  • Addresses: 2
  • Flags: none
  • Registers: none
  • Function: Jump to op1

Unconditionally jumps to the memory address pointed to by op1.

JZ (#|&|@|R|@R)op1 (&|@|@R)op2
  • Opcode: 0x60
  • Addresses: 3
  • Flags: none
  • Registers: none
  • Function: Jump to op2 if op1 is zero

Jumps to the memory address pointed to by op2 if the value at op1 is 0x0000.

JNZ (#|&|@|R|@R)op1 (&|@|@R)op2
  • Opcode: 0x70
  • Addresses: 3
  • Flags: none
  • Registers: none
  • Function: Jump to op2 if op1 not zero

Jumps to the memory address pointed to by op2 if the value at op1 is not 0x0000.

DJNZ (#|&|@|R|@R)op1 (&|@|@R)op2
  • Opcode: 0xD5
  • Addresses: 3
  • Flags: none
  • Registers: none
  • Function: Decrement op1 and jump to op2 if not zero

Decrements the value of the memory address pointed to by op1. If the initial value was 0x0000, it will be set to 0xFFFF and the Carry Flag (C) will not be changed. If the new value at op1 is not 0x0000, jumps to the memory address pointed to by op2.

CJNE (#|&|@|R|@R)op1 (&|@|@R)op2
  • Opcode: 0xB4
  • Addresses: 3
  • Flags: C
  • Registers: none
  • Function: Compare op1 and CMP and jump to op2 if not equal

Compares the value of the memory address pointed to by op1 with the value of Comparison Register (CMP). If they are not equal, program execution jumps to the memory address pointed to by op2. If the value of CMP is less than the value of op1 the Carry Flag (C) is set, otherwise it is cleared.

CALL (&|@|@R)op1
  • Opcode: 0x12
  • Addresses: 2
  • Flags: none
  • Registers: SP, Stack
  • Function: Call subroutine at op1

Starts a subroutine by jumping to the memory address pointed to by op1 and pushing the memory address of the instruction following CALL to the stack.

RET
  • Opcode: 0x22
  • Addresses: 1
  • Flags: none
  • Registers: SP, Stack
  • Function: Return from subroutine

Returns from an subroutine by jumping to the memory address pointed to by the stack and removing that element from the stack. If the stack if empty, program execution ends with an abnormal termination.

RETI
  • Opcode: 0x32
  • Addresses: 1
  • Flags: IFS, IFP, IFH
  • Registers: SP, Stack
  • Function: Return from interrupt

Returns from an interrupt service routine by jumping to the memory address pointed to by the stack and removes that element from the stack. The Interrupt Status Flag (IFS) is set to the state of the Interrupt On Hold Flag (IFH). After that both the Interrupt On Hold Flag (IFH) and the Interrupt Priority Flag (IFP) are unconditionally cleared. If the stack if empty, program execution ends with an abnormal termination. RETI functions identically to RET if it is executed outside of an interrupt service routine, except that it copies the IFH to the IFS and clears both the IFH and the IFP (which should not be set anyway).

NOP
  • Opcode: 0x00
  • Addresses: 1
  • Flags: none
  • Registers: none
  • Function: No operation

No operation. Does nothing for one machine cycle.

See also:
JB | JNB | JBC

Introduction | About Doc Bot | Site Map | Search | Use License | Contact Us
©2009 Daniel Julivert