Data Transfer and Manipulation Data Transfer and Manipulation











- Slides: 11

Data Transfer and Manipulation

Data Transfer and Manipulation Most computer instructions can be classified into three categories: 1) Data transfer, 2) Data manipulation, 3) Program control instructions

Data Transfer Instruction v. Data transfer instructions move data from one place in the computer to another without changing the data content v. The most common transfers are between memory and processor registers, between processor registers and input or output, and between the processor registers themselves.

NAME Load Store Move Exchange Input Output Push pop Mnemonic LD ST MOV XCH IN OUT PUSH POP Typical Data Transfer Instruction : » Load : transfer from memory to a processor register, usually an AC (memory read) » Store : transfer from a processor register into memory (memory write) » Move : transfer from one register to another register » Exchange : swap information between two registers or a register and a memory word » Input/Output : transfer data among processor registers and input/output device » Push/Pop : transfer data between processor registers and a memory stack

Data Manipulation Instruction q. Data Manipulation Instructions perform operations on data and provide the computational capabilities for the computer. q. It is divided into three basic types: 1) Arithmetic, 2) Logical and bit manipulation, 3) Shift Instruction

Arithmetic Insructions • The four basic arithmetic operations are addition, subtraction, multiplication, and division. NAME Increment Decrement Add Subtract Multiply Divide Add with carry Subtract with borrow Negate (2’s complement) Mnemonic INC DEC ADD SUB MUL DIV ADDC SUBB NEG

Logical and bit manipulation Insructions • Logical instructions perform binary operations on strings of bits stored in registers. • They are useful for manipulating indvidual bits or a group of bits that represent binarycoded information. NAME Clear Complement AND OR Exclusive-or Clear carry Set carry complement carry Enable interrupt Disable interrupt Mnemonic CLR COM AND OR XOR CLRC SETC COMC EI DI

Shift Instructions • Instuctions to shift the content of an operand • Shifts are operations in which the bits of a word are moved to the left or right. NAME Mnemonic Logical shift right SHR Logical shift left SHL Arithmetic shift right Arithmetic shift left Rotate right Rotate left Rotate right through carry SHRA Rotate left through carry ROLC SHLA ROR ROL RORC

Program control instructions specify conditions for altering the content of the program counter , while data transfer and manipulation instructions specify condtions for data-processing operations. NAME Mnemonic Branch BR Jump JMP Skip SKP Call CALL Return RET Compare(by subtraction) CMP Test(by ANDing) TST

Status Bit Conditions • It is convinent to supplement the ALU circuit in the CPU with a status register where status bit condition can be stored for further analysis. • Status bits are also called condition code bit or flag bit. • The four status bits are symbolized by C, S, Z and V. • The bits are set or cleared as a result of an operation performed in the ALU

4 -bit status register • Bit C (carry) : • Bit S (sign) : • Bit Z (zero) : set to 1 if the output of the ALU contains all 0’s • Bit V (overflow) :