Section: Array Operations & Code Conversions
Aim: To write an assembly language program to convert the given Hexadecimal number into its ASCII equivalent and to verify the result.
Apparatus Required: 8085 microprocessor kit, keyboard.
Algorithm:
- Load the Hexadecimal number from the location.
- Separate the nibbles.
- Convert each nibble to its ASCII Equivalent.
- Add the two converted values.
- Display the result.
- Stop.
Program:
| Address | Label | Mnemonics | Operand | Comment |
|---|---|---|---|---|
| 4100 | LDA | 4200 | Get the data | |
| 4103 | MOV | B, A | Move Accumulator content to B reg | |
| 4104 | ANI | 0F | Mask upper nibble | |
| 4106 | CALL | SUB | Get ASCII code for upper nibble | |
| 4109 | STA | 4201 | Store the value of accumulator | |
| 410B | MOV | A, B | Move B reg content to Acc | |
| 410D | ANI | F0 | Mask lower nibble | |
| 410F | RLC | Rotate left without carry 4 times | ||
| 4110 | RLC | |||
| 4111 | RLC | |||
| 4112 | RLC | |||
| 4113 | CALL | SUB | Get the ASCII code | |
| 4116 | STA | 4202 | Store the accumulator | |
| 4119 | HLT | Stop | ||
| 411A | SUB | CPI | 0A | Compare with 0A |
| 411C | JC | SKP | Skip if carry | |
| 411F | ADI | 07 | Add 07 to Acc | |
| 4121 | SKP | ADI | 30 | Add 30 to Acc |
| 4123 | RET | Return |
Observation:
- Input:
- Address
4200:A5
- Address
- Output:
- Address
4201:35 - Address
4202:41
- Address
Result: Thus assembly language program to convert the given Hexadecimal number into its ASCII equivalent is completed and also the result is verified.
Flowchart:
+-------------------------------+
| START |
+---------------+---------------+
|
v
+-------------------------------+
| Load the Hexadecimal number |
+---------------+---------------+
|
v
+-------------------------------+
| Convert each nibble into |
| ASCII equivalent |
+---------------+---------------+
|
v
+-------------------------------+
| Display the result |
+---------------+---------------+
|
v
+-------------------------------+
| STOP |
+-------------------------------+
Viva Questions:
- What is ASCII number for 0AH?
- What is difference between byte and word?
- What is the immediate addressing mode?
- What are data transfer instructions?
- What is the use of immediate addressing mode?
- What are branching instructions?
- What is DMA?
For all 2026 published articles list: click here:
…till the next post, bye-bye & take care