Let's start with int 21h, because it seems like magic if you're not familiar with the multipurpose functionality. It behaves differently depending on the value of the AX register.
mov is just shuffling data around, I'm not sure I need to explain it unless you have a specific question.
Line 11 is where the real work of the conversion is done:
add al,20h ;converts uppercase to lowercase
It's brittle in that the program doesn't check to make sure the character has a lower case equivalent before doing the conversion, but in the ASCII character set upper and lower case letter blocks are 32 characters apart, so if you add 32 (which is 20h in hexadecimal) to an upper case character you'll get the corresponding lower case character, and if you subtract 32 from that, you'll get the original upper case character.
For example, 'A' has a value of 65 and 'a' a value of 97. 65 + 32 = 97 and 97 - 32 = 65. Easy peasy.
int 20h terminates the program.
deceptikon
Challenge Accepted
3,443 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56
ah and al are both under the ax registry right? well is there a significant difference between ah an al?
AH and AL are the upper and lower bytes of the AX register. Much like AX is the lower 16 bits of EAX and EAX is the lower 32 bits of RAX. They're general registers, but some instructions expect operands in a specific register or part of a register or write to a specific register or part of a register.
For example, let's take this block:
mov ah,01h ;ask user
int 21h
add al,20h ;converts uppercase to lowercase
mov bl,al
int 21h (if you read the documentation I linked earlier) states that an operand in AH of 01h will cause a character to be read from standard input, and the character that's read will be stored in AL. BL is the more permanent storage for the character as other work is performed using AX prior to printing that character.
And before you ask, yes, it could also be done like this:
mov ah, 01h
int 21h
mov bl, al
add bl, 20h
There's not really any reason to add before moving or move before adding. There may be a performance reason I'm not familiar with, but in this case I doubt it given that you're working with two general registers of the same size.
deceptikon
Challenge Accepted
3,443 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56
because bl is capable of handling more and much intense instructions, am I right?
Not really. AL and BL are functionally identical, but because AL will be reused almost immediately by the next few instructions, its contents must be saved into another register or they'll be lost.
deceptikon
Challenge Accepted
3,443 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56
You clearly didn't read the reference links I so kindly gave you earlier. Here it is again. AH tells the interrupt what to do, and DL is the argument.
deceptikon
Challenge Accepted
3,443 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 56