Write an assembly language program to perform different arithmetic and logical operations on 8 bit and 16 bit operations.
Apparatus:Dyna 8085 microprocessor kit.
Program:
(a) Using Immediate Data (8 Bit):
| Address | Opcode | Mnemonic | Operand | Comments |
| C000 | 3E Data1 | MVI | A, Data1 | Get first byte in the Accumulator |
| C002 | 06 Data2 | MVI | B, Data2 | Get Second byte in Register B |
| C004 | 88 | ADD | B | Addition of Data1 (A) + Data2 (B). Result is saved in accumulator A. |
| C008 | 76 | HLT (RST1) | Halt the program |
Press R as DYNA85>R.
Example
| Data 1 | Data 2 | Result |
| A = 2 | B = 3 | A = 5(Accumulator) |
(b) Program to add two 8 bit numbers using data stored in memory:
Algorithm:
| Address | Opcode | Lable | Mnemonic | Operand | Comments |
| C000 | 21,B1,C0 | LXI | H, C0B1 H | Get address of 1st number in H-L pair | |
| C003 | 7E | Mov | A, M | Shift 1st no. in accumulator | |
| C004 | 23 | INX | H | Increment content of H-L Pair to point to 2nd number | |
| MOV | B, M | Move 2nd no into Reg. B | |||
| C005 | 86 | ADD | B | 1 stno. + 2 nd no., result is stored in accumulator | |
| C006 | 23 | INX | H | Increment | |
| C007 | 77 | MOV | M, A | Move result at address C0B3 H | |
| C00E | 23 | INX | H | Move to next location | |
| C00F | 00 36 | MVI | M, 00H | Store 0 if carry is not generated | |
| C010 | JNC | Label1 (C014) | |||
| C012 | 01 36 | MVI | M, 01H | Store 1 as carry | |
| C014 | 76 | Label1: | HLT | RST1 | Halt |
| Address | Data | Comments | Example |
| C0B1 | Data1 | 1stno. to be added | 5 |
| C0B2 | Data2 | 2ndno. to be added | 2 |
| C0B3 | Result | Data1 + Data2 | 3 |
| C0B3 | Carry | Carry is stored as either 0 or 1 | 0 |
Viva Questions:
Get all latest content delivered to your email a few times a month.