Assignment 10, due April 10
Part of
the homework for CS:2630, Spring 2015
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
1 = 000000000001 010000000000 000000000000 (exp = 1, mantissa = 1/2) 10 = 000000000100 010100000000 000000000000 (exp = 4, mantissa = 5/8) 0.1 = 111111111101 011001100110 011001100110 (exp = -3, mantissa = 8/10)
a) Given a floating point number in IEEE format in R3, write code to extract the exponent from that number and convert it to PDP-8 format in the least significant 12 bits of R4, leaving R3 unchanged. You may use R5 as a scratch register. Assume that the number is neither unnormalized nor a NaN. (0.5 points)
b) Given a floating point number in IEEE format in R3, write code to extract the mantissa from that number and convert it to PDP-8 format in the least significant 24 bits of R3 (the most significant 8 bits of R3 must be set to zero). You may use R5 and R6 as scratch registers, if necessary.
sin x ≅ x – x3/6 + x5/120
A Problem: Given that the Hawk floating point coprocessor is already turned on, and given the value of x in R3, write Hawk code (not a subroutine, just straight line code) that computes the above approximation for sin x, leaving the result in R3. (1 point).
Note: You may need some place to store intermediate results. You can use R4 and up if necessary.
FF100010 |
| Parallel-port data register | ||||||||||||||||
FF100004 |
| Parallel-port status and control register | ||||||||||||||||
IE = interrupt enable (control) | ||||||||||||||||||
ER = error (status) | ||||||||||||||||||
DR = direction (control, in = 0) | ||||||||||||||||||
RD = data ready (status) |
Parallel ports were frequently bidirectional, able to serve both as input or output ports, hence the addition of a DR control bit to set the data transfer direction. As an input port (DR = 0), RD = 1 indicates that the data register contains new input data; reading the data register will reset RD. As an output port (DR = 1), RD = 1 indicates that the data register is ready for new output data; writing the data register will reset RD. (1 point)
A problem: Write Smal Hawk code for a PUTPAR routine that outputs one 8-bit byte to the parallel port. This should not use interrupts, it should set the direction to output, wait for ready, and then transfer data to the device.