Advertisement
LincolnArantes

Login senha certa ou errada

Oct 26th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Escrito por Lincoln Cesar dos Reis Arantes
  2. section .text
  3.  
  4.  
  5.     global _start       ;must be declared for using gcc
  6.  
  7.  
  8. _start:                     ;tell linker entry point
  9.  
  10.  
  11.  
  12. mov edx, len    ;message length
  13. mov ecx, msg    ;message to write
  14. mov ebx, 1      ;file descriptor (stdout)
  15. mov eax, 4      ;system call number (sys_write)
  16.  int 0x80
  17.  
  18.  
  19.   ; Entrada Dados
  20.  mov eax, 3
  21.  mov ebx, 0
  22.  mov ecx, senha
  23.  mov edx, 40
  24.   int 0x80
  25.   ;--------------------------
  26.  
  27.  
  28.  
  29.  
  30.  
  31. mov eax, [senha]
  32. mov ebx, 'abcd'
  33. cmp eax, ebx
  34. je certa
  35. jne errada
  36.  
  37.  
  38.  
  39. certa:
  40.  
  41. mov edx, lenc    ;message length
  42. mov ecx, msgc    ;message to write
  43. mov ebx, 1      ;file descriptor (stdout)
  44. mov eax, 4      ;system call number (sys_write)
  45.  int 0x80
  46. call exit
  47.  
  48.  
  49.  
  50.  
  51. errada:
  52.  
  53. mov edx, lene    ;message length
  54. mov ecx, msge    ;message to write
  55. mov ebx, 1      ;file descriptor (stdout)
  56. mov eax, 4      ;system call number (sys_write)
  57.  int 0x80
  58. call exit
  59.    
  60.  
  61. exit:
  62.  
  63.  
  64. mov eax, 1      ;system call number (sys_exit)
  65. int 0x80        ;call kernel
  66.  
  67.  
  68. section .data
  69.  
  70.  
  71. msgc db 'VOCÊ ACERTOU A SENHA!',0xa    ;our dear string
  72. lenc equ $ - msgc           ;length of our dear string
  73.  
  74. msge db 'VOCÊ ERROU A SENHA! BYE',0xa  ;our dear string
  75. lene equ $ - msge           ;length of our dear string
  76.  
  77. msg db 'Entre com a senha',0xa  ;our dear string
  78. len equ $ - msg         ;length of our dear string
  79.  
  80.  
  81. segment .bss
  82.  
  83. senha resb 16
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement