the code is:
.global asm0 asm0: push ebp mov ebp,esp mov eax,DWORD PTR [ebp+0x8] mov ebx,DWORD PTR [ebp+0xc] mov eax,ebx mov esp,ebp pop ebp
The entry is: asm0(0x2a,0x4f)
The output is: 0x4f2a
Why is the input parameters reversed?
You may also be interested in reading about endianness from the NASM documentation:
3.4.3 Character Constants
A character constant consists of a string up to eight bytes long, used in an expression context. It is treated as if it was an integer.
A character constant with more than one byte will be arranged with little-endian order in mind: if you code
then the constant generated is not 0x61626364, but 0x64636261, so that if you were then to store the value into memory, it would read abcd rather than dcba. This is also the sense of character constants understood by the Pentium's CPUID instruction.
More research on your behalf to better understand this can be done by reading about the topic of endianness. It's confusing when you first run into it, but there are many charts like this one to help demonstrate it:
Finally, there's an excellent video from OpenSecurityTraining that does a great job of explaining endianness and order of parameters/arguments with calling conventions. Click here to view it.