CSE 2312 - Assignments

Practice Assignment 11 (Not Graded)


Practice Question 1

Write an assembly function compare_arrays that returns 1 if two integer arrays are equal (meaning the elements at each position are equal) and returns 0 otherwise. You should decide and specify exactly what (and how many) arguments this function should take.


Practice Question 2

Why does ARM-7 impose the constraint that constant arguments to instructions such as add, sub, and, mov are 8-bit integers (that are possibly shifted)? Why not allow general 16-bit integer or 32-bit integers?


Practice Question 3

Consider this line of assembly code:
push {r4, r5, r6, lr}
Is this correct code or not? If correct, is it a real instruction or a pseudo-instruction? If it is a pseudo-instruction, translate it into real instructions.


Practice Question 4

Consider this line of assembly code:
mov r1, #0x00f3f000
Is this correct code or not? If correct, is it a real instruction or a pseudo-instruction? If it is a pseudo-instruction, translate it into real instructions.


Practice Question 5

Consider this line of assembly code:
mov r1, #0x001f8000
Is this correct code or not? If correct, is it a real instruction or a pseudo-instruction? If it is a pseudo-instruction, translate it into real instructions.


Practice Question 6

Consider this line of assembly code:
ldr r1, #0x001f8ab0
Is this correct code or not? If correct, is it a real instruction or a pseudo-instruction? If it is a pseudo-instruction, translate it into real instructions.


Practice Question 7

Consider this line of assembly code:
ldr r1, =0x001f8ab0
Is this correct code or not? If correct, is it a real instruction or a pseudo-instruction? If it is a pseudo-instruction, translate it into real instructions.


Practice Question 8

Consider this piece of assembly code:
	mov sp, #0x100000
	ldr r1, =0xabcdef12
	ldr r2, =0x34567890
	push {r1}
	push {r2}
	ldr r3, [sp]
	ldrb r4, [sp]
	ldr r5, [sp, #4]
	ldrb r6, [sp, #4]
Specify, in hexadecimal, the contents of r3, r4, r5, r6 after this piece of code executes.


Back to the list of assignments.