Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- b1 db 9
- b2 db 3
- nzs db ?
- pkey db "press any key...$"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- mov al, b1
- mov bl, b2
- mul bl
- mov dx, ax
- mov bx, 1
- petlja:
- cmp bx, dx
- jl racunaj
- jmp kraj
- racunaj:
- mov ch, b1
- mov dh, b2
- mov ax, bx
- div ch
- mov cl, ah
- mov ax, bx
- div dh
- mov dl, ah
- cmp cl, dl
- je dali0
- jmp uvecaj
- dali0:
- cmp cl, 0
- je jeste
- jmp uvecaj
- uvecaj:
- add bx, 1
- jmp petlja
- jeste:
- mov dx, bx
- jmp kraj
- kraj:
- mov ax, dx
- mov bl, 10
- div bl
- mov bl, ah
- mov dl, al
- add dl, 48
- mov ah, 2
- int 21h
- mov dl, bl
- add dl, 48
- int 21h
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- 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