HYUNDAI MicroElectonics
36
DEC
( Decrement )
Function
: M
( M )
1
Description : Decrement the contents of the accumulator or of the memory by 1.
Flag
:
Mnemonic
OP Code
Bytes
Cycles
DEC A
A8
1
2
DEC dp
A9
2
4
DEC dp + X
B9
2
5
DEC !abs
B8
3
5
DEC X
AF
1
2
DEC Y
BE
1
2
Example
:
405
;**************************************
406
; ROTATE 32 BIT SHIFT LEFT *
407
;**************************************
408 F868 1E03
LDX
#3
409 F86A 3934
NextByte: ROL
34H+X
; SHIFT ROTATE LEFT
410 F86C AF
DEC
X
; DECREMENT INDEX COUNTER
411 F86D 10FB
BPL
NextByte
412 F86F 6F
RET
DECW
( Decrement word - 16bit )
Function
: ( dp+1 ) ( dp ) = ( dp+1 ) ( dp )
−−−−
1
Description : Decrement the contents of 16bit memory pair by 1.
Flag
:
Mnemonic
OP Code
Bytes
Cycles
DECW dp
BD
2
6
Example
:
529 C241 C40F
LDA
#0FH
530 C243 3E3F
LDY
#03FH
531 C245 BD05
DECW
CMPDATL
532 C247 5D05
CMPW
CMPDATL ; YA(030FH) - (1)(CMPDATL)
533 C249 7004
BNE
NEXT
534 C24B C400
LDA
#0H
535 C24D 3E00
LDY
#0H
536 C24F DD03
NEXT:
TYA
DPL