Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development Center 1 1
1. Additional Logic Operations 1. Rotate Rotate the contents of the accumulator one position to the left or right. 1.RLC Rotate the accumulator left. Bit 7 goes to bit 0 AND the Carry flag. 2.RAL Rotate the accumulator left through the carry. Bit 7 goes to the carry and carry goes to bit 0. 3.RRC Rotate the accumulator right. Bit 0 goes to bit 7 AND the Carry flag. 4.RAR Rotate the accumulator right through the carry. Bit 0 goes to the carry and carry goes to bit 7. 2
1. 1 Additional Logic Operations RLC vs. RLA 1.RLC ( Rotate Accumulator Left ) 2.RAL ( Rotate Left Through Carry ) 3
2. Rotate instructions examples MVI A,FAh A = RLC A= after RLC Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0 0 Carry flag 1
2. Rotate instructions examples MVI A,FAh A = RAL A= After RAL Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0 0 Carry flag 1
2. Additional Logical Operations Compare Compare the contents of a register or memory location with the contents of the accumulator. 1.CMP R/M Compare the contents of the register or memory location. 2.CPI # Compare the 8-bit number to the contents of the accumulator. Comparison is doing by internal subtraction that does not change the contents of the accumulator. A –(R / M / #) In this instruction there is no specific target for the result. The flag register is affected. It sets the flags (Z, Cy, and S). 6
3. Machine Control 1. HLT Halt Stop executing the program and it used at the end of the program. 2. NOP No Operation No operation Exactly as it says, do nothing. Usually used for delay program during the debugging. 7
4. Instruction Size Depending on the operand type, the instruction may have different sizes. It will occupy a different number of memory bytes. Typically, all instructions occupy one byte only. The exception is any instruction that contains immediate data or a memory address. Instructions that include immediate data use two bytes. One for the opcode and the other for the 8-bit data. Instructions that include a memory address occupy three bytes. One for the opcode, and the other two for the 16-bit address. 8
4.1 Instruction with Immediate Date Operation: Load an 8-bit number into the accumulator. MVIA, 32 Operation: MVIA Operand: The number 32 Binary Code: E 1 st byte nd byte. 9
4.2 Instruction with a Memory Address Operation: go to address Instruction: JMP 2085Opcode: JMP Operand: 2085 Binary code: C3 1st byte nd byte rd byte 10
5. Addressing Modes The microprocessor has different ways of specifying the data for the instruction. These are called “addressing modes”. The 8085 has four addressing modes: 1.Implied Ex: CMA 2.Immediate Ex: MVI B, 45 3.Direct Ex: LDA Register Ex: MOV B, A ( Data is copied from one register to another register). 5.Indirect Ex: LDAX B ( Load the accumulator with the contents of the memory location whose address is stored in the register pair BC). 11
5.1 Indirect Addressing Mode Indirect addressing is used when the data is transferred from the address pointed by the data in a register to other register. Indirect addressing uses the data in a register pair as a 16-bit address to identify the memory location being accessed. The HL register pair is always used in conjunction with the memory register “M”. The BC and DE register pairs can be used to load data into the Accumulator using indirect addressing. 12
13 End of lecture 11