1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "emul.h"
#include "6502.h"
#include "memory.h"
#include <stdlib.h>
#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 <mail at andreasbaumann dot cc>\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 );
}
|