Delphi assembler: understanding the Result register
问题 I'm messing around with ASM in Delphi. From my understanding, EAX holds Result. In the following, I have to put RET at the end, otherwise Result is not correct (it is correct if the input is 0). What am I doing wrong, or should I say, what don't I understand about this? function MSb(const Val: Integer): Integer; label Go; asm CMP EAX, 0 JNZ Go MOV EAX, -1 RET Go: BSR EBX, EAX MOV EAX, EBX RET end; If I say the following: MOV Result, EBX Then I get the following compilation: MOV [EPB-$04], EBX