Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

@Data

Status
Not open for further replies.

FrozenLight

Programmer
Mar 15, 2002
8
0
0
CA
mov ax,@Data
mov ds,ax
Where does the program gets the corresponding value to @Data? Does DOS, when it loads the program, replaces @Data by the current data segment?
I'm confuse about it.

Note: I'm using Masm 6.14
 
@Data is a special label reserved by the assembler when using '.MODEL'.

If you notice most assembly programs now use '.MODEL', because if you do, you can use '.DATA', '.CODE', '.STACK', and '.FARDATA'. These pseudo-ops define segments in the program (I assume you know about segments).

All segments however MUST have a name and an address. The old way, you defined segments in this manner:

CODE_SEG SEGMENT PUBLIC PARA 'CODE' (etc...)


So CODE_SEG was the name of the segment which you can refer to if at any time you need to know the address of that segment.

However, in the new way you simply do:

.CODE

without defining a name for that segment. So how do you now refer to that segment? Well the assembler gives it the name @CODE. Similarly, a .DATA segment is named @DATA, a .FARDATA segment is named @FARDATA.


As for what DOS does... leave DOS alone until you're prepared to handle it. Just know that DOS will handle anything that requires segments by itself. So if you put @DATA in your program, DOS will replace it with the address it placed @DATA in. @DATA refers to the .DATA segment, remember that. If you defined another data segment with a different name, you use that name, but that's advanced technique. When you start getting tricky and start playing with segments by yourself, that's when you start worrying about what DOS does.
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
.radix16 means that all your numbers will be considered as hexadecimal unless otherwise noted. That means that a 10 is equivalent to 16 decimal, where if the radix was 10, you could use either 16 or 10h to mean sixteen. And that means that, instead of writing INT 21H, if you tell the assembler that you're using a base/root 16 counting system, you can just write INT 21 (equivalent to 33 in decimal). To specify eleven decimal in hexadecimal, you'd write 0b.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top