data transfer and manipulation

16
Data Transfer and Manipulation By:- Gaurav Pal(8136)

Upload: sanjeev-patel

Post on 14-Jun-2015

10.144 views

Category:

Education


69 download

DESCRIPTION

Sanjeev Patel 4x

TRANSCRIPT

Page 1: Data transfer and manipulation

Data Transfer and Manipulation

By:-Gaurav Pal(8136)

Page 2: 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

Page 3: Data transfer and manipulation

Data Transfer Instruction

Data transfer instructions move data from one place in the computer to another without changing the data content

The most common transfers are between memory and processor registers,between processor registers and input or output,and between the processor registers themselves.

Page 4: Data transfer and manipulation

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

NAME MnemonicLoad LDStore STMove MOVExchange XCHInput INOutput OUTPush PUSHpop POP

Page 5: Data transfer and manipulation

Data Manipulation Instruction

Data Manipulation Instructions perform operations on data and provide the computational capabilities for the computer.

It is divided into three basic types:1) Arithmetic,

2) Logical and bit manipulation, 3) Shift Instruction

Page 6: Data transfer and manipulation

Arithmetic InsructionsNAME MnemonicIncrement INCDecrement DECAdd ADDSubtract SUBMultiply MULDivide DIVAdd with carry ADDCSubtract with borrow

SUBB

Negate (2’s complement)

NEG

Page 7: Data transfer and manipulation

Logical and bit manipulation Insructions

NAME MnemonicClear CLRComplement COMAND ANDOR ORExclusive-or XORClear carry CLRCSet carry SETCcomplement carry COMCEnable interrupt EIDisable interrupt DI

Page 8: Data transfer and manipulation

Shift InstructionsNAME MnemonicLogical shift right SHR

Logical shift left SHL

Arithmetic shift right

SHRA

Arithmetic shift left

SHLA

Rotate right RORRotate left ROLRotate right through carry

RORC

Rotate left through carry

ROLC

Page 9: Data transfer and manipulation

Program controlProgram 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

Page 10: Data transfer and manipulation

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

Page 11: Data transfer and manipulation

4-bit status register

Page 12: Data transfer and manipulation

Conditional Branch Instructions :

Page 13: Data transfer and manipulation

Subroutine Call and Return

It is a self-contained sequence of instructions that performs a given computational task.

During the execution of a program,a subroutine may call when it is called, a branch is executed to the beginning of the subroutine to start executing its set of instructions. After the subroutine has been executed,a branch is made back to the main program.

Page 14: Data transfer and manipulation

A subroutine call is implemented with the following microoperations:

CALL:SP← SP-1: Decrement stack point

M[SP] ←PC : Push content of PC onto the stack

PC←Effective Address : Transfer control to the subroutine

RETURN:PC ← M[SP] : Pop stack and transfer to PCSP ← SP+1 : Increment stack pointer

Page 15: Data transfer and manipulation

Program Interrupt

» Transfer program control from a currently running program to another service programas a result of an external or internal generated request

» Control returns to the original program after the service program is executed

Page 16: Data transfer and manipulation

Types of Interrupts1) External Interrupts

» come from I/O device, from a timing device, from a circuitmonitoring the power supply, or from any other external source

2) Internal Interrupts or TRAP» caused by register overflow, attempt to divide by zero,an invalid operation code, stack overflow, and protection violation

3) Software Interrupts» initiated by executing an instruction (INT or RST)» used by the programmer to initiate an interrupt procedure at any desired point in the program