CPTR-215 Assembly Language Programming HW#4 due Monday

First a few notes.



NOTE 1: This is a paper and pencil assignment (i.e not using software for assembly language program development).

Note 2: Letters in instruction mneumonics, such as ADD, must all be the same case. I.e ADD or add are ok but Add is not.

Note 3: In class I showed how an immediate value, a constant, can be placed in a register using an ADD or MOV instruction (ADD r2,r3,#41 or MOV r6,#35. I think I may have left the impression that the immediate value could only be an 8-bit value, i.e. in the range 0 to 255. That is not correct. For an add or subract type instruction the immediate value is a twelve bit number and hence has a range 0 to 4095. For the MOV instruction the value can be up to 16 bits long and thus has a range of 0 to 65535.

NOTE 4: When we start using the assembler program, numbers are assumed to be decimal unless special formatting is used. Hexadecimal (base 16) numbers are written with two characters 0x preceeding the significant digits of the hexadecimal number. For example, the decimal value 34 would be written 0x22 in hexidecimal.

Now the HW problems to turn in.

PROBLEM 1: What is in each of the three registers after this instruction executes? ADD r9,r6,r4

PROBLEM 2: Repeat problem 1 for ADD r8,r1,#123

PROBLEM 3: Assume r2 holds a value of 78, r4 a value of 16, and r5 a value of 21. What value will be in each of these registers after this instruction is executed: ADD r2,r5,r4?

PROBLEM 4: Write an instruction that will place a value of 237 in register r9

PROBLEM 5: Assume that register 4 contains variable A, register 5 contains variable B, and register 6 contains variable C, and register 7 contains variable X. Write a sequence of instructions that will perform this arithmetic operation: X = A + B + C + 10.

PROBLEM 6: Write an instruction that will place 0x3d45 in register r0.

PROBLEM 7: What is in register r8 after this instruction executes: ADD r8,r8,r8

PROBLEM 8: Produce a table (diagram) that shows the values in each memory location of an ARM system starting at address 0x00000000 and ending at address 0000000f with the following values stored as 32-bit values in order using little-endian form: 0x1034e290, 0x004c7f24, 0x91b27cef, 0x27aa5f21

Larry Aamodt PhD, PE
Professor of Engineering and Computer Science
Walla Walla College
Contact:
via email: AamoLa (at) wallawalla.edu
via phone: x2058