Exemplo n.º 1
0
int main (int argc, char * argv[]) {
    world = new World("Dclock", argc, argv);
    DoArgs(argc, argv);
    InitData();
    switch (CreateMode) {
	case SWEPT:
	    TheClock = new DFace(
		ShowDate, ShowBorder, ShowTime, TimeMode
	    );
	    world->InsertApplication(TheClock);
	    break;
	case PLACED:
	    TheClock = new DFace(
		ShowDate, ShowBorder, ShowTime, TimeMode, Width, Height
	    );
	    world->InsertApplication(TheClock);
	    break;
	case DEFINED:
	    TheClock = new DFace(
		ShowDate, ShowBorder, ShowTime, TimeMode, Width, Height
	    );
	    world->InsertApplication(TheClock, XPos, YPos);
	    break;
    }
    TheClock->Run();
    return 0;
}
Exemplo n.º 2
0
int main(int argc, char **argv){
    FILE *blah;unsigned char *tmp;
    //if(argc!=0){printf("no config info for me to follw\n");exit(-1);}
    if(argc==1){printf("Nothing to do\nArgs supported are: ?L_com:\"comfile.com\" --it will load a com file\n");
        printf("?L_bin:\"binfile.bin\" --it will load a bin file, the default \"tester\" file is in bin format\n");
        printf("?log:\"logfile.txt\"   --it will use this as the log file\n");
        exit(1);
    }

    printf("Starting Open86\n");
    opcodes_16bit=malloc(0xFF*sizeof(void *)); //trying to get ready for 64bit...lol
    opcodes_debug=malloc(0xFF*sizeof(void *));
    opcodes_disasm=malloc(0xFF*sizeof(void *));
    core=malloc(0x100000+0x1000); //alloc 1meg plus a bit for safe practice
    if(core==NULL){panic("Can't allocate enough memory for core");}
    gregs8[AH]++;
    gregs8[CH]++;
    gregs8[DH]++;
    gregs8[BH]++;
    memset(gregs16,0,2*8); //zero out the general registers
    memset(sregs,0,2*4); //zero segments
    sregs[CS]=0x20;
    ip=0;
    doeip;
    doiptr; //update those
    flagreg=0;
    printf("Cpu State Set!\n");
    tmp=iptr;
    open86_dir=malloc(512);
	config_dir=malloc(512);
	dev_dir=malloc(512);
    tmp_filename=malloc(512);

	 //now have the test code in memory
	//printf("now going to loader...\n");
	//StartExLib();
	//for(;;){}
	//if(SDL_Init(SDL_INIT_EVERYTHING)==-1){
	//	panic("Error initializing SDL!!\n");
	//}
	Devices=malloc(sizeof(void *)*DEV_LIMIT);
	if(Devices==NULL){panic("Could not allocate enough memory for Devices!\n");}
    ports=malloc(sizeof(void *)*0xFFFF); //266k on 32bit machine
    if(ports==NULL){panic("Can't allocate enough memory for ports!\n");}
    memset(ports,0,sizeof(void *)*0xFFFF); //zero it out
    printf("Internal device structures setup!\n");
     InitOpcodes();
     printf("Opcodes initiated!\n");
     printf("setting up devices...\n");
     /**initialize GlobStruct!**/
     GlobStruct=malloc(sizeof(GlobalDevice));
     GlobStruct->_gregs16=gregs16;
     GlobStruct->_gregs8=gregs8;
     GlobStruct->_sregs=sregs;
     GlobStruct->_ip=&ip;
     GlobStruct->_eip=&eip;
     GlobStruct->_iptr=&iptr;
     GlobStruct->_flagreg=&flagreg;
     GlobStruct->_flags=&flags;
     GlobStruct->device_handles=Devices;
     GlobStruct->_dev_i=&dev_i;
     GlobStruct->_ports=ports;
     GlobStruct->_core=core;
     GlobStruct->cpu_lock=0;
     //CalculatePF8(0xAA);
     //if(flags->pf==1){printf("yay!");}
     //flags->cf=1;
     GetOpen86Dir(argv[0]);
	DoArgs(argc,argv);
    printf("Args and such parsed\n");
     ports[0xFF]=&EndMePort;
     ports[0xFA]=&PrintMePort;
     ports[0xFB]=&PrintMemory;
    printf("Devices initiated!\n");
    printf("Done initializing! Now executing instructions\n");
     DoCPU();

}