x86 convert to lower case assembly

后端 未结 3 2029
孤独总比滥情好
孤独总比滥情好 2020-12-12 08:24

This program is to convert a char pointer into lower case. I\'m using Visual Studio 2010.

This is from another question, but much simpler to read and mo

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 08:46

    Your code can alter only the first char (or [edi], 20h) - the EDI does not increment.

    EDIT: found this thread with workaround. Try using the 'dl' instead of al.

    ; move the token address to search for into EDI
    ; (not the *token, as would be with mov edi, [token])
    
    mov edi, token      
    
    LOWERCASE_TOKEN:            ;lowercase the token
      mov al, [edi]
      ; check for null-terminator here !
      cmp al, 0
      je GET_OUT
      or al, 20h
      mov dl, al
      mov [edi], dl
      inc edi
    jmp LOWERCASE_TOKEN
    GET_OUT:
    

提交回复
热议问题