Virtual Directive

Programming, for all ages and all languages.
Post Reply
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Virtual Directive

Post by Bender »

Hi,
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
Do any other assemblers support this directive?
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
Post Reply