A compilation Applet: user login verification program

Source: Internet
Author: User

This is a small experiment we want to do when learning the compilation. It feels interesting and I want to post it to my blog. For more information, see.

Lab requirements:

After the program is executed, an operation prompt is displayed. Enter the user name and password. When you type the password, the program does not display the entered characters, the welcome page is displayed and DOS is returned only when the user name, password string, and program string are the same.

The Code contains detailed comments. If you are interested, you can check them out.

Code:

; Filename: exercise2.asm. 486 Data Segment use16 mesg1 dB 0dh, 0ah, 'Please input Username: $'mesg2 dB 0dh, 0ah, 'Please input password: $'mesg3 dB 0dh, 0ah, 'login incorrect! $ 'Username db' b12040331 $ 'password db' 123456789 $ 'flag DB? Buf dB 30 dB? DB 30 DUP (?) Data ends code segment use16 assume Cs: code, DS: Data beg: mov ax, data mov ds, ax mov es, ax Aga: mov flag, 0 mov ah, 9; display prompt information (User Name) mov dx, offset mesg1 int 21 h mov ah, 0ah; enter user name mov dx, offset Buf int 21 h mov BL, BUF + 1 mov BH, 0 mov Si, offset BUF + 2 mov byte PTR [bx + Si], '$' mov Si, offset BUF + 2; Verify that the user name is correct mov Di, offset username mov CX, 9 CLD repe cmpsb mov flag, CL mov ah, 9; display prompt information (password) mov dx, offset mesg2 int 21 h mov Si, offset BUF + 2; process input password input: moV ah, 0ch; clear Keyboard Buffer int 21 h mov ah, 8 int 21 h CMP Al, 13 JZ next mov [Si], Al Inc Si mov ah, 2 mov DL, 2ah int 21 h JMP input next: CMP flag, 0 jnz lerror mov Si, offset BUF + 2; verify if the password is correct mov Di, offset password mov CX, 9 CLD repe cmpsb jnz lerror mov ah, 4ch int 21 h lerror: mov ah, 9 mov dx, offset mesg3 int 21 h JMP agacode ends end beg

The running effect is as follows:


A compilation Applet: user login verification program

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.