Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern printf
- segment .data
- c_pt_s db `char: '%c' is 0x%.8X`,10,0 ;for char_print printf("char: %d is %c\n",eax,eax);
- n_pt_s db `x%.8X `,10,0
- segment .bss
- segment .txt
- global t1
- t1:
- enter 0,0 ; setup routine
- mov esi, [ebp+8] ;
- mov ecx, 0
- mov edi, [ebp+12] ;tallybuff
- loop1: mov eax, 0
- mov al, [esi+ecx] ;
- ;call char_print
- ;mov edx, edi+4*al
- mov ebx, [edi+4*eax]
- inc ebx
- mov [edi+4*eax], ebx ;
- inc ecx
- cmp al, 0 ;check to see if null
- je done
- jmp loop1
- ;add esp, 4 ;
- done mov eax, 0 ;this puts my return value in place
- leave ;; comment these to asm print out tally
- ret ;; comment these to asm print out tally
- mov ecx, 0
- ptall mov ebx, [edi+4*ecx]
- call num_print
- inc ecx
- cmp ecx, 80h
- je done1
- jmp ptall
- done1 leave
- ret
- num_print pusha
- push ebx
- push n_pt_s
- call printf
- add esp, 8 ;remove 2 pushes on stack
- popa
- ret
- char_print pusha
- push eax
- push eax
- push c_pt_s
- call printf
- add esp, 12 ;remove 2 pushes on stack
- popa
- ret
Advertisement
Add Comment
Please, Sign In to add comment