Compilation of a combat: convert uppercase to lowercase

SEGMENT the DATAS 
    ; where input data segment codes   
    str1 DB " Please Enter A Captial Letter: " 
    DB 0DH, 0AH, ' $ ' 
    str2 DB " Error the Input " 
    DB 0DH, 0AH, ' $ ' 
the DATAS ENDS 

the STACKS SEGMENT 
    ; enter here stack sections of the code 
STACKS ENDS 

cODES sEGMENT 
    the ASSUME CS: cODES, DS: DATAS, SS: STACKS 
the START: 
    MOV AX, DATAS 
    MOV DS, AX 
    ; here enter the code snippet 
    
    MOV dx, offset str1 
    MOV AH, 9 
    int 21H 
    
    MOV AH, 01 
    int 21H
    
    CMP al, 41H; of al the ASCII code 41H character comparison 
    JB Exit 
    the CMP al, 5AH; of al the ASCII code 5AH character comparison 
    JA Exit 
    
    the ADD al, 32             ; uppercase small letter 
    
    MOV dl, al; print statement 
    MOV AH, 02 
    int 21H 
    
    MOV AH, 4CH; end 
    iNT 21H 
    
    Exit:; time before the comparison, if error, jump to the entrance         
        MOV dx, offset str2 
        MOV AH, 9 
        int 21H 
        
        MOV AH, 4ch 
        int 21H 
    
CODES eNDS 
    eND the START

        After writing the main feeling is that although it is closer to the bottom of the assembly language, but in fact the contents of many still frame form, a bit like some of the structural framework java and c ++, and directly on the line, such as MOV AH, 4ch   int end 21h is to represent, a bit like packaging means, many of which are used is a large block complete code, which only need to change some of the parameters in it.

Guess you like

Origin www.cnblogs.com/Rebel3/p/11620931.html