Read a character's ascii code convert to Hex,Octal in 8086

Read a character's ascii code convert to Hex,Octal in 8086

Page 1 of 1

3 Replies - 12566 Views - Last Post: 10 June 2009 - 09:29 AM

#1 excal.1905  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-June 09

Read a character's ascii code convert to Hex,Octal in 8086

Post icon  Posted 08 June 2009 - 02:55 PM

Hi . i want read one character convert dec to octal and hex in assembly 8086. i need program codes . i'm using emu8086 emulator..
help me please :rolleyes:

This post has been edited by excal.1905: 08 June 2009 - 02:57 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Read a character's ascii code convert to Hex,Octal in 8086

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2247
  • View blog
  • Posts: 9,237
  • Joined: 18-February 07

Re: Read a character's ascii code convert to Hex,Octal in 8086

Posted 09 June 2009 - 12:24 PM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 excal.1905  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-June 09

Re: Read a character's ascii code convert to Hex,Octal in 8086

Posted 10 June 2009 - 08:32 AM

ok. i read this codes:
print 'Bir karakter yaz:'
mov ah,1
int 21h
mov sayi,al 
mov ah,2
mov dh,1
int 10h
;hex yaz:		
mov bx,16		   
mov dx,0
div bx
mov bx,dx
mov ah,2  
mov dx,ax
and dx,000Fh 
cmp dx,9
ja  cevir
add dx,48
int 21h 
git:
mov ah,2
mov dx,bx
cmp dx,9
ja  cevir1 
add dx,48
int 21h	
git1:
print 'h'

mov ah,2
mov dh,2
mov dl,0
int 10h 

			   
;binary yaz:
mov bl,sayi
mov cx, 8   
bak: mov ah, 2   
		mov dl, '0'
		test bl, 10000000b  
		jz sifir
		mov dl, '1'
sifir:  int 21h
		shl bl, 1
loop bak
print 'b'	  
		
mov ah,2
mov dh,3
mov dl,0
int 10h 
;octal yaz:
mov cl,0
mov al,sayi 
mov bx,8		   
mov dx,0
div bx
mov bx,dx
mov ah,2 
mov dx,ax
mov say,al
and dl,0Fh
cmp dl,7
Ja ekle
don:
and bl,0Fh
cmp bl,7
Ja ekle1
don1: 
cmp cl,0
jne yaz
don2:
mov ah,2
and say,00000111b
mov dl,say
add dl,48
int 21h 
mov dx,bx 
and dl,00000111b
add dx,48
int 21h 
print 'o'
jmp bitir 
ekle:
inc cl
jmp don
ekle1:
inc cl
jmp don1
yaz:
mov ah,2
mov dl,cl
add dl,48
int 21h
jmp don2
mov ah,2	 
cevir:
cmp dx,10 
je ayaz
cmp dx,11 
je byaz
cmp dx,12 
je cyaz
cmp dx,13 
je dyaz
cmp dx,14 
je eyaz
mov dx,'F'
int 21h
jmp git	   
ayaz:
mov dx,'A'
int 21h
jmp git 
byaz:
mov dx,'B'
int 21h
jmp git 
cyaz:
mov dx,'C'
int 21h
jmp git 
dyaz:
mov dx,'D'
int 21h
jmp git 
eyaz:
mov dx,'E'
int 21h
jmp git  
cevir1:
cmp dx,10 
je ayaz1
cmp dx,11 
je byaz1
cmp dx,12 
je cyaz1
cmp dx,13 
je dyaz1
cmp dx,14 
je eyaz1
mov dx,'F'
int 21h
jmp git1	   
ayaz1:
mov dx,'A'
int 21h 
jmp git1
byaz1:
mov dx,'B'
int 21h 
jmp git1
cyaz1:
mov dx,'C'
int 21h 
jmp git1
dyaz1:
mov dx,'D'
int 21h 
jmp git1
eyaz1:
mov dx,'E'
int 21h 
jmp git1
 
bitir:hlt
sayi db ?
say db ?

This post has been edited by excal.1905: 10 June 2009 - 08:34 AM

Was This Post Helpful? 0
  • +
  • -

#4 Dantheman  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 445
  • Joined: 27-May 09

Re: Read a character's ascii code convert to Hex,Octal in 8086

Posted 10 June 2009 - 09:29 AM

So... what seems to be the officer, problem?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1