Samsung KS57C2308 Computer Monitor User Manual


 
SAM47 INSTRUCTION SET KS57C2308/P2308/C2316/P2316
5-82
SBS Subtract
SBS dst,src
Operation: Operand Operation Summary Bytes Cycles
A,@HL Subtract indirect data memory from A; skip on borrow 1 1 + S
EA,RR Subtract register pair (RR) from EA; skip on borrow 2 2 + S
RRb,EA Subtract EA from register pair (RRb); skip on borrow 2 2 + S
Description: The source operand is subtracted from the destination operand and the result is stored in the
destination. The contents of the source are unaffected. A skip is executed if a borrow occurs. The
value of the carry flag is not affected.
Operand Binary Code Operation Notation
A,@HL 0 0 1 1 1 1 0 1
A A – (HL); skip on borrow
EA,RR 1 1 0 1 1 1 0 0
EA EA – RR; skip on borrow
1 0 1 1 1 r2 r1 0
RRb,EA 1 1 0 1 1 1 0 0
RRb RRb – EA; skip on borrow
1 0 1 1 0 r2 r1 0
Examples: 1. The accumulator contains the value 0C3H, register pair HL contains the value 0C7H, and the
carry flag is cleared to logic zero:
RCF ; C "0"
SBS EA,HL ; EA 0C3H – 0C7H
; SBS instruction skips on borrow,
; but carry flag value is not affected
JPS XXX ; Skip because a borrow occurred
JPS YYY ; Jump to YYY is executed
2. The accumulator contains the value 0AFH, register pair HL contains the value 0AAH, and the
carry flag is set to logic one:
SCF ; C "1"
SBS EA,HL ; EA 0AFH – 0AAH
JPS XXX ; Jump to XXX
; JPS was not skipped since no "borrow" occurred after
SBS