mpmc lab print
mpmc lab print
PRACTICE PROGRAMS:
1 WAP to move 32H to register C and verify the contents of register C.
S-A
EC4206 MICROPROCESSOR
APPLICATION LABORATORY
1. REARRANGING BYTES:
bytes in the
locations starting from 0C401I/2500H
tirst block should in such
that first 8
a
program to
4. ADDITION OF 12 BYTES:
Write a
program to add
12 bytes
store the sum in residing in locations starting from 0C20H /2400H. and
location 0C30H /2500H
(result space 2 bytes)
5. SORTING IN DESCENDING ORDER:
Write a
program to sort
16 bytes residing in locations starting from 0C20H
descending order in the same locatión 2400H. in
6.
MULTIPLICATION OF SINGLE BYTE BY SINGLE
BYTE:
Write a
program to
multiply
single byte residing in location OC20H/
a
byte residing in location 0C21H 2400H
the product in 0C22Hby another
/ 2401H and store
(Product space 2 bytes) 2402H
7. ADDITION OF 18 BCD NO'S:
Wriie a
program to add 18 BCD no's
and store the sum in
residing locations starting trom OC20H/
location 0C40H / 2500H
in
(result space 2 bytes) 2400H
8. ADDITION OFTWO 10-BYTE NO'S:
Write program to add a 10-byte no. residing in location 0C20H/2400H with another 10-
a
byte no. residing in location 0C30H / 2420H and store the sum in location OC40H/ 2440H
result space 11 bytes)
Write a program to add a 20-digit BCD number residing in location 0C20H/ 2400H, with
another 20-digit BCD number residing in location 0c30H/ 2420H and store the result at
location 0C40H/2440H (result space 21 digits)
Write a program to subtract a 6-digit BCD number residing in location OC30H/ 2420H from
another 6-digit BCD number residing in location 0C20H/ 2400H and store the difference in
location 0C40H / 2440H
Sixteen bytes reside in locations starting from 0C20H/ 2400H. Writea program to sort them
in the same locations according to parity, odd parity bytes first and then even parity bytes
next. Keep the count (in BCD) of odd parity and even parity bytes at 0c30H / 2420H and
OC31H/2421H respectively
12. BINARY TO BCD CONVERSION:
Write a program to converta single byte binary number residing in location 0C20H/2400H,
to the corresponding BCD numberand storeit in location OC2IH/2401H and OC22H/2402H
in packed form
Write a program to convert a BCD number residing at 0C20H / 2400H to its corresponding
binary number and store it at 0C21H/2401H
14. GROUPING ODD, EVEN, DIVIDE BY 4 AND DIVIDE BY 16 BYTES:
Write a program to group 32 bytes residing in locations starting from 0C20H/ 2400H in the
divisible by 4, 8 or ló next, the
following pattern: the odd bytes first, the even bytes but not
even bytes divisible by 4 but not by 8 or
16 next, the even bytes divisible by 8 and 16 last.
their respective counts (in BCD) at 4
They shall be stored in the same locations. Keep
locations starting from OC40H / 2440H
BINARY NUMBERS:
15. MULTIPLICATION OF TWO 5-BYTE
number residing in location at OC20H/ 2400H
Write a program to multiply a 5-byte binary
in location at OC30H /2410H and store the result at 0C40H
by another 5-byte number residing
/2440H (rosult space 10 bytes)
16. L0GICAL OPERATION:
A byte is residing at OC20H1/ 24001H. Write a program to compute the bit S using the logical
expression: S A7.As + As.A4t Az.Ai and store the bit 'S'as MS bit in the location OC21H/
2401H
8-bytes are residing in locations starting from OC20H/ 2400H. Write a program to fill 16
locations starting from 0C40H / 2420H with the corresponding ASCII codes of the nibbles
such that in the consecutive memory locations, the first location shall be filled up by the
coresponding ASCll ofthe lower nibble and the second location with thatofthe higher nibble
A block of 16 bytes resides in locations starting from 0C20OH / 2400H. Write a program to
form a second block of size 1ó with the no. of 1's in the corresponding byte of the first block,
at locations starting from OC30H/2420H. (For e.g. the first entry in the second block will be
the no. of l's in the first entry of the first block.)
A table ofdata is stored in the memory locations starting from OC21H/2401H and he
elements in the table (in BCD ) is given at 0C20H / 2400H.Write a program to detect the
maximum and minimum data byte in the table and store them at 0C10H / 2500H and 0C11H
12501H respectively. Also store the addresses ofthe maximum and minimum bytes at 0C12H
1 2502H and OC13H/ 2503H and at 0C14H/2504H and 0C15H /2505H respectively. Ifthe
maximum and minimum bytes are not unique fill OC12H/ 2502H and OC13H/2503H and
OC14H/2504H and OC15H/2505H with 00H
Write a program to multiply a 5-byte signed binary number residing in location OC20H/
2400H by another 5-byte signed binary numberresiding in location 0C30H/2410H and store
the product in location OC40H/2420H (result space 10 bytes)
Write a program to multiply a 6-digit BCD number residing in location OC20H/ 2400H by
another 6-digit BCD number residing in location OC30H / 2410H and store the result in
location 0C40H/ 2420H (result space 12 digits)
22. BINARY DIVISION:
in
program to divide a word residing in location OC2011 /2400H by byte residing
a
Write a
and
location 0C3011 / 240211 and store the quotient in OC31H/ 2403H (result space bytes)
2
ORDER:
24. SORTING SIGNED BINARY BYTES IN ASCENDING
location starting from OC20H/
Write a program to sort 16-signed binary bytes residing at
locations
2400H in the ascending order and store them at the same
SPECIFIED BYTE:
25. SIZE OF ABLOCK ENDING WITHA
and ends up
block which starts at 0C21H /2401lH
Write a program to estimate the size of a
count (in BCD) at OC90H/ 2490H. The
with a data specified at OC20H/ 2400H. Keep the
is not encountered within 99
specified byte is also a part of the block. If the specified byte
numbers, put EEH at 0C90H/ 2490H
ALTERNATE 00H:
27. SIZE OFA BLOCK ENDING WITH THREE
A block starts at OC0OH/ 2400H and ends where three 0OH at alternate locations (alternate
means a 0OH followed by a non-zero byte, again a 00H and again a non-zero byte and so on)
A block starts at OC20H/ 24001H and ends at OC3FH/ 241FH. Write a program to determine
the number of consecutive locations with identical data and store the count (in BCD) in
location 0C40H /2420H. If three consecutive locations have identical data, the count shall be
2 and so on
A block of memory starting at OC201/2400H has got 32 bytes. Write a program to determine
the number oftimes 00H, 01H, 02H, FEH and FFH occur in it. The counts (in BCD) are to
be stored at locations starting from 0C40H /2420H. Keep the count of any other bytes other
than the above-specified bytes, together at last
Two blocks of 10 bytes each are in locations 0C20H/ 2400H and OC30H/ 2410H
residing
locations starting from
respectively, Write a program to form a third block of 10 bytes at of
OC40H/2420H, such that each entry in that block is the one's complement of the larger
block shall be the
the corresponding entries of the first two blocks (the nth entry in the third
one's complement of the of the nh entry of the first block
larger and the nth entry of the second
block)
32. ADDRESS OF LAST NON-BLANK CHARACTER:
An ASCII string exists in locations starting from C20H / 2400H and ends with a carriage
return ODH. Write a program to store the address of the
last non-blank character at OC10H/
last non-
2500H and 0C1lH /2501H. Also at OC12H /2502H store the index (in BCD) ofthe
the location OC10H/ 2500H,
blank character. If you do not find character in the string filB
00H. Assume the iength of the string is less than
OC11H/2501H and 0C12H/ 2502H with
99
in the string is
An ASCII string exists in locations 0C21H/2401H. The number of characters even
parity
given in 0C20H/2400H (in BCD). Write a program to count string by adding
edit the
the (in BCD) of the edited bytes
bit (at MS bytes) to the bytes having odd parity. Kecp
at OC1FH /2500H
SRISAT
An ASCIl string of characters either with ASCII 0' or ASCII 1' or few characters other than ASCIl
0' or ASCII '1' exists in locations starting from 0C20H/ 2400H and with a carriage return 0DH.
Write a program to convert it to a corresponding byte. Disregard the invalid characters and take first
eight valid characters. The first valid characters encountered should be treated as MS bit. If the string.
which ends with a carriage, return ODH does not contain eight valid characters fill all the remaining
bits with 0s and form the byte. Store the byte in location 0C5OH / 2500H
Write a program to insert the content at the location 0C20H/2400H to a list which begins at
OC22H/2402H, if not already present in the list and only if byte at location 0C20H/2400H
is divisible by two. The number of bytes in the list is given at location 0C21H/ 2401H (in
BCD). If the insertion is valid, insert the byte at the end of the list and modify the count
accordingly
39. MAPPING A RECTANGLE:
16x 8 bytes starting from 0C20H 12400H are considered to be map as rectangle. The starting address
of the left and bottom corner is given in 0CBOH /2500H and 0CB1H/2501H. The number of bits,
which are 1's in that location
a. is given in OCB2H/2502H. The number of bits to be the width
b. is given in 0CB3H / 2503H. The number of bits to be the length
c. is given in OCB4H /2504H. The number of bits to be the height
Write a program to map a rectangle of the above dimensions in the base rectangle with ali high bits
(1's) inside the mapped rectangle. (Refer to the following figure).