Beispiel #1
0
void control(SD(sd),
   const Signals& OpCode,
   const Signals& Out)
{
   Signal bits(WORDSIZE, "ROM Output");

   loadRom(controlRom, ROMSIZE * WORDSIZE, "controlUnitRom.txt");
   Rom(SD(sd, "1a"), OpCode, bits, ROMSIZE, WORDSIZE, controlRom);

   for (int ndx = 0; ndx < NUM_BITS; ++ndx)
      Or(SD(sd, "1a"), (bits[ndx], Zero), Out[ndx]);
}
Beispiel #2
0
void simnet() {

   // input to ROM
   Signal address(4, "address");
   Switch("1a", address[3], '3');
   Switch("1a", address[2], '2');
   Switch("1a", address[1], '1');
   Switch("1a", address[0], '0');

   // output from ROM
   Signal bits(8, "ROM Output");

   // burn the rom
   loadRom(romContents, NUM_WORDS, "romfile.txt");

   // instantiate the rom
   Rom("1b", address, bits, ROMSIZE, WORDSIZE, romContents);

   Probe("1c", bits);
}
Beispiel #3
0
int main(int argc, char **argv){

    SDL_Event event;                   //Event handler
    //init_apu();
    int QUIT = FALSE;
    
	if (argc < 2){
		printf("No Rom\n");
		return 1;
	}
	
	if (loadRom(argv[1])){
		return 1;
	}
    
    if (displayInit()){
        return 1;
    }
    
	
	hardwareReset();
    
    printf("[INFO] Version %s\n",version);
	printf("[INFO] System reset done\n");
    printf("[INFO] BUTTON A  = a\n");
    printf("[INFO] BUTTON B  = s\n");
    printf("[INFO] START     = q\n");
    printf("[INFO] SELECT    = w\n");
    printf("[INFO] DIRECTION = arrow keys\n");
    //display();
    
    int count = 0;
	
    while (!QUIT) {
    
        count++;    
        
        if (count > 100){                   /* Poll for events every 100 loops */  
            while (SDL_PollEvent(&event)) {
                
                inputHandleEvents(event);
                
                if( event.type == SDL_QUIT ) { 
                    QUIT = TRUE;
                }
        
                if (event.type == SDL_KEYDOWN){
                    if (event.key.keysym.sym == SDLK_ESCAPE){
                        QUIT = TRUE;
                    }
                    if (event.key.keysym.sym == SDLK_F1){
                        displayEnd();
                        return 1;
                    }
                    if (event.key.keysym.sym == SDLK_F9){
                        hardwareReset();
                    }
                }
                //inputHandleEvents(event);
                
            }
        count = 0;
        }       
              
		execute();
		//inputHandleEvents(event);
	}

    updateMBC2SRAM();   
    displayEnd();
	
return 0;
}
Beispiel #4
0
int main(int argc, char ** argv) {
	// Initialise SDL
	if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0) 
		DIE("SDL_Init: %s", SDL_GetError());

  GL_Init();

  //Init SDL_TTF to print text to the screen...
  if ( TTF_Init() )
  {
    fprintf( stderr, "Error initializing SDL_ttf!\n" );
    exit ( 1 );
  }

	S9xInitDisplay(argc, argv);

	// Configure snes9x
#if CONF_GUI
	OssoInit();						// Hildon-games-wrapper initialization.
#endif
	S9xLoadConfig(argc, argv);		// Load config files and parse cmd line.
  readOptions();
#if CONF_GUI
	OssoConfig();					// Apply specific hildon-games config.
#endif

  // S9x initialization
  S9xInitDisplay(argc, argv);
  S9xInitAudioOutput();
  S9xInitInputDevices();

  while(1)
  {
    S9xInit();
    S9xReset();

    char * rom = romSelector();
    S9xSetRomFile(rom);
    free(rom);

    // Load rom and related files: state, unfreeze if needed
    loadRom();
    resumeGame();

    // Late initialization
    sprintf(String, "DrNokSnes - %s", Memory.ROMName);
    S9xSetTitle(String);
    S9xHacksLoadFile(Config.hacksFile);
    if (!S9xGraphicsInit())
      DIE("S9xGraphicsInit failed");
    S9xAudioOutputEnable(true);
    SDL_PauseAudio(0);
    S9xVideoReset();

    Config.running = true;
    do {
      frameSync();			// May block, or set frameskip to true.
      S9xMainLoop();			// Does CPU things, renders if needed.
      pollEvents();
      //Ouch that this is going here...
      updateBindingMessage();
    } while (Config.running);

    S9xVideoReset();
    S9xGraphicsDeinit();

    // Save state
    Memory.SaveSRAM(S9xGetFilename(FILE_SRAM));
    pauseGame();
    Memory.Deinit();
    S9xDeinitAPU();
  }

  // Deinitialization
  S9xAudioOutputEnable(false);
  S9xDeinitInputDevices();
  S9xDeinitAudioOutput();
  S9xDeinitDisplay();

	// Late deinitialization
	S9xUnloadConfig();
#if CONF_GUI
	OssoDeinit();
#endif

	SDL_Quit();

	return 0;
}
Beispiel #5
0
int main(int argc, char* argv[]){
    SDL_Event e;
    bool quit = false;
    init();
    cpu_init();
    loadMedia();
    loadRom("c8games/TANK");
    while(!quit){
        cycle();
        //debugRender();
        while(SDL_PollEvent(&e) != 0){
            if(e.type == SDL_QUIT){
                quit = true;
            }
            memset(key, 0, sizeof(key));
            if(e.type == SDL_KEYDOWN){
                switch(e.key.keysym.sym){
                    case SDLK_1:
                        key[0] = 1;
                        break;
                    case SDLK_2:
                        key[1] = 1;
                        break;
                    case SDLK_3:
                        key[2] = 1;
                        break;
                    case SDLK_4:
                        key[3] = 1;
                        break;
                    case SDLK_q:
                        key[4] = 1;
                        break;
                    case SDLK_w:
                        key[5] = 1;
                        break;
                    case SDLK_e:
                        key[6] = 1;
                        break;
                    case SDLK_r:
                        key[7] = 1;
                        break;
                    case SDLK_a:
                        key[8] = 1;
                        break;
                    case SDLK_s:
                        key[9] = 1;
                        break;
                    case SDLK_d:
                        key[10] = 1;
                        break;
                    case SDLK_f:
                        key[11] = 1;
                        break;
                    case SDLK_z:
                        key[12] = 1;
                        break;
                    case SDLK_x:
                        key[13] = 1;
                        break;
                    case SDLK_c:
                        key[14] = 1;
                        break;
                    case SDLK_v:
                        key[15] = 1;
                        break;
                }
            }
        }
        drawScreen();
        SDL_UpdateWindowSurface(window);
        SDL_Delay(50);
    }

    close2();
    return 0;
}