Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. displays: resb 4
  2.  
  3. display:  db  00111111b,  00000110b,  01011011b,  01001111b,  01100110b, 01101101b, 01111101b, 00000111b, 01111111b, 01100111b
  4.  
  5. xor eax, eax
  6. mov al, [0x2]
  7. mov bl, [0x0]
  8.  
  9. mov ecx, -1
  10. ciclo1:
  11. inc ecx
  12. cmp [ecx+display], al
  13. jne ciclo1
  14.  
  15. mov eax, ecx
  16.  
  17. mov ecx, -1
  18. ciclo2:
  19. inc ecx
  20. cmp [ecx+display], bl
  21. jne ciclo2
  22.  
  23. mov ebx,ecx
  24.  
  25. test [0x1], 01000000b
  26. jz soma
  27.  
  28. neg ebx
  29.  
  30. soma:
  31. add eax, ebx
  32.  
  33.  
  34. cmp eax, 9
  35. jg doubledigit
  36.  
  37. cmp eax, 0
  38. jl negative
  39.  
  40. mov bl,[eax+display]
  41. mov [0x0], bl
  42. mov [0x1], 00111111b
  43. mov [0x3], 01110011b
  44.  
  45. jmp fim
  46.  
  47. negative:
  48. neg eax
  49. mov bl,[eax+display]
  50. mov [0x0], bl
  51. mov [0x1], 00111111b
  52. mov [0x3], 1010100b
  53.  
  54. jmp fim
  55.  
  56. doubledigit:
  57. add eax, -10
  58. mov bl,[eax+display]
  59. mov [0x0], bl
  60. mov [0x1], 1
  61. mov [0x3], 01110011b
  62.  
  63. fim:
  64. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement