Hardware Reference
In-Depth Information
E2.13 Write a program to count the number of even elements of an array of N 16-bit elements.
The array is stored at memory locations starting from $1010. N is no larger than 255.
E2.14 Write an instruction sequence to shift the 32-bit number to the left four places. The 32-
bit number is located at $1000,$1003.
E2.15 Write a program to count the number of elements in an array that are smaller than 16.
The array is stored at memory locations starting from $1010. The array has N 8-bit unsigned
elements.
E2.16 Write an instruction sequence to swap the upper four bits and the lower four bits of ac-
cumulator A (swap bit 7 with bit 3, bit 6 with bit 2, and so on).
E2.17 Write a program to count the number of elements in an array whose bits 3, 4, and 7 are
0s. The array has N 8-bit elements and is stored in memory locations starting from $1000.
E2.18 Write an instruction sequence to set bits 3, 2, 1, and 0 of memory location at $1000 to 1
and leave the upper 4 bits of the same location unchanged.
E2.19 Find the values of condition fl ags N, Z, V, and C in the CCR register after the execution
of each of the following instructions, given that [A] 5 $50 and the condition fl ags are N 5 0,
Z 5 1, V 5 0, and C 5 1.
a. suba #40
b. tsta
c. adda #$50
d. lsra
e. rola
f. lsla
E2.20 Find the values of condition fl ags N, Z, V, and C in the CCR register after executing each
of the following instructions independently, given that [A] 5 $00 and the initial condition codes
are N 5 0, C 5 0, Z 5 1, and V 5 0.
a. tsta
b. adda #$40
c. suba #$78
d. lsla
e. rola
f. adda #$CF
E2.21 Write an instruction sequence to toggle the odd-number bits and clear the even-number
bits of memory location at $66.
E2.22 Write a program to shift the 8-byte number located at $1000,$1007 to the left four
places.
E2.23 Write a program to shift the 6-byte number located at $1010,$1015 to the right three
places.
E2.24 Write a program to create a time delay of 100 sec by using program loops, assuming that
the frequency of the bus clock is 24 MHz.
E2.25 Write a program to create a time delay of 5 sec using program loops, assuming that the
frequency of the bus clock is 24 MHz.
E2.26 Write a program to evaluate
a 2 x 2 1 a 1 x 1 a 0
Plug in values to verify that your program is correct.
E2.27 Write a program to evaluate
a 3 x 3 1 a 2 x 2 1 a 1 x 1 a 0
Plug in values to verify that your program is correct.
 
Search WWH ::




Custom Search