viernes, 29 de octubre de 2021

computació

for( [k] = 1 ; [k] [< n ; [k]++ )

funcions[k](x,y);

for( [k] = not(1) ; [k] [< not(n) ; [k]-- )

funcions[k](x,y);


Mov bx,n

Mov ax,[bx]

Not ax

Not ax

Mov bx, funcions[0]

Inc bx

Xor cx,cx

Inc cx

cicle

Push bx

Push ax

Push cx

Mov si,x

Mov di,[si]

Push di

Mov si,y

Mov di,[si]

Push di

Call [bx]

Pop di

Mov si,y

Mov [si],di

Pop di

Mov si,x

Mov [si],di

Pop cx

Pop ax

Pop bx

Push cx

Xor cx,ax

Jz final

Pop cx

Inc cx

Inc bx

Jmp cicle

final


Mov bx,not(n)

Mov ax,[bx]

Not ax

Mov bx, funcions[not(0)]

Dec bx

Sys cx,cx

Dec cx

cicle

Push bx

Push ax

Push cx

Mov si,x

Mov di,[si]

Push di

Mov si,y

Mov di,[si]

Push di

Call [bx]

Pop di

Mov si,y

Mov [si],di

Pop di

Mov si,x

Mov [si],di

Pop cx

Pop ax

Pop bx

Push cx

Sys cx,ax

Jf final

Pop cx

Dec cx

Dec bx

Jmp cicle

final


funcions[1]( int x, int y )

{

print("%d",[x]+[y]);

[x] = not([x]);

[y] = [y];

}

funcions[2]( int x, int y )

{

print("%d",[x]+[y]);

[x] = [x];

[y] = not([y]);

}

funcions[3]( int x, int y )

{

print("%d",[x]+[y]);

[x] = not([x]);

[y] = [y];

}

funcions[4]( int x, int y )

{

print("%d",[x]+[y]);

[x] = [x];

[y] = not([y]);

}


funcions[not(1)]( int x, int y )

{

print("%d",[x]·[y]);

[x] = not([x]);

[y] = [y];

}

funcions[not(2)]( int x, int y )

{

print("%d",[x]·[y]);

[x] = [x];

[y] = not([y]);

}

funcions[not(3)]( int x, int y )

{

print("%d",[x]·[y]);

[x] = not([x]);

[y] = [y];

}

funcions[not(4)]( int x, int y )

{

print("%d",[x]·[y]);

[x] = [x];

[y] = not([y]);

}


for( [k] = 1 ; [k] [< 4 ; [k]++ )

funcions[k](x,y);

for( [k] = not(1) ; [k] [< not(4) ; [k]-- )

funcions[k](x,y);


funcions[1]( int m, int n , int p , int q )

{

print("%d / %d",( [m]·[q]+[p]·[n] ),( [n]·[q] ));

[m] = not([m]);

[n] = [n];

[p] = [p];

[q] = [q];

}

funcions[2]( int m, int n , int p , int q )

{

print("%d / %d",( [m]·[q]+[p]·[n] ),( [n]·[q] ));

[m] = [m];

[n] = [n];

[p] = not([p]);

[q] = [q];

}

funcions[3]( int m, int n , int p , int q )

{

print("%d / %d",( [m]·[q]+[p]·[n] ),( [n]·[q] ));

[m] = not([m]);

[n] = [n];

[p] = [p];

[q] = [q];

}

funcions[4]( int m, int n , int p , int q )

{

print("%d / %d",( [m]·[q]+[p]·[n] ),( [n]·[q] ));

[m] = [m];

[n] = [n];

[p] = not([p]);

[q] = [q];

}

No hay comentarios:

Publicar un comentario