| 
    Avr8bit-emulator
    
   An emulator for the Atmel AVR 8-bit microcontroller 
   | 
 
#include "branch.h"
Go to the source code of this file.
Functions | |
| void | rjmp (uint8_t k, struct CORE *core) | 
| Perform a relative jump.   | |
| void | ijmp (struct CORE *core) | 
| Perform an indirect jump.   | |
| void | jmp (uint32_t k, struct CORE *core) | 
| Perform an absolute jump.   | |
| void | rcall (uint8_t k, struct CORE *core, struct SRAM *sram) | 
| Perform a relative call to a subroutine.   | |
| void | icall (struct CORE *core, struct SRAM *sram) | 
| Perform an indirect call to a subroutine.   | |
| void | ret (struct CORE *core, struct SRAM *sram) | 
| Return from a subroutine.   | |
| void | reti (struct CORE *core, struct SRAM *sram) | 
| Return from an interrupt.   | |
| void | cpse (uint8_t d, uint8_t r, struct CORE *core) | 
| Compare and skip if equal.   | |
| void | cp (uint8_t d, uint8_t r, struct CORE *core) | 
| Compare two registers.   | |
| void | cpc (uint8_t d, uint8_t r, struct CORE *core) | 
| Compare two registers with carry.   | |
| void | cpi (uint8_t d, uint8_t K, struct CORE *core) | 
| Compare register with an immediate value.   | |
| void | sbrc (uint8_t r, uint8_t b, struct CORE *core) | 
| Skip if bit in register is cleared.   | |
| void | sbrs (uint8_t r, uint8_t b, struct CORE *core) | 
| Skip if bit in register is set.   | |
| void | sbic (uint8_t A, uint8_t b, struct CORE *core, union DATA_SPACE *data_space) | 
| Skip if bit in I/O register is cleared.   | |
| void | sbis (uint8_t A, uint8_t b, struct CORE *core, union DATA_SPACE *data_space) | 
| Skip if bit in I/O register is set.   | |
| void | brbs (uint8_t s, uint8_t k, struct CORE *core) | 
| Branch if status flag is set.   | |
| void | brbc (uint8_t s, uint8_t k, struct CORE *core) | 
| Branch if status flag is cleared.   | |
| void | breq (uint8_t k, struct CORE *core) | 
| Branch if equal.   | |
| void | brne (uint8_t k, struct CORE *core) | 
| Branch if not equal.   | |
| void | brcs (uint8_t k, struct CORE *core) | 
| Branch if carry set.   | |
| void | brcc (uint8_t k, struct CORE *core) | 
| Branch if carry cleared.   | |
| void | brsh (uint8_t k, struct CORE *core) | 
| Branch if same or higher.   | |
| void | brlo (uint8_t k, struct CORE *core) | 
| Branch if lower.   | |
| void | brmi (uint8_t k, struct CORE *core) | 
| Branch if minus.   | |
| void | brpl (uint8_t k, struct CORE *core) | 
| Branch if plus.   | |
| void | brge (uint8_t k, struct CORE *core) | 
| Branch if greater or equal.   | |
| void | brlt (uint8_t k, struct CORE *core) | 
| Branch if less than.   | |
| void | brhs (uint8_t k, struct CORE *core) | 
| Branch if half carry set.   | |
| void | brhc (uint8_t k, struct CORE *core) | 
| Branch if half carry cleared.   | |
| void | brts (uint8_t k, struct CORE *core) | 
| Branch if T flag set.   | |
| void | brtc (uint8_t k, struct CORE *core) | 
| Branch if T flag cleared.   | |
| void | brvs (uint8_t k, struct CORE *core) | 
| Branch if overflow set.   | |
| void | brvc (uint8_t k, struct CORE *core) | 
| Branch if overflow cleared.   | |
| void | brie (uint8_t k, struct CORE *core) | 
| Branch if interrupts enabled.   | |
| void | brid (uint8_t k, struct CORE *core) | 
| Branch if interrupts disabled.   | |
| void brbc | ( | uint8_t | s, | 
| uint8_t | k, | ||
| struct CORE * | core | ||
| ) | 
Branch if status flag is cleared.
| s | Status flag. | 
| k | Relative address. | 
| core | Pointer to the CORE structure. | 
Definition at line 247 of file branch.c.
References CORE::PC, SREG::sreg, and CORE::sreg.
| void brbs | ( | uint8_t | s, | 
| uint8_t | k, | ||
| struct CORE * | core | ||
| ) | 
Branch if status flag is set.
| s | Status flag. | 
| k | Relative address. | 
| core | Pointer to the CORE structure. | 
Definition at line 230 of file branch.c.
References CORE::PC, SREG::sreg, and CORE::sreg.
| void brcc | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if carry cleared.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 315 of file branch.c.
References SREG::C, CORE::PC, and CORE::sreg.
| void brcs | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if carry set.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 298 of file branch.c.
References SREG::C, CORE::PC, and CORE::sreg.
| void breq | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if equal.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 264 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::Z.
| void brge | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if greater or equal.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 400 of file branch.c.
References SREG::N, CORE::PC, CORE::sreg, and SREG::V.
| void brhc | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if half carry cleared.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 451 of file branch.c.
References SREG::H, CORE::PC, and CORE::sreg.
| void brhs | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if half carry set.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 434 of file branch.c.
References SREG::H, CORE::PC, and CORE::sreg.
| void brid | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if interrupts disabled.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 553 of file branch.c.
References SREG::I, CORE::PC, and CORE::sreg.
| void brie | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if interrupts enabled.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 536 of file branch.c.
References SREG::I, CORE::PC, and CORE::sreg.
| void brlo | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if lower.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 349 of file branch.c.
References SREG::C, CORE::PC, and CORE::sreg.
| void brlt | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if less than.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 417 of file branch.c.
References SREG::N, CORE::PC, CORE::sreg, and SREG::V.
| void brmi | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if minus.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 366 of file branch.c.
References SREG::N, CORE::PC, and CORE::sreg.
| void brne | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if not equal.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 281 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::Z.
| void brpl | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if plus.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 383 of file branch.c.
References SREG::N, CORE::PC, and CORE::sreg.
| void brsh | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if same or higher.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 332 of file branch.c.
References SREG::C, CORE::PC, and CORE::sreg.
| void brtc | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if T flag cleared.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 485 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::T.
| void brts | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if T flag set.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 468 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::T.
| void brvc | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if overflow cleared.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 519 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::V.
| void brvs | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
Branch if overflow set.
| k | The offset for the branch. | 
| core | Pointer to the core structure. | 
Definition at line 502 of file branch.c.
References CORE::PC, CORE::sreg, and SREG::V.
| void cp | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Compare two registers.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 120 of file branch.c.
References CORE::gp, GP::R, and update_sreg_arithm().
| void cpc | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Compare two registers with carry.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 132 of file branch.c.
References SREG::C, CORE::gp, GP::R, CORE::sreg, and update_sreg_arithm().
| void cpi | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Compare register with an immediate value.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 144 of file branch.c.
References CORE::gp, GP::R, and update_sreg_arithm().
| void cpse | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Compare and skip if equal.
| d | The destination register. | 
| r | The source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 102 of file branch.c.
Perform an indirect call to a subroutine.
Definition at line 54 of file branch.c.
References CORE::gp, SRAM::mem, CORE::PC, CORE::SP, and GP::Z.
| void ijmp | ( | struct CORE * | core | ) | 
| void jmp | ( | uint32_t | k, | 
| struct CORE * | core | ||
| ) | 
Perform a relative call to a subroutine.
| k | The offset for the call. | 
| core | Pointer to the CORE structure. | 
| sram | Pointer to the SRAM structure. | 
Definition at line 39 of file branch.c.
Return from an interrupt.
Definition at line 87 of file branch.c.
References SRAM::mem, CORE::PC, CORE::SP, CORE::sreg, and update_sreg_I().
| void rjmp | ( | uint8_t | k, | 
| struct CORE * | core | ||
| ) | 
| void sbic | ( | uint8_t | A, | 
| uint8_t | b, | ||
| struct CORE * | core, | ||
| union DATA_SPACE * | data_space | ||
| ) | 
Skip if bit in I/O register is cleared.
| A | I/O register address. | 
| b | Bit position. | 
| core | Pointer to the CORE structure. | 
| data_space | Pointer to the DATA_SPACE union. | 
Definition at line 192 of file branch.c.
References DATA_SPACE::io_reg, and CORE::PC.
| void sbis | ( | uint8_t | A, | 
| uint8_t | b, | ||
| struct CORE * | core, | ||
| union DATA_SPACE * | data_space | ||
| ) | 
Skip if bit in I/O register is set.
| A | I/O register address. | 
| b | Bit position. | 
| core | Pointer to the CORE structure. | 
| data_space | Pointer to the DATA_SPACE union. | 
Definition at line 211 of file branch.c.
References DATA_SPACE::io_reg, and CORE::PC.
| void sbrc | ( | uint8_t | r, | 
| uint8_t | b, | ||
| struct CORE * | core | ||
| ) | 
Skip if bit in register is cleared.
| r | Register. | 
| b | Bit position. | 
| core | Pointer to the CORE structure. | 
Definition at line 156 of file branch.c.
| void sbrs | ( | uint8_t | r, | 
| uint8_t | b, | ||
| struct CORE * | core | ||
| ) | 
Skip if bit in register is set.
| r | Register. | 
| b | Bit position. | 
| core | Pointer to the CORE structure. | 
Definition at line 174 of file branch.c.