I wonder if anyone uses FASM as their assembler as most people use NASM which is also used by most tutorials. After having a discussion on the FASM foruns about PIC (Position Independent Code) I discovered this beautiful directive call "virtual".
A quick example:
Code: Select all
call getEIP_and_continue
getEIP_and_continue:
; pop EIP into EBP
pop ebp
;; position Independent
mov eax, [label]
.....
;; program's data section
virtual at ebp + ($ - getEIP_and_continue) ; $ is the current position in code
label: dd 0x0
end virtual