954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

making program on assembly that change from hexadecimal number to binary (plz help)

Hey im new in this forum but really need help with making program on assembly 8086 that will take a string of 4 characters , then check if they are right and after that convert them to binary and decimal, then again hexadecimal, and in the end print something like this :

ADRESS: BINARY: DECIMAL: HEXADECIMAL:

FF00 1111111100000000 65280 16500

D3C2 1101001100101100 54060 1614

3344 0011001101000100 13124 3344

Im actually very bad in assembly , but im good in C , so i wrote it and tried to convert it to assembly, it didn't work :( , so it took 3 days just to understand how to make scanf function in assembler , and in two days i must finish this program, please help me !!!!!

dadisimo
Newbie Poster
1 post since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Let's first start with the user input.
Check out this post:
http://www.daniweb.com/software-development/assembly/code/270832

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

Here is a clue/key to what you can do.
I compiled this with the a86 compiler and watched the execution with (DOS) Debug.

Look what happens to the result in the output based on the setting of the first byte.

setBinary:
	mov si, strInput
	mov di, strOutput
doTest:
	test byte ptr[si], 8
	jz test4
	mov byte ptr[di+0], '1'
	
test4:
	test byte ptr[si], 4
	jz test2
	mov byte ptr[di+1], '1'
	
test2:
	test byte ptr[si], 2
	jz test1
	mov byte ptr[di+2], '1'
	
test1:
	test byte ptr[si], 1
	jz quit
	mov byte ptr[di+3], '1'
quit:
	int 20h
strInput:	db 'EF00$'
strOutput:	db '0000$'
thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

Do you still need this?

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: