English
Language : 

GMS30C2116 Datasheet, PDF (83/322 Pages) Hynix Semiconductor – USERS MANUAL
INSTRUCTION SET
3-19
3.10 Negate Instructions
The source operand is subtracted from zero, the result is placed in the destination register
and the condition flags are set or cleared accordingly.
At NEG and NEGS, the source operand and the result are interpreted as either both signed
or both unsigned integers. At NEGS, the source operand and the result are signed integers
and a trap to Range Error occurs at overflow.
Format Notation
Operation
RR
NEG Rd, Rs
Rd := - Rs;
Z := Rd = 0;
N := Rd(31);
V := overflow;
C := borrow;
-- signed or unsigned Negate
-- sign
RR
NEGS Rd, Rs
Rd := - Rs;
Z := Rd = 0;
N := Rd(31);
V := overflow;
if overflow then
trap ⇒ Range Error;
-- signed Negate with trap
-- sign
When the SR is denoted as a source operand at NEG and NEGS, C is negated instead of
the SR. The notation is then:
Format Notation
Operation
RR
NEG Rd, C
Rd := - C;
-- signed or unsigned Negate C
if C is set then
Rd := -1;
else
Rd := 0;
RR
NEGS Rd, C
Rd := - C;
-- signed Negate C
if C is set then
Rd := -1;
else
Rd := 0;
The flags are treated as defined by NEG or NEGS. A trap cannot occur.
Register
L0 : $124
L1 : $4
Instruction
NEG L0, L1
; L0 = - L1 = $FFFFFFFC