From 3554028fdf4454382698e53fc3744b6902da43b1 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Fri, 29 Dec 2023 08:38:59 +0100 Subject: [PATCH] fix building frontend_curses.c --- src/frontend_curses.c | 2 ++ src/frontend_posix.c | 6 ++++++ src/posix_vfs.c | 6 +++--- src/zzt.c | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/frontend_curses.c b/src/frontend_curses.c index a3a8a10..7affa82 100644 --- a/src/frontend_curses.c +++ b/src/frontend_curses.c @@ -78,6 +78,8 @@ static void platform_kbd_tick(void) { } #include "asset_loader.h" + +#define FRONTEND_POSIX_NO_AUDIO #include "frontend_posix.c" static int nc_color_map[] = { diff --git a/src/frontend_posix.c b/src/frontend_posix.c index d729b1c..94e1ff1 100644 --- a/src/frontend_posix.c +++ b/src/frontend_posix.c @@ -54,7 +54,9 @@ static void posix_zzt_help(int argc, char **argv) { fprintf(stderr, " -m [] set memory limit, in KB (64-640)\n"); fprintf(stderr, " -M [] set extended memory limit, in KB\n"); fprintf(stderr, " -t enable world testing mode (skip K, C, ENTER)\n"); +#ifndef FRONTEND_POSIX_NO_AUDIO fprintf(stderr, " -V [] set starting volume (0-100)\n"); +#endif fprintf(stderr, "\n"); fprintf(stderr, "See for more information.\n"); } @@ -122,9 +124,11 @@ static int posix_zzt_init(int argc, char **argv) { case 't': skip_kc = 1; break; +#ifndef FRONTEND_POSIX_NO_AUDIO case 'V': starting_volume = atoi(optarg); break; +#endif case '?': fprintf(stderr, "Could not parse options! Try %s -h for help.\n", argv > 0 ? argv[0] : "running with"); exit(0); @@ -137,9 +141,11 @@ static int posix_zzt_init(int argc, char **argv) { zzt_init(memory_kbs); zzt_set_max_extended_memory(extended_memory_kbs); zzt_load_blink(video_blink); +#ifndef FRONTEND_POSIX_NO_AUDIO if (starting_volume >= 0) { audio_stream_set_volume(starting_volume * 6 / 10); } +#endif #ifdef USE_GETOPT if (argc > optind && posix_vfs_exists(argv[optind])) { diff --git a/src/posix_vfs.c b/src/posix_vfs.c index 19a48e9..f0a217f 100644 --- a/src/posix_vfs.c +++ b/src/posix_vfs.c @@ -57,7 +57,7 @@ #define MAX_FILES_START 16 #define MAX_FILES_LIMIT 256 -// #define DEBUG_VFS +#define DEBUG_VFS static FILE **file_pointers; static char **file_pointer_names; @@ -562,7 +562,7 @@ int vfs_read(int handle, u8* ptr, int amount) { FILE* fptr = file_pointers[handle-1]; int count = fread(ptr, 1, amount, fptr); #ifdef DEBUG_VFS - fprintf(stderr, "posix vfs: read %d/%d bytes from %d\n", count, amount, handle); +// fprintf(stderr, "posix vfs: read %d/%d bytes from %d\n", count, amount, handle); vfs_check_error(fptr); #endif return count; @@ -573,7 +573,7 @@ int vfs_write(int handle, u8* ptr, int amount) { FILE* fptr = file_pointers[handle-1]; int count = fwrite(ptr, 1, amount, fptr); #ifdef DEBUG_VFS - fprintf(stderr, "posix vfs: wrote %d/%d bytes to %d\n", count, amount, handle); +// fprintf(stderr, "posix vfs: wrote %d/%d bytes to %d\n", count, amount, handle); vfs_check_error(fptr); #endif return count; diff --git a/src/zzt.c b/src/zzt.c index 304ed61..e22bb3e 100644 --- a/src/zzt.c +++ b/src/zzt.c @@ -993,6 +993,8 @@ static int cpu_func_intr_0xa5(cpu_state* cpu) { static int cpu_func_intr_0x21(cpu_state* cpu) { zzt_state* zzt = (zzt_state*) cpu; + if (cpu->ah != 0x2c && cpu->ah != 0x3f) + fprintf(stderr, "dbg: interrupt %02X %04X\n", 0x21, cpu->ax); switch (cpu->ah) { case 0x48: { // allocation (unsupported)