seperate the digits of a hexa decimal numbers and store in different locations
first get the packed BCD number and mask the lower nibble then move to the required position in the number and adjust the higher BCD digit as a lower digit then store the partial result now get the orignal BCD number and mask the higher nibble store the result and stop the program
LDA 2200H
ANI F0H
RRC
RRC
RRC
RRC
STA 2300H
LDA 2200H
ANI 0FH
STA 2301H
HLT
You might be also interested in:
:: Assembly Language Source Codes
:: why there are two ground pins in 8086
:: Program to display ASCII characters on the display unit
Jun 26, 2008
Jun 25, 2008
assambley Language program for swapping two numbers
swap the two numbers
the following program will swap the two numbers
eg; 23 will be changed to 32
LDA 2000H
MOV B,A
LDA 2200H
STA 2000H
MOV A,B
STA 2200H
HLT
the algorithm of the program is simple just copy the fist number in to register B and second number in to register A while storing store them in the reverse way that id first store the contents in the A first and then store the contents in register B
the following program will swap the two numbers
eg; 23 will be changed to 32
LDA 2000H
MOV B,A
LDA 2200H
STA 2000H
MOV A,B
STA 2200H
HLT
the algorithm of the program is simple just copy the fist number in to register B and second number in to register A while storing store them in the reverse way that id first store the contents in the A first and then store the contents in register B
Labels:
Assembly Language,
Program
Jun 23, 2008
Adding the 4 four most significant bit to a hexa no
this is the program to add 4 most significant bit to a hexa decimal number
first get most significant BCD Digit
then move to the location by RLC command
store the temporary number in C
get the lower BCD digit and add it
store the result and stop the program.
LDA 2201H
RLC
RLC
RLC
RLC
MOV C,A
LDA 2200H
ADD C
STA 2300H
HLT
first get most significant BCD Digit
then move to the location by RLC command
store the temporary number in C
get the lower BCD digit and add it
store the result and stop the program.
LDA 2201H
RLC
RLC
RLC
RLC
MOV C,A
LDA 2200H
ADD C
STA 2300H
HLT
Labels:
Assembly Language,
Program
Jun 21, 2008
once (1's) and twos (2's) complement of a number
1's complement of the number
LDA 2200H
CMA
STA 2300H
HLT
cma will give 1's complement of a number
2's complement of a number
LDA 2200H
CMA
ADI 01H
STA 2300H
HLT
here first the once's complent of the number is determined and then one is added to it
You might be also interested in:
:: Traffic light control system using 8086
:: Assembly Language Program to serve NMI
:: Interfacing Stepper Motor to 8086 using 8255
LDA 2200H
CMA
STA 2300H
HLT
cma will give 1's complement of a number
2's complement of a number
LDA 2200H
CMA
ADI 01H
STA 2300H
HLT
here first the once's complent of the number is determined and then one is added to it
You might be also interested in:
:: Traffic light control system using 8086
:: Assembly Language Program to serve NMI
:: Interfacing Stepper Motor to 8086 using 8255
Labels:
Assembly Language,
Program
Jun 17, 2008
Find the maximum number from the list of hexa decimal numbers
The program will find the maximum number form the list of hexadecimal numbers
LDA 2200H
MOV C,A
XRAA
LXI H,2201H
BACK: CMP M
JNC SKIP
MOVE A,M
SKIP: INX H
DCR C
JNZ BACK
STA 2300H
HLT
the algorithm is as follows
:: Assembly Language Programs to compute an expression
:: Interfacing Analog-to-Digital converter to 8086 using 8255
:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086
LDA 2200H
MOV C,A
XRAA
LXI H,2201H
BACK: CMP M
JNC SKIP
MOVE A,M
SKIP: INX H
DCR C
JNZ BACK
STA 2300H
HLT
the algorithm is as follows
- first initialize counter C= no of numbers in the list
- then assign the maximum value is equal to zero ( thats the minimum possible value we can assign ) A=0
- then initialize the pointer to the list of numbers
- compare the number with A
- if the number is greater the then maximum number that is A then replace A with the new number if not go for the next number
- i.e increment pointer value and decrement count C
- if c reaches 0 then come out of loop
- store the number in A in some memory location
- stop the program
:: Assembly Language Programs to compute an expression
:: Interfacing Analog-to-Digital converter to 8086 using 8255
:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086
Labels:
Assembly Language,
Program
Jun 16, 2008
Find the number of negative numbers from list of hexa decimal numbers
This Assembly Language program for 8086 microprocessor will calculate the number of negative numbers from the list of hexa decimal numbers
LDA 2200H
MOV C,A
MVI B,00
LXI H,2201H
BACK: MOV A,M
ANI 80H
JZ SKIP
INR B
SKIP: INX H
DCR C
JNZ BACK
MOV A,B
STA 2300H
HLT
the program works as follows
first initialize the counter for total number of numbers to search for (C)
put the initial value for negative numbers is equals to zero ( B=0)
initialize the pointer to the memory location of the data
then get the number and check the most significant bit if it is 1 then the number is negative (verify this your self )
increment B that is negative number count
increment pointer
decrement number count C
repeat the process of the total numbers
store the result and stop the program .
You might be also interested in:
:: Assembly Language Source Codes
:: why there are two ground pins in 8086
:: Program to display ASCII characters on the display unit
LDA 2200H
MOV C,A
MVI B,00
LXI H,2201H
BACK: MOV A,M
ANI 80H
JZ SKIP
INR B
SKIP: INX H
DCR C
JNZ BACK
MOV A,B
STA 2300H
HLT
the program works as follows
first initialize the counter for total number of numbers to search for (C)
put the initial value for negative numbers is equals to zero ( B=0)
initialize the pointer to the memory location of the data
then get the number and check the most significant bit if it is 1 then the number is negative (verify this your self )
increment B that is negative number count
increment pointer
decrement number count C
repeat the process of the total numbers
store the result and stop the program .
You might be also interested in:
:: Assembly Language Source Codes
:: why there are two ground pins in 8086
:: Program to display ASCII characters on the display unit
Labels:
Assembly Language,
Program
Subscribe to:
Posts (Atom)