Skip to content

Instantly share code, notes, and snippets.

@DeRegem
Last active November 3, 2015 18:24
Show Gist options
  • Save DeRegem/59491ecd04d82f13c8d1 to your computer and use it in GitHub Desktop.
Save DeRegem/59491ecd04d82f13c8d1 to your computer and use it in GitHub Desktop.
format PE
entry main
section '.text' code readable executable
main:
push str_intro
push format_output
call [printf]
add esp,8
push str_input
push format_input
call [scanf]
add esp,8
mov esi,str_input
xor eax,eax
xor ebx,ebx
xor ebx,ebx
xor edx,edx
_bucle:
cmp byte[esi],0
je _control
movzx eax,byte[esi]
add [8*eax+contadores],1
add esi,1
jmp _bucle
_control:
cmp bl,[contadores+edx*8]
jl _nuevomayor
_incremento:
inc edx
cmp edx,256
je _fin
jmp _control
_nuevomayor:
movzx ebx,[contadores+edx*8]
jmp _incremento
_fin:
push ebx
push format_output2
call [printf]
add esp,8
push num
push format_input
call [scanf]
add esp, 8
push 0
call [exit]
ret
section '.data' data readable writeable
contadores rb 256
str_input dd "%s",0
num dd ?
format_input db "%s",0
format_output db "%s",10,0
format_output2 db "%d",10,0
str_intro db "Ingrese la string:",10,0
section '.idata' data import readable
include "macro\import32.inc"
library msvcrt, "MSVCRT.DLL"
import msvcrt,\
printf ,'printf',\
scanf ,'scanf',\
exit ,'exit'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment