Re: a problem in n5.dll in windows 95
From: Ro (inp_out_at_sim.tim)
Date: 12/21/04
- Next message: T.M. Sommers: "Re: A snapshot of the LuxAsm developments"
- Previous message: Alex: "Re: [ Attn: Randy ] Ad-hoc Parsing?"
- In reply to: Ro : "a problem in n5.dll in windows 95"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Dec 2004 07:52:23 GMT
On Thu, 16 Dec 2004 17:15:35 GMT, Ro <inp_out@sim.tim> wrote:
>; eax St0ToAscii( char* string, uint intPart, uint decPart )
><st0>;
>;
>; Suppone che la stringa sia sufficientemente ampia, ritorna in eax il
>; numero di caratteri scritti, usa due registri float, se intPart==0
>; scrive il numero senza esponente se l'esponente permette (0<e<=17)
>; altrimenti (intPart, decPart)=( 1, decPart ), se intPart o decPart
>; sono fuori range li aggiusta privilegiando intPart
>; k: 0k, 4 ra, 8 P_string, 12 P_intPart, 16 P_decPart
>St0ToAscii:
> push ebp
> mov ebp, esp
> push ebx
> push ecx
> push edx
> push esi
> sub esp, 64
> ; 10, 20; 0-9=num, 12-15=exp, 16-17=wc_temp 20-29=bcd
> %define @string [ebp+8]
> %define @exp [esp+12]
> %define @wc_temp [esp+16]
> %define @bcd [esp+20]
> fnstcw @wc_temp
> mov dword[esp+8], 0
> fldcw [cw_data] ; resetta tutto + troncamento
> fxam
> ; controlla numero in st0 setta c0, c1, c2, c3
> mov esi, @string
> fnstsw ax ; store in ax content of stauts reg
>; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
>; c0 c1 c2 c3
>; c1= sign; c3, c2, c0
>; non suppo. 0 0 0 formato
>; NaN 0 0 1
>; Finite num. 0 1 0
>; Infinity 0 1 1
>; Zero 1 0 0
>; Empty reg. 1 0 1
>; Denormal 1 1 0
> mov al, ah
> test al, 00000010b
> jz .c0
> mov byte[esi], '-'
> jmp short .c1
>.c0:
>mov byte[esi], '+'
>.c1: ; leva il bit del segno
>inc esi
>and al, 01000101b
> cmp al, 00000000b
> jne .c2 ; in .cf nessuna operazione in fpu-stack
> dec esi
> mov dword[esi], 'Ns'
> mov eax, 2
> jmp .cf
>.c2:
>cmp al, 00000001b
>jne .c3
> dec esi
> mov dword[esi], 'NaN'
> mov eax, 3
> jmp .cf
>.c3:
>cmp al, 00000101b
>jne .c4
> mov dword[esi], 'InF'
> mov eax, 4
> jmp .cf
>.c4:
>cmp al, 01000000b
>jne .c5
> mov dword[esi], '0.0'
> mov eax, 4
> jmp .cf
>.c5:
>cmp al, 01000001b
>jne .c7
> dec esi
> mov dword[esi], 'Nul'
> mov eax, 3
> jmp .cf
>.c6:
>mov dword[esi], '0.0'
>mov eax, 4
mov eax, 3
>jmp .ca
>.c7: ; st = num, num
[...]
>; ---------------- ripristino
>.ca: ; ricarica il numero nello fpu-stack
>fld tword[esp]
>; st = num
> inc eax ; per il '-' o il '+' iniziale
>.cf:
>fldcw @wc_temp
> %undef @string
> %undef @exp
> %undef @wc_temp
> %undef @bcd
> add esp, 64
> pop esi
> pop edx
> pop ecx
> pop ebx
> mov esp, ebp
> pop ebp
> ret 12
>
- Next message: T.M. Sommers: "Re: A snapshot of the LuxAsm developments"
- Previous message: Alex: "Re: [ Attn: Randy ] Ad-hoc Parsing?"
- In reply to: Ro : "a problem in n5.dll in windows 95"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|