0% found this document useful (0 votes)
3 views

mpmc lab print

The document outlines a series of programming assignments focused on microprocessor applications, including tasks such as moving data between registers, performing arithmetic operations, and manipulating memory locations. It covers a variety of operations like addition, subtraction, multiplication, sorting, and conversions between binary and BCD formats. Each assignment specifies the memory locations involved and the expected outcomes, providing a comprehensive practice program for microprocessor programming skills.

Uploaded by

btech10220.23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

mpmc lab print

The document outlines a series of programming assignments focused on microprocessor applications, including tasks such as moving data between registers, performing arithmetic operations, and manipulating memory locations. It covers a variety of operations like addition, subtraction, multiplication, sorting, and conversions between binary and BCD formats. Each assignment specifies the memory locations involved and the expected outcomes, providing a comprehensive practice program for microprocessor programming skills.

Uploaded by

btech10220.23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

SRISMT

PRACTICE PROGRAMS:
1 WAP to move 32H to register C and verify the contents of register C.

2. WAP to move the contents of


register B to register A if register 8 contains 78H and verify the
contents of both the registers.
3. WAP to find out the 2's
complement of a number stored at location 230OH.

4. WAP to store two numbers 12H and 78H in


registers C and D respectively and add them
together. Verify the result by viewing the contents of registers and also store
the result at
/2400H.
S. WAP to store the contents of BC
register pair to the stack if the BC pair is initialised to 27#FH
and retrieve back the contents of BC
pair.
6. WAP to store the contents of
register A and Flag register to the stack.

7. A number is stored at location


23FFH. WAP to rotate it right 2 times and then rotate
it left 4
times and store it at 2400H.
Verify the result whether it is two times of the original value or
not.
7

8. A byte given location 2400H. WAP to perform the following


is at

i) XRA, i) ANA, ii) ORA, iv) XRI,06H, V)ANI,O1H, Vi)


ORI,0FH
Store the result starting from location
2500H
9. WAP to increment the
register pair BC by two and decrement the register pair OE by one if
they are initialised to locations 29FEH and 2300H respectively.
10. WAP to compare two
numbers stored in register Cand D respectively. if the content of C is
greater than the content of D, store EtH at location 2500H otherwise FFH.

S-A
EC4206 MICROPROCESSOR
APPLICATION LABORATORY
1. REARRANGING BYTES:

16 bytes are residing in locations


transfer these bytes in
starting from 0C2011 240011. Write a

bytes in the
locations starting from 0C401I/2500H
tirst block should in such
that first 8
a
program to

appear at last 8 locations of the second blockway


bytes in the first block at first 8 locations of the second and the last 8
block
2. CHECKING BITS OF A WORD:

A word is residing in location 0C40H / 2400H.


word program to check each bit Write a
starting from Ms bit and fill 16 locations
from 0C201H/ 2500H. with of
the
00H or FFH
depending
on the bit, FFH if
starting
either
the no. of l's and 0's bit is '1' and 00H if the
bit is 0'. Also count
(count BCD) in the word and store them
in
2420H and OC3iH/2421H respectively at 0C3OH/
3. FILLANG UP 128 LOCATIONS:
Write a
program to fill up 128 locations
first 64 locations to bestarting
from OCO0H / 2400H with
following pattern: filled up as 00H.
bytes in the
11H. 22H, and 1IH. 22H. --- FFH, 00H.
---------

so on and the last 64 locations to be filied up


---. O0H, FFH, EEH, DDH and so on
as FFH. EEH. DDH.

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)

9. ADDITION OFTWO 20-DIGIT BCD NO's:

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)

10. BCD SUBTRACTION:

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

11. SORTING EVEN AND ODD PARITY BYTES:

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

13. BCD TO BINARY CONVERSION:

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

Note: Bold indicates complement

17. CONVERSION OF NIBBLES TO ASCII CODES:

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

18. NUMBER OF BITS IN BYTES:

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.)

19. MAXIMUM AND MINIMUM BYTES:

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

20. 5-BYTE x 5-BYTE BINARY MULTIPLICATION:

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)

21. BCD MULTIPLICATION:

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

remainderin location OC321/2405H


23. SORTING SIGNED BYTES:

OC20H /2400H in the same


Write program to sort 16 signed binary bytes residing in location
a
zero bytes and then
locations in such a way that the positive numbers should appear first, then
and store the
the negative numbers. Count the numbers of positive, zero and negative bytes
counts (in BCD) 3 locations starting from 0Cc30H / 2410H respectively

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

26. SIZE OF A BLOCK STARTING WITH


O0H AND ENDING WITH 60H:

and 0CAOH /24A0H starts with 00H and ends


A block of memory between 0C00H/the2400H
with 60H. Write a program to count number of bytes in the block. The two bytes 00H and
60H should not be included in the count. The count (in BCD) should be kept at OCA1IH/
24A1H. If the count is more than 99, store EEH at 0CAIH /24AIH

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)

are found. Write a program to


estimate the size of the block including the three 00H. Keep the
count at location 0CA1H / 24A1H. If the count is more than 99, store EEH at
(in BCD)
OCAIH /24AIH

28. NUMBER OF TIMES FFH OCCURS AS PAIR:


Write a program to count the
A block starts at OC20H / 2400H and ends at OC2FH / 240FH.
number of times FFH occur as memory pairs and keep the count (BCD) in location 0C30H/
2410H. If four consecutive locations are filled up with FFH the count shall be 2 and so on
29. CONSECUTIVE. MEMORY LOCATIONS WITH IDENTICAL DATA:

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

30. COUNT OF SPECIFIED BYTES:

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

31. FORMATION OFA THIRD BLOCK:

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

33. REPLACING TRAILING ZEROS WITH BLANKS:

The number of characters in the string is


An ASCII string starts in location OC21H /2401H.
to edit the string by replacing all trailing
given in 0C20H/ 240OH (in BCD). Write a program
zeros by blanks (ASCII for blank is 20H and zero is 30H)

34. ADDING EVEN PARITY TO ASCII CHARACTERS:

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

35. COMPARISON OF TWO ASCII


STRINGS:
TwoASCIl string starts at locations OC2111/24011 and
OC41/ 2501H respectively. The
alphabets in the first string are in capital whereas those in the second string are in small. The
numbers of Characters (in BCD) are
given at OC2011 / 2400H and OC40H/ 2500H. Write a
program to compare the two strings. If there is one-to-one
strings fill the locationOC60H/ 2600H with FFH, correspondence between the two
otherwise with ( H
36. ASCII TO HEXADECIMAL CONVERSION:
10 bytes are residing in locations starting from OC20H/ 2400H. Write a program to check
whether each of them is an ASCll representation of characters OH to FH. Îf so replace them
by their corresponding hexadecimal character at the same location, otherwise fill the
corTesponding location with an error code 00H

37. AN ASCII STRING TO BYTE CONVERSION:

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

38. INSERTION TOA LIST:

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).

You might also like