|
Floating Point Unit (FPU) Quick IntroThere is very little that I can tell you about the FPU without going into great depth like they do on the Art of Assembly pages (see References). However, just to get you started understand that the FPU is a stack based processor. Most instructions work in the following manner: push operand one, push operand two, call operator. I.e.
fbld N1
fild N2
fadd
fbstp
| | | | | | | |
|------| |------| |------| |------|
| | | | | | | |
|------| |------| |------| |------|
| | | | | | | |
|------| => |------| => |------| => |------|
| | | | | | | |
|------| |------| |------| |------|
| | | N2 | | | | |
|------| |------| |------| |------|
| N1 | | N1 | | N1+N2| | |
------ ------ ------ ------
Notice that any two operands may be pushed on to the FPU (in this case an integer and a packed decimal). The FPU automatically does the necessary conversions. Additionally, a number may be popped off in any format. You will find that packed BCD is easiest for the FPU project, so it is a good idea to write a function that converts string2BCD and BCD2string. As you work with the FPU you will want to draw diagrams of the stack to double check your calculations. Include these drawings with your program. If you have bugs, please bring the stack diagrams with you when you come to see me - this is the simplest way for me to see what you are doing. Last Modified: January 26, 1999 - Barry E. Mapen |