Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Need help with DPMI function 301h (Developers)

posted by Rugxulo(R) Homepage, Usono, 30.08.2019, 02:43

> Ok, there is no "official" assembler standard, so it's a bit vague here.
>
> For the MASM family of assemblers, the line "mov edi,r" would indeed load
> the CONTENT of data label "r" into EDI.
>
> For the NASM family of assemblers, the line "mov edi,r" usually will load
> the ADDRESS of data label "r" into EDI.

I think this is also because of a preference for brevity. That it, it's shorter to not have to specify brackets.

MOV AX,MyVar

... is shorter (to read, easier to type) than ...

MOV AX,[MyVar]

... especially if done hundreds of times. But ...

MOV AX, OFFSET MyLabel

... is more verbose than ...

MOV AX, MyLabel

... which is why some people prefer ...

LEA AX, MyLabel ; (only some few require brackets here)

... which is often translated into a simple "MOV" (to save a single byte per instance). But even that LEA->MOV translation "behind your back" is explicitly avoided in many assemblers, even later versions of MASM (where you were expected to use "opattr" inside a macro instead).

Borland obviously supported both MASM syntax (but barely any v6) in TASM as well as their own "Ideal" mode. Unfortunately, a lot of legacy MASM/TASM code never got translated to NASM or FASM or similar.

 

Complete thread:

Back to the forum
Board view  Mix view
15949 Postings in 1475 Threads, 271 registered users, 98 users online (0 registered, 98 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum