Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model tiny
- .code
- org 100h
- start:
- mov ax, 1
- mov bx, 5
- cmp bx, 9
- jge @@6
- cmp bx, 0
- jl @@7
- je @@2
- jmp @@1
- ;
- greErr db, 'A number in BX is too long', 24h
- lesErr db, 'A number in BX is less that zero', 24h
- @@1:
- mul bx
- dec bx
- cmp bx, 1
- jge @@1
- @@2:
- mov bx, 10
- xor cx, cx
- @@3:
- xor dx, dx
- div bx
- push dx
- inc cx
- test ax, ax
- jnz @@3
- @@4:
- pop dx
- cmp dl, 9
- jbe @@5
- add dl, 7
- @@5:
- add dl, 30h
- mov ah, 2
- int 21h
- loop @@4
- ret
- @@6:
- mov ah, 09h
- lea dx, greErr
- int 21h
- ret
- @@7:
- mov ah, 09h
- lea dx, lesErr
- int 21h
- ret
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement