Page 1 of 1

Asm uninitialized data

Posted: Sun Jul 03, 2011 2:44 pm
by jfl
I am trying to use uninitialized variables in my os but can't figure out how. A sample of the code I have so far is:

Code: Select all

22: mov test,0xDE
23: section .bss
24: test: resb 1
When I build it using

Code: Select all

nasm -f elf -o load.o load.s
, it outputs:

Code: Select all

src/load.s:22: error: invalid combination of opcode and operands
I've tried adding square brackets but it doesn't work.

Re: Asm uninitialized data

Posted: Sun Jul 03, 2011 4:10 pm
by bluemoon
jfl wrote:I've tried adding square brackets but it doesn't work.
I add square brackets and nasm tell exactly the issue:

Code: Select all

error: operation size not specified
The solution to this mystery error message is specify the operation size.

Code: Select all

mov byte [test], 0xDE
ps: test is not a good name for variable label.

Re: Asm uninitialized data

Posted: Mon Jul 04, 2011 12:27 am
by xenos
bluemoon wrote:ps: test is not a good name for variable label.
...because "test" is an x86 instruction.