Re: Another one



Avatar Zondertau wrote:

Avatar,

Thank you.

How about this one? It also produces an 'Operand size mismatch'

  mov Result+1, al     // save to allocated string/last position {<---}

For other questions it might be useful if you also provided the
declarations for the variables and types involved.

You're right. I should have.

Here is the function the above line comes from. Marked with {<---}


function Hexs(const byte: byte; const uppercase: boolean = YES): string; const ByteDigits = 2; asm //PUSH Result //@Result = ECX PUSH ebx lea ebx, HEX_UPPERCASE +1 // init ebx with default value test uppercase, 1 // is uppercase flag = YES? jne @skipsetlocase // nz = YES, then dont bother to kowercase lea ebx, HEX_LOWERCASE +1 // uppercase flags = FALSE @skipsetlocase:

  mov ah, al; push eax      // save copy first

  mov eax, Result           // where the result will be stored
  call System.@LStrClr      // cleared for ease
  mov edx, ByteDigits       // how much length of str requested
  call System.@LStrSetLength// result: new allocation pointer in EAX
  mov Result, [eax]    // eax contains the new allocated pointer
                       // we got the storage as well at once
  pop eax

  and al, $f; xlat     // strip high nibbles, translate

  mov Result+1, al     // save to allocated string/last position {<---}
  mov al, ah
  shr eax, 3 * 4       // shift 3 nibbles away (high nibble of AH)
  and al, $f; xlat     // strip high nibbles, translate
  mov [Result], al     // save to allocated string / first position

  //mov Result, edx
  //call System.@LStrLAsg
  pop ebx
  mov eax, @Result
end;


Cheers Adem .



Relevant Pages