Asm uninitialized data

Programming, for all ages and all languages.
Post Reply
jfl
Posts: 9
Joined: Thu Dec 23, 2010 12:34 pm

Asm uninitialized data

Post 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.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Asm uninitialized data

Post 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.
User avatar
xenos
Member
Member
Posts: 1118
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Asm uninitialized data

Post by xenos »

bluemoon wrote:ps: test is not a good name for variable label.
...because "test" is an x86 instruction.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply