Homework 6
22C:18, Spring 1996
Due Tuesday Mar. 5, 1996 in discussion
Douglas W. Jones
Consider the following bit of M68000 assembly code for the Macintosh:
START: LEA START,A4
MOVE.L X,D3
JMP START
DATA
X: DS.L 1
END
-
Hand assemble the above code, showing the entire contents of the code segment
of this program as a sequence of 8 bit bytes, with the contents of every
byte given in binary.
-
For each operand referenced in the above code, describe the exact addressing
mode that is used, including whether this mode is implied by the opcode or
dictated by some mode field, and what register(s) (if any) the mode uses.
-
Conside the following Pascal (and C) type declarations for the representation
of home-made floating point numbers with exponent and mantissa fields:
TYPE FLT = RECORD TYPEDEF STRUCT FLT {
EXP: INTEGER; INT EXP;
MANT: INTEGER; INT MANT;
END; } FLOAT;
Both exponent and mantissa fields are integers! The abstract value of a
number in this system is MANT*2**EXP where the ** operator
is used for exponentiation. The normalization rule is that the mantissa
is always odd unless it is zero. Write a procedure (in Pascal or C) that,
when passed two floating point numbers represented in the above format and
adds them, returning a result in the first argument.
-
Consider the assignment A=(A*B)+C, where A, B and C are stored in
D1, D2 and D3 and where each variable is a 16 bit fixed point number with
4 places after the point. Write M68000 code to implement the given
assignment.