hii everyone., here we have some basic programming of 8086 microprocessors
1.Addition of two hexadecimal nos. (BYTE or WORD)
MOV AX, 1ST DATA Move 1st data byte / word in Acc reg.
MOV BX, 2ND DATA Move 2nd data byte/ word in BX reg.
ADD AX, BX Add contents of Ax and BX.
INT 21 Return to DOS
Enter the program by using the a ASSEMBLE command.
First type a 0100 <ENTER> and line by line enter the program.
Now in order to verify the program use the u UNASSEMBLE
command.
Type U 0100 <ENTER>
And debug will then display the entire program.
Since this program is entered from offset 0100, hence check
that the IP register should be at 0100. This can be done by
using the R REGISTER command. For that
Type r IP <ENTER>
The screen will show IP :0100 _
If the address of the IP register is the same as that of the
program you want to execute, then just press <ENTER> key.
But if it is different then at that blank space just after the IP
address is displayed, type the new offset address and press
<ENTER> key.
Then execute the program by using the g GO command.
Type g 0108 <ENTER> (since this program ends at 0108)
Examine the contents of the registers as well as the Flags.
Write and execute programs considering hexadecimal nos. for:
Subtraction
Multiplication
Division
Examine the contents of the registers as well as the Flags
Write and execute programs considering decimal nos. for:
i) Addition
ii) Subtraction
Examine the contents of the registers as well as the Flags
Write an assembly language program to add the contents of the memory location 1000:0100H to the contents of 1500:0100H and store the result in memory location 2500:0100H
MOV CX, 1000H Move 1000h to CX to Initialize DS
MOV DS, CX Initialize DS at 1000H
MOV AX, [0100] Move data at offset 0100 to AX
MOV CX, 1500H Move 1500h to CX to Initialize DS
MOV DS, CX Initialize DS at 1500H
MOV BX, [0100] Move data at offset 0100 to BX
ADD AX, BX Add the two data bytes.
MOV CX, 2500H Move 2500h to CX to Initialize DS
MOV DS, CX Initialize DS at 2500H
MOV [0100], AX Store the result at 2500:0100H
INT 21 Return to DOS
First type a 0200 <ENTER> and line by line enter the above
program.
Now in order to load the data in 1000:0100 & 1500:0100 use
the e command i.e. the ENTER command
Type e 1000:0100 <ENTER>
The screen will display 1000:0100 D2._
D2 is the data present earlier, now at that blank space enter
the new data byte, and then press <ENTER>.
Similarly to enter data at 1500:0100
Type e 1500:0100 <ENTER>
The screen will display 1500:0100 40._
40 is the data present earlier, now at that blank space enter
the new data byte, and then press <ENTER>.
Execute the program by using the GO command and check
2500:0100 for the result.
Ten data bytes are stored in consecutive memory locations
having offset from 0200H in the segment starting from1000H.
Write an assembly language program to move the entire block
of data bytes to a new offset address starting from 0300H.
(i.e. move data bytes stored from 1000:0200 1000:0209 to
new memory locations 1000:0300 1000:0309)
In order to understand and to develop the logic you should first write and execute this program in a general way i.e. using simple instructions.
Then try to minimize the above program by using the LOOP instruction, and
Further modify and minimize it by using the MOVSB ( move string byte ) instruction.
In order to store the data bytes use the e i.e. the ENTER command. Please note that only one data byte can be entered at a time.
Five data bytes are stored in consecutive memory locations
having offset from 0200H in the segment starting from1000H.
Write an assembly language program to find the greatest of
these five data bytes . Store the greatest number in AL register.
Write an assembly language program to find out the number of
even and odd numbers from a given ten, words i.e. 16-bit
hexadecimal nos. (The words are stored from 0300 offset
onwards)(Please note that each word will occupy two memory
locations).
Write an assembly language program to find out the number of
positive and negative numbers from a given ten, signed nos.
(The signed nos. are stored from offset 0300 onwards).
9. Write an assembly language program to display a string of
characters on the screen. Use the ASCII code chart.
10. Write an assembly language program to find the square root of
a decimal number. The number considered should be a perfect
square.
1.Addition of two hexadecimal nos. (BYTE or WORD)
MOV AX, 1ST DATA Move 1st data byte / word in Acc reg.
MOV BX, 2ND DATA Move 2nd data byte/ word in BX reg.
ADD AX, BX Add contents of Ax and BX.
INT 21 Return to DOS
Enter the program by using the a ASSEMBLE command.
First type a 0100 <ENTER> and line by line enter the program.
Now in order to verify the program use the u UNASSEMBLE
command.
Type U 0100 <ENTER>
And debug will then display the entire program.
Since this program is entered from offset 0100, hence check
that the IP register should be at 0100. This can be done by
using the R REGISTER command. For that
Type r IP <ENTER>
The screen will show IP :0100 _
If the address of the IP register is the same as that of the
program you want to execute, then just press <ENTER> key.
But if it is different then at that blank space just after the IP
address is displayed, type the new offset address and press
<ENTER> key.
Then execute the program by using the g GO command.
Type g 0108 <ENTER> (since this program ends at 0108)
Examine the contents of the registers as well as the Flags.
Write and execute programs considering hexadecimal nos. for:
Subtraction
Multiplication
Division
Examine the contents of the registers as well as the Flags
Write and execute programs considering decimal nos. for:
i) Addition
ii) Subtraction
Examine the contents of the registers as well as the Flags
Write an assembly language program to add the contents of the memory location 1000:0100H to the contents of 1500:0100H and store the result in memory location 2500:0100H
MOV CX, 1000H Move 1000h to CX to Initialize DS
MOV DS, CX Initialize DS at 1000H
MOV AX, [0100] Move data at offset 0100 to AX
MOV CX, 1500H Move 1500h to CX to Initialize DS
MOV DS, CX Initialize DS at 1500H
MOV BX, [0100] Move data at offset 0100 to BX
ADD AX, BX Add the two data bytes.
MOV CX, 2500H Move 2500h to CX to Initialize DS
MOV DS, CX Initialize DS at 2500H
MOV [0100], AX Store the result at 2500:0100H
INT 21 Return to DOS
First type a 0200 <ENTER> and line by line enter the above
program.
Now in order to load the data in 1000:0100 & 1500:0100 use
the e command i.e. the ENTER command
Type e 1000:0100 <ENTER>
The screen will display 1000:0100 D2._
D2 is the data present earlier, now at that blank space enter
the new data byte, and then press <ENTER>.
Similarly to enter data at 1500:0100
Type e 1500:0100 <ENTER>
The screen will display 1500:0100 40._
40 is the data present earlier, now at that blank space enter
the new data byte, and then press <ENTER>.
Execute the program by using the GO command and check
2500:0100 for the result.
Ten data bytes are stored in consecutive memory locations
having offset from 0200H in the segment starting from1000H.
Write an assembly language program to move the entire block
of data bytes to a new offset address starting from 0300H.
(i.e. move data bytes stored from 1000:0200 1000:0209 to
new memory locations 1000:0300 1000:0309)
In order to understand and to develop the logic you should first write and execute this program in a general way i.e. using simple instructions.
Then try to minimize the above program by using the LOOP instruction, and
Further modify and minimize it by using the MOVSB ( move string byte ) instruction.
In order to store the data bytes use the e i.e. the ENTER command. Please note that only one data byte can be entered at a time.
Five data bytes are stored in consecutive memory locations
having offset from 0200H in the segment starting from1000H.
Write an assembly language program to find the greatest of
these five data bytes . Store the greatest number in AL register.
Write an assembly language program to find out the number of
even and odd numbers from a given ten, words i.e. 16-bit
hexadecimal nos. (The words are stored from 0300 offset
onwards)(Please note that each word will occupy two memory
locations).
Write an assembly language program to find out the number of
positive and negative numbers from a given ten, signed nos.
(The signed nos. are stored from offset 0300 onwards).
9. Write an assembly language program to display a string of
characters on the screen. Use the ASCII code chart.
10. Write an assembly language program to find the square root of
a decimal number. The number considered should be a perfect
square.
No comments