IA-32: Pushing a byte onto a stack isn't possible on Pentium, why?

Posted by Tim Green on Stack Overflow See other posts from Stack Overflow or by Tim Green
Published on 2010-04-06T16:42:34Z Indexed on 2010/04/06 16:53 UTC
Read the original article Hit count: 383

Filed under:
|
|
|
|

Hi,

I've come to learn that you cannot push a byte directly onto the Intel Pentium's stack, can anyone explain this to me please?

The reason that I've been given is because the esp register is word-addressable (or, that is the assumption in our model) and it must be an "even address". I would have assumed decrementing the value of some 32-bit binary number wouldn't mess with the alignment of the register, but apparently I don't understand enough.

I have tried some NASM tests and come up that if I declare a variable (bite db 123) and push it on to the stack, esp is decremented by 4 (indicating that it pushed 32-bits?). But, "push byte bite" (sorry for my choice of variable names) will result in a kind error:

test.asm:10: error: Unsupported non-32-bit ELF relocation

Any words of wisdom would be greatly appreciated during this troubled time. I am first year undergraduate so sorry for my naivety in any of this.

Tim

© Stack Overflow or respective owner

Related posts about pentium

Related posts about assembly