98 lines
2.1 KiB
C++
98 lines
2.1 KiB
C++
#include <stdio.h>
|
||
|
||
|
||
#include <alloc.h>
|
||
#include <conio.h>
|
||
#include <stdlib.h>
|
||
#include <graphics.h>
|
||
|
||
|
||
#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 Gr fico
|
||
|
||
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;
|
||
}
|
||
|