Tekil Mesaj gösterimi
Alt 06-09-2008, 15:19   #21
Constantin
ยŦยк
 
Constantin - ait Kullanıcı Resmi (Avatar)
 

Z80 ASSEMBLY LANGUAGE PROGRAMMING EXERCISES



1. k is the contents of memory location FC00H representing an unsigned 8-bit number. Write a Z-80 Assembly language program that computes the following equations depending on the initial value of k. Store the result in memory location FC00H.



2. Write a Z-80 Assembly language program that adds the two digits of a BCD number in memory location FC00H. Place the BCD result in memory location FC01H.

example: Address Contents of Memory Loc.
FC00 39H
FC01 12H ; <== 3+9=12 (BCD result)

3. Write a Z-80 Assembly language program that computes the 2’s complement of a 16-bit number stored in memory locations FC01H (LObyte) and FC02H (HIbyte). Store the result in in memory locations FC03H (LObyte) and FC04H (HIbyte). See the example given on the right hand side.

example: Address Contents of Memory Loc.
FC01 FFH
FC02 C6H
FC03 01H Result: LObyte
FC04 39H Result: HIbyte

C6FFH= 1100011011111111B
2’s complement= 0011100100000001B


4. Write a Z-80 Assembly language program that merges the least significant digits of two bytes in memory locations FC00H and FC01H. The most significant digits of the bytes will be discarded. (see the example). Place the resulting byte into memory location FC02H.
example: Address Contents of Mem. Loc.
FC00 2AH
FC01 C3H
FC02 A3H  result


5. Write a Z-80 Assembly language program that adds ten numbers (8-bit each) stored in memory locations F000H-F009H with ten numbers (8-bit each) stored in memory locations D000H-D009H. Assume that the results of additions are also 8-bit and store the results in memory locations F000H-F009H.
contents of memory location F000H + contents of memory location D000H will be stored in memory location F000H
contents of memory location F001H + contents of memory location D001H will be stored in memory location F001H
and so on (ten additions in total). In your program, use a program loop and index registers as address pointers.


6. Write a Z-80 Assembly language program that adds two 32-bit numbers in memory locations FC00H-FC03H and FC04H-FC07H, respectively (use a program loop). The least significant bytes of both numbers are in memory locations FC00H and FC04H respectively. Store the result in memory locations FC08H-FC0BH.
Constantin Ofline   Alıntı ile Cevapla