Bona Fide OS Development

dd eax not working
Page 1 of 1

Author:  jflanagan987 [ Wed Mar 23, 2011 4:36 pm ]
Post subject:  dd eax not working

When I try to write the value of eax to ram using
dd eax
nasm gives me an error message saying:
error: operand 1: expression is not simple or relocatable
I don't see how I'm doing it wrong because the code looks fine to me.

Author:  losethos [ Thu Mar 24, 2011 1:38 am ]
Post subject:  Re: dd eax not working

"dd" is "define double". Puts a constant in a spot. It is not an instruction.

You want to use the "mov" instruction.

    mov [01000h],eax

Something like that. You better start with a book on asm, honestly.

Author:  jflanagan987 [ Thu Mar 24, 2011 10:13 am ]
Post subject:  Re: dd eax not working

example: resd 1
mov [example], eax
should work? I'll try it.

Author:  brenden [ Tue Aug 23, 2011 1:14 am ]
Post subject:  Re: dd eax not working

Yep, losethos is right, you need to use the `mov` command and they way you are using it now should move the value in `eax` and move it intomemory at the address labeled `example`. But what is the `resd` opcode? I've never seen that and can't find any reference to it in the intel x86 opcode list.

Author:  jflanagan987 [ Wed Aug 31, 2011 4:12 pm ]
Post subject:  Re: dd eax not working

Resd reserves a double word(the 1 means only reserve one) but I have now found out that it can only be used in the bss section. I understand now that DD actually puts the value in that place in the executable which ends up in ram.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group