commit 040749ecc1efa2b795be6c858085f23642473df4 Author: jdg Date: Wed Sep 8 21:32:30 2021 +0200 First commit 05/11/1995 diff --git a/BOT.CPP b/BOT.CPP new file mode 100644 index 0000000..569a2b6 --- /dev/null +++ b/BOT.CPP @@ -0,0 +1,861 @@ +/***************************************************************/ +/* */ +/* Conversin de fuentes de MAKE BOTON en ASCII a fuentes */ +/* para CPP, que pueden ser compilados junto al programa. */ +/* */ +/***************************************************************/ +/* */ +/* MAKE BOTON es un programa realizado por Jos David Guilln */ +/* MB a CPP es una utilidad complementaria a Make Boton por */ +/* Jos David Guilln... */ +/* */ +/***************************************************************/ +/* */ +/* GRACIAS POR UTILIZAR MI SOFTWARE... */ +/* */ +/* JOS DAVID GUILLN (c) 1995 */ +/* */ +/***************************************************************/ + + + +// Debe indicar el directorio exacto de la Cabecera de MAKE BOTON +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON +#include "stdlib.h" +#include "conio.h" +#include "alloc.h" +#include "graphics.h" + + + +extern int /*vez,*/ memoria_asignada, Secuencias, *n_Botones_Secuencia; + struct Make_Boton { int Up, Left, Down, Right; unsigned char Cdf, Cb1, Cb2; unsigned char Ab, Pb; unsigned Isc, Sc; }; +extern struct Make_Boton far *Botones; +struct Make_Boton Bot_Static; + + + +extern void Libera_Memoria(void);extern void Imprime_Boton(int D_Bord, struct Make_Boton Bot_Imp); + + +// Esta funcin debe ser llamada para la inicializacion de los +// botones en lugar de CARGA_BOTONES(...). +// Para cargar los botones con parametro 0 y para imprimir +// imprimir los estaticos con parametro [ n de secuencia ] +int Fichero_bot(char Dinamicos_Estaticos); + +int Fichero_bot(char Dinamicos_Estaticos) { + +static char vez = 0; + + switch(Dinamicos_Estaticos) { + + case 0: + if( vez == 0 ) { + vez = 1; + atexit( Libera_Memoria ); + } + if ( memoria_asignada == 1 ) { + free(n_Botones_Secuencia); + farfree(Botones); + memoria_asignada = 0; + } + int SiZe_BoToN = 0; + if ( (Botones = (struct Make_Boton far *)farcalloc(1, sizeof( struct Make_Boton ) )) == NULL) + return SIN_MEMORIA; + memoria_asignada = 1; + + Secuencias = 5; + if (( n_Botones_Secuencia = (int *) malloc( sizeof(int)*Secuencias ) ) == NULL) { + cprintf("\nNo Hay suficiente Memoria, ni para un Boton\n\n"); + return SIN_MEMORIA; + } + n_Botones_Secuencia[1 - 1] = 91; + SiZe_BoToN += ( sizeof( struct Make_Boton ) * 91); + if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) { + Secuencias = 1; + return SIN_MEMORIA; + } + memoria_asignada = 1; + Botones [0].Left = 565; Botones [0].Up = 0;Botones [0]. Right = 640;Botones [0]. Down = 26; + Botones [0]. Cdf = 7; Botones [0]. Cb1 = 56; Botones [0]. Cb2 = 63; Botones [0]. Ab = 2; Botones [0]. Pb = 1; Botones [0]. Isc = 0; Botones [0]. Sc = 30; + Botones [1].Left = 20; Botones [1].Up = 34;Botones [1]. Right = 45;Botones [1]. Down = 59; + Botones [1]. Cdf = 7; Botones [1]. Cb1 = 56; Botones [1]. Cb2 = 63; Botones [1]. Ab = 2; Botones [1]. Pb = 1; Botones [1]. Isc = 0; Botones [1]. Sc = 0; + Botones [2].Left = 47; Botones [2].Up = 34;Botones [2]. Right = 72;Botones [2]. Down = 59; + Botones [2]. Cdf = 7; Botones [2]. Cb1 = 56; Botones [2]. Cb2 = 63; Botones [2]. Ab = 2; Botones [2]. Pb = 1; Botones [2]. Isc = 0; Botones [2]. Sc = 0; + Botones [3].Left = 74; Botones [3].Up = 34;Botones [3]. Right = 99;Botones [3]. Down = 59; + Botones [3]. Cdf = 7; Botones [3]. Cb1 = 56; Botones [3]. Cb2 = 63; Botones [3]. Ab = 2; Botones [3]. Pb = 1; Botones [3]. Isc = 0; Botones [3]. Sc = 0; + Botones [4].Left = 101; Botones [4].Up = 34;Botones [4]. Right = 126;Botones [4]. Down = 59; + Botones [4]. Cdf = 7; Botones [4]. Cb1 = 56; Botones [4]. Cb2 = 63; Botones [4]. Ab = 2; Botones [4]. Pb = 1; Botones [4]. Isc = 0; Botones [4]. Sc = 0; + Botones [5].Left = 128; Botones [5].Up = 34;Botones [5]. Right = 153;Botones [5]. Down = 59; + Botones [5]. Cdf = 7; Botones [5]. Cb1 = 56; Botones [5]. Cb2 = 63; Botones [5]. Ab = 2; Botones [5]. Pb = 1; Botones [5]. Isc = 0; Botones [5]. Sc = 0; + Botones [6].Left = 155; Botones [6].Up = 34;Botones [6]. Right = 180;Botones [6]. Down = 59; + Botones [6]. Cdf = 7; Botones [6]. Cb1 = 56; Botones [6]. Cb2 = 63; Botones [6]. Ab = 2; Botones [6]. Pb = 1; Botones [6]. Isc = 0; Botones [6]. Sc = 0; + Botones [7].Left = 182; Botones [7].Up = 34;Botones [7]. Right = 207;Botones [7]. Down = 59; + Botones [7]. Cdf = 7; Botones [7]. Cb1 = 56; Botones [7]. Cb2 = 63; Botones [7]. Ab = 2; Botones [7]. Pb = 1; Botones [7]. Isc = 0; Botones [7]. Sc = 0; + Botones [8].Left = 209; Botones [8].Up = 34;Botones [8]. Right = 234;Botones [8]. Down = 59; + Botones [8]. Cdf = 7; Botones [8]. Cb1 = 56; Botones [8]. Cb2 = 63; Botones [8]. Ab = 2; Botones [8]. Pb = 1; Botones [8]. Isc = 0; Botones [8]. Sc = 0; + Botones [9].Left = 20; Botones [9].Up = 61;Botones [9]. Right = 45;Botones [9]. Down = 86; + Botones [9]. Cdf = 7; Botones [9]. Cb1 = 56; Botones [9]. Cb2 = 63; Botones [9]. Ab = 2; Botones [9]. Pb = 1; Botones [9]. Isc = 0; Botones [9]. Sc = 0; + Botones [10].Left = 47; Botones [10].Up = 61;Botones [10]. Right = 72;Botones [10]. Down = 86; + Botones [10]. Cdf = 7; Botones [10]. Cb1 = 56; Botones [10]. Cb2 = 63; Botones [10]. Ab = 2; Botones [10]. Pb = 1; Botones [10]. Isc = 0; Botones [10]. Sc = 0; + Botones [11].Left = 74; Botones [11].Up = 61;Botones [11]. Right = 99;Botones [11]. Down = 86; + Botones [11]. Cdf = 7; Botones [11]. Cb1 = 56; Botones [11]. Cb2 = 63; Botones [11]. Ab = 2; Botones [11]. Pb = 1; Botones [11]. Isc = 0; Botones [11]. Sc = 0; + Botones [12].Left = 101; Botones [12].Up = 61;Botones [12]. Right = 126;Botones [12]. Down = 86; + Botones [12]. Cdf = 7; Botones [12]. Cb1 = 56; Botones [12]. Cb2 = 63; Botones [12]. Ab = 2; Botones [12]. Pb = 1; Botones [12]. Isc = 0; Botones [12]. Sc = 0; + Botones [13].Left = 128; Botones [13].Up = 61;Botones [13]. Right = 153;Botones [13]. Down = 86; + Botones [13]. Cdf = 7; Botones [13]. Cb1 = 56; Botones [13]. Cb2 = 63; Botones [13]. Ab = 2; Botones [13]. Pb = 1; Botones [13]. Isc = 0; Botones [13]. Sc = 0; + Botones [14].Left = 155; Botones [14].Up = 61;Botones [14]. Right = 180;Botones [14]. Down = 86; + Botones [14]. Cdf = 7; Botones [14]. Cb1 = 56; Botones [14]. Cb2 = 63; Botones [14]. Ab = 2; Botones [14]. Pb = 1; Botones [14]. Isc = 0; Botones [14]. Sc = 0; + Botones [15].Left = 182; Botones [15].Up = 61;Botones [15]. Right = 207;Botones [15]. Down = 86; + Botones [15]. Cdf = 7; Botones [15]. Cb1 = 56; Botones [15]. Cb2 = 63; Botones [15]. Ab = 2; Botones [15]. Pb = 1; Botones [15]. Isc = 0; Botones [15]. Sc = 0; + Botones [16].Left = 209; Botones [16].Up = 61;Botones [16]. Right = 234;Botones [16]. Down = 86; + Botones [16]. Cdf = 7; Botones [16]. Cb1 = 56; Botones [16]. Cb2 = 63; Botones [16]. Ab = 2; Botones [16]. Pb = 1; Botones [16]. Isc = 0; Botones [16]. Sc = 0; + Botones [17].Left = 236; Botones [17].Up = 34;Botones [17]. Right = 261;Botones [17]. Down = 59; + Botones [17]. Cdf = 3; Botones [17]. Cb1 = 56; Botones [17]. Cb2 = 63; Botones [17]. Ab = 3; Botones [17]. Pb = 1; Botones [17]. Isc = 0; Botones [17]. Sc = 0; + Botones [18].Left = 263; Botones [18].Up = 34;Botones [18]. Right = 288;Botones [18]. Down = 59; + Botones [18]. Cdf = 3; Botones [18]. Cb1 = 56; Botones [18]. Cb2 = 63; Botones [18]. Ab = 3; Botones [18]. Pb = 1; Botones [18]. Isc = 0; Botones [18]. Sc = 0; + Botones [19].Left = 290; Botones [19].Up = 34;Botones [19]. Right = 315;Botones [19]. Down = 59; + Botones [19]. Cdf = 3; Botones [19]. Cb1 = 56; Botones [19]. Cb2 = 63; Botones [19]. Ab = 3; Botones [19]. Pb = 1; Botones [19]. Isc = 0; Botones [19]. Sc = 0; + Botones [20].Left = 236; Botones [20].Up = 61;Botones [20]. Right = 261;Botones [20]. Down = 86; + Botones [20]. Cdf = 3; Botones [20]. Cb1 = 56; Botones [20]. Cb2 = 63; Botones [20]. Ab = 3; Botones [20]. Pb = 1; Botones [20]. Isc = 0; Botones [20]. Sc = 0; + Botones [21].Left = 263; Botones [21].Up = 61;Botones [21]. Right = 288;Botones [21]. Down = 86; + Botones [21]. Cdf = 3; Botones [21]. Cb1 = 56; Botones [21]. Cb2 = 63; Botones [21]. Ab = 3; Botones [21]. Pb = 1; Botones [21]. Isc = 0; Botones [21]. Sc = 0; + Botones [22].Left = 290; Botones [22].Up = 61;Botones [22]. Right = 315;Botones [22]. Down = 86; + Botones [22]. Cdf = 3; Botones [22]. Cb1 = 56; Botones [22]. Cb2 = 63; Botones [22]. Ab = 3; Botones [22]. Pb = 1; Botones [22]. Isc = 0; Botones [22]. Sc = 0; + Botones [23].Left = 341; Botones [23].Up = 34;Botones [23]. Right = 366;Botones [23]. Down = 59; + Botones [23]. Cdf = 7; Botones [23]. Cb1 = 56; Botones [23]. Cb2 = 63; Botones [23]. Ab = 2; Botones [23]. Pb = 1; Botones [23]. Isc = 0; Botones [23]. Sc = 0; + Botones [24].Left = 368; Botones [24].Up = 34;Botones [24]. Right = 393;Botones [24]. Down = 59; + Botones [24]. Cdf = 7; Botones [24]. Cb1 = 56; Botones [24]. Cb2 = 63; Botones [24]. Ab = 2; Botones [24]. Pb = 1; Botones [24]. Isc = 0; Botones [24]. Sc = 0; + Botones [25].Left = 395; Botones [25].Up = 34;Botones [25]. Right = 420;Botones [25]. Down = 59; + Botones [25]. Cdf = 7; Botones [25]. Cb1 = 56; Botones [25]. Cb2 = 63; Botones [25]. Ab = 2; Botones [25]. Pb = 1; Botones [25]. Isc = 0; Botones [25]. Sc = 0; + Botones [26].Left = 422; Botones [26].Up = 34;Botones [26]. Right = 447;Botones [26]. Down = 59; + Botones [26]. Cdf = 7; Botones [26]. Cb1 = 56; Botones [26]. Cb2 = 63; Botones [26]. Ab = 2; Botones [26]. Pb = 1; Botones [26]. Isc = 0; Botones [26]. Sc = 0; + Botones [27].Left = 449; Botones [27].Up = 34;Botones [27]. Right = 474;Botones [27]. Down = 59; + Botones [27]. Cdf = 7; Botones [27]. Cb1 = 56; Botones [27]. Cb2 = 63; Botones [27]. Ab = 2; Botones [27]. Pb = 1; Botones [27]. Isc = 0; Botones [27]. Sc = 0; + Botones [28].Left = 476; Botones [28].Up = 34;Botones [28]. Right = 499;Botones [28]. Down = 59; + Botones [28]. Cdf = 7; Botones [28]. Cb1 = 56; Botones [28]. Cb2 = 63; Botones [28]. Ab = 2; Botones [28]. Pb = 1; Botones [28]. Isc = 0; Botones [28]. Sc = 0; + Botones [29].Left = 501; Botones [29].Up = 34;Botones [29]. Right = 526;Botones [29]. Down = 59; + Botones [29]. Cdf = 7; Botones [29]. Cb1 = 56; Botones [29]. Cb2 = 63; Botones [29]. Ab = 2; Botones [29]. Pb = 1; Botones [29]. Isc = 0; Botones [29]. Sc = 0; + Botones [30].Left = 528; Botones [30].Up = 34;Botones [30]. Right = 553;Botones [30]. Down = 59; + Botones [30]. Cdf = 7; Botones [30]. Cb1 = 56; Botones [30]. Cb2 = 63; Botones [30]. Ab = 2; Botones [30]. Pb = 1; Botones [30]. Isc = 0; Botones [30]. Sc = 0; + Botones [31].Left = 341; Botones [31].Up = 61;Botones [31]. Right = 366;Botones [31]. Down = 86; + Botones [31]. Cdf = 7; Botones [31]. Cb1 = 56; Botones [31]. Cb2 = 63; Botones [31]. Ab = 2; Botones [31]. Pb = 1; Botones [31]. Isc = 0; Botones [31]. Sc = 0; + Botones [32].Left = 368; Botones [32].Up = 61;Botones [32]. Right = 393;Botones [32]. Down = 86; + Botones [32]. Cdf = 7; Botones [32]. Cb1 = 56; Botones [32]. Cb2 = 63; Botones [32]. Ab = 2; Botones [32]. Pb = 1; Botones [32]. Isc = 0; Botones [32]. Sc = 0; + Botones [33].Left = 395; Botones [33].Up = 61;Botones [33]. Right = 420;Botones [33]. Down = 86; + Botones [33]. Cdf = 7; Botones [33]. Cb1 = 56; Botones [33]. Cb2 = 63; Botones [33]. Ab = 2; Botones [33]. Pb = 1; Botones [33]. Isc = 0; Botones [33]. Sc = 0; + Botones [34].Left = 422; Botones [34].Up = 61;Botones [34]. Right = 447;Botones [34]. Down = 86; + Botones [34]. Cdf = 7; Botones [34]. Cb1 = 56; Botones [34]. Cb2 = 63; Botones [34]. Ab = 2; Botones [34]. Pb = 1; Botones [34]. Isc = 0; Botones [34]. Sc = 0; + Botones [35].Left = 449; Botones [35].Up = 61;Botones [35]. Right = 474;Botones [35]. Down = 86; + Botones [35]. Cdf = 7; Botones [35]. Cb1 = 56; Botones [35]. Cb2 = 63; Botones [35]. Ab = 2; Botones [35]. Pb = 1; Botones [35]. Isc = 0; Botones [35]. Sc = 0; + Botones [36].Left = 476; Botones [36].Up = 61;Botones [36]. Right = 499;Botones [36]. Down = 86; + Botones [36]. Cdf = 7; Botones [36]. Cb1 = 56; Botones [36]. Cb2 = 63; Botones [36]. Ab = 2; Botones [36]. Pb = 1; Botones [36]. Isc = 0; Botones [36]. Sc = 0; + Botones [37].Left = 501; Botones [37].Up = 61;Botones [37]. Right = 526;Botones [37]. Down = 86; + Botones [37]. Cdf = 7; Botones [37]. Cb1 = 56; Botones [37]. Cb2 = 63; Botones [37]. Ab = 2; Botones [37]. Pb = 1; Botones [37]. Isc = 0; Botones [37]. Sc = 0; + Botones [38].Left = 528; Botones [38].Up = 61;Botones [38]. Right = 553;Botones [38]. Down = 86; + Botones [38]. Cdf = 7; Botones [38]. Cb1 = 56; Botones [38]. Cb2 = 63; Botones [38]. Ab = 2; Botones [38]. Pb = 1; Botones [38]. Isc = 0; Botones [38]. Sc = 0; + Botones [39].Left = 555; Botones [39].Up = 34;Botones [39]. Right = 580;Botones [39]. Down = 59; + Botones [39]. Cdf = 3; Botones [39]. Cb1 = 56; Botones [39]. Cb2 = 63; Botones [39]. Ab = 3; Botones [39]. Pb = 1; Botones [39]. Isc = 0; Botones [39]. Sc = 0; + Botones [40].Left = 582; Botones [40].Up = 34;Botones [40]. Right = 607;Botones [40]. Down = 59; + Botones [40]. Cdf = 3; Botones [40]. Cb1 = 56; Botones [40]. Cb2 = 63; Botones [40]. Ab = 3; Botones [40]. Pb = 1; Botones [40]. Isc = 0; Botones [40]. Sc = 0; + Botones [41].Left = 609; Botones [41].Up = 34;Botones [41]. Right = 634;Botones [41]. Down = 59; + Botones [41]. Cdf = 3; Botones [41]. Cb1 = 56; Botones [41]. Cb2 = 63; Botones [41]. Ab = 3; Botones [41]. Pb = 1; Botones [41]. Isc = 0; Botones [41]. Sc = 0; + Botones [42].Left = 555; Botones [42].Up = 61;Botones [42]. Right = 580;Botones [42]. Down = 86; + Botones [42]. Cdf = 3; Botones [42]. Cb1 = 56; Botones [42]. Cb2 = 63; Botones [42]. Ab = 3; Botones [42]. Pb = 1; Botones [42]. Isc = 0; Botones [42]. Sc = 0; + Botones [43].Left = 582; Botones [43].Up = 61;Botones [43]. Right = 607;Botones [43]. Down = 86; + Botones [43]. Cdf = 3; Botones [43]. Cb1 = 56; Botones [43]. Cb2 = 63; Botones [43]. Ab = 3; Botones [43]. Pb = 1; Botones [43]. Isc = 0; Botones [43]. Sc = 0; + Botones [44].Left = 609; Botones [44].Up = 61;Botones [44]. Right = 634;Botones [44]. Down = 86; + Botones [44]. Cdf = 3; Botones [44]. Cb1 = 56; Botones [44]. Cb2 = 63; Botones [44]. Ab = 3; Botones [44]. Pb = 1; Botones [44]. Isc = 0; Botones [44]. Sc = 0; + Botones [45].Left = 582; Botones [45].Up = 364;Botones [45]. Right = 634;Botones [45]. Down = 388; + Botones [45]. Cdf = 7; Botones [45]. Cb1 = 56; Botones [45]. Cb2 = 63; Botones [45]. Ab = 2; Botones [45]. Pb = 1; Botones [45]. Isc = 0; Botones [45]. Sc = 19; + Botones [46].Left = 582; Botones [46].Up = 390;Botones [46]. Right = 607;Botones [46]. Down = 451; + Botones [46]. Cdf = 7; Botones [46]. Cb1 = 56; Botones [46]. Cb2 = 63; Botones [46]. Ab = 2; Botones [46]. Pb = 1; Botones [46]. Isc = 0; Botones [46]. Sc = 38; + Botones [47].Left = 609; Botones [47].Up = 390;Botones [47]. Right = 634;Botones [47]. Down = 451; + Botones [47]. Cdf = 7; Botones [47]. Cb1 = 56; Botones [47]. Cb2 = 63; Botones [47]. Ab = 2; Botones [47]. Pb = 1; Botones [47]. Isc = 0; Botones [47]. Sc = 34; + Botones [48].Left = 582; Botones [48].Up = 453;Botones [48]. Right = 634;Botones [48]. Down = 478; + Botones [48]. Cdf = 7; Botones [48]. Cb1 = 56; Botones [48]. Cb2 = 63; Botones [48]. Ab = 2; Botones [48]. Pb = 1; Botones [48]. Isc = 0; Botones [48]. Sc = 31; + Botones [49].Left = 555; Botones [49].Up = 364;Botones [49]. Right = 580;Botones [49]. Down = 478; + Botones [49]. Cdf = 7; Botones [49]. Cb1 = 56; Botones [49]. Cb2 = 63; Botones [49]. Ab = 2; Botones [49]. Pb = 1; Botones [49]. Isc = 0; Botones [49]. Sc = 46; + Botones [50].Left = 538; Botones [50].Up = 103;Botones [50]. Right = 632;Botones [50]. Down = 127; + Botones [50]. Cdf = 9; Botones [50]. Cb1 = 56; Botones [50]. Cb2 = 63; Botones [50]. Ab = 2; Botones [50]. Pb = 1; Botones [50]. Isc = 0; Botones [50]. Sc = 22; + Botones [51].Left = 500; Botones [51].Up = 100;Botones [51]. Right = 530;Botones [51]. Down = 130; + Botones [51]. Cdf = 7; Botones [51]. Cb1 = 56; Botones [51]. Cb2 = 63; Botones [51]. Ab = 2; Botones [51]. Pb = 1; Botones [51]. Isc = 78; Botones [51]. Sc = 0; + Botones [52].Left = 465; Botones [52].Up = 100;Botones [52]. Right = 495;Botones [52]. Down = 130; + Botones [52]. Cdf = 7; Botones [52]. Cb1 = 56; Botones [52]. Cb2 = 63; Botones [52]. Ab = 2; Botones [52]. Pb = 1; Botones [52]. Isc = 83; Botones [52]. Sc = 0; + Botones [53].Left = 430; Botones [53].Up = 100;Botones [53]. Right = 460;Botones [53]. Down = 130; + Botones [53]. Cdf = 7; Botones [53]. Cb1 = 56; Botones [53]. Cb2 = 63; Botones [53]. Ab = 2; Botones [53]. Pb = 1; Botones [53]. Isc = 70; Botones [53]. Sc = 0; + Botones [54].Left = 605; Botones [54].Up = 135;Botones [54]. Right = 635;Botones [54]. Down = 165; + Botones [54]. Cdf = 7; Botones [54]. Cb1 = 56; Botones [54]. Cb2 = 63; Botones [54]. Ab = 2; Botones [54]. Pb = 1; Botones [54]. Isc = 72; Botones [54]. Sc = 0; + Botones [55].Left = 570; Botones [55].Up = 135;Botones [55]. Right = 600;Botones [55]. Down = 165; + Botones [55]. Cdf = 7; Botones [55]. Cb1 = 56; Botones [55]. Cb2 = 63; Botones [55]. Ab = 2; Botones [55]. Pb = 1; Botones [55]. Isc = 82; Botones [55]. Sc = 0; + Botones [56].Left = 535; Botones [56].Up = 135;Botones [56]. Right = 565;Botones [56]. Down = 165; + Botones [56]. Cdf = 7; Botones [56]. Cb1 = 56; Botones [56]. Cb2 = 63; Botones [56]. Ab = 2; Botones [56]. Pb = 1; Botones [56]. Isc = 84; Botones [56]. Sc = 0; + Botones [57].Left = 500; Botones [57].Up = 135;Botones [57]. Right = 530;Botones [57]. Down = 165; + Botones [57]. Cdf = 7; Botones [57]. Cb1 = 56; Botones [57]. Cb2 = 63; Botones [57]. Ab = 2; Botones [57]. Pb = 1; Botones [57]. Isc = 67; Botones [57]. Sc = 0; + Botones [58].Left = 465; Botones [58].Up = 135;Botones [58]. Right = 495;Botones [58]. Down = 165; + Botones [58]. Cdf = 7; Botones [58]. Cb1 = 56; Botones [58]. Cb2 = 63; Botones [58]. Ab = 2; Botones [58]. Pb = 1; Botones [58]. Isc = 79; Botones [58]. Sc = 0; + Botones [59].Left = 430; Botones [59].Up = 135;Botones [59]. Right = 460;Botones [59]. Down = 165; + Botones [59]. Cdf = 7; Botones [59]. Cb1 = 56; Botones [59]. Cb2 = 63; Botones [59]. Ab = 2; Botones [59]. Pb = 1; Botones [59]. Isc = 65; Botones [59]. Sc = 0; + Botones [60].Left = 605; Botones [60].Up = 170;Botones [60]. Right = 635;Botones [60]. Down = 200; + Botones [60]. Cdf = 7; Botones [60]. Cb1 = 56; Botones [60]. Cb2 = 63; Botones [60]. Ab = 2; Botones [60]. Pb = 1; Botones [60]. Isc = 0; Botones [60]. Sc = 24; + Botones [61].Left = 570; Botones [61].Up = 170;Botones [61]. Right = 600;Botones [61]. Down = 200; + Botones [61]. Cdf = 7; Botones [61]. Cb1 = 56; Botones [61]. Cb2 = 63; Botones [61]. Ab = 2; Botones [61]. Pb = 1; Botones [61]. Isc = 0; Botones [61]. Sc = 35; + Botones [62].Left = 535; Botones [62].Up = 170;Botones [62]. Right = 565;Botones [62]. Down = 200; + Botones [62]. Cdf = 7; Botones [62]. Cb1 = 56; Botones [62]. Cb2 = 63; Botones [62]. Ab = 2; Botones [62]. Pb = 1; Botones [62]. Isc = 68; Botones [62]. Sc = 0; + Botones [63].Left = 500; Botones [63].Up = 170;Botones [63]. Right = 530;Botones [63]. Down = 200; + Botones [63]. Cdf = 7; Botones [63]. Cb1 = 56; Botones [63]. Cb2 = 63; Botones [63]. Ab = 2; Botones [63]. Pb = 1; Botones [63]. Isc = 77; Botones [63]. Sc = 0; + Botones [64].Left = 465; Botones [64].Up = 170;Botones [64]. Right = 495;Botones [64]. Down = 200; + Botones [64]. Cdf = 7; Botones [64]. Cb1 = 56; Botones [64]. Cb2 = 63; Botones [64]. Ab = 2; Botones [64]. Pb = 1; Botones [64]. Isc = 85; Botones [64]. Sc = 0; + Botones [65].Left = 430; Botones [65].Up = 170;Botones [65]. Right = 460;Botones [65]. Down = 200; + Botones [65]. Cdf = 7; Botones [65]. Cb1 = 56; Botones [65]. Cb2 = 63; Botones [65]. Ab = 2; Botones [65]. Pb = 1; Botones [65]. Isc = 76; Botones [65]. Sc = 0; + Botones [66].Left = 605; Botones [66].Up = 205;Botones [66]. Right = 635;Botones [66]. Down = 235; + Botones [66]. Cdf = 14; Botones [66]. Cb1 = 56; Botones [66]. Cb2 = 63; Botones [66]. Ab = 2; Botones [66]. Pb = 1; Botones [66]. Isc = 0; Botones [66]. Sc = 0; + Botones [67].Left = 570; Botones [67].Up = 205;Botones [67]. Right = 600;Botones [67]. Down = 235; + Botones [67]. Cdf = 14; Botones [67]. Cb1 = 56; Botones [67]. Cb2 = 63; Botones [67]. Ab = 2; Botones [67]. Pb = 1; Botones [67]. Isc = 0; Botones [67]. Sc = 0; + Botones [68].Left = 535; Botones [68].Up = 205;Botones [68]. Right = 565;Botones [68]. Down = 235; + Botones [68]. Cdf = 14; Botones [68]. Cb1 = 56; Botones [68]. Cb2 = 63; Botones [68]. Ab = 2; Botones [68]. Pb = 1; Botones [68]. Isc = 0; Botones [68]. Sc = 0; + Botones [69].Left = 500; Botones [69].Up = 205;Botones [69]. Right = 530;Botones [69]. Down = 235; + Botones [69]. Cdf = 63; Botones [69]. Cb1 = 56; Botones [69]. Cb2 = 7; Botones [69]. Ab = 2; Botones [69]. Pb = 1; Botones [69]. Isc = 57; Botones [69]. Sc = 0; + Botones [70].Left = 465; Botones [70].Up = 205;Botones [70]. Right = 495;Botones [70]. Down = 235; + Botones [70]. Cdf = 63; Botones [70]. Cb1 = 56; Botones [70]. Cb2 = 7; Botones [70]. Ab = 2; Botones [70]. Pb = 1; Botones [70]. Isc = 56; Botones [70]. Sc = 0; + Botones [71].Left = 430; Botones [71].Up = 205;Botones [71]. Right = 460;Botones [71]. Down = 235; + Botones [71]. Cdf = 63; Botones [71]. Cb1 = 56; Botones [71]. Cb2 = 7; Botones [71]. Ab = 2; Botones [71]. Pb = 1; Botones [71]. Isc = 55; Botones [71]. Sc = 0; + Botones [72].Left = 605; Botones [72].Up = 240;Botones [72]. Right = 635;Botones [72]. Down = 270; + Botones [72]. Cdf = 14; Botones [72]. Cb1 = 56; Botones [72]. Cb2 = 63; Botones [72]. Ab = 2; Botones [72]. Pb = 1; Botones [72]. Isc = 0; Botones [72]. Sc = 0; + Botones [73].Left = 570; Botones [73].Up = 240;Botones [73]. Right = 600;Botones [73]. Down = 270; + Botones [73]. Cdf = 14; Botones [73]. Cb1 = 56; Botones [73]. Cb2 = 63; Botones [73]. Ab = 2; Botones [73]. Pb = 1; Botones [73]. Isc = 0; Botones [73]. Sc = 83; + Botones [74].Left = 535; Botones [74].Up = 240;Botones [74]. Right = 565;Botones [74]. Down = 270; + Botones [74]. Cdf = 14; Botones [74]. Cb1 = 56; Botones [74]. Cb2 = 63; Botones [74]. Ab = 2; Botones [74]. Pb = 1; Botones [74]. Isc = 0; Botones [74]. Sc = 0; + Botones [75].Left = 500; Botones [75].Up = 240;Botones [75]. Right = 530;Botones [75]. Down = 270; + Botones [75]. Cdf = 63; Botones [75]. Cb1 = 56; Botones [75]. Cb2 = 7; Botones [75]. Ab = 2; Botones [75]. Pb = 1; Botones [75]. Isc = 54; Botones [75]. Sc = 0; + Botones [76].Left = 465; Botones [76].Up = 240;Botones [76]. Right = 495;Botones [76]. Down = 270; + Botones [76]. Cdf = 63; Botones [76]. Cb1 = 56; Botones [76]. Cb2 = 7; Botones [76]. Ab = 2; Botones [76]. Pb = 1; Botones [76]. Isc = 53; Botones [76]. Sc = 0; + Botones [77].Left = 430; Botones [77].Up = 240;Botones [77]. Right = 460;Botones [77]. Down = 270; + Botones [77]. Cdf = 63; Botones [77]. Cb1 = 56; Botones [77]. Cb2 = 7; Botones [77]. Ab = 2; Botones [77]. Pb = 1; Botones [77]. Isc = 52; Botones [77]. Sc = 0; + Botones [78].Left = 605; Botones [78].Up = 275;Botones [78]. Right = 635;Botones [78]. Down = 305; + Botones [78]. Cdf = 14; Botones [78]. Cb1 = 56; Botones [78]. Cb2 = 63; Botones [78]. Ab = 2; Botones [78]. Pb = 1; Botones [78]. Isc = 0; Botones [78]. Sc = 72; + Botones [79].Left = 570; Botones [79].Up = 275;Botones [79]. Right = 600;Botones [79]. Down = 305; + Botones [79]. Cdf = 14; Botones [79]. Cb1 = 56; Botones [79]. Cb2 = 63; Botones [79]. Ab = 2; Botones [79]. Pb = 1; Botones [79]. Isc = 0; Botones [79]. Sc = 82; + Botones [80].Left = 535; Botones [80].Up = 275;Botones [80]. Right = 565;Botones [80]. Down = 305; + Botones [80]. Cdf = 14; Botones [80]. Cb1 = 56; Botones [80]. Cb2 = 63; Botones [80]. Ab = 2; Botones [80]. Pb = 1; Botones [80]. Isc = 0; Botones [80]. Sc = 0; + Botones [81].Left = 500; Botones [81].Up = 275;Botones [81]. Right = 530;Botones [81]. Down = 305; + Botones [81]. Cdf = 63; Botones [81]. Cb1 = 56; Botones [81]. Cb2 = 7; Botones [81]. Ab = 2; Botones [81]. Pb = 1; Botones [81]. Isc = 51; Botones [81]. Sc = 0; + Botones [82].Left = 465; Botones [82].Up = 275;Botones [82]. Right = 495;Botones [82]. Down = 305; + Botones [82]. Cdf = 63; Botones [82]. Cb1 = 56; Botones [82]. Cb2 = 7; Botones [82]. Ab = 2; Botones [82]. Pb = 1; Botones [82]. Isc = 50; Botones [82]. Sc = 0; + Botones [83].Left = 430; Botones [83].Up = 275;Botones [83]. Right = 460;Botones [83]. Down = 305; + Botones [83]. Cdf = 63; Botones [83]. Cb1 = 56; Botones [83]. Cb2 = 7; Botones [83]. Ab = 2; Botones [83]. Pb = 1; Botones [83]. Isc = 49; Botones [83]. Sc = 0; + Botones [84].Left = 605; Botones [84].Up = 310;Botones [84]. Right = 635;Botones [84]. Down = 340; + Botones [84]. Cdf = 14; Botones [84]. Cb1 = 56; Botones [84]. Cb2 = 63; Botones [84]. Ab = 2; Botones [84]. Pb = 1; Botones [84]. Isc = 0; Botones [84]. Sc = 80; + Botones [85].Left = 570; Botones [85].Up = 310;Botones [85]. Right = 600;Botones [85]. Down = 340; + Botones [85]. Cdf = 14; Botones [85]. Cb1 = 56; Botones [85]. Cb2 = 63; Botones [85]. Ab = 2; Botones [85]. Pb = 1; Botones [85]. Isc = 13; Botones [85]. Sc = 0; + Botones [86].Left = 535; Botones [86].Up = 310;Botones [86]. Right = 565;Botones [86]. Down = 340; + Botones [86]. Cdf = 14; Botones [86]. Cb1 = 56; Botones [86]. Cb2 = 63; Botones [86]. Ab = 2; Botones [86]. Pb = 1; Botones [86]. Isc = 0; Botones [86]. Sc = 0; + Botones [87].Left = 500; Botones [87].Up = 310;Botones [87]. Right = 530;Botones [87]. Down = 340; + Botones [87]. Cdf = 63; Botones [87]. Cb1 = 56; Botones [87]. Cb2 = 7; Botones [87]. Ab = 2; Botones [87]. Pb = 1; Botones [87]. Isc = 8; Botones [87]. Sc = 0; + Botones [88].Left = 430; Botones [88].Up = 310;Botones [88]. Right = 460;Botones [88]. Down = 340; + Botones [88]. Cdf = 63; Botones [88]. Cb1 = 56; Botones [88]. Cb2 = 7; Botones [88]. Ab = 2; Botones [88]. Pb = 1; Botones [88]. Isc = 48; Botones [88]. Sc = 0; + Botones [89].Left = 430; Botones [89].Up = 345;Botones [89]. Right = 530;Botones [89]. Down = 359; + Botones [89]. Cdf = 7; Botones [89]. Cb1 = 56; Botones [89]. Cb2 = 63; Botones [89]. Ab = 2; Botones [89]. Pb = 1; Botones [89]. Isc = 0; Botones [89]. Sc = 0; + Botones [90].Left = 535; Botones [90].Up = 345;Botones [90]. Right = 635;Botones [90]. Down = 359; + Botones [90]. Cdf = 7; Botones [90]. Cb1 = 56; Botones [90]. Cb2 = 63; Botones [90]. Ab = 2; Botones [90]. Pb = 1; Botones [90]. Isc = 0; Botones [90]. Sc = 0; + n_Botones_Secuencia[2 - 1] = 31; + SiZe_BoToN += ( sizeof( struct Make_Boton ) * 31); + if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) { + Secuencias = 2; + return SIN_MEMORIA; + } + memoria_asignada = 1; + Botones [91].Left = 20; Botones [91].Up = 34;Botones [91]. Right = 45;Botones [91]. Down = 59; + Botones [91]. Cdf = 7; Botones [91]. Cb1 = 56; Botones [91]. Cb2 = 63; Botones [91]. Ab = 2; Botones [91]. Pb = 1; Botones [91]. Isc = 0; Botones [91]. Sc = 0; + Botones [92].Left = 47; Botones [92].Up = 34;Botones [92]. Right = 72;Botones [92]. Down = 59; + Botones [92]. Cdf = 7; Botones [92]. Cb1 = 56; Botones [92]. Cb2 = 63; Botones [92]. Ab = 2; Botones [92]. Pb = 1; Botones [92]. Isc = 0; Botones [92]. Sc = 0; + Botones [93].Left = 74; Botones [93].Up = 34;Botones [93]. Right = 99;Botones [93]. Down = 59; + Botones [93]. Cdf = 7; Botones [93]. Cb1 = 56; Botones [93]. Cb2 = 63; Botones [93]. Ab = 2; Botones [93]. Pb = 1; Botones [93]. Isc = 0; Botones [93]. Sc = 0; + Botones [94].Left = 101; Botones [94].Up = 34;Botones [94]. Right = 126;Botones [94]. Down = 59; + Botones [94]. Cdf = 7; Botones [94]. Cb1 = 56; Botones [94]. Cb2 = 63; Botones [94]. Ab = 2; Botones [94]. Pb = 1; Botones [94]. Isc = 0; Botones [94]. Sc = 0; + Botones [95].Left = 128; Botones [95].Up = 34;Botones [95]. Right = 153;Botones [95]. Down = 59; + Botones [95]. Cdf = 7; Botones [95]. Cb1 = 56; Botones [95]. Cb2 = 63; Botones [95]. Ab = 2; Botones [95]. Pb = 1; Botones [95]. Isc = 0; Botones [95]. Sc = 0; + Botones [96].Left = 155; Botones [96].Up = 34;Botones [96]. Right = 180;Botones [96]. Down = 59; + Botones [96]. Cdf = 7; Botones [96]. Cb1 = 56; Botones [96]. Cb2 = 63; Botones [96]. Ab = 2; Botones [96]. Pb = 1; Botones [96]. Isc = 0; Botones [96]. Sc = 0; + Botones [97].Left = 182; Botones [97].Up = 34;Botones [97]. Right = 207;Botones [97]. Down = 59; + Botones [97]. Cdf = 7; Botones [97]. Cb1 = 56; Botones [97]. Cb2 = 63; Botones [97]. Ab = 2; Botones [97]. Pb = 1; Botones [97]. Isc = 0; Botones [97]. Sc = 0; + Botones [98].Left = 209; Botones [98].Up = 34;Botones [98]. Right = 234;Botones [98]. Down = 59; + Botones [98]. Cdf = 7; Botones [98]. Cb1 = 56; Botones [98]. Cb2 = 63; Botones [98]. Ab = 2; Botones [98]. Pb = 1; Botones [98]. Isc = 0; Botones [98]. Sc = 0; + Botones [99].Left = 20; Botones [99].Up = 61;Botones [99]. Right = 45;Botones [99]. Down = 86; + Botones [99]. Cdf = 7; Botones [99]. Cb1 = 56; Botones [99]. Cb2 = 63; Botones [99]. Ab = 2; Botones [99]. Pb = 1; Botones [99]. Isc = 0; Botones [99]. Sc = 0; + Botones [100].Left = 47; Botones [100].Up = 61;Botones [100]. Right = 72;Botones [100]. Down = 86; + Botones [100]. Cdf = 7; Botones [100]. Cb1 = 56; Botones [100]. Cb2 = 63; Botones [100]. Ab = 2; Botones [100]. Pb = 1; Botones [100]. Isc = 0; Botones [100]. Sc = 0; + Botones [101].Left = 74; Botones [101].Up = 61;Botones [101]. Right = 99;Botones [101]. Down = 86; + Botones [101]. Cdf = 7; Botones [101]. Cb1 = 56; Botones [101]. Cb2 = 63; Botones [101]. Ab = 2; Botones [101]. Pb = 1; Botones [101]. Isc = 0; Botones [101]. Sc = 0; + Botones [102].Left = 101; Botones [102].Up = 61;Botones [102]. Right = 126;Botones [102]. Down = 86; + Botones [102]. Cdf = 7; Botones [102]. Cb1 = 56; Botones [102]. Cb2 = 63; Botones [102]. Ab = 2; Botones [102]. Pb = 1; Botones [102]. Isc = 0; Botones [102]. Sc = 0; + Botones [103].Left = 128; Botones [103].Up = 61;Botones [103]. Right = 153;Botones [103]. Down = 86; + Botones [103]. Cdf = 7; Botones [103]. Cb1 = 56; Botones [103]. Cb2 = 63; Botones [103]. Ab = 2; Botones [103]. Pb = 1; Botones [103]. Isc = 0; Botones [103]. Sc = 0; + Botones [104].Left = 155; Botones [104].Up = 61;Botones [104]. Right = 180;Botones [104]. Down = 86; + Botones [104]. Cdf = 7; Botones [104]. Cb1 = 56; Botones [104]. Cb2 = 63; Botones [104]. Ab = 2; Botones [104]. Pb = 1; Botones [104]. Isc = 0; Botones [104]. Sc = 0; + Botones [105].Left = 182; Botones [105].Up = 61;Botones [105]. Right = 207;Botones [105]. Down = 86; + Botones [105]. Cdf = 7; Botones [105]. Cb1 = 56; Botones [105]. Cb2 = 63; Botones [105]. Ab = 2; Botones [105]. Pb = 1; Botones [105]. Isc = 0; Botones [105]. Sc = 0; + Botones [106].Left = 209; Botones [106].Up = 61;Botones [106]. Right = 234;Botones [106]. Down = 86; + Botones [106]. Cdf = 7; Botones [106]. Cb1 = 56; Botones [106]. Cb2 = 63; Botones [106]. Ab = 2; Botones [106]. Pb = 1; Botones [106]. Isc = 0; Botones [106]. Sc = 0; + Botones [107].Left = 236; Botones [107].Up = 34;Botones [107]. Right = 261;Botones [107]. Down = 59; + Botones [107]. Cdf = 3; Botones [107]. Cb1 = 56; Botones [107]. Cb2 = 63; Botones [107]. Ab = 3; Botones [107]. Pb = 1; Botones [107]. Isc = 0; Botones [107]. Sc = 0; + Botones [108].Left = 263; Botones [108].Up = 34;Botones [108]. Right = 288;Botones [108]. Down = 59; + Botones [108]. Cdf = 3; Botones [108]. Cb1 = 56; Botones [108]. Cb2 = 63; Botones [108]. Ab = 3; Botones [108]. Pb = 1; Botones [108]. Isc = 0; Botones [108]. Sc = 0; + Botones [109].Left = 290; Botones [109].Up = 34;Botones [109]. Right = 315;Botones [109]. Down = 59; + Botones [109]. Cdf = 3; Botones [109]. Cb1 = 56; Botones [109]. Cb2 = 63; Botones [109]. Ab = 3; Botones [109]. Pb = 1; Botones [109]. Isc = 0; Botones [109]. Sc = 0; + Botones [110].Left = 236; Botones [110].Up = 61;Botones [110]. Right = 261;Botones [110]. Down = 86; + Botones [110]. Cdf = 3; Botones [110]. Cb1 = 56; Botones [110]. Cb2 = 63; Botones [110]. Ab = 3; Botones [110]. Pb = 1; Botones [110]. Isc = 0; Botones [110]. Sc = 0; + Botones [111].Left = 263; Botones [111].Up = 61;Botones [111]. Right = 288;Botones [111]. Down = 86; + Botones [111]. Cdf = 3; Botones [111]. Cb1 = 56; Botones [111]. Cb2 = 63; Botones [111]. Ab = 3; Botones [111]. Pb = 1; Botones [111]. Isc = 0; Botones [111]. Sc = 0; + Botones [112].Left = 290; Botones [112].Up = 61;Botones [112]. Right = 315;Botones [112]. Down = 86; + Botones [112]. Cdf = 3; Botones [112]. Cb1 = 56; Botones [112]. Cb2 = 63; Botones [112]. Ab = 3; Botones [112]. Pb = 1; Botones [112]. Isc = 0; Botones [112]. Sc = 0; + Botones [113].Left = 555; Botones [113].Up = 34;Botones [113]. Right = 580;Botones [113]. Down = 59; + Botones [113]. Cdf = 3; Botones [113]. Cb1 = 56; Botones [113]. Cb2 = 63; Botones [113]. Ab = 3; Botones [113]. Pb = 1; Botones [113]. Isc = 0; Botones [113]. Sc = 0; + Botones [114].Left = 582; Botones [114].Up = 34;Botones [114]. Right = 607;Botones [114]. Down = 59; + Botones [114]. Cdf = 3; Botones [114]. Cb1 = 56; Botones [114]. Cb2 = 63; Botones [114]. Ab = 3; Botones [114]. Pb = 1; Botones [114]. Isc = 0; Botones [114]. Sc = 0; + Botones [115].Left = 609; Botones [115].Up = 34;Botones [115]. Right = 634;Botones [115]. Down = 59; + Botones [115]. Cdf = 3; Botones [115]. Cb1 = 56; Botones [115]. Cb2 = 63; Botones [115]. Ab = 3; Botones [115]. Pb = 1; Botones [115]. Isc = 0; Botones [115]. Sc = 0; + Botones [116].Left = 555; Botones [116].Up = 61;Botones [116]. Right = 580;Botones [116]. Down = 86; + Botones [116]. Cdf = 3; Botones [116]. Cb1 = 56; Botones [116]. Cb2 = 63; Botones [116]. Ab = 3; Botones [116]. Pb = 1; Botones [116]. Isc = 0; Botones [116]. Sc = 0; + Botones [117].Left = 582; Botones [117].Up = 61;Botones [117]. Right = 607;Botones [117]. Down = 86; + Botones [117]. Cdf = 3; Botones [117]. Cb1 = 56; Botones [117]. Cb2 = 63; Botones [117]. Ab = 3; Botones [117]. Pb = 1; Botones [117]. Isc = 0; Botones [117]. Sc = 0; + Botones [118].Left = 609; Botones [118].Up = 61;Botones [118]. Right = 634;Botones [118]. Down = 86; + Botones [118]. Cdf = 3; Botones [118]. Cb1 = 56; Botones [118]. Cb2 = 63; Botones [118]. Ab = 3; Botones [118]. Pb = 1; Botones [118]. Isc = 0; Botones [118]. Sc = 0; + Botones [119].Left = 538; Botones [119].Up = 103;Botones [119]. Right = 632;Botones [119]. Down = 127; + Botones [119]. Cdf = 9; Botones [119]. Cb1 = 56; Botones [119]. Cb2 = 63; Botones [119]. Ab = 2; Botones [119]. Pb = 1; Botones [119]. Isc = 0; Botones [119]. Sc = 31; + Botones [120].Left = 605; Botones [120].Up = 275;Botones [120]. Right = 635;Botones [120]. Down = 305; + Botones [120]. Cdf = 14; Botones [120]. Cb1 = 56; Botones [120]. Cb2 = 63; Botones [120]. Ab = 2; Botones [120]. Pb = 1; Botones [120]. Isc = 0; Botones [120]. Sc = 72; + Botones [121].Left = 605; Botones [121].Up = 310;Botones [121]. Right = 635;Botones [121]. Down = 340; + Botones [121]. Cdf = 14; Botones [121]. Cb1 = 56; Botones [121]. Cb2 = 63; Botones [121]. Ab = 2; Botones [121]. Pb = 1; Botones [121]. Isc = 0; Botones [121]. Sc = 80; + n_Botones_Secuencia[3 - 1] = 2; + SiZe_BoToN += ( sizeof( struct Make_Boton ) * 2); + if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) { + Secuencias = 3; + return SIN_MEMORIA; + } + memoria_asignada = 1; + Botones [122].Left = 204; Botones [122].Up = 274;Botones [122]. Right = 276;Botones [122]. Down = 291; + Botones [122]. Cdf = 7; Botones [122]. Cb1 = 56; Botones [122]. Cb2 = 63; Botones [122]. Ab = 2; Botones [122]. Pb = 1; Botones [122]. Isc = 0; Botones [122]. Sc = 30; + Botones [123].Left = 364; Botones [123].Up = 274;Botones [123]. Right = 436;Botones [123]. Down = 291; + Botones [123]. Cdf = 7; Botones [123]. Cb1 = 56; Botones [123]. Cb2 = 63; Botones [123]. Ab = 2; Botones [123]. Pb = 1; Botones [123]. Isc = 0; Botones [123]. Sc = 46; + n_Botones_Secuencia[4 - 1] = 4; + SiZe_BoToN += ( sizeof( struct Make_Boton ) * 4); + if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) { + Secuencias = 4; + return SIN_MEMORIA; + } + memoria_asignada = 1; + Botones [124].Left = 377; Botones [124].Up = 169;Botones [124]. Right = 391;Botones [124]. Down = 221; + Botones [124]. Cdf = 7; Botones [124]. Cb1 = 56; Botones [124]. Cb2 = 63; Botones [124]. Ab = 0; Botones [124]. Pb = 1; Botones [124]. Isc = 0; Botones [124]. Sc = 46; + Botones [125].Left = 377; Botones [125].Up = 223;Botones [125]. Right = 391;Botones [125]. Down = 276; + Botones [125]. Cdf = 7; Botones [125]. Cb1 = 56; Botones [125]. Cb2 = 63; Botones [125]. Ab = 0; Botones [125]. Pb = 1; Botones [125]. Isc = 0; Botones [125]. Sc = 30; + Botones [126].Left = 377; Botones [126].Up = 278;Botones [126]. Right = 391;Botones [126]. Down = 303; + Botones [126]. Cdf = 7; Botones [126]. Cb1 = 56; Botones [126]. Cb2 = 63; Botones [126]. Ab = 0; Botones [126]. Pb = 1; Botones [126]. Isc = 0; Botones [126]. Sc = 72; + Botones [127].Left = 377; Botones [127].Up = 305;Botones [127]. Right = 391;Botones [127]. Down = 330; + Botones [127]. Cdf = 7; Botones [127]. Cb1 = 56; Botones [127]. Cb2 = 63; Botones [127]. Ab = 0; Botones [127]. Pb = 1; Botones [127]. Isc = 0; Botones [127]. Sc = 80; + n_Botones_Secuencia[5 - 1] = 22; + SiZe_BoToN += ( sizeof( struct Make_Boton ) * 22); + if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) { + Secuencias = 5; + return SIN_MEMORIA; + } + memoria_asignada = 1; + Botones [128].Left = 15; Botones [128].Up = 380;Botones [128]. Right = 25;Botones [128]. Down = 390; + Botones [128]. Cdf = 0; Botones [128]. Cb1 = 7; Botones [128]. Cb2 = 7; Botones [128]. Ab = 3; Botones [128]. Pb = 0; Botones [128]. Isc = 82; Botones [128]. Sc = 0; + Botones [129].Left = 15; Botones [129].Up = 405;Botones [129]. Right = 25;Botones [129]. Down = 415; + Botones [129]. Cdf = 0; Botones [129]. Cb1 = 7; Botones [129]. Cb2 = 7; Botones [129]. Ab = 3; Botones [129]. Pb = 0; Botones [129]. Isc = 73; Botones [129]. Sc = 0; + Botones [130].Left = 15; Botones [130].Up = 430;Botones [130]. Right = 25;Botones [130]. Down = 440; + Botones [130]. Cdf = 0; Botones [130]. Cb1 = 7; Botones [130]. Cb2 = 7; Botones [130]. Ab = 3; Botones [130]. Pb = 0; Botones [130]. Isc = 80; Botones [130]. Sc = 0; + Botones [131].Left = 15; Botones [131].Up = 455;Botones [131]. Right = 25;Botones [131]. Down = 465; + Botones [131]. Cdf = 0; Botones [131]. Cb1 = 7; Botones [131]. Cb2 = 7; Botones [131]. Ab = 3; Botones [131]. Pb = 0; Botones [131]. Isc = 77; Botones [131]. Sc = 0; + Botones [132].Left = 315; Botones [132].Up = 380;Botones [132]. Right = 325;Botones [132]. Down = 390; + Botones [132]. Cdf = 0; Botones [132]. Cb1 = 7; Botones [132]. Cb2 = 7; Botones [132]. Ab = 3; Botones [132]. Pb = 0; Botones [132]. Isc = 84; Botones [132]. Sc = 0; + Botones [133].Left = 315; Botones [133].Up = 395;Botones [133]. Right = 325;Botones [133]. Down = 405; + Botones [133]. Cdf = 0; Botones [133]. Cb1 = 7; Botones [133]. Cb2 = 7; Botones [133]. Ab = 3; Botones [133]. Pb = 0; Botones [133]. Isc = 83; Botones [133]. Sc = 0; + Botones [134].Left = 315; Botones [134].Up = 410;Botones [134]. Right = 325;Botones [134]. Down = 420; + Botones [134]. Cdf = 0; Botones [134]. Cb1 = 7; Botones [134]. Cb2 = 7; Botones [134]. Ab = 3; Botones [134]. Pb = 0; Botones [134]. Isc = 86; Botones [134]. Sc = 0; + Botones [135].Left = 496; Botones [135].Up = 380;Botones [135]. Right = 506;Botones [135]. Down = 390; + Botones [135]. Cdf = 1; Botones [135]. Cb1 = 56; Botones [135]. Cb2 = 63; Botones [135]. Ab = 0; Botones [135]. Pb = 0; Botones [135]. Isc = 0; Botones [135]. Sc = 0; + Botones [136].Left = 496; Botones [136].Up = 392;Botones [136]. Right = 506;Botones [136]. Down = 402; + Botones [136]. Cdf = 2; Botones [136]. Cb1 = 56; Botones [136]. Cb2 = 63; Botones [136]. Ab = 0; Botones [136]. Pb = 0; Botones [136]. Isc = 0; Botones [136]. Sc = 0; + Botones [137].Left = 496; Botones [137].Up = 402;Botones [137]. Right = 506;Botones [137]. Down = 412; + Botones [137]. Cdf = 3; Botones [137]. Cb1 = 56; Botones [137]. Cb2 = 63; Botones [137]. Ab = 0; Botones [137]. Pb = 0; Botones [137]. Isc = 0; Botones [137]. Sc = 0; + Botones [138].Left = 496; Botones [138].Up = 414;Botones [138]. Right = 506;Botones [138]. Down = 424; + Botones [138]. Cdf = 4; Botones [138]. Cb1 = 56; Botones [138]. Cb2 = 63; Botones [138]. Ab = 0; Botones [138]. Pb = 0; Botones [138]. Isc = 0; Botones [138]. Sc = 0; + Botones [139].Left = 496; Botones [139].Up = 426;Botones [139]. Right = 506;Botones [139]. Down = 436; + Botones [139]. Cdf = 5; Botones [139]. Cb1 = 56; Botones [139]. Cb2 = 63; Botones [139]. Ab = 0; Botones [139]. Pb = 0; Botones [139]. Isc = 0; Botones [139]. Sc = 0; + Botones [140].Left = 508; Botones [140].Up = 380;Botones [140]. Right = 518;Botones [140]. Down = 390; + Botones [140]. Cdf = 6; Botones [140]. Cb1 = 56; Botones [140]. Cb2 = 63; Botones [140]. Ab = 0; Botones [140]. Pb = 0; Botones [140]. Isc = 0; Botones [140]. Sc = 0; + Botones [141].Left = 508; Botones [141].Up = 392;Botones [141]. Right = 518;Botones [141]. Down = 402; + Botones [141]. Cdf = 7; Botones [141]. Cb1 = 56; Botones [141]. Cb2 = 63; Botones [141]. Ab = 0; Botones [141]. Pb = 0; Botones [141]. Isc = 0; Botones [141]. Sc = 0; + Botones [142].Left = 508; Botones [142].Up = 402;Botones [142]. Right = 518;Botones [142]. Down = 412; + Botones [142]. Cdf = 8; Botones [142]. Cb1 = 56; Botones [142]. Cb2 = 63; Botones [142]. Ab = 0; Botones [142]. Pb = 0; Botones [142]. Isc = 0; Botones [142]. Sc = 0; + Botones [143].Left = 508; Botones [143].Up = 414;Botones [143]. Right = 518;Botones [143]. Down = 424; + Botones [143]. Cdf = 9; Botones [143]. Cb1 = 56; Botones [143]. Cb2 = 63; Botones [143]. Ab = 0; Botones [143]. Pb = 0; Botones [143]. Isc = 0; Botones [143]. Sc = 0; + Botones [144].Left = 508; Botones [144].Up = 426;Botones [144]. Right = 518;Botones [144]. Down = 436; + Botones [144]. Cdf = 10; Botones [144]. Cb1 = 56; Botones [144]. Cb2 = 63; Botones [144]. Ab = 0; Botones [144]. Pb = 0; Botones [144]. Isc = 0; Botones [144]. Sc = 0; + Botones [145].Left = 520; Botones [145].Up = 380;Botones [145]. Right = 530;Botones [145]. Down = 390; + Botones [145]. Cdf = 11; Botones [145]. Cb1 = 56; Botones [145]. Cb2 = 63; Botones [145]. Ab = 0; Botones [145]. Pb = 0; Botones [145]. Isc = 0; Botones [145]. Sc = 0; + Botones [146].Left = 520; Botones [146].Up = 392;Botones [146]. Right = 530;Botones [146]. Down = 402; + Botones [146]. Cdf = 12; Botones [146]. Cb1 = 56; Botones [146]. Cb2 = 63; Botones [146]. Ab = 0; Botones [146]. Pb = 0; Botones [146]. Isc = 0; Botones [146]. Sc = 0; + Botones [147].Left = 520; Botones [147].Up = 402;Botones [147]. Right = 530;Botones [147]. Down = 412; + Botones [147]. Cdf = 13; Botones [147]. Cb1 = 56; Botones [147]. Cb2 = 63; Botones [147]. Ab = 0; Botones [147]. Pb = 0; Botones [147]. Isc = 0; Botones [147]. Sc = 0; + Botones [148].Left = 520; Botones [148].Up = 414;Botones [148]. Right = 530;Botones [148]. Down = 424; + Botones [148]. Cdf = 14; Botones [148]. Cb1 = 56; Botones [148]. Cb2 = 63; Botones [148]. Ab = 0; Botones [148]. Pb = 0; Botones [148]. Isc = 0; Botones [148]. Sc = 0; + Botones [149].Left = 520; Botones [149].Up = 426;Botones [149]. Right = 530;Botones [149]. Down = 436; + Botones [149]. Cdf = 15; Botones [149]. Cb1 = 56; Botones [149]. Cb2 = 63; Botones [149]. Ab = 0; Botones [149]. Pb = 0; Botones [149]. Isc = 0; Botones [149]. Sc = 0; + break; + case 1: + Bot_Static.Left = 236; Bot_Static.Up = 95; Bot_Static.Right = 425; Bot_Static.Down = 135; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 239; Bot_Static.Up = 98; Bot_Static.Right = 422; Bot_Static.Down = 132; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 1; Bot_Static.Up = 140; Bot_Static.Right = 91; Bot_Static.Down = 165; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 4; Bot_Static.Up = 143; Bot_Static.Right = 87; Bot_Static.Down = 162; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 1; Bot_Static.Up = 170; Bot_Static.Right = 91; Bot_Static.Down = 359; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 4; Bot_Static.Up = 173; Bot_Static.Right = 87; Bot_Static.Down = 356; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 96; Bot_Static.Up = 140; Bot_Static.Right = 231; Bot_Static.Down = 165; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 99; Bot_Static.Up = 143; Bot_Static.Right = 228; Bot_Static.Down = 162; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 96; Bot_Static.Up = 170; Bot_Static.Right = 231; Bot_Static.Down = 359; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 99; Bot_Static.Up = 173; Bot_Static.Right = 228; Bot_Static.Down = 356; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 236; Bot_Static.Up = 140; Bot_Static.Right = 425; Bot_Static.Down = 165; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 239; Bot_Static.Up = 143; Bot_Static.Right = 422; Bot_Static.Down = 162; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 236; Bot_Static.Up = 170; Bot_Static.Right = 425; Bot_Static.Down = 359; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 239; Bot_Static.Up = 173; Bot_Static.Right = 422; Bot_Static.Down = 356; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(63); settextstyle( 2, 0, 5); outtextxy( 4, 143, " Direccin Instruccin Dato" ); + setcolor(0); settextstyle( 2, 0, 5); outtextxy( 5, 144, " Direccin Instruccin Dato" ); + Bot_Static.Left = 0; Bot_Static.Up = 0; Bot_Static.Right = 565; Bot_Static.Down = 26; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 3; Bot_Static.Up = 3; Bot_Static.Right = 562; Bot_Static.Down = 23; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 0; Bot_Static.Up = 30; Bot_Static.Right = 320; Bot_Static.Down = 90; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 4; Bot_Static.Up = 34; Bot_Static.Right = 18; Bot_Static.Down = 86; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(63); settextstyle( 2, 1, 4); outtextxy( 4, 34, "Entradas" ); + setcolor(0); settextstyle( 2, 1, 4); outtextxy( 5, 35, "Entradas" ); + Bot_Static.Left = 321; Bot_Static.Up = 30; Bot_Static.Right = 640; Bot_Static.Down = 90; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 325; Bot_Static.Up = 34; Bot_Static.Right = 339; Bot_Static.Down = 86; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(63); settextstyle( 2, 1, 4); outtextxy( 325, 34, "Salidas " ); + setcolor(0); settextstyle( 2, 1, 4); outtextxy( 326, 35, "Salidas " ); + Bot_Static.Left = 1; Bot_Static.Up = 364; Bot_Static.Right = 550; Bot_Static.Down = 478; Bot_Static.Cdf = 12; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 6; Bot_Static.Up = 369; Bot_Static.Right = 545; Bot_Static.Down = 473; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 535; Bot_Static.Up = 100; Bot_Static.Right = 635; Bot_Static.Down = 130; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + break; + case 2: + + setcolor(4); settextstyle( 2, 0, 6); + outtextxy( 539, 105, " R U N" ); + outtextxy( 539, 108, " _" ); + + setcolor(12); settextstyle( 2, 0, 4); + outtextxy( 570, 8, "_" ); + + settextstyle( 2, 0, 5); + outtextxy( 582, 368, " _" ); + outtextxy( 582, 457, " _" ); + + settextstyle( 2, 0, 6); + outtextxy( 538, 104, " R U N" ); + outtextxy( 538, 107, " _" ); + + settextstyle( 2, 1, 5); + outtextxy( 587, 395, " _ " ); + outtextxy( 616, 395, " _ " ); + outtextxy( 558, 369, " Configurar " ); + outtextxy( 560, 369, " _ " ); + + setcolor(0); settextstyle( 2, 0, 4); + outtextxy( 571, 6, "Acerca de..." ); + outtextxy( 571, 9, "_" ); + + setcolor(0); settextstyle( 2, 1, 5); + outtextxy( 561, 370, " _ " ); + outtextxy( 586, 396, " Salvar" ); + outtextxy( 588, 396, " _ " ); + outtextxy( 613, 396, " Cargar" ); + outtextxy( 617, 396, " _ " ); + outtextxy( 559, 370, " Configurar " ); + + + // INICIO 63 + setcolor(63); + settextstyle( 2, 0, 5); + outtextxy( 126, 64, " 12" ); + outtextxy( 153, 64, " 13" ); + outtextxy( 180, 64, " 14" ); + outtextxy( 207, 64, " 15" ); + outtextxy( 234, 64, " 03" ); + outtextxy( 261, 64, " 04" ); + outtextxy( 288, 64, " 19" ); + outtextxy( 339, 37, " 0" ); + outtextxy( 366, 37, " 1" ); + outtextxy( 393, 37, " 2" ); + outtextxy( 570, 5, "Acerca de..." ); + outtextxy( 582, 366, " Reset" ); + outtextxy( 420, 37, " 3" ); + outtextxy( 447, 37, " 4" ); + outtextxy( 582, 455, " Salir" ); + outtextxy( 18, 37, " 0" ); + outtextxy( 45, 37, " 1" ); + outtextxy( 72, 37, " 2" ); + outtextxy( 99, 37, " 3" ); + outtextxy( 126, 37, " 4" ); + outtextxy( 153, 37, " 5" ); + outtextxy( 180, 37, " 6" ); + outtextxy( 207, 37, " 7" ); + outtextxy( 234, 37, " 00" ); + outtextxy( 261, 37, " 01" ); + outtextxy( 288, 37, " 02" ); + outtextxy( 18, 64, " 8" ); + outtextxy( 45, 64, " 9" ); + outtextxy( 72, 64, " 10" ); + outtextxy( 99, 64, " 11" ); + outtextxy( 339, 64, " 8" ); + outtextxy( 526, 37, " 7" ); + outtextxy( 499, 37, " 6" ); + outtextxy( 474, 37, " 5" ); + outtextxy( 553, 37, " 05" ); + outtextxy( 580, 37, " 06" ); + outtextxy( 607, 37, " 07" ); + outtextxy( 366, 64, " 9" ); + outtextxy( 393, 64, " 10" ); + outtextxy( 434, 105, "FUN" ); + outtextxy( 474, 64, " 13" ); + outtextxy( 447, 64, " 12" ); + outtextxy( 420, 64, " 11" ); + outtextxy( 499, 64, " 14" ); + outtextxy( 526, 64, " 15" ); + outtextxy( 553, 64, " 08" ); + outtextxy( 580, 64, " 09" ); + outtextxy( 434, 107, "_" ); + outtextxy( 607, 64, " 10" ); + outtextxy( 433, 140, "AND OR CNT" ); + outtextxy( 469, 105, "SFT" ); + outtextxy( 469, 107, "_" ); + outtextxy( 505, 105, "NOT" ); + outtextxy( 505, 107, "_" ); + outtextxy( 614, 142, "_" ); + outtextxy( 614, 140, "HR" ); + outtextxy( 430, 175, " LD OUT" ); + outtextxy( 544, 140, "TR LR" ); + outtextxy( 544, 142, "_ _" ); + outtextxy( 430, 177, " _ _" ); + outtextxy( 505, 175, "TIM" ); + outtextxy( 505, 175, " _" ); + outtextxy( 544, 175, "DM CH" ); + outtextxy( 544, 177, "_" ); + outtextxy( 433, 142, "_ _ _" ); + + + setcolor(63); settextstyle( 2, 1, 5); + outtextxy( 585, 395, " Salvar" ); + outtextxy( 612, 395, " Cargar" ); + setcolor(63); settextstyle( 2, 0, 4); + outtextxy( 609, 177, "CONT" ); + outtextxy( 430, 345, " Debug Code" ); + outtextxy( 533, 345, " Reset Valores" ); + // FIN 63 + + setcolor(0); settextstyle( 2, 0, 5); + outtextxy( 583, 459, " _" ); + outtextxy( 583, 367, " Reset" ); + outtextxy( 583, 369, " _" ); + outtextxy( 583, 456, " Salir" ); + outtextxy( 19, 38, " 0" ); + outtextxy( 46, 38, " 1" ); + outtextxy( 73, 38, " 2" ); + outtextxy( 100, 38, " 3" ); + outtextxy( 127, 38, " 4" ); + outtextxy( 154, 38, " 5" ); + outtextxy( 181, 38, " 6" ); + outtextxy( 208, 38, " 7" ); + outtextxy( 235, 38, " 00" ); + outtextxy( 262, 38, " 01" ); + outtextxy( 289, 38, " 02" ); + outtextxy( 19, 65, " 8" ); + outtextxy( 46, 65, " 9" ); + outtextxy( 73, 65, " 10" ); + outtextxy( 100, 65, " 11" ); + outtextxy( 127, 65, " 12" ); + outtextxy( 154, 65, " 13" ); + outtextxy( 181, 65, " 14" ); + outtextxy( 208, 65, " 15" ); + outtextxy( 235, 65, " 03" ); + outtextxy( 262, 65, " 04" ); + outtextxy( 289, 65, " 19" ); + outtextxy( 340, 38, " 0" ); + outtextxy( 367, 38, " 1" ); + outtextxy( 394, 38, " 2" ); + outtextxy( 421, 38, " 3" ); + outtextxy( 448, 38, " 4" ); + outtextxy( 475, 38, " 5" ); + outtextxy( 500, 38, " 6" ); + outtextxy( 527, 38, " 7" ); + outtextxy( 554, 38, " 05" ); + outtextxy( 581, 38, " 06" ); + outtextxy( 608, 38, " 07" ); + outtextxy( 340, 65, " 8" ); + outtextxy( 367, 65, " 9" ); + outtextxy( 394, 65, " 10" ); + outtextxy( 421, 65, " 11" ); + outtextxy( 448, 65, " 12" ); + outtextxy( 475, 65, " 13" ); + outtextxy( 500, 65, " 14" ); + outtextxy( 527, 65, " 15" ); + outtextxy( 554, 65, " 08" ); + outtextxy( 581, 65, " 09" ); + outtextxy( 608, 65, " 10" ); + outtextxy( 435, 106, "FUN" ); + outtextxy( 435, 108, "_" ); + outtextxy( 470, 106, "SFT" ); + outtextxy( 470, 108, "_" ); + outtextxy( 506, 106, "NOT" ); + outtextxy( 506, 108, "_" ); + outtextxy( 434, 141, "AND OR CNT" ); + outtextxy( 434, 143, "_ _ _" ); + outtextxy( 545, 141, "TR LR" ); + outtextxy( 545, 143, "_ _" ); + outtextxy( 614, 141, "HR" ); + outtextxy( 614, 143, "_" ); + outtextxy( 431, 176, " LD OUT" ); + outtextxy( 431, 178, " _ _" ); + outtextxy( 506, 176, "TIM" ); + outtextxy( 506, 176, " _" ); + outtextxy( 545, 176, "DM CH" ); + outtextxy( 545, 178, "_" ); + outtextxy( 545, 178, " _" ); + outtextxy( 544, 246, " DEL" ); + outtextxy( 441, 216, " 7 9" ); + outtextxy( 438, 216, " 8" ); + outtextxy( 540, 211, "EXT" ); + outtextxy( 438, 251, " 5" ); + outtextxy( 544, 211, " CHG" ); + outtextxy( 441, 251, " 4 6" ); + outtextxy( 441, 286, " 1 3" ); + outtextxy( 438, 286, " 2 " ); + outtextxy( 540, 281, "REC" ); + outtextxy( 536, 281, " INS UP" ); + outtextxy( 441, 321, " 0" ); + outtextxy( 506, 316, "CLR" ); + outtextxy( 508, 316, " VER" ); + + setcolor(0); + settextstyle( 2, 0, 4); + outtextxy( 609, 178, "CONT" ); + outtextxy( 609, 180, " _" ); + outtextxy( 538, 249, "" ); + outtextxy( 543, 256, "SET" ); + outtextxy( 609, 248, "MONT" ); + outtextxy( 540, 243, "PLAY" ); + outtextxy( 609, 213, "SCRH" ); + outtextxy( 428, 242, " E F" ); + outtextxy( 428, 277, " B C D" ); + outtextxy( 428, 312, " A" ); + outtextxy( 539, 318, " WRIT DOWN" ); + outtextxy( 539, 318, " DOWN" ); + outtextxy( 431, 346, " Debug Code" ); + outtextxy( 534, 346, " Reset Valores" ); + + setcolor(7); + outtextxy( 429, 243, " E F" ); + outtextxy( 429, 278, " B C D" ); + outtextxy( 429, 313, " A" ); + setcolor(22); + outtextxy( 539, 242, "PLAY" ); + outtextxy( 538, 248, "" ); + outtextxy( 538, 317, " WRIT DOWN" ); + outtextxy( 538, 317, " DOWN" ); + outtextxy( 609, 247, "MONT" ); + outtextxy( 542, 255, "SET" ); + outtextxy( 609, 212, "SCRH" ); + + settextstyle( 2, 0, 5); + outtextxy( 440, 250, " 4 6" ); + outtextxy( 437, 250, " 5" ); + outtextxy( 507, 315, " VER" ); + outtextxy( 535, 280, " INS UP" ); + outtextxy( 440, 320, " 0" ); + outtextxy( 505, 315, "CLR" ); + outtextxy( 543, 245, " DEL" ); + outtextxy( 440, 285, " 1 3" ); + outtextxy( 539, 280, "REC" ); + outtextxy( 437, 285, " 2" ); + outtextxy( 440, 215, " 7 9" ); + outtextxy( 437, 215, " 8" ); + outtextxy( 539, 210, "EXT" ); + outtextxy( 543, 210, " CHG" ); + + setcolor(12); + outtextxy( 544, 177, " _" ); + settextstyle( 2, 0, 4); + outtextxy( 609, 179, " _" ); + + + break; + case 3: + Bot_Static.Left = 538; Bot_Static.Up = 103; Bot_Static.Right = 632; Bot_Static.Down = 127; Bot_Static.Cdf = 9; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + settextstyle( 2, 0, 6); + setcolor(12); + outtextxy( 538, 104, " S T O P" ); + settextstyle( 2, 0, 6); outtextxy( 538, 107, " _" ); + setcolor(4); + settextstyle( 2, 0, 6); outtextxy( 539, 105, " S T O P" ); + settextstyle( 2, 0, 6); outtextxy( 539, 108, "_" ); + break; + case 4: + Bot_Static.Left = 538; Bot_Static.Up = 103; Bot_Static.Right = 632; Bot_Static.Down = 127; Bot_Static.Cdf = 9; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + settextstyle( 2, 0, 6); + setcolor(12); + outtextxy( 538, 104, " R U N" ); + outtextxy( 538, 107, " _" ); + setcolor(4); + outtextxy( 539, 105, " R U N" ); + outtextxy( 539, 108, " _" ); + break; + case 100: + Bot_Static.Left = 200; Bot_Static.Up = 212; Bot_Static.Right = 440; Bot_Static.Down = 267; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 205; Bot_Static.Up = 217; Bot_Static.Right = 435; Bot_Static.Down = 262; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 200; Bot_Static.Up = 270; Bot_Static.Right = 280; Bot_Static.Down = 295; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 360; Bot_Static.Up = 270; Bot_Static.Right = 440; Bot_Static.Down = 295; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + break; + case 101: + settextstyle( 2, 0, 5); + setcolor(63); + outtextxy( 200, 274, " Aceptar" ); + outtextxy( 340, 274, " Cancelar" ); + setcolor(0); + outtextxy( 201, 275, " Aceptar" ); + outtextxy( 201, 275, " A" ); + outtextxy( 341, 275, " C" ); + outtextxy( 341, 275, " Cancelar" ); + setcolor(14); + outtextxy( 200, 274, " A" ); + outtextxy( 340, 274, " C" ); + break; + case 10: + Bot_Static.Left = 240; Bot_Static.Up = 140; Bot_Static.Right = 400; Bot_Static.Down = 340; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 243; Bot_Static.Up = 143; Bot_Static.Right = 397; Bot_Static.Down = 337; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 250; Bot_Static.Up = 150; Bot_Static.Right = 391; Bot_Static.Down = 164; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(0, Bot_Static); + Bot_Static.Left = 250; Bot_Static.Up = 169; Bot_Static.Right = 375; Bot_Static.Down = 180; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 250; Bot_Static.Up = 185; Bot_Static.Right = 375; Bot_Static.Down = 330; Bot_Static.Cdf = 0; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 377; Bot_Static.Up = 169; Bot_Static.Right = 391; Bot_Static.Down = 221; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 377; Bot_Static.Up = 223; Bot_Static.Right = 391; Bot_Static.Down = 276; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 377; Bot_Static.Up = 278; Bot_Static.Right = 391; Bot_Static.Down = 303; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 377; Bot_Static.Up = 305; Bot_Static.Right = 391; Bot_Static.Down = 330; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 0; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + + setcolor(63); + settextstyle( 2, 1, 4); + outtextxy( 377, 169, "Cancelar" ); + outtextxy( 377, 223, "Aceptar " ); + + setcolor(2); + outtextxy( 377, 169, "C " ); + outtextxy( 377, 223, "A " ); + + setcolor(0); + outtextxy( 378, 170, "Cancelar" ); + outtextxy( 378, 170, "C " ); + outtextxy( 378, 224, "Aceptar " ); + outtextxy( 378, 224, "A " ); + settextstyle( 2, 0, 4); + outtextxy( 378, 289, " -" ); + outtextxy( 378, 316, " +" ); + + setcolor(63); + outtextxy( 377, 288, " -" ); + setcolor(63); + outtextxy( 377, 315, " +" ); + + break; + case 20: + setcolor(63); settextstyle( 2, 0, 5); + outtextxy( 14, 383, " _" ); + outtextxy( 14, 408, " _" ); + outtextxy( 14, 433, " _" ); + outtextxy( 14, 458, " _" ); + outtextxy( 314, 398, " _" ); + outtextxy( 314, 383, " _" ); + outtextxy( 314, 413, " _" ); + setcolor(4); + outtextxy( 15, 405, " Usar INT 8 [ Ejecucin TURBO ]" ); + outtextxy( 15, 380, " RETROCEDER... Colores >>> >> >" ); + outtextxy( 15, 430, " Usar PC_Out [ Interfaz PC <> Out ]" ); + outtextxy( 15, 455, " Mostrar Diagramas de Tiempo" ); + setcolor(12); + outtextxy( 315, 380, " Texto >" ); + outtextxy( 315, 395, " Texto Sealado >" ); + outtextxy( 315, 410, " Visor LCD >" ); + break; + case 200: + Bot_Static.Left = 200; Bot_Static.Up = 212; Bot_Static.Right = 440; Bot_Static.Down = 267; Bot_Static.Cdf = 12; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 205; Bot_Static.Up = 217; Bot_Static.Right = 435; Bot_Static.Down = 262; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(240); settextstyle( 2, 0, 5); + outtextxy( 210, 222, " ERROR ABRIENDO FICHERO" ); + outtextxy( 210, 242, " OPERACION ABORTADA" ); + break; + case 300: + Bot_Static.Left = 200; Bot_Static.Up = 212; Bot_Static.Right = 440; Bot_Static.Down = 267; Bot_Static.Cdf = 12; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 205; Bot_Static.Up = 217; Bot_Static.Right = 435; Bot_Static.Down = 262; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(240); settextstyle( 2, 0, 5); + outtextxy( 210, 222, " P L C (c) 1995 v 2.0" ); + outtextxy( 210, 242, " Jos David Guilln.." ); + break; + case 500: + Bot_Static.Left = 200; Bot_Static.Up = 212; Bot_Static.Right = 440; Bot_Static.Down = 267; Bot_Static.Cdf = 12; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 205; Bot_Static.Up = 217; Bot_Static.Right = 435; Bot_Static.Down = 262; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(240); settextstyle( 2, 0, 5); outtextxy( 210, 222, " Programa no tiene FUN" ); + setcolor(240); settextstyle( 2, 0, 5); outtextxy( 210, 242, " ERROR EN LA EJECUCIN..." ); + break; + case 501: + Bot_Static.Left = 200; Bot_Static.Up = 212; Bot_Static.Right = 440; Bot_Static.Down = 267; Bot_Static.Cdf = 12; Bot_Static.Cb1 = 63; Bot_Static.Cb2 = 56; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + Bot_Static.Left = 205; Bot_Static.Up = 217; Bot_Static.Right = 435; Bot_Static.Down = 262; Bot_Static.Cdf = 7; Bot_Static.Cb1 = 56; Bot_Static.Cb2 = 63; Bot_Static.Ab = 2; Bot_Static.Pb = 1; + Imprime_Boton(1, Bot_Static); + setcolor(240); settextstyle( 2, 0, 5); + outtextxy( 210, 222, " Se encontro una funcin" ); + outtextxy( 210, 242, " no reconocida por PLC..." ); + break; + default: + break; + } +} diff --git a/CNT.PLC b/CNT.PLC new file mode 100644 index 0000000..83e96e7 Binary files /dev/null and b/CNT.PLC differ diff --git a/DIFD(14).PLC b/DIFD(14).PLC new file mode 100644 index 0000000..9030f15 Binary files /dev/null and b/DIFD(14).PLC differ diff --git a/DIFU(13).PLC b/DIFU(13).PLC new file mode 100644 index 0000000..80a020e Binary files /dev/null and b/DIFU(13).PLC differ diff --git a/EGAVGAF.OBJ b/EGAVGAF.OBJ new file mode 100644 index 0000000..b2e2499 Binary files /dev/null and b/EGAVGAF.OBJ differ diff --git a/KEEP(11).PLC b/KEEP(11).PLC new file mode 100644 index 0000000..873cd32 Binary files /dev/null and b/KEEP(11).PLC differ diff --git a/KEY.EXE b/KEY.EXE new file mode 100644 index 0000000..719566b Binary files /dev/null and b/KEY.EXE differ diff --git a/KIT.PLC b/KIT.PLC new file mode 100644 index 0000000..b61628b Binary files /dev/null and b/KIT.PLC differ diff --git a/LITTF.OBJ b/LITTF.OBJ new file mode 100644 index 0000000..48fd97b Binary files /dev/null and b/LITTF.OBJ differ diff --git a/MAKE_BOT.OBJ b/MAKE_BOT.OBJ new file mode 100644 index 0000000..29c8ff9 Binary files /dev/null and b/MAKE_BOT.OBJ differ diff --git a/PLC.CFG b/PLC.CFG new file mode 100644 index 0000000..d48156a Binary files /dev/null and b/PLC.CFG differ diff --git a/PLC.CPP b/PLC.CPP new file mode 100644 index 0000000..efe1bc0 --- /dev/null +++ b/PLC.CPP @@ -0,0 +1,97 @@ +#include + + +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON +#include "plc.h" + +extern void CFG_File( char Cargar_Salvar ); +#define Salvar 1 +#define Cargar 2 + +MemoriaRam *Ram; +FirmWare far *Programa; + +int main(void){ + + InicializaMemoria( ); + CargaEntornoGrafico(); + CFG_File( Cargar ); + + Menu_Edicion( ); + + restorecrtmode( ); + free (Ram ); + farfree(Programa ); + +return 0; + +} + +int CargaEntornoGrafico(void) { + + int errorcode = registerfarbgidriver(EGAVGA_driver_far); + +/* report any registration errors */ +if (errorcode < 0) +{ + printf("Graphics error: %s\n", grapherrormsg(errorcode)); + printf("Press any key to halt:"); + getch(); + exit(1); /* terminate with an error code */ +} +errorcode = registerfarbgifont(small_font_far); + +/* report any registration errors */ +if (errorcode < 0) +{ + printf("Graphics error: %s\n", grapherrormsg(errorcode)); + printf("Press any key to halt:"); + getch(); + exit(1); /* terminate with an error code */ +} + + Initialize( 9, 2 ); // Inicializa el Modo Grfico + + setfillstyle(6, 57); + floodfill(0, 0, 1); + +// Fichero_bot(0); + carga_botones("PLC.dat"); // Carga botones del fichero "botones.p1" + +// Fichero_bot(1); + Imprime_Estaticos( 1, "PLC.dat"); // Imprime botones estaticos 'Seccion 1' + + Imprime_Secuencia(1); // Imprime secuencia 1. + +// Fichero_bot(2); + Imprime_Estaticos( 2, "PLC.dat"); // Imprime Estaticos, secuencia 2. + + Imprime_Bordes(1, B_Ch00_In , 4); + Imprime_Bordes(1, B_Ch00_Out, 4); + + PunteroRaton = 1; + inicializa_raton_grafico( 0, 0, 640, 480); + + return 1; +} + +int InicializaMemoria(void){ + + if ( (Ram = (MemoriaRam *)malloc( sizeof(MemoriaRam) ) ) == NULL ) + Abandona_Programa("Imposible inicializar RAM PLC --> MEMORY OUT!!! ", sizeof(MemoriaRam) ); + + Resetea_Memoria(); + + if ( (Programa = (FirmWare far *)farmalloc( (long)(sizeof(FirmWare) * 10005) ) ) == NULL ) + Abandona_Programa("Imposible inicializar programa --> MEMORY OUT!!! ", (long)(sizeof(FirmWare)*11005) ); + + Reset_Programa(); + return 1; +} + diff --git a/PLC.DAT b/PLC.DAT new file mode 100644 index 0000000..47480bc --- /dev/null +++ b/PLC.DAT @@ -0,0 +1,694 @@ +********************************************************************************* +* * +* JD _SOFT_ * +* FuTuRe ViSiOn * +* * +* Este es el cdigo fuente necesario para ejecutar el emulador si no se * +* utiliza la utilidad MB2SRC ( creada por JD ) para compilar este fuente * +* con el programa .EXE ( la compilacin es automatizada para mayor facilidad ) * +* * +* * +* Make_Boton ( Generador de entornos grfico ) es un programa realizado * +* por JD _SOFT_ * +********************************************************************************* +****************************************************************************** +* * +* Fuente para el lenguaje generador de entornos grficos Make_Boton * +* * +****************************************************************************** + + +#5 + +!1, 91 +1 + +*&211, 95, 231, 135, 7, 56, 63, 2, 1 +*|214, 97, 2, 4, 1, 63, Ayuda, + *|215, 98, 2, 4, 1, 0, Ayuda, +*|216, 97, 2, 4, 1, 4, _ , + *|217, 98, 2, 4, 1, 0, _ , + +* Cuadro original LCD +&236, 95, 425, 135, 7, 56, 63, -2, 1 +&239, 98, 422, 132, 0, 63, 56, 2, 1 + +* Cuadro ampliando LCD -- Mejor ViSiOn !!! -- FuTuRe is an great GENIUS, isn't it ? +& 1, 140, 91, 165, 7, 56, 63, -2, 1, 65, 00 + & 4, 143, 87, 162, 7, 63, 56, 2, 1, 65, 00 + & 1, 170, 91, 359, 7, 56, 63, -2, 1, 65, 00 + & 4, 173, 87, 356, 0, 63, 56, 2, 1, 65, 00 + +& 96, 140, 231, 165, 7, 56, 63, -2, 1, 65, 00 + & 99, 143, 228, 162, 7, 63, 56, 2, 1, 65, 00 + & 96, 170, 231, 359, 7, 56, 63, -2, 1, 65, 00 + & 99, 173, 228, 356, 0, 63, 56, 2, 1, 65, 00 + +&236, 140, 425, 165, 7, 56, 63, -2, 1, 65, 00 + &239, 143, 422, 162, 7, 63, 56, 2, 1, 65, 00 + &236, 170, 425, 359, 7, 56, 63, -2, 1, 65, 00 + &239, 173, 422, 356, 0, 63, 56, 2, 1, 65, 00 + +| 4, 143, 2, 5, 0, 63, Direccin Instruccin Dato, + | 5, 144, 2, 5, 0, 0, Direccin Instruccin Dato, + + +// Barra de mensaje +& 0, 0, 565, 26, 7, 56, 63, -2, 1 +& 3, 3, 562, 23, 0, 63, 56, 2, 1 + + +$565, 0, 640, 26, 7, 56, 63, 2, 1, 00, 30 + +*!2, 44 +// Cuadro para entradas +& 0, 30, 320, 90, 7, 56, 63, -2, 1 +& 4, 34, 18, 86, 7, 63, 56, 0, 1 +| 4, 34, 2, 4, 1, 63, Entradas, +| 5, 35, 2, 4, 1, 0, Entradas, + + $ 20, 34, 45, 59, 7, 56, 63, 2, 1, 00, 00 * 48, 00 + $ 47, 34, 72, 59, 7, 56, 63, 2, 1, 00, 00 * 49, 00 + $ 74, 34, 99, 59, 7, 56, 63, 2, 1, 00, 00 * 50, 00 + $101, 34, 126, 59, 7, 56, 63, 2, 1, 00, 00 * 51, 00 + $128, 34, 153, 59, 7, 56, 63, 2, 1, 00, 00 * 52, 00 + $155, 34, 180, 59, 7, 56, 63, 2, 1, 00, 00 * 53, 00 + $182, 34, 207, 59, 7, 56, 63, 2, 1, 00, 00 * 54, 00 + $209, 34, 234, 59, 7, 56, 63, 2, 1, 00, 00 * 55, 00 + + $ 20, 61, 45, 86, 7, 56, 63, 2, 1, 00, 00 * 97, 00 + $ 47, 61, 72, 86, 7, 56, 63, 2, 1, 00, 00 * 98, 00 + $ 74, 61, 99, 86, 7, 56, 63, 2, 1, 00, 00 * 99, 00 + $101, 61, 126, 86, 7, 56, 63, 2, 1, 00, 00 *100, 00 + $128, 61, 153, 86, 7, 56, 63, 2, 1, 00, 00 *101, 00 + $155, 61, 180, 86, 7, 56, 63, 2, 1, 00, 00 *102, 00 + $182, 61, 207, 86, 7, 56, 63, 2, 1, 00, 00 *103, 00 + $209, 61, 234, 86, 7, 56, 63, 2, 1, 00, 00 *104, 00 + + + $236, 34, 261, 59, 3, 56, 63, 3, 1, 00, 00 + $263, 34, 288, 59, 3, 56, 63, 3, 1, 00, 00 + $290, 34, 315, 59, 3, 56, 63, 3, 1, 00, 00 + + $236, 61, 261, 86, 3, 56, 63, 3, 1, 00, 00 + $263, 61, 288, 86, 3, 56, 63, 3, 1, 00, 00 + $290, 61, 315, 86, 3, 56, 63, 3, 1, 00, 00 + + +// Cuadro para salidas +&321, 30, 640, 90, 7, 56, 63, -2, 1 +&325, 34, 339, 86, 7, 63, 56, 0, 1 +|325, 34, 2, 4, 1, 63, Salidas , +|326, 35, 2, 4, 1, 0, Salidas , + + $341, 34, 366, 59, 7, 56, 63, 2, 1, 00, 00 *00, 129 + $368, 34, 393, 59, 7, 56, 63, 2, 1, 00, 00 *00, 120 + $395, 34, 420, 59, 7, 56, 63, 2, 1, 00, 00 *00, 121 + $422, 34, 447, 59, 7, 56, 63, 2, 1, 00, 00 *00, 122 + $449, 34, 474, 59, 7, 56, 63, 2, 1, 00, 00 *00, 123 + $476, 34, 499, 59, 7, 56, 63, 2, 1, 00, 00 *00, 124 + $501, 34, 526, 59, 7, 56, 63, 2, 1, 00, 00 *00, 125 + $528, 34, 553, 59, 7, 56, 63, 2, 1, 00, 00 *00, 126 + + $341, 61, 366, 86, 7, 56, 63, 2, 1, 00, 00 *00, 127 + $368, 61, 393, 86, 7, 56, 63, 2, 1, 00, 00 *00, 128 + $395, 61, 420, 86, 7, 56, 63, 2, 1, 00, 00 *00, 30 + $422, 61, 447, 86, 7, 56, 63, 2, 1, 00, 00 *00, 48 + $449, 61, 474, 86, 7, 56, 63, 2, 1, 00, 00 *00, 46 + $476, 61, 499, 86, 7, 56, 63, 2, 1, 00, 00 *00, 32 + $501, 61, 526, 86, 7, 56, 63, 2, 1, 00, 00 *00, 18 + $528, 61, 553, 86, 7, 56, 63, 2, 1, 00, 00 *00, 33 + + $555, 34, 580, 59, 3, 56, 63, 3, 1, 00, 00 + $582, 34, 607, 59, 3, 56, 63, 3, 1, 00, 00 + $609, 34, 634, 59, 3, 56, 63, 3, 1, 00, 00 + + $555, 61, 580, 86, 3, 56, 63, 3, 1, 00, 00 + $582, 61, 607, 86, 3, 56, 63, 3, 1, 00, 00 + $609, 61, 634, 86, 3, 56, 63, 3, 1, 00, 00 + + + +*Boton Reset +$582, 364, 634, 388, 7, 56, 63, 2, 1, 00, 19 +*Boton Salvar + $582, 390, 607, 451, 7, 56, 63, 2, 1, 00, 38 +*Boton Cargar + $609, 390, 634, 451, 7, 56, 63, 2, 1, 00, 34 +*Boton Salir +$582, 453, 634, 478, 7, 56, 63, 2, 1, 00, 31 +*Boton Configurar + $555, 364, 580, 478, 7, 56, 63, 2, 1, 00, 46 + +*Recuadro para diagramas de tiempo y mensajes varios +& 1, 364, 550, 478, 12, 56, 63, 2, 1 +& 6, 369, 545, 473, 0, 63, 56, 2, 1 +&535, 100, 635, 130, 7, 56, 63, -2, 1, 00, 00 +$538, 103, 632, 127, 9, 56, 63, 2, 1, 00, 22 + +$500, 100, 530, 130, 7, 56, 63, 2, 1, 78, 00 +$465, 100, 495, 130, 7, 56, 63, 2, 1, 83, 00 +$430, 100, 460, 130, 7, 56, 63, 2, 1, 70, 00 + +$605, 135, 635, 165, 7, 56, 63, 2, 1, 72, 00 +$570, 135, 600, 165, 7, 56, 63, 2, 1, 82, 00 +$535, 135, 565, 165, 7, 56, 63, 2, 1, 84, 00 +$500, 135, 530, 165, 7, 56, 63, 2, 1, 67, 00 +$465, 135, 495, 165, 7, 56, 63, 2, 1, 79, 00 +$430, 135, 460, 165, 7, 56, 63, 2, 1, 65, 00 + +$605, 170, 635, 200, 7, 56, 63, 2, 1, 00, 24 +$570, 170, 600, 200, 7, 56, 63, 2, 1, 00, 35 +$535, 170, 565, 200, 7, 56, 63, 2, 1, 68, 00 +$500, 170, 530, 200, 7, 56, 63, 2, 1, 77, 00 +$465, 170, 495, 200, 7, 56, 63, 2, 1, 85, 00 +$430, 170, 460, 200, 7, 56, 63, 2, 1, 76, 00 + +$605, 205, 635, 235, 14, 56, 63, 2, 1, 00, 00 +$570, 205, 600, 235, 14, 56, 63, 2, 1, 00, 00 +$535, 205, 565, 235, 14, 56, 63, 2, 1, 00, 00 +$500, 205, 530, 235, 63, 56, 7, 2, 1, 57, 00 +$465, 205, 495, 235, 63, 56, 7, 2, 1, 56, 00 +$430, 205, 460, 235, 63, 56, 7, 2, 1, 55, 00 + +$605, 240, 635, 270, 14, 56, 63, 2, 1, 00, 00 +$570, 240, 600, 270, 14, 56, 63, 2, 1, 00, 83 +$535, 240, 565, 270, 14, 56, 63, 2, 1, 00, 00 +$500, 240, 530, 270, 63, 56, 7, 2, 1, 54, 00 +$465, 240, 495, 270, 63, 56, 7, 2, 1, 53, 00 +$430, 240, 460, 270, 63, 56, 7, 2, 1, 52, 00 + +$605, 275, 635, 305, 14, 56, 63, 2, 1, 00, 72 +$570, 275, 600, 305, 14, 56, 63, 2, 1, 00, 82 +$535, 275, 565, 305, 14, 56, 63, 2, 1, 00, 00 +$500, 275, 530, 305, 63, 56, 7, 2, 1, 51, 00 +$465, 275, 495, 305, 63, 56, 7, 2, 1, 50, 00 +$430, 275, 460, 305, 63, 56, 7, 2, 1, 49, 00 + +$605, 310, 635, 340, 14, 56, 63, 2, 1, 00, 80 +$570, 310, 600, 340, 14, 56, 63, 2, 1, 13, 00 +$535, 310, 565, 340, 14, 56, 63, 2, 1, 00, 00 +$500, 310, 530, 340, 63, 56, 7, 2, 1, 08, 00 +$430, 310, 460, 340, 63, 56, 7, 2, 1, 48, 00 + + * + * + * + * + * + * + * + * + +$430, 345, 530, 359, 7, 56, 63, 2, 1, 00, 00 +$535, 345, 635, 359, 7, 56, 63, 2, 1, 00, 00 + + +2 + +|570, 5, 2, 4, 0, 63, Acerca de..., +|571, 6, 2, 4, 0, 0, Acerca de..., + |570, 8, 2, 4, 0, 12, _, + |571, 9, 2, 4, 0, 0, _, + +|538, 104, 2, 6, 0, 12, R U N, +|539, 105, 2, 6, 0, 4, R U N, + |538, 107, 2, 6, 0, 12, _, + |539, 108, 2, 6, 0, 4, _, + + |582, 366, 2, 5, 0, 63, Reset, + |583, 367, 2, 5, 0, 0, Reset, + |582, 368, 2, 5, 0, 12, _, + |583, 369, 2, 5, 0, 0, _, + + |585, 395, 2, 5, 1, 63, Salvar, + |586, 396, 2, 5, 1, 0, Salvar, + |587, 395, 2, 5, 1, 12, _ , + |588, 396, 2, 5, 1, 0, _ , + + |612, 395, 2, 5, 1, 63, Cargar, + |613, 396, 2, 5, 1, 0, Cargar, + |616, 395, 2, 5, 1, 12, _ , + |617, 396, 2, 5, 1, 0, _ , + + |582, 455, 2, 5, 0, 63, Salir, + |583, 456, 2, 5, 0, 0, Salir, + |582, 457, 2, 5, 0, 12, _, + |583, 459, 2, 5, 0, 0, _, + + |558, 369, 2, 5, 1, 63, Configurar , + |559, 370, 2, 5, 1, 0, Configurar , + |560, 369, 2, 5, 1, 12, _ , + |561, 370, 2, 5, 1, 0, _ , + +* Comentario Botones Entradas +| 18, 37, 2, 5, 0, 63, 0, + | 19, 38, 2, 5, 0, 0, 0, +| 45, 37, 2, 5, 0, 63, 1, + | 46, 38, 2, 5, 0, 0, 1, +| 72, 37, 2, 5, 0, 63, 2, + | 73, 38, 2, 5, 0, 0, 2, +| 99, 37, 2, 5, 0, 63, 3, + |100, 38, 2, 5, 0, 0, 3, +|126, 37, 2, 5, 0, 63, 4, + |127, 38, 2, 5, 0, 0, 4, +|153, 37, 2, 5, 0, 63, 5, + |154, 38, 2, 5, 0, 0, 5, +|180, 37, 2, 5, 0, 63, 6, + |181, 38, 2, 5, 0, 0, 6, +|207, 37, 2, 5, 0, 63, 7, + |208, 38, 2, 5, 0, 0, 7, +|234, 37, 2, 5, 0, 63, 00, + |235, 38, 2, 5, 0, 0, 00, +|261, 37, 2, 5, 0, 63, 01, + |262, 38, 2, 5, 0, 0, 01, +|288, 37, 2, 5, 0, 63, 02, + |289, 38, 2, 5, 0, 0, 02, + +| 18, 64, 2, 5, 0, 63, 8, + | 19, 65, 2, 5, 0, 0, 8, +| 45, 64, 2, 5, 0, 63, 9, + | 46, 65, 2, 5, 0, 0, 9, +| 72, 64, 2, 5, 0, 63, 10, + | 73, 65, 2, 5, 0, 0, 10, +| 99, 64, 2, 5, 0, 63, 11, + |100, 65, 2, 5, 0, 0, 11, +|126, 64, 2, 5, 0, 63, 12, + |127, 65, 2, 5, 0, 0, 12, +|153, 64, 2, 5, 0, 63, 13, + |154, 65, 2, 5, 0, 0, 13, +|180, 64, 2, 5, 0, 63, 14, + |181, 65, 2, 5, 0, 0, 14, +|207, 64, 2, 5, 0, 63, 15, + |208, 65, 2, 5, 0, 0, 15, +|234, 64, 2, 5, 0, 63, 03, + |235, 65, 2, 5, 0, 0, 03, +|261, 64, 2, 5, 0, 63, 04, + |262, 65, 2, 5, 0, 0, 04, +|288, 64, 2, 5, 0, 63, 19, + |289, 65, 2, 5, 0, 0, 19, + +* Comentario Botones Salidas +|339, 37, 2, 5, 0, 63, 0, + |340, 38, 2, 5, 0, 0, 0, +|366, 37, 2, 5, 0, 63, 1, + |367, 38, 2, 5, 0, 0, 1, +|393, 37, 2, 5, 0, 63, 2, + |394, 38, 2, 5, 0, 0, 2, +|420, 37, 2, 5, 0, 63, 3, + |421, 38, 2, 5, 0, 0, 3, +|447, 37, 2, 5, 0, 63, 4, + |448, 38, 2, 5, 0, 0, 4, +|474, 37, 2, 5, 0, 63, 5, + |475, 38, 2, 5, 0, 0, 5, +|499, 37, 2, 5, 0, 63, 6, + |500, 38, 2, 5, 0, 0, 6, +|526, 37, 2, 5, 0, 63, 7, + |527, 38, 2, 5, 0, 0, 7, +|553, 37, 2, 5, 0, 63, 05, + |554, 38, 2, 5, 0, 0, 05, +|580, 37, 2, 5, 0, 63, 06, + |581, 38, 2, 5, 0, 0, 06, +|607, 37, 2, 5, 0, 63, 07, + |608, 38, 2, 5, 0, 0, 07, + +|339, 64, 2, 5, 0, 63, 8, + |340, 65, 2, 5, 0, 0, 8, +|366, 64, 2, 5, 0, 63, 9, + |367, 65, 2, 5, 0, 0, 9, +|393, 64, 2, 5, 0, 63, 10, + |394, 65, 2, 5, 0, 0, 10, +|420, 64, 2, 5, 0, 63, 11, + |421, 65, 2, 5, 0, 0, 11, +|447, 64, 2, 5, 0, 63, 12, + |448, 65, 2, 5, 0, 0, 12, +|474, 64, 2, 5, 0, 63, 13, + |475, 65, 2, 5, 0, 0, 13, +|499, 64, 2, 5, 0, 63, 14, + |500, 65, 2, 5, 0, 0, 14, +|526, 64, 2, 5, 0, 63, 15, + |527, 65, 2, 5, 0, 0, 15, +|553, 64, 2, 5, 0, 63, 08, + |554, 65, 2, 5, 0, 0, 08, +|580, 64, 2, 5, 0, 63, 09, + |581, 65, 2, 5, 0, 0, 09, +|607, 64, 2, 5, 0, 63, 10, + |608, 65, 2, 5, 0, 0, 10, + +* Texto Botones consola de mandos + +|434, 105, 2, 5, 0, 63, FUN, + |435, 106, 2, 5, 0, 0, FUN, + |434, 107, 2, 5, 0, 63, _, + |435, 108, 2, 5, 0, 0, _, +|469, 105, 2, 5, 0, 63, SFT, + |470, 106, 2, 5, 0, 0, SFT, + |469, 107, 2, 5, 0, 63, _, + |470, 108, 2, 5, 0, 0, _, +|505, 105, 2, 5, 0, 63, NOT, + |506, 106, 2, 5, 0, 0, NOT, + |505, 107, 2, 5, 0, 63, _, + |506, 108, 2, 5, 0, 0, _, + +|433, 140, 2, 5, 0, 63, AND OR CNT, + |434, 141, 2, 5, 0, 0, AND OR CNT, + |433, 142, 2, 5, 0, 63, _ _ _, + |434, 143, 2, 5, 0, 0, _ _ _, + +|544, 140, 2, 5, 0, 63, TR LR, + |545, 141, 2, 5, 0, 0, TR LR, + |544, 142, 2, 5, 0, 63, _ _, + |545, 143, 2, 5, 0, 0, _ _, + +|614, 140, 2, 5, 0, 63, HR, + |614, 141, 2, 5, 0, 0, HR, + |614, 142, 2, 5, 0, 63, _, + |614, 143, 2, 5, 0, 0, _, + +|430, 175, 2, 5, 0, 63, LD OUT, + |431, 176, 2, 5, 0, 0, LD OUT, + |430, 177, 2, 5, 0, 63, _ _, + |431, 178, 2, 5, 0, 0, _ _, + +|505, 175, 2, 5, 0, 63, TIM, + |506, 176, 2, 5, 0, 0, TIM, + |505, 175, 2, 5, 0, 63, _, + |506, 176, 2, 5, 0, 0, _, +|544, 175, 2, 5, 0, 63, DM CH, + |545, 176, 2, 5, 0, 0, DM CH, + |544, 177, 2, 5, 0, 63, _, + |545, 178, 2, 5, 0, 0, _, + |544, 177, 2, 5, 0, 12, _, + |545, 178, 2, 5, 0, 0, _, + +|609, 177, 2, 4, 0, 63, CONT, + |609, 178, 2, 4, 0, 0, CONT, + |609, 179, 2, 4, 0, 12, _, + |609, 180, 2, 4, 0, 0, _, + +|440, 215, 2, 5, 0, 22, 7 9, + |441, 216, 2, 5, 0, 0, 7 9, +|437, 215, 2, 5, 0, 22, 8, + |438, 216, 2, 5, 0, 0, 8, + +|539, 210, 2, 5, 0, 22, EXT, + |540, 211, 2, 5, 0, 0, EXT, + +|543, 210, 2, 5, 0, 22, CHG, + |544, 211, 2, 5, 0, 0, CHG, +|609, 212, 2, 4, 0, 22, SCRH, + |609, 213, 2, 4, 0, 0, SCRH, + +|428, 242, 2, 4, 0, 0, E F, + |429, 243, 2, 4, 0, 7, E F, +|440, 250, 2, 5, 0, 22, 4 6, + |441, 251, 2, 5, 0, 0, 4 6, +|437, 250, 2, 5, 0, 22, 5, + |438, 251, 2, 5, 0, 0, 5, + +|539, 242, 2, 4, 0, 22, PLAY, + |540, 243, 2, 4, 0, 0, PLAY, + |538, 248, 2, 4, 0, 22,, + |538, 249, 2, 4, 0, 0,, +|542, 255, 2, 4, 0, 22, SET, + |543, 256, 2, 4, 0, 0, SET, + +|543, 245, 2, 5, 0, 22, DEL, + |544, 246, 2, 5, 0, 0, DEL, +|609, 247, 2, 4, 0, 22, MONT, + |609, 248, 2, 4, 0, 0, MONT, + +|428, 277, 2, 4, 0, 0, B C D, + |429, 278, 2, 4, 0, 7, B C D, +|440, 285, 2, 5, 0, 22, 1 3, + |441, 286, 2, 5, 0, 0, 1 3, +|437, 285, 2, 5, 0, 22, 2, + |438, 286, 2, 5, 0, 0, 2 , + +|539, 280, 2, 5, 0, 22, REC, + |540, 281, 2, 5, 0, 0, REC, + + +|535, 280, 2, 5, 0, 22, INS UP, + |536, 281, 2, 5, 0, 0, INS UP, + +|428, 312, 2, 4, 0, 0, A, + |429, 313, 2, 4, 0, 7, A, +|440, 320, 2, 5, 0, 22, 0, + |441, 321, 2, 5, 0, 0, 0, + +|505, 315, 2, 5, 0, 22, CLR, + |506, 316, 2, 5, 0, 0, CLR, +|507, 315, 2, 5, 0, 22, VER, + |508, 316, 2, 5, 0, 0, VER, +|538, 317, 2, 4, 0, 22, WRIT DOWN, + |539, 318, 2, 4, 0, 0, WRIT DOWN, + +|538, 317, 2, 4, 0, 22, DOWN, + |539, 318, 2, 4, 0, 0, DOWN, + +|430, 345, 2, 4, 0, 63, Debug Code, + |431, 346, 2, 4, 0, 0, Debug Code, +|533, 345, 2, 4, 0, 63, Reset Valores, + |534, 346, 2, 4, 0, 0, Reset Valores, + + + +*********>>>>>> <<<<<<<<>>>>>>>>>> <<<<<<<********** +*|242, 100, 2, 5, 0, 6, 0000 And Not Tim xxxx, +*|373, 115, 2, 5, 0, 6, n 0000, +**&239, 98, 422, 132, 0, 63, 56, 2, 1 +**********>>>>>> <<<<<<<<>>>>>>>>>> <<<<<<<********** + + +!2, 31 + + * Botones para seleccionar Entrada en canal + $ 20, 34, 45, 59, 7, 56, 63, 2, 1, 00, 00 + $ 47, 34, 72, 59, 7, 56, 63, 2, 1, 00, 00 + $ 74, 34, 99, 59, 7, 56, 63, 2, 1, 00, 00 + $101, 34, 126, 59, 7, 56, 63, 2, 1, 00, 00 + $128, 34, 153, 59, 7, 56, 63, 2, 1, 00, 00 + $155, 34, 180, 59, 7, 56, 63, 2, 1, 00, 00 + $182, 34, 207, 59, 7, 56, 63, 2, 1, 00, 00 + $209, 34, 234, 59, 7, 56, 63, 2, 1, 00, 00 + + $ 20, 61, 45, 86, 7, 56, 63, 2, 1, 00, 00 + $ 47, 61, 72, 86, 7, 56, 63, 2, 1, 00, 00 + $ 74, 61, 99, 86, 7, 56, 63, 2, 1, 00, 00 + $101, 61, 126, 86, 7, 56, 63, 2, 1, 00, 00 + $128, 61, 153, 86, 7, 56, 63, 2, 1, 00, 00 + $155, 61, 180, 86, 7, 56, 63, 2, 1, 00, 00 + $182, 61, 207, 86, 7, 56, 63, 2, 1, 00, 00 + $209, 61, 234, 86, 7, 56, 63, 2, 1, 00, 00 + + + * Botones de secuencia para Entrada + $236, 34, 261, 59, 3, 56, 63, 3, 1, 00, 00 + $263, 34, 288, 59, 3, 56, 63, 3, 1, 00, 00 + $290, 34, 315, 59, 3, 56, 63, 3, 1, 00, 00 + + $236, 61, 261, 86, 3, 56, 63, 3, 1, 00, 00 + $263, 61, 288, 86, 3, 56, 63, 3, 1, 00, 00 + $290, 61, 315, 86, 3, 56, 63, 3, 1, 00, 00 + + + * Botones de secuencia para Salidas + $555, 34, 580, 59, 3, 56, 63, 3, 1, 00, 00 + $582, 34, 607, 59, 3, 56, 63, 3, 1, 00, 00 + $609, 34, 634, 59, 3, 56, 63, 3, 1, 00, 00 + + $555, 61, 580, 86, 3, 56, 63, 3, 1, 00, 00 + $582, 61, 607, 86, 3, 56, 63, 3, 1, 00, 00 + $609, 61, 634, 86, 3, 56, 63, 3, 1, 00, 00 + + * Boton STOP + $538, 103, 632, 127, 9, 56, 63, 2, 1, 00, 31 + * Botones Up / Down + $605, 275, 635, 305, 14, 56, 63, 2, 1, 00, 72 + $605, 310, 635, 340, 14, 56, 63, 2, 1, 00, 80 + + +// Secuencia que reescribe STOP +3 + &538, 103, 632, 127, 9, 56, 63, 2, 1, 00, 22 + |538, 104, 2, 6, 0, 12, S T O P, + |539, 105, 2, 6, 0, 4, S T O P, + |538, 107, 2, 6, 0, 12, _, + |539, 108, 2, 6, 0, 4, _, + +// Secuencia que reescribe RUN +4 + &538, 103, 632, 127, 9, 56, 63, 2, 1, 00, 22 + |538, 104, 2, 6, 0, 12, R U N, + |539, 105, 2, 6, 0, 4, R U N, + |538, 107, 2, 6, 0, 12, _, + |539, 108, 2, 6, 0, 4, _, + + + + +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 + + + +* 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, +, + + + +!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 + +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** +* Configuracin +!5,22 +20 +$ 15, 380, 25, 390, 0, 7, 7, 3, 0, 82, 00 +$ 15, 405, 25, 415, 0, 7, 7, 3, 0, 73, 00 +$ 15, 430, 25, 440, 0, 7, 7, 3, 0, 80, 00 +$ 15, 455, 25, 465, 0, 7, 7, 3, 0, 77, 00 + |15, 380, 2, 5, 0, 4, RETROCEDER... Colores >>> >> >, + |14, 383, 2, 5, 0, 63, _, + |15, 405, 2, 5, 0, 4, Usar INT 8 [ Ejecucin TURBO ], + |14, 408, 2, 5, 0, 63, _, + |15, 430, 2, 5, 0, 4, Usar PC_Out [ Interfaz PC <> Out ], + |14, 433, 2, 5, 0, 63, _, + |15, 455, 2, 5, 0, 4, Mostrar Diagramas de Tiempo, + |14, 458, 2, 5, 0, 63, _, + +$315, 380, 325, 390, 0, 7, 7, 3, 0, 84, 00 +$315, 395, 325, 405, 0, 7, 7, 3, 0, 83, 00 +$315, 410, 325, 420, 0, 7, 7, 3, 0, 86, 00 + |315, 380, 2, 5, 0, 12, Texto >, + |314, 383, 2, 5, 0, 63, _, + |315, 395, 2, 5, 0, 12, Texto Sealado >, + |314, 398, 2, 5, 0, 63, _, + |315, 410, 2, 5, 0, 12, Visor LCD >, + |314, 413, 2, 5, 0, 63, _, + + + +$ 496, 380, 506, 390, 1, 56, 63, 0, 0, 00, 00 +$ 496, 392, 506, 402, 2, 56, 63, 0, 0, 00, 00 +$ 496, 402, 506, 412, 3, 56, 63, 0, 0, 00, 00 +$ 496, 414, 506, 424, 4, 56, 63, 0, 0, 00, 00 +$ 496, 426, 506, 436, 5, 56, 63, 0, 0, 00, 00 + +$ 508, 380, 518, 390, 6, 56, 63, 0, 0, 00, 00 +$ 508, 392, 518, 402, 7, 56, 63, 0, 0, 00, 00 +$ 508, 402, 518, 412, 8, 56, 63, 0, 0, 00, 00 +$ 508, 414, 518, 424, 9, 56, 63, 0, 0, 00, 00 +$ 508, 426, 518, 436, 10, 56, 63, 0, 0, 00, 00 + +$ 520, 380, 530, 390, 11, 56, 63, 0, 0, 00, 00 +$ 520, 392, 530, 402, 12, 56, 63, 0, 0, 00, 00 +$ 520, 402, 530, 412, 13, 56, 63, 0, 0, 00, 00 +$ 520, 414, 530, 424, 14, 56, 63, 0, 0, 00, 00 +$ 520, 426, 530, 436, 15, 56, 63, 0, 0, 00, 00 + +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** +***************************************************************************** + + +200 +& 200, 212, 440, 267, 12, 63, 56, 2, 1 +& 205, 217, 435, 262, 7, 56, 63, 2, 1 +| 210, 222, 2, 5, 0, 240, ERROR ABRIENDO FICHERO, +| 210, 242, 2, 5, 0, 240, OPERACION ABORTADA, + +300 +& 200, 212, 440, 267, 12, 63, 56, 2, 1 +& 205, 217, 435, 262, 7, 56, 63, 2, 1 +| 210, 222, 2, 5, 0, 240, P L C (c) 1995 v 2.0, +| 210, 242, 2, 5, 0, 240, Jos David Guilln.., + +500 +& 200, 212, 440, 267, 12, 63, 56, 2, 1 +& 205, 217, 435, 262, 7, 56, 63, 2, 1 +| 210, 222, 2, 5, 0, 240, Programa no tiene FUN, +| 210, 242, 2, 5, 0, 240, ERROR EN LA EJECUCIN..., + +501 +& 200, 212, 440, 267, 12, 63, 56, 2, 1 +& 205, 217, 435, 262, 7, 56, 63, 2, 1 +| 210, 222, 2, 5, 0, 240, Se encontro una funcin, +| 210, 242, 2, 5, 0, 240, no reconocida por PLC..., diff --git a/PLC.DSK b/PLC.DSK new file mode 100644 index 0000000..c9966c7 Binary files /dev/null and b/PLC.DSK differ diff --git a/PLC.EXE b/PLC.EXE new file mode 100644 index 0000000..5f46962 Binary files /dev/null and b/PLC.EXE differ diff --git a/PLC.H b/PLC.H new file mode 100644 index 0000000..d4ecb06 --- /dev/null +++ b/PLC.H @@ -0,0 +1,257 @@ +#include + +// Estas macros son para los botones a cada +// boton, Make_Boton le asigna un nmero ID +// y es mucho mas sencillo utilizar un nombre +// que un nmero... +#define B_In0 2 +#define B_In1 3 +#define B_In2 4 +#define B_In3 5 +#define B_In4 6 +#define B_In5 7 +#define B_In6 8 +#define B_In7 9 +#define B_In8 10 +#define B_In9 11 +#define B_In10 12 +#define B_In11 13 +#define B_In12 14 +#define B_In13 15 +#define B_In14 16 +#define B_In15 17 + // Seleccin de canales de entrada ( 19xx Datos internos ) + #define B_Ch00_In 18 + #define B_Ch01_In 19 + #define B_Ch02_In 20 + #define B_Ch03_In 21 + #define B_Ch04_In 22 + #define B_Ch19_In 23 +#define B_Out0 24 +#define B_Out1 25 +#define B_Out2 26 +#define B_Out3 27 +#define B_Out4 28 +#define B_Out5 29 +#define B_Out6 30 +#define B_Out7 31 +#define B_Out8 32 +#define B_Out9 33 +#define B_Out10 34 +#define B_Out11 35 +#define B_Out12 36 +#define B_Out13 37 +#define B_Out14 38 +#define B_Out15 39 + // Seleccin de canales de entrada ( 19xx Datos internos ) + #define B_Ch00_Out 40 + #define B_Ch01_Out 41 + #define B_Ch02_Out 42 + #define B_Ch03_Out 43 + #define B_Ch04_Out 44 + #define B_Ch19_Out 45 +#define B_AcercaDe 1 +#define B_Fun 54 +#define B_Sft 53 +#define B_Not 52 +#define B_Run 51 +#define B_And 60 +#define B_Or 59 +#define B_Cnt 58 +#define B_Tr 57 +#define B_Lr 56 +#define B_Hr 55 +#define B_Ld 66 +#define B_Out 65 +#define B_Tim 64 +#define B_Dm 63 +#define B_Ch 62 +#define B_Cont 61 +#define B_7 72 +#define B_8 71 +#define B_9 70 +#define B_Ext 69 +#define B_Chg 68 +#define B_Scrh 67 +#define B_4 78 +#define B_5 77 +#define B_6 76 +#define B_Play 75 +#define B_Del 74 +#define B_Mont 73 +#define B_1 84 +#define B_2 83 +#define B_3 82 +#define B_Rec 81 +#define B_Ins 80 +#define B_Up 79 +#define B_0 89 +#define B_Clr 88 +#define B_Ver 87 +#define B_Write 86 +#define B_Down 85 +#define B_DebugCode 90 +#define B_ResetValores 91 +#define B_Configurar 50 +#define B_Reset 46 +#define B_Salvar 47 +#define B_Cargar 48 +#define B_Salir 49 + +///////////////// Una vez que estemos en el modo RUN +#define R_In0 1 +#define R_In1 2 +#define R_In2 3 +#define R_In3 4 +#define R_In4 5 +#define R_In5 6 +#define R_In6 7 +#define R_In7 8 +#define R_In8 9 +#define R_In9 10 +#define R_In10 11 +#define R_In11 12 +#define R_In12 13 +#define R_In13 14 +#define R_In14 15 +#define R_In15 16 + // Seleccin de canales de entrada ( 19xx Datos internos ) + #define R_Ch00_In 17 + #define R_Ch01_In 18 + #define R_Ch02_In 19 + #define R_Ch03_In 20 + #define R_Ch04_In 21 + #define R_Ch19_In 22 + // Seleccin de canales de entrada ( 19xx Datos internos ) + #define R_Ch00_Out 23 + #define R_Ch01_Out 24 + #define R_Ch02_Out 25 + #define R_Ch03_Out 26 + #define R_Ch04_Out 27 + #define R_Ch19_Out 28 +#define R_Stop 29 +#define R_Up 30 +#define R_Down 31 + + + + +// +// Nmero de Entradas y Salidas +// +#define Numero_In 16 +#define Numero_Out 16 +#define Numero_Tim 48 +#define Numero_Tmp 8 + +// +// Aqui estan definido los nombres de todos los comandos +// y su _ID correspondiente. El programa debe guiarse por +// estos cdigos... +// +#define ReadNop 0 // No Opera +#define Ld 1 // Inicio de bloque +#define Or 2 // Funcion Or +#define And 3 // Funcion And +#define _Out 4 // Inicia salida +#define Tim 5 // Temporizador +#define Cnt 6 // Contador +// #define _Tr 7 // Rel Temporal (No se considera FUNCION) +#define Fun 99 // Las siguientes macros son las + // funciones dentro de FUN + #define End 101 // Final de programa + // No he tenido ocacin de comprobar el funcionamiento + // de las dos siguientes instrucciones en un Automata. + // Por lo que no comprendo bien su funcionamiento lgico. + #define Il 102 // Instruccin de condicin + #define Ilc 103 // Instruccin fin de condicin + + #define Sft 110 // Registro de desplazamiento + #define Keep 111 // Switch biestable ( Rel Latch ) + + #define DifU 113 // Activador en el flanco de subida + #define DifD 114 // Activador en el flanco de bajada + #define TimH 115 // Temporizador de alta velocidad + #define Cmp 120 // Comparador + #define Mov 121 // Move + #define Mvn 122 // Move Not + #define Add 130 // Add (Suma en BCD) + #define Sub 131 // Subtract ( Resta en BCD ) + #define Stc 140 // Introduce un 1 en el flag de acarreo + #define Clc 141 // Borra el flag de acarreo +// Macros para los parametros y parametros compuestos +#define P_void 0 // Sin parametro activo +#define P_Ld 1 // Fusin de bloques +#define P_Tr 2 // +#define P_Hr 3 // Reles internos +#define P_Cnt 4 // +#define P_Tim 5 // Utiliza estado del temporizador +#define P_Keep 6 // Utiliza estado del biestable ( Rel Latch ) +#define P_Not 7 // Negacin del dato Entrada +#define P_Not_Tr 8 // Negacin del dato Rel Temporal +#define P_Not_Hr 9 // Negacin del dato Rel Interno +#define P_Not_Cnt 10 // Negacin del dato Contador +#define P_Not_Tim 11 // Negacin del dato Temporizador +#define P_Keep_Hr 12 // Keep Guardando valores +#define P_Tim_Data 13 // Dato TIM/TIMH/CNT (inutil en v2.0) +#define P_Out 14 // Carga una salida + + +int Menu_Edicion(void) ; +void Reset_Programa(void) ; +void Resetea_Memoria(void) ; +int InicializaMemoria(void) ; +int CargaEntornoGrafico(void) ; +void ReImprimeCanal_In(int Canal) ; +void ReImprimeCanal_Out(int Canal) ; +void Abandona_Programa(char *texto, long valor) ; + +typedef struct { + unsigned int Bit : 1; // Bariable de tamao 1 bit +} Puertas; + +typedef struct { + + Puertas In [Numero_In] [6]; // 16 Entradas x 6 canales.. + Puertas Out [Numero_Out] [6]; // 16 Salidas x 6 canales.. + Puertas Hr [Numero_Out] [10]; // 16 Reles internos x 9 canales.. + Puertas Ri [Numero_Out][10]; // Reles internos volatiles....... + Puertas Tr [Numero_Tmp] ; // 8 Reles temporales............... + Puertas _Ld [200]; //200 Ld's........................... + Puertas _Cnt [Numero_Tim] ; // 47 Biestable lgico con pulsacin. + Puertas _Tim [Numero_Tim] ; // 47 Logica temporizacin........... +// Puertas Bt [3]; // 3 Preestados lgicos de Tiempo... + clock_t Contador_de_Tiempo[3]; // 3 Cronmetros de inicio para Bt.. + int Tim_Cnt [Numero_Tim] ; // 47 Comprobadores temporizacin.... + + Puertas Pre_Ld [9999]; // Preestados lgicos a los LD's.... + +} MemoriaRam; + +typedef struct { + + unsigned char Comando; + unsigned char Parametros; + + unsigned int Dato; + unsigned int SubDato; + +} FirmWare; + + +struct Colores { + char Texto; + char F_Texto; + char VisorLCD; +}; + +typedef struct { + + struct Colores Colores; + Puertas PcOut; + Puertas TimeFlow; + Puertas Int8; + +} Configuracion; + +// extern int Fichero_bot(char Dinamicos_Estaticos); diff --git a/PLC.PRJ b/PLC.PRJ new file mode 100644 index 0000000..a168248 Binary files /dev/null and b/PLC.PRJ differ diff --git a/PLC_ACER.CPP b/PLC_ACER.CPP new file mode 100644 index 0000000..0098a1f --- /dev/null +++ b/PLC_ACER.CPP @@ -0,0 +1,152 @@ +#include + +#include +#include +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON +//extern int Fichero_bot(char Dinamicos_Estaticos); + +void Acerca_de( void ); +void Circulos3(int PosX, int PosY, int RadioX, int RadioY, int Velocidad); + +void Acerca_de( void ) +{ + + void *Imagen; + +while(kbhit()) getch(); + setfillstyle(SOLID_FILL, 0); + bar( 9, 372, 542, 471); + + if ( (Imagen = malloc( JD_imagesize(200, 212, 440, 267) ) ) == NULL ) { + Espera_Tecla_o_Raton(); + Anclar_Raton(); + return; + } else { + getimage( 200, 212, 440, 267, Imagen ); + Imprime_Estaticos( 300, "PLC.DAT"); +// Fichero_bot(300); + + +Circulos3( 269 + 6, 52 + 369, /*48*/80, 48, 5); + + putimage( 200, 212, Imagen, COPY_PUT); + free(Imagen); + + setfillstyle(SOLID_FILL, 0); + bar( 9, 372, 542, 471); + + while(kbhit()) getch(); + + return; + } + + +} + +void Circulos3(int PosX, int PosY, int RadioX, int RadioY, int Velocidad){ + +// Circulo con apariencia de 3D, por: Jos David Guilln + +int x=RadioX, + y=0, + oldx=RadioX, oldx2 = RadioX, oldx3 = RadioX, + oldy=RadioY, oldy2 = RadioY, oldy3 = RadioY, + // giroX = 0, + // vezX = 0, + cicloX = 1, + // giroY = 0, + // vezY = 0, + cicloY = 1, + Angulo = 0; + char c=8; + + +do{ + setcolor(0); + ellipse(PosX, PosY, 0+ Angulo, 360+ Angulo, abs(oldx), RadioY ); + ellipse(PosX, PosY, 0/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(oldy) ); + + +/*if(giroX==1)*//*{*/ setcolor(c/*56*/);// else setcolor(c+1/*63*/); +/// ellipse(PosX, PosY, 90+ Angulo, 270+ Angulo, abs(x), /*abs(y)*/50 ); +ellipse(PosX, PosY, 0+ Angulo, 90+ Angulo, abs(x), RadioY ); +ellipse(PosX, PosY, 180+ Angulo, 270+ Angulo, abs(x), RadioY ); +/*if(giroY==1)*/ setcolor(c/*56*/);// else setcolor(c+1/*63*/); +/// ellipse(PosX, PosY, 0+ Angulo, 180+ Angulo, /*abs(y)*/50, abs(x) ); +ellipse(PosX, PosY, 90/*+*/- Angulo, 180/*+*/- Angulo, RadioX, abs(y)); +ellipse(PosX, PosY, 270/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(y) ); + + +/*if(giroX==1) */ setcolor(c+1/*63*/); // else setcolor(c/*56*/); +/// ellipse(PosX, PosY, 270+ Angulo, 90+ Angulo, abs(x), /*abs(y)*/50 ); +ellipse(PosX, PosY, 90+ Angulo, 180+ Angulo, abs(x), RadioY ); +ellipse(PosX, PosY, 270+ Angulo, 360+ Angulo, abs(x), RadioY ); + +/*if(giroY==1) */setcolor(c+1/*63*/);// else setcolor(c/*56*/); +/// ellipse(PosX, PosY, 180+ Angulo, 360+ Angulo, /*abs(y)*/50, abs(x) ); +ellipse(PosX, PosY, 0/*+*/- Angulo, 90/*+*/- Angulo, RadioX, abs(y) ); +ellipse(PosX, PosY, 180/*+*/- Angulo, 270/*+*/- Angulo, RadioX, abs(y) ); + + oldx = oldx2; + oldx2 = oldx3; + oldx3 = x; + + oldy = oldy2; + oldy2 = oldy3; + oldy3 = y; + + x--; + if(x<=-(RadioX-1) ) x=RadioX; + y--; + if(y<=-(RadioY-1) ) y=RadioY; + +if(cicloX == 0 && x == RadioX ) { cicloX = 1; //vezX = 0; + c++; if (c==14) c=9; +} else +if(cicloX == 1 && x == RadioX ) { cicloX = 0;// vezX = 1; +} + + +//if(vezX==0){ +// if(x<0) giroX=1; else giroX=0; +//} +//if(vezX==1){ +// if(x<0) giroX=0; else giroX=1; +//} + +if(cicloY == 0 && y == RadioY ) { cicloY = 1; //vezY = 0; // c++; if (c==14) c=1; +} else +if(cicloY == 1 && y == RadioY ) { cicloY = 0; //vezY = 1; +} + +/* +if(vezY==0){ + if(y<0) giroY=1; else giroY=0; +} +if(vezY==1){ + if(y<0) giroY=0; else giroY=1; +} +*/ + + + +// delay(20); + Angulo++; + Angulo+= Velocidad; if( Angulo== (360 + 180) ) Angulo=0; + +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// +//giroX = 1; +//giroY = 1; +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// + +}while(!kbhit()); + +} diff --git a/PLC_EDIT.CPP b/PLC_EDIT.CPP new file mode 100644 index 0000000..dfbeed6 --- /dev/null +++ b/PLC_EDIT.CPP @@ -0,0 +1,1804 @@ +#include + +#include + +#include +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON +#include "PLC.h" + + +extern void Acerca_de( void ); +extern MemoriaRam *Ram; +extern FirmWare far *Programa; + +extern void Run(void); +extern char Optar( char *texto1, char *texto2, char *texto3 ); +char file_browser( char *comodin_name, char *texto1, char Cargar_Salvar ); + +int Muestra_Mensaje(int Mensaje, char *file); + +void BEEP(void) ; +void UpRow(void) ; +void DownRow(void) ; +void Configurar(void) ; +void BuscarItem(void) ; +void GetProgram(void) ; +void SendProgram(void) ; +void LoadProgram(void) ; +void WriteProgram(void) ; +void PrintWholeScreen (void) ; +int Select_Columna_Up(void) ; +int Select_Columna_Down(void) ; +void Numero_Pulsado(char numero) ; +void DelRow( void ) ; +void AddRow( char Arriba_Abajo ) ; +void PrintCurrLine ( char Oculta_Mark, char Ultima ) ; +void PrintVisorLCD ( char Ultima ) ; +void MuestraLCD( char *texto1, char *texto2) ; + +Configuracion CFG; + +void CFG_File( char Cargar_Salvar ); +#define Salvar 1 +#define Cargar 2 + + +char Buffer_Teclado[16], BT = 0; + +Puertas DebugCode; + + + int CurrRow = 0, + CurrTopLine = 0; + char CurrCol = 0; + + char CurrCh_In = 0, + CurrCh_Out = 0; + +int Menu_Edicion(void){ + + int Boton_Pulsado, ok = 0; + + + +PrintWholeScreen (); +CurrRow = 0; CurrTopLine = 0; +PrintCurrLine(1, 0); +PrintVisorLCD ( 0 ); + +do{ + Boton_Pulsado = Comprueba_Secuencia( 1 ); + switch( Boton_Pulsado ) { // Iniciamos comprobacion + + case 0: // No se pulso ningun BOTON + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + Anclar_Raton(); + break; + case -1: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + case -2: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + case B_In0 : + case B_In1 : + case B_In2 : + case B_In3 : + case B_In4 : + case B_In5 : + case B_In6 : + case B_In7 : + case B_In8 : + case B_In9 : + case B_In10 : + case B_In11 : + case B_In12 : + case B_In13 : + case B_In14 : + case B_In15 : + if ( CurrCh_In != (5) ) { + if ( Ram -> In[Boton_Pulsado - B_In0][CurrCh_In].Bit == 1 ) { +// Ram -> CoIn[Boton_Pulsado - B_In0 ][CurrCh_In].Bit = Ram -> In[Boton_Pulsado - B_In0 ][CurrCh_In].Bit; + Ram -> In[Boton_Pulsado - B_In0 ][CurrCh_In].Bit = 0; + Imprime_Bordes(1, Boton_Pulsado, -1); + } else { +// Ram -> CoIn[Boton_Pulsado - B_In0 ][CurrCh_In].Bit = Ram -> In[Boton_Pulsado - B_In0 ][CurrCh_In].Bit; + Ram -> In[Boton_Pulsado - B_In0 ][CurrCh_In].Bit = 1; + Imprime_Bordes(1, Boton_Pulsado, 2); + } + } + break; + case B_Ch00_In : + case B_Ch01_In : + case B_Ch02_In : + case B_Ch03_In : + case B_Ch04_In : + case B_Ch19_In : + Imprime_Bordes(1, (CurrCh_In + B_Ch00_In ), -1); + CurrCh_In = ( Boton_Pulsado - B_Ch00_In ); + Imprime_Bordes(1, Boton_Pulsado, 4); + ReImprimeCanal_In(CurrCh_In); + break; + case B_Ch00_Out : + case B_Ch01_Out : + case B_Ch02_Out : + case B_Ch03_Out : + case B_Ch04_Out : + case B_Ch19_Out : + Imprime_Bordes(1, (CurrCh_Out + B_Ch00_Out ), -1); + CurrCh_Out = ( Boton_Pulsado - B_Ch00_Out ); + Imprime_Bordes(1, Boton_Pulsado, 4); + ReImprimeCanal_Out(CurrCh_Out); + break; + case B_AcercaDe : + Acerca_de(); + break; + case B_Fun : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + Programa[10000].Comando = Fun; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } + break; + case B_Sft : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + Programa[10000].Comando = Sft; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + CurrCol = 1; + } + break; + case B_Not : +// gotoxy(1,1); printf("Not %3d", Boton_Pulsado); + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un NOT + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + case _Out : + Programa[10000].Parametros = P_Not; + break; + default: + break; + } + } + break; + case B_Run : + BT = 0; + Run(); +// gotoxy(1,1); printf("Run %3d", Boton_Pulsado); + break; + case B_And : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + Programa[10000].Comando = And; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } + break; + case B_Or : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + Programa[10000].Comando = Or; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } + break; + case B_Cnt : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un Cnt + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + if ( Programa[10000].Parametros == P_Not ) + Programa[10000].Parametros = P_Not_Cnt; + else if ( Programa[10000].Parametros == 0 ) + Programa[10000].Parametros = P_Cnt; + else { + Programa[10000].Comando = Cnt; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + CurrCol = 1; + } + break; + default: + Programa[10000].Comando = Cnt; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + CurrCol = 1; + break; + } + } + break; + case B_Tr : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un Tr + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + case _Out : + if ( Programa[10000].Parametros == P_Not ) + Programa[10000].Parametros = P_Not_Tr; + else if ( Programa[10000].Parametros == 0 ) + Programa[10000].Parametros = P_Tr; +/* + else { + Programa[10000].Comando = _Tr; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } +*/ + break; + default: + break; + } + } + break; + case B_Lr : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + } + break; + case B_Hr : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; +// gotoxy(1,1); printf("Hr %3d", Boton_Pulsado); + // Funciones que admiten un Hr + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + case _Out : + case Keep : + case DifU : + case DifD : + case Sft : + case Cmp : + case Mov : + case Mvn : + case Add : + case Sub : + if ( Programa[10000].Parametros == P_Not ) + Programa[10000].Parametros = P_Not_Hr; + else + Programa[10000].Parametros = P_Hr; + break; + default: + break; + } + } + break; + case B_Ld : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un Ld + switch( Programa[10000].Comando ) { + case And : + case Or : + if( Programa[10000].Parametros == 0 ) + Programa[10000].Parametros = P_Ld; + else { + Programa[10000].Comando = Ld; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } + break; + default: + Programa[10000].Comando = Ld; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + break; + } + } + break; + case B_Out : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + Programa[10000].Comando =_Out; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + } + break; + case B_Tim : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un Tim + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + if ( Programa[10000].Parametros == P_Not ) + Programa[10000].Parametros = P_Not_Tim; + else if ( Programa[10000].Parametros == 0 ) + Programa[10000].Parametros = P_Tim; + else { + Programa[10000].Comando = Tim; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + CurrCol = 1; + } + break; + default: + Programa[10000].Comando = Tim; + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + CurrCol = 1; + break; + } + } + break; + case B_Dm : + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + } + break; + case B_Ch : +/* + if ( CurrCol == 0 || CurrCol == 1 ) { + BT = 0; + // Funciones que admiten un Tim + switch( Programa[10000].Comando ) { + case Ld : + case And : + case Or : + if ( Programa[10000].Parametros == P_Not ) + Programa[10000].Parametros = P_Not_Tim; + else + Programa[10000].Parametros = P_Tim; + break; + default: + break; + } + } +*/ + break; + case B_Cont : + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + break; + case B_Ext : + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + break; + case B_Chg : + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + break; + case B_Scrh : + BT = 0; + BuscarItem(); + break; + case B_Play : + BT = 0; + GetProgram(); + break; + case B_Del : + Buffer_Teclado[BT] = B_Del; + BT++; + break; + case B_Mont : + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + break; + case B_Rec : + BT = 0; + SendProgram(); + break; + case B_Ins : + Buffer_Teclado[BT] = B_Ins; + BT++; + break; + case B_Up : + if ( Buffer_Teclado[0] == B_Ins ) { + BT = 0; + MuestraLCD( "", " Insert Line ?"); + if ( Comprueba_Secuencia( 1 ) == B_Up ) + AddRow( 0 ); + } + else + if ( Buffer_Teclado[0] == B_Del ) { + BT = 0; + MuestraLCD( "", " Delete Line ?"); + if ( Comprueba_Secuencia( 1 ) == B_Up ) + DelRow( ); + } else { + BT = 0; + PrintCurrLine ( 0, 0 ); // Ocultamos linea anterior + UpRow(); + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + } + break; + case B_Clr : + BT = 0; + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + break; + case B_Ver : + BT = 0; + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + // ۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱۱ + // + break; + case B_Write : + BT = 0; + if ( Programa[ 10000 ].Comando == Fun ) { + switch ( Programa[ 10000 ].Dato + 100) { + + case Sft : // Registro de desplazamiento + case Add : // Add (Suma en BCD) + case Sub : // Subtract ( Resta en BCD ) + case TimH : // Temporizador de alta velocidad + case Cmp : // Comparador + case Mov : // Move + case Mvn : // Move Not + Programa[ 10000 ].Comando = 100 + Programa[ 10000 ].Dato; + Programa[ 10000 ].Dato = 0; + CurrCol = 1; + break; + + case End : // Final de programa + + case Il : // Instruccin de condicin + case Ilc : // Instruccin fin de condicin + + case Keep : // Switch biestable ( Rel Latch ) + case DifU : // Activador en el flanco de subida + case DifD : // Activador en el flanco de bajada + case Stc : // Introduce un 1 en el flag de acarreo + case Clc : // Borra el flag de acarreo + Programa[ 10000 ].Comando = 100 + Programa[ 10000 ].Dato; + Programa[ 10000 ].Dato = 0; + break; + default: + break; + } + Programa[10000].Parametros = 0; + Programa[10000].Dato = 0; + Programa[10000].SubDato = 0; + +// // Confirma linea editada y la copia en la DIRECCION REAL +// Programa[ CurrRow + CurrTopLine ] = Programa[ 10000 ]; + } else { + // Confirma linea editada y la copia en la DIRECCION REAL + Programa[ CurrRow + CurrTopLine ] = Programa[ 10000 ]; + PrintCurrLine ( 0, 1 ); // Ocultamos linea anterior + DownRow(); + Programa[10000] = Programa[ CurrRow + CurrTopLine ]; + } + + break; + case B_Down : + if ( Buffer_Teclado[0] == B_Ins ) { + BT = 0; + MuestraLCD( "", " Insert Line ?"); + if ( Comprueba_Secuencia( 1 ) == B_Down ) + AddRow( 1 ); + } + else + if ( Buffer_Teclado[0] == B_Del ) { + BT = 0; + MuestraLCD( "", " Delete Line ?"); + if ( Comprueba_Secuencia( 1 ) == B_Down ) + DelRow( ); + } else { + PrintCurrLine ( 0, 0 ); // Ocultamos linea anterior + DownRow(); + Programa[10000] = Programa[ CurrRow + CurrTopLine ]; + } + break; + case B_DebugCode : + DebugCode.Bit = ( DebugCode.Bit ? 0 : 1 ) ; + break; + case B_ResetValores : + Resetea_Memoria(); + ReImprimeCanal_In (CurrCh_In ); + ReImprimeCanal_Out(CurrCh_Out); + break; + case B_Configurar : + Configurar(); + break; + case B_Reset : + if ( Optar( "Confirme borrado", "total de DATOS","" ) == 1 ) { + Resetea_Memoria(); + ReImprimeCanal_In (CurrCh_In ); + ReImprimeCanal_Out(CurrCh_Out); + Reset_Programa(); + CurrRow = 0; CurrTopLine = 0; + PrintWholeScreen(); + PrintCurrLine( 1, 0 ); + } + break; + case B_Salvar : + WriteProgram(); + break; + case B_Cargar : + LoadProgram(); + break; + case B_Salir : + ok = 1; + break; + case B_0 : + BT = 0; + Numero_Pulsado( 0 ); + break; + case B_1 : + BT = 0; + Numero_Pulsado( 1 ); + break; + case B_2 : + BT = 0; + Numero_Pulsado( 2 ); + break; + case B_3 : + BT = 0; + Numero_Pulsado( 3 ); + break; + case B_4 : + BT = 0; + Numero_Pulsado( 4 ); + break; + case B_5 : + BT = 0; + Numero_Pulsado( 5 ); + break; + case B_6 : + BT = 0; + Numero_Pulsado( 6 ); + break; + case B_7 : + BT = 0; + Numero_Pulsado( 7 ); + break; + case B_8 : + BT = 0; + Numero_Pulsado( 8 ); + break; + case B_9 : + BT = 0; + Numero_Pulsado( 9 ); + break; + default: + break; + } + + PrintCurrLine( 1, 1 ); + PrintVisorLCD ( 1 ); + if ( BT == 0 ) { + for ( BT = 0; BT < 16; BT ++ ) + Buffer_Teclado[BT] = 0; + BT = 0; + } + + + +}while(!ok); + +return ok; + +} + +void Resetea_Memoria(void){ + + int i, ch; + + // Resetea Salidas + for( ch = 0;ch < 6 ;ch++ ) + for( i = 0; i < Numero_Out ; i++ ) + Ram -> Out [i][ch].Bit = 0; + + + // Resetea Entradas + for( ch = 0;ch < 6 ;ch++ ) + for( i = 0; i < Numero_Out ; i++ ) + Ram -> In [i][ch].Bit = 0; + +/* + // Resetea Salidas Internas + for( ch = 0;ch < 9 ;ch++ ) + for( i = 0; i < Numero_Out ; i++ ) + Ram -> Out2 [i][ch].Bit = 0; +*/ + // Resetea Salidas no volatiles + for( ch = 0;ch < 9 ;ch++ ) + for( i = 0; i < Numero_Out ; i++ ) + Ram -> Hr [i][ch].Bit = 0; + + for( i = 0; i < Numero_Tmp ; i++ ) + Ram -> Tr [i] .Bit = 0; + + for( i = 0; i < Numero_Tim ; i++ ) + Ram -> Tim_Cnt [i] = 0; + + +} + + +void Reset_Programa(void){ + + int i=0; + for ( i; i<10001; i++ ) + { + Programa[i].Comando = 0; + Programa[i].Parametros = 0; + + Programa[i].Dato = 0; + Programa[i].SubDato = 0; + } + +} + + +void Abandona_Programa(char *texto, long valor){ + + // Comprobar donde estamos. ( Texto / Grfico ) + closegraph(); + cprintf("\n%s <%ld>", texto, valor ); + + exit(valor); +} + +void ReImprimeCanal_In(int Canal){ + + int i; + for ( i = 0; i < Numero_In; i++ ) + if ( Ram -> In[i][Canal].Bit == 1 ) { + Imprime_Bordes(1, (i+B_In0), 2); + } else { + Imprime_Bordes(1, (i+B_In0), -1); + } + +} + +void ReImprimeCanal_Out(int Canal){ + + int i; + for ( i = 0; i < Numero_Out; i++ ) + if ( Ram -> Out[i][Canal].Bit == 1 ) { + Imprime_Bordes(1, (i+B_Out0), 2); + } else { + Imprime_Bordes(1, (i+B_Out0), -1); + } + + +} + + +void PrintWholeScreen (void) +{ + + int OldCurrRow = CurrRow ; + char Contador; + PrintCurrLine ( 0, 0 ); + for ( Contador = 0; Contador < 10; Contador++ ) + DownRow(); + + CurrRow = OldCurrRow; + +} + +void PrintCurrLine ( char Oculta_Mark, char Ultima ) +{ + char Buffer[80] ; + int Buff_int ; + settextstyle( SMALL_FONT, HORIZ_DIR, 5 ); +// Solo 11 Lineas de 5 puntos + if ( Oculta_Mark == 0 ) { + setfillstyle( SOLID_FILL, 0 ); + bar( 7, (176 + ( ( CurrRow ) * 15 ) ), 84, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + bar( 102, (176 + ( ( CurrRow ) * 15 ) ), 225, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + bar( 242, (176 + ( ( CurrRow ) * 15 ) ), 419, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + setcolor(CFG.Colores.Texto ); + Buff_int = (CurrRow + CurrTopLine); + }else{ + setfillstyle( SOLID_FILL, 0 ); + bar( 242, (176 + ( ( CurrRow ) * 15 ) ), 419, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + setfillstyle( SOLID_FILL, CFG.Colores.F_Texto ); + bar( 7, (176 + ( ( CurrRow ) * 15 ) ), 84, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + bar( 102, (176 + ( ( CurrRow ) * 15 ) ), 225, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + switch( CurrCol ) { + case 1: // Primera Zona + bar( 242, (176 + ( ( CurrRow ) * 15 ) ), 301, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + break; + case 2: // Segunda Zona + bar( 301, (176 + ( ( CurrRow ) * 15 ) ), 360, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + break; + case 3: // Tercera Zona + bar( 360, (176 + ( ( CurrRow ) * 15 ) ), 419, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + break; + default: + bar( 242, (176 + ( ( CurrRow ) * 15 ) ), 419, ( (176 + 15) + ( ( CurrRow ) * 15 ) ) ); + break; + } + setcolor(0); + Buff_int = (CurrRow + CurrTopLine); + } + if ( Ultima == 1 ) + Buff_int = 10000; + + sprintf( Buffer, " %04d", ( CurrRow + CurrTopLine ) ); + outtextxy( 10, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + switch ( Programa[Buff_int].Comando ) { + case ReadNop : + sprintf( Buffer, "ReadNop" ); + break; + case Fun : + sprintf( Buffer, "FUN " ); + break; + case Ld : + sprintf( Buffer, "Ld " ); + break; + case Or : + sprintf( Buffer, "Or " ); + break; + case And : + sprintf( Buffer, "And " ); + break; + case _Out : + sprintf( Buffer, "Out " ); + break; + case Tim : + sprintf( Buffer, "Tim " ); + break; + case Cnt : + sprintf( Buffer, "Cnt " ); + break; +/* + case _Tr : + sprintf( Buffer, "Tr " ); + break; +*/ + case End : + sprintf( Buffer, "End (01)" ); + break; + case Il : + sprintf( Buffer, "Il (02)" ); + break; + case Ilc : + sprintf( Buffer, "Ilc (03)" ); + break; + case Sft : + sprintf( Buffer, "Sft (10)" ); + break; + case Keep : + sprintf( Buffer, "Keep (11)" ); + break; + case DifU : + sprintf( Buffer, "DifU (13)" ); + break; + case DifD : + sprintf( Buffer, "DifD (14)" ); + break; + case TimH : + sprintf( Buffer, "TimH (15)" ); + break; + case Cmp : + sprintf( Buffer, "Cmp (15)" ); + break; + case Mov : + sprintf( Buffer, "Mov (21)" ); + break; + case Mvn : + sprintf( Buffer, "Mvn (22)" ); + break; + case Add : + sprintf( Buffer, "Add (30)" ); + break; + case Sub : + sprintf( Buffer, "Sub (31)" ); + break; + case Stc : + sprintf( Buffer, "Stc (40)" ); + break; + case Clc : + sprintf( Buffer, "Clc (41)" ); + break; + default : + sprintf( Buffer, "Error " ); + break; + } +if ( Programa[Buff_int].Comando != Add && Programa[Buff_int].Comando != Sub ) + switch ( Programa[Buff_int].Parametros ) { + case 0 : + break; + case P_Ld : + strcat( Buffer, "Ld " ); + break; + case P_Tr : + strcat( Buffer, "Tr " ); + break; + case P_Hr : + strcat( Buffer, "Hr " ); + break; + case P_Cnt : + strcat( Buffer, "Cnt " ); + break; + case P_Tim : + strcat( Buffer, "Tim " ); + break; + case P_Keep : + strcat( Buffer, "Keep " ); + break; + case P_Not : + strcat( Buffer, "Not " ); + break; + case P_Not_Tr : + strcat( Buffer, "Not Tr" ); + break; + case P_Not_Hr : + strcat( Buffer, "Not Hr" ); + break; + case P_Not_Cnt : + strcat( Buffer, "Not Cnt" ); + break; + case P_Not_Tim : + strcat( Buffer, "Not Tim" ); + break; + case P_Keep_Hr : + strcat( Buffer, "Keep Hr" ); + break; + case P_Tim_Data : + strcat( Buffer, "Tim Data" ); + break; + case P_Out : + strcat( Buffer, "Out " ); + break; + default : + strcat( Buffer, "Error " ); + break; + } + outtextxy( 105, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + switch( Programa[Buff_int].Comando ) { + case ReadNop : + case End : + case Il : + case Ilc : + break; + case Tim : + case TimH: + case Cnt : + case Cmp : + case Sft : + case Mov : + case Mvn : + switch( CurrCol ) { + case 1: + sprintf( Buffer, " %02d", Programa[Buff_int].Dato ); + outtextxy( /*334*/242, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + setcolor(CFG.Colores.Texto ); +// sprintf( Buffer, "# % 4d", Programa[Buff_int].SubDato ); +// outtextxy( /*334*/360, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + sprintf( Buffer, " #% 5d", Programa[Buff_int].SubDato ); + outtextxy( /*334*/331, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + break; + case 3: +// sprintf( Buffer, "# % 4d", Programa[Buff_int].SubDato ); + sprintf( Buffer, " #% 5d", Programa[Buff_int].SubDato ); + outtextxy( /*334*/331, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + +// outtextxy( /*334*/360, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + setcolor(CFG.Colores.Texto ); + sprintf( Buffer, " %02d", Programa[Buff_int].Dato ); + outtextxy( /*334*/242, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + break; + default: + break; + } + break; + case Add : + case Sub : + switch( CurrCol ) { + case 1: + sprintf( Buffer, "# %04d", Programa[Buff_int].Dato ); + outtextxy( /*334*/242, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + setcolor(CFG.Colores.Texto ); + sprintf( Buffer, "# %04d", Programa[Buff_int].SubDato ); + outtextxy( /*334*/301, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + sprintf( Buffer, "Ch %02d", Programa[Buff_int].Parametros ); + outtextxy( /*334*/360, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + break; + case 2: + sprintf( Buffer, "# %04d", Programa[Buff_int].SubDato ); + outtextxy( /*334*/301, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + setcolor(CFG.Colores.Texto ); + sprintf( Buffer, "# %04d", Programa[Buff_int].Dato ); + outtextxy( /*334*/242, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + sprintf( Buffer, "Ch %02d", Programa[Buff_int].Parametros ); + outtextxy( /*334*/360, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + break; + case 3: + sprintf( Buffer, "Ch %02d", Programa[Buff_int].Parametros ); + outtextxy( /*334*/360, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + setcolor(CFG.Colores.Texto ); + sprintf( Buffer, "# %04d", Programa[Buff_int].Dato ); + outtextxy( /*334*/242, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + sprintf( Buffer, "# %04d", Programa[Buff_int].SubDato ); + outtextxy( /*334*/301, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + + break; + default: + break; + } + + break; + + + default: + sprintf( Buffer, " %04d", Programa[Buff_int].Dato ); + outtextxy( /*334*/331, (176 + ( ( CurrRow ) * 15 ) ), Buffer ); + break; + } + + + + + + + +} + +void PrintVisorLCD ( char Ultima ) +{ + char Buffer[80] ; + int Buff_int ; + settextstyle( SMALL_FONT, HORIZ_DIR, 5 ); +// Solo 11 Lineas de 5 puntos + + setfillstyle( SOLID_FILL, 0 ); + bar( 242, 101, 419, 129 ); + setcolor(CFG.Colores.VisorLCD ); + + + if ( Ultima == 1 ) + Buff_int = 10000; + else + Buff_int = (CurrRow + CurrTopLine); + + // Direccin + sprintf( Buffer, "%04d", ( CurrRow + CurrTopLine ) ); + outtextxy( 243, 100, Buffer ); + + switch ( Programa[Buff_int].Comando ) { + case ReadNop : + outtextxy( 243, 100, " Read" ); + sprintf( Buffer, " Nop (00)" ); + break; + case Fun : + sprintf( Buffer, " FUN" ); + break; + case Ld : + sprintf( Buffer, " Ld " ); + break; + case Or : + sprintf( Buffer, " Or " ); + break; + case And : + sprintf( Buffer, " And " ); + break; + case _Out : + sprintf( Buffer, " Out " ); + break; + case Tim : + if ( CurrCol == 1 ) + sprintf( Buffer, " Tim " ); + else + sprintf( Buffer, " Tim Data" ); + break; + case Cnt : + if ( CurrCol == 1 ) + sprintf( Buffer, " Cnt " ); + else + sprintf( Buffer, " Cnt Data" ); + break; +/* + case _Tr : + sprintf( Buffer, " Tr " ); + break; +*/ + case End : + sprintf( Buffer, " End (01)" ); + break; + case Il : + sprintf( Buffer, " Il (02)" ); + break; + case Ilc : + sprintf( Buffer, " Ilc (03)" ); + break; + case Sft : + if ( CurrCol == 1 ) + sprintf( Buffer, " Sft (10)" ); + else + sprintf( Buffer, " Sft ]Ch" ); + break; + case Keep : + sprintf( Buffer, " Keep (11)" ); + break; + case DifU : + sprintf( Buffer, " DifU (13)" ); + break; + case DifD : + sprintf( Buffer, " DifD (14)" ); + break; + case TimH : + if ( CurrCol == 1 ) + sprintf( Buffer, " TimH (15)" ); + else + sprintf( Buffer, " TimH Data" ); + break; + case Cmp : + if ( CurrCol == 1 ) + sprintf( Buffer, " Cmp (15)" ); + else + sprintf( Buffer, " Cmp Data" ); + break; + case Mov : + if ( CurrCol == 1 ) + sprintf( Buffer, " Mov (21)" ); + else + sprintf( Buffer, " Mov Data" ); + break; + case Mvn : + if ( CurrCol == 1 ) + sprintf( Buffer, " Mvn (22)" ); + else + sprintf( Buffer, " Mvn Data" ); + break; + case Add : + if ( CurrCol == 1 ) + sprintf( Buffer, " Add (30)" ); + else + if ( CurrCol == 2 ) + sprintf( Buffer, " Add Data" ); + else + sprintf( Buffer, " Add to Channel" ); + break; + case Sub : + if ( CurrCol == 1 ) + sprintf( Buffer, " Sub (31)" ); + else + if ( CurrCol == 2 ) + sprintf( Buffer, " Sub Data" ); + else + sprintf( Buffer, " Sub to Channel" ); + break; + case Stc : + sprintf( Buffer, " Stc (40)" ); + break; + case Clc : + sprintf( Buffer, " Clc (41)" ); + break; + default : + sprintf( Buffer, " Error " ); + break; + } +if ( Programa[Buff_int].Comando != Add && Programa[Buff_int].Comando != Sub ) { + switch ( Programa[Buff_int].Parametros ) { + case 0 : + break; + case P_Ld : + strcat( Buffer, "Ld" ); + break; + case P_Tr : + strcat( Buffer, "Tr" ); + break; + case P_Hr : + strcat( Buffer, "Hr" ); + break; + case P_Cnt : + strcat( Buffer, "Cnt" ); + break; + case P_Tim : + strcat( Buffer, "Tim" ); + break; + case P_Keep : + strcat( Buffer, "Keep" ); + break; + case P_Not : + strcat( Buffer, "Not" ); + break; + case P_Not_Tr : + strcat( Buffer, "Not Tr" ); + break; + case P_Not_Hr : + strcat( Buffer, "Not Hr" ); + break; + case P_Not_Cnt : + strcat( Buffer, "Not Cnt" ); + break; + case P_Not_Tim : + strcat( Buffer, "Not Tim" ); + break; + case P_Keep_Hr : + strcat( Buffer, "Keep Hr" ); + break; + case P_Tim_Data : + strcat( Buffer, "Tim Data" ); + break; + case P_Out : + strcat( Buffer, "Out" ); + break; + default : + strcat( Buffer, "Error" ); + break; + } +} + outtextxy( 243, 115, Buffer ); + switch( Programa[Buff_int].Comando ) { + case ReadNop : + case End : + case Il : + case Ilc : + sprintf( Buffer, " "); + break; + case Tim : + case TimH : + case Cnt : + case Cmp : + case Sft : + case Mov : + case Mvn : + switch( CurrCol ) { + case 1: + sprintf( Buffer, " %02d", Programa[Buff_int].Dato ); + break; + case 3: + sprintf( Buffer, "#% 5d", Programa[Buff_int].SubDato ); + break; + default: + break; + } + break; + case Add : + case Sub : + switch( CurrCol ) { + case 1: + sprintf( Buffer, "# %04d", Programa[Buff_int].Dato ); + break; + case 2: + sprintf( Buffer, "# %04d", Programa[Buff_int].SubDato ); + break; + case 3: + sprintf( Buffer, " Ch %02d", Programa[Buff_int].Parametros ); + break; + default: + break; + } + + break; + + + default : + sprintf( Buffer, " %04d", Programa[Buff_int].Dato ); + break; + } + + outtextxy( 373, 115, Buffer ); + + + + + + + +} + +void BuscarItem(void) +{ +} +void GetProgram(void) +{ +} +void SendProgram(void) +{ +} +void AddRow( char Arriba_Abajo ) +{ + + int avance, Stop; + + if ( Arriba_Abajo == 0 && (CurrRow+CurrTopLine) == 0 ) return; + if ( Arriba_Abajo == 1 && (CurrRow+CurrTopLine) == 9999 ) return; + + if ( Arriba_Abajo == 0 ) + Stop = CurrRow + CurrTopLine - 1; + else + Stop = CurrRow + CurrTopLine + 1; + // Comienza proceso de eliminacin + avance = 9999; + do{ + Programa[avance + 1] = Programa[avance]; + avance--; + }while(avance >= Stop ); + + + if ( Arriba_Abajo == 0 ) + Stop++; + + Programa[Stop].Comando = 0; + Programa[Stop].Parametros = 0; + Programa[Stop].Dato = 0; + Programa[Stop].SubDato = 0; + + avance = CurrRow; CurrRow = 0; + PrintWholeScreen(); + if ( (CurrRow = avance + ( (Arriba_Abajo==0) ? (0) : (1) )) <0 ) + { + CurrRow = 0; + UpRow(); + } + if ( CurrRow > 10 ) + { + CurrRow = 10; + DownRow(); + } + + + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + +} + +void DelRow(void) +{ + + int avance; + // Comienza proceso de eliminacin + avance = CurrRow + CurrTopLine; + do{ + Programa[avance] = Programa[avance+1]; + avance++; + }while(avance < 10000 ); + + Programa[9999].Comando = 0; + Programa[9999].Parametros = 0; + Programa[9999].Dato = 0; + Programa[9999].SubDato = 0; + + avance = CurrRow; CurrRow = 0; + PrintWholeScreen(); + CurrRow = avance; + Programa[10000] = Programa[CurrRow + CurrTopLine ]; +} + + +void UpRow(void) +{ + + if( CurrCol > 1 ) Select_Columna_Up(); + else + if ( ( CurrRow + CurrTopLine ) <= 0 ) BEEP(); // Rebasado n de lineas + else { + + if ( Select_Columna_Up() == 1 ) { + if ( ( CurrRow ) <= 0 ) + { + CurrTopLine -= 11; + if ( CurrTopLine < 0 ) CurrTopLine = 0; + CurrRow = 0; + PrintWholeScreen(); + CurrRow = 10; + Select_Columna_Up(); + PrintCurrLine ( 1, 0 ); + }else{ + CurrRow--; + Select_Columna_Up(); + PrintCurrLine ( 0, 0 ); + } + } else + PrintCurrLine ( 0, 0 ); + + } + +} + + + +void DownRow(void) +{ + + if ( ( CurrRow + CurrTopLine ) >= 9999 ) BEEP(); // Rebasado n de lineas + else { + + if ( Select_Columna_Down() == 1 ) { + if ( ( CurrRow ) >= 10 ) + { + CurrRow = 0; + CurrTopLine += 11; + if ( CurrTopLine + CurrRow > 9999 ) CurrTopLine = ( 9999 - 10 ); + PrintWholeScreen(); + Select_Columna_Down(); + PrintCurrLine ( 1, 0 ); + }else{ + CurrRow++; + Select_Columna_Down(); + PrintCurrLine ( 0, 0 ); + } + } else { + PrintCurrLine ( 0, 0 ); + } + + } + +} +void LoadProgram(void) +{ + char Buffer[500] = "*.PLC"; + +struct Cabecera { + char Nombre_del_Programa[70]; + char Comentario_Inicial[70]; + char VerHi, VerLow; + char Register; + long Records; +}; +Cabecera C_PLC; + + if ( file_browser( Buffer, "Cargar Programa PLC", 0 ) ) { + FILE *handle_Load; + + if ( (handle_Load = fopen( Buffer, "rb") ) == NULL ) Muestra_Mensaje(200, "PLC.DAT"); + fread ( &C_PLC, sizeof( struct Cabecera ), 1, handle_Load ); + if ( C_PLC.VerHi == 2 && C_PLC.VerLow == 0 ) { + fread ( Programa, sizeof(FirmWare), 10000, handle_Load ); + fread ( Ram, sizeof(MemoriaRam), 1, handle_Load ); + } + fclose(handle_Load); + + CurrRow = 0; CurrTopLine = 0; + PrintWholeScreen(); + PrintCurrLine( 1, 0 ); + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + ReImprimeCanal_Out(CurrCh_Out); + ReImprimeCanal_In(CurrCh_In); + } +/* +char drive[MAXDRIVE]; +char dir[MAXDIR]; +char file[MAXFILE]; +char ext[MAXEXT]; +int flags; + +flags=fnsplit(Buffer,drive,dir,file,ext); + + if( !strcmpi( file, "SFT" ) || !strcmpi( file, "CNT" ) + ||!strcmpi( file, "KEEP(11)") || !strcmpi( file, "DIFD(14)" ) + ||!strcmpi( file, "DIFU(13)") ) + Run(); +*/ + +} +void WriteProgram(void) +{ + char Buffer[500] = "*.PLC"; + char Buffer2[13]; +struct Cabecera { + char Nombre_del_Programa[70]; + char Comentario_Inicial[70]; + char VerHi, VerLow; + char Register; + long Records; +}; +Cabecera C_PLC; + +sprintf( C_PLC.Nombre_del_Programa, "P.L.C\nJse David Guilln\n%c", 26 ); +C_PLC.VerHi = 2; C_PLC.VerLow = 0; +C_PLC.Register = 1; C_PLC.Records = 1; + + if ( file_browser( Buffer, "Salvar Programa PLC", 1 ) ) { + +char drive[MAXDRIVE]; +char dir[MAXDIR]; +char file[MAXFILE]; +char ext[MAXEXT]; +int flags; + +flags=fnsplit(Buffer,drive,dir,file,ext); +if( !(flags & EXTENSION) ) + strcpy( ext, ".PLC" ); +fnmerge(Buffer ,drive,dir,file,ext); + + + FILE *handle_Save; + + if ( (handle_Save = fopen( Buffer, "wb") ) == NULL ) Muestra_Mensaje(200, "PLC.DAT"); + fwrite( &C_PLC, sizeof( struct Cabecera ), 1, handle_Save ); + fwrite( Programa, sizeof(FirmWare), 10000, handle_Save ); + fwrite( Ram, sizeof(MemoriaRam), 1, handle_Save ); + fclose(handle_Save); + + CurrRow = 0; CurrTopLine = 0; + PrintWholeScreen(); + PrintCurrLine( 1, 0 ); + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + } +} +void Configurar(void) +{ + +/* +struct Colores { + char Texto; + char F_Texto; + char VisorLCD; +}; + +typedef struct { + + struct Colores Colores; + char PcOut.Bit; + char TimeFlow.Bit; + char Int8.Bit; + +} Configuracion; +Configuracion CFG; +*/ + char Boton_Pulsado, ok = 0, C_Texto = 5; + + setfillstyle(SOLID_FILL, 0); + bar( 9, 372, 542, 471); + + Imprime_Secuencia(5); +// Fichero_bot(20); + Imprime_Estaticos(20, "PLC.dat"); + + Imprime_Bordes(5, 5, CFG.Colores.Texto); + if ( CFG.Int8.Bit ) Imprime_Bordes(5, 2, 4); + if ( CFG.PcOut.Bit ) Imprime_Bordes(5, 3, 4); + if ( CFG.TimeFlow.Bit ) Imprime_Bordes(5, 4, 4); + + +do{ + Boton_Pulsado = Comprueba_Secuencia( 5 ); + switch(Boton_Pulsado ) { // Iniciamos comprobacion + + case 0: // No se pulso ningun BOTON + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + break; + case -1: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + case -2: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + // Retroceder + case 1 : + ok = 1; + break; + // Usar Int8.Bit + case 2 : + if ( CFG.Int8.Bit ) { + CFG.Int8.Bit = 0; + Imprime_Bordes(5, 2, -1); + } else { + CFG.Int8.Bit = 1; + Imprime_Bordes(5, 2, 4); + } + break; + // Usar Pc_Out + case 3 : + if ( CFG.PcOut.Bit ) { + CFG.PcOut.Bit = 0; + Imprime_Bordes(5, 3, -1); + } else { + CFG.PcOut.Bit = 1; + Imprime_Bordes(5, 3, 4); + } + break; + // Usar TimeFlow.Bit + case 4 : + if ( CFG.TimeFlow.Bit ) { + CFG.TimeFlow.Bit = 0; + Imprime_Bordes(5, 4, -1); + } else { + CFG.TimeFlow.Bit = 1; + Imprime_Bordes(5, 4, 4); + } + break; + // Texto + case 5 : + C_Texto = 5; + Imprime_Bordes(5, 5, CFG.Colores.Texto); + Imprime_Bordes(5, 6, -1); + Imprime_Bordes(5, 7, -1); + break; + // Texto Sealado + case 6 : + C_Texto = 6; + Imprime_Bordes(5, 5, -1); + Imprime_Bordes(5, 6, CFG.Colores.F_Texto); + Imprime_Bordes(5, 7, -1); + break; + // Visor LCD + case 7 : + C_Texto = 7; + Imprime_Bordes(5, 5, -1); + Imprime_Bordes(5, 6, -1); + Imprime_Bordes(5, 7, CFG.Colores.VisorLCD); + break; + + case 8 : + case 9 : + case 10 : + case 11 : + case 12 : + + case 13 : + case 14 : + case 15 : + case 16 : + case 17 : + + case 18 : + case 19 : + case 20 : + case 21 : + case 22 : + switch ( C_Texto ) { + case 5: + CFG.Colores.Texto = ( Boton_Pulsado - 7); + Imprime_Bordes(5, 5, CFG.Colores.Texto); + break; + case 6: + CFG.Colores.F_Texto = ( Boton_Pulsado - 7 ); + Imprime_Bordes(5, 6, CFG.Colores.F_Texto); + break; + case 7: + CFG.Colores.VisorLCD = ( Boton_Pulsado - 7 ); + Imprime_Bordes(5, 7, CFG.Colores.VisorLCD); + break; + } + + break; + + default: + break; + } + +}while(!ok); + + + if ( Optar( "Cambios en la configuracin.", " SALVAR ?", "") == 1 ) + CFG_File( Salvar ); + else + CFG_File( Cargar ); + + setfillstyle(SOLID_FILL, 0); + bar( 9, 372, 542, 471); + +} + +void BEEP(void) +{ +} + +int Select_Columna_Up(void){ + +int back = 0; + // Antes de Bajar una linea, mira si se ha de bajar una linea REAL + // o una linea VIRTUAL + switch( Programa[CurrRow + CurrTopLine].Comando ){ + case Tim: + case Cnt: + case Sft: + case Cmp: + case Mov: + case Mvn: + case TimH: + if ( CurrCol == 3 ) { CurrCol = 1; } + else + if ( CurrCol == 1 ) { CurrCol = 0; back = 1; } + else + if ( CurrCol == 0 ) { CurrCol = 3; } + break; + case Add: + case Sub: + if ( CurrCol == 3 ) { CurrCol = 2; } + else + if ( CurrCol == 2 ) { CurrCol = 1; } + else + if ( CurrCol == 1 ) { CurrCol = 0; back = 1; } + else + if ( CurrCol == 0 ) { CurrCol = 3; } + break; + default: + CurrCol = 0; + back = 1; + break; + } +return back; +} + + + +int Select_Columna_Down(void){ + +int back = 0; + // Antes de Bajar una linea, mira si se ha de bajar una linea REAL + // o una linea VIRTUAL + switch( Programa[CurrRow + CurrTopLine].Comando ){ + case Tim: + case Cnt: + case Sft: + case Cmp: + case Mov: + case Mvn: + case TimH: + if ( CurrCol == 0 ) { CurrCol = 1; } + else + if ( CurrCol == 1 ) { CurrCol = 3; } + else + if ( CurrCol == 3 ) { CurrCol = 0; back = 1; } + break; + case Add: + case Sub: + if ( CurrCol == 0 ) { CurrCol = 1; } + else + if ( CurrCol == 1 ) { CurrCol = 2; } + else + if ( CurrCol == 2 ) { CurrCol = 3; } + else + if ( CurrCol == 3 ) { CurrCol = 0; back = 1; } + break; + default: + CurrCol = 0; + back = 1; + break; + } + +return back; +} + + + +void Numero_Pulsado(char numero) { + // Vemos si posee dato secundario... + // y lo canalizamos a su posicin correcta + switch( Programa[10000].Comando ) { + case Tim : + case TimH: + case Cnt : + case Cmp : + case Sft : + case Mov : + case Mvn : + if ( CurrCol == 1 ) + Programa[10000].Dato = ( ( ( Programa[10000].Dato - ( ( Programa[10000].Dato / 10 ) * 10 ) ) * 10 ) + numero ); + else + if ( CurrCol == 3 ) + Programa[10000].SubDato = ( ( ( Programa[10000].SubDato - ( ( Programa[10000].SubDato / 1000 ) * 1000 ) ) * 10 ) + numero ); + break; + case Add : + case Sub : + if ( CurrCol == 1 ) + Programa[10000].Dato = ( ( ( Programa[10000].Dato - ( ( Programa[10000].Dato / 1000 ) * 1000 ) ) * 10 ) + numero ); + else + if ( CurrCol == 2 ) + Programa[10000].SubDato = ( ( ( Programa[10000].SubDato - ( ( Programa[10000].SubDato / 1000 ) * 1000 ) ) * 10 ) + numero ); + else + if ( CurrCol == 3 ) + Programa[10000].Parametros = ( ( ( Programa[10000].Parametros - ( ( Programa[10000].Parametros / 10 ) * 10 ) ) * 10 ) + numero ); + break; + default: + CurrCol = 0; + Programa[10000].Dato = ( ( ( Programa[10000].Dato - ( ( Programa[10000].Dato / 1000 ) * 1000 ) ) * 10 ) + numero ); + break; + } +} + + +void MuestraLCD( char *texto1, char *texto2) +{ + char Buffer[20]; + setfillstyle( SOLID_FILL, 0 ); + bar( 242, 101, 419, 129 ); + setcolor(CFG.Colores.VisorLCD ); + + sprintf( Buffer, "%04d", ( CurrRow + CurrTopLine ) ); + outtextxy( 243, 100, Buffer ); + outtextxy( 243, 100, texto1 ); + outtextxy( 243, 115, texto2 ); + +} + + + +void CFG_File( char Cargar_Salvar ) { + + FILE *handle_CFG; + +if ( Cargar_Salvar == Cargar ) { + if ( ( handle_CFG = fopen( "PLC.CFG", "rb") ) == NULL ) { + + ( handle_CFG = fopen( "PLC.CFG", "wb") ); + CFG.Colores.Texto = 2; + CFG.Colores.F_Texto =14; + CFG.Colores.VisorLCD= 6; + CFG.PcOut.Bit = 0; + CFG.TimeFlow.Bit = 0; + CFG.Int8.Bit = 0; + fwrite( &CFG, sizeof(Configuracion), 1, handle_CFG ); + fclose( handle_CFG ); + } else { + fread( &CFG, sizeof(Configuracion), 1, handle_CFG ); + fclose( handle_CFG ); + } +} else { + + if ( ( handle_CFG = fopen( "PLC.CFG", "wb") ) == NULL ) { + CFG.Colores.Texto = 2; + CFG.Colores.F_Texto =14; + CFG.Colores.VisorLCD= 6; + CFG.PcOut.Bit = 0; + CFG.TimeFlow.Bit = 0; + CFG.Int8.Bit = 0; + } else { + fwrite( &CFG, sizeof(Configuracion), 1, handle_CFG ); + fclose( handle_CFG ); + } +} + +} \ No newline at end of file diff --git a/PLC_FILE.CPP b/PLC_FILE.CPP new file mode 100644 index 0000000..52dfd65 --- /dev/null +++ b/PLC_FILE.CPP @@ -0,0 +1,595 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON + +//extern int Fichero_bot(char Dinamicos_Estaticos); + + +//////////////////////////////////////////////////////////////////////////// +/***************************************************************************\ +| 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"| +\***************************************************************************/ + +//for interrupt handlers +void interrupt critical_error_handler(.../*__CPPARGS*/); // interrupt prototype +void interrupt (*old_int24)(.../*__CPPARGS*/); // interrupt function pointer +void startceh(); +void stopceh(); + +int erroroccurred=0; + +//////////////////////////////////////////////////////////////////////////// +struct Colores { + char Texto; + char F_Texto; + char VisorLCD; +}; + +typedef struct { + + struct Colores Colores; + +} Configuracion; +extern Configuracion CFG; + +typedef struct { + char files[13] ; //200 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 *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); + +char Optar( char *texto1, char *texto2, char *texto3 ); + +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; + + startceh(); + + FileRow = FileCurrTopRow = 0; + + olddrive = getdisk(); + getcwd( oldpath, 229 ); + + void *C_Texto; + +C_Texto = malloc( JD_imagesize(240, 140, 400, 340) ); +S_File = (SFile *)malloc( sizeof(SFile) * 201 ); + +if( C_Texto == NULL || S_File == NULL ) { + closegraph(); + cprintf("\n\rSALIENDO"); + cprintf("\n\rImposible encontrar %ldKbytes en el Heap", ( JD_imagesize(240, 140, 400, 340) + sizeof(SFile)*201 ) ); + return 0; +} + +rasterscan( comodin_name ); + +gettextsettings(&textinfo); + +getimage( 240, 140, 400, 340, C_Texto); + + + Imprime_Estaticos( 10, "PLC.DAT"); // Imprime botones estaticos 'Seccion 20' +//Fichero_bot(10); + + +settextstyle( SMALL_FONT, HORIZ_DIR, 4); + +setcolor( 1 ); +outtextxy( 250+( ( 141 - textwidth(texto1) ) / 2 ), 150, texto1 ); + +PrintWholeScreen_Files(); +PrintSelectRow( 1 ); + + +while(!ok){ // Bucle infinito + + switch( Comprueba_Secuencia( 4 ) ) { // 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, CFG.Colores.F_Texto, 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( "Fichero Existe", " Reemplazarlo ?","" ) == 0 ) 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); + +free ( C_Texto ); +free ( 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==200) 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==200) 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[200].files," -- NONE -- "); + S_File[200].filesize=-1; + return maxfiles; +} + + + +void PrintWholeScreen_Files(void ) +{ + + int OldFileRow = FileRow ; + char Contador; + + setfillstyle( SOLID_FILL, 0 ); + bar(252, 187, 372, 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[10]; + char Buff2[10]; + if ( Hide_Show==0 ) + { + setfillstyle( SOLID_FILL, 0 ); + bar(252, 188 + ( FileRow * 10 ) , 373, 187 + 10 + ( FileRow * 10 ) ); + setcolor( CFG.Colores.Texto ); + } else { + setfillstyle( SOLID_FILL, CFG.Colores.F_Texto ); + bar(252, 188 + ( FileRow * 10 ) , 373, 187 + 10 + ( FileRow * 10 ) ); + setcolor(0); + } + +switch( S_File[FileRow + FileCurrTopRow].attrs ) +{ + case FA_DIREC: + sprintf(Buffer, "%-13s < DIR >", S_File[FileRow+FileCurrTopRow].files +// strncpy( Buff1, S_File[FileRow+FileCurrTopRow].files, 8)//, +// strrev(strncpy( Buff2, strrev(S_File[FileRow+FileCurrTopRow].files), 3)) +); + break; + case 255: + sprintf(Buffer, "%-8s >DRIVER<", strncpy( Buff1, S_File[FileRow+FileCurrTopRow].files, 8) ); + break; + default: + + sprintf(Buffer, "%-13s", S_File[FileRow+FileCurrTopRow].files); + outtextxy( 252 , 187 + ( FileRow * 10 ) , Buffer ); + sprintf(Buffer, " %7lu", S_File[FileRow+FileCurrTopRow].filesize ); + +// sprintf(Buffer, "%-13s%7lu", S_File[FileRow+FileCurrTopRow].files, +// S_File[FileRow+FileCurrTopRow].filesize ); + break; +} + + outtextxy( 252 , 187 + ( FileRow * 10 ) , Buffer ); + +} + +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( CFG.Colores.Texto ); + 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; +} diff --git a/PLC_RUN.CPP b/PLC_RUN.CPP new file mode 100644 index 0000000..9f7a376 --- /dev/null +++ b/PLC_RUN.CPP @@ -0,0 +1,1423 @@ +#include +#include + +#include + +#include +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON +#include "PLC.H" + + + + +// +// +// +// +// +// +// +// +// +// + + + struct Make_Boton { + unsigned int Up, Left, Down, Right; + unsigned char Cdf, Cb1, Cb2; + unsigned char Ab, Pb; + unsigned char Isc, Sc; + }; + + extern struct Make_Boton far *Botones; // Puntero a estructura + extern void Imprime_Boton_i(struct Make_Boton Bot_Imp); + extern int P_Sec(int numero); + extern int lee_objeto(FILE *); + extern void Deprime_Image(struct Make_Boton Bot_Imp); + extern void Imprime_Boton(int D_Bord, struct Make_Boton Bot_Imp); + extern char True_Push, // Parametros para el TRUE_PUSH + Push; // PRESION REAL !!! + extern void far *arrow; // YA !!! + extern int Secuencias, *n_Botones_Secuencia; + extern char memoria_asignada, vez; + extern struct Make_Boton far *Botones; // Puntero a estructura + +void Anclar_Raton_PLC(void); +// +// +// +// +// +// +// +// + +// +//#define Comprueba_Secuencia_PLC(2) Comprueba_Secuencia(2) +// +extern int Muestra_Mensaje(int Mensaje, char *file) ; +extern Puertas DebugCode ; +extern void UpRow(void) ; +extern void DownRow(void) ; +extern void PrintCurrLine ( char Oculta_Mark, char Ultima ) ; +extern void PrintVisorLCD ( char Ultima ) ; +extern void MuestraLCD( char *texto1, char *texto2) ; +extern void redefine_cursor_raton(int r_e) ; +int Comprueba_Secuencia_PLC(char Sec_num ) ; + + +extern int CurrRow , + CurrTopLine ; +extern char CurrCol ; + + +extern MemoriaRam *Ram; +extern FirmWare far *Programa; + +extern char CurrCh_In , + CurrCh_Out ; + +extern Configuracion CFG; + +char Running = 0; + +void Run(void); +void Instala_Int8(void); +void DesInstala_Int8(void); +void Ejecuta_Programa(void); +void Ejecuta_Programa_BETA(void); +void remapea_relojes(void); + +void Ejecuta_Programa(void) +{ +} + +void Instala_Int8(void){ +} +void DesInstala_Int8(void){ +} + + +void Run(void) +{ + char ok = 0, Boton_Pulsado/*, Tipo_Run = 0*/; + Running = 1; + // + CFG.Int8.Bit = 0; + // + + Imprime_Estaticos( 3, "PLC.dat"); +// Fichero_bot(3); + + redefine_cursor_raton(1); // Modo RUN + remapea_relojes(); + if ( CFG.Int8.Bit ) Instala_Int8(); +/* + else + Tipo_Run = 1; +*/ + activa_raton(); +do{ + if ( CFG.Int8.Bit == 0 ) Ejecuta_Programa_BETA(); + Boton_Pulsado = ( CFG.Int8.Bit ? Comprueba_Secuencia( 2 ) : Comprueba_Secuencia_PLC( 2 ) ); + switch( Boton_Pulsado ) { // Iniciamos comprobacion + + case 0: // No se pulso ningun BOTON + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + break; + case -1: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + case -2: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + case R_In0 : + case R_In1 : + case R_In2 : + case R_In3 : + case R_In4 : + case R_In5 : + case R_In6 : + case R_In7 : + case R_In8 : + case R_In9 : + case R_In10 : + case R_In11 : + case R_In12 : + case R_In13 : + case R_In14 : + case R_In15 : + if ( CurrCh_In != (5) ) { + if ( Ram -> In[Boton_Pulsado - R_In0][CurrCh_In].Bit == 1 ) { +// Ram -> CoIn[Boton_Pulsado - R_In0 ][CurrCh_In].Bit = Ram -> In[Boton_Pulsado - R_In0 ][CurrCh_In].Bit; + Ram -> In[Boton_Pulsado - R_In0 ][CurrCh_In].Bit = 0; + desactiva_raton(); + Imprime_Bordes(2, Boton_Pulsado, -1); + activa_raton(); + } else { +// Ram -> CoIn[Boton_Pulsado - R_In0 ][CurrCh_In].Bit = Ram -> In[Boton_Pulsado - R_In0 ][CurrCh_In].Bit; + Ram -> In[Boton_Pulsado - R_In0 ][CurrCh_In].Bit = 1; + desactiva_raton(); + Imprime_Bordes(2, Boton_Pulsado, 2); + activa_raton(); + } + } + break; + case R_Ch00_In : + case R_Ch01_In : + case R_Ch02_In : + case R_Ch03_In : + case R_Ch04_In : + case R_Ch19_In : + desactiva_raton(); + Imprime_Bordes(2, (CurrCh_In + R_Ch00_In ), -1); + CurrCh_In = ( Boton_Pulsado - R_Ch00_In ); + Imprime_Bordes(2, Boton_Pulsado, 4); + ReImprimeCanal_In(CurrCh_In); + activa_raton(); + break; + case R_Ch00_Out : + case R_Ch01_Out : + case R_Ch02_Out : + case R_Ch03_Out : + case R_Ch04_Out : + case R_Ch19_Out : + desactiva_raton(); + Imprime_Bordes(2, (CurrCh_Out + R_Ch00_Out ), -1); + CurrCh_Out = ( Boton_Pulsado - R_Ch00_Out ); + Imprime_Bordes(2, Boton_Pulsado, 4); + ReImprimeCanal_Out(CurrCh_Out); + activa_raton(); + break; + case R_Stop : + desactiva_raton(); + Running = 0; + ok = 1; + break; + + case R_Up : + desactiva_raton(); + PrintCurrLine ( 0, 0 ); // Ocultamos linea anterior + UpRow(); + Programa[10000] = Programa[CurrRow + CurrTopLine ]; + PrintCurrLine( 1, 1 ); + PrintVisorLCD ( 1 ); + activa_raton(); + break; + case R_Down : + desactiva_raton(); + PrintCurrLine ( 0, 0 ); // Ocultamos linea anterior + DownRow(); + Programa[10000] = Programa[ CurrRow + CurrTopLine ]; + PrintCurrLine( 1, 1 ); + PrintVisorLCD ( 1 ); + activa_raton(); + break; + + default: + break; + } + + if ( !Running ) ok = 1; + +}while(!ok); + + if ( CFG.Int8.Bit ) DesInstala_Int8(); + Imprime_Estaticos( 4, "PLC.dat"); +// Fichero_bot(4); + +redefine_cursor_raton(2); // Modo Edit + + +} + + + +void Ejecuta_Programa_BETA(void){ + + int pq_LD=0; // por cual LD va ? + // Hemos considerado cada LD un bloque de + // resultados lgicos entre las operaciones + // a realizar... + int i = 0; // Variable que ha de avanzar en el contador. + int Cpar; + Puertas ch; + + for( i ; (Programa[i].Comando != End && i != 9999); i++ ) + { + // Primero comprobamos el comando y ejecutamos el subcomando asociado. + switch( Programa[i].Comando) + { + // + // + case 0 : + /*READ NOP Tambien es una funcin !!!! */ + break; + // + // + case Ld : + if( i > 0 && Programa[i-1].Comando == _Out ) pq_LD = 0; + pq_LD++; + switch ( Cpar = Programa[i].Parametros ) { + case 0 : // Sin Parametros + case P_Not : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Entrada... + case 0: case 1: case 2: case 3: case 4: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ); + break; + + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + : + !Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + ); + + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: case 19: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + : + !Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + ); + break; + } + break; + case P_Tr : + case P_Not_Tr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Tmp ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tr ) ? + Ram ->Tr[ Programa[i].Dato ].Bit + : + !Ram ->Tr[ Programa[i].Dato ].Bit + ); + break; + case P_Hr : + case P_Not_Hr : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) <= 9 ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Hr ) ? + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ); + break; + case P_Cnt : + case P_Not_Cnt : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Cnt ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ); + break; + case P_Tim : + case P_Not_Tim : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tim ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ); + break; + } + break; + // + // + case Or : + switch ( Cpar = Programa[i].Parametros ) { + case 0 : + case P_Not : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Entrada... + case 0: case 1: case 2: case 3: case 4: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + : + !Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: case 19: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + : + !Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + } + break; + case P_Ld : + Ram ->_Ld[1].Bit = ( Ram ->_Ld[1].Bit || Ram ->_Ld[2].Bit ); + for(Cpar=2; Cpar<=pq_LD; Cpar++) + Ram ->_Ld[Cpar].Bit = Ram ->_Ld[ Cpar + 1 ].Bit; + pq_LD--; + break; + case P_Tr : + case P_Not_Tr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Tmp ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tr ) ? + Ram ->Tr[ Programa[i].Dato ].Bit + : + !Ram ->Tr[ Programa[i].Dato ].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + case P_Hr : + case P_Not_Hr : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) <= 9 ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Hr ) ? + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + case P_Cnt : + case P_Not_Cnt : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Cnt ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + case P_Tim : + case P_Not_Tim : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tim ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ) + || + Ram ->_Ld[pq_LD].Bit; + break; + + } + break; + // + // + case And : + switch ( Cpar = Programa[i].Parametros ) { + case 0 : + case P_Not : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Entrada... + case 0: case 1: case 2: case 3: case 4: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->In [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + : + !Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: case 19: + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == 0 ) ? + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + : + !Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [ (Programa[i].Dato / 100 ) - 10 ].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + } + break; + case P_Ld : + Ram ->_Ld[1].Bit = ( Ram ->_Ld[1].Bit && Ram ->_Ld[2].Bit ); + for(Cpar=2; Cpar<=pq_LD; Cpar++) + Ram ->_Ld[Cpar].Bit = Ram ->_Ld[ Cpar + 1 ].Bit; + pq_LD--; + break; + case P_Tr : + case P_Not_Tr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Tmp ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tr ) ? + Ram ->Tr[ Programa[i].Dato ].Bit + : + !Ram ->Tr[ Programa[i].Dato ].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + case P_Hr : + case P_Not_Hr : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) <= 9 ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Hr ) ? + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + : + !Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + case P_Cnt : + case P_Not_Cnt : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Cnt ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + case P_Tim : + case P_Not_Tim : + if ( ( Programa[i].Dato ) < Numero_Tim ) + Ram ->_Ld[pq_LD].Bit = ( ( Cpar == P_Tim ) ? + Ram ->_Tim [Programa[i].Dato].Bit + : + !Ram ->_Tim [Programa[i].Dato].Bit + ) + && + Ram ->_Ld[pq_LD].Bit; + break; + + } + break; + // + // + case _Out : + switch ( Cpar = Programa[i].Parametros ) { + case 0 : + case P_Not : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + if ( Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit != ( ( Cpar == 0 ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ) ) + { + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = ( ( Cpar == 0 ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ); + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + if ( ( ( Cpar == 0 ) ? Ram ->_Ld[1].Bit : !Ram ->_Ld[1].Bit ) ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + if ( Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit != ( ( Cpar == 0 ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ) ) + { +// Ram ->CoRi[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit; + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = ( ( Cpar == 0 ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ); + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + if ( ( ( Cpar == 0 ) ? Ram ->_Ld[1].Bit : !Ram ->_Ld[1].Bit ) && ( Programa[i].Dato / 100) == 10 ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + } + break; + case P_Tr : + case P_Not_Tr : + if ( Programa[i].Dato < Numero_Tmp ) + { + if ( Ram ->Tr [Programa[i].Dato].Bit != ( ( Cpar == P_Tr ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ) ) + Ram ->Tr [Programa[i].Dato].Bit = ( ( Cpar == P_Tr ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ); + } + break; + case P_Hr : + case P_Not_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + if ( Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit != ( ( Cpar == P_Hr ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ) ) + { +// Ram ->CoHr[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit; + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = ( ( Cpar == P_Hr ) ? + Ram ->_Ld[1].Bit + : + !Ram ->_Ld[1].Bit + ); + } + break; + } + break; + // + // + case Tim : + if ( Programa[i].Dato < Numero_Tim ) + if ( Ram -> _Ld[1].Bit == 0 ) + { + Ram -> _Tim[ Programa[i].Dato ].Bit = 0; + Ram -> Tim_Cnt[ Programa[i].Dato ] = -1; + } else { + if ( Ram -> Tim_Cnt[ Programa[i].Dato ] < 0 ) + Ram -> Tim_Cnt[ Programa[i].Dato ] = clock(); + if ( ( ( ( clock() - Ram -> Tim_Cnt[ Programa[i].Dato ] ) / CLK_TCK ) * 10 ) >= Programa[i].SubDato ) + Ram -> _Tim[ Programa[i].Dato ].Bit = 1; + } + pq_LD = 0; + break; + // + // + case Cnt : + if ( pq_LD >= 2 && Programa[i].Dato < Numero_Tim ) + { + if ( Ram -> _Ld[1].Bit && !Ram -> _Ld[2].Bit ) + { + if ( Ram -> _Cnt[ Programa[i].Dato ].Bit != Ram -> _Ld[1].Bit ) + if ( Ram -> Tim_Cnt[ Programa[i].Dato ] >= (Programa[i].SubDato - 1) ) + Ram -> _Tim[ Programa[i].Dato ].Bit = 1; + else { + Ram -> Tim_Cnt[ Programa[i].Dato ]++; + Ram -> _Tim[ Programa[i].Dato ].Bit = 0; + } + } + if ( Ram -> _Ld[2].Bit ) + { + Ram -> Tim_Cnt[ Programa[i].Dato ] = 0; + Ram -> _Tim[ Programa[i].Dato ].Bit = 0; + } + Ram -> _Cnt[ Programa[i].Dato ].Bit = Ram -> _Ld[1].Bit; + } + pq_LD = 0; + break; + // + // + case Sft : + // Registro de desplazamiento v2.0 + if ( pq_LD >= 3 ) + { + // Entrada de Reposicin + if ( Ram -> _Ld[3].Bit ) + { + switch ( Programa[i].Parametros ) + { + case 0 : + if ( (Programa[i].Dato - 5) <= 4 && (Programa[i].SubDato - 5) <= 4 ) + for ( Cpar = (Programa[i].Dato - 5); Cpar <= (Programa[i].SubDato - 5); Cpar ++ ) + for ( auto char Prop = 0; Prop < 16; Prop ++ ) + if( Ram ->Out[ Prop ] [ Cpar ].Bit ) + { + desactiva_raton(); + Ram ->Out[ Prop ] [ Cpar ].Bit = 0; + if ( CurrCh_Out == Cpar ) + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + else + if ( (Programa[i].Dato - 10) <= 8 && (Programa[i].SubDato - 10) <= 8 ) + for ( Cpar = (Programa[i].Dato - 10); Cpar <= (Programa[i].SubDato - 10); Cpar ++ ) + for ( auto char Prop = 0; Prop < 16; Prop ++ ) + + if ( Ram ->Ri [ Prop ] [ Cpar ].Bit ) + { + Ram ->Ri [ Prop ] [ Cpar ].Bit = 0; + if ( CurrCh_Out == Cpar ) + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + } + break; + case P_Hr: + if ( Programa[i].Dato <= 9 ) + for ( Cpar = (Programa[i].Dato - 5); Cpar <= (Programa[i].SubDato - 5); Cpar ++ ) + for ( auto char Prop = 0; Prop < 16; Prop ++ ) + { + Ram ->Hr [ Prop ] [ Cpar ].Bit = 0; + if ( CurrCh_Out == Cpar ) + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + } + break; + } + } else { + if ( !Ram -> Pre_Ld[i].Bit && Ram -> _Ld[2].Bit ) + { + auto char Prop; + switch ( Programa[i].Parametros ) + { + case 0 : + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( (Programa[i].SubDato-5) < (Numero_Out - 1) ) + { + for ( Cpar = (Programa[i].SubDato - 5); Cpar >=(signed int)(Programa[i].Dato - 5); Cpar -- ) + for ( Prop = 15; Prop >= 0; Prop-- ) + { + if ( Prop != 0 ) + { + if(Ram ->Out[ Prop ] [ Cpar ].Bit != Ram -> Out[Prop - 1][Cpar].Bit) + { + Ram ->Out[ Prop ] [ Cpar ].Bit = Ram -> Out[Prop - 1][Cpar].Bit; + if ( CurrCh_Out == Cpar ) + { + desactiva_raton(); + if ( Ram ->Out[ Prop ] [ Cpar ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( Prop + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + } + } + else if( Cpar != 0 ) + if(Ram ->Out[ Prop ] [ Cpar ].Bit != Ram -> Out[15][Cpar-1].Bit) + { + Ram ->Out[ Prop ] [ Cpar ].Bit = Ram -> Out[15][Cpar-1].Bit; + if ( CurrCh_Out == Cpar ) + { + desactiva_raton(); + if ( Ram ->Out[ Prop ] [ Cpar ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( Prop + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + } + } + if (Ram ->Out[ 0 ] [ (signed int)(Programa[i].Dato - 5) ].Bit != Ram -> _Ld[1].Bit ) + { + Ram ->Out[ 0 ] [ (signed int)(Programa[i].Dato - 5) ].Bit = Ram -> _Ld[1].Bit; + if ( CurrCh_Out == (signed int)(Programa[i].Dato - 5) ) + { + desactiva_raton(); + if ( Ram ->Out[ 0 ] [ (signed int)(Programa[i].Dato - 5) ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( B_Out0 ), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( B_Out0 ), -1); + activa_raton(); + } + } + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + if ( (Programa[i].SubDato-10) <= 8 ) + { + for ( Cpar = (Programa[i].SubDato - 10); Cpar >= (signed int)(Programa[i].Dato - 10); Cpar -- ) + for ( Prop = 8; Prop >= 0; Prop-- ) + { + if ( Prop != 0 ) + if ( Ram ->Ri [ Prop ] [ Cpar ].Bit != Ram -> Ri [Prop - 1][Cpar].Bit ) + { + Ram ->Ri [ Prop ] [ Cpar ].Bit = Ram -> Ri [Prop - 1][Cpar].Bit; + if ( CurrCh_Out == 5 ) + { + desactiva_raton(); + if ( Ram ->Out[ Prop ] [ Cpar ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( Prop + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + } + else if( Cpar != 0 ) + if ( Ram ->Ri [ Prop ] [ Cpar ].Bit != Ram -> Ri [16][Cpar-1].Bit ) + { + Ram ->Ri [ Prop ] [ Cpar ].Bit = Ram -> Ri [16][Cpar-1].Bit; + if ( CurrCh_Out == 5 ) + { + desactiva_raton(); + if ( Ram ->Out[ Prop ] [ Cpar ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( Prop + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + } + } + if(Ram ->Ri [ 0 ] [ (signed int)(Programa[i].Dato-10) ].Bit != Ram -> _Ld[1].Bit) + { + desactiva_raton(); + Ram ->Ri [ 0 ] [ (signed int)(Programa[i].Dato-10) ].Bit = Ram -> _Ld[1].Bit; + if ( CurrCh_Out == 5 ) + if ( Ram ->Out[ 0 ] [ (signed int)(Programa[i].Dato-10) ].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ( Prop + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ( Prop + B_Out0), -1); + activa_raton(); + } + } + break; + } + break; + case P_Hr : + // Canales de Internos no volatiles. ( HR ). + if ( (Programa[i].SubDato) <= 9 && (Programa[i].SubDato-9) <= 9 ) + { + for ( Cpar = (Programa[i].SubDato - 9); Cpar >= (signed int)(Programa[i].Dato - 9); Cpar -- ) + for ( Prop = 8; Prop >= 0; Prop-- ) + { + if ( Prop != 0 ) + Ram ->Hr [ Prop ] [ Cpar ].Bit = Ram -> Hr [Prop - 1][Cpar].Bit; + else if( Cpar != 0 ) + Ram ->Hr [ Prop ] [ Cpar ].Bit = Ram -> Hr [16][Cpar-1].Bit; + } + Ram ->Hr [ 0 ] [ (signed int)(Programa[i].Dato-9) ].Bit = Ram -> _Ld[1].Bit; + } + break; + } + } + + } + + pq_LD = 0; + } + + { + Ram -> Pre_Ld[i].Bit = Ram -> _Ld[2].Bit; + ch.Bit = 0; + } + break; + // + // + case Keep : + if ( pq_LD >= 2 ) + { + char ok; + switch ( Programa[i].Parametros ) { + case 0 : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + ok = Ram -> Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit; + if( Ram -> _Ld[ 1 ].Bit && !Ram -> _Ld[ 2 ].Bit ) Ram -> Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 1; + if( Ram -> _Ld[ 2 ].Bit ) Ram -> Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 0; + if( ok != Ram -> Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit ) + { + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + if ( Ram -> Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + ok = Ram -> Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )].Bit; + if( Ram -> _Ld[ 1 ].Bit && !Ram -> _Ld[ 2 ].Bit ) Ram -> Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-10].Bit = 1; + if( Ram -> _Ld[ 2 ].Bit ) Ram -> Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-10].Bit = 0; + if( ok != Ram -> Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-10].Bit ) + { + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )) ) + { + desactiva_raton(); + if ( ( Ram ->_Ld[ 1 ].Bit ) && ( Programa[i].Dato / 100) == 10 ) + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + else + // Ponemos el borde correspondiente a OFF + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + } + break; + case P_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + { + if( Ram -> _Ld[1].Bit && !Ram -> _Ld[2].Bit ) Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 1; + if( Ram -> _Ld[2].Bit ) Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 1; + } + break; + } + } + pq_LD = 0; + break; + + // + // + case DifU : +// printf("%d %d\n",Ram -> Pre_Ld[i].Bit, Ram -> _Ld[1].Bit); + if ( !Ram -> Pre_Ld[i].Bit && Ram -> _Ld[1].Bit ) + { + switch ( Programa[i].Parametros ) { + case 0 : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 1; + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + activa_raton(); + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100) - 10].Bit = 1; + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + activa_raton(); + } + break; + } + case P_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 1; + break; + } + } + else + // Si el Dato esta activo se desactiva... + switch ( Programa[i].Parametros ) { + case 0 : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + if ( Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit ) + { + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 0; + + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + if ( Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100) - 10].Bit ) + { + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100) - 10].Bit = 0; + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + } + case P_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 0; + break; + } + + pq_LD = 0; + break; + // + // + case DifD : + if ( Ram -> Pre_Ld[i].Bit && !Ram -> _Ld[1].Bit ) + { + switch ( Programa[i].Parametros ) { + case 0 : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 1; + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + activa_raton(); + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100)-10 ].Bit = 1; + if ( CurrCh_Out == 5 ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), 2); + activa_raton(); + } + break; + } + case P_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 1; + break; + } + } + else + // Si el Dato esta activo se desactiva... + switch ( Programa[i].Parametros ) { + case 0 : + // Miro si esta en el rango de Ch(xx00-15) [N IO's] + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out ) + // Miro que canal esta usando para canalizarlo correctamente + switch ( Programa[i].Dato / 100) + { + // Canales de Salida... + case 5: case 6: case 7: case 8: case 9: + if ( Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit ) + { + Ram ->Out[( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100 )-5].Bit = 0; + + if ( CurrCh_Out == ( (Programa[i].Dato / 100 )-5) ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + // Canales de Internos ( Reles Internos ). + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: // case 19: + if ( Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100)-10 ].Bit ) + { + Ram ->Ri [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [(Programa[i].Dato / 100)-10 ].Bit = 0; + if ( CurrCh_Out == 5 ) + { + desactiva_raton(); + // Ponemos el borde correspondiente a ON + Imprime_Bordes(1, ((( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )) + B_Out0), -1); + activa_raton(); + } + } + break; + } + case P_Hr : + if ( ( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 ) < Numero_Out && ( Programa[i].Dato / 100) < 9 ) + Ram ->Hr [( Programa[i].Dato - ( Programa[i].Dato / 100 ) * 100 )] [Programa[i].Dato / 100 ].Bit = 0; + break; + } + pq_LD = 0; + break; + // + // + case TimH : + if ( Programa[i].Dato < Numero_Tim ) + if ( Ram -> _Ld[1].Bit == 0 ) + { + Ram -> _Tim[ Programa[i].Dato ].Bit = 0; + Ram -> Tim_Cnt[ Programa[i].Dato ] = -1; + } else { + if ( Ram -> Tim_Cnt[ Programa[i].Dato ] < 0 ) + Ram -> Tim_Cnt[ Programa[i].Dato ] = clock(); + if ( ( ( ( clock() - Ram -> Tim_Cnt[ Programa[i].Dato ] ) / CLK_TCK ) * 100 ) >= Programa[i].SubDato ) + Ram -> _Tim[ Programa[i].Dato ].Bit = 1; + } + pq_LD = 0; + break; +// +// +// +// +// +// +// +// + // + // + case Cmp : + pq_LD = 0; + break; + // + // + case Mov : + pq_LD = 0; + break; + // + // + case Mvn : + pq_LD = 0; + break; + // + // + case Add : + pq_LD = 0; + break; + // + // + case Sub : + pq_LD = 0; + break; + // + // + case Stc : + pq_LD = 0; + break; + // + // + case Clc : + pq_LD = 0; + break; + // + // + case End : + pq_LD = 0; + break; + // + // + case Il : + break; + // + // + case Ilc : + break; + + default: + Muestra_Mensaje(501, "PLC.DAT"); + Running = 0; + break; + } + + ////// Mantiene los relojes de TIEMPO + ///////////////////////////////////////////////////////////////////// + /////////////////// Contadores internos 1900 a 1902 ///////////////// + ///////////////////////////////////////////////////////////////////// + /* 1900 0'1s 0'05s */ + /* 1901 0'2s 0'1 s */ + /* 1902 1 s 0'5 */ + ////////////////////////////////////// +// 1900 + if ( ( ( (clock() - Ram ->Contador_de_Tiempo[0] ) / CLK_TCK) ) >= 0.05 ) + if ( Ram ->Ri [ 0 ] [ 9 ].Bit == 0 ) + { + Ram ->Ri [ 0 ] [ 9 ].Bit = 1; +Ram ->Contador_de_Tiempo[0] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 0), -1); + activa_raton(); + } + } else { + Ram ->Ri [ 0 ] [ 9 ].Bit = 0; +Ram ->Contador_de_Tiempo[0] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 0), 2); + activa_raton(); + } + } +// 1901 + if ( ( ( (clock() - Ram ->Contador_de_Tiempo[1] ) / CLK_TCK) ) >= 0.1 ) + if ( Ram ->Ri [ 1 ] [ 9 ].Bit == 0 ) + { + Ram ->Ri [ 1 ] [ 9 ].Bit = 1; +Ram ->Contador_de_Tiempo[1] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 1), -1); + activa_raton(); + } + } else { + Ram ->Ri [ 1 ] [ 9 ].Bit = 0; +Ram ->Contador_de_Tiempo[1] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 1), 2); + activa_raton(); + } + } + +// 1902 + if ( ( ( (clock() - Ram ->Contador_de_Tiempo[2] ) / CLK_TCK) ) >= 0.5 ) + + if ( Ram ->Ri [ 2 ] [ 9 ].Bit == 0 ) + { + Ram ->Ri [ 2 ] [ 9 ].Bit = 1; +Ram ->Contador_de_Tiempo[2] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 2), -1); + activa_raton(); + } + } else { + Ram ->Ri [ 2 ] [ 9 ].Bit = 0; +Ram ->Contador_de_Tiempo[2] = clock(); + if ( CurrCh_In == 5 ) + { + desactiva_raton(); + Imprime_Bordes(2, (R_In0 + 2), 2); + activa_raton(); + } + } + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + if ( ch.Bit ) + Ram -> Pre_Ld[i].Bit = Ram -> _Ld[1].Bit; + else + ch.Bit = 1; + + + } + + if ( i == 9999 ) + { + Muestra_Mensaje(500, "PLC.DAT"); + Running = 0; + return; + } + +} + + + + +// Esta funcin se diferencia de la original, en no ser fija: es decir que +// tras cada llamada vuelve, se pulse o no un boton, para poder continuar +// utilizando MB y otras cosas a la vez.... +int Comprueba_Secuencia_PLC(char Sec_num ) +{ + +// char boton_izq=0, boton_der=0; + char key, key2=0; + char i, Pulso = 0; + int psec = P_Sec(Sec_num-1); + + union REGS io; + io.x.ax = 3; + + + + if ( kbhit() ) { + + if ( (key = getch())==0) key2 = getch(); + for(i=0; i> 1) & 1; + x_raton = io.x.cx; + y_raton = io.x.dx; + + + for(i = 0; i < n_Botones_Secuencia[Sec_num-1]; i++) + if( (x_raton >= Botones[psec+i].Left) && (x_raton <= Botones[psec+i].Right) && + (y_raton >= Botones[psec+i].Up) && (y_raton <= Botones[psec+i].Down) ) { + + Pulso = i + 1; + Push = ON; + desactiva_raton(); + Imprime_Boton_i(Botones[psec+Pulso-1]); + Anclar_Raton_PLC(); +// delay(10); + if( Push == ON && True_Push == ON ) Deprime_Image(Botones[psec+Pulso-1]); + Push = OFF; + Imprime_Boton(0, Botones[psec+Pulso-1]); + activa_raton(); + return Pulso; + } + } + + return (0); +} + +void Anclar_Raton_PLC(void){ + + union REGS io; + io.x.ax = 3; + do { + int86(0x33, &io, &io); + Ejecuta_Programa_BETA(); + } while( (io.x.bx & 1)==1 || ((io.x.bx >> 1) & 1)==1); +} + +void remapea_relojes(void) +{ + int i, ch; + for( i=0; i<200; i++ ) + Ram -> _Ld[i].Bit = 0; + for( i=0; i<9999; i++ ) + Ram -> Pre_Ld[i].Bit = 0; + for(ch=0;ch<10;ch++ ) + for( i=0; iHr[i][ch].Bit; + for(ch=0;ch<10;ch++ ) + for( i=0; iRi[i][ch].Bit; + for(ch=0;chTr[ch].Bit; + for(ch=0;ch_Cnt[ch].Bit; + for(ch=0;ch_Tim[ch].Bit; +/* + for(ch=0;ch<3;ch++ ) + Ram ->Bt[i].Bit = 1; +*/ + for(ch=0;chTim_Cnt[ch] = 0; + for(ch=0;ch<3;ch++ ) + Ram ->Contador_de_Tiempo[ch] = clock(); + +} diff --git a/PLC_UTIL.CPP b/PLC_UTIL.CPP new file mode 100644 index 0000000..285d7a7 --- /dev/null +++ b/PLC_UTIL.CPP @@ -0,0 +1,221 @@ +#include + +#include + +#include +#include +#include +#include +#include + + +#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON + +//extern int Fichero_bot(char Dinamicos_Estaticos); + +struct Colores { + char Texto; + char F_Texto; + char VisorLCD; +}; + +typedef struct { + + struct Colores Colores; + +} Configuracion; +extern Configuracion CFG; + + + +char Optar( char *texto1, char *texto2, char *texto3 ); +int Muestra_Mensaje(int Mensaje, char *file); +void redefine_cursor_raton(int r_e); + +char Optar( char *texto1, char *texto2, char *texto3 ){ + + int ok = 0, inst = 0; + struct textsettingstype textinfo; + + void *C_Texto, *C_Aceptar, *C_Cancelar; + +C_Texto = malloc( JD_imagesize(200, 212, 440, 267) ); +C_Aceptar = malloc( JD_imagesize(200, 270, 280, 295) ); +C_Cancelar = malloc( JD_imagesize(360, 270, 440, 295) ); + +if( C_Texto == NULL || C_Aceptar == NULL || C_Cancelar == NULL) { + closegraph(); + cprintf("\n\rSALIENDO"); + cprintf("\n\rImposible encontrar %ldKbytes en el Heap", + ( JD_imagesize(118, 160, 521, 335) + + JD_imagesize(118, 160, 521, 335) + + JD_imagesize(118, 160, 521, 335) + ) + ); + exit(SIN_MEMORIA); +} + +gettextsettings(&textinfo); + +settextstyle(SMALL_FONT, HORIZ_DIR, 5 ); +// settextjustify(CENTER_TEXT, CENTER_TEXT); + +getimage(200, 212, 440, 267, C_Texto); +getimage(200, 270, 280, 295, C_Aceptar); +getimage(360, 270, 440, 295, C_Cancelar); + + + Imprime_Estaticos(100, "PLC.DAT"); // Imprime botones estaticos 'Seccion 20' +// Fichero_bot(100); + Imprime_Secuencia(3); // Imprime secuencia 4. + Imprime_Estaticos(101, "PLC.DAT"); // Imprime textos estaticos 'Seccion 5' +// Fichero_bot(101); + +outtextxy( 210+( ( 230 - textwidth(texto1) ) / 2 ), 220, texto1 ); +outtextxy( 210+( ( 230 - textwidth(texto2) ) / 2 ), 235, texto2 ); +outtextxy( 210+( ( 230 - textwidth(texto3) ) / 2 ), 250, texto3 ); + +while(!ok){ // Bucle infinito + + switch( Comprueba_Secuencia( 3 ) ) { // 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( getch() ) { // La utilizamos + // ESC ( CANCELAR ) + case 14: + inst = 0; + ok = 1; + break; + default: + break; + } + break; + case -1: // Hay una tecla especial en BUFFER + getch(); // La eliminamos + break; + // Boton Aceptar + case 1: + inst = 1; + ok = 1; + break; + // Boton Cancelar + case 2: + inst = 0; + ok = 1; + break; + default: + while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER + break; + } + +} + + +putimage(200, 212, C_Texto, COPY_PUT); +putimage(200, 270, C_Aceptar, COPY_PUT); +putimage(360, 270, C_Cancelar, COPY_PUT); + +free ( C_Texto ); +free ( C_Aceptar ); +free ( C_Cancelar ); + + +settextstyle(textinfo.font, textinfo.direction, textinfo.charsize ); +settextjustify(textinfo.horiz, textinfo.vert); + +return inst; + + + +} + + + +int Muestra_Mensaje(int Mensaje, char *file) { + void *Imagen; + + + if ( (Imagen = malloc( JD_imagesize(200, 212, 440, 267) ) ) == NULL ) { + Espera_Tecla_o_Raton(); + Anclar_Raton(); + return -1; + } else { + getimage( 200, 212, 440, 267, Imagen ); + Imprime_Estaticos( Mensaje, file); +// Fichero_bot( Mensaje ); + + Espera_Tecla_o_Raton(); + Anclar_Raton(); + putimage( 200, 212, Imagen, COPY_PUT); + free(Imagen); + return 1; + } +} + +void redefine_cursor_raton(int r_e){ + + struct SREGS seg; + union REGS ent, sal; + long dir; + +extern int dir_raton [32+32]; + +if(r_e==1) { //// Cursor mientras se ejecuta +int dir_rton [32+32] = { + + 0x0808, /* 1 1 */ + 0x0000, /* */ + 0x0000, /* */ + 0x0000, /* */ + 0x0800, /* 1 */ + 0x0000, /* */ + 0x0000, /* */ + 0x8000, /*1 */ + 0x8083, /*1 1 1*/ + 0x8001, /*1 1*/ + 0xF810, /*1 1 1 1 1 1 1*/ + 0x8810, /*1 1 1 1*/ + 0x8811, /*1 1 1 1*/ + 0x8003, /*1 1 1*/ + 0x8007, /*1 1 1 1*/ + 0x800F, /*1 1 1 1 1*/ + + 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x7252, /*0 0 0 0 0 0 0 0 0*/ + 0x4A5A, /*0 0 0 0 0 0 0 0 0*/ + 0x725A, /*0 0 0 0 0 0 0 0*/ + 0x6256, /*0 0 0 0 0 0 0 0 0*/ + 0x5256, /*0 0 0 0 0 0 0 0 0*/ + 0x4992, /*0 0 0 0 0 0 0 0 0 0*/ + 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x3E70, /*0 0 0 0 0 0 0 0*/ + 0x0248, /*0 0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x0244, /*0 0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x0242, /*0 0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x2244, /*0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x2248, /*0 0 0 0 0 0 0 0 0 0 0 0*/ + 0x3E70, /*0 0 0 0 0 0 0 0*/ + 0x0000 /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/ + }; + dir = (long)dir_rton; + +} else { //// Cursor mientras se edita + dir = (long)dir_raton; +} + + ent.x.ax = 9; + ent.x.bx = 0; + ent.x.cx = 0; + ent.x.dx = (int) dir; + seg.es = (int) (dir >> 16); + int86x(0x33, &ent, &sal, &seg); /* asigna un cursor diferente */ + + ent.x.ax = 3; + int86(0x33, &ent, &sal); + + +} diff --git a/R.BAT b/R.BAT new file mode 100644 index 0000000..031ee0a --- /dev/null +++ b/R.BAT @@ -0,0 +1 @@ +edit plc.dat diff --git a/README.md b/README.md new file mode 100644 index 0000000..de6ec34 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +#PLC + + +*05/11/1995* + +ToDo: wwtcf? + + +![screenshot](/PLC.png "Screenshot") diff --git a/SFT.PLC b/SFT.PLC new file mode 100644 index 0000000..3808165 Binary files /dev/null and b/SFT.PLC differ