Re: ascii to st0

From: Ro (inp_out_at_sim.tim)
Date: 11/19/04


Date: Fri, 19 Nov 2004 17:22:55 GMT

On Thu, 18 Nov 2004 09:22:13 GMT, Ro <inp_out@sim.tim> wrote:
> *ShowWindow( D*WindowHandle, SW_SHOW);
> *UpdateWindow( D*WindowHandle );
> #.L1; finit;

      finit; #.L1;

> .While:
> {*TranslateMessage(FirstMessage);
> *DispatchMessageA(FirstMessage);
> .L1: *GetMessageA(FirstMessage, 0, 0, 0);
> a#.While
> }
> popad
> *ExitProcess(0);
>}
>

>[section .data]
> cw_data dw 0000001101111111b
> num0 dd 0
> num1 dd 0
> num00 dd 0
> num11 dd 0
> sign dd 0
> nim dd 0
>__SECT__

>/* segno in b
>/* numero in r:k, numero cifre in c, ultima posizione in j
>/* nel caso di errore o nessun numero stc altrimenti clc
>/* converti<origine i>
>/* 0 @sign, 4 i, 8 a, 12 Ra
>converti:
>< a, i /* i punta sempre al carattere
> /* corrente della stringa
><< @sign=[s]
> s-=4
> #.c1 /* leva gli spazi
>.c0: ++i| .c1: B*i==' ' #.c0;
> D @sign=0;
> B*i=='+' !#.b0 | ++i; #.c2
>.b0: B*i=='-' !#.c2 | ++i; ++D @sign;
>.c2: B*i>'9' #.ce
> B*i<'0' #.ce /* nel caso dopo eventuale + o -
> #.b1; /* c'e' un non numero => errore
>.ce: r=0; a=0; c=0; b=0; j=^4; ##.cf
>.b1: #.g1 /* leva gli zeri
>.g0: ++i| .g1: B*i=='0' #.g0;
> a=0; r=0; k=0; j=0; c=0;
>.c3: al=*i /* prende parte non esponente
> al<='9' !#.c4
> al>='0' !#.c4
> D*num00=k; D*num11=r;
            ^^^^^^^^^^^^^^^^^^^^^
           No need of this

> _mult10(); jc .c7
> al-='0'; k+=a | jnc .b2; ++r | jo .c7

                                           jo .cr

> .b2: ++i| #.c3;

 .cr: --c; --r;#.c7
But it is possible overflow for r above?
And then, there is the need of a test routine like this!

test:
  mov ecx, 1000000;
.qui:
  fai_sringa_float_casuale(indirizzo);
  asciToFloat(indirizzo, puntatore);
  asciToFloat_ok(indirizzo);
  st0!=st1
       {str val, "valori st0 st1 e ecx = %f %f %u", 13, 10
        dt hht0, hht1;
        hht0=st0; hht1=st1;
        print(val, t0, t1, ecx);
        fstp st0; fstp st0;
        goto .end
       }
  fstp st0; fstp st0;
  loop .qui
.end:
ret