[alt.lang.asm,comp.lang.c]assembly Vs C Language

¬

¬a\\/b

Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Can you write what this below does, better and more clear in C? :)

/* ritorna -1 D[s+116Funzione_chiamante]==D[s+20qui]==-1 se errore
/* ritorna 0 D[s+116Funzione_chiamante]==linea_ricevuta_len se OK
/* 0j, 4i, 8r, 12c, 16b, 20ra, 24P_a
dg_threadf:
< b, c, r, i, j
/* 100:4(socket), 104:4(@ibuf), 108:4(ilen)
/* 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
/* 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
/* 156:4(len)
i=[s+24]; b=*i;
..0: r=[i+4]; c=[i+8];
j=&[i+36]; a=&[i+56]; D*a=16;
recvfrom(b, r, c, 0, j, a);
a==SOCKET_ERROR!#.1
..e: a=-1; D[i+16]=a; #.f;
..1: D[i+32] #.e; /* timeout
D[j+20]<8#.e /* risposta troppo piccola
r=[j]; c=[i+24]; c=[c]; r!=[c] #.0;
/* confronta addr. port
/* del messaggio con quelle da ricevere
r=[j+4]; r!=[c+4]#.0;
D[i+16]=a; a=0; /* fine ok
..f:
b, c, r, i, j
ret 4

/* int dg_SndRcv( char* ibuf, int ilen, char* obuf, int olen,
/* int fd, char* destAdd_cliAdd, int destLen, int* Pint3A)
/* funzione che manda domanda(obuf), riceve risposta(ibuf) usando UDP
/* se timeout senza risposta o errori ritorna -1 e CF==1
/* altrimenti ritorna lunghezza messaggio ricevuto e CF==0
/*
/* "Pint3A" punta a un vettore di 3 interi inizializzato
/* per la prima volta a "Pint3A[0]=0; Pint3A[1]=0; Pint3A[2]=4;"
/*
/* 256+28=284, 256+32=288
/* 0k, 4j, 8i, 12r, 16c, 20b, 24ra, 28P_ibuf, 32P_ilen, 36P_obuf,
/* 40P_olen
/* 44P_fd, 48P_destAdd, 52P_destLen, 56P_Pint3A
dg_SndRcv:
< b, c, r, i, j, k
s-=256
<< @ibuf=[s+284], @ilen=[s+288], @obuf=[s+292], @olen=[s+296]
<< @fd=[s+300], @destAdd=[s+304], @destLen=[s+308], @Pint3A=[s+312]
<< @t=[k], @c=[k+4], @delta=[k+8]
/* s = 0:4(var), 16:4(Var), 24:4(N.trasmissioni),
/* 32:4(Tempo totale), 36:16(NewAddr), 56:4(newLen)
/* 100:4(socket), 104:4(@ibuf), 108:4(ilen)
/* 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
/* 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?),
/* 156:4(len)
/* 200:16(& @cliaddr)
i=@obuf; k=@Pint3A; D[s+24]=4; /* 1+tre ritrasmissioni
D[s+16]=0;
D @ibuf==0#.e; i==0#.e;
D @destAdd==0!#.a| D @destLen!=0#.e; #.b;
..a: D @destLen<0 ?#.e;
..b: b=@fd; b==-1#.e; D @ilen<=0?#.e; D @olen<0?#.e;
k!#.e; j=@t; D[s+32]=j; #.1;
..e: a=-1; stc; ##.f;
..1: D @t!=0!#.2
D @t > 10000#.c; /* 10s se esageratamente grande vai e ricalcola
c=@c; c==@delta!#.2 /* aggiorna il timer per velocita'
..c: D @t=0; D @c=0; j=0; /* maggiori ogni "delta" pacchetti
D[s+32]=j; /* aggiorna estimatori ogni 200 volte
D @delta>200#.2| D @delta <<= 1; /* delta cresce
all'inizio
..2: D*s="."; a=s; _P<(a);
a=@olen; r=@destAdd; c=@destLen; i=@obuf;
sendto(b, i, a, 0, r, c); a!=@olen#.e;
D[s+16]#.3;
c=@ilen; r=@ibuf; a=&[s+100];
*a=b; D[a+4]=r; D[a+8]=c; i=&[a+12];
r=& @destAdd; c = & @destLen;
D[a+24]=r; D[a+28]=c; D[a+32]=0;
CreateThread(0, 0, dg_threadf, a, 0, i);
a==0#.e; [s+16]=a;
..3: j=@t;
..4: a=@t; Sleep(a);
a=[s+16]; c=s; GetExitCodeThread(a, c); a==0#.6;
D*s!=STILL_ACTIVE!#.5
b=[s+116]; b<0?#.7;
a=[s+32]; @t=a; ++D @c;
a=b; clc; ##.f;
..5: a=@t; j+=@t; ++a; D[s+32]+=a; @t=a;
/* il tempo aumenta se problemi
j>30100!#.4 /* 30 secondi timeout per nuovo sendto
--D[s+24]!#.ee; ##.2; /* 1+3 volte rinvia sendto;
..6: ##.e1;
..6a: PrintSockError(); ##.e1;
..6b: ##.9;
..7: D @t=0; D @c=0; D @delta=4; a=-1; stc; ##.f; /* reset
..ee: _P<("Timeout ... \n"); D[s+132]=1;
socket(AF_INET, SOCK_DGRAM, 0 ); a==INVALID_SOCKET#.6a;
i=a; /* nome del socket client [quello del client]
r=&[s+200]; a=&[s+8]; D*a=16; getsockname(b, r, a); a#.6b;
inet_addr("127.0.0.1"); a==INADDR_NONE#.9;
r=&[s+200]; j^=j; [r+sin_addr]=a;
/* printSockAddr_in(r);
..8: r=&[s+200]; a=&[s+8]; c=&[s+4]; sendto(i, c, 0, 0, r, a);
a!=0#.9;
..55: Sleep(500); a=[s+16]; c=s; GetExitCodeThread(a, c); a==0#.9;
++j; D*s!=STILL_ACTIVE#.9; j==7#.9;
j==3#.8; #.55;
..9: dg_close1(i); jnc .e1;
_P<("dg_SndRcv: Errore nel chiudere il socket\n");
/* chiude i=socket, j=thread
..e1: j=[s+16]; CloseHandle(j); a==0#.77; ##.7 /* errore==0 #.77
..77: TerminateThread(j, 0); CloseHandle(j); ##.7;
..f: /* se dopo 4 volte ancora nessuna risposta
esce
@t, @c, @delta /* e ritorna -1
@fd, @destAdd, @destLen, @Pint3A
@ibuf, @ilen, @obuf, @olen
s=&[s+256];
b, c, r, i, j, k
ret 32

this is the traslation
; ritorna -1 D[s+116Funzione_chiamante]==D[s+20qui]==-1 se errore
; ritorna 0 D[s+116Funzione_chiamante]==linea_ricevuta_len se OK
; 0j, 4i, 8r, 12c, 16b, 20ra, 24P_a
dg_threadf:
push ebx
push ecx
push edx
push esi
push edi
; 100:4(socket), 104:4(@ibuf), 108:4(ilen)
; 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
; 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
; 156:4(len)
mov esi, [esp+24]
mov ebx, [esi]
..0:
mov edx, [esi+4]
mov ecx, [esi+8]
lea edi, [esi+36]
lea eax, [esi+56]
mov dword[eax], 16
push eax
push edi
push 0
push ecx
push edx
push ebx
call recvfrom
cmp eax, SOCKET_ERROR
jne .1
..e:
mov eax, -1
mov dword[esi+16], eax
jmp short .f
..1: ; timeout
cmp dword[esi+32] , 0
jne .e
cmp dword[edi+20], 8
jb .e ; risposta troppo piccola
mov edx, [edi] ; confronta addr. port
mov ecx, [esi+24]
mov ecx, [ecx]
cmp edx, [ecx]
jne .0
mov edx, [edi+4] ; del messaggio con quelle da ricevere
cmp edx, [ecx+4]
jne .0
mov dword[esi+16], eax ; fine ok
mov eax, 0
..f:
pop edi
pop esi
pop edx
pop ecx
pop ebx
ret 4

; int dg_SndRcv( char* ibuf, int ilen, char* obuf, int olen,
; int fd, char* destAdd_cliAdd, int destLen, int* Pint3A)
; funzione che manda domanda(obuf), riceve risposta(ibuf) usando UDP
; se timeout senza risposta o errori ritorna -1 e CF==1
; altrimenti ritorna lunghezza messaggio ricevuto e CF==0
;
; "Pint3A" punta a un vettore di 3 interi inizializzato
; per la prima volta a "Pint3A[0]=0; Pint3A[1]=0; Pint3A[2]=4;"
;
; 256+28=284, 256+32=288
; 0k, 4j, 8i, 12r, 16c, 20b, 24ra, 28P_ibuf, 32P_ilen, 36P_obuf,
40P_olen
; 44P_fd, 48P_destAdd, 52P_destLen, 56P_Pint3A
dg_SndRcv:
push ebx
push ecx
push edx
push esi
push edi
push ebp
sub esp, 256
%define @ibuf [esp+284]
%define @ilen [esp+288]
%define @obuf [esp+292]
%define @olen [esp+296]
%define @fd [esp+300]
%define @destAdd [esp+304]
%define @destLen [esp+308]
%define @Pint3A [esp+312]
%define @t [ebp]
%define @c [ebp+4]
%define @delta [ebp+8]
; s = 0:4(var), 16:4(Var), 24:4(N.trasmissioni)
; 32:4(Tempo totale), 36:16(NewAddr), 56:4(newLen)
; 100:4(socket), 104:4(@ibuf), 108:4(ilen)
; 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
; 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
; 156:4(len)
; 200:16(& @cliaddr)
mov esi, @obuf ; 1+tre ritrasmissioni
mov ebp, @Pint3A
mov dword[esp+24], 4
mov dword[esp+16], 0
cmp dword @ibuf, 0
je .e
cmp esi, 0
je .e
cmp dword @destAdd, 0
jne .a
cmp dword @destLen, 0
jne .e
jmp short .b
..a:
cmp dword @destLen, 0
jl .e
..b:
mov ebx, @fd
cmp ebx, -1
je .e
cmp dword @ilen, 0
jle .e
cmp dword @olen, 0
jl .e
cmp ebp, 0
je .e
mov edi, @t
mov dword[esp+32], edi
jmp short .1
..e:
mov eax, -1
stc
jmp .f
..1:
cmp dword @t, 0
je .2
cmp dword @t, 10000
ja .c ; 10s se esageratamente grande vai e ricalcola
mov ecx, @c ; aggiorna il timer per velocita'
cmp ecx, @delta
jne .2
..c: ; maggiori ogni "delta" pacchetti
mov dword @t, 0
mov dword @c, 0
mov edi, 0
mov dword[esp+32], edi ; aggiorna estimatori ogni 200 volte
cmp dword @delta, 200
ja .2 ; delta cresce all'inizio
shl dword @delta, 1
..2:
mov dword[esp], "."
mov eax, esp
push eax
call _P
add esp, 4
mov eax, @olen
mov edx, @destAdd
mov ecx, @destLen
mov esi, @obuf
push ecx
push edx
push 0
push eax
push esi
push ebx
call sendto
cmp eax, @olen
jne .e
cmp dword[esp+16], 0
jne .3
mov ecx, @ilen
mov edx, @ibuf
lea eax, [esp+100]
mov [eax], ebx
mov dword[eax+4], edx
mov dword[eax+8], ecx
lea esi, [eax+12]
lea edx, @destAdd
lea ecx, @destLen
mov dword[eax+24], edx
mov dword[eax+28], ecx
mov dword[eax+32], 0
push esi
push 0
push eax
push dg_threadf
push 0
push 0
call CreateThread
cmp eax, 0
je .e
mov [esp+16], eax
..3:
mov edi, @t
..4:
mov eax, @t
push eax
call Sleep
mov eax, [esp+16]
mov ecx, esp
push ecx
push eax
call GetExitCodeThread
cmp eax, 0
je .6
cmp dword[esp], STILL_ACTIVE
je .5
mov ebx, [esp+116]
cmp ebx, 0
jl .7
mov eax, [esp+32]
mov @t, eax
inc dword @c
mov eax, ebx
clc
jmp .f
..5: ; il tempo aumenta se problemi
mov eax, @t
add edi, @t
inc eax
add dword[esp+32], eax
mov @t, eax
cmp edi, 30100
jbe .4 ; 30 secondi timeout per nuovo sendto
dec dword[esp+24]
jz .ee ; 1+3 volte rinvia sendto;
jmp .2
..6:
jmp .e1
..6a:
call PrintSockError
jmp .e1
..6b:
jmp .9
..7: ; reset
mov dword @t, 0
mov dword @c, 0
mov dword @delta, 4
mov eax, -1
stc
jmp .f
..ee:
push _Timeout_$$$_$n
call _P
add esp, 4
mov dword[esp+132], 1
push 0
push SOCK_DGRAM
push AF_INET
call socket
cmp eax, INVALID_SOCKET
je .6a
mov esi, eax
lea edx, [esp+200]
lea eax, [esp+8]
mov dword[eax], 16
push eax
push edx
push ebx
call getsockname
cmp eax, 0
jne .6b
push _127$0$0$1
call inet_addr
cmp eax, INADDR_NONE
je .9
lea edx, [esp+200]
xor edi, edi
mov [edx+sin_addr], eax
; printSockAddr_in(r);
..8:
lea edx, [esp+200]
lea eax, [esp+8]
lea ecx, [esp+4]
push eax
push edx
push 0
push 0
push ecx
push esi
call sendto
cmp eax, 0
jne .9
..55:
push 500
call Sleep
mov eax, [esp+16]
mov ecx, esp
push ecx
push eax
call GetExitCodeThread
cmp eax, 0
je .9
inc edi
cmp dword[esp], STILL_ACTIVE
jne .9
cmp edi, 7
je .9
cmp edi, 3
je .8
jmp short .55
..9:
push esi
call dg_close1
jnc .e1
push _dg$SndRcv$_Errore_nel_chiudere_il_socket$n
call _P
add esp, 4
; chiude i=socket, j=thread
..e1: ; errore==0 #.77
mov edi, [esp+16]
push edi
call CloseHandle
cmp eax, 0
je .77
jmp .7
..77:
push 0
push edi
call TerminateThread
push edi
call CloseHandle
jmp .7
..f: ; se dopo 4 volte ancora nessuna risposta esce

%undef @t
%undef @c
%undef @delta ; e ritorna -1
%undef @fd
%undef @destAdd
%undef @destLen
%undef @Pint3A
%undef @ibuf
%undef @ilen
%undef @obuf
%undef @olen
lea esp, [esp+256]
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
ret 32
 
S

santosh

¬a\/b alias "Rsolscarliola" said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Can you write what this below does, better and more clear in C? :)

Even the Cosmic Microwave Background would be clearer than your mess.
By the way, I'm sure anything that your little language can do can be
done in C. The only disadvantages might be better portability,
readability, acceptance, industry conformance, etc. etc.
 
M

MQ

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Can you write what this below does, better and more clear in C? :)

/* ritorna -1 D[s+116Funzione_chiamante]==D[s+20qui]==-1 se errore
/* ritorna 0 D[s+116Funzione_chiamante]==linea_ricevuta_len se OK
/* 0j, 4i, 8r, 12c, 16b, 20ra, 24P_a
dg_threadf:
< b, c, r, i, j
/* 100:4(socket), 104:4(@ibuf), 108:4(ilen)
/* 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
/* 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
/* 156:4(len)
i=[s+24]; b=*i;
.0: r=[i+4]; c=[i+8];
j=&[i+36]; a=&[i+56]; D*a=16;
recvfrom(b, r, c, 0, j, a);
a==SOCKET_ERROR!#.1
.e: a=-1; D[i+16]=a; #.f;
.1: D[i+32] #.e; /* timeout
D[j+20]<8#.e /* risposta troppo piccola
r=[j]; c=[i+24]; c=[c]; r!=[c] #.0;
/* confronta addr. port
/* del messaggio con quelle da ricevere
r=[j+4]; r!=[c+4]#.0;
D[i+16]=a; a=0; /* fine ok
.f:
b, c, r, i, j
ret 4

/* int dg_SndRcv( char* ibuf, int ilen, char* obuf, int olen,
/* int fd, char* destAdd_cliAdd, int destLen, int* Pint3A)
/* funzione che manda domanda(obuf), riceve risposta(ibuf) usando UDP
/* se timeout senza risposta o errori ritorna -1 e CF==1
/* altrimenti ritorna lunghezza messaggio ricevuto e CF==0
/*
/* "Pint3A" punta a un vettore di 3 interi inizializzato
/* per la prima volta a "Pint3A[0]=0; Pint3A[1]=0; Pint3A[2]=4;"
/*
/* 256+28=284, 256+32=288
/* 0k, 4j, 8i, 12r, 16c, 20b, 24ra, 28P_ibuf, 32P_ilen, 36P_obuf,
/* 40P_olen
/* 44P_fd, 48P_destAdd, 52P_destLen, 56P_Pint3A
dg_SndRcv:
< b, c, r, i, j, k
s-=256
<< @ibuf=[s+284], @ilen=[s+288], @obuf=[s+292], @olen=[s+296]
<< @fd=[s+300], @destAdd=[s+304], @destLen=[s+308], @Pint3A=[s+312]
<< @t=[k], @c=[k+4], @delta=[k+8]
/* s = 0:4(var), 16:4(Var), 24:4(N.trasmissioni),
/* 32:4(Tempo totale), 36:16(NewAddr), 56:4(newLen)
/* 100:4(socket), 104:4(@ibuf), 108:4(ilen)
/* 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
/* 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?),
/* 156:4(len)
/* 200:16(& @cliaddr)
i=@obuf; k=@Pint3A; D[s+24]=4; /* 1+tre ritrasmissioni
D[s+16]=0;
D @ibuf==0#.e; i==0#.e;
D @destAdd==0!#.a| D @destLen!=0#.e; #.b;
.a: D @destLen<0 ?#.e;
.b: b=@fd; b==-1#.e; D @ilen<=0?#.e; D @olen<0?#.e;
k!#.e; j=@t; D[s+32]=j; #.1;
.e: a=-1; stc; ##.f;
.1: D @t!=0!#.2
D @t > 10000#.c; /* 10s se esageratamente grande vai e ricalcola
c=@c; c==@delta!#.2 /* aggiorna il timer per velocita'
.c: D @t=0; D @c=0; j=0; /* maggiori ogni "delta" pacchetti
D[s+32]=j; /* aggiorna estimatori ogni 200 volte
D @delta>200#.2| D @delta <<= 1; /* delta cresce
all'inizio
.2: D*s="."; a=s; _P<(a);
a=@olen; r=@destAdd; c=@destLen; i=@obuf;
sendto(b, i, a, 0, r, c); a!=@olen#.e;
D[s+16]#.3;
c=@ilen; r=@ibuf; a=&[s+100];
*a=b; D[a+4]=r; D[a+8]=c; i=&[a+12];
r=& @destAdd; c = & @destLen;
D[a+24]=r; D[a+28]=c; D[a+32]=0;
CreateThread(0, 0, dg_threadf, a, 0, i);
a==0#.e; [s+16]=a;
.3: j=@t;
.4: a=@t; Sleep(a);
a=[s+16]; c=s; GetExitCodeThread(a, c); a==0#.6;
D*s!=STILL_ACTIVE!#.5
b=[s+116]; b<0?#.7;
a=[s+32]; @t=a; ++D @c;
a=b; clc; ##.f;
.5: a=@t; j+=@t; ++a; D[s+32]+=a; @t=a;
/* il tempo aumenta se problemi
j>30100!#.4 /* 30 secondi timeout per nuovo sendto
--D[s+24]!#.ee; ##.2; /* 1+3 volte rinvia sendto;
.6: ##.e1;
.6a: PrintSockError(); ##.e1;
.6b: ##.9;
.7: D @t=0; D @c=0; D @delta=4; a=-1; stc; ##.f; /* reset
.ee: _P<("Timeout ... \n"); D[s+132]=1;
socket(AF_INET, SOCK_DGRAM, 0 ); a==INVALID_SOCKET#.6a;
i=a; /* nome del socket client [quello del client]
r=&[s+200]; a=&[s+8]; D*a=16; getsockname(b, r, a); a#.6b;
inet_addr("127.0.0.1"); a==INADDR_NONE#.9;
r=&[s+200]; j^=j; [r+sin_addr]=a;
/* printSockAddr_in(r);
.8: r=&[s+200]; a=&[s+8]; c=&[s+4]; sendto(i, c, 0, 0, r, a);
a!=0#.9;
.55: Sleep(500); a=[s+16]; c=s; GetExitCodeThread(a, c); a==0#.9;
++j; D*s!=STILL_ACTIVE#.9; j==7#.9;
j==3#.8; #.55;
.9: dg_close1(i); jnc .e1;
_P<("dg_SndRcv: Errore nel chiudere il socket\n");
/* chiude i=socket, j=thread
.e1: j=[s+16]; CloseHandle(j); a==0#.77; ##.7 /* errore==0 #.77
.77: TerminateThread(j, 0); CloseHandle(j); ##.7;
.f: /* se dopo 4 volte ancora nessuna risposta
esce
@t, @c, @delta /* e ritorna -1
@fd, @destAdd, @destLen, @Pint3A
@ibuf, @ilen, @obuf, @olen
s=&[s+256];
b, c, r, i, j, k
ret 32

this is the traslation
; ritorna -1 D[s+116Funzione_chiamante]==D[s+20qui]==-1 se errore
; ritorna 0 D[s+116Funzione_chiamante]==linea_ricevuta_len se OK
; 0j, 4i, 8r, 12c, 16b, 20ra, 24P_a
dg_threadf:
push ebx
push ecx
push edx
push esi
push edi
; 100:4(socket), 104:4(@ibuf), 108:4(ilen)
; 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
; 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
; 156:4(len)
mov esi, [esp+24]
mov ebx, [esi]
.0:
mov edx, [esi+4]
mov ecx, [esi+8]
lea edi, [esi+36]
lea eax, [esi+56]
mov dword[eax], 16
push eax
push edi
push 0
push ecx
push edx
push ebx
call recvfrom
cmp eax, SOCKET_ERROR
jne .1
.e:
mov eax, -1
mov dword[esi+16], eax
jmp short .f
.1: ; timeout
cmp dword[esi+32] , 0
jne .e
cmp dword[edi+20], 8
jb .e ; risposta troppo piccola
mov edx, [edi] ; confronta addr. port
mov ecx, [esi+24]
mov ecx, [ecx]
cmp edx, [ecx]
jne .0
mov edx, [edi+4] ; del messaggio con quelle da ricevere
cmp edx, [ecx+4]
jne .0
mov dword[esi+16], eax ; fine ok
mov eax, 0
.f:
pop edi
pop esi
pop edx
pop ecx
pop ebx
ret 4

; int dg_SndRcv( char* ibuf, int ilen, char* obuf, int olen,
; int fd, char* destAdd_cliAdd, int destLen, int* Pint3A)
; funzione che manda domanda(obuf), riceve risposta(ibuf) usando UDP
; se timeout senza risposta o errori ritorna -1 e CF==1
; altrimenti ritorna lunghezza messaggio ricevuto e CF==0
;
; "Pint3A" punta a un vettore di 3 interi inizializzato
; per la prima volta a "Pint3A[0]=0; Pint3A[1]=0; Pint3A[2]=4;"
;
; 256+28=284, 256+32=288
; 0k, 4j, 8i, 12r, 16c, 20b, 24ra, 28P_ibuf, 32P_ilen, 36P_obuf,
40P_olen
; 44P_fd, 48P_destAdd, 52P_destLen, 56P_Pint3A
dg_SndRcv:
push ebx
push ecx
push edx
push esi
push edi
push ebp
sub esp, 256
%define @ibuf [esp+284]
%define @ilen [esp+288]
%define @obuf [esp+292]
%define @olen [esp+296]
%define @fd [esp+300]
%define @destAdd [esp+304]
%define @destLen [esp+308]
%define @Pint3A [esp+312]
%define @t [ebp]
%define @c [ebp+4]
%define @delta [ebp+8]
; s = 0:4(var), 16:4(Var), 24:4(N.trasmissioni)
; 32:4(Tempo totale), 36:16(NewAddr), 56:4(newLen)
; 100:4(socket), 104:4(@ibuf), 108:4(ilen)
; 112:4(var), 116:4(Valore ret di dg_threadf), 124:4(& @destAdd)
; 128:4(& @destLen), 132:4(Timeout), 136:16(fromwhere?)
; 156:4(len)
; 200:16(& @cliaddr)
mov esi, @obuf ; 1+tre ritrasmissioni
mov ebp, @Pint3A
mov dword[esp+24], 4
mov dword[esp+16], 0
cmp dword @ibuf, 0
je .e
cmp esi, 0
je .e
cmp dword @destAdd, 0
jne .a
cmp dword @destLen, 0
jne .e
jmp short .b
.a:
cmp dword @destLen, 0
jl .e
.b:
mov ebx, @fd
cmp ebx, -1
je .e
cmp dword @ilen, 0
jle .e
cmp dword @olen, 0
jl .e
cmp ebp, 0
je .e
mov edi, @t
mov dword[esp+32], edi
jmp short .1
.e:
mov eax, -1
stc
jmp .f
.1:
cmp dword @t, 0
je .2
cmp dword @t, 10000
ja .c ; 10s se esageratamente grande vai e ricalcola
mov ecx, @c ; aggiorna il timer per velocita'
cmp ecx, @delta
jne .2
.c: ; maggiori ogni "delta" pacchetti
mov dword @t, 0
mov dword @c, 0
mov edi, 0
mov dword[esp+32], edi ; aggiorna estimatori ogni 200 volte
cmp dword @delta, 200
ja .2 ; delta cresce all'inizio
shl dword @delta, 1
.2:
mov dword[esp], "."
mov eax, esp
push eax
call _P
add esp, 4
mov eax, @olen
mov edx, @destAdd
mov ecx, @destLen
mov esi, @obuf
push ecx
push edx
push 0
push eax
push esi
push ebx
call sendto
cmp eax, @olen
jne .e
cmp dword[esp+16], 0
jne .3
mov ecx, @ilen
mov edx, @ibuf
lea eax, [esp+100]
mov [eax], ebx
mov dword[eax+4], edx
mov dword[eax+8], ecx
lea esi, [eax+12]
lea edx, @destAdd
lea ecx, @destLen
mov dword[eax+24], edx
mov dword[eax+28], ecx
mov dword[eax+32], 0
push esi
push 0
push eax
push dg_threadf
push 0
push 0
call CreateThread
cmp eax, 0
je .e
mov [esp+16], eax
.3:
mov edi, @t
.4:
mov eax, @t
push eax
call Sleep
mov eax, [esp+16]
mov ecx, esp
push ecx
push eax
call GetExitCodeThread
cmp eax, 0
je .6
cmp dword[esp], STILL_ACTIVE
je .5
mov ebx, [esp+116]
cmp ebx, 0
jl .7
mov eax, [esp+32]
mov @t, eax
inc dword @c
mov eax, ebx
clc
jmp .f
.5: ; il tempo aumenta se problemi
mov eax, @t
add edi, @t
inc eax
add dword[esp+32], eax
mov @t, eax
cmp edi, 30100
jbe .4 ; 30 secondi timeout per nuovo sendto
dec dword[esp+24]
jz .ee ; 1+3 volte rinvia sendto;
jmp .2
.6:
jmp .e1
.6a:
call PrintSockError
jmp .e1
.6b:
jmp .9
.7: ; reset
mov dword @t, 0
mov dword @c, 0
mov dword @delta, 4
mov eax, -1
stc
jmp .f
.ee:
push _Timeout_$$$_$n
call _P
add esp, 4
mov dword[esp+132], 1
push 0
push SOCK_DGRAM
push AF_INET
call socket
cmp eax, INVALID_SOCKET
je .6a
mov esi, eax
lea edx, [esp+200]
lea eax, [esp+8]
mov dword[eax], 16
push eax
push edx
push ebx
call getsockname
cmp eax, 0
jne .6b
push _127$0$0$1
call inet_addr
cmp eax, INADDR_NONE
je .9
lea edx, [esp+200]
xor edi, edi
mov [edx+sin_addr], eax
; printSockAddr_in(r);
.8:
lea edx, [esp+200]
lea eax, [esp+8]
lea ecx, [esp+4]
push eax
push edx
push 0
push 0
push ecx
push esi
call sendto
cmp eax, 0
jne .9
.55:
push 500
call Sleep
mov eax, [esp+16]
mov ecx, esp
push ecx
push eax
call GetExitCodeThread
cmp eax, 0
je .9
inc edi
cmp dword[esp], STILL_ACTIVE
jne .9
cmp edi, 7
je .9
cmp edi, 3
je .8
jmp short .55
.9:
push esi
call dg_close1
jnc .e1
push _dg$SndRcv$_Errore_nel_chiudere_il_socket$n
call _P
add esp, 4
; chiude i=socket, j=thread
.e1: ; errore==0 #.77
mov edi, [esp+16]
push edi
call CloseHandle
cmp eax, 0
je .77
jmp .7
.77:
push 0
push edi
call TerminateThread
push edi
call CloseHandle
jmp .7
.f: ; se dopo 4 volte ancora nessuna risposta esce

%undef @t
%undef @c
%undef @delta ; e ritorna -1
%undef @fd
%undef @destAdd
%undef @destLen
%undef @Pint3A
%undef @ibuf
%undef @ilen
%undef @obuf
%undef @olen
lea esp, [esp+256]
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
ret 32


Yuck
 
K

Keith Thompson

MQ said:
¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Can you write what this below does, better and more clear in C? :)
[459 lines deleted]


Yuck

Surely you could have expressed your opinion (with which I agree
wholeheartedly) without quoting the whole ugly thing.
 
K

kinebud

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Can you write what this below does, better and more clear in C? :)

.... Are you clinically insane?

Seriously though: I'm pretty sure you're definately wrong either way.

-Peace out,
Austin
 
R

Richard Heathfield

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Whether or not I belive it (on which I have no opinion), I certainly don't
believe it.
Can you write what this below does, better and more clear in C? :)

Yes, easily, provided it is properly specified and remunerated.

<hundreds of lines of junk snipped>
 
D

Donkey

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

etc...

Although I commend you on your effort to add yet another layer of
obfuscation and confusion to assembly language (well done) I have to go
take an aspirin now...

Donkey
 
¬

¬a\\/b

Although I commend you on your effort to add yet another layer of
obfuscation and confusion to assembly language (well done) I have to go
take an aspirin now...

Donkey

so i'm alone to think that
 
F

f0dder

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

*snip*
I'd rather read a raw disassembly, your language is worse than line noise -
sorry :)
 
E

Evenbit

¬a\/b said:
Belive it or not, with my little symbols language assembly is
1000 times better than C in **in practice**

Only for you. It *is* inventive! It *is* original thought! But, it
does a lot more than RosAsm, HLA, or Daniela/Windela/Lindela in terms
of kicking against the mainstream way of doing things. I suggest that
you write a manual for it and post it as an Esoteric programming
language.

Nathan.
 
S

santosh

Evenbit said:
Only for you. It *is* inventive! It *is* original thought! But, it
does a lot more than RosAsm, HLA, or Daniela/Windela/Lindela in terms
of kicking against the mainstream way of doing things. I suggest that
you write a manual for it and post it as an Esoteric programming
language.

IMHO, not *all* that original. Terse and APL are two languages, among
possibly others, that are pretty close, syntactically, to symbol guy's
soup.
:)
 
K

KiLVaiDeN

¬a\/b wrote :
Lot of lines [snipped..]

Your language is not that bad. Here are cons and pros I see to is :

Pros :
- It's small. Once learned, I guess you can write fast code without
typing hundreds of lines.
- It's ugly. I see it as an advantage, because then your source code
is automatically obfuscated ;) Well... Not that much though, but still
:)

Cons :
- It's ugly. Sorry but nobody would want to learn a language that
gives a headache after reading 2 lines with so many signs, already C is
bashed for it's symbols soup, but your is like C but worse.
- It's hard to see the program flow.. I don't feel the flow of the
program "reading" your code, it's like so little that it looks like a
micro program.. Doesn't feel that good tbh.
- The use of such short variable names for registers is like
overkill. The register already have short names, no need to further
more shorten them imo.

Overall, it's an interesting addition to the existing bunch of
programming languages available; There WILL be people who like it, like
there is people who like to dress with flowers on their trousers. So
post it somewhere, document it, my advice :)

Cheers
K
 
¬

¬a\\/b

¬a\/b wrote :
Lot of lines [snipped..]
Cons :
- It's ugly. Sorry but nobody would want to learn a language that
gives a headache after reading 2 lines with so many signs, already C is
bashed for it's symbols soup, but your is like C but worse.

for me is clearer and easier than all your languages, in fact i can
write code in that language that in another one language is impossible
to write because too difficult.
- It's hard to see the program flow.. I don't feel the flow of the
program "reading" your code, it's like so little that it looks like a
micro program.. Doesn't feel that good tbh.
- The use of such short variable names for registers is like
overkill. The register already have short names, no need to further
more shorten them imo.

x86 assembly registers others assemblers have, are not short name
enough
 
¬

¬a\\/b

Only for you. It *is* inventive! It *is* original thought! But, it
does a lot more than RosAsm, HLA, or Daniela/Windela/Lindela in terms
of kicking against the mainstream way of doing things. I suggest that
you write a manual for it and post it as an Esoteric programming
language.
Nathan.

there is a bit of surprise for me to see someone that says well of
that language. i say only that registers have to be of short names,
indentation is very good in assembly,
and labels - compare - jumps in code are better than C loop code
so it is good the composite instruction "if(a<b) goto label" or
"a<b#label"
 
O

o///annabee

there is a bit of surprise for me to see someone that says well of
that language.

If someone says well of it, be on guard for a lier.:)
But in the case of Nathan, this is just probably
trying to make some friends. Some people are desperate
for making friends. :))

I utterly hate your language.

:))
 
K

kinebud

¬a\/b said:
for me is clearer and easier than all your languages, in fact i can
write code in that language that in another one language is impossible
to write because too difficult.

What's your point? Many lisp programmers out there can easily cut the
size of a C program into a half/fourth with little effort and naturally
get it done quicker, but that doesn't mean it isn't "impossibly
difficult" in C by any means whatsoever. (Maybe you just aren't that
good in those other languages, perhaps?) You're also missing other
parts of the [entire] equation, but they aren't addressed here so I
won't bother with pointing them out.
x86 assembly registers others assemblers have, are not short name
enough

Um... I fail to see how this gives you any 'tactical' advantage over
something like C.

-Peace,
Austin
 
P

pete

kinebud said:
¬a\/b said:
for me is clearer and easier than all your languages, in fact i can
write code in that language that in another one language is
impossible
to write because too difficult.

What's your point? Many lisp programmers out there can easily cut the
size of a C program into a half/fourth with little
effort and naturally
get it done quicker, but that doesn't mean it isn't "impossibly
difficult" in C by any means whatsoever. (Maybe you just aren't that
good in those other languages, perhaps?) You're also missing other
parts of the [entire] equation, but they aren't addressed here so I
won't bother with pointing them out.
x86 assembly registers others assemblers have, are not short name
enough

Um... I fail to see how this gives you any 'tactical' advantage over
something like C.

I think ¬a\/b is the same character
who originally called himself "Giuseppe" in 2003,
when he posted "The Source Code Of A Thousand Tears."

http://groups-beta.google.com/group/comp.lang.c/msg/af50449c04ecc796
 
E

Evenbit

¬a\/b said:
there is a bit of surprise for me to see someone that says well of
that language.

Brainfuck is also classified as Esoteric - does that "speak well" of
it? "inventive" does not always equal "good" or useful. Some
"anti-mainstream" things are self-defeating.
i say only that registers have to be of short names,
indentation is very good in assembly,
and labels - compare - jumps in code are better than C loop code
so it is good the composite instruction "if(a<b) goto label" or
"a<b#label"

So, are you trying to write C code or Asm code? Too much mixing of HLL
features leaves you sitting on a fence.

Nathan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top