#include #include #include #include #include #include #include #include #include #include #include "B-T.h" #define OFF 0 #define ON 1 #ifdef __cplusplus #define __CPPARGS ... #else #define __CPPARGS #endif char far *MemTexto = (char far *)0xB8000000; char ROWselect = 6, notENABLED; int MenuPrincipal(void); void Installer(void); int boton_izq; int boton_der; int x_raton, y_raton, RATON = 1; int Execute( char *program ) { if ( access( program, 0 ) != 0 ) { Optar( 1, "ATENCION", "No se encontr¢ el programa requerido", "asegurese que esta en la ruta:", program, NULL ); } else { system( program ); MenuPrincipal(); } }; int main(void) { inicializa_raton_texto(); if( RATON ) desactiva_raton(); MenuPrincipal(); // sleep( 5 ); Installer(); textcolor( WHITE ); textbackground( BLACK ); clrscr(); cprintf( "\nSol Negro (c) | 1999" ); cprintf( "\n" ); _setcursortype(_NORMALCURSOR); return 0; } void SN(void) { static int columna = 15, inc = 1, cont; static clock_t start=clock(); int i, j; // fila -^ ^--- columna if ( notENABLED ) return; MemTexto[ ROWselect*80*2 + 60*2 +1 ] = 0x0E; MemTexto[ ROWselect*80*2 + 61*2 +1 ] = 0x0E; MemTexto[ ROWselect*80*2 + 62*2 +1 ] = 0x0E; MemTexto[ ROWselect*80*2 + 63*2 +1 ] = 0x0E; if ( ( cont >= 0 && cont < 17 ) || cont >= 68 ) { MemTexto[ ROWselect*80*2 + 60*2 ] = '<'; MemTexto[ ROWselect*80*2 + 61*2 ] = '-'; MemTexto[ ROWselect*80*2 + 62*2 ] = '-'; MemTexto[ ROWselect*80*2 + 63*2 ] = '³'; } else if ( ( cont < 35 ) || cont >= 52 ) { MemTexto[ ROWselect*80*2 + 60*2 ] = ' '; MemTexto[ ROWselect*80*2 + 61*2 ] = '<'; MemTexto[ ROWselect*80*2 + 62*2 ] = '-'; MemTexto[ ROWselect*80*2 + 63*2 ] = '°'; } else { MemTexto[ ROWselect*80*2 + 60*2 ] = ' '; MemTexto[ ROWselect*80*2 + 61*2 ] = ' '; MemTexto[ ROWselect*80*2 + 62*2 ] = '<'; MemTexto[ ROWselect*80*2 + 63*2 ] = '²'; } if ( ( clock() - start ) > .05 ) start = clock(); else return; cont++; cont = (cont++)%70; columna+= inc; if ( columna == 59 ) inc = -1; if ( columna == 15 ) inc = +1; // GRADIENTE SN for ( i=1; i < 4; i++ ) { MemTexto[ i*80*2 + columna *2 + 1] = ( inc==1 ? 0x00 : 0x0F ); MemTexto[ i*80*2 + (columna+1)*2 + 1] = ( inc==1 ? 0x08 : 0x07 ); MemTexto[ i*80*2 + (columna+2)*2 + 1] = ( inc==1 ? 0x08 : 0x07 ); MemTexto[ i*80*2 + (columna+3)*2 + 1] = ( inc==1 ? 0x07 : 0x07 ); MemTexto[ i*80*2 + (columna+4)*2 + 1] = ( inc==1 ? 0x07 : 0x08 ); MemTexto[ i*80*2 + (columna+5)*2 + 1] = ( inc==1 ? 0x07 : 0x08 ); MemTexto[ i*80*2 + (columna+6)*2 + 1] = ( inc==1 ? 0x0F : 0x00 ); } // GRADIENTE (SOL) j = (columna-15)/3; for ( i=0; i < 18; i++ ) // Filas // Columnas { MemTexto[ i*80*2 + j *2 + 1] = ( inc==1 ? 0x00 : 0x0F ); MemTexto[ i*80*2 + (j+1)*2 + 1] = ( inc==1 ? 0x08 : 0x07 ); MemTexto[ i*80*2 + (j+2)*2 + 1] = ( inc==1 ? 0x08 : 0x07 ); MemTexto[ i*80*2 + (j+3)*2 + 1] = ( inc==1 ? 0x07 : 0x07 ); MemTexto[ i*80*2 + (j+4)*2 + 1] = ( inc==1 ? 0x07 : 0x08 ); MemTexto[ i*80*2 + (j+5)*2 + 1] = ( inc==1 ? 0x07 : 0x08 ); MemTexto[ i*80*2 + (j+6)*2 + 1] = ( inc==1 ? 0x0F : 0x00 ); } } int MenuPrincipal(void) { _setcursortype(_NOCURSOR); textcolor( DARKGRAY ); textbackground( BLACK ); clrscr(); cprintf("| _ \n\r"); cprintf(" / / ÜÜ Ü Ü Ü Ü Ü ÜÜÜ ÜÜ Ü\n\r"); cprintf(" øøø / _/ ßÜ Û Û Û ÛßÜÛ ÛÜ Û Ü ÛÜß Û Û\n\r"); cprintf(" ýýøø _/ ÜÜß ßÜß ÛÜ Û ßÛ ßÜ ßÜÜß Û Û ßÜß\n\r"); cprintf(" ýýýøø / \n\r"); cprintf(" êêêýøø __/ \n\r"); cprintf(" êêêêýøø \n\r"); cprintf(" êêêêýøø ----__- \n\r"); cprintf(" êêêêýøø \n\r"); cprintf(" êêêêýøø __--_ \n\r"); cprintf(" êêêýøø \\ \n\r"); cprintf(" ýýýøø \\_ \n\r"); cprintf(" ýýøø \\_ \n\r"); cprintf(" øøø \\_ \n\r"); cprintf(" øø \\ \\_ \n\r"); cprintf(" | \\ \n\r"); cprintf(" | | \\ \n\r"); cprintf(" | \n\r"); textcolor( RED ); cprintf(" \n\r"); return 0; } int Funcion_Botones(int Funcion, int nBotones, struct Boton_Texto *Boton_Texto) { char i; int DEVOLVER = -1; int longitud, key, key2; switch( Funcion ) { case DIBUJA: highvideo(); textcolor(BLACK); textbackground(11); gotoxy(Boton_Texto[nBotones].x, Boton_Texto[nBotones].y); DEVOLVER = 0; longitud = strlen( Boton_Texto[nBotones].Texto ); while( DEVOLVER <= longitud ) { if( Boton_Texto[nBotones].Texto[DEVOLVER] == '&' ) { DEVOLVER ++; textcolor(RED); cprintf("%c", Boton_Texto[nBotones].Texto[DEVOLVER]); textcolor(BLACK); } else cprintf("%c", Boton_Texto[nBotones].Texto[DEVOLVER]); DEVOLVER ++; } // cprintf("%s", Texto); textbackground(7); // ±SALIR±Ü cprintf("ß"); // ßßßßßßß gotoxy(Boton_Texto[nBotones].x+1, Boton_Texto[nBotones].y+1); for(i = 0; i < longitud; i ++ ) // ±±±±±±±Ü cprintf("Ü"); // ßßßßßßß break; case DEPRIME: highvideo(); textcolor(BLACK); textbackground(11); gotoxy(Boton_Texto[nBotones].x, Boton_Texto[nBotones].y); DEVOLVER = 0; longitud = strlen( Boton_Texto[nBotones].Texto ); //////////////// textbackground(BLACK); while( DEVOLVER <= (longitud+1) ) { if( Boton_Texto[nBotones].Texto[DEVOLVER] == '&' ) { DEVOLVER ++; } cprintf(" "); DEVOLVER ++; } textbackground(11); gotoxy(Boton_Texto[nBotones].x+1, Boton_Texto[nBotones].y+1); DEVOLVER = 0; while( DEVOLVER <= longitud ) { if( Boton_Texto[nBotones].Texto[DEVOLVER] == '&' ) { DEVOLVER ++; textcolor(RED); cprintf("%c", Boton_Texto[nBotones].Texto[DEVOLVER]); textcolor(BLACK); } else cprintf("%c", Boton_Texto[nBotones].Texto[DEVOLVER]); DEVOLVER ++; } // cprintf("%s", Texto); // // ±±±±±±± break; case Dibuja_Todos: for( i=0; i < nBotones; i++) Funcion_Botones( DIBUJA, i, Boton_Texto); break; case COMPRUEBA: if( bioskey(1)!=0 ) { key = toupper( getch() ); DEVOLVER = -2; if ( key == 0 ) { key2 = toupper( getch() ); DEVOLVER = -1; } for( i=0; i < nBotones && DEVOLVER <= -1; i++){ if( key == Boton_Texto[i].ID_T1 ) { if( key == 0 ) { if( key2 == Boton_Texto[i].ID_T2 ){ DEVOLVER = (i + 1); Funcion_Botones( DEPRIME, (DEVOLVER-1), Boton_Texto); delay(150); //sleep(1); Funcion_Botones( DIBUJA, (DEVOLVER-1), Boton_Texto); } } else { DEVOLVER = (i + 1); Funcion_Botones( DEPRIME, (DEVOLVER-1), Boton_Texto); delay(150); //sleep(1); Funcion_Botones( DIBUJA, (DEVOLVER-1), Boton_Texto); } } } if( DEVOLVER == -2 ) { ungetch(key); } if( DEVOLVER == -1 ) { ungetch(key2); } } else if( RATON ) { DEVOLVER = 0; for( i=0; i < nBotones && DEVOLVER == 0; i++) { longitud = strlen( Boton_Texto[i].Texto ); if ( (x_raton+1) >= Boton_Texto[i].x && (x_raton+1) <= ( Boton_Texto[i].x + longitud -1) && y_raton == (Boton_Texto[i].y-1) ) { DEVOLVER = (i + 1); Funcion_Botones( DEPRIME, (DEVOLVER-1), Boton_Texto); if( RATON ) activa_raton(); espera_soltar(); if( RATON ) desactiva_raton(); // delay(150); Funcion_Botones( DIBUJA, (DEVOLVER-1), Boton_Texto); } } } break; case STD_BY: Funcion_Botones(Dibuja_Todos, nBotones, Boton_Texto); do{ if( RATON ) activa_raton(); if( RATON ) espera_pulsar(); else while( bioskey(1)==0 ); if( RATON ) desactiva_raton(); DEVOLVER = Funcion_Botones(COMPRUEBA, nBotones, Boton_Texto); }while(DEVOLVER==0 && bioskey(1)==0 ); } return DEVOLVER; } void inicializa_raton_texto(void) { union REGS ent, sal; ent.x.ax = 0; int86(0x33, &ent, &sal); /* averigua si hay rat¢n conectado */ if(sal.x.ax==0) { RATON = 0; return; } ent.x.ax = 15; ent.x.cx = 8; ent.x.dx = 16; int86(0x33, &ent, &sal); /* fija la raz¢n mickey/pixel */ ent.x.ax = 7; ent.x.cx = 0; ent.x.dx = 639; int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. horizontal */ ent.x.ax = 8; ent.x.cx = 0; ent.x.dx = 199; int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. vertical */ ent.x.ax = 4; ent.x.cx = 320; ent.x.dx = 100; int86(0x33, &ent, &sal); /* fija la posici¢n del rat¢n */ ent.x.ax = 1; int86(0x33, &ent, &sal); /* muestra el puntero del rat¢n */ } void activa_raton(void) { union REGS ent, sal; ent.x.ax = 1; int86(0x33, &ent, &sal); } void desactiva_raton(void) { union REGS ent, sal; ent.x.ax = 2; int86(0x33, &ent, &sal); } void espera_pulsar(void) { union REGS ent, sal; do{ if(bioskey(1)!=0) break; ent.x.ax = 3; int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */ SN(); }while((sal.x.bx & 3)==0); boton_izq=sal.x.bx & 1; boton_der=(sal.x.bx >> 1) & 1; x_raton= (sal.x.cx >> 1) / 4; // / 8 y_raton= (sal.x.dx)/8; // /8 } void espera_soltar(void) { union REGS ent, sal; do{ ent.x.ax = 3; int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */ }while((sal.x.bx & 3)!=0); boton_izq=sal.x.bx & 1; boton_der=(sal.x.bx >> 1) & 1; x_raton=sal.x.cx >> 1; y_raton=sal.x.dx; } ///////////////////////////////////////////////////////////////////////////// void Installer(void) { struct Boton_Texto BT[6]; /* 23456789-123456789-123456789- { Preparar DISCO DURO } { VOLCAR WINDOWS 98 CD->HD } { VOLCAR WINDOWS 95 CD->HD } { VOLCAR UTILIDADES CD->HD } { TESTEO DEL EQUIPO } { SALIR } */ BT[0].x = 26; BT[0].y = 20; strcpy( BT[0].Texto, " &SALIR "); BT[0].ID_T1 = 83; BT[0].ID_T2 = 0; BT[1].x = 26; BT[1].y = 7; strcpy( BT[1].Texto, " &Preparar DISCO DURO "); BT[1].ID_T1 = 80; BT[1].ID_T2 = 0; BT[2].x = 26; BT[2].y =10; strcpy( BT[2].Texto, " &TESTEO DEL EQUIPO "); BT[2].ID_T1 = 84; BT[2].ID_T2 = 0; BT[3].x = 26; BT[3].y =12; strcpy( BT[3].Texto, " VOLCAR &UTILIDADES CD->HD "); BT[3].ID_T1 = 85; BT[3].ID_T2 = 0; BT[4].x = 26; BT[4].y =15; strcpy( BT[4].Texto, " VOLCAR &WINDOWS 98 CD->HD "); BT[4].ID_T1 = 87; BT[4].ID_T2 = 0; BT[5].x = 26; BT[5].y =17; strcpy( BT[5].Texto, " VOLCAR WINDOWS 9&5 CD->HD "); BT[5].ID_T1 = 53; BT[5].ID_T2 = 0; char ok = 0; int BPush, key; char nBT = 2; char reentrada = 0; _setcursortype( _NOCURSOR ); // DibujaPantallaArticulos(); do { notENABLED = OFF; if ( reentrada == 0 ) BPush = Funcion_Botones(STD_BY, 6, BT); else reentrada = 0; notENABLED = ON; switch ( BPush ) { case 0: // No se pulso ningun BOTON while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER break; case -2: // Hay una tecla normal en BUFFER /* if ( ( key = getch() ) != 13 && key != 27 ) ungetch( key ); */ if ( ( key = getch() ) == 13 ) { reentrada = 1; BPush = nBT; } while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER break; case -1: // Hay una tecla especial en BUFFER switch( getch() ) { // Flecha Izquierda case 75: case 15: break; // Flecha Derecha case 77: case 9: break; // Flecha Arriba case 72: MemTexto[ ROWselect*80*2 + 60*2 ] = ' '; MemTexto[ ROWselect*80*2 + 61*2 ] = ' '; MemTexto[ ROWselect*80*2 + 62*2 ] = ' '; MemTexto[ ROWselect*80*2 + 63*2 ] = ' '; nBT--; if ( nBT == 0 ) nBT = 6; switch(nBT) { case 1: ROWselect = 19; break; case 2: ROWselect = 6; break; case 3: ROWselect = 9; break; case 4: ROWselect = 11; break; case 5: ROWselect = 14; break; case 6: ROWselect = 16; break; } break; // Flecha Abajo case 80: MemTexto[ ROWselect*80*2 + 60*2 ] = ' '; MemTexto[ ROWselect*80*2 + 61*2 ] = ' '; MemTexto[ ROWselect*80*2 + 62*2 ] = ' '; MemTexto[ ROWselect*80*2 + 63*2 ] = ' '; nBT++; if ( nBT == 7 ) nBT = 1; switch(nBT) { case 1: ROWselect = 19; break; case 2: ROWselect = 6; break; case 3: ROWselect = 9; break; case 4: ROWselect = 11; break; case 5: ROWselect = 14; break; case 6: ROWselect = 16; break; } break; // Inicio case 71: break; // Fin case 79: break; } while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER break; case 1: ok = 1; break; // Preparar DISCO DURO case 2: Execute( "UT_systm\\PMAGIC\\PQMAGIC.EXE" ); break; // Volcar W98 -> HD case 5: Execute( "UT_systm\\C98.BAT" ); break; // Volcar W95 -> HD case 6: Execute( "UT_systm\\C95.BAT" ); break; // Volcar UTILIDADES -> HD case 4: Execute( "UT_systm\\CUT.BAT" ); break; // TESTEO case 3: Execute( "UT_systm\\TESTdos\\Test.exe" ); break; } } while(!ok); }