NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: ben321 on December 16, 2023, 08:25:18 AM
-
For example, in 16 bit mode, the movsb command looks only at the si and di registers (first 16 bits of the esi and edi registers). However I can use "db 0x67" to manually insert the address size override byte in front of the movsb opcode. This will force it to use the entire 32bits of the esi and edi registers. However, I'm wondering if there's a proper instruction for this. I've tried "movsb long", and "movsb far". And so far I can't find any instruction that will cause NASM to write the 0x67 byte in front of the opcode for movsb.
-
You can use the a32 prefix to override the address size. In your case, that would be
a32 movsb
Similarly, to use 16 bit addressing in 32 bit code, you can use the a16 prefix
To override operand size, it's o16 and o32
-
You can use the a32 prefix to override the address size. In your case, that would be
a32 movsb
Similarly, to use 16 bit addressing in 32 bit code, you can use the a16 prefix
To override operand size, it's o16 and o32
Thanks for the info. Is that somewhere in the manual? Or more of a hidden function?
Also, movsb is usually used with rep, so where does the a32 go in this case? Before or after the rep?
-
Yes, it's in the manual, that's what I checked before replying. In version 2.07 of the manual, it's described in section 10.3. In version 0.98, it was section 9.3. They're the two version I currently use for reference.
I think the REP would be the first prefix, so you repeat the o32 each time round. Not sure on that though, it may work the other way round as well.
-
"rep" gets its parameter from cx or ecx. np?
Best.
Frank
-
"rep" gets its parameter from cx or ecx. np?
Best.
Frank
Yes. I guess o16/o32 would override which is used, and come before the rep. Haven't tried it though, so not sure on that.
-
Hi Debs.
I think I may have misunderstood the question. Seems like a good one to "try it and see what works"/
Best,
Frank