commit b4ad5f43f26b4d932fc48beef96c0363ed9a692f Author: jdg Date: Wed Sep 8 21:27:06 2021 +0200 First commit 10/06/1992 diff --git a/0.PCX b/0.PCX new file mode 100644 index 0000000..e1021fd Binary files /dev/null and b/0.PCX differ diff --git a/3.PCX b/3.PCX new file mode 100644 index 0000000..c7c9785 Binary files /dev/null and b/3.PCX differ diff --git a/EGAVGA.BGI b/EGAVGA.BGI new file mode 100644 index 0000000..8001631 Binary files /dev/null and b/EGAVGA.BGI differ diff --git a/FREC.IMG b/FREC.IMG new file mode 100644 index 0000000..4620d15 --- /dev/null +++ b/FREC.IMG @@ -0,0 +1,280 @@ +* +* ATENCION, ESTE ES EL CàDIGO FUENTE DE MIS LIBRERIAS PARA GENERAR FONDOS +* Y PULSADORES. +* +* VERSION DEL CODIGO COMPILABLE EN TIEMPO DE EJECUCION +* +* UTILICE EL PROGRAMA MK_BOTON.EXE PARA CONVERTIR A C++ +* Y COMPILARLO JUNTO AL CODIGO FUENTE DE LA APLICACION. +* +* El autor de este programa vende LAS LIBRERIAS que el mismo a fabricado +* y con las que estan ello este programa: +* +* MAKE_BOTON 5.000 ptas ( Crea Pulsadores y FX's sin esfuerzo ) +* WAVE_GENER 5.000 ptas ( Muestreador y retocador completo ) +* FX_PACK 5.000 ptas ( N§s Grandes, Letras Despl, MouseP... ) +* WAVE_PLAY 3.500 ptas ( Librerias de reproducci¢n de waves +* de hasta 32 TeraBytes con solo 8 Kb ) +* XMS_MEMMGR 3.500 ptas ( Clase para manejar la XMS ) +* B_DATOS 5.000 ptas ( Clase " la gestion de bases de datos ) +* +* Ú---> 15.000 <---Â---> 15.000 <---Ä---> 15.000 <---Â---> 15.000 <---¿ +* Ã---> 15.000 <---´ TODO EL KIT POR SOLO Ã---> 15.000 <---´ +* À---> 15.000 <---Á---> 15.000 <---Ä---> 15.000 <---Á---> 15.000 <---Ù + + + +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ +* Û Û +* Û Pantalla Principal Û +* Û Û +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ + +­1 + + +* Cuadro de ondas +& 0, 120, 640, 480, 7, 63, 56, 2, 2 +& 5, 125, 635, 284, 0, 56, 63, 1, 2 +& 5, 288, 635, 313, 1, 56, 63, 1, 2 +& 5, 317, 635, 475, 0, 56, 63, 1, 2 + +* Cuadro de numeros +& 0, 0, 240, 120, 7, 63, 56, 2, 2 +& 8, 8, 232, 82, 0, 56, 63, 2, 2 +& 8, 87, 232, 112, 0, 56, 63, 2, 2 + +* Cuadro de Botone +* +* COMIENZA EL JUEGO... ( JD EL GENIO DE GENIOS... ) +* +* + +#5 + +!1, 33 + +* Boton Seleccion Generador/Osciloscopio +$ 240, 0, 315, 24, 7, 63, 56, 2, 2, 00, 00 + * Boton ejecutar accion GENERAR/OBTENER onda + $ 315, 0, 340, 24, 7, 63, 56, 2, 2, 00, 00 +* ???????????????????????????????????? +$ 240, 24, 315, 48, 7, 63, 56, 2, 2, 00, 00 + * ???????????????????????????????????? + $ 315, 24, 340, 48, 7, 63, 56, 2, 2, 00, 00 + +* Boton Salvar +$ 240, 48, 340, 72, 7, 63, 56, 2, 2, 00, 00 +* Boton Cargar +$ 240, 72, 340, 96, 7, 63, 56, 2, 2, 00, 00 + +* Boton Salir +$ 240, 96, 340, 120, 7, 63, 56, 2, 2, 83, 00 + + +* Boton Ayuda on-Line +$ 340, 0, 365, 30, 7, 63, 56, 2, 2, 00, 00 +* Boton Creditos +$ 340, 30, 365, 60, 7, 63, 56, 2, 2, 00, 00 +* Boton REGISTRO / MI LICENCIA +$ 340, 60, 365, 120, 7, 63, 56, 2, 2 + + +* Cuadro/Boton Amplitud +& 540, 0, 615, 24, 7, 63, 56, 2, 2 + $ 542, 2, 613, 22, 0, 56, 63, 2, 2, 00, 00 +& 540, 24, 615, 48, 7, 63, 56, 2, 2 + $ 542, 26, 613, 46, 0, 56, 63, 2, 2, 00, 00 +* Cuadro/Boton unidad +& 611, 0, 640, 24, 7, 63, 56, 2, 2 + $ 613, 2, 638, 22, 0, 56, 63, 2, 2, 00, 00 +& 611, 24, 640, 48, 7, 63, 56, 2, 2 + $ 613, 26, 638, 46, 0, 56, 63, 2, 2, 00, 00 + +* Botones de cursor y acciones mas precisas para estos + * + $ 615, 48, 640, 72, 7, 63, 56, 2, 2, 00, 73 + * --------->>>>>> Flecha derecha + $ 615, 72, 640, 96, 7, 63, 56, 2, 2, 00, 77 + * Marcar Parte de la onda + $ 615, 96, 640, 120, 7, 63, 56, 2, 2, 00, 81 + + * ^^^^^ Flecha arriba + $ 590, 48, 615, 72, 7, 63, 56, 2, 2, 00, 72 + * Centrar cero + $ 590, 72, 615, 96, 7, 63, 56, 2, 2, 00, 00 + * \/ \/ \/ \/ \/ Flecha abajo + $ 590, 96, 615, 120, 7, 63, 56, 2, 2, 00, 80 + + * + $ 565, 48, 590, 72, 7, 63, 56, 2, 2, 00, 71 + * <<<<<<-------- Flecha izquierda + $ 565, 72, 590, 96, 7, 63, 56, 2, 2, 00, 75 + * Ground ( Tierra ) + $ 565, 96, 590, 120, 7, 63, 56, 2, 2, 00, 79 + +* Selecciona la onda completa +$ 540, 48, 565, 120, 7, 63, 56, 2, 2, 00, 00 + +* Creacion de onda predefinida + * Estancar proceso + $ 365, 0, 395, 24, 7, 63, 56, 2, 2, 00, 00 + * Retroceder tipo de onda + $ 395, 0, 424, 24, 7, 63, 56, 2, 2, 00, 00 + * Onda pred. 1, 2, 3 + $ 424, 0, 453, 24, 7, 63, 56, 2, 2, 00, 00 + $ 453, 0, 482, 24, 7, 63, 56, 2, 2, 00, 00 + $ 482, 0, 511, 24, 7, 63, 56, 2, 2, 00, 00 + * Avanzar tipo de onda + $ 511, 0, 540, 24, 7, 63, 56, 2, 2, 00, 00 + + +$ 365, 24, 424, 48, 7, 63, 56, 2, 2, 00, 00 +* +$ 424, 24, 482, 48, 7, 63, 56, 2, 2, 00, 00 +* +$ 482, 24, 540, 48, 7, 63, 56, 2, 2, 00, 00 + +* | 397, 50, 2, 4, 0, 63, MMMMMMMMM-MMMMMMMMM-MMMMMMMMM-, + +­2 + +| 240, 50, 2, 6, 0, 63, Salvar, +| 241, 51, 2, 6, 0, 0, Salvar, +| 240, 74, 2, 6, 0, 63, Cargar, +| 241, 75, 2, 6, 0, 0, Cargar, +| 240, 98, 2, 6, 0, 63, Salir, +| 241, 99, 2, 6, 0, 0, Salir, + | 240, 99, 2, 6, 0, 63, _, + | 241, 100, 2, 6, 0, 0, _, + +| 614, 108, 2, 2, 0, 63, Marca, +| 615, 109, 2, 2, 0, 0, Marca, +| 563, 107, 2, 4, 0, 63, GND, +| 564, 108, 2, 4, 0, 0, GND, +| 382, 1, 2, 4, 1, 63, CRT, +| 383, 2, 2, 4, 1, 0, CRT, + +!2, 1 +$ 204, 274, 276, 291, 7, 56, 63, -2, 1, 00, 30 + +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ +* Û Û +* Û Casilla de pregunta ( OPTAR por.... ACEPTAR CANCELAR Û +* Û Û +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ + +­100 +& 200, 212, 440, 267, 7, 56, 63, 2, 1 +& 205, 217, 435, 262, 7, 63, 56, -2, 1 + +* Boton Aceptar +& 200, 270, 280, 295, 7, 63, 56, 2, 1 +* Boton Cancelar +& 360, 270, 440, 295, 7, 63, 56, 2, 1 + +­101 +| 200, 274, 2, 5, 0, 63, Aceptar, +| 201, 275, 2, 5, 0, 0, Aceptar, + | 200, 274, 2, 5, 0, 14, A, + | 201, 275, 2, 5, 0, 0, A, + + +| 340, 274, 2, 5, 0, 63, Cancelar, +| 341, 275, 2, 5, 0, 0, Cancelar, + | 340, 274, 2, 5, 0, 14, C, + | 341, 275, 2, 5, 0, 0, C, + + +!3, 2 +* Boton Aceptar +$ 204, 274, 276, 291, 7, 56, 63, -2, 1, 00, 30 +* Boton Cancelar +$ 364, 274, 436, 291, 7, 56, 63, -2, 1, 00, 46 + + +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ +* Û Û +* Û File Browser Û +* Û Û +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ + +!4, 4 + +*Cuadro Cancelar +$ 377, 169, 391, 221, 7, 56, 63, 0, 1, 00, 46 +*Boton Aceptar +$ 377, 223, 391, 276, 7, 56, 63, 0, 1, 00, 30 + +* Subir +$ 377, 278, 391, 303, 7, 56, 63, 0, 1, 00, 72 +* Bajar +$ 377, 305, 391, 330, 7, 56, 63, 0, 1, 00, 80 + + + +* x y fuente tama¤o orientacion color texto + +* Men£ para Cargar o Salvar +­10 + +*Cuadro Total +& 240, 140, 400, 340, 7, 63, 56, 2, 1 +& 243, 143, 397, 337, 7, 56, 63, -2, 1 +*Cuadro Informativo +& 250, 150, 391, 164, 7, 56, 63, -0, 1 +*Cuadro introduccion nuevos datos +& 250, 169, 375, 180, 0, 56, 63, 0, 1 +*Cuadro de muestreo +& 250, 185, 375, 330, 0, 56, 63, 0, 1 + +*Cuadro Cancelar +& 377, 169, 391, 221, 7, 56, 63, 0, 1 +*Boton Aceptar +& 377, 223, 391, 276, 7, 56, 63, 0, 1 + +* Subir +& 377, 278, 391, 303, 7, 56, 63, 0, 1 +* Bajar +& 377, 305, 391, 330, 7, 56, 63, 0, 1 + +|377, 169, 2, 4, 1, 63, Cancelar, + |378, 170, 2, 4, 1, 0, Cancelar, + |377, 169, 2, 4, 1, 2, C , + |378, 170, 2, 4, 1, 0, C , +|377, 223, 2, 4, 1, 63, Aceptar , + |378, 224, 2, 4, 1, 0, Aceptar , + |377, 223, 2, 4, 1, 2, A , + |378, 224, 2, 4, 1, 0, A , + +|377, 288, 2, 4, 0, 63, -, + |378, 289, 2, 4, 0, 0, -, +|377, 315, 2, 4, 0, 63, +, + |378, 316, 2, 4, 0, 0, +, + + + +******************************************************************************** +**** Prueba del pulsador derecho... ******************************************* +******************************************************************************** +!5, 7 +* Boton Cerrar seleccion derecho +$ 0, 0, 25, 52, 7, 63, 56, 2, 2, 00, 00 + +* Boton seleccion DISPERSION +$ 30, 0, 105, 24, 7, 63, 56, 2, 2, 00, 00 +$ 50, 3, 103, 21, 0, 56, 63, 2, 1, 00, 00 + +* Boton seleccion PRESICIàN +$ 30, 29, 105, 52, 7, 63, 56, 2, 2, 00, 00 +$ 50, 32, 103, 49, 0, 56, 63, 2, 1, 00, 00 + + * Subir selecci¢n + $ 110, 0, 135, 24, 7, 63, 56, 2, 2, 00, 00 + * Bajar selecci¢n + $ 110, 29, 135, 52, 7, 63, 56, 2, 2, 00, 00 +* TODO EL CUADRO MIDE: (0, 0) - (135, 52) +******************************************************************************** +******************************************************************************** +******************************************************************************** + diff --git a/LITT.CHR b/LITT.CHR new file mode 100644 index 0000000..08c3067 Binary files /dev/null and b/LITT.CHR differ diff --git a/LLAVE.CPP b/LLAVE.CPP new file mode 100644 index 0000000..e0ccddf --- /dev/null +++ b/LLAVE.CPP @@ -0,0 +1,758 @@ +#define SEC_OPTAR 2 +#define ENCUADRE 3 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "..\libs\make_bot\make_bot.h" // Fuciones de MAKE_BOTON + +#define PULSO_QUE_CABEN 48 +#define ANCHO_PULSO 12 +#define ALTO_PULSO 12 +extern void ponicono(int x,int y,char matriz[18][18], char pos); +extern char flecha [18] [18]; + +typedef struct + { + int x, y; // Coordenadas iniciales de muestreo + char ndigitos; // n£mero de digitos a mostrar + char AX, AY; // factor de espaciado + char C1, C2, C3; // colores de fondo, texto, borde + + // Datos privados y uso interno exclusivamente + unsigned int Flen; // longitud de la frase actual + char BitByte; // bit del byte por el que va en el recorrido + char currByte; // byte actual dentro de la frase + } p_Ampliada; + +#define OFF 0 +#define ON 1 + +#ifdef __cplusplus + #define __CPPARGS ... +#else + #define __CPPARGS +#endif +#define INTR 0X1C /* The clock tick interrupt */ + +char count = 0, intvect = OFF, IntVect = OFF; + +extern int Optar( int optar, ...); + +void AnulaInterrupcion(void); +void interrupt handler(__CPPARGS); +void interrupt ( *oldhandler)(__CPPARGS); +char *ptr_char; + +void DibujaPulsos( long comienzo, char bit, char far *Datos, int x, int y, char color, long TotalPulsos ); +void LeeFuentes(char *file); +void Fuente_Amplia( char *Frase, p_Ampliada far *FA ); +void DibujaFondo(void); +void DibujaSeparadores( int X1, int Y1, int X2, int Y2, char color ); + +void Error( int code, char *MensajeError ); + +void BorraPantalla(void); +void ComienzaRutina(void); + +extern char file_browser( char *comodin_name, char *texto1, char Cargar_Salvar ); + +long InicioPulso[6][2]; + +void CargarOnda( char *file, char far *Datos, char Ventana ); +void SalvarOnda( char *file, char far *Datos, char Ventana ); + +char far *Datos[2]; + +int TiempoEspera = 5, DIR_LPT = 0x378, ANGULO = 0; + +int main( int argc, char *argv[] ) +{ + + int i; + long j; + char buffer[4][80] = { "Jos‚ David Guill‚n || _-ùFuTuRe ViSiOnù-_ || 1996 (c)", + " ", + " e-mail: Jose-David.Guillen@cs.us.es ", + " " }; + + if ( argc == 2 ) + { + TiempoEspera = atoi(argv[1]); + if ( TiempoEspera < 0 || TiempoEspera > 1000 ) + TiempoEspera = 5; + } + if ( argc == 3 ) + { + DIR_LPT = atoi( argv[2] ); + if ( DIR_LPT < 0 ) + DIR_LPT = 0x379; + + } + if ( argc == 4 ) + { + ANGULO = atoi( argv[3] ); + if ( ANGULO < 0 ) + ANGULO = 0; + + } + + + if ( atexit( AnulaInterrupcion ) != 0 ) + intvect = OFF; + else + intvect = ON; + + True_Push = ON; PunteroRaton = 1; + Initialize( 9, 2 ); // Inicializa el Modo Gr fico + inicializa_raton_grafico( 0, 0, 639, 479 ); + setrgbpalette(EGA_WHITE, 56, 58, 59 ); + setrgbpalette(EGA_LIGHTGRAY, 30, 37, 43 ); + setrgbpalette(EGA_DARKGRAY, 24, 27, 30 ); + + if ( carga_botones( "llave.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" ); + + if ( ( Datos[0] = (char far *)farcalloc( 100000, sizeof(char) ) ) == NULL ) + { + Optar( 0, "ERROR DE MEMORIA", "Memoria insuficiente", "para la primera forma", "de onda.", NULL ); + closegraph(); + return -1; + } + + if ( ( Datos[1] = (char far *)farcalloc( 100000, sizeof(char) ) ) == NULL ) + { + farfree( Datos[0] ); + Optar( 0, "ERROR DE MEMORIA", "Memoria insuficiente", "para la segunda forma", "de onda.", NULL ); + closegraph(); + return -1; + } + + _fmemcpy( Datos[0], &i, 50000 ); + + if ( intvect == ON ) + { + // save the old interrupt vector + oldhandler = getvect(INTR); + // install the new interrupt handler + setvect(INTR, handler); + + IntVect = ON; + } + + if ( ( ptr_char = ( char *)malloc( sizeof(char)*4096 ) ) == NULL ) + Error( 0x06, "Error inicializando Memoria, fuentes" ); + LeeFuentes("llave.fnt"); + + + DibujaFondo(); + + ComienzaRutina(); + + BorraPantalla(); + + free( ptr_char ); + AnulaInterrupcion(); + + closegraph(); + + printf( "\n%s", buffer[0] ); + printf( "\n%s", buffer[1] ); + printf( "\n%s", buffer[2] ); + printf( "\n%s", buffer[3] ); + + farfree( Datos[0] ); + farfree( Datos[1] ); + return 0; + +} + +void ComienzaRutina(void) +{ + int ok, BPush, VentanaActiva, i, j; + long DLectura; + char buffer[280]; + + // Temporal hasta que existan datos reales... +/* + Datos[0] = (char *)&ok; + Datos[1] = (char *)&ok; +*/ + + + VentanaActiva = 0; + for ( j = 0; j < 2; j++ ) + for ( i = 0; i < 5; i++ ) + InicioPulso[i][j] = 0; + + InicioPulso[5][0] = 100000; + InicioPulso[5][1] = 100000; + + DibujaSeparadores( 63, 27, 630, 193, EGA_RED ); + DibujaSeparadores( 63, 27 + 250, 630, 193 + 250, EGA_RED ); + // Borramos los pulsos anteriores, y los desplazamos + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][0], 0x01 << j, Datos[0], 63, 42 + 30*j + 0, EGA_GREEN, InicioPulso[5][0] ); + DibujaPulsos( InicioPulso[j][1], 0x01 << j, Datos[1], 63, 42 + 30*j + 250, EGA_GREEN, InicioPulso[5][1] ); + } + + // Flecha hacia arriba + ponicono( 20, 225, flecha, 2 ); + + + ok = 0; + do { + + // Actualiza todos los puntos + setfillstyle( SOLID_FILL, EGA_BLACK ); + setcolor( EGA_WHITE ); + for ( i = 0; i < 2; i++ ) + for ( j = 0; j < 5; j++ ) + { + bar( 12, 42+31*j + 250*i, 52, 53+31*j + 250*i ); + sprintf( buffer, "%7ld", InicioPulso[j][i] ); + outtextxy( 12, 41 + 31*j + 250*i, buffer ); + } + + BPush = Comprueba_Secuencia( 1, NULL ); + + switch( BPush ) + { + case -2: + case -1: + case -0: + while( kbhit() ) getch(); + break; + // Salir + case 1: + ok = 1; + break; + // Cambio de Ventana + case 2: + VentanaActiva = !VentanaActiva; + // Flecha hacia arriba + ponicono( 20, 225, flecha, VentanaActiva == 0 ? 2 : 4 ); + + break; + // Desplazamiento de ondas (IZQUIERDA ) + case 3: + case 4: + case 5: + case 6: + case 7: + InicioPulso[BPush-3][VentanaActiva] --; + if ( InicioPulso[BPush-3][VentanaActiva] < 0 ) + { + InicioPulso[BPush-3][VentanaActiva] = 0; + } else { + // Borramos la onda anterior + DibujaPulsos( InicioPulso[BPush-3][VentanaActiva] + 1, 0x01 << (BPush - 3), Datos[VentanaActiva], 63, 42 + 30*(BPush-3) + ( VentanaActiva ? 250 : 0 ), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + + // Dibujamos la nueva onda + DibujaPulsos( InicioPulso[BPush-3][VentanaActiva], 0x01 << (BPush - 3), Datos[VentanaActiva], 63, 42 + 30*(BPush-3) + ( VentanaActiva ? 250 : 0 ), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + } + break; + // Desplazamiento de ondas (DERECHA) + case 8: + case 9: + case 10: + case 11: + case 12: + InicioPulso[BPush-8][VentanaActiva] ++; + if ( InicioPulso[BPush-8][VentanaActiva] > InicioPulso[5][VentanaActiva] ) + { + InicioPulso[BPush-8][VentanaActiva] --; + } else { + // Borramos la onda anterior + DibujaPulsos( InicioPulso[BPush-8][VentanaActiva] - 1, 0x01 << (BPush - 8), Datos[VentanaActiva], 63, 42 + 30*(BPush-8) + (VentanaActiva ? 250 : 0), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + + // Dibujamos la nueva onda + DibujaPulsos( InicioPulso[BPush-8][VentanaActiva], 0x01 << (BPush - 8), Datos[VentanaActiva], 63, 42 + 30*(BPush-8) + (VentanaActiva ? 250 : 0), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + } + break; + // Desplazamiento de pulsos TODAS (IZQUIERDA) + case 13: + // Borramos los pulsos anteriores, y los desplazamos + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + InicioPulso[j][VentanaActiva]--; + if ( InicioPulso[j][VentanaActiva] < 0 ) + InicioPulso[j][VentanaActiva] = 0; + } + + DibujaSeparadores( 63, 27 + (VentanaActiva ? 250 : 0 ), 630, 193 + (VentanaActiva ? 250 : 0 ), EGA_RED ); + + // Dibujamos los nuevos pulsos. + for ( j = 0; j < 5; j ++ ) + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + break; + // Reset de todos los pulsos + case 14: + // Borramos los pulsos anteriores, y los reseteamos + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + InicioPulso[j][VentanaActiva] = 0; + } + + DibujaSeparadores( 63, 27 + (VentanaActiva ? 250 : 0 ), 630, 193 + (VentanaActiva ? 250 : 0 ), EGA_RED ); + + // Dibujamos los nuevos pulsos. + for ( j = 0; j < 5; j ++ ) + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + break; + // Al final de todos los pulso + case 15: + // Borramos los pulsos anteriores, nos colocamos al final + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + InicioPulso[j][VentanaActiva] = InicioPulso[5][VentanaActiva] - PULSO_QUE_CABEN; + } + + DibujaSeparadores( 63, 27 + (VentanaActiva ? 250 : 0 ), 630, 193 + (VentanaActiva ? 250 : 0 ), EGA_RED ); + + // Dibujamos los nuevos pulsos. + for ( j = 0; j < 5; j ++ ) + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + break; + // Desplazamiento de pulsoso TODOS (Derecha) + case 16: + // Borramos los pulsos anteriores, y los desplazamos + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_BLACK, InicioPulso[5][VentanaActiva] ); + InicioPulso[j][VentanaActiva]++; + if ( InicioPulso[j][VentanaActiva] > InicioPulso[5][VentanaActiva] ) + InicioPulso[j][VentanaActiva]--; + } + + DibujaSeparadores( 63, 27 + (VentanaActiva ? 250 : 0 ), 630, 193 + (VentanaActiva ? 250 : 0 ), EGA_RED ); + + // Dibujamos los nuevos pulsos. + for ( j = 0; j < 5; j ++ ) + DibujaPulsos( InicioPulso[j][VentanaActiva], 0x01 << j, Datos[VentanaActiva], 63, 42 + 30*j + ( VentanaActiva ? 250 : 0 ), EGA_GREEN, InicioPulso[5][VentanaActiva] ); + break; + // CARGAR + case 17: + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][0], 0x01 << j, Datos[0], 63, 42 + 30*j + 0, EGA_BLACK, InicioPulso[5][0] ); + DibujaPulsos( InicioPulso[j][1], 0x01 << j, Datos[1], 63, 42 + 30*j + 250, EGA_BLACK, InicioPulso[5][1] ); + } + + strcpy( buffer, "*.llv" ); + if ( file_browser( buffer, "Cargar Archivo", 0 ) ) + CargarOnda( buffer, Datos[VentanaActiva], VentanaActiva ); + + DibujaSeparadores( 63, 27, 630, 193, EGA_RED ); + DibujaSeparadores( 63, 27 + 250, 630, 193 + 250, EGA_RED ); + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][0], 0x01 << j, Datos[0], 63, 42 + 30*j + 0, EGA_BLACK, InicioPulso[5][0] ); + DibujaPulsos( InicioPulso[j][1], 0x01 << j, Datos[1], 63, 42 + 30*j + 250, EGA_BLACK, InicioPulso[5][1] ); + } + break; + // SALVAR + case 18: + strcpy( buffer, "*.llv" ); + if ( file_browser( buffer, "Salvar Archivo", 1 ) ) + SalvarOnda( buffer, Datos[VentanaActiva], VentanaActiva ); + break; + // LEER ONDA + case 19: + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][0], 0x01 << j, Datos[0], 63, 42 + 30*j + 0, EGA_BLACK, InicioPulso[5][0] ); + DibujaPulsos( InicioPulso[j][1], 0x01 << j, Datos[1], 63, 42 + 30*j + 250, EGA_BLACK, InicioPulso[5][1] ); + } + Optar( 0, "Lectura de Onda", "Prepare el chisme, y", "pulse una tecla cuando este", "preparado...", NULL ); + Optar( ENCUADRE, "Leyendo Onda", "Presione una cualquier", "tecla para interrumpir el", "proceso...", NULL ); + + outportb( DIR_LPT + 0, 0xFF ); + outportb( DIR_LPT + 1, 0x01 ); + // Comienza lectura + for ( DLectura=0; DLectura < InicioPulso[5][VentanaActiva] && !kbhit(); DLectura++ ) + { + Datos[VentanaActiva][DLectura] = inportb( DIR_LPT ); + + sin( ANGULO ); + delay(TiempoEspera); + } + + while( kbhit() ) getch(); + + Optar( ENCUADRE, NULL ); + DibujaSeparadores( 63, 27, 630, 193, EGA_RED ); + DibujaSeparadores( 63, 27 + 250, 630, 193 + 250, EGA_RED ); + // Borramos los pulsos anteriores, y los desplazamos + for ( j = 0; j < 5; j ++ ) + { + DibujaPulsos( InicioPulso[j][0], 0x01 << j, Datos[0], 63, 42 + 30*j + 0, EGA_GREEN, InicioPulso[5][0] ); + DibujaPulsos( InicioPulso[j][1], 0x01 << j, Datos[1], 63, 42 + 30*j + 250, EGA_GREEN, InicioPulso[5][1] ); + } + break; + + } + + }while ( !ok ); + +} + +void CargarOnda( char *file, char far *Datos, char Ventana ) +{ + FILE *file_in; + int i; + char buffer[80]; + + struct CABECERA + { + long DPulsos[6]; + } Cabecera; + + if ( ( file_in = fopen( file, "rb" ) ) != NULL ) + { + fread( &Cabecera, sizeof( CABECERA ), 1, file_in ); + + farfree( Datos ); + if ( ( Datos = (char far *)farmalloc( sizeof(char)*Cabecera.DPulsos[5] ) ) == NULL ) + { + sprintf( buffer, "longitud %ld bytes.", (long)(sizeof(char)*Cabecera.DPulsos[5]) ); + Optar( 0, "ATENCION !!!", "No hay suficiente memoria", "no pude cargar el pulso", buffer, NULL ); + for ( i = 0; i < 6; i++ ) + Cabecera.DPulsos[i] = 0; + } else { + fseek( file_in, sizeof( CABECERA ), SEEK_SET ); + fread( Datos, sizeof(char), Cabecera.DPulsos[5], file_in ); + } + + for ( i = 0; i < 6; i++ ) + InicioPulso[i][Ventana] = Cabecera.DPulsos[i]; + + + fclose(file_in); + } + +} + + +void SalvarOnda( char *file, char far *Datos, char Ventana ) +{ + FILE *file_out; + int i; + + struct CABECERA + { + long DPulsos[6]; + } Cabecera; + + if ( ( file_out = fopen( file, "wb" ) ) != NULL ) + { + for ( i = 0; i < 6; i++ ) + Cabecera.DPulsos[i] = InicioPulso[i][Ventana]; + + fwrite( &Cabecera, sizeof( CABECERA ), 1, file_out ); + fseek( file_out, sizeof( CABECERA ), SEEK_SET ); + fwrite( Datos, sizeof(char), Cabecera.DPulsos[5], file_out ); + + fclose(file_out); + } + +} + + + +void BorraPantalla(void) +{ + int CLS; + setcolor( 0 ); + randomize(); + + switch( random(4)+1 ) + { + case 1: + for ( CLS = 0; CLS < 640; CLS+=2 ) + { + line( CLS, 0, CLS, 479 ); + line( 639-CLS, 0, 639-CLS, 479 ); + delay( 10 ); + } + break; + case 2: + for ( CLS = 0; CLS < 480; CLS+=2 ) + { + line( 0, CLS, 639, CLS ); + line( 0, 479-CLS, 639, 479-CLS ); + delay( 10 ); + } + break; + case 3: + for ( CLS = 0; CLS < 640*2; CLS+=2 ) + { + line( 639-CLS, 0, 639 , CLS ); + line( CLS, 479, 0, 480-CLS ); + delay( 10 ); + } + break; + case 4: + for ( CLS = 0; CLS < 640*2; CLS+=2 ) + { + line( CLS, 0, 0, CLS ); + line( 640-CLS, 479, 639, 480-CLS ); + delay( 10 ); + } + break; + } + + +} + +void DibujaPulsos( long comienzo, char And_bit, char far *Datos, int x, int y, char color, long TotalPulsos ) +{ + long Pulso; + + // seleccionamos el color de usuario + setcolor( color ); + + y += ALTO_PULSO + 5; + +// moveto( x, y + ( comienzo > 0 ? ( ( Datos[comienzo-1] & And_bit ) ? ALTO_PULSO : 0 ) : 0 ) ); + moveto( x, y - ( comienzo > 0 ? ( ( Datos[comienzo] & And_bit ) ? ALTO_PULSO : 0 ) : 0 ) ); + for ( Pulso = comienzo; Pulso < ( comienzo + PULSO_QUE_CABEN ) & Pulso < TotalPulsos; Pulso++, x+=ANCHO_PULSO ) + { + lineto( x, y - ( ( Datos[Pulso] & And_bit ) ? ALTO_PULSO : 0 ) ); + lineto( x, y - ( ( Datos[Pulso+1] & And_bit ) ? ALTO_PULSO : 0 ) ); + } +} + +void DibujaSeparadores( int X1, int Y1, int X2, int Y2, char color ) +{ + setcolor( color ); + + setlinestyle( CENTER_LINE, 0, NORM_WIDTH ); + + for ( ; X1 < X2; X1 += ANCHO_PULSO ) + line( X1, Y1, X1, Y2 ); + + setlinestyle( SOLID_LINE, 0, NORM_WIDTH ); + +} + + +void DibujaFondo(void) +{ + FILE *fp; + int alto, ancho; unsigned char byte; int contador; char BitMap[40][40]; + + int x, y, vez = -1; + + if ( ( fp = fopen ( "1.PCX", "rb" ) ) != NULL ) + { + // Saltamos la cabecera + fseek( fp, 128, SEEK_SET ); + + for(alto=0; alto<32; alto++) + { + for(ancho=0; ancho<32; ) + { + byte=getc(fp); + if(byte<=0xC0) + { + if ( vez == -1 ) vez = byte; + BitMap[ancho%32][alto%32] = byte; + ancho++; + } + else + { + contador=byte&0x3F; byte=getc(fp); + for(; contador>0; contador--) + { + BitMap[ancho%32][alto%32] = byte; + ancho++; + } + } + } + } + // Rellenamos la pantalla con un fondo atractivo... + setfillstyle( SOLID_FILL, vez ); bar( 0, 0, 640, 480 ); + for ( ancho = 0; ancho < 32; ancho++ ) + for ( y = 0; y < 480; y+=35 ) + for ( alto = 0; alto < 32; alto++ ) + for ( x = 0; x < 640; x+=35 ) + putpixel( x + ancho, y + alto, BitMap[ancho][alto] ); + fclose( fp ); + } else { + // Rellenamos la pantalla con un fondo atractivo... + setcolor( 1 ); + setfillstyle( LTBKSLASH_FILL, 1 ); bar( 0, 0, 640, 480 ); + } + + + + Imprime_Estaticos( 10, "llave.img" ); + + +/* + setfillstyle( SOLID_FILL, EGA_GREEN ); + setcolor( 11 ); + rectangle( 58, 23, 632, 197 ); +*/ +// & 58, 23, 632, 197, 0, 56, 63, 2, 2 +// & 58, 273, 632, 447, 0, 56, 63, 2, 2 + +} + + + + +void AnulaInterrupcion(void) +{ +/* reset the old interrupt handler */ +if ( intvect == ON ) + setvect(INTR, oldhandler); +intvect = OFF; +} + +/***************************************************************************\ +|* *| +|* INT CLK *| +|* *| +|* Descripci¢n: *| +|* interrupci¢n para el parpadeo de los led's *| +|* *| +|* Entradas: (indeterminadas) *| +|* *| +|* *| +|* *| +|* Salidas: (ninguna) *| +|* *| +\***************************************************************************/ +void interrupt handler(__CPPARGS) +{ +/* increase the global counter */ + if ( IntVect == ON ) + { + count = (count++)%16; + if ( count == 1 ) + { + setpalette( 11, EGA_GREEN ); + setpalette( 13, EGA_LIGHTGREEN ); + } + else if ( count == 8 ) + { + setpalette( 11, EGA_RED ); + setpalette( 13, EGA_LIGHTRED ); + + } + } + +/* call the old routine */ + oldhandler(); +} + + +void LeeFuentes(char *file) +{ +FILE *fich; + /* Reservamos 4 Kb. para cargar la fuente en memoria */ + + /* Abrimos el fichero de la fuente */ + + if ((fich=fopen(file,"rb"))==NULL) { + printf("\a\nArchivo %s no encontrado.\n",file); + Error(0, "No se encuentra el archivo de fuentes"); + } + + fseek(fich, SEEK_SET, 0); /* Nos colocamos al principio del fichero */ + fread(ptr_char,1,4096,fich); /* Cargamos en memoria 4096 bytes del fichero */ + fclose(fich); /* Cerramos el fichero */ +} + +#define TAMx 8 +#define TAMy 8 +void Fuente_Amplia( char *Frase, p_Ampliada far *FA ) +{ + int i, j, k; // Variables de avance + int c_elec; // Color en el momento de imprimir + int PosX, PosY; // Posicion fisica final + char LCaract; // Caracter de linea a tratar + + if ( FA->Flen != _fstrlen( Frase ) ) // Reseteamos las variables de control interno + { + // Obtenemos la longitud de la frase. ( En d¡gitos ) + FA -> Flen = _fstrlen( Frase ); + // Contador de digito actual a cero + FA -> BitByte = 0; + // Posicion dentro de la frase + FA -> currByte = 0; + } + + // Avance horizontal de bit's ( avance de digitos ) + for ( i = 0; i < ( TAMx * (FA -> ndigitos) ); i++ ) + { + k = ( Frase[ ( (i+FA->BitByte)/TAMx + FA -> currByte ) % FA->Flen ] ) << 4; + LCaract = ( (char)0x01 << (7 - (i+FA->BitByte)%TAMx) ); + PosX = FA -> x + FA->AX * i; // Posicion f¡sica horizontal + // Avance vertical de bit's + for ( j = 0; j < TAMy; j ++ ) + { + PosY = FA -> y + FA->AY * j; // Posicion f¡sica vertical + + if ( ptr_char[ k + j ] & LCaract ) + c_elec = FA->C2; + else + c_elec = FA->C1; + + putpixel ( PosX, PosY, c_elec ); + } + } + // Tenemos en cuenta el avance dentro de la frase + if ( ( FA -> BitByte ++ ) >= 7 ) + { + FA -> BitByte = 0; FA -> currByte ++; + if ( FA -> currByte >= FA -> Flen ) + FA -> currByte = 0; + } + +} +#undef TAMy +#undef TAMx + + +void Error( int code, char *MensajeError ) +{ + free( ptr_char ); + AnulaInterrupcion(); + restorecrtmode(); + + printf( "\nSe produjo un codigo de error %d, subcodigo no disponible ", code ); + switch( code ) + { + case 0: + printf( "\n Error Desconocido " ); + break; + case 1: + printf( "\n BDatos gener¢ el error de salida. |ERROR DE ACCESO| " ); + break; + case 2: + printf( "\n Make Boton gener¢ el error de salida " ); + break; + case 3: + printf( "\n Fall¢ en alg£n punto del men£ principal" ); + break; + + }; + + printf( "\n> %s_", MensajeError ); + exit(code); +} diff --git a/LLAVE.EXE b/LLAVE.EXE new file mode 100644 index 0000000..d532bb8 Binary files /dev/null and b/LLAVE.EXE differ diff --git a/LLAVE.FNT b/LLAVE.FNT new file mode 100644 index 0000000..f0b651e Binary files /dev/null and b/LLAVE.FNT differ diff --git a/LLAVE.IMG b/LLAVE.IMG new file mode 100644 index 0000000..3758520 --- /dev/null +++ b/LLAVE.IMG @@ -0,0 +1,240 @@ +** Codigo fuente para MAKE_BOTON +** +** Make BOTON es un programa realizado por Jos‚ David Guill‚n +** +** Enlazar al programa principal con MB2CPP, y compilar a OBJ para Linkar +** +** +** MAKE_BOTON es un producto de JD. -->>> 5.000 Libreria exelente para +** tratamiento de botones y grf. +** ONDA_GRN es un producto de JD. --->>> 5.000 Le gustaria representar ondas +** sonoras con facilidad: ONDA_GRN +** UTILIZADO EN ­­­ FREC_OSC !!! +** + + +***************************************************************************** +* +* ATENCION !!! +* ALTERAR ESTE FICHERO, CAUSARA EL MALFUNCIONAMIENTO DEL +* PROGRAMA DE APOYO... ( ERRORES NO DOCUMENTADOS ) +* +***************************************************************************** + +#3 + +!1,20 + +* Boton SALIR!!! +$ 570, 215, 630, 255, 7, 7, 7, 0, 2, 000, 000 + +* Forma de onda +$ 15, 205, 48, 265, 7, 63, 56, 1, 2, 000, 000 + +* Desplazamiento de ondas +$ 58, 205, 110, 217, 7, 63, 56, 1, 2, 000, 000 +$ 58, 217, 110, 229, 7, 63, 56, 1, 2, 000, 000 +$ 58, 229, 110, 241, 7, 63, 56, 1, 2, 000, 000 +$ 58, 241, 110, 253, 7, 63, 56, 1, 2, 000, 000 +$ 58, 253, 110, 265, 7, 63, 56, 1, 2, 000, 000 + $ 113, 205, 165, 217, 7, 63, 56, 1, 2, 000, 000 + $ 113, 217, 165, 229, 7, 63, 56, 1, 2, 000, 000 + $ 113, 229, 165, 241, 7, 63, 56, 1, 2, 000, 000 + $ 113, 241, 165, 253, 7, 63, 56, 1, 2, 000, 000 + $ 113, 253, 165, 265, 7, 63, 56, 1, 2, 000, 000 + +* Reset Total +$ 170, 205, 185, 265, 7, 63, 56, 1, 2, 000, 000 +$ 185, 205, 200, 265, 7, 63, 56, 1, 2, 000, 000 +$ 200, 205, 215, 265, 7, 63, 56, 1, 2, 000, 000 +$ 215, 205, 230, 265, 7, 63, 56, 1, 2, 000, 000 + +* Cargar / Salvar +$ 485, 205, 565, 233, 7, 63, 56, 2, 2, 000, 000 +$ 485, 237, 565, 265, 7, 63, 56, 2, 2, 000, 000 + +* Leer / ??? +$ 400, 205, 480, 233, 7, 63, 56, 2, 2, 000, 000 +*$ 300, 205, 380, 233, 7, 63, 56, 2, 2, 000, 000 +$ 400, 237, 480, 265, 7, 63, 56, 2, 2, 000, 000 + + +­10 + +* Selector de forma de onda +& 15, 205, 48, 265, 7, 63, 56, 1, 2 + +*& 5, 20, 635, 200, 7, 63, 56, 2, 2 +*& 5, 270, 635, 450, 7, 63, 56, 2, 2 + + +* Desplazamiento de ondas +& 58, 205, 110, 217, 7, 63, 56, 1, 2 +& 58, 217, 110, 229, 7, 63, 56, 1, 2 +& 58, 229, 110, 241, 7, 63, 56, 1, 2 +& 58, 241, 110, 253, 7, 63, 56, 1, 2 +& 58, 253, 110, 265, 7, 63, 56, 1, 2 + & 113, 205, 165, 217, 7, 63, 56, 1, 2 + & 113, 217, 165, 229, 7, 63, 56, 1, 2 + & 113, 229, 165, 241, 7, 63, 56, 1, 2 + & 113, 241, 165, 253, 7, 63, 56, 1, 2 + & 113, 253, 165, 265, 7, 63, 56, 1, 2 + | 60, 205, 2, 4, 0, 0, <--- 1 1 --->, + | 60, 217, 2, 4, 0, 0, <--- 2 2 --->, + | 60, 229, 2, 4, 0, 0, <--- 3 3 --->, + | 60, 241, 2, 4, 0, 0, <--- 4 4 --->, + | 60, 253, 2, 4, 0, 0, <--- 5 5 --->, + +* Reset Total +& 170, 205, 185, 265, 7, 63, 56, 1, 2 +& 185, 205, 200, 265, 7, 63, 56, 1, 2 +& 200, 205, 215, 265, 7, 63, 56, 1, 2 +& 215, 205, 230, 265, 7, 63, 56, 1, 2 + | 170, 205, 2, 4, 1, 0, Retrocede, + | 185, 205, 2, 4, 1, 0, INICIO , + | 200, 205, 2, 4, 1, 0, FIN , + | 215, 205, 2, 4, 1, 0, Avanza , + + +* Boton SALIR!!! +& 600, 235, 30, -1, 7, 63, 56, 3, 2 +| 578, 220, 2, 6, 0, 0, Salir, +| 579, 221, 2, 6, 0, 63, Salir, + +& 485, 205, 565, 233, 7, 63, 56, 2, 2 +& 485, 237, 565, 265, 7, 63, 56, 2, 2 +| 485, 207, 2, 5, 0, 0, Cargar, +| 486, 208, 2, 5, 0, 63, Cargar, + +| 485, 237, 2, 5, 0, 0, Salvar, +| 486, 238, 2, 5, 0, 63, Salvar, + +& 400, 205, 480, 233, 7, 63, 56, 2, 2 +*& 300, 205, 380, 233, 7, 63, 56, 2, 2 +& 400, 237, 480, 265, 7, 63, 56, 2, 2 +| 404, 207, 2, 5, 0, 0, Leer Onda, +| 405, 208, 2, 5, 0, 63, Leer Onda, +*| 486, 238, 2, 5, 0, 63, Salvar, + + + +*& 5, 20, 635, 200, 7, 63, 56, 2, 2 +*& 5, 270, 635, 450, 7, 63, 56, 2, 2 + + +* Linea de fondo para ayudas +& 5, 455, 500, 475, 0, 63, 56, 0, 2 +& 505, 455, 635, 475, 63, 0, 56, 0, 2 + +* Pulsadores da avance global + + +* Ventanas para las formas de ondas +& 5, 20, 635, 200, 7, 63, 56, 2, 2 +& 5, 270, 635, 450, 7, 63, 56, 2, 2 + & 58, 23, 632, 197, 0, 56, 63, 2, 2 + & 58, 273, 632, 447, 0, 56, 63, 2, 2 + +* Ventanitas para saber cuanto se ha desplazado una onda en particualar +& 10, 40, 53, 55, 0, 56, 63, 0, 2 +& 10, 71, 53, 86, 0, 56, 63, 0, 2 +& 10, 102, 53, 117, 0, 56, 63, 0, 2 +& 10, 133, 53, 148, 0, 56, 63, 0, 2 +& 10, 164, 53, 179, 0, 56, 63, 0, 2 +* Ventanitas para saber cuanto se ha desplazado una onda en particualar +& 10, 290, 53, 305, 0, 56, 63, 0, 2 +& 10, 321, 53, 336, 0, 56, 63, 0, 2 +& 10, 352, 53, 367, 0, 56, 63, 0, 2 +& 10, 383, 53, 398, 0, 56, 63, 0, 2 +& 10, 414, 53, 429, 0, 56, 63, 0, 2 + + +| 0, 0, 2, 4, 0, 0, , + + + +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ +* Û Û +* Û File Browser Û +* Û Û +* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ + +!2, 4 + +*Cuadro Cancelar +$ 377, 169, 391, 221, 7, 56, 63, 0, 1, 00, 46 +*Boton Aceptar +$ 377, 223, 391, 276, 7, 56, 63, 0, 1, 00, 30 + +* Subir +$ 377, 278, 391, 303, 7, 56, 63, 0, 1, 00, 72 +* Bajar +$ 377, 305, 391, 330, 7, 56, 63, 0, 1, 00, 80 + + + +* x y fuente tama¤o orientacion color texto + +* Men£ para Cargar o Salvar +­20 + +*Cuadro Total +& 240, 140, 400, 340, 7, 63, 56, 2, 1 +& 243, 143, 397, 337, 7, 56, 63, -2, 1 +*Cuadro Informativo +& 250, 150, 391, 164, 7, 56, 63, -0, 1 +*Cuadro introduccion nuevos datos +& 250, 169, 375, 180, 0, 56, 63, 0, 1 +*Cuadro de muestreo +& 250, 185, 375, 330, 0, 56, 63, 0, 1 + +*Cuadro Cancelar +& 377, 169, 391, 221, 7, 56, 63, 0, 1 +*Boton Aceptar +& 377, 223, 391, 276, 7, 56, 63, 0, 1 + +* Subir +& 377, 278, 391, 303, 7, 56, 63, 0, 1 +* Bajar +& 377, 305, 391, 330, 7, 56, 63, 0, 1 + +|377, 169, 2, 4, 1, 63, Cancelar, + |378, 170, 2, 4, 1, 0, Cancelar, + |377, 169, 2, 4, 1, 2, C , + |378, 170, 2, 4, 1, 0, C , +|377, 223, 2, 4, 1, 63, Aceptar , + |378, 224, 2, 4, 1, 0, Aceptar , + |377, 223, 2, 4, 1, 2, A , + |378, 224, 2, 4, 1, 0, A , + +|377, 288, 2, 4, 0, 63, -, + |378, 289, 2, 4, 0, 0, -, +|377, 315, 2, 4, 0, 63, +, + |378, 316, 2, 4, 0, 0, +, + +************************************************ Botones D: 6 +**** **** Botones S: +** Parte Utilizada por Optar ** +**** **** +************************************************ +!3, 2 + +$ 170, 320, 270, 350, 7, 63, 56, 2, 2, 000, 30 +$ 370, 320, 470, 350, 7, 63, 56, 2, 2, 000, 46 + +­100 +& 170, 165, 470, 315, 7, 63, 56, 0, 2 +& 172, 167, 468, 190, 1, 56, 63, 0, 2 + +& 170, 320, 270, 350, 7, 63, 56, 2, 2 +| 175, 325, 2, 6, 0, 63, Aceptar, +| 176, 326, 2, 6, 0, 0, Aceptar, +| 175, 327, 2, 6, 0, 63, _, +| 176, 328, 2, 6, 0, 0, _, + +& 370, 320, 470, 350, 7, 63, 56, 2, 2 +| 373, 325, 2, 6, 0, 63, Cancelar, +| 374, 326, 2, 6, 0, 0, Cancelar, +| 373, 327, 2, 6, 0, 63, _, +| 374, 328, 2, 6, 0, 0, _, + diff --git a/LLAVE.PRJ b/LLAVE.PRJ new file mode 100644 index 0000000..d09589f Binary files /dev/null and b/LLAVE.PRJ differ diff --git a/LLAVE_FL.CPP b/LLAVE_FL.CPP new file mode 100644 index 0000000..457e8d7 --- /dev/null +++ b/LLAVE_FL.CPP @@ -0,0 +1,752 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +char flecha [18] [18] = + { + 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,0,4,0,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,0,4,4,4,0,7,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,0,4,4,4,4,4,4,4,0,7,7,7,7, + 7,7,7,7,0,4,4,4,4,4,4,4,4,4,0,7,7,7, + 7,7,7,0,4,4,4,4,4,4,4,4,4,4,4,0,7,7, + 7,7,0,0,0,0,0,4,4,4,4,4,0,0,0,0,0,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,4,4,4,4,4,0,7,7,7,7,7, + 7,7,7,7,7,7,0,0,0,0,0,0,0,7,7,7,7,7 + }; +void ponicono(int x,int y,char matriz[18][18], char pos) +{ + int veces1,veces2; + + for (veces1=0;veces1<=17;veces1++) + { + for (veces2=0;veces2<=17;veces2++) + { + + switch( pos ) + { + case 1: + if ( matriz[veces1][veces2] != 3 ) + putpixel(x+veces1,y+veces2,matriz[veces1][veces2]); + break; + case 2: + if ( matriz[17-veces2][veces1] != 3 ) + putpixel(x+veces1,y+veces2,matriz[17-veces2][veces1]); + break; + case 3: + if ( matriz[17-veces1][veces2] != 3 ) + putpixel(x+veces1,y+veces2,matriz[17-veces1][veces2]); + break; + case 4: + if ( matriz[veces2][veces1] != 3 ) + putpixel(x+veces1,y+veces2,matriz[veces2][veces1]); + break; + } + } + } + +} + + + + +#include "..\libs\make_bot\make_bot.h" + +/*extern CFG_FREC cfgFREC;*/ +//////////////////////////////////////////////////////////////////////////// +/***************************************************************************\ +| Critical Disk Error handling routines (C) 1995 Jason Speight. | +| void interrupt critical_error_handler(__CPPARGS) is the interrupt which | +| captures disk io errors. (int 0x24, if you're interested!) Such errors | +| are : Disk not inserted in drive, seek error reading from a drive, general| +| disk failure etc. The only things the interrupt does is : | +| Suppress the dos ABORT,RETRY,FAIL,IGNORE statement | +| Sets a variable erroroccurred to the dos error statement. (!=0) | +| | +| StartCEH() and StopCEH() start and stop the error handler. YOU MUST | +| STOPCEH BEFORE THE EXIT OF THE PROGRAM. or else when you get a disk | +| error, the int 24 issued bu DOS points to the middle of nowhere! *HANG* | +| | +| diskerror() is my routine to display a disk IO error. It also sets the | +| global variable erroroccurred to 0 for future use. This procedure also | +| needs access to "SCRNHNDL.H" and "BOXES.H" | +| | +| BTW, anybody know how to trap the message "PLEASE INSERT DISK FOR DRIVE x"| +\***************************************************************************/ + +void interrupt critical_error_handler(.../*__CPPARGS*/); // interrupt prototype +void interrupt (*old_int24)(.../*__CPPARGS*/); // interrupt function pointer +void startceh(); +void stopceh(); + +int erroroccurred=0; + +//////////////////////////////////////////////////////////////////////////// + +typedef struct { + char files[13] ; //100 files, 12 byte filename (+1 for terminator!) + long filesize ; //Try as static.. free up that ram, bud. (Use HUGE mem model) + unsigned char attrs ; +} SFile; + +SFile far *S_File; + +void FileDownRow(void); +void FileUpRow(void) ; +void PrintWholeScreen_Files(void); +void PrintSelectRow( char Hide_Show ); + +unsigned char FileRow = 0; int FileCurrTopRow = 0; +unsigned int maxfiles=0; +unsigned int rasterscan(char *fm); +char Archivo[13]; +void PrintVisor(void); + +int Optar( int optar, ... ); + +int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, int left, int up, int right, int down); + +char file_browser( char *comodin_name, char *texto1, char Cargar_Salvar ); + +char file_browser( char *comodin_name, char *texto1, char Cargar_Salvar ){ + + int ok = 0, inst = 0; + struct textsettingstype textinfo; + char oldpath[229]=" -- NONE -- "; //internal. do not change + unsigned char olddrive=255; //impossible drive name + char olddisk, key; long MemVideo; + + startceh(); + + FileRow = FileCurrTopRow = 0; + + olddrive = getdisk(); + getcwd( oldpath, 229 ); + + void far *C_Texto; + +MemVideo = JD_imagesize(240, 140, 400, 340); +C_Texto = farmalloc( MemVideo ); +S_File = (SFile far *)farmalloc( sizeof(SFile) * 101 ); + +if( C_Texto == NULL || S_File == NULL ) +{ + closegraph(); + cprintf("\n\rSALIENDO"); + cprintf("\n\rImposible encontrar %ldKbytes en el Heap %ld", (long)(sizeof(SFile)*101), MemVideo ); + return 0; +} + +rasterscan( comodin_name ); + +gettextsettings(&textinfo); + +getimage( 240, 140, 400, 340, C_Texto); + + + Imprime_Estaticos( 20, "llave.IMG"); // Imprime botones estaticos 'Seccion 20' + + + +settextstyle( SMALL_FONT, HORIZ_DIR, 4); + +setcolor( EGA_YELLOW ); +outtextxy( 250+( ( 141 - textwidth(texto1) ) / 2 ), 150, texto1 ); + +PrintWholeScreen_Files(); +PrintSelectRow( 1 ); + + +while(!ok){ // Bucle infinito + + switch( Comprueba_Secuencia( 2, NULL ) ) { // Iniciamos comprobacion de 2¦ sec + + case 0: // No se pulso ningun BOTON + // Pero el raton fue presionado en + // algun sitio... + break; + case -2: // Hay una tecla normal en BUFFER + switch( key = getch() ) { // La utilizamos + // ESC ( CANCELAR ) + case 27: + inst = 0; + ok = 1; + break; + case 13: + switch( S_File[FileRow + FileCurrTopRow].attrs ) + { + // Si directorio: cambiamos simplemente + case FA_DIREC: + chdir( S_File[FileRow + FileCurrTopRow].files ); + FileRow = FileCurrTopRow = 0; + rasterscan( comodin_name ); + PrintWholeScreen_Files(); + PrintSelectRow( 1 ); + break; + // Si unidad comprobamos que podemos cambiar y como directorio... + case 255: + erroroccurred=0; + olddisk=getdisk(); + setdisk( (S_File[FileRow + FileCurrTopRow].files[0] - 'A') ); + if (erroroccurred) { + setdisk(olddisk); + } else { + FileRow = FileCurrTopRow = 0; + rasterscan( comodin_name ); + PrintWholeScreen_Files(); + PrintSelectRow( 1 ); + } + break; + default: + if ( strcmp(Archivo, S_File[FileRow+FileCurrTopRow].files) == 0 ) + { + if ( Cargar_Salvar == 0 ) { + if ( access(Archivo, 0) != 0) break; + sprintf( comodin_name, "%c:\\", getdisk() + 'A' ); + getcurdir(0,comodin_name+3); + strcat(comodin_name, "\\"); + strcat(comodin_name, Archivo); + inst = 1; + ok = 1; + } + } + strcpy(Archivo, S_File[FileRow+FileCurrTopRow].files); + PrintVisor(); + break; + } + + break; + default: + strcpy( Archivo, "\0" ); + ungetch(key); + InputCadenaG(Archivo, 0, 12, 0, /*cfgFREC.F_Texto*/1, 252, 171, 373, 178); + if (Cargar_Salvar == 0) + { + // Comprobamos que existe el fichero + if ( access(Archivo, 0) != 0) + strcpy( Archivo, "\0" ); + } + PrintVisor(); + break; + } + break; + case -1: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + // Boton Aceptar + case 2: + if ( Cargar_Salvar == 0 ) { + if ( access(Archivo, 0) != 0) break; + sprintf( comodin_name, "%c:\\", getdisk() + 'A' ); + getcurdir(0,comodin_name+3); + strcat(comodin_name, "\\"); + strcat(comodin_name, Archivo); + inst = 1; + ok = 1; + } else { + if ( access(Archivo, 0) == 0) + if ( Optar( 1, "ATENCION !!!", "El fichero ya existe", "¨ Desea reemplazarlo ?", NULL ) != 1 ) break; + sprintf( comodin_name, "%c:\\", getdisk() + 'A' ); + getcurdir(0,comodin_name+3); + strcat(comodin_name, "\\"); + strcat(comodin_name, Archivo); + inst = 1; + ok = 1; + } + break; + // Boton Cancelar + case 1: + inst = 0; + ok = 1; + break; + // Boton Subir + case 3: + FileUpRow(); + break; + // Boton Bajar + case 4: + FileDownRow(); + break; + default: + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + break; + } + +} + +putimage( 240, 140, C_Texto, COPY_PUT); + +farfree ( C_Texto ); +farfree ( S_File ); + +settextstyle(textinfo.font, textinfo.direction, textinfo.charsize ); +settextjustify(textinfo.horiz, textinfo.vert); + + setdisk(olddrive); + chdir(oldpath); + + +stopceh(); + +return inst; + +} + + + +unsigned int rasterscan(char *fm) { + struct ffblk ffblk; + char done=0; + unsigned int olddisk; + maxfiles = 0; + +// build a disk drive availiable list + olddisk=getdisk(); + for (int i=1;i<27;i++) if (_chdrive(i) == 0) + { + sprintf( S_File[maxfiles].files, "%c:", (char)('A' + i - 1) ); + S_File[maxfiles].filesize=0; + S_File[maxfiles].attrs=255; // Unidad + if (ffblk.ff_attrib & 16) S_File[maxfiles].filesize=0; + maxfiles++; + + } + setdisk(olddisk); + +// drivelist[2]='N'; //stop access to B drive until I sort out pahntom dive probs +//Ok, Drive B may be a phantom drive. If you try to access drive B, then +//the program looses controll. Bummer! +// needs debugging. (always ignores drive b...) +// asm int 0x11 +// asm mov equipmentlist,ax +// drivelist[2]='N'; +// if ((equipmentlist & 16)) drivelist[2]='Y'; + + + done = findfirst("*.*",&ffblk,FA_DIREC); + while (!done) { + if (ffblk.ff_attrib == 0x10) { + strcpy(S_File[maxfiles].files,ffblk.ff_name); + S_File[maxfiles].filesize=ffblk.ff_fsize; + S_File[maxfiles].attrs=ffblk.ff_attrib; + if (ffblk.ff_attrib & 16) S_File[maxfiles].filesize=0; + maxfiles++; + } + done = findnext(&ffblk); + if (maxfiles==100) done=!done; //stop to prevent internal crashes. + } + + done = findfirst(fm,&ffblk,FA_DIREC); + while (!done) { + if (ffblk.ff_attrib != 0x10) { + strcpy(S_File[maxfiles].files,ffblk.ff_name); + S_File[maxfiles].filesize=ffblk.ff_fsize; + S_File[maxfiles].attrs=ffblk.ff_attrib; + if (ffblk.ff_attrib & 16) S_File[maxfiles].filesize=0; + maxfiles++; + } + done = findnext(&ffblk); + if (maxfiles==100) done=!done; //stop to prevent internal crashes. + } + if (maxfiles==0) { //no files to browse + strcpy(S_File[0].files," -- NONE -- "); + S_File[0].filesize=-1; + maxfiles=1;} + strcpy(S_File[100].files," -- NONE -- "); + S_File[100].filesize=-1; + return maxfiles; +} + + + +void PrintWholeScreen_Files(void ) +{ + + int OldFileRow = FileRow ; + char Contador; + + setfillstyle( SOLID_FILL, 0 ); + bar(252, 187, 374, 327); + + PrintSelectRow ( 0 ); + for ( FileRow = 0; FileRow < 14; FileRow++ ) + if ( ( FileRow + FileCurrTopRow ) < maxfiles ) + PrintSelectRow ( 0 ); + + + FileRow = OldFileRow; + + +} + +void PrintSelectRow( char Hide_Show ) +{ + + char Buffer[80]; + char Buff1[80]; + char Buff2[80]; + + if ( Hide_Show==0 ) + { + setfillstyle( SOLID_FILL, 0 ); + bar(252, 188 + ( FileRow * 10 ) , 373, 187 + 10 + ( FileRow * 10 ) ); + setcolor( /*cfgFREC.Texto*/EGA_RED ); + } else { + setfillstyle( SOLID_FILL, /*cfgFREC.F_Texto*/EGA_YELLOW ); + bar(252, 188 + ( FileRow * 10 ) , 373, 187 + 10 + ( FileRow * 10 ) ); + setcolor(0); + } + +switch( S_File[FileRow + FileCurrTopRow].attrs ) +{ + case FA_DIREC: + sprintf(Buffer, "%-13s", S_File[FileRow+FileCurrTopRow].files ); + sprintf(Buff1 , " < DIR >" ); + break; + case 255: + sprintf(Buffer, "%-8s", strncpy( Buff1, S_File[FileRow+FileCurrTopRow].files, 8) ); + sprintf(Buff1 , " >DRIVER<" ); + break; + default: + + sprintf(Buffer, "%-13s", S_File[FileRow+FileCurrTopRow].files); +// outtextxy( 252 , 187 + ( FileRow * 10 ) , Buffer ); + sprintf(Buff1 , " %7lu", S_File[FileRow+FileCurrTopRow].filesize ); + break; +} + + outtextxy( 252 , 187 + ( FileRow * 10 ) , Buffer ); + outtextxy( 252 , 187 + ( FileRow * 10 ) , Buff1 ); + +} + +void FileDownRow(void) +{ + + // ¨¨ Estoy en la linea fisica 000 ??? + if ( (FileRow + FileCurrTopRow) != (maxfiles - 1) ) { + + // Linea 0, Baja Con retroceso multiple + if ( FileRow == 13 ) { + FileCurrTopRow += 14; + while ( (FileCurrTopRow + FileRow) > maxfiles ) FileCurrTopRow--; + FileRow = 0; + PrintWholeScreen_Files(); + PrintSelectRow( 1 ); + } else { + PrintSelectRow( 0 ); + FileRow++; + PrintSelectRow( 1 ); + } + + } +} + +void FileUpRow(void) +{ + + // ¨¨ Estoy en la linea fisica 000 ??? + if ( (FileRow + FileCurrTopRow) != 0 ) { + + // Linea 0, Baja Con retroceso multiple + if ( FileRow == 0 ) { + FileCurrTopRow -= 14; + if ( FileCurrTopRow < 0 ) FileCurrTopRow = 0; + FileRow = 0; + PrintWholeScreen_Files(); + FileRow = 13; + PrintSelectRow( 1 ); + } else { + PrintSelectRow( 0 ); + FileRow--; + PrintSelectRow( 1 ); + } + + } +} + + + +/* +void diskerror(void) { +char message[30]; + pushscreen(); + draw3dboxup(19,10,43,6); + draw3dboxdn(21,11,39,4); + switch (erroroccurred) { + case 1 : strcpy(message,"Write Protected Disk"); break; + case 2 : strcpy(message,"Drive Not Ready"); break; + case 3 : strcpy(message,"Unknown Command"); break; + case 4 : strcpy(message,"Data Error (CRC)"); break; + case 5 : strcpy(message,"Bad Request Structure Length"); break; + case 6 : strcpy(message,"Seek Error"); break; + case 7 : strcpy(message,"Unknown Media Type"); break; + case 8 : strcpy(message,"Sector Not Found"); break; + case 9 : strcpy(message,"Printer Out Of Paper"); break; + case 10: strcpy(message,"Write Fault"); break; + case 11: strcpy(message,"Read Fault"); break; + case 12: strcpy(message,"General Failure"); break; + default: strcpy(message,"Unknown Error"); + } + + printcentered(12,"Error - Press any key to continue",0x74); + printcentered(13,message,0x70); + getch(); + popscreen(); + erroroccurred=0; +} +*/ + +void interrupt critical_error_handler(.../*__CPPARGS*/) { + asm push ax //preserve only modified register + asm mov ax,di //di holds error code ranging from 0 to 0x0c +// asm inc ax + asm mov erroroccurred,ax //increase erroroccurred for ease of programming + asm mov al,0x20 + asm out 0x20,al //send interrupt clear flag +// asm pushf // I think I dont need this line in.... + asm pop ax //restore ax +} + +void startceh() { + old_int24 = _dos_getvect( 0x24 ); + _dos_setvect( 0x24, critical_error_handler); + } + +void stopceh() { + _dos_setvect(0x24,old_int24); + } + +void PrintVisor(void) +{ + + setfillstyle( SOLID_FILL, 0 ); + bar(252, 171, 373, 178); + setcolor( /*cfgFREC.Texto*/1 ); + outtextxy(252, 169, strupr(Archivo) ); + +} + + + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// +int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, int left, int up, int right, int down) +{ + + int ls; // longitud cadena + char *s1; // puntero a cadena inicial + int c, ok = 0; + + s1 = s; // inicio cadena + ls = strlen ( s ); // Longitud de actual + s += ls; // se coloca en el final + + setfillstyle(SOLID_FILL, cf); + do{ + bar(left, up, right, down); + setcolor(cc); + outtextxy( left, up-2, s1 ); + if ( ls < lmax ) { + setcolor(4); + outtextxy( left+textwidth( s1 ), up-2, "<"); + } + + + switch( c = getch() ) // obtiene tecla + { + case 0: + case 13: + ok = 1; // 13 = INTRO || Especiales + break; + case 8: + if ( ls > 0 ) { // 8 = Back Space + ls--; + s--; + *s = '\0'; + } + break; + case 27: + *s='\0'; + ok = 1; + break; + default: + if ( !numalp && c >= 32 && c <= 254 && ls < lmax) + { + *s++ = toupper(c); + ls++; + *s = '\0'; + } else + if ( numalp && isdigit(c) && ls < lmax) { + *s++ = c; + ls++; + *s = '\0'; + } + break; + } + + }while(!ok); + + ok = 1; + *s = ' '; + while( ok ) { + if(*s==' ') { *s = '\0'; s--; + } else { s++; ok = 0; } + } + + *s = '\0'; + + while(kbhit()) getch(); // Vacia Buffer impidiendo falsas + // pulsaciones... + + return ls; +} + + + + + + + + + + +/************************************/ +/************************************//************************************/ +/************************************//************************************/ +/************************************//************************************/ +/************************************/ +#define SEC_OPTAR 3 +#define ENCUADRE 3 +int Optar( int optar, ... ) +{ + static void far *fondo, far *fd_aceptar, far *fd_cancelar; + static char Memoria = 0; + + int DEV = 0, ok = 0, linea = 0; + int Center; char *buff; + struct textsettingstype texttypeinfo; + + va_list ap; + va_start( ap, &optar ); + + if ( Memoria == 1 ) + { + putimage( 170, 165, fondo , COPY_PUT ); + putimage( 170, 320, fd_aceptar , COPY_PUT ); + putimage( 370, 320, fd_cancelar, COPY_PUT ); + + farfree( fondo ); + farfree( fd_aceptar ); + farfree( fd_cancelar ); + + Memoria = 0; + + if ( optar == ENCUADRE ) return DEV; + } + + if ( ( fondo = farmalloc( JD_imagesize( 170, 165, 470, 315 ) ) ) != NULL && + ( fd_aceptar = farmalloc( JD_imagesize( 170, 320, 270, 350 ) ) ) != NULL && + ( fd_cancelar = farmalloc( JD_imagesize( 370, 320, 470, 350 ) ) ) != NULL ) + { + Memoria = 1; + + getimage( 170, 165, 470, 315, fondo ); + getimage( 170, 320, 270, 350, fd_aceptar ); + getimage( 370, 320, 470, 350, fd_cancelar); + + gettextsettings( &texttypeinfo ); + + Imprime_Estaticos( 100, "llave.img" ); + + settextstyle( SMALL_FONT, HORIZ_DIR, 6 ); + + setcolor( 63 ); + + while ( (buff = va_arg(ap, char *)) != NULL ) + { + Center = (296 - textwidth( buff ) ) / 2; + outtextxy( 172+Center, ( (linea == 0 ) ? 167 : 200 + 20*linea ), buff ); + linea++; + } + + va_end(ap); + + settextstyle( texttypeinfo.font, texttypeinfo.direction, texttypeinfo.charsize ); + + + if ( optar != ENCUADRE ) + { + ok = 0; while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + do { + switch( Comprueba_Secuencia( SEC_OPTAR, NULL ) ) + { + case 0: // No se pulso ningun BOTON + case -2: + case -1: + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + if ( optar == 0 ) ok = 1; + break; + case 1: + DEV = 1; ok = 1; + break; + case 2: + DEV = 0; ok = 1; + break; + } + }while( !ok ); + + putimage( 170, 165, fondo , COPY_PUT ); + putimage( 170, 320, fd_aceptar , COPY_PUT ); + putimage( 370, 320, fd_cancelar, COPY_PUT ); + + farfree( fondo ); + farfree( fd_aceptar ); + farfree( fd_cancelar ); + + Memoria = 0; + + } + + + } else { + farfree( fondo ); + farfree( fd_aceptar ); + farfree( fd_cancelar ); + } + + + return DEV; +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..5200c52 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +#LLAVE + + +*10/06/1992* + +ToDo: wwtcf? + + +![screenshot](/LLAVE.png "Screenshot") diff --git a/TEST1.LLV b/TEST1.LLV new file mode 100644 index 0000000..647bc40 Binary files /dev/null and b/TEST1.LLV differ