Homework 7 - Macros/Bit Manipulation
Assignment
Write a program to:
- Input a 32-bit decimal number,
- Reverse the number using a macro that reverses the bits in a 32-bit
value. Use bit manipulation instructions of Chapter 6.
- Output the reversed value,
- Reverse the reversed value,
- Output the reversed reversed value. Because reverse is its own inverse,
this provides a test that the reverse macro is working correctly.
Macro Requirements
IMPORTANT:
-
Save and restore any registers indirectly changed by code in a macro.
-
If no actual parameter is supplied the macro should display an error message to
the console.
-
When labels are used inside a macro definition, ensure that each invocation
of the macro produces unique labels (i.e. use local operative).
Turn In
-
Cover page - Your name, date, and Homework 7.
-
Assembler program - Well documented copy of the Hw7.asm file,
-
Assembler listing - HW7.lst printed in landscape mode.
-
Program output - Test using the values: 1, 2147483647, 1073741824, -1.
- Isolate a single bit at a time and place in the result:
- An easy method is to rotate or shift the input value one bit, the one
bit is in the carry flag.
- Rotate the carry flag into the result, rotating in the opposite
direction the input value is rotated or shifted.
- Write out an algorithm by hand before using the computer.
Document last modified: