Assembly language-Alphabetic character conversion

Source: Internet
Author: User
Tags alphabetic character

1. Title: Uppercase and lowercase alphabetic characters interchange

2. Requirements: Enter a character from the keyboard, if the character is a carriage return, exit the program directly, if it is a lowercase letter, it is converted to uppercase and displayed, if it is uppercase, is converted to lowercase letters and display, if it is non-alphabetic characters, display a prompt message, and wait for the user to reenter characters.

3. Tip: First determine whether it is a carriage return, if not, whether it is uppercase or lowercase letters, if the conversion and output, otherwise display re-enter. The difference between uppercase ASCII and lowercase ASCII is 20H, which can be converted according to this.

 1; Example assembly Language Program--2; Author:karllen 3; Date:revised 5/2014 4 5.386 6. MODEL FLAT 7 8 exitprocess PROTO NEAR32 stdcall, Dwexitcode:dword 9 INCLUDE io.h; Header file for input/output11-cr EQU 0DH; Carriage return character13 Lf EQU 0ah; Line Feed14 15. STACK 4096; Reserve 4096-byte stack16 17. DATA18 Promot byte "Enter a char of letter", cr,lf,019 warning byte "The char isn ' t a letter,enter AG       Ain ", 020 answerltou byte" The char is a lowercase,it's uppercase is "a byte cr,lf,023 Answerutol byte "The char is a uppercase,it's lowercase is" a byte cr,lf,025 char B Yte 1 DUP (?) 26.         CODE27 _start:28 output promot29 input char,130 dogo:31 mov bl,char32 input char,133           CMP char,0dh34 JE dowhcmp; CR deal the CR35 jmp doGo36 dowhcmp:37    Bl,41h39 JL Inputagain; the char < a,end and input again40 cmp bl, 5ah41 Jle Enduppertol; the char <= z,so to judge it's or not lowercase42; th              e Char is a uppercase43 cmplower:44 CMP bl,61h; the char < a,end and input Again45              JL INPUTAGAIN46 CMP Bl,7ah; the char > Z.end and input agian47 JG inputAgain48               JMP Endlowertou; The char is a lowercase49 inputagain:51 output warning 52              Input char,153 mov bl,char54 jmp doGo55 enduppertol:56 mov al,bl57 add al,32; here is the decimal plus minus the Mov char,al59 output Answeru              toL60 output char61 jmp endMain62 endlowertou:63 mov al,bl64      Sub al,3265        mov char,al66 output answerLtoU67 output char68 endmain:69 ExitProcess INVOKE, 0; Exit with return code 071 _start; Make entry point public73 the END; End of source code

Assembly language-Alphabetic character conversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.