assembly question
hey guys,
whoever knows assembly, i need help:
i want to convert AX (16 bit integer) and resolve it into its component digits into an 8-byte string.
so, i wanna do this:
number db 8 dup(0)
lea si, number
and lodsb for each resolved digit of the integer in AX
i know it involves dividing by 10 and taking the remainder, but the code i got from my book doesn''t seem to work or something.
i''ve tried doing this, but i don''t get the right answer. i''m a beginner in assembly too, so please bear with me.
do any of you have any assembler source to do this, or any links to source? thanks
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
It has been a long time, but a little assembly could be fun...
I guess this is enough assembly for me this year
|
I guess this is enough assembly for me this year
![](smile.gif)
![](http://baskuenen.cfxweb.net/images/title.jpg)
hey, thanks, bas
seem to save me all the time.
a2k
seem to save me all the time.
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
darn it,
that''s not what i wanted. my binary->ascii already works. my ascii->binary doesn''t work.
sorry.
the thing is, it only works if the string is terminated with a ''$'' it has to be terminated with anything other than digits.
a2k
that''s not what i wanted. my binary->ascii already works. my ascii->binary doesn''t work.
sorry.
the thing is, it only works if the string is terminated with a ''$'' it has to be terminated with anything other than digits.
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
I think it would be easier like this:
mov di, offset number+5
mov dl, 0
mov es:[di], dl
dec dl
mov bx, 10
mov cx, 5
repeat:
xor dx, dx
div bx
add dl, ''0''
mov es:[di], dl
dec di
dec cx
jnz repeat
I am too tired and too much in a hurry to write any comments or check if it actually works.
mov di, offset number+5
mov dl, 0
mov es:[di], dl
dec dl
mov bx, 10
mov cx, 5
repeat:
xor dx, dx
div bx
add dl, ''0''
mov es:[di], dl
dec di
dec cx
jnz repeat
I am too tired and too much in a hurry to write any comments or check if it actually works.
ascii->binary...hmmm...even easier.
I wasn''t planning on doing more assembly this year, but what the heck...
Now in speed optimised 32bit![](smile.gif)
C''mon guys, you''re missing all the fun in using 32 bit assembly !
Linear megabyte buffers, no more segment worries, and fast full 32bit regs
I wasn''t planning on doing more assembly this year, but what the heck...
Now in speed optimised 32bit
![](smile.gif)
|
C''mon guys, you''re missing all the fun in using 32 bit assembly !
Linear megabyte buffers, no more segment worries, and fast full 32bit regs
![](smile.gif)
![](http://baskuenen.cfxweb.net/images/title.jpg)
i''m actually taking an assembly class right now, and we''re not even using the extended registers. not sure how to do it this way. i''ve been working with measly 16-bit numbers. that''s all i need for this stupid project.
hey bas, was that code runnable or were you going off of it in your head? did you run it inline in visual c++? if so, how do you do it? not sure how to get my c++ compiler to run inline assembly.
a2k
hey bas, was that code runnable or were you going off of it in your head? did you run it inline in visual c++? if so, how do you do it? not sure how to get my c++ compiler to run inline assembly.
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
nevermind, found it in MSDN
a2k
a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement