#include "emul.h" #include "6502.h" #include "memory.h" #include #include "options.h" #include "version.h" static int parse_options_and_arguments( int argc, char *argv[], struct gengetopt_args_info *args_info ) { cmdline_parser_init( args_info ); if( cmdline_parser2( argc, argv, args_info, 1, 0, 1 ) != 0 ) { cmdline_parser_free( args_info ); return 1; } return 0; } int main( int argc, char *argv[] ) { struct gengetopt_args_info args_info; emul_t emul; cpu_6502_t cpu; memory_t memory; if( parse_options_and_arguments( argc, argv, &args_info ) != 0 ) { exit( EXIT_FAILURE ); } if( args_info.long_version_given ) { printf( "emu version: %s, Copyright (c) 2020, LGPLv3, Andreas Baumann \n", EMU_VERSION ); exit( EXIT_SUCCESS ); } memory_init( &memory ); memory_load( &memory, ROM_START, ROM_SIZE, "./rom.bin" ); cpu_6502_init( &cpu, &memory ); //cpu.debug = true; cpu_6502_reset( &cpu ); emul_init( &emul, &cpu, &memory ); emul.gui = true; emul_start( &emul ); emul_run( &emul ); emul_free( &emul ); exit( EXIT_SUCCESS ); }