From 670a776571399f3ec67061d6c945ffe4d8de3bb2 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 21 Jun 2014 23:08:07 -0700 Subject: [PATCH] Fixes for Linux build --- src/apple2.h | 2 +- src/disk.c | 6 ++++-- src/prefs.c | 3 ++- src/vm.c | 9 +++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/apple2.h b/src/apple2.h index 75538136..b5a63270 100644 --- a/src/apple2.h +++ b/src/apple2.h @@ -27,7 +27,7 @@ /* Symbol naming issues */ #ifdef NO_UNDERSCORES #define SN(foo) foo -#define SNX(foo, INDEX, SCALE) _##foo(%rip,INDEX,SCALE) +#define SNX(foo, INDEX, SCALE) foo(,INDEX,SCALE) #define E(foo) .globl foo; .balign 16; foo##: #define CALL(foo) foo #else /* !NO_UNDERSCORES */ diff --git a/src/disk.c b/src/disk.c index 7edbeebb..ff206b7d 100644 --- a/src/disk.c +++ b/src/disk.c @@ -143,9 +143,10 @@ void c_eject_6(int drive) { { ERRLOG("OOPS: An error occurred when attempting to compress a disk image : %s", err); #ifdef INTERFACE_CLASSIC + int ch = -1; snprintf(&zlibmenu[4][2], 37, "%s", err); c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H); - while ((int ch = c_mygetch(1)) == -1) { + while ((ch = c_mygetch(1)) == -1) { // ... } #endif @@ -190,9 +191,10 @@ int c_new_diskette_6(int drive, const char * const raw_file_name, int force) { { ERRLOG("OOPS: An error occurred when attempting to inflate/load a disk image : %s", err); #ifdef INTERFACE_CLASSIC + int ch = -1; snprintf(&zlibmenu[4][2], 37, "%s", err); c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H); - while ((int ch = c_mygetch(1)) == -1) { + while ((ch = c_mygetch(1)) == -1) { // ... } #endif diff --git a/src/prefs.c b/src/prefs.c index b9378475..f9e3d5e2 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -372,6 +372,7 @@ bool save_settings(void) #define ERROR_SUBMENU_H 9 #define ERROR_SUBMENU_W 40 #ifdef INTERFACE_CLASSIC + int ch = -1; char submenu[ERROR_SUBMENU_H][ERROR_SUBMENU_W+1] = //1. 5. 10. 15. 20. 25. 30. 35. 40. { "||||||||||||||||||||||||||||||||||||||||", @@ -391,7 +392,7 @@ bool save_settings(void) PREFS_ERRPRINT(); #ifdef INTERFACE_CLASSIC c_interface_print_submenu_centered(submenu[0], ERROR_SUBMENU_W, ERROR_SUBMENU_H); - while ((int ch = c_mygetch(1)) == -1) + while ((ch = c_mygetch(1)) == -1) { } #endif diff --git a/src/vm.c b/src/vm.c index 47c0c99e..e7c4d1bb 100644 --- a/src/vm.c +++ b/src/vm.c @@ -142,7 +142,16 @@ GLUE_C_READ(read_keyboard_strobe) GLUE_C_READ(read_random) { +#ifdef __APPLE__ return arc4random_uniform(0x100); +#else + static time_t seed=0; + if (!seed) { + seed = time(NULL); + srandom(seed); + } + return (random() % UINT_MAX); +#endif } GLUE_C_READ(speaker_toggle)