Are we able to move a memory operand to a segment register in these ways using MOV instruction in assembly(x86) language ?
1.
MOV DS,[BX]
2.
MOV DS,[6401H]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, both addressing modes are valid.
You’ve got this question tagged both Masm and Nasm. They’re not the same, y’know! To convince Masm you want a memory reference, you may need to do
mov ds, ds:[6401h]– strange, I know, but that’s the syntax of the assembler – or was, the last time I used Masm (long time ago!). The redundantds:is optimized away in Masm, Nasm would emit it. If Fasm won’t do this, Fasm is broken (which I doubt! Tomasz is a genius!)… just tried it with Fasm – works fine!Incidentally, 32-bit addresses do involve a segment register – the OS sets ’em up, and it is rare to use ’em in “userland” code, but they’re still there! (64-bit code, no – but I’m less sure of that).