Sunday, 15 March 2015

sorting - Access violation in Masm when accessing memory offset -


I am trying to sort a selection in x86 assembly and when I try to use, Access error is getting a variable to use offset of an array.

 . Data array byte "fairy tale" calculation = ($ - array) minIndex BYTE? .cod _main PROC mov eax, 0 mb ebx, 0 mov ecx, count; Transfer the array number to the register ACX counter; Reduce Counter Lea SEI, ARAR Memo BL, 0; I = 0 L1: Push ECX Mov Min Index, BL; Min indices = I mov al, min index [ssi]; This gives error; Rest of the code ... ret_main ENDP END _main  

There are no build errors, access violations only at run time Do not you have permission to perform such operation in MASM? Is there any remedy?

mov al, minIndex [esi]

If you think that minIndex will be considered and will use offset esi in the reading task, then you are wrong address Minindex .

You can change your code to:

  movzx eX, byte ptr min indax; Extend from zero - in miniex xx into mov .. mov al, [esi + eax]; ..and use it as an offset in the array  

No comments:

Post a Comment