ADDRESS SPACES

KS57C2308/P2308/C2316/P2316

 

 

SKIP CONDITION FLAGS (SC2, SC1, SC0)

The skip condition flags SC2, SC1, and SC0 in the PSW indicate the current program skip conditions and are set and reset automatically during program execution. Skip condition flags can only be addressed by 8-bit read instructions. Direct manipulation of the SC2, SC1, and SC0 bits is not allowed.

CARRY FLAG (C)

The carry flag is used to save the result of an overflow or borrow when executing arithmetic instructions involving a carry (ADC, SBC). The carry flag can also be used as a 1-bit accumulator for performing Boolean operations involving bit-addressed data memory.

If an overflow or borrow condition occurs when executing arithmetic instructions with carry (ADC, SBC), the carry flag is set to "1". Otherwise, its value is "0". When a RESET occurs, the current value of the carry flag is retained during power-down mode, but when normal operating mode resumes, its value is undefined.

The carry flag can be directly manipulated by predefined set of 1-bit read/write instructions, independent of other bits in the PSW. Only the ADC and SBC instructions, and the instructions listed in Table 2-7, affect the carry flag.

Table 2-7. Valid Carry Flag Manipulation Instructions

Operation Type

Instructions

Carry Flag Manipulation

 

 

 

Direct manipulation

SCF

Set carry flag to "1"

 

 

 

 

RCF

Clear carry flag to "0" (reset carry flag)

 

 

 

 

CCF

Invert carry flag value (complement carry flag)

 

 

 

 

BTST C

Test carry and skip if C = "1"

 

 

 

Bit transfer

LDB (operand) (1),C

Load carry flag value to the specified bit

 

LDB C,(operand) (1)

Load contents of the specified bit to carry flag

Boolean manipulation

BAND C,(operand) (1)

AND the specified bit with contents of carry flag and save

 

 

the result to the carry flag

 

 

 

 

BOR C,(operand) (1)

OR the specified bit with contents of carry flag and save

 

 

the result to the carry flag

 

 

 

 

BXOR C,(operand) (1)

XOR the specified bit with contents of carry flag and save

 

 

the result to the carry flag

 

 

 

Interrupt routine

INTn (2)

Save carry flag to stack with other PSW bits

Return from interrupt

IRET

Restore carry flag from stack with other PSW bits

 

 

 

NOTES:

1.The operand has three bit addressing formats: mema.a, memb.@L, and @H + DA.b.

2.“INTn” refers to the specific interrupt being executed and is not an instruction.

2-20

Page 28
Image 28
Samsung KS57C2308 manual Skip Condition Flags SC2, SC1, SC0, Carry Flag C