Home > other >  Assembly language assembly instructions are legal
Assembly language assembly instructions are legal

Time:10-17

Excuse me mov ax, [1] and mov ax, 1 the two instructions legal

CodePudding user response:

mov ax, [1] , are all right,
However, mov ax, [1] for masm equivalent of mov ax, 1 so the source program written mov ax, ds: [1] will only be 1 explain for memory address rather than a number immediately,

CodePudding user response:

reference 1/f, zara's reply:
mov ax, [1] , are all right,
However, mov ax, [1] for masm equivalent of mov ax, so in the source program written in 1 mov ax, ds: [1] will only be 1 explain for memory address rather than immediately,
mov ax, [1] is equivalent to mov ax, 1 it seems wrong

CodePudding user response:

reference 1/f, zara's reply:
mov ax, [1] , are all right,
However, mov ax, [1] for masm equivalent of mov ax, so in the source program written in 1 mov ax, ds: [1] will only be 1 explain for memory address rather than immediately,
[n] said addressing a migration

CodePudding user response:

This is usually on the idea of it is yes; However, you get the masm5/6/32 v?? To compile the next, you will find masm delocalised understand,

CodePudding user response:

MOV AX, [1] of the writing mean direct memory addressing, [] is put inside address memory (offset),
But don't know what the reason, MASM compiler software will be to identify it into MOV AX, 1
That is to say, the book said that the DS is probably the base address can be omitted, but the software doesn't think so, the software does not allow to omit, namely:
Software in the MOV AX, DS: [1] is direct memory addressing of the book, so write programs to use direct addressing mode, remember to add base,

As for MOV AX, 1 normal number immediately transfer,

Conclusion: MOV AX, [1] and MOV AX, 1 in the book and software are legitimate;
Books are: direct addressing and immediately send
Software is respectively: (into) number immediately send and send immediately

CodePudding user response:

Because the masm designers don't want to let users often use absolute address access, deliberately put the mov ax, [1] interpreted as mov ax, 1
Masm there are a lot of the eccentricity, such as not explicitly use rip based addressing, such as mov rax, [rip + XXX] this kind of instruction, but data access instructions, such as mov rax, var (var) is a variable, masm is implied generated mov rax, [rip + XXX]; Is the offset of the current rip to var (XXX)
  • Related