In most assemblers is a macro for pushing all flags/registers - I think in MASM/TASM the macro is 'PUSHR'
and 'POPR'. Alternatively, you could manually push all flags/registers before code in the function, then pop them all off after. eg.
function:
push ax
push bx
push cx
push dx
etc...
; Code goes here
...
pop dx
pop cx
pop bx
pop ax
ret
in order of push, in reverse for pop.
32bit opcodes only valid for 16bit mode because in 32bit mode all opcodes operate the extended 32bit registers.
you have to push/pop the segments selectors manually.
i tend to find pusha/popa is costly on the stack.
irrelevant when task switching.
i find when manipulating registers for return values using ebp to modify stack and popa does not award any benefits over manual pops ie to return eax value
push ebx
push ecx
push eax
<BLAH>
<set eax to return value>
pop ecx ;lose old eax value
pop ecx
pop ebx
ret <or iret as the case maybe>
hope it helps - straiph
"There are 10 types of people in this world, those who know binary and those who don't!"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.