- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Instructions to complement/set Cy flag in 8085 Microprocessor
In 8085 Instruction set,there are two instructions to control the Cy flag bit content. Thesemnemonics are STC and CMC. Both are 1-Byteinstructions. There hex codes are given in the following table –
Mnemonics,Operand | Opcode(in HEX) | Bytes |
STC | 37 | 1 |
CMC | 3F | 1 |
Using STC instruction we can set the Cy flag bit to 1 irrespective of itsprevious value. And using CMC instruction we can complement the current value of the Cy fag bit andresult will update the current Cy flag bit value. Here STC stands for “SeT the Carry flag” and CMC stands for “CoMplement the Carry flag”. Note that, there isno dedicated instruction in 8085 instruction set to reset the Cy flagbit. To resent the Cy flag bit we can execute STC and CMCinstructions sequentially in this order.
Intel 8085 also provides instructions to complement thecy flag, and set the cy flag to the 1 state. But it does not have aninstruction to reset the cy flag to 0. If it is desired to reset cyflag to 0, the method is to set it to 1 and then complement it.Notice that no other flag can be set or complemented.
Address | Hex Codes | Mnemonic | Comment |
2000 | 37 | STC | Set the Cy flag bit to 1 irrespective of its previous value |
2001 | 3F | CMC | Complement the Cy flag bit. So here Cy ← complement of 1 = 0 will be the final value of Cy flag bit |
The timing diagram against this instruction STC execution is as follows –
Summary − So this instruction STC requires 1-Byte, 1-Machine Cycle (Opcode Fetch) and 4 T-States for execution as shown in the timing diagram.
The timing diagram against this instruction CMC execution is as follows –
Summary − So this instruction CMC requires 1-Byte, 1-Machine Cycle (Opcode Fetch) and 4 T-States for execution as shown in the timing diagram.
- Related Articles
- Instructions to perform addition in 8085 Microprocessor
- Instructions to rotate Accumulator in 8085 Microprocessor
- Instructions to perform subtraction in 8085 Microprocessor
- Number of instructions in 8085 Microprocessor
- Conditional JUMP instructions in 8085 Microprocessor
- Conditional call instructions in 8085 Microprocessor
- Conditional return instructions in 8085 Microprocessor
- Restart instructions (RSTn) in 8085 Microprocessor
- Instruction to complement Accumulator in 8085 Microprocessor
- Instructions to perform AND operation in 8085 Microprocessor
- Instructions to perform OR operation in 8085 Microprocessor
- Instructions to perform compare operation in 8085 Microprocessor
- IN and OUT instructions in 8085 Microprocessor
- Instructions to perform Exclusive OR operation in 8085 Microprocessor
- Conditional and Unconditional JUMP instructions in 8085 Microprocessor
