print macro msg
mov ah,09h
lea dx,msg
int 21h
endm
readmul macro d,j1,j2
mov cx,0ah
j1:mov ah,01h
int 21h
cmp al,0dh
je j2
sub al,30h
mov bl,al
mov ax,d
xor bh,bh
mul cx
add ax,bx
mov d,ax
jmp j1
j2:nop
endm
.model small
.stack 100h
.data
str1 db 10,13,'Enter a decimal number $'
n dw 0
f db 0
str2 db 10,13,'Octal is $'
.code
main proc
mov ax,@data
mov ds,ax
print str1
readmul n,jump1,jump2
mov cx,6
mov ax,n
loop11:xor bx,bx
shr ax,1
rcr bx,1
shr ax,1
rcr bx,1
shr ax,1
rcr bx,1
mov bl,bh
rol bl,1
rol bl,1
rol bl,1
push bx
loop loop11
print str2
mov cx,6
l11:pop dx
cmp dl,f
je j45
dec f
add dl,30h
mov ah,02h
int 21h
j45:loop l11
mov ah,4ch
int 21h
main endp
end
No comments:
Post a Comment