Skip to content

Commit

Permalink
fix building frontend_curses.c
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Dec 29, 2023
1 parent 5e31f21 commit 3554028
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/frontend_curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
6 changes: 6 additions & 0 deletions src/frontend_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://zeta.asie.pl/> for more information.\n");
}
Expand Down Expand Up @@ -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);
Expand All @@ -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])) {
Expand Down
6 changes: 3 additions & 3 deletions src/posix_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/zzt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3554028

Please sign in to comment.