Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- user db "admin"
- psw db "password"
- msg1 db "Inserisci username: $"
- msg2 db 10, 13, "Inserisci password: $"
- arrayuser db 20 dup (?)
- arraypsw db 20 dup (?)
- ok db 10, 13, "Login effettuato con successo!$"
- error1 db 10, 13, "Errore! Username non trovato!$"
- error2 db 10, 13, "Password errata$"
- pkey db 10, 13, "premi un tasto per continuare...$"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- lea dx, msg1
- mov ah, 9
- int 21h
- xor si, si
- mov cx, 20
- label_inserimentouser:
- call inserimentouser
- loop label_inserimentouser
- xor si, si
- mov cx, 20
- label_confrontouser:
- call confrontouser
- loop label_confrontouser
- fine_ciclo:
- lea dx, msg2
- mov ah, 9
- int 21h
- xor si, si
- mov cx, 20
- label_inserimentopsw:
- call inserimentopsw
- loop label_inserimentopsw
- xor si, si
- mov cx, 20
- label_confrontopsw:
- call confrontopsw
- loop label_confrontopsw
- riuscito:
- lea dx, ok
- mov ah, 9
- int 21h
- jmp fine
- errore1:
- lea dx, error1
- mov ah, 9
- int 21h
- jmp fine
- errore2:
- lea dx, error2
- mov ah, 9
- int 21h
- fine:
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- inserimentouser proc
- mov ah, 1
- int 21h
- mov arrayuser[si], al
- cmp arrayuser[si], 13
- je label_confrontouser
- inc si
- ret
- inserimentouser endp
- inserimentopsw proc
- mov ah, 7
- int 21h
- mov arraypsw[si], al
- cmp arraypsw[si], 13
- je label_confrontopsw
- mov ah, 2
- mov dl, 2
- int 21h
- inc si
- ret
- inserimentopsw endp
- confrontouser proc
- xor si, si
- mov al, user[si]
- cmp arrayuser[si], al
- jne errore1
- inc si
- cmp si, 5
- je riuscito
- ret
- confrontouser endp
- confrontopsw proc
- xor si, si
- mov al, psw[si]
- cmp arraypsw[si], al
- jne errore2
- inc si
- cmp si, 8
- je riuscito
- ret
- confrontopsw endp
- end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment