I'm learning how to create real mode programs assembled and linked with:
- GCC Assembler version 2.25
- Binutils version 2.25
- GCC version 5.2.0
I use Intel syntax without prefixes specified with .intel_syntax noprefix
I want to load the address of a string into the SI register. I know, how to refer to a memory location in NASM, but when I do the same inside the GNU Assembler code, it only moves a WORD of the string into the register instead of the address of the label.
My code is:
.code16
.intel_syntax noprefix
mov cx, 11
mov si, name
mov di, 0x7E00
push di
rep cmpsb
pop di
je LOAD
When I compile it with GCC, I can see in the debugger that the processor does:
mov si, WORD ptr ds:0x7d2d
but I want the address of the string moved into the register, not the data it points at.
I also tried to put square brackets around the name like this:
.code16
.intel_syntax noprefix
mov cx, 11
mov si, [name]
mov di, 0x7E00
push di
rep cmpsb
pop di
je LOAD
It doesn't make a difference.
From NASM I know that this assembly code works:
mov si, name
NASM will generate the instruction that moves the address of name
into register SI.
My question: Is there a way to force GCC using Intel Syntax with No Prefix to load the address of a symbol into a register?