Usage of x87 fstp instruction - popped value showing up in ST7?
14:17 15 Jan 2014

I have a question: let's say my stack of the Floating-point unit is as follows:

ST0 = +1.5000000000000000e+0001   
ST1 = +5.0000000000000000e+0000  
ST2 = +2.5000000000000000e+0001   
ST3 = +0.0000000000000000e+0000  
ST4 = +0.0000000000000000e+0000   
ST5 = +0.0000000000000000e+0000   
ST6 = +0.0000000000000000e+0000   
ST7 = +0.0000000000000000e+0000  

After doing this instruction:

fstp st(1) 

My prediction it that the unit would send the st(0) to st(1) (the situation on the stack would be 1.5; 1.5; 2.5; 0 etc.) and then pop the top of the stack so the situation would be 1.5; 2.5; 0 etc.

Instead, I see the following:

ST0 = +1.5000000000000000e+0001   
ST1 = +2.5000000000000000e+0001   
ST2 = +0.0000000000000000e+0000   
ST3 = +0.0000000000000000e+0000   
ST4 = +0.0000000000000000e+0000   
ST5 = +0.0000000000000000e+0000   
ST6 = +0.0000000000000000e+0000   
ST7 = +1.5000000000000000e+0001  

My question is, why has st(7) changed and how can I achieve my expected results?

assembly masm fpu x87