I am new to x86 assembly and I am trying to understand the code in this document : http://www.cs.cmu.edu/~410-s07/p4/p4-boot.pdf page 3 :
movw $0x1234, %ax
movw %ax, %ds
movw $0x5678, %bx
# The following instruction is the same as "movw $0x1337, (%bx)".
movw $0x1337, %ds:(%bx) # Places 0x1337 into memory word 0x179b8.
# Segment Base: %ds << 4: 12340
# Offset: %bx: + 5678
# -------
# Linear Address: 179b8
But I am not understanding the command :
movw $0x1337, %ds:(%bx) # Places 0x1337 into memory word 0x179b8.
Why concatenating %ds with (%bx) is the same as ((%ds << 4) | %bx) ?
As I am in real mode (16 bits), the concatenation shouldn't be %ds << 8 ? instead of %ds << 4?
And why the parenthesis is just around %bx? And not around the whole structure like : movw $0x1337, (%ds:%bx) ?