int main( int argc, char* args[] ) { screen = NULL; //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); // Setup the screen screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_SWSURFACE); Emulator emu; emu.loadFromFile("superkuken"); while(true) { emu.run(); // SDL_Flip(screen); SDL_Delay(0); } //Quit SDL SDL_Quit(); return 0; }
int main( int argc, char *argv[] ){ Emulator *emu; if ( argc > 1 ){ std::cout << "Opening rom file " << argv[1] << std::endl; emu = new Emulator( argv[1] ); emu->run( ); delete emu; } else { std::cout << "Usage: chaps [rom file]" << std::endl; } return 0; }
int main(int argc, char *args[]) { Emulator emulator; //string name = "cpu/cpu_instrs"; //string name = "instr_timing"; //emulator.memory.load_rom("tests/" + name + ".gb"); //emulator.memory.load_rom("roms/Dr. Mario.gb"); //emulator.memory.load_rom("roms/kirby.gb"); //emulator.memory.load_rom("roms/tetris.gb"); //emulator.memory.load_rom("roms/minesweeper.gb"); //emulator.memory.load_rom("roms/Super Mario Land.gb"); //emulator.memory.load_rom("roms/cASTELIAN.gb"); //emulator.memory.load_rom("roms/Serpent.gb"); emulator.memory.load_rom("roms/yupferris.gb"); emulator.run(); return 0; }
void tmain(int ac, const char * av[]) { if ( ac < 2 ) { void usage(); usage(); return; } Context ctx; ctx.init_clo(ac, av); if (ctx.mmcalc) return; Pragma pgm("cryptoleq", CRYPTOLEQVERSION); pgm.load_file("cryptoleq.pgm"); string data = "stdin"; if (!ctx.input_file.empty()) data = file2str(ctx.input_file); if (data.empty()) throw "Cannot read file " + ctx.input_file; if ( ctx.do_translate ) { { std::istringstream is(data); pgm.load_dot_input(is); } pgm.read(ctx.clo_pragma); Compiler comp; { const Pragma & g = pgm; Unumber r = make_unumber(ctx.clo_seed, 0); if ( r.iszero() ) r = g.R(); comp.init_pqkru(g.N(), g.P(), g.Q(), g.K(), r, g.U()); if (g.beta()) comp.proc.setB2Beta(g.beta()); if ( !g.snk.empty() ) comp.sneak = Unumber(g.snk, Unumber::Decimal); for ( auto i : g.include_paths) Input_token_stream::include_paths.push_back(i); } Cell::setN(comp.proc.N); ctx.setcompiler(comp); if ( ctx.bshow ) { ctx.show(); comp.show(); return; } if ( ctx.bcrypt ) { ctx.crypt(); return; } auto token_stream = ctx.tokenize(data); if ( ctx.preproc ) { cout << ctx.write(token_stream, pgm); return; } auto itr = ctx.parse(token_stream, &comp); ctx.evaluate(itr); bool outputx = (pgm.cqtype == pgm.Cqtype::X); auto out_stream = ctx.compile(itr, outputx); data = ctx.write(out_stream, pgm); } if (!ctx.do_emulate) { ctx.save(data); ctx.stat.output_e(); return; } // execute { Emulator emu; Pragma pgm("cryptoleq", CRYPTOLEQVERSION); { std::istringstream in(data); emu.current_input_stream = ∈ emu.mkmem_stream(pgm, ctx.clo_pragma); } Cell::setN(pgm.N()); ProcessorTS proc(pgm.N()); emu.io_type = pgm.io; if ( !ctx.separator.empty() ) emu.sep_ts = emu.sep_x = char(std::atoi(ctx.separator.c_str())); if (!pgm.entry.empty()) emu.entry = str2ts(pgm.entry); Stat * stat = nullptr; if ( !ctx.stat.filename.empty() ) { stat = &ctx.stat; stat->addrinit(); // in case no compilation } emu.run(proc, stat); if (stat) stat->output(); } }