PROBLEMS FOR 8085 ASSEMBLY LANGUAGE PROGRAMMING
1. Write a program, which loads registers, A, B, C and D with an identical constant [e.g.$C0]. Try to optimize the program in such a way that the smallest number of program bytes is used. Test the program in single-step mode. After each step test, the register (s) of interest.
2. Assume that 3 bytes of data are stored at consecutive memory addresses of the data-memory starting at Y. Write a program which loads register C with (Y), i.e. with data contained at memory address Y, D with (Y+1), E with (Y+2) and A with (Y+1).
(i)Use register indirect addressing, and
(ii)Use direct addressing mode (LDA instruction), and Compare (i) and (ii) in terms of memory requirement.
3. Test the above 3 programs at the end of each single step. Choose Y within an address of RAM available as per result of the memory map experiment (v).
4. Assume that 2 bytes of data are stored at the consecutive addresses of data-memory starting at address Z. Use indirect addressing i.e. addresses Z', Z'' and Z''' specified by 3 register pairs DE and BC and HL. Write a program which moves the data from addresses Z and Z+1 to addresses Z' and Z'+1, then to addresses Z" and Z"+1,and then to address Z''' and Z'''+1. Test the program by executing it using GO command, and then by checking at the data-memory addresses, Z', Z'+1 Z'', Z''+1, Z''' and Z'''+1.
5. Assume that 1 byte of data is stored at a data-memory address Q. Write a program which tests bit 3 of (Q)[i.e. 4th bit from lsb], write ÿ into a memory address Q+5, if bit 3 = '0', and write $00 at the same address in case bit 5 = '1'. Test the program, during execution itself in run-mode.
6. Write a program which tests if any bit is '0' in a data byte specified at an address R. If it is so, $00 would be stored at address R+1 and if not so then $FF should be stored at the same address. We test the program in run-mode.
7. Write a program, which test if the all-odd bits are '1' in a data byte at a data-memory location S. If it is so store $01 at S+1, else stores $00 at the same location.
8. Sixteen bytes of data are specified at consecutive data-memory locations starting at Z. Write a program which increments the value of all sixteen bytes by $01.
9. Two data-bytes are stored at addresses Y and Y+1. Interchange the data bytes at these two addresses using (i) indirect addressing and (i) direct addressing. Execute the two programs and get the identical results. Also find the difference in memory space used by these two programs.
10. Eight bytes (unsigned binary numbers) with upper nibble zero in each byte are stored at consecutive data-memory address starting Q. Compute the sum of the eight bytes and store it at an address Z. Use indirect addressing.
11. Two unsigned binary numbers are stored at consecutive data memory addresses X, X+1. Write a program for computing (X+1) - (X) by using only the ADD instruction. The magnitude of the result should be stored at register C and the sign at D, ($00 if positive and $01 if negative) D using the 2's complement concept.
12. A double precision number (i.e. a 16 bit unsigned number) is stored at Z and Z+1 (lower byte at X). Another double precision number is stored at Z' and Z'+1. Add the two numbers and store result at Z'' and Z''+1 and double this number and store the result at Z''' and Z'''+1.
13. A double precision number (i.e. a 16 bit unsigned number) is stored at Z and Z+1 (lower byte at X). Another double precision number is stored at Z' and Z'+1. Subtract the two numbers and store the result at ZIV and ZIV+1.
14. Two 2-digit BCD numbers, each less than 128 decimal, are stored at the two consecutive memory addresses, Q and Q+1. Write a program for computing the sum and storing the result at address Q+2 using a decimal adjust instruction.
15. Two 2-digit BCD numbers are stored at consecutive memory addresses, Q+3 and Q+4. Compute the difference of the two numbers and store the result at location Y. Use decimal subtraction with the aid of DAA and 1's complement.
16. (i) Two-digit BCD number is stored at memory address X. Convert the number into binary and store the result at an address Q.(ii) An 8-bit binary number is stored at data memory location Y. Convert it into decimal (BCD) and store the result of the address Q.
17. Write a program which decrements a counter (i.e. a binary number stored at register C) one by one and halts when the counter value is zero. Test the program in single-step. Again modify the program, which increments the contents of C up to decimal 100.
18. A counter can be defined as a register, a register pair or a memory address whose content gets incremented or decremented. Define such a counter as subroutine. Write a program for the generation of 2 different time-delays using the same subroutine. Implement this program by using following steps: (i) Set initial value for delay 1[=input parameter of subroutine], (ii) Call subroutine named count, (iii) Set initial value for delay-2, (iv) Call counter subroutine, (v) Jump to step( i). Set the counter to a small initial value and test the program in a single-step mode.
19. Assume crystal frequency = 6MHz. Implement a time-delay loop (counter) for the generation of a 50ms delay. Using monitor delay routine at an address $0559 and described in section VIII.6.
20. Assume crystal frequency = 4MHz. Implement a time-delay loop (counter) for the generation of a 60s delay. Using monitor delay routine at an address $0559 and described in section VIII.6. Test this program with the help of your wristwatch by inserting a RST0 instruction such that the program transfers (its control) to the monitor after execution of the time-delay in order to display of initial boot message after 60s.
21. A binary number less than decimal 25 is stored at memory address X. Multiply the number by 6 and store the result at X+1.
22. Now multiply by 10 using a formula: X. 10 = X. 2 + X. 23, and using a concept that a multiplication by 2 corresponds to a shift left by one bit.
23. Write a program for a decimal counter (00-99), which is programmable for the clock-frequency (e.g. frequency can be specified as 6MHz or 4MHz at memory address Q) and display the count in the data-field using a corresponding monitor subroutine.
24. Same as problem No. 23 but let the counter count from decimal 00 to a given decimal number (stored at a data-memory) where it gets reset and starts again.
25. S binary numbers are stored at consecutive data-memory addresses starting at Y, where S is defined at a memory address Z. Find the largest number and store the result at address Z'.
26. S binary numbers are stored at consecutive data memory addresses starting at Q. Rearrange the numbers in ascending order.
27. Write a program for moving a Data-block of 100 bytes. Assume starting address of source block at $0000 and destination is from memory address $2000.
28. N bytes start from address Q. These are to be moved to address Q+N+1. The addresses for Q and N are specified at address X.
29. Given two integer numbers stored at memory locations Q and Q+1. Write a program for displaying the greatest common factor (GCF).
30. With the given conditions of problem at serial number 22 above, write a program to divide a number by 10 (instead of multiply). Assume that the number is in multiple of 10,and is less than 251.
31. A binary number is stored at data-memory location Q+5. Compute the number of its logical 1's and store the result at Q+6.
32. In computer communication, data bits are often transmitted in ASCII (abbreviation for American Code for Information Interchange) format. This code consists of 128 symbols for numbers, letters and signs, out of which the hexadecimal characters have the representations as given in table VIII.6. Assume that a hex-decimal character is stored in its ASCII code at address Z. Store the corresponding character at another address at Z'.
33. A code word is stored at data-memory location X. Write a program for testing whether the code word belongs to the ASCII code for decimal 0. Set address to $FF if YES and $00 if NO. [Refer table for ASCII code.]
Note: These problems are solely for downloading by a student for own person learning. These problems are author and publisher's copy-right. Any use in a book or published material or printed tutorial will warrant action under the Copyright act by the author and his book publishers from where these has been taken. Students are advised to solve all the problems for best preparation of €85 programming. Students are also free to ask any difficulty through this website 'query' link. - Author