Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "asm_io.inc"
- segment .data
- msg db " : ", 0
- segment .bss
- input1 resd 1
- decomposto resd 10
- current resd 1
- castECX resd 1
- equal resb 0
- segment .text
- global asm_main
- asm_main:
- ;call read_int ; read integer
- mov eax, 2010
- mov [input1], eax ; store into input1
- nextNumber:
- mov eax, [input1]
- add eax, 1
- call print_int
- call print_nl
- mov [input1], eax ; store into input1
- mov edi, decomposto
- cld
- mov ecx, 0
- multipleDivisionsBy10:
- cdq
- mov ebx, 10
- div ebx
- mov [current], eax
- mov eax, edx
- call print_int
- call print_nl
- add ecx, 1
- stosd
- mov eax, [current]
- cmp eax, 0
- jg multipleDivisionsBy10
- call print_nl
- mov eax, ecx
- call print_int
- call print_nl
- ; [decomposto] from 0 to ecx-1 is the word
- cld ; ZF ->
- mov eax, 1
- mov [equal], eax
- letsCheckForEquality:
- mov ebx, [decomposto+ecx]
- mov esi, decomposto
- mov [castECX], ecx
- loopInsideLoop:
- lodsd
- cmp eax, ebx
- call print_int
- mov eax, msg
- call print_string
- mov eax, ebx
- call print_int
- call print_nl
- ;je nextNumber
- loop loopInsideLoop
- mov ecx, [castECX]
- loop letsCheckForEquality ; loops ecx times
- mov eax, [input1]
- call print_int
- call print_nl
- leave
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement