SlideShare a Scribd company logo
1 of 14
char pagina=0, color=7;
int puerto=0; // 0 COM1 - 1 COM2 - 2 COM3 - 3 COM4
char ESC=0;
// ************************ Servicio 0 de Teclado *************************
void pausa()
{
_AH=0;
asm int 16h
}
// ************************ Servicio 0 de Teclado *************************
int lee_teclado()
{
_AH= 0;
asm int 16h
return (_AX);
}
// ************************ Servicio 1 de Teclado *************************
int ve_teclado()
{
int f;
_AH=1;
asm int 16h
f=_FLAGS;
return (f&64); // 64 no habia nada tecleado - 0 habia algo tecleado
}
// ************************ Servicio 2 de Teclado *************************
int estado_teclado()
{
_AH=2;
asm int 16h
return (_AX);
}
// ************************ Servicio 0 de Video *************************
void modo_video(char modo)
{
_AH=0;
_AL=modo;
asm int 10h
}
// ************************ Servicio 1 de Video *************************
void forma_cursor(char inicio, char final)
{
_AH=1;
_CH=inicio;
_CL=final;
asm int 10h
}
// ************************ Servicio 1 de Video *************************
void apaga_cursor()
{
_AH=3;
_BH=pagina;
asm int 10h
_AH=1;
_CH|=0x20;
asm int 10h
}
// ************************ Servicio 1 de Video *************************
void enciende_cursor()
{
_AH=3;
_BH=pagina;
asm int 10h
_AH=1;
_CH&=0x1f;
asm int 10h
}
// ************************ Servicio 2 de Video *************************
void cursor_xy(char x, char y)
{
_AH=2;
_BH=pagina;
_DL=(x-1);
_DH=(y-1);
asm int 10h
}
// ************************ Servicio 3 de Video *************************
void lee_posicion_cursor(char *x,char *y)
{
_AH=3;
_BH=pagina;
asm int 10h
*x=_DL;
*y=_DH;
}
// ************************ Servicio 5 de Video *************************
void pagina_activa(char p_activa)
{
_AH=5;
_AL=p_activa;
asm int 10h
}
// ************************ Servicio 6 de Video *************************
void rueda_arriba(char x1,char y1,char x2, char y2,char n)
{
_AH=6;
_AL=n;
_BH=color;
_CH=y1;
_CL=x1;
_DH=y2;
_DL=x2;
asm int 10h
}
// ************************ Servicio 7 de Video *************************
void rueda_abajo(char x1,char y1,char x2, char y2, char n)
{
_AH=7;
_AL=n;
_BH=color;
_CH=y1;
_CL=x1;
_DH=y2;
_DL=x2;
asm int 10h
}
// ************************ Servicio 8 de Video *************************
void lee_caracter(char *caracter,char *atributo)
{
_AH=8;
_BH=pagina;
asm int 10h
*caracter= _AL;
*atributo= _AH;
}
// ************************ Servicio 9 de Video *************************
void escribe_caracter(char caracter)
{
char x,y;
_AH=9;
_AL=caracter;
_BH=pagina;
_BL=color;
_CX=1;
asm int 10h
lee_posicion_cursor(&x,&y);
cursor_xy(x+2,++y);
}
// ************************ Servicio 9 de Video *************************
void limpia_pantalla()
{
cursor_xy(1,1);
_AH=9;
_AL=32;
_BH=pagina;
_BL=color;
_CX=2000;
asm int 10h
cursor_xy(1,1);
}
// ************************ Servicio 10 de Video *************************
void imprime_caracter(char caracter)
{
_AH=10;
_AL=caracter;
_BH=pagina;
_BL=color;
_CX=1;
asm int 10h
}
// ************************ Servicio 11 de Video *************************
void paleta_color(char paleta, char pixel)
{
_AH=11;
_BH=paleta;
_BL=pixel;
asm int 10h
}
// ************************ Servicio 12 de Video *************************
void escribe_pixel(int x, int y)
{
_AH=12;
_AL=color;
_BH=pagina;
_CX=x;
_DX=y;
asm int 10h
}
// ************************ Servicio 13 de Video *************************
char lee_pixel(int x, int y)
{
_AH=13;
_BH=pagina;
_CX=x;
_DX=y;
asm int 10h
return (_AL);
}
// ************************ Servicio 14 de Video *************************
void escribe_control(char caracter)
{
_AH=14;
_AL=caracter;
_BH=pagina;
_BL=color;
asm int 10h
}
// ************************ Servicio 0 de Mouse *************************
void mouse_instalado(int *ax, int *bx)
{
_AX=0;
asm int 33h
*ax=_AX;
*bx=_BX;
}
// ************************ Servicio 1 de Mouse *************************
void muestra_mouse_cursor()
{
_AX=1;
asm int 33h
}
// ************************ Servicio 2 de Mouse *************************
void oculta_mouse_cursor()
{
_AX=2;
asm int 33h
}
// ************************ Servicio 3 de Mouse *************************
void get_mouse_XY(int *cx, int *dx)
{
_AX=3;
asm int 33h
*cx=_CX+8;
*dx=_DX+8;
}
// ************************ Servicio 3 de Mouse *************************
char boton_mouse()
{
_AX=3;
asm int 33h
return (_BL);
}
// ************************ Servicio 4 de Mouse *************************
void set_mouse_XY(int x, int y)
{
_AX=4;
_CX=x;
_DX=y;
asm int 33h
}
// ************************ Servicio 5 de Mouse *************************
char mouse_boton_presion(int b, int *bx)
{
_AX=5;
_BX=b;
asm int 33h
*bx=_BX;
return(_AL);
}
// ************************ Servicio 6 de Mouse *************************
char mouse_boton_suelto(int b, int *bx)
{
_AX=6;
_BX=b;
asm int 33h
*bx=_BX;
return(_AL);
}
// ************************ Servicio 7 de Mouse *************************
void mouse_limite_hori(int minx, int maxx)
{
_AX=7;
_CX=minx;
_DX=maxx;
asm int 33h
}
// ************************ Servicio 8 de Mouse *************************
void mouse_limite_vert(int miny, int maxy)
{
_AX=8;
_CX=miny;
_DX=maxy;
asm int 33h
}
// ************************ Servicio 9 de Mouse *************************
void mouse_cursor_grafico(int hor, int ver, char *dx)
{
_ES=_DS;
_AX=9;
_BX=hor;
_CX=ver;
_DX= (int)dx;
asm int 33h
}
// ************************ Servicio 10 de Mouse *************************
void mouse_cursor_texto(int sh, int li, int lf)
{
_AX=10;
_BX=sh;
_CX=li;
_DX=lf;
asm int 33h
}
// ************************ Servicio 11 de Mouse *************************
void lee_mouse_mov(int *cx, int *dx)
{
_AX=11;
asm int 33h
*cx=_CX;
*dx=_DX;
asm int 33h
}
// ************************ Servicio 0 del Serial *************************
int inicia_port(char pi)
{
_AH=0;
_AL=pi;
_DX=puerto;
asm int 14h
return (_AX);
}
// ************************ Servicio 1 del Serial *************************
char envia_caracter(char carac)
{
_AH=1;
_AL=carac;
_DX=puerto;
asm int 14h
return (_AH);
}
// ************************ Servicio 2 del Serial *************************
int recibe_caracter()
{
_AH=2;
_DX=puerto;
asm int 14h
return (_AX);
}
// ************************ Servicio 3 del Serial *************************
int estado_serial()
{
_AH=3;
_DX=puerto;
asm int 14h
return (_AX);
}
// ******************** Rutinas de IN y OUT de Asembler
*************************
void outport(int pt,char c)
{
_AL = c;
_DX = pt;
asm out dx,al
}
char inport(int pt)
{
_DX = pt;
asm in al,dx
return (_AL);
}
// ************************ Rutinas de Alto Nivel *************************
void set_color(char fondo, char plano)
{
color=(fondo<<4)+plano;
}
void escribe_cadena(char *p)
{
while (*p) escribe_caracter(*p++);
}
void escribe_cadenag(char *p)
{
while (*p) escribe_control(*p++);
}
void retardo (long t)
{
long x;
for(x=0L;x<t;x++);
}
void cuadrado(cordx, cordy, largo, ancho)
char cordx; // Coordenada X del cuadrado
char cordy; // Coordenada Y del cuadrado
char largo; // Altura del cuadrado
char ancho; // Ancho del cuadrado
{
char h,i,j;
// Escribe la primera linea
cursor_xy(cordx,cordy++);
escribe_caracter(218);
for (j=0;j<ancho;j++) escribe_caracter(196);
escribe_caracter(191);
// Escribe de la segunda a la penultima linea
for(h=1;h<=largo;h++)
{
cursor_xy(cordx,cordy++);
escribe_caracter(179);
for (j=0;j<ancho;j++) escribe_caracter(32);
escribe_caracter(179);
}
// Escribe la ultima linea
cursor_xy(cordx,cordy++);
escribe_caracter(192);
for (j=0;j<ancho;j++) escribe_caracter(196);
escribe_caracter(217);
}
/*
196 194
218ÚÄÄÄÄÄÄÂÄÄÄÄ¿191 1era Linea
179³ 197 ³ ³ 2da Linea
³ ³ ³
195ÃÄÄÄÄÄÄÅÄÄÄÄ´180 3era Linea
³ ³ ³ Penultima Linea
192ÀÄÄÄÄÄÄÁÄÄÄÄÙ217 Ultima Linea
193
*/
void cuadriculado(cordx, cordy, largo, ancho, campo, alto)
char cordx; // Coordenada X del cuadriculado
char cordy; // Coordenada Y del cuadriculado
char largo; // Altura del cuadriculado
char ancho; // Ancho del cuadriculado
char campo; // Ancho de cada cuadricula
char alto; // Altura de cada cuadricula
{
char m[5][4]={218,196,194,191,
179,32 ,179,179,
195,196,197,180,
179,32 ,179,179,
192,196,193,217};
char *p;
char a,h,i,j,k;
// Escribe todas las lineas
for(h=0;h<=largo;h++)
{
p=(void *)m;
p+= h ? 8:0;
if (h==largo)p+=8;
for (k=0;k<alto+1;k++)
{
cursor_xy(cordx,cordy++);
escribe_caracter(*(p++));
for (i=1;i<=ancho;i++)
{
for (j=0;j<campo;j++) escribe_caracter(*p);
if (i != ancho) escribe_caracter(*(p+1));
}
p+=2;
escribe_caracter(*(p++));
if (k>0 && k<alto) p-=4;
if (h==largo) break;
}
}
}
#define inicia_arg(arg, parm) (arg = ...)
/*---------------------------------------------------------------------------*
* *
* RUTINAS PARA IMPRIMIR *
* *
*---------------------------------------------------------------------------*/
/* ------------------------------------------------------------------------- */
void imprime(char *fmt, ...) /* Derivado de Bob Brown,P.U.*/
{
void *args;
inicia_arg(args,fmt);
_doprnt(fmt, args, escribe_video, 0);
}
/* ------------------------------------------------------------------------- */
void escribe_video(char ch)
{
switch (ch) {
case 'r': /* retorna el carro */
case 'n': /* salta a una nueva linea */
case 't': /* Tabulado */
escribe_control(ch);
break;
default:
escribe_caracter(ch);
}
}
/* ------------------------------------------------------------------------- */
static _doprnt(fmt, args, func, farg) /* Adaptado de S. Salisbury,Purdue U.*/
char *fmt; /* Cadena Formato para imprime */
int *args; /* Argumentos de imprime */
int (*func)(); /* Funcion para escribir un caracter */
int farg; /* Argumentos de la funcion */
{
int c;
int i;
int f; /* Caracter formato (despues de %) */
char *str; /* mueve puntero en cadena */
char string[MAXSTR]; /* cadena de salida */
int length; /* largo de cadena "str" */
char fill; /* caracter de relleno (' ' o '0') */
int leftjust; /* justificacion, 0=derecha, otro izq*/
int longflag; /* != 0 para numericos long */
int fmax,fmin; /* campo de %, minimo y maximo */
int leading; /* no. de caracteres de salida */
char sign; /* numeros negativos decimales */
char digit1; /* offset que se suma 1er digito */
for(;;) {
/* Busca el primer caracter % o el fin de la cadena fmt */
while( (c = *fmt++) != '%' ) {
if( c == '0' )
return;
(*func)(c);
}
/* Busca la cadena "%%" como '%' */
if( *fmt == '%' ) {
(*func)(*fmt++);
continue;
}
/* Verifica para "%-" == salida justificada a la izquierda */
if ((leftjust = ((*fmt=='-')) ? 1 : 0) )
fmt++;
/* Llena con ceros las salidas de campos ("%0) */
fill = (*fmt == '0') ? *fmt++ : ' ';
/* muestra el ancho de campo minimo para especificaciones */
/* %d,u,x,c,s ademas de campo variable para %0 */
fmin = 0;
if( *fmt == '*' ) {
fmin = *args++;
++fmt;
}
else while( '0' <= *fmt && *fmt <= '9' ) {
fmin = fmin * 10 + *fmt++ - '0';
}
/* muestra el ancho maximo de cadenas para %s */
fmax = 0;
if( *fmt == '.' ) {
if( *(++fmt) == '*' ) {
fmax = *args++;
++fmt;
}
else while( '0' <= *fmt && *fmt <= '9' ) {
fmax = fmax * 10 + *fmt++ - '0';
}
}
/* Verifica para la opcion 'l' para numericos long */
if(longflag = ((*fmt == 'l') ? 1 : 0))
fmt++;
str = string;
if( (f = *fmt++) == '0' ) {
(*func)('%');
return;
}
sign = '0'; /* signo=='-' para decimal negativo */
switch( f ) {
case 'c' :
string[0] = (char) *args;
string[1] = '0';
fmax = 0;
fill = ' ';
break;
case 's' :
str = (char *) *args;
fill = ' ';
break;
case 'D' :
longflag = 1;
case 'd' :
if(longflag) {
if ( *(long *)args < 0) {
sign = '-';
*(long *)args = -*(long *)args;
}
} else {
if ( *args < 0 ) {
sign = '-';
*args = -*args;
}
}
longflag--;
case 'U' :
longflag++;
case 'u' :
if ( longflag ) {
digit1 = 0;
/* longs negativo en formato sin signo */
/* no pueden ser computados para division */
/* convierte *args a "positivo", digit1 */
/* el cual se le adicionara despues */
while(*(long *)args < 0) {
*(long *)args -= 1000000000L;
++digit1;
}
_prtl10(*(long *)args, str);
str[0] += digit1;
++args;
} else
_prt10(*args, str);
fmax = 0;
break;
case 'O' :
longflag ++;
case 'o' :
if ( longflag ) {
_prtl8(*(long *)args, str);
++args;
} else
_prt8(*args, str);
fmax = 0;
break;
case 'X' :
longflag++;
case 'x' :
if ( longflag ) {
_prtl16(*(long *)args, str);
++args;
} else
_prt16(*args, str);
fmax = 0;
break;
default :
(*func)(f);
break;
}
args++;
for(length = 0; str[length] != '0'; length++)
;
if ( fmin > MAXSTR || fmin < 0 )
fmin = 0;
if ( fmax > MAXSTR || fmax < 0 )
fmax = 0;
leading = 0;
if ( fmax != 0 || fmin != 0 ) {
if ( fmax != 0 )
if ( length > fmax )
length = fmax;
if ( fmin != 0 )
leading = fmin - length;
if ( sign == '-' )
--leading;
}
if ( sign == '-' && fill == '0' )
(*func)(sign);
if ( leftjust == 0 )
for( i = 0; i < leading; i++ )
(*func)(fill);
if ( sign == '-' && fill == ' ' )
(*func)( sign);
for( i = 0 ; i < length ; i++ )
(*func)(str[i]);
if ( leftjust != 0 )
for( i = 0; i < leading; i++ )
(*func)(fill);
}
}
static void _prt10(num, str)
int num;
char *str;
{
int i;
char c, temp[6];
temp[0] = '0';
for( i = 1; i <= 5; i++ ) {
temp[i] = num % 10 + '0';
num /= 10;
}
for( i = 5; temp[i] == '0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}
static void _prtl10(num, str)
long num;
char *str;
{
int i;
char c, temp[11];
temp[0] = '0';
for( i = 1; i <= 10; i++ ) {
temp[i] = num % 10 + '0';
num /= 10;
}
for( i = 10; temp[i] == '0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}
static void _prt8(num, str)
int num;
char *str;
{
int i;
char c, temp[7];
temp[0] = '0';
for( i = 1; i <= 6; i++ ) {
temp[i] = (num & 07) + '0';
num = (num >> 3) & 0037777;
}
temp[6] &= '1';
for( i = 6; temp[i] == '0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}
static void _prtl8(num, str)
long num;
char *str;
{
int i;
char c, temp[12];
temp[0] = '0';
for( i = 1; i <= 11; i++ ) {
temp[i] = (num & 07) + '0';
num = num >> 3;
}
temp[11] &= '3';
for( i = 11; temp[i] == '0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}
static void _prt16(num, str)
int num;
char *str;
{
int i;
char c, temp[5];
temp[0] = '0';
for( i = 1; i <= 4; i++ ) {
temp[i] = "0123456789abcdef"[num & 0x0f];
num = num >> 4;
}
for( i = 4; temp[i] =='0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}
static void _prtl16(num, str)
long num;
char *str;
{
int i;
char c, temp[9];
temp[0] = '0';
for( i = 1; i <= 8; i++ ) {
temp[i] = "0123456789abcdef"[num & 0x0f];
num = num >> 4;
}
for( i = 8; temp[i] == '0'; i-- );
if ( i == 0 )
i++;
while( i >= 0 )
*str++ = temp[i--];
}

More Related Content

What's hot (12)

The core of javascript
The core of javascriptThe core of javascript
The core of javascript
 
Some logics
Some logicsSome logics
Some logics
 
Img 0001
Img 0001Img 0001
Img 0001
 
Sbaw091027
Sbaw091027Sbaw091027
Sbaw091027
 
week-24x
week-24xweek-24x
week-24x
 
Bab 2.2
Bab 2.2Bab 2.2
Bab 2.2
 
Practica 4 errores
Practica 4 erroresPractica 4 errores
Practica 4 errores
 
Основы Reverse Engineering
Основы Reverse EngineeringОсновы Reverse Engineering
Основы Reverse Engineering
 
Clear all
Clear allClear all
Clear all
 
Hace una calculadora en jeank
Hace una calculadora en jeankHace una calculadora en jeank
Hace una calculadora en jeank
 
Sbaw090526
Sbaw090526Sbaw090526
Sbaw090526
 
Rafael torrest
Rafael torrestRafael torrest
Rafael torrest
 

Viewers also liked

báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcm
báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcmbáo giá dịch vụ giúp việc theo giờ bảo đảm ở hcm
báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcmjarvis682
 
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đường
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đườngThừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đường
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đườngjarvis682
 
báo giá dịch vụ giúp việc quận phú nhuận ở sài gòn
báo giá dịch vụ giúp việc quận phú nhuận ở sài gònbáo giá dịch vụ giúp việc quận phú nhuận ở sài gòn
báo giá dịch vụ giúp việc quận phú nhuận ở sài gònnorman899
 
Cómo participar en un taller virtual
Cómo participar en un taller virtualCómo participar en un taller virtual
Cómo participar en un taller virtualNarda Rojas Alarcon
 
báo giá dịch vụ giúp việc quận 8 tại hcm
báo giá dịch vụ giúp việc quận 8 tại hcmbáo giá dịch vụ giúp việc quận 8 tại hcm
báo giá dịch vụ giúp việc quận 8 tại hcmlazaro250
 
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minh
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minhbáo giá dịch vụ giúp việc quận thủ đức ở hồ chí minh
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minheddie610
 
Totul despre miel
Totul despre mielTotul despre miel
Totul despre mielBiro Bela
 
báo giá dịch vụ giúp việc quận 9 hcm
báo giá dịch vụ giúp việc quận 9 hcmbáo giá dịch vụ giúp việc quận 9 hcm
báo giá dịch vụ giúp việc quận 9 hcmirving261
 
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảm
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảmNguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảm
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảmcolene176
 
báo giá dịch vụ giúp việc quận tân phú sài gòn
báo giá dịch vụ giúp việc quận tân phú sài gònbáo giá dịch vụ giúp việc quận tân phú sài gòn
báo giá dịch vụ giúp việc quận tân phú sài gònkeneth144
 
báo giá dịch vụ giúp việc quận gò vấp tphcm
báo giá dịch vụ giúp việc quận gò vấp tphcmbáo giá dịch vụ giúp việc quận gò vấp tphcm
báo giá dịch vụ giúp việc quận gò vấp tphcmdaria196
 
báo giá dịch vụ giúp việc quận bình tân ở tphcm
báo giá dịch vụ giúp việc quận bình tân ở tphcmbáo giá dịch vụ giúp việc quận bình tân ở tphcm
báo giá dịch vụ giúp việc quận bình tân ở tphcmchester624
 

Viewers also liked (14)

báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcm
báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcmbáo giá dịch vụ giúp việc theo giờ bảo đảm ở hcm
báo giá dịch vụ giúp việc theo giờ bảo đảm ở hcm
 
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đường
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đườngThừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đường
Thừa cân, béo bụng là nguyên nhân của các bệnh tim mạch, tiểu đường
 
MODEL MAKING
MODEL MAKINGMODEL MAKING
MODEL MAKING
 
báo giá dịch vụ giúp việc quận phú nhuận ở sài gòn
báo giá dịch vụ giúp việc quận phú nhuận ở sài gònbáo giá dịch vụ giúp việc quận phú nhuận ở sài gòn
báo giá dịch vụ giúp việc quận phú nhuận ở sài gòn
 
Cómo participar en un taller virtual
Cómo participar en un taller virtualCómo participar en un taller virtual
Cómo participar en un taller virtual
 
báo giá dịch vụ giúp việc quận 8 tại hcm
báo giá dịch vụ giúp việc quận 8 tại hcmbáo giá dịch vụ giúp việc quận 8 tại hcm
báo giá dịch vụ giúp việc quận 8 tại hcm
 
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minh
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minhbáo giá dịch vụ giúp việc quận thủ đức ở hồ chí minh
báo giá dịch vụ giúp việc quận thủ đức ở hồ chí minh
 
Totul despre miel
Totul despre mielTotul despre miel
Totul despre miel
 
báo giá dịch vụ giúp việc quận 9 hcm
báo giá dịch vụ giúp việc quận 9 hcmbáo giá dịch vụ giúp việc quận 9 hcm
báo giá dịch vụ giúp việc quận 9 hcm
 
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảm
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảmNguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảm
Nguy cơ cao bị đột quỵ tai biến ở những phụ nữ hay lo lắng, trầm cảm
 
báo giá dịch vụ giúp việc quận tân phú sài gòn
báo giá dịch vụ giúp việc quận tân phú sài gònbáo giá dịch vụ giúp việc quận tân phú sài gòn
báo giá dịch vụ giúp việc quận tân phú sài gòn
 
báo giá dịch vụ giúp việc quận gò vấp tphcm
báo giá dịch vụ giúp việc quận gò vấp tphcmbáo giá dịch vụ giúp việc quận gò vấp tphcm
báo giá dịch vụ giúp việc quận gò vấp tphcm
 
báo giá dịch vụ giúp việc quận bình tân ở tphcm
báo giá dịch vụ giúp việc quận bình tân ở tphcmbáo giá dịch vụ giúp việc quận bình tân ở tphcm
báo giá dịch vụ giúp việc quận bình tân ở tphcm
 
Ppt sosped
Ppt sospedPpt sosped
Ppt sosped
 

Includes

  • 1. char pagina=0, color=7; int puerto=0; // 0 COM1 - 1 COM2 - 2 COM3 - 3 COM4 char ESC=0; // ************************ Servicio 0 de Teclado ************************* void pausa() { _AH=0; asm int 16h } // ************************ Servicio 0 de Teclado ************************* int lee_teclado() { _AH= 0; asm int 16h return (_AX); } // ************************ Servicio 1 de Teclado ************************* int ve_teclado() { int f; _AH=1; asm int 16h f=_FLAGS; return (f&64); // 64 no habia nada tecleado - 0 habia algo tecleado } // ************************ Servicio 2 de Teclado ************************* int estado_teclado() { _AH=2; asm int 16h return (_AX); } // ************************ Servicio 0 de Video ************************* void modo_video(char modo) { _AH=0; _AL=modo; asm int 10h } // ************************ Servicio 1 de Video ************************* void forma_cursor(char inicio, char final) { _AH=1; _CH=inicio; _CL=final; asm int 10h } // ************************ Servicio 1 de Video *************************
  • 2. void apaga_cursor() { _AH=3; _BH=pagina; asm int 10h _AH=1; _CH|=0x20; asm int 10h } // ************************ Servicio 1 de Video ************************* void enciende_cursor() { _AH=3; _BH=pagina; asm int 10h _AH=1; _CH&=0x1f; asm int 10h } // ************************ Servicio 2 de Video ************************* void cursor_xy(char x, char y) { _AH=2; _BH=pagina; _DL=(x-1); _DH=(y-1); asm int 10h } // ************************ Servicio 3 de Video ************************* void lee_posicion_cursor(char *x,char *y) { _AH=3; _BH=pagina; asm int 10h *x=_DL; *y=_DH; } // ************************ Servicio 5 de Video ************************* void pagina_activa(char p_activa) { _AH=5; _AL=p_activa; asm int 10h } // ************************ Servicio 6 de Video ************************* void rueda_arriba(char x1,char y1,char x2, char y2,char n) { _AH=6; _AL=n; _BH=color; _CH=y1; _CL=x1; _DH=y2;
  • 3. _DL=x2; asm int 10h } // ************************ Servicio 7 de Video ************************* void rueda_abajo(char x1,char y1,char x2, char y2, char n) { _AH=7; _AL=n; _BH=color; _CH=y1; _CL=x1; _DH=y2; _DL=x2; asm int 10h } // ************************ Servicio 8 de Video ************************* void lee_caracter(char *caracter,char *atributo) { _AH=8; _BH=pagina; asm int 10h *caracter= _AL; *atributo= _AH; } // ************************ Servicio 9 de Video ************************* void escribe_caracter(char caracter) { char x,y; _AH=9; _AL=caracter; _BH=pagina; _BL=color; _CX=1; asm int 10h lee_posicion_cursor(&x,&y); cursor_xy(x+2,++y); } // ************************ Servicio 9 de Video ************************* void limpia_pantalla() { cursor_xy(1,1); _AH=9; _AL=32; _BH=pagina; _BL=color; _CX=2000; asm int 10h cursor_xy(1,1); } // ************************ Servicio 10 de Video ************************* void imprime_caracter(char caracter) { _AH=10; _AL=caracter;
  • 4. _BH=pagina; _BL=color; _CX=1; asm int 10h } // ************************ Servicio 11 de Video ************************* void paleta_color(char paleta, char pixel) { _AH=11; _BH=paleta; _BL=pixel; asm int 10h } // ************************ Servicio 12 de Video ************************* void escribe_pixel(int x, int y) { _AH=12; _AL=color; _BH=pagina; _CX=x; _DX=y; asm int 10h } // ************************ Servicio 13 de Video ************************* char lee_pixel(int x, int y) { _AH=13; _BH=pagina; _CX=x; _DX=y; asm int 10h return (_AL); } // ************************ Servicio 14 de Video ************************* void escribe_control(char caracter) { _AH=14; _AL=caracter; _BH=pagina; _BL=color; asm int 10h } // ************************ Servicio 0 de Mouse ************************* void mouse_instalado(int *ax, int *bx) { _AX=0; asm int 33h *ax=_AX; *bx=_BX; } // ************************ Servicio 1 de Mouse ************************* void muestra_mouse_cursor()
  • 5. { _AX=1; asm int 33h } // ************************ Servicio 2 de Mouse ************************* void oculta_mouse_cursor() { _AX=2; asm int 33h } // ************************ Servicio 3 de Mouse ************************* void get_mouse_XY(int *cx, int *dx) { _AX=3; asm int 33h *cx=_CX+8; *dx=_DX+8; } // ************************ Servicio 3 de Mouse ************************* char boton_mouse() { _AX=3; asm int 33h return (_BL); } // ************************ Servicio 4 de Mouse ************************* void set_mouse_XY(int x, int y) { _AX=4; _CX=x; _DX=y; asm int 33h } // ************************ Servicio 5 de Mouse ************************* char mouse_boton_presion(int b, int *bx) { _AX=5; _BX=b; asm int 33h *bx=_BX; return(_AL); } // ************************ Servicio 6 de Mouse ************************* char mouse_boton_suelto(int b, int *bx) { _AX=6; _BX=b; asm int 33h *bx=_BX; return(_AL); }
  • 6. // ************************ Servicio 7 de Mouse ************************* void mouse_limite_hori(int minx, int maxx) { _AX=7; _CX=minx; _DX=maxx; asm int 33h } // ************************ Servicio 8 de Mouse ************************* void mouse_limite_vert(int miny, int maxy) { _AX=8; _CX=miny; _DX=maxy; asm int 33h } // ************************ Servicio 9 de Mouse ************************* void mouse_cursor_grafico(int hor, int ver, char *dx) { _ES=_DS; _AX=9; _BX=hor; _CX=ver; _DX= (int)dx; asm int 33h } // ************************ Servicio 10 de Mouse ************************* void mouse_cursor_texto(int sh, int li, int lf) { _AX=10; _BX=sh; _CX=li; _DX=lf; asm int 33h } // ************************ Servicio 11 de Mouse ************************* void lee_mouse_mov(int *cx, int *dx) { _AX=11; asm int 33h *cx=_CX; *dx=_DX; asm int 33h } // ************************ Servicio 0 del Serial ************************* int inicia_port(char pi) { _AH=0; _AL=pi; _DX=puerto; asm int 14h return (_AX); }
  • 7. // ************************ Servicio 1 del Serial ************************* char envia_caracter(char carac) { _AH=1; _AL=carac; _DX=puerto; asm int 14h return (_AH); } // ************************ Servicio 2 del Serial ************************* int recibe_caracter() { _AH=2; _DX=puerto; asm int 14h return (_AX); } // ************************ Servicio 3 del Serial ************************* int estado_serial() { _AH=3; _DX=puerto; asm int 14h return (_AX); } // ******************** Rutinas de IN y OUT de Asembler ************************* void outport(int pt,char c) { _AL = c; _DX = pt; asm out dx,al } char inport(int pt) { _DX = pt; asm in al,dx return (_AL); } // ************************ Rutinas de Alto Nivel ************************* void set_color(char fondo, char plano) { color=(fondo<<4)+plano; } void escribe_cadena(char *p) { while (*p) escribe_caracter(*p++); } void escribe_cadenag(char *p) { while (*p) escribe_control(*p++);
  • 8. } void retardo (long t) { long x; for(x=0L;x<t;x++); } void cuadrado(cordx, cordy, largo, ancho) char cordx; // Coordenada X del cuadrado char cordy; // Coordenada Y del cuadrado char largo; // Altura del cuadrado char ancho; // Ancho del cuadrado { char h,i,j; // Escribe la primera linea cursor_xy(cordx,cordy++); escribe_caracter(218); for (j=0;j<ancho;j++) escribe_caracter(196); escribe_caracter(191); // Escribe de la segunda a la penultima linea for(h=1;h<=largo;h++) { cursor_xy(cordx,cordy++); escribe_caracter(179); for (j=0;j<ancho;j++) escribe_caracter(32); escribe_caracter(179); } // Escribe la ultima linea cursor_xy(cordx,cordy++); escribe_caracter(192); for (j=0;j<ancho;j++) escribe_caracter(196); escribe_caracter(217); } /* 196 194 218ÚÄÄÄÄÄÄÂÄÄÄÄ¿191 1era Linea 179³ 197 ³ ³ 2da Linea ³ ³ ³ 195ÃÄÄÄÄÄÄÅÄÄÄÄ´180 3era Linea ³ ³ ³ Penultima Linea 192ÀÄÄÄÄÄÄÁÄÄÄÄÙ217 Ultima Linea 193 */ void cuadriculado(cordx, cordy, largo, ancho, campo, alto) char cordx; // Coordenada X del cuadriculado char cordy; // Coordenada Y del cuadriculado char largo; // Altura del cuadriculado char ancho; // Ancho del cuadriculado char campo; // Ancho de cada cuadricula char alto; // Altura de cada cuadricula {
  • 9. char m[5][4]={218,196,194,191, 179,32 ,179,179, 195,196,197,180, 179,32 ,179,179, 192,196,193,217}; char *p; char a,h,i,j,k; // Escribe todas las lineas for(h=0;h<=largo;h++) { p=(void *)m; p+= h ? 8:0; if (h==largo)p+=8; for (k=0;k<alto+1;k++) { cursor_xy(cordx,cordy++); escribe_caracter(*(p++)); for (i=1;i<=ancho;i++) { for (j=0;j<campo;j++) escribe_caracter(*p); if (i != ancho) escribe_caracter(*(p+1)); } p+=2; escribe_caracter(*(p++)); if (k>0 && k<alto) p-=4; if (h==largo) break; } } } #define inicia_arg(arg, parm) (arg = ...) /*---------------------------------------------------------------------------* * * * RUTINAS PARA IMPRIMIR * * * *---------------------------------------------------------------------------*/ /* ------------------------------------------------------------------------- */ void imprime(char *fmt, ...) /* Derivado de Bob Brown,P.U.*/ { void *args; inicia_arg(args,fmt); _doprnt(fmt, args, escribe_video, 0); } /* ------------------------------------------------------------------------- */ void escribe_video(char ch) { switch (ch) { case 'r': /* retorna el carro */ case 'n': /* salta a una nueva linea */ case 't': /* Tabulado */ escribe_control(ch); break; default: escribe_caracter(ch);
  • 10. } } /* ------------------------------------------------------------------------- */ static _doprnt(fmt, args, func, farg) /* Adaptado de S. Salisbury,Purdue U.*/ char *fmt; /* Cadena Formato para imprime */ int *args; /* Argumentos de imprime */ int (*func)(); /* Funcion para escribir un caracter */ int farg; /* Argumentos de la funcion */ { int c; int i; int f; /* Caracter formato (despues de %) */ char *str; /* mueve puntero en cadena */ char string[MAXSTR]; /* cadena de salida */ int length; /* largo de cadena "str" */ char fill; /* caracter de relleno (' ' o '0') */ int leftjust; /* justificacion, 0=derecha, otro izq*/ int longflag; /* != 0 para numericos long */ int fmax,fmin; /* campo de %, minimo y maximo */ int leading; /* no. de caracteres de salida */ char sign; /* numeros negativos decimales */ char digit1; /* offset que se suma 1er digito */ for(;;) { /* Busca el primer caracter % o el fin de la cadena fmt */ while( (c = *fmt++) != '%' ) { if( c == '0' ) return; (*func)(c); } /* Busca la cadena "%%" como '%' */ if( *fmt == '%' ) { (*func)(*fmt++); continue; } /* Verifica para "%-" == salida justificada a la izquierda */ if ((leftjust = ((*fmt=='-')) ? 1 : 0) ) fmt++; /* Llena con ceros las salidas de campos ("%0) */ fill = (*fmt == '0') ? *fmt++ : ' '; /* muestra el ancho de campo minimo para especificaciones */ /* %d,u,x,c,s ademas de campo variable para %0 */ fmin = 0; if( *fmt == '*' ) { fmin = *args++; ++fmt; } else while( '0' <= *fmt && *fmt <= '9' ) { fmin = fmin * 10 + *fmt++ - '0'; } /* muestra el ancho maximo de cadenas para %s */ fmax = 0; if( *fmt == '.' ) { if( *(++fmt) == '*' ) { fmax = *args++;
  • 11. ++fmt; } else while( '0' <= *fmt && *fmt <= '9' ) { fmax = fmax * 10 + *fmt++ - '0'; } } /* Verifica para la opcion 'l' para numericos long */ if(longflag = ((*fmt == 'l') ? 1 : 0)) fmt++; str = string; if( (f = *fmt++) == '0' ) { (*func)('%'); return; } sign = '0'; /* signo=='-' para decimal negativo */ switch( f ) { case 'c' : string[0] = (char) *args; string[1] = '0'; fmax = 0; fill = ' '; break; case 's' : str = (char *) *args; fill = ' '; break; case 'D' : longflag = 1; case 'd' : if(longflag) { if ( *(long *)args < 0) { sign = '-'; *(long *)args = -*(long *)args; } } else { if ( *args < 0 ) { sign = '-'; *args = -*args; } } longflag--; case 'U' : longflag++; case 'u' : if ( longflag ) { digit1 = 0; /* longs negativo en formato sin signo */ /* no pueden ser computados para division */ /* convierte *args a "positivo", digit1 */ /* el cual se le adicionara despues */ while(*(long *)args < 0) { *(long *)args -= 1000000000L; ++digit1; } _prtl10(*(long *)args, str); str[0] += digit1; ++args; } else _prt10(*args, str); fmax = 0;
  • 12. break; case 'O' : longflag ++; case 'o' : if ( longflag ) { _prtl8(*(long *)args, str); ++args; } else _prt8(*args, str); fmax = 0; break; case 'X' : longflag++; case 'x' : if ( longflag ) { _prtl16(*(long *)args, str); ++args; } else _prt16(*args, str); fmax = 0; break; default : (*func)(f); break; } args++; for(length = 0; str[length] != '0'; length++) ; if ( fmin > MAXSTR || fmin < 0 ) fmin = 0; if ( fmax > MAXSTR || fmax < 0 ) fmax = 0; leading = 0; if ( fmax != 0 || fmin != 0 ) { if ( fmax != 0 ) if ( length > fmax ) length = fmax; if ( fmin != 0 ) leading = fmin - length; if ( sign == '-' ) --leading; } if ( sign == '-' && fill == '0' ) (*func)(sign); if ( leftjust == 0 ) for( i = 0; i < leading; i++ ) (*func)(fill); if ( sign == '-' && fill == ' ' ) (*func)( sign); for( i = 0 ; i < length ; i++ ) (*func)(str[i]); if ( leftjust != 0 ) for( i = 0; i < leading; i++ ) (*func)(fill); } } static void _prt10(num, str) int num; char *str; {
  • 13. int i; char c, temp[6]; temp[0] = '0'; for( i = 1; i <= 5; i++ ) { temp[i] = num % 10 + '0'; num /= 10; } for( i = 5; temp[i] == '0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; } static void _prtl10(num, str) long num; char *str; { int i; char c, temp[11]; temp[0] = '0'; for( i = 1; i <= 10; i++ ) { temp[i] = num % 10 + '0'; num /= 10; } for( i = 10; temp[i] == '0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; } static void _prt8(num, str) int num; char *str; { int i; char c, temp[7]; temp[0] = '0'; for( i = 1; i <= 6; i++ ) { temp[i] = (num & 07) + '0'; num = (num >> 3) & 0037777; } temp[6] &= '1'; for( i = 6; temp[i] == '0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; } static void _prtl8(num, str) long num; char *str; { int i; char c, temp[12]; temp[0] = '0'; for( i = 1; i <= 11; i++ ) { temp[i] = (num & 07) + '0';
  • 14. num = num >> 3; } temp[11] &= '3'; for( i = 11; temp[i] == '0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; } static void _prt16(num, str) int num; char *str; { int i; char c, temp[5]; temp[0] = '0'; for( i = 1; i <= 4; i++ ) { temp[i] = "0123456789abcdef"[num & 0x0f]; num = num >> 4; } for( i = 4; temp[i] =='0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; } static void _prtl16(num, str) long num; char *str; { int i; char c, temp[9]; temp[0] = '0'; for( i = 1; i <= 8; i++ ) { temp[i] = "0123456789abcdef"[num & 0x0f]; num = num >> 4; } for( i = 8; temp[i] == '0'; i-- ); if ( i == 0 ) i++; while( i >= 0 ) *str++ = temp[i--]; }