Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- pkey db "press any key...$"
- num db ?
- brojac db ?
- array dw 230d,908d,112d,202d,234d
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- proc presmetaj
- pop bx
- pop ax
- ciklus2:
- cmp ax, 0d
- je zavrsi
- mov dl, 10d
- div dl
- mov cl, al
- mov al, ah
- mov ah, 0
- mov dl, 2d
- div dl
- cmp ah, 0
- je parna
- neparna:
- mov al, cl
- mov ah, 0
- jmp ciklus2
- parna:
- inc num
- mov al, cl
- mov ah, 0
- jmp ciklus2
- zavrsi:
- push bx
- ret
- endp presmetaj
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- mov bx, 0d
- ciklus:
- cmp bx, 10d
- je kraj
- mov ax, array[bx]
- push ax
- call presmetaj
- add brojac, 2d
- mov bl, brojac
- mov bh, 0
- jmp ciklus
- kraj:
- mov dl, num
- mov ah,02h
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement