Skip to content

Commit 90940eb

Browse files
authored
Adding '-version' shell option (#299)
1 parent ced8eb0 commit 90940eb

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ x16emu
33
x16emu.exe
44
x16emu_mac.zip
55
x16emu_win.zip
6+
x16-rom
67
rom_labels.h
78
rom.bin
89
chargen.bin
@@ -13,5 +14,4 @@ x16emu.html
1314
x16emu.html.mem
1415
x16emu.js
1516
x16emu.wasm
16-
x16emu.worker.js
17-
17+
x16emu.worker.js

disasm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
int disasm(uint16_t pc, uint8_t *RAM, char *line, unsigned int max_line, bool debugOn, uint8_t bank) {
2121
uint8_t opcode = real_read6502(pc, debugOn, bank);
22-
const char *mnemonic = mnemonics[opcode];
22+
char const *mnemonic = mnemonics[opcode];
2323

2424
//
2525
// Test for branches, relative address. These are BRA ($80) and

main.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "rom_symbols.h"
3535
#include "ym2151.h"
3636
#include "audio.h"
37+
#include "version.h"
3738

3839
#ifdef __EMSCRIPTEN__
3940
#include <emscripten.h>
@@ -379,7 +380,8 @@ is_kernal()
379380
static void
380381
usage()
381382
{
382-
printf("\nCommander X16 Emulator (C)2019 Michael Steil\n");
383+
printf("\nCommander X16 Emulator\tv.%s (%s)", VER, VER_NAME);
384+
printf("(C)2019,2020 Michael Steil\n");
383385
printf("All rights reserved. License: 2-clause BSD\n\n");
384386
printf("Usage: x16emu [option] ...\n\n");
385387
printf("-rom <rom.bin>\n");
@@ -446,6 +448,8 @@ usage()
446448
printf("\tPrint instruction trace. Optionally, a trigger address\n");
447449
printf("\tcan be specified.\n");
448450
#endif
451+
printf("-version\n");
452+
printf("\tPrint additional version information the emulator and ROM.\n");
449453
printf("\n");
450454
exit(1);
451455
}
@@ -772,6 +776,11 @@ main(int argc, char **argv)
772776
audio_buffers = (int)strtol(argv[0], NULL, 10);
773777
argc--;
774778
argv++;
779+
} else if (!strcmp(argv[0], "-version")){
780+
printf("%s", VER_INFO);
781+
argc--;
782+
argv++;
783+
exit(0);
775784
} else {
776785
usage();
777786
}

version.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Commander X16 Emulator
2+
// Copyright (c) 2019, 2020 Michael Steil
3+
// All rights reserved. License: 2-clause BSD
4+
5+
#define VER "37"
6+
#define VER_NAME "Geneva"
7+
#define VER_INFO "### Release 37 (\"Geneva\")\n"

0 commit comments

Comments
 (0)