Re: Formatting in assembly




James Daughtry wrote:
¬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? :-)

Everyone has their "perfect assembly language" :)

BTW: Herbert's is x86 assembly, seems to be a mix of Gas and some other
assembler I don't know.

--Dragontamer

.



Relevant Pages

  • Re: Insert a byte
    ... CLR eax and 'then' ADD? ... will not MOV eax |OR eax,eax become less foreward stalling? ... but in practice there is also a result register with ... therefore the assembler generates ...
    (alt.lang.asm)
  • Re: TYPE and SIZE Equivalent in NASM?
    ... If you are going to have an assembler perform type ... BX has is a 16-bit type, EAX is a 32-bit type. ... mov ebx, variableA ...
    (comp.lang.asm.x86)
  • Re: Just started ASM...
    ... This means that i consider "sub eax 0-1" to be way more ... You seem to ignore that RosAsm Syntax is WAY more flexible ... than any Assembler Syntax around. ... MOV, _EAX_ 0-1B ...
    (alt.lang.asm)
  • Re: convert Decimal to Hexa
    ... fasm assembler - flat binary ... mov eax, 1234CDEFh ... Download aeBIOS here ...
    (comp.lang.asm.x86)
  • Re: Math in asm... and limits...
    ... mov C, ax; ax -> C ... A bit assembler specific, ... was a trick to get the command prompt to switch into 16-bit emulation ... mov eax, A; ...
    (comp.lang.asm.x86)