From: Jakob B. <jb...@wi...> - 2010-12-17 10:07:55
|
On 17-12-2010 07:27, Littlefield, Tyler wrote: > hello all, > I have a quick question. > I have the following: > section .data > ptr dd 0 > array times 100 db 0 > > Now, when I want to assign array to p, I can't mov it--how can I assign > the pointer to point there? Last, is there a way to get the type of > processor? > (32-64), as that will make a difference on the code in some places? > ; For 32 bits, I think this should assemble just fine: ptr dd 0 array times 100 db 0 mov [ptr], array ; For 64 bits, The code should become ptr dq 0 array times 100 db 0 lea rax,[array] ; Add some notation here to make this rip relative! mov [ptr], rax I don't know how to test if nasm is compiling for 16, 32 or 64 bits with assembler directives, sorry I don't do that much nasm coding these days. |