Re: Formatting in assembly
- From: "James Daughtry" <mordock32@xxxxxxxxxxx>
- Date: 31 Mar 2006 05:36:47 -0800
¬a\/b wrote:
main:
call 'msvcrt._write',1,msg1,D$msg1_len
call 'msvcrt._read',0,buf,blen
dec eax | mov D$n,eax
call atoi,buf,D$n
call itoa,result,eax,D$n
call 'msvcrt._write',1,result,D$n
ide_exit
msvcrt._write(1,msg1,D$msg1_len);
etc
....
/* if return 1 OK, if return 0 error
itoa:
j=[s+4]; a=[s+8]; c=[s+12]; b=10;
c<>1; <#.ce; =#.c5;
.c0: { r=0; div b; /* r=a%10, a=a/10
rl+='0'; *j=rl; ++j; a==0#.c2;
.c1: --c#.c0;
}
.c2: i=[s+4]; B*j=0; c==0#.ce; --j;
#.c4;
.c3: {al=*i; *j<->al; *i=al; --j; ++i;
.c4: i<j#.c3
}
a=1;#.cf;
.c5: B*j=0;
.ce: a=0
.cf:
ret
NOT TESTED
What language is that? :-)
for me this itoa seems wrong at last because don't end the string with
\0 and not has some return error code
There's no need to terminate the string with 0 if you don't intend to
use any code that expects such a sentinel, which I didn't.
.
- Follow-Ups:
- Re: Formatting in assembly
- From: Dragontamer
- Re: Formatting in assembly
- References:
- Formatting in assembly
- From: James Daughtry
- Re: Formatting in assembly
- From: ¬a\\/b
- Formatting in assembly
- Prev by Date: Re: GDI can be fast!
- Next by Date: Re: Formatting in assembly
- Previous by thread: Re: Formatting in assembly
- Next by thread: Re: Formatting in assembly
- Index(es):
Relevant Pages
|