-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhexorbinary.asm
More file actions
44 lines (38 loc) · 1.15 KB
/
Copy pathhexorbinary.asm
File metadata and controls
44 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
data segment
msg db ,"the decimal equivalent is :$"
hun db 0
ten db 0
unit db 0
data ends
code segment
assume cs:code,ds:data,ss:stack
start: mov ax,data
mov ds,ax
mov dx,offset msg
mov ah,09h
int 21h
mov ax,0bbh ;if we take 10111011b the program is for binary to dec and is equal to 187
mov cl,100 ; divide the no by 10
div cl ; ah al
; 87(R) 1(Q)
mov hun,al ; the quotient will go to variable hun
mov al,ah
mov ah,00h ; ax=00rem (16 bit)
mov cl,10
div cl
mov ten,al
mov unit,ah
mov dl,hun
call disp
mov dl,ten
call disp
mov dl,unit
call disp
mov ah,4ch ; proper termination
int 21h
disp: add dl,30h ; get ASCII
mov ah,02h
int 21h
ret
code ends
end start