assemblystackdecrementindexed

ASM: Decrement content of specific address


I need to decrement some bytes on/from the stack at a given address (indexed from esi).

pop esi ; 

Now changing would not be a problem, I simply can do

mov [esi+13], al ;

to store the content from al in esi+13.

But how can I decrement what is in "esi+13".

E.g. value of esi+13 = 0xFF → New value of esi+13 = 0xFE.

I tried different things like

dec [esi+13] ;
sub [esi+13], 1; 
dec esi+13; 

and so on, but I didn't find a solution.

I don't know which bytes will be in "esi+13" so I can't move the "result" to the address, I really have to decrement it.


Solution

  • I think this should work:

    dec byte ptr [esi+13]