# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ64GA004 - Programmers Reference Manual

- 1
- 2
…
- 19
- 20
- 21
- 22
- 23
…
- 501
- 502

© 2005-2011 Microchip Technology Inc. DS70157F-page 21
Section 2. Programmer’s Model
Programmer’s
Model
2
2.15 DOEND REGISTER (dsPIC30F, dsPIC33F AND dsPIC33E DEVICES)
The DOEND register contains the ending address for a hardware DO loop. When a DO instruction
is executed, DOEND is loaded with the address specified by the expression in the DO instruction.
This location in memory specifies the last instruction in the DO loop. When looping is activated
and the instruction stored at the DOEND address is executed, program execution will continue
from the DO loop start address (stored in the DOSTART register).
2.16 STATUS REGISTER
The 16-bit STATUS register maintains status information for the instructions which have been
executed most recently. Operation Status bits exist for MCU operations, loop operations and
DSP operations. Additionally, the STATUS register contains the CPU Interrupt Priority Level bits,
IPL<2:0>, which are used for interrupt processing.
Depending on the MCU and DSC family, one of the following STATUS registers is used:
• Register 2-1 for PIC24F, PIC24H, and PIC24E devices
• Register 2-2 for dsPIC30F and dsPIC33F devices
• Register 2-3 for dsPIC33E devices
2.16.1 MCU ALU Status Bits
The MCU operation Status bits are either affected or used by the majority of instructions in the
instruction set. Most of the logic, math, rotate/shift and bit instructions modify the MCU Status bits
after execution, and the conditional Branch instructions use the state of individual Status bits to
determine the flow of program execution. All conditional branch instructions are listed in
Section
4.8 “Conditional Branch Instructions”.
The Carry (C), Zero (Z), Overflow (OV), Negative (N), and Digit Carry (DC) bits show the
immediate status of the MCU ALU by indicating whether an operation has resulted in a Carry,
Zero, Overflow, Negative result, or Digit Carry. When a subtract operation is performed, the C
flag is used as a Borrow
flag.
The Z Status bit is useful for extended precision arithmetic. The Z Status bit functions like a
normal Z flag for all instructions except those that use a carry or borrow input (ADDC, CPB,
SUBB and SUBBR). See
Section 4.9 “Z Status Bit” for more detailed information.
2.16.2 REPEAT Loop Status Bit
The REPEAT Active bit (RA) is used to indicate when looping is active. The RA flag indicates that
a REPEAT instruction is being executed, and it is only affected by the REPEAT instructions. The
RA flag is set to ‘1’ when the instruction being repeated begins execution, and it is cleared when
the instruction being repeated completes execution for the last time.
Since the RA flag is also read-only, it may not be directly cleared. However, if a REPEAT or its
target instruction is interrupted, the Interrupt Service Routine may clear the RA flag of the SRL,
which resides on the stack. This action will disable looping once program execution returns from
the Interrupt Service Routine, because the restored RA will be ‘0’.
Note 1: For dsPIC30F and dsPIC33F devices, DOEND has a shadow register. See
Section 2.18 “Shadow Registers” for information on shadow registers.
2: The dsPIC33E devices have a 4-level-deep, nested DO stack instead of a shadow
register.
3: Refer to the specific device family reference manual for complete details about DO
loops.
Note 1: All MCU bits are shadowed during execution of the PUSH.S instruction and they are
restored on execution of the POP.S instruction.
2: All MCU bits, except the DC flag (which is not in the SRL), are stacked during
exception processing (see
Section 4.7.1 “Software Stack Pointer”).

- 1
- 2
…
- 19
- 20
- 21
- 22
- 23
…
- 501
- 502