I've been having the strangest problem. In x86 assembly, the 32 bit registers (eax, ebx, etc.) have been overflowing at 256, suggesting that they're actually 8 bit, for some reason. For example:
test.s:
section .data
section .text
global _start
_start:
mov eax, 1
mov ebx, 256
int 80h
If I then compile this code with nasm -felf32 -g test.s && ld -m elf_i386 -s -o test test.s
, and run the resulting executable, it returns 0. This same problem happens for eax, ecx, edx, etc.
Why would the 32 bit registers act like 8 bit ones, in ANY situation?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…