0

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
=======================================================

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by skaa
0

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
=======================================================

0

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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.