Z80 Instruction Set — Bit


AND
BIT
CCF
OR
RES
SCF
SET
XOR

AND

AND reg8
Operation Bitwise AND on A with reg8.
Op Code 10100[reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 4 or 7 (HL)

AND imm8
Operation Bitwise AND on A with imm8.
Op Code 11100110 : [imm8]
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 7

AND (regindex + ofs8)
Operation Bitwise AND on A with the data at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 10100110 [ofs8]
Register Bit Field
IX 11011101
IY 11111101
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 19

Top

BIT

BIT imm3,reg8
Operation Tests bit imm3 of reg8.
Op Code 11001011 : 01[imm3][reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
Flags S P/V are scrambled
Z is affected as defined
H is set
N is cleared
C is unaffected
T States 8 or 12 (HL)

BIT imm3,(regindex + ofs8)
Operation Tests bit imm3 of the data at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 11001011 : [ofs8] : 01[imm3110
Register Bit Field
IX 11011101
IY 11111101
Flags S P/V are scrambled
Z is affected as defined
H is set
N is cleared
C is unaffected
T States 23

Top

CCF

CCF
Operation Inverts the value of the carry flag.
Op Code 00111111
Flags S Z P/V are unaffected
H is the carry before operation
N is reset
See instruction for C
T States 4

Top

OR

OR reg8
Operation Bitwise OR on A with reg8.
Op Code 10110[reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
Flags S Z are affected as defined
P/V is parity
H N C are reset
T States 4 or 7 (HL)

OR imm8
Operation Bitwise OR on A with imm8.
Op Code 11110110 : [imm8]
Flags S Z are affected as defined
P/V is parity
H N C are reset
T States 7

OR (regindex + ofs8)
Operation Bitwise OR on A with the data at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 10110110 [ofs8]
Register Bit Field
IX 11011101
IY 11111101
Flags S Z are affected as defined
P/V is parity
H N C are reset
T States 19

Top

RES

RES imm3,reg8
Operation Resets bit imm3 of reg8.
Op Code 11001011 : 10[imm3][reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
T States 8 or 15 (HL)

RES imm3,(regindex + ofs8)
Operation Resets bit imm3 of the value at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 11001011 : [ofs8] : 10[imm3]110
Flags Not affected
T States 23

Top

SCF

SCF
Operation Sets the carry flag.
Op Code 00110111
Flags S Z P/V are unaffected
H N are reset
C is set
T States 4

Top

SET

SET imm3,reg8
Operation Sets bit imm3 of reg8.
Op Code 11001011 : 11[imm3][reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
T States 8 or 15 (HL)

SET imm3,(regindex + ofs8)
Operation Sets bit imm3 of the value at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 11001011 : [ofs8] : 11[imm3]110
Flags Not affected
T States 23

Top

XOR

XOR reg8
Operation Bitwise XOR on A with reg8.
Op Code 10101[reg8]
Register Bit Field
A 111
B 000
C 001
D 010
E 011
H 100
L 101
(HL) 110
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 4 or 7 (HL)

XOR imm8
Operation Bitwise XOR on A with imm8.
Op Code 11101110 : [imm8]
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 7

XOR (regindex + ofs8)
Operation Bitwise XOR on A with the data at the memory location pointed to by regindex plus ofs8.
Op Code [regindex] : 10101110 [ofs8]
Register Bit Field
IX 11011101
IY 11111101
Flags S Z are affected as defined
H is set
P/V is parity
N C are reset
T States 19

Top

This is part of Learn TI-83 Plus Assembly In 28 Days
Copyright (c) 2002, 2003, 2004 Sean McLaughlin
See the file gfdl.html for copying conditions