0

I wan't to ask, in x86-16 assembly @ symbol is for what ? Can you explain ?

Example :

.data
str db "Hello!", 6, 10, '$'

mov ax, @data ; <- here
mov ds, ax
vbvbvb123
  • 31
  • 4
  • The selector (address divided by 16 in real mode) for the given segment. – Jester Oct 28 '20 at 13:28
  • 2
    I don't know about emu8086 specifically, but with MASM `@data` is a predefined symbol that expands to `DGROUP`. And `DGROUP` is a 64k segment group which combines the _DATA, _BSS, CONST, and STACK segments. – Michael Oct 28 '20 at 13:30
  • Does this answer your question? [Assembly code do not recognise ? and @data](https://stackoverflow.com/q/57316059/5221149) – Andreas Oct 28 '20 at 13:35

1 Answers1

2

This is assembly code for the Microsoft Macro Assembler (MASM).

.data defines the beginning of the data segment.

@data is the address of the data segment.

Which in this case means that the code is assigning the address of the "Hello!" string to the ds register.

Note: data is not a label you can choose, it is a keyword.

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • 1
    `@data` isn't "the address", it's the linear address right shifted by 4, i.e. the real-mode segment-register value the assembler expects to make `seg:off` addressing into `.data` work, for the `[offset]` values it uses in addressing modes. – Peter Cordes Oct 28 '20 at 16:11