summaryrefslogtreecommitdiff
path: root/emu/emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'emu/emu.c')
-rw-r--r--emu/emu.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/emu/emu.c b/emu/emu.c
index 7d5c37c..7c8f041 100644
--- a/emu/emu.c
+++ b/emu/emu.c
@@ -4,11 +4,35 @@
#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" );