Guest User

Untitled

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