Last active
December 15, 2015 01:38
-
-
Save RC1140/5180853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_f proc near | |
input = dword ptr 8 | |
push ebp ;Stack winding , remember where we came from. | |
mov ebp, esp ;Stack winding , update the current stack locations. | |
movzx eax, byte ptr [ebp+input] ; Move the byte value @ the address [ebp + input] and extend it if needed into the eax register | |
; eax now contains the the first 8 bytes of the stack for the current function which is your first parameter passed to the function | |
lea edx, [eax-61h] ; This subtracts 61h from eax (the parameter passed in ) and sets edx to the result. | |
; Assuming we passed in the letter 'a' , this would result in 61h - 61h == 0 in edx | |
cmp dl, 19h ; Compare the lower register of edx to 19h , if the value is less than 19h then we | |
; we know we are dealing with lower case letters. Otherwise this is an upper case letter or some other char which means we can ignore it. | |
ja short loc_80483F2 ; If the dl is greater than 19h then jump to loc_80483F2 and exit the function as nothing needs to be done. | |
sub eax, 20h ; Subtract 20h from eax , this convert a lower case char to upper case. This is a very effecient way to change the | |
; the case because of the following , 'a' == 61h and 'A' == 41h , so by subtracting 20h from any letter char , we will be left | |
; with the upper case value. | |
loc_80483F2: | |
pop ebp ;Stack unwinding | |
retn ; Pop the instruction pointer and jump to it , this exits the function and returns to the caller. | |
_f endp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment