flat assembler
Message board for the users of flat assembler.
Index
> Main > Stack doesn't hold entire hexvalue of 4 bytes |
Author |
|
revolution 09 Feb 2015, 00:55
x86 uses a full-descending stack so to get the last value pushed you should do this:
Code: mov eax,[esp] |
|||
09 Feb 2015, 00:55 |
|
theguy 09 Feb 2015, 01:00
Ok thank you, this noob appreciates it
|
|||
09 Feb 2015, 01:00 |
|
JohnFound 09 Feb 2015, 05:46
And [esp-1] is incorrect always. If you want to get the previous pushed number you have to use [esp-4].
|
|||
09 Feb 2015, 05:46 |
|
DOS386 09 Feb 2015, 08:55
> [esp-1] is incorrect always. If you want to get the
> previous pushed number you have to use [esp-4]. Right. Since CPU architecture is bad ... 80386 and above still do use Byte AKA Octet as size unit, but they strongly prefer 32-bit processing. Code: use32 push ax ; Size override call ... ; Stack is misaligned now ... this is the ticket for the HELL !!! This compiles fine, but only 2 flaws: - it breaks Win32 API on NT (not on ME) - it can even crash if "AC" hack is enabled |
|||
09 Feb 2015, 08:55 |
|
revolution 09 Feb 2015, 09:01
DOS386 wrote: Right. Since CPU architecture is bad ... 80386 and above still do use Byte AKA Octet as size unit, but they strongly prefer 32-bit processing. And I don't think that byte sized addressing is a flaw. It would be worse if we were forced to process EVERYTHING as 32-bit units. And becomes even more wasteful if 64-bit CPUs required 64-bit values for everything. Actually even 8-bits is a compromise because the x86 CPU can do single bit addressing and processing. |
|||
09 Feb 2015, 09:01 |
|
l_inc 09 Feb 2015, 12:51
revolution
Quote: Actually even 8-bits is a compromise because the x86 CPU can do single bit addressing I don't think so. You can do bitwise arithmetics and introduce an artificial addressing scheme in form byte_address:bit_address, where byte_address is 32 to 64 bit long and bit_address is 3 bit long, but this cannot be viewed as a uniform addressing scheme, because the bit store ordering is completely transparent to the user with respect to the ISA. This differs to the byte addressing in standard 32 bit RISC architectures where native load-storing is 4-bytes wide and 4-bytes aligned, but the ISAs still allow bytewise load-storing, and this way the byte store ordering can be inferred from the returned byte value as well as affects the software logic in general (difference in endianness). That's why a byte is called to be the smallest addressable unit of memory. _________________ Faith is a superposition of knowledge and fallacy |
|||
09 Feb 2015, 12:51 |
|
revolution 10 Feb 2015, 09:45
JohnFound wrote: If you want to get the previous pushed number you have to use [esp-4]. |
|||
10 Feb 2015, 09:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.