Guest User

Untitled

a guest
Apr 30th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4.     ; add your data here!
  5.    
  6.     user db "admin"
  7.     psw db "password"
  8.     msg1 db "Inserisci username: $"
  9.     msg2 db 10, 13, "Inserisci password: $"
  10.     arrayuser db 20 dup (?)
  11.     arraypsw db 20 dup (?)
  12.     ok db 10, 13, "Login effettuato con successo!$"
  13.     error1 db 10, 13, "Errore! Username non trovato!$"
  14.     error2 db 10, 13, "Password errata$"
  15.     pkey db 10, 13, "premi un tasto per continuare...$"
  16. ends
  17.  
  18. stack segment
  19.     dw   128  dup(0)
  20. ends
  21.  
  22. code segment
  23. start:
  24. ; set segment registers:
  25.    
  26.     mov ax, data
  27.     mov ds, ax
  28.     mov es, ax
  29.  
  30.     ; add your code here
  31.    
  32.     lea dx, msg1
  33.     mov ah, 9
  34.     int 21h    
  35.  
  36.     xor si, si
  37.     mov cx, 20
  38.    
  39.    
  40. label_inserimentouser:
  41.     call inserimentouser
  42.     loop label_inserimentouser
  43.    
  44.     xor si, si
  45.     mov cx, 20
  46.  
  47. label_confrontouser:
  48.     call confrontouser
  49.     loop label_confrontouser
  50.  
  51. fine_ciclo:
  52.     lea dx, msg2
  53.     mov ah, 9
  54.     int 21h
  55.  
  56.        
  57.     xor si, si
  58.     mov cx, 20
  59.    
  60. label_inserimentopsw:
  61.     call inserimentopsw
  62.     loop label_inserimentopsw
  63.  
  64.  
  65.     xor si, si
  66.     mov cx, 20
  67.  
  68.  
  69. label_confrontopsw:
  70.     call confrontopsw
  71.     loop label_confrontopsw    
  72.  
  73. riuscito:
  74.     lea dx, ok
  75.     mov ah, 9
  76.     int 21h    
  77.     jmp fine
  78.    
  79. errore1:
  80.     lea dx, error1
  81.     mov ah, 9
  82.     int 21h
  83.     jmp fine
  84.    
  85. errore2:
  86.     lea dx, error2
  87.     mov ah, 9
  88.     int 21h
  89.    
  90.  
  91. fine:
  92.     lea dx, pkey
  93.     mov ah, 9
  94.     int 21h        ; output string at ds:dx
  95.    
  96.     ; wait for any key....    
  97.     mov ah, 1
  98.     int 21h
  99.    
  100.     mov ax, 4c00h ; exit to operating system.
  101.     int 21h    
  102.  
  103.  
  104.  
  105. ends
  106.  
  107.  
  108. inserimentouser proc
  109.     mov ah, 1
  110.     int 21h
  111.     mov arrayuser[si], al
  112.     cmp arrayuser[si], 13
  113.     je label_confrontouser
  114.     inc si
  115.     ret
  116. inserimentouser endp
  117.  
  118.  
  119. inserimentopsw proc
  120.     mov ah, 7
  121.     int 21h
  122.     mov arraypsw[si], al
  123.     cmp arraypsw[si], 13
  124.     je label_confrontopsw
  125.     mov ah, 2
  126.     mov dl, 2
  127.     int 21h
  128.     inc si
  129.     ret
  130. inserimentopsw endp
  131.  
  132. confrontouser proc
  133.     xor si, si
  134.     mov al, user[si]
  135.     cmp arrayuser[si], al
  136.     jne errore1
  137.     inc si
  138.     cmp si, 5
  139.     je riuscito
  140.     ret
  141. confrontouser endp
  142.  
  143.  
  144. confrontopsw proc
  145.     xor si, si
  146.     mov al, psw[si]
  147.     cmp arraypsw[si], al
  148.     jne errore2
  149.     inc si
  150.     cmp si, 8
  151.     je riuscito
  152.     ret
  153. confrontopsw endp
  154.  
  155. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment