--- hatari/src/falcon/nvram.c 2019/04/01 07:13:46 1.1 +++ hatari/src/falcon/nvram.c 2019/04/09 08:47:22 1.1.1.4 @@ -27,7 +27,7 @@ All other cells are reserved / unused. */ -const char NvRam_rcsid[] = "Hatari $Id: nvram.c,v 1.1 2019/04/01 07:13:46 root Exp $"; +const char NvRam_fileid[] = "Hatari nvram.c : " __DATE__ " " __TIME__; #include "main.h" #include "configuration.h" @@ -35,16 +35,15 @@ const char NvRam_rcsid[] = "Hatari $Id: #include "log.h" #include "nvram.h" #include "paths.h" -#include "araglue.h" #define DEBUG 0 - #if DEBUG -#define D(x) x +#define Dprintf(a) printf a #else -#define D(x) +#define Dprintf(a) #endif + // Defs for checksum #define CKS_RANGE_START 14 #define CKS_RANGE_END (14+47) @@ -54,7 +53,7 @@ const char NvRam_rcsid[] = "Hatari $Id: #define NVRAM_START 14 #define NVRAM_LEN 50 -static uint8 nvram[64] = { 48,255,21,255,23,255,1,25,3,33,42,14,112,128, +static Uint8 nvram[64] = { 48,255,21,255,23,255,1,25,3,33,42,14,112,128, 0,0,0,0,0,0,0,0,17,46,32,1,255,0,1,10,135,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; @@ -78,17 +77,17 @@ void NvRam_Reset(void) /** * Load NVRAM data from file. */ -static BOOL NvRam_Load(void) +static bool NvRam_Load(void) { - BOOL ret = FALSE; + bool ret = false; FILE *f = fopen(nvram_filename, "rb"); if (f != NULL) { - uint8 fnvram[NVRAM_LEN]; + Uint8 fnvram[NVRAM_LEN]; if (fread(fnvram, 1, NVRAM_LEN, f) == NVRAM_LEN) { memcpy(nvram+NVRAM_START, fnvram, NVRAM_LEN); - ret = TRUE; + ret = true; } fclose(f); Log_Printf(LOG_DEBUG, "NVRAM loaded from '%s'\n", nvram_filename); @@ -106,21 +105,21 @@ static BOOL NvRam_Load(void) /** * Save NVRAM data to file */ -static BOOL NvRam_Save(void) +static bool NvRam_Save(void) { - BOOL ret = FALSE; + bool ret = false; FILE *f = fopen(nvram_filename, "wb"); if (f != NULL) { if (fwrite(nvram+NVRAM_START, 1, NVRAM_LEN, f) == NVRAM_LEN) { - ret = TRUE; + ret = true; } fclose(f); } else { - Log_Printf(LOG_ERROR, "ERROR: cannot store NVRAM to '%s'\n", nvram_filename); + Log_Printf(LOG_WARN, "ERROR: cannot store NVRAM to '%s'\n", nvram_filename); } return ret; @@ -162,7 +161,7 @@ void NvRam_Init(void) if (!NvRam_Load()) // load NVRAM file automatically { - if (ConfigureParams.Screen.MonitorType == MONITOR_TYPE_VGA) // VGA ? + if (ConfigureParams.Screen.nMonitorType == MONITOR_TYPE_VGA) // VGA ? { nvram[NVRAM_MONITOR] |= 32; // VGA mode } @@ -222,7 +221,7 @@ void NvRam_Select_WriteByte(void) */ void NvRam_Data_ReadByte(void) { - uint8 value = 0; + Uint8 value = 0; if (nvram_index == NVRAM_SECONDS || nvram_index == NVRAM_MINUTES || nvram_index == NVRAM_HOURS || (nvram_index >=NVRAM_DAY && nvram_index <=NVRAM_YEAR) ) @@ -242,7 +241,7 @@ void NvRam_Data_ReadByte(void) } else if (nvram_index == 10) { - static BOOL rtc_uip = TRUE; + static bool rtc_uip = true; value = rtc_uip ? 0x80 : 0; rtc_uip = !rtc_uip; } @@ -259,7 +258,7 @@ void NvRam_Data_ReadByte(void) { value = nvram[nvram_index]; } - D(bug("Reading NVRAM data at %d = %d ($%02x)", nvram_index, value, value)); + Dprintf(("Reading NVRAM data at %d = %d ($%02x)\n", nvram_index, value, value)); IoMem_WriteByte(0xff8963, value); } @@ -273,7 +272,6 @@ void NvRam_Data_ReadByte(void) void NvRam_Data_WriteByte(void) { Uint8 value = IoMem_ReadByte(0xff8963); - D(bug("Writing NVRAM data at %d = %d ($%02x)", nvram_index, value, value)); + Dprintf(("Writing NVRAM data at %d = %d ($%02x)\n", nvram_index, value, value)); nvram[nvram_index] = value; } -