Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- include 'emu8086.inc'
- data segment
- ; add your data here!
- user db "admin"
- psw db "password"
- arrayuser db 20 dup (?)
- arraypsw db 20 dup (?)
- 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
- call pthis
- db "Inserisci username: ", 0
- call inserimentouser
- uscitaciclo:
- call a_capo
- call pthis
- db "Inserisci password: ", 0
- call inserimentopsw
- confronto:
- call confrontouser
- call confrontopsw
- call a_capo
- call pthis
- db "Login effettuato con successo", 0
- call a_capo
- jmp fine
- errore:
- call a_capo
- call pthis
- db "Errore! Username o password non corretti!", 0
- call a_capo
- 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
- xor si, si
- mov cx, 20
- label_inserimentouser:
- mov ah, 1
- int 21h
- mov arrayuser[si], al
- cmp arrayuser[si], 13
- je uscitaciclo
- inc si
- cmp si, 20
- je uscitaciclo
- jmp label_inserimentouser
- ret
- inserimentouser endp
- inserimentopsw proc
- xor si, si
- mov cx, 20
- label_inserimentopsw:
- mov ah, 7
- int 21h
- mov arraypsw[si], al
- cmp arraypsw[si], 13
- je confronto
- mov ah, 2
- mov dl, '*'
- int 21h
- inc si
- cmp si, 20
- je confronto
- jmp label_inserimentopsw
- ret
- inserimentopsw endp
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- confrontouser proc
- xor si, si
- mov cx, 5
- label_confrontouser:
- mov al, arrayuser[si]
- mov bl, user[si]
- cmp al, bl
- jne errore
- inc si
- loop label_confrontouser
- ret
- confrontouser endp
- confrontopsw proc
- xor si, si
- mov cx, 8
- label_confrontopsw:
- mov al, psw[si]
- cmp arraypsw[si], al
- jne errore
- inc si
- loop label_confrontopsw
- ret
- confrontopsw endp
- a_capo proc
- mov ah, 2
- mov dl, 10
- int 21h
- mov ah, 2
- mov dl, 13
- int 21h
- ret
- a_capo endp
- DEFINE_PTHIS
- end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment