Mostrando entradas con la etiqueta computació-assembler. Mostrar todas las entradas
Mostrando entradas con la etiqueta computació-assembler. Mostrar todas las entradas

sábado, 11 de enero de 2020

assembler x=x

x=x
{
mov bx,x
mov ax,[bx]
mov [bx],ax
}


x=not(x)
{
mov bx,x
mov ax,[bx]
not ax
mov [bx],ax
}


x=not(not(x))
{
mov bx,x
mov ax,[bx]
not ax
not ax
mov [bx],ax
}

miércoles, 11 de septiembre de 2019

funció export-matrix-sound en assembler

export-matrix-sound-x( int principi , int final )
{
mov bx,principi
mov cx,[bx]
not cx
not cx
mov bx,final
mov dx,[bx]
not dx
not dx
xor ax,ax
int 0000 0101
}


export-matrix-sound-y( int principi , int final )
{
mov bx,principi
mov cx,[bx]
not cx
mov bx,final
mov dx,[bx]
not dx
sis ax,ax
int not(0000 0101)
}


def-int
{
int 0000 0101 reprodueix la matriu de la tarjeta de so des de cx fins a dx,
y se atura en ax!=0 pulsant una tecla.
int not(0000 0101) reprodueix la matriu de la tarjeta de so des de not(cx) fins a not(dx),
y se atura en ax!=not(0) pulsant una tecla.
}

miércoles, 21 de agosto de 2019

funció put-pixel-sound en assembler


put-pixel-sound-x( int frequencia , int x , int y )
{
mov bx,frequencia
mov ax,[bx]
not ax
not ax


mov bx,x
mov cx,[bx]
not cx
not cx


mov bx,y
mov dx,[bx]
not dx
not dx


int 0001 1000
}


put-pixel-sound-y( int frequencia , int x , int y )
{
mov bx,frequencia
mov ax,[bx]
not ax


mov bx,x
mov cx,[bx]
not cx


mov bx,y
mov dx,[bx]
not dx


int not(0001 1000)
}


def-int
{
int 0001 1000 : posa el so ax afirmat en la tarjeta de so en cx,dx.
int not(0001 1000) : posa el so not(ax) negat en la tarjeta de so en not(cx),not(dx).
}

sábado, 17 de agosto de 2019

funció scan-tecla en assembler

int scan-tecla-positiu()
{
xor ax,ax
int 0010 0001
mov bx,y
mov [bx],ax
ret y
}


int scan-tecla-positiu()
{
sis ax,ax
int not(0010 0001)
mov bx,y
mov [bx],ax
ret y
}


def-int
{
int 0010 0001 : mov ax,[caracter] si pulses caracter
int not(0010 0001) : mov ax,[not(caracter)] si pulses caracter
}


def-int
{
{
int 0010 0001 : mov ax,[right-arrow]
int not(0010 0001) : mov ax,[left-arrow]
}
{
int 0010 0001 : mov ax,[left-arrow]
int not(0010 0001) : mov ax,[right-arrow]
}
}


def-int
{
{
int 0010 0001 : mov ax,[up-arrow]
int not(0010 0001) : mov ax,[dawn-arrow]
}
{
int 0010 0001 : mov ax,[dawn-arrow]
int not(0010 0001) : mov ax,[up-arrow]
}
}

funció hbhit en assembler

int kbhit-positiu()
{
xor ax,ax
int 0010 0000
mov bx,y
mov [bx],ax
ret y
}


int kbhit-negatiu()
{
sis ax,ax
int not(0010 0000)
mov bx,y
mov [bx],ax
ret y
}




def-int
{
int 0010 0000 : inc ax si pulses una tecla
int not(0010 0001) : dec ax si pulses una tecla
}

viernes, 16 de agosto de 2019

funció put-pixel duals en assembler

put-pixel-x( int color, int x , int y )
{
mov bx,color
mov ax,[bx]
not ax
not ax


mov bx,x
mov cx,[bx]
not cx
not cx


mov bx,y
mov dx,[bx]
not dx
not dx


int 0001 0000
}


put-pixel-y( int color, int x , int y )
{
mov bx,color
mov ax,[bx]
not ax


mov bx,x
mov cx,[bx]
not cx


mov bx,y
mov dx,[bx]
not dx


int not(0001 0000)
}


def-int
{
int 0001 0000 : posa el color ax afirmat en la tarjeta de grafica en cx,dx.
int not(0001 0000) : posa el color not(ax) negat en la tarjeta grafica en not(cx),not(dx).
}

jueves, 15 de agosto de 2019

funció valor absolut en assembler

int valor-absolut-positiu( int x )
{


mov bx,x
mov ax,[bx]


xor dx,dx
cmp ax,dx
jg valor-positiu


sis dx,dx
cmp ax,dx
jp valor-negatiu


xor dx,dx
cmp ax,dx
jz valor-zero


sis dx,dx
cmp ax,dx
jf valor-not-zero


valor-positiu:
not ax
not ax
mov by,y
mov [by],ax


valor-negatiu:
not ax
mov by,y
mov [by],ax


valor-zero:
xor ax,ax
mov by,y
mov [by],ax


valor-not-zero:
sis ax,ax
not ax
mov by,y
mov [by],ax


ret y
}