I want to code assembly,Code assembly is convert number to character for ASCII code.

example.

=======================================================
Input ASCII CODE (in hexadecimal) press Esc to end the program : 41
Out put character is : A
=======================================================

Recommended Answers

All 2 Replies

sorry, that's kind of vague. at the very least, you'll need to know what processor architecture, operating system and assembler you want to code for. once you know that, maybe someone can point you in the right direction.

I want to code assembly,Code assembly is convert number to character for ASCII code.

example.

=======================================================
Input ASCII CODE (in hexadecimal) press Esc to end the program : 41
Out put character is : A
=======================================================

I did not care of errors because you did not write about them, so I do not know how to process them. Only digits and capitals 'A'-'F' are allowed to enter. Let me know if you have any questions.

;nasm -f bin HexToA.asm -o HexToA.com
;Convert HEX to character
	org	100h
start:
	jmp begin
data:
	sinp	times	255	db 0;string for input
begin:
	lea	si,[sinp]

	mov	cx,0
minputrp:
	mov	ah,1
	int	21h
	cmp al,27
	je minputex

	mov	[si],al

	inc	si
	inc	cx
	jmp minputrp
minputex:

	mov	bx,0
	mov	dx,1
mconvertrp:
	dec	si

	push	ax
	mov	ax,0
	mov	al,byte [si]
	sub	al,'0'
	cmp	byte [si],'A'
	jl	mconvertd
	sub	al,7
mconvertd:
	push	dx
	mul	dx
	pop	dx
	add	bx,ax

	mov	ax,16
	mul	dx
	mov	dx,ax
	pop	ax

	loop	mconvertrp

	mov ah,2
	mov dl,bl
	int	21h

	mov	ah,4ch
	int	21h
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.