Here, I have a Assembly Language Program to check if a number in Memory Location is Even or Odd. I’ll also be saving the number to a different memory location depending on the condition results.
Problem: Write an 8086 ALP to Convert Decimal number to Hexadecimal number.
In this article, you’ll be learning how to write a Assembly Language Program to print Strings in multiple lines (8086). For this example code, we’ll have three different strings saved on the Registers and will be printed in different lines.
Title: 8086 Assembly Program to print String “Hello World, Good Morning, Have Good Day” in 3 different lines
Description: If you have seen your first Hello World ALP, this assembly program prints STRING from .DATA, but in three different lines. So, here we’ll be saving 3 different Strings to .DATA, and then print them one by one. From our first Hello World ALP hope you have understood the use of mnemonics to display the string and the interrupt request.
Write an assembly language program to count the number of 1’s in a byte stored in memory location 2000H.
Step 1: Point to memory location 2000H
Step 2: Load register A (Accumulator) with the content of memory location
Step 3: Set a counter to loop through each bits of number, Say C
Step 4: Set a counter to store the number of one’s (1’s) in the byte, Say B
Step 5: Rotate the content of accumulator to left through carry
Step 6: If no carry found from Step 5 then jump to Step 8
Step 7: Else increase the counter B by one (if carry found)
Step 8: Decrease counter C by one
Step 9: Until the value at counter C is 0 repeat from Step 5
Step 10: Terminate the program. (When C is 0)
|LXI H 2000H;||HL points at location 2000H|
|MOV A, M;||Loads A with the content of M|
|MVI C, 08H;||Sets up counter for number of bits|
|MVI B, 00H;||Sets counter to count number of ones|
|jump2:||RAL;||Rotates accumulator left through carry|
|JNC jump1;||On no carry jumps to jump1:|
|INR B;||Increases counter B by one|
|jump1:||DCR C;||Decreases counter C by one|
|JNZ jump2;||When C is not zero jumps to jump2:|
|HLT;||Terminates the program|