Cleanups to make all logging functions use stdlog instead of stdout.

The new --logfile (-L) commandline option sets a file to log to.
The new --debug (-D) forces output to stderr if no logfile is given.
This commit is contained in:
waltje
2017-11-24 02:23:00 -05:00
parent d287293a75
commit ce1bab2967
20 changed files with 1547 additions and 1571 deletions

View File

@@ -10,7 +10,7 @@
* data in the form of FM/MFM-encoded transitions) which also
* forms the core of the emulator's floppy disk emulation.
*
* Version: @(#)floppy_86f.c 1.0.11 2017/11/04
* Version: @(#)floppy_86f.c 1.0.12 2017/11/24
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -131,6 +131,7 @@ typedef struct
} find_t;
#pragma pack(pop)
uint8_t encoded_fm[64] = { 0xAA, 0xAB, 0xAE, 0xAF, 0xBA, 0xBB, 0xBE, 0xBF, 0xEA, 0xEB, 0xEE, 0xEF, 0xFA, 0xFB, 0xFE, 0xFF,
0xAA, 0xAB, 0xAE, 0xAF, 0xBA, 0xBB, 0xBE, 0xBF, 0xEA, 0xEB, 0xEE, 0xEF, 0xFA, 0xFB, 0xFE, 0xFF,
0xAA, 0xAB, 0xAE, 0xAF, 0xBA, 0xBB, 0xBE, 0xBF, 0xEA, 0xEB, 0xEE, 0xEF, 0xFA, 0xFB, 0xFE, 0xFF,
@@ -141,6 +142,7 @@ uint8_t encoded_mfm[64] = { 0xAA, 0xA9, 0xA4, 0xA5, 0x92, 0x91, 0x94, 0x95, 0x4A
0xAA, 0xA9, 0xA4, 0xA5, 0x92, 0x91, 0x94, 0x95, 0x4A, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
0x2A, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, 0x4A, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55 };
enum
{
FMT_PRETRK_GAP0,
@@ -163,6 +165,7 @@ enum
FMT_POSTTRK_GAP4
};
#pragma pack(push,1)
typedef struct
{
@@ -176,6 +179,7 @@ typedef union {
split_byte_t nibbles;
} decoded_t;
/* Disk flags: Bit 0 Has surface data (1 = yes, 0 = no)
Bits 2, 1 Hole (3 = ED + 2000 kbps, 2 = ED, 1 = HD, 0 = DD)
Bit 3 Sides (1 = 2 sides, 0 = 1 side)
@@ -235,24 +239,28 @@ struct
} d86f[FDD_NUM];
#pragma pack(pop)
#ifdef ENABLE_D86F_LOG
int d86f_do_log = ENABLE_D86F_LOG;
#endif
void d86f_log(const char *format, ...)
static void
d86f_log(const char *format, ...)
{
#ifdef ENABLE_D86F_LOG
if (d86f_do_log)
{
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
va_list ap;
va_start(ap, format);
vfprintf(stdlog, format, ap);
va_end(ap);
fflush(stdlog);
}
#endif
}
void d86f_zero_bit_field(int drive, int side)
{
int i = 0;