It is possible to do this:
mov eax, 'abgr'
but can I do this somehow?
mov eax, 'a',0,'b',0
or even
mov eax, 97,0,98,0
No. The instruction expects a single value to be loaded into EAX.
However, similar to "mov eax,5", you could do
mov eax,"r"
such that AL would contain "r", and the upper 24 bits of EAX would contain 0
(Note that the mov al,"r" instruction would not zero the upper 24 bits of EAX.)
mov eax,'a',0,'b',0
would be
mov eax,620061h
;'a' = 61h, 'b' = 62h
you could probably write a macro to do it with the text defines
Quote from: oex on April 01, 2010, 01:22:11 AM
but can I do this somehow?
mov eax, 'a',0,'b',0
or even
mov eax, 97,0,98,0
mov eax, ('a' shl 24) or ('b' shl 8)
mov eax, 'abba' and 0FF00FF00h
The register with the MOV mnemonic expects a 32 bit value, how you write an assembler to load it is your own business. FASM loads in 1234 order, MASM in traditional reverse and I have no doubt you could produce other variations but it must enbd up a valid opcode, the rest is style and preference.
Yep nice one dave and drizz.... I like the and method.... So much better than:
mov al, 'a'
mov ah, 'b'
bswap eax
mov al, etc etc
or (and this is shows where this was relevant to me....)
mov al, 'a'
mov [edi], al
mov al, 0
mov [edi+1], al
mov al, 'b'
mov [edi+2], al
mov al, 0
mov [edi+3], al
much cleaner:
mov eax, 'abba' and 0FF00FF00h
mov [edi], eax
This could also be useful for manualy editing unicode for example
yes - Drizz's method with "AND 0FF00FFh" is nice and clean :U
heh just read your post properly dave.... cleaner still :lol
mov eax, 620061h
mov [edi], eax
mov dword ptr [edi],620061h ;'a',0,'b',0
:P
Awesome, ty :bg