Showing posts with label Microprocessor. Show all posts
Showing posts with label Microprocessor. Show all posts

Tuesday, July 9, 2013

Write an assembly language program to subtract two 16-bit numbers (3467h and ACDCh). (in 8085)



Subtracting 3467h from ACDCh i.e. ACDCh – 3467h= 7875h

MVI H,ACH                 [move ACh in register H]
MVI L,DCH                  [move DCh in register L]
MVI D,34H                  [move 34h in register D]
MVI E,67h                   [move 67h in register E]
MOV A,L                      [move value of register L in accumulator]
SUB E                            [subtract value of register E from accumulator]
MOV L,A                      [move the value of accumulator in register L]
MOV A,H                     [move the value of register H in accumulator]
SBB D                            [subtract with borrow the value of register D from accumulator]
MOV H,A                     [move the value of accumulator in register H]
SHLD C010H                [store the result, L in C010h and H in C011h]
HLT                                 [stop processing]

Write an assembly language program to multiply 05h and 06h. Explain all steps.



multiply: 05h and 06h i.e. 05h*06h= 1Eh
MVI B,06H           [move 06h in register B]
MVI C,05H           [move 05h in register C]
LABEL:                   [name of loop]
  ADD B                 [add the value of register B with accumulator]
  DCR C                  [decrease the value of register C by 1]
  JNZ LABEL          [jump to LABEL if the value of register C is not zero]
STA C000H           [store the result, the value of accumulator in address C000h]
HLT                         [stop processing]

Write an assembly language program to subtract two 16-bit numbers. (in 8085)



LHLD C003    [load the content of C003 in register L and C004 in register H]
XCHG         [transfer the value of register H in D and register L in E]
LHLD C000    [load the content of C000 in register L and C001 in register H]
MOV A,L     [move the content of register L in accumulator]
SUB E       [subtract value of register E from accumulator]
MOV L,A              [move the value of accumulator in register L]
MOV A,H             [move the value of register H in accumulator]
SBB D                    [subtract with borrow the value of register D from accumulator]
MOV H,A             [move the value of accumulator in register H]
SHLD C030           [store the value of register L in C030 and H in C031]
HLT                         [Stop processing]

Explain Control Bus.



The control bus carries signals relating to the control and coordination of the various activities across the computer system, which can be sent from the control unit within the CPU. Control bus contain group of wires where each wire perform a specific task by specifying a control bit. For instance, different specific lines are used for each of Read, Write and Reset request.

Explain Data bus.



The data bus is responsible for the exchange of data between the processor, memory and peripherals. They are bidirectional so it allows data flow in both the direction along the wire. The width of the data bus differs from the address bus. Each single wire is responsible for transmitting single binary value at each clock. So, the greater width allows greater amount of data to be transferred at the same time.