There’s a good guide to x87 FPU by Raymond Filiatreault. Chapter 1 explains how the FPU register stack works.
Yes, fld st(0)
pushes a copy of the top of the stack. The Intel insn ref manual explicitly mentions this special-case use of fld st(n)
I believe you’re right that fstp
does pop after the fild
.
- The first
fild / fstp
pair converts a globalint
(at L1000F140) to a float on the stack. - Then
fld st(0)
duplicates the top of the stack (i.e. the value that was there before thefild/fstp
). - Then divide that value by another global, and multiply by another.
- final stack:
st(0)=orig / global1 * global2 st(1)=orig
Related Posts:
- How to move ST(0) to EAX?
- What’s the purpose of the LEA instruction?
- Understanding cmp instruction
- What does the MOVZBL instruction do in IA-32 AT&T syntax?
- What’s the purpose of the LEA instruction?
- The point of test %eax %eax
- What does the MOVZBL instruction do in IA-32 AT&T syntax?
- What’s the purpose of the LEA instruction?
- The difference between cmpl and cmp
- x86 cmpl and jne
- What is the function of the push / pop instructions used on registers in x86 assembly?
- What is callq instruction?
- Purpose of ESI & EDI registers?
- What are the ESP and the EBP registers?
- IDIV operation in assembly (understanding)
- explanation about push ebp and pop ebp instruction in assembly
- x86 assembly: How does the ‘subl’ command work in AT&T syntax
- what does the cmpq instruction do?
- Purpose of ESI & EDI registers?
- Bubble sort on array on Assembly Language
- Nasm Error: invalid combination of opcode and operands
- When and why do we sign extend and use cdq with mul/div?
- How do AX, AH, AL map onto EAX?
- pop or add esp, 4 ? What is the difference?
- What is the difference between MOV and LEA?
- `testl` eax against eax?
- Difference between JE/JNE and JZ/JNZ
- Printing out a number in assembly language?
- What does `dword ptr` mean?
- Difference between JA and JG in assembly
- what does the the dword operand do in assembly
- What does the LEAL assembly instruction do?
- [Binary Bomb – Phase 4
- assembly “mov” instruction
- Why shift a bit using sll and such in MIPs Assembly?
- Assembly code vs Machine code vs Object code?
- Understanding how `lw` and `sw` actually work in a MIPS program
- need help understanding the movzbl call in this function
- MIPS: lw (load word) instruction
- What is the meaning of XOR in x86 assembly?
- What does the BEQ instruction do exactly?
- What’s the size of a QWORD on a 64-bit machine?
- MIPS assembly for a simple for loop
- Difference between JA and JG in assembly
- mips .word function and differences between 2 codes
- Display value found at given address gdb
- Why doesn’t there exists a subi opcode for MIPS?
- Convert C program into assembly code
- LC3 LEA instruction and the value stored
- What exactly does the lb instruction do?
- lc3 LDR instruction and the value stored
- What is the difference between la and li in opcodes in MIPS?
- What does movslq do?
- Assembly language je jump function
- What are .S files?
- Why are rbp and rsp called general purpose registers?
- x86 Assembly pointers
- what is the use of ori in this part of MIPS code?
- Storing a user’s input in MIPS
- Integer absolute value in MIPS?
- xorl %eax – Instruction set architecture in IA-32
- MIPS Assembly – lui $t0, 4097?
- Greater than, less than equal, greater than equal in MIPS
- Assembly addq clarification
- Which variable size to use (db, dw, dd) with x86 assembly?
- MIPS program jr $ra instructions and stack handling
- Assembly – JG/JNLE/JL/JNGE after CMP
- Subtract two input numbers
- writing functions in assembler
- JNZ & CMP Assembly Instructions
- X86 assembly – Handling the IDIV instruction
- Assembly language (MIPS) difference betweent addi and add
- MIPS Address out of range (MARS)
- Difference between “addi” and “add” for pseudoinstruction “move” in MIPS?
- sorting array in mips (assembly)
- what is a file handle and where it is useful for a programmer?
- How does `Skipcond` work in the MARIE assembly language?
- What are callee and caller saved registers?
- Multiplication by a power of 2 using Logical shifts in MIPS assembly
- MIPS instruction and machine code
- Convert from Java to MIPS
- Understanding Assembly MIPS .ALIGN and Memory Addressing
- error A2022: instruction operands must be the same size
- What’s the difference between a word and byte?
- Assembly Language – How to do Modulo?
- Difference between movq and movabsq in x86-64
- What is the jmpq command doing in this example
- Assembly – JZ instruction after CMP
- What does bx lr do in ARM assembly language?
- `js` and `jb` instructions in assembly
- Difference between masm32 and masm?
- C to assembly – leaq instruction
- While, Do While, For loops in Assembly Language (emu8086)
- movq assembly function
- Bubble sort algorithm in MIPS
- How do I correctly use the mod operator in MIPS?
- Assembly x86 – “leave” Instruction
- How do I compile the asm generated by GCC?
- GDB no such file or directory
- What is between ESP and EBP?