Fix the warnings and some errors.

This commit is contained in:
sorgelig
2018-12-29 21:15:25 +08:00
parent 3aa5c4d438
commit ddd5b75d2b
19 changed files with 136 additions and 156 deletions

View File

@@ -832,7 +832,7 @@ bool TDiskImage::FindSector(unsigned char CYL, unsigned char SIDE,
unsigned int TrackOffset = FromOffset;
bool FirstFind = true;
unsigned int FirstPos;
unsigned int FirstPos = 0;
// Ïîèñê àäðåñíîé ìåòêè òðåáóåìîãî ñåêòîðà...
bool ADFOUND = false;
@@ -2829,7 +2829,7 @@ int GetByte(void) /* get one byte */
while (getlen <= 8)
{
if ((i = readChar()) == -1) i = 0;
if ((int)(i = readChar()) == -1) i = 0;
getbuf |= i << (8 - getlen);
getlen += 8;
}

View File

@@ -135,11 +135,13 @@ static int smbus_open(int dev_address)
return 1;
}
/*
static void smbus_close()
{
if(i2c_handle > 0) close(i2c_handle);
i2c_handle = -1;
}
*/
static int smbus_get(int address, short *data)
{

View File

@@ -632,7 +632,7 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons
}
struct dirent *de;
while(nDirEntries < (sizeof(DirItem)/sizeof(DirItem[0])))
while(nDirEntries < (int)(sizeof(DirItem)/sizeof(DirItem[0])))
{
de = readdir(d);
if (de == NULL) break;

View File

@@ -131,17 +131,18 @@ static int fpgamgr_test_fpga_ready(void)
return 1;
}
/* Poll until FPGA is ready to be accessed or timeout occurred */
/*
// Poll until FPGA is ready to be accessed or timeout occurred
static int fpgamgr_poll_fpga_ready(void)
{
unsigned long i;
/* If FPGA is blank, wait till WD invoke warm reset */
// If FPGA is blank, wait till WD invoke warm reset
for (i = 0; i < FPGA_TIMEOUT_CNT; i++) {
/* check for init done signal */
// check for init done signal
if (!is_fpgamgr_initdone_high())
continue;
/* check again to avoid false glitches */
// check again to avoid false glitches
if (!is_fpgamgr_initdone_high())
continue;
return 1;
@@ -149,6 +150,7 @@ static int fpgamgr_poll_fpga_ready(void)
return 0;
}
*/
/* Start the FPGA programming by initialize the FPGA Manager */
static int fpgamgr_program_init(void)
@@ -431,7 +433,7 @@ static int make_env(const char *name, const char *cfg)
*str++ = '=';
*str++ = '"';
for (int i = 0; i < strlen(name); i++)
for (uint32_t i = 0; i < strlen(name); i++)
{
*str++ = name[i];
}
@@ -479,7 +481,7 @@ int fpga_load_rbf(const char *name, const char *cfg)
void *buf = malloc(st.st_size);
if (!buf)
{
printf("Couldn't allocate %d bytes.\n", st.st_size);
printf("Couldn't allocate %llu bytes.\n", st.st_size);
ret = -1;
}
else
@@ -499,7 +501,7 @@ int fpga_load_rbf(const char *name, const char *cfg)
p = (void*)(((uint8_t*)buf) + 16);
}
do_bridge(0);
ret = socfpga_load(buf, st.st_size);
ret = socfpga_load(p, sz);
if (ret)
{
printf("Error %d while loading %s\n", ret, path);

View File

@@ -52,7 +52,7 @@ int ini_getline(char* line)
char c, ignore = 0, skip = 1;
int i = 0;
while(c = ini_getch())
while((c = ini_getch()))
{
if (!CHAR_IS_SPACE(c)) skip = 0;
if (i >= (INI_LINE_SIZE - 1) || CHAR_IS_COMMENT(c)) ignore = 1;
@@ -200,9 +200,9 @@ void ini_parse(const ini_cfg_t* cfg)
{
return;
}
else ini_parser_debugf("Opened file %s with size %d bytes.", cfg->filename_alt, ini_file.size);
else ini_parser_debugf("Opened file %s with size %llu bytes.", cfg->filename_alt, ini_file.size);
}
else ini_parser_debugf("Opened file %s with size %d bytes.", cfg->filename, ini_file.size);
else ini_parser_debugf("Opened file %s with size %llu bytes.", cfg->filename, ini_file.size);
ini_pt = 0;

View File

@@ -475,7 +475,7 @@ static const int ev2ps2[] =
NONE, //191 KEY_F21
NONE, //192 KEY_F22
NONE, //193 KEY_F23
0x5D, //194 U-mlaut on DE mapped to
0x5D, //194 U-mlaut on DE mapped to backslash
NONE, //195 ???
NONE, //196 ???
NONE, //197 ???
@@ -986,7 +986,7 @@ typedef struct
int accx, accy;
} devInput;
static devInput input[NUMDEV] = { 0 };
static devInput input[NUMDEV] = {};
static int first_joystick = -1;
int mfd = -1;
@@ -1082,6 +1082,8 @@ static int check_devs()
static void INThandler(int code)
{
(void)code;
printf("\nExiting...\n");
if (mwd >= 0) inotify_rm_watch(mfd, mwd);
@@ -1257,7 +1259,7 @@ static int keyrah_trans(int key, int press)
else if (fn)
{
fn |= 2;
for (int n = 0; n<(sizeof(kr_fn_table) / (2 * sizeof(kr_fn_table[0]))); n++)
for (uint32_t n = 0; n<(sizeof(kr_fn_table) / (2 * sizeof(kr_fn_table[0]))); n++)
{
if ((key&255) == kr_fn_table[n * 2]) return kr_fn_table[(n * 2) + 1];
}
@@ -1423,8 +1425,6 @@ static void joy_analog(int num, int axis, int offset)
static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int dev)
{
static int key_mapped = 0;
static uint8_t modifiers = 0;
static char keys[6] = { 0,0,0,0,0,0 };
int map_skip = (ev->type == EV_KEY && ev->code == 57 && mapping_dev >= 0 && mapping_type==1);
int cancel = (ev->type == EV_KEY && ev->code == 1);

View File

@@ -23,7 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#include <stdio.h>
#include <sched.h>
#include "string.h"
#include <inttypes.h>
#include <ctype.h>
#include <string.h>
#include "menu.h"
#include "user_io.h"
#include "input.h"

127
menu.cpp
View File

@@ -136,12 +136,12 @@ enum MENU
MENU_8BIT_ABOUT2
};
unsigned char menustate = MENU_NONE1;
unsigned char parentstate;
unsigned char menusub = 0;
unsigned char menusub_last = 0; //for when we allocate it dynamically and need to know last row
unsigned int menumask = 0; // Used to determine which rows are selectable...
unsigned long menu_timer = 0;
uint32_t menustate = MENU_NONE1;
uint32_t parentstate;
uint32_t menusub = 0;
uint32_t menusub_last = 0; //for when we allocate it dynamically and need to know last row
uint32_t menumask = 0; // Used to determine which rows are selectable...
uint32_t menu_timer = 0;
extern const char *version;
@@ -209,10 +209,10 @@ unsigned char config_autofire = 0;
// file selection menu variables
char fs_pFileExt[13] = "xxx";
unsigned char fs_ExtLen = 0;
unsigned char fs_Options;
unsigned char fs_MenuSelect;
unsigned char fs_MenuCancel;
uint32_t fs_ExtLen = 0;
uint32_t fs_Options;
uint32_t fs_MenuSelect;
uint32_t fs_MenuCancel;
char* GetExt(char *ext)
{
@@ -250,13 +250,13 @@ int changeDir(char *dir)
if (p)
{
*p = 0;
int len = strlen(p+1);
uint32_t len = strlen(p+1);
if (len > sizeof(curdir) - 1) len = sizeof(curdir) - 1;
strncpy(curdir, p+1, len);
}
else
{
int len = strlen(SelectedPath);
uint32_t len = strlen(SelectedPath);
if (len > sizeof(curdir) - 1) len = sizeof(curdir) - 1;
strncpy(curdir, SelectedPath, len);
SelectedPath[0] = 0;
@@ -348,25 +348,6 @@ void substrcpy(char *d, char *s, char idx)
#define HELPTEXT_DELAY 10000
#define FRAME_DELAY 150
// prints input as a string of binary (on/off) values
// assumes big endian, returns using special characters (checked box/unchecked box)
void siprintbinary(char* buffer, size_t const size, void const * const ptr)
{
unsigned char *b = (unsigned char*)ptr;
unsigned char byte;
int i, j;
memset(buffer, '\0', sizeof(buffer));
for (i = size - 1; i >= 0; i--)
{
for (j = 0; j<8; j++)
{
byte = (b[i] >> j) & 1;
buffer[j] = byte ? '\x1a' : '\x19';
}
}
return;
}
unsigned char getIdx(char *opt)
{
if ((opt[1] >= '0') && (opt[1] <= '9')) return opt[1] - '0';
@@ -374,11 +355,11 @@ unsigned char getIdx(char *opt)
return 0; // basically 0 cannot be valid because used as a reset. Thus can be used as a error.
}
unsigned int getStatus(char *opt, unsigned int status)
uint32_t getStatus(char *opt, uint32_t status)
{
char idx1 = getIdx(opt);
char idx2 = getIdx(opt + 1);
unsigned int x = (status & (1 << idx1)) ? 1 : 0;
uint32_t x = (status & (1 << idx1)) ? 1 : 0;
if (idx2>idx1) {
x = status >> idx1;
@@ -388,11 +369,11 @@ unsigned int getStatus(char *opt, unsigned int status)
return x;
}
unsigned int setStatus(char *opt, unsigned int status, unsigned int value)
uint32_t setStatus(char *opt, uint32_t status, uint32_t value)
{
unsigned char idx1 = getIdx(opt);
unsigned char idx2 = getIdx(opt + 1);
unsigned long x = 1;
uint32_t x = 1;
if (idx2>idx1) x = ~(0xffffffff << (idx2 - idx1 + 1));
x = x << idx1;
@@ -400,11 +381,11 @@ unsigned int setStatus(char *opt, unsigned int status, unsigned int value)
return (status & ~x) | ((value << idx1) & x);
}
unsigned int getStatusMask(char *opt)
uint32_t getStatusMask(char *opt)
{
char idx1 = getIdx(opt);
char idx2 = getIdx(opt + 1);
unsigned int x = 1;
uint32_t x = 1;
if (idx2>idx1) x = ~(0xffffffff << (idx2 - idx1 + 1));
@@ -448,9 +429,7 @@ static int hold_cnt = 0;
static uint32_t menu_key_get(void)
{
static uint32_t c2;
static unsigned long delay;
static unsigned long repeat;
static unsigned char repeat2;
uint32_t c1, c;
c1 = menu_key;
@@ -496,7 +475,6 @@ char* getNet(int spec)
{
int netType = 0;
struct ifaddrs *ifaddr, *ifa, *ifae = 0, *ifaw = 0;
int family, s;
static char host[NI_MAXHOST];
if (getifaddrs(&ifaddr) == -1)
@@ -684,8 +662,6 @@ void HandleUI(void)
char *p;
char s[40];
unsigned char m = 0, up, down, select, menu, right, left, plus, minus;
uint8_t mod;
unsigned long len;
char enable;
static int reboot_req = 0;
static long helptext_timer;
@@ -694,10 +670,6 @@ void HandleUI(void)
static char drive_num = 0;
static char flag;
static int cr = 0;
uint8_t keys[6] = { 0,0,0,0,0,0 };
uint16_t keys_ps2[6] = { 0,0,0,0,0,0 };
char usb_id[64];
static char cp_MenuCancel;
@@ -802,12 +774,12 @@ void HandleUI(void)
// Also set parentstate to the appropriate menustate.
if (menumask)
{
if (down && (menumask >= (1 << (menusub + 1)))) // Any active entries left?
if (down && (menumask >= ((uint32_t)1 << (menusub + 1)))) // Any active entries left?
{
do
{
menusub++;
} while ((menumask & (1 << menusub)) == 0);
} while ((menumask & ((uint32_t)1 << menusub)) == 0);
menustate = parentstate;
}
@@ -816,7 +788,7 @@ void HandleUI(void)
do
{
--menusub;
} while ((menumask & (1 << menusub)) == 0);
} while ((menumask & ((uint32_t)1 << menusub)) == 0);
menustate = parentstate;
}
}
@@ -827,7 +799,13 @@ void HandleUI(void)
// only updating values in this function as necessary.
//
if (user_io_core_type() == CORE_TYPE_SHARPMZ)
sharpmz_ui(MENU_NONE1, MENU_NONE2, MENU_8BIT_SYSTEM1, MENU_FILE_SELECT1, &parentstate, &menustate, &menusub, &menusub_last, &menumask, SelectedPath, &helptext, helptext_custom, &fs_ExtLen, &fs_Options, &fs_MenuSelect, &fs_MenuCancel, fs_pFileExt, menu, select, up, down, left, right, plus, minus);
sharpmz_ui(MENU_NONE1, MENU_NONE2, MENU_8BIT_SYSTEM1, MENU_FILE_SELECT1,
&parentstate, &menustate, &menusub, &menusub_last,
&menumask, SelectedPath, &helptext, helptext_custom,
&fs_ExtLen, &fs_Options, &fs_MenuSelect, &fs_MenuCancel,
fs_pFileExt,
menu, select, up, down,
left, right, plus, minus);
// Switch to current menu screen
switch (menustate)
@@ -1004,7 +982,7 @@ void HandleUI(void)
{
adjvisible = 0;
entry = 0;
int selentry = 0;
uint32_t selentry = 0;
joy_bcount = 0;
menumask = 0;
p = user_io_get_core_name();
@@ -1183,11 +1161,9 @@ void HandleUI(void)
else
{
static char ext[13];
char fs_present;
p = user_io_8bit_get_string(1);
fs_present = p && strlen(p);
int entry = 0;
uint32_t entry = 0;
int i = 1;
while (1)
{
@@ -1719,11 +1695,11 @@ void HandleUI(void)
case MENU_8BIT_ABOUT2:
StarsUpdate();
OsdDrawLogo(0, 0, 1);
OsdDrawLogo(1, 1, 1);
OsdDrawLogo(2, 2, 1);
OsdDrawLogo(3, 3, 1);
OsdDrawLogo(4, 4, 1);
OsdDrawLogo(0);
OsdDrawLogo(1);
OsdDrawLogo(2);
OsdDrawLogo(3);
OsdDrawLogo(4);
sprintf(s, " ARM s/w ver. %s", version + 5);
OsdWrite(10, s, 0, 0, 1);
@@ -1849,7 +1825,7 @@ void HandleUI(void)
menumask = tos_get_direct_hdd() ? 0x3f : 0x7f;
OsdSetTitle("Storage", 0);
// entries for both floppies
for (int i = 0; i<2; i++) {
for (uint32_t i = 0; i<2; i++) {
strcpy(s, " A: ");
strcat(s, tos_get_disk_name(i));
s[1] = 'A' + i;
@@ -1864,7 +1840,7 @@ void HandleUI(void)
strcpy(s, " ACSI0 direct SD: ");
strcat(s, tos_get_direct_hdd() ? "on" : "off");
OsdWrite(4, s, menusub == 3, 0);
for (int i = 0; i<2; i++) {
for (uint32_t i = 0; i<2; i++) {
strcpy(s, " ACSI0: ");
s[5] = '0' + i;
@@ -2113,8 +2089,7 @@ void HandleUI(void)
case 3: {
unsigned long chipset = (tos_system_ctrl() >> 23) + 1;
if (chipset == 4) chipset = 0;
tos_update_sysctrl(tos_system_ctrl() & ~(TOS_CONTROL_STE | TOS_CONTROL_MSTE) |
(chipset << 23));
tos_update_sysctrl((tos_system_ctrl() & ~(TOS_CONTROL_STE | TOS_CONTROL_MSTE)) | (chipset << 23));
menustate = MENU_MIST_VIDEO1;
} break;
@@ -2176,10 +2151,10 @@ void HandleUI(void)
// use left/right to adjust video position
if (left || right) {
if ((menusub == 2) || (menusub == 3)) {
if (left && (tos_get_video_adjust(menusub - 2) > -100))
if (left && ((signed char)(tos_get_video_adjust(menusub - 2)) > -100))
tos_set_video_adjust(menusub - 2, -1);
if (right && (tos_get_video_adjust(menusub - 2) < 100))
if (right && ((signed char)(tos_get_video_adjust(menusub - 2)) < 100))
tos_set_video_adjust(menusub - 2, +1);
menustate = MENU_MIST_VIDEO_ADJUST1;
@@ -2239,7 +2214,7 @@ void HandleUI(void)
if (df[i].status & DSK_INSERTED) // floppy disk is inserted
{
char *p;
if (p = strrchr(df[i].name, '/'))
if ((p = strrchr(df[i].name, '/')))
{
p++;
}
@@ -2267,7 +2242,7 @@ void HandleUI(void)
}
else
strcpy(s, "");
OsdWrite(i+1, s, menusub == i, (i>drives) || (i>config.floppy.drives));
OsdWrite(i+1, s, menusub == (uint32_t)i, (i>drives) || (i>config.floppy.drives));
}
}
sprintf(s, " Floppy disk turbo : %s", config.floppy.speed ? "on" : "off");
@@ -2400,7 +2375,7 @@ void HandleUI(void)
OsdWrite(1, "", 0, 0);
OsdWrite(2, " Default", menusub == 0, (menumask & 1) == 0);
OsdWrite(3, "", 0, 0);
for (int i = 1; i < 10; i++)
for (uint i = 1; i < 10; i++)
{
static char name[64];
sprintf(name, " %d ", i);
@@ -2620,7 +2595,7 @@ void HandleUI(void)
OsdWrite(2, " Default", menusub == 0, 0);
OsdWrite(3, "", 0, 0);
for (int i = 1; i < 10; i++)
for (uint i = 1; i < 10; i++)
{
static char name[64];
sprintf(name, " %d ", i);
@@ -2895,8 +2870,8 @@ void HandleUI(void)
OsdWrite(2, "", 0, 0);
{
int n = 3, m = 1, t = 4;
for (int i = 0; i < 4; i++)
uint n = 3, m = 1, t = 4;
for (uint i = 0; i < 4; i++)
{
strcpy(s, (i & 2) ? " Secondary " : " Primary ");
strcat(s, (i & 1) ? "Slave: " : "Master: ");
@@ -2974,7 +2949,7 @@ void HandleUI(void)
case MENU_HARDFILE_SELECTED:
{
int num = (menusub - 2) / 2;
int len = strlen(SelectedPath);
uint len = strlen(SelectedPath);
if (len > sizeof(config.hardfile[num].filename) - 1) len = sizeof(config.hardfile[num].filename) - 1;
if(len) memcpy(config.hardfile[num].filename, SelectedPath, len);
config.hardfile[num].filename[len] = 0;
@@ -3000,11 +2975,11 @@ void HandleUI(void)
OsdWrite(m++, " !! DANGEROUS !!", 0, 0);
OsdWrite(m++, "", 0, 0);
OsdWrite(m++, " RDB has illegal CHS values:", 0, 0);
sprintf(s, " Cylinders: %d", rdb->rdb_Cylinders);
sprintf(s, " Cylinders: %lu", rdb->rdb_Cylinders);
OsdWrite(m++, s, 0, 0);
sprintf(s, " Heads: %d", rdb->rdb_Heads);
sprintf(s, " Heads: %lu", rdb->rdb_Heads);
OsdWrite(m++, s, 0, 0);
sprintf(s, " Sectors: %d", rdb->rdb_Sectors);
sprintf(s, " Sectors: %lu", rdb->rdb_Sectors);
OsdWrite(m++, s, 0, 0);
OsdWrite(m++, "", 0, 0);
OsdWrite(m++, " Max legal values:", 0, 0);
@@ -3555,7 +3530,7 @@ void _strncpy(char* pStr1, const char* pStr2, size_t nCount)
static void set_text(const char *message, unsigned char code)
{
char s[40];
char i = 0, l = 1;
int i = 0, l = 1;
OsdWrite(0, "", 0, 0);

2
menu.h
View File

@@ -18,7 +18,7 @@ void ErrorMessage(const char *message, unsigned char code);
void InfoMessage(const char *message, int timeout = 2000);
void Info(const char *message, int timeout = 2000, int width = 0, int height = 0, int frame = 0);
unsigned int getStatus(char *opt, unsigned int status);
uint32_t getStatus(char *opt, uint32_t status);
void substrcpy(char *d, char *s, char idx);
extern char joy_bnames[12][32];

26
osd.cpp
View File

@@ -139,15 +139,15 @@ static void rotatechar(unsigned char *in, unsigned char *out)
}
}
#define OSDHEIGHT (osd_size*8)
#define OSDHEIGHT (uint)(osd_size*8)
void OsdSetTitle(const char *s, int a)
{
// Compose the title, condensing character gaps
arrow = a;
int zeros = 0;
int i = 0, j = 0;
int outp = 0;
uint i = 0, j = 0;
uint outp = 0;
while (1)
{
int c = s[i++];
@@ -178,7 +178,7 @@ void OsdSetTitle(const char *s, int a)
}
// Now centre it:
int c = (OSDHEIGHT - 1 - outp) / 2;
uint c = (OSDHEIGHT - 1 - outp) / 2;
memmove(titlebuffer + c, titlebuffer, outp);
for (i = 0; i<c; ++i) titlebuffer[i] = 0;
@@ -245,7 +245,7 @@ void OsdWriteOffset(unsigned char n, const char *s, unsigned char invert, unsign
if (leftchar)
{
unsigned char tmp2[8];
memcpy(tmp2, charfont[leftchar], 8);
memcpy(tmp2, charfont[(uint)leftchar], 8);
rotatechar(tmp2, tmp);
p = tmp;
}
@@ -333,14 +333,14 @@ void OsdWriteOffset(unsigned char n, const char *s, unsigned char invert, unsign
DisableOsd();
}
void OsdDrawLogo(unsigned char n, char row, char superimpose)
void OsdDrawLogo(int row)
{
unsigned short i;
const unsigned char *p;
int linelimit = OSDLINELEN;
int mag = (osd_size / 8);
n = n * mag;
uint n = row * mag;
// select buffer and line to write to
if (!is_minimig())
@@ -357,7 +357,7 @@ void OsdDrawLogo(unsigned char n, char row, char superimpose)
unsigned char bt = 0;
const unsigned char *lp = logodata[row];
int bytes = sizeof(logodata[0]);
if (row >= (sizeof(logodata) / sizeof(logodata[0]))) lp = 0;
if ((uint)row >= (sizeof(logodata) / sizeof(logodata[0]))) lp = 0;
char *bg = framebuffer[n + k];
@@ -441,20 +441,20 @@ void OSD_PrintText(unsigned char line, const char *text, unsigned long start, un
if (offset) {
width -= 8 - offset;
p = &charfont[*text++][offset];
p = &charfont[(uint)(*text++)][offset];
for (; offset < 8; offset++)
spi8(*p++^invert);
}
while (width > 8) {
unsigned char b;
p = &charfont[*text++][0];
p = &charfont[(uint)(*text++)][0];
for (b = 0; b<8; b++) spi8(*p++^invert);
width -= 8;
}
if (width) {
p = &charfont[*text++][0];
p = &charfont[(uint)(*text++)][0];
while (width--)
spi8(*p++^invert);
}
@@ -530,7 +530,7 @@ void OSD_PrintInfo(const char *message, int *width, int *height, int frame)
for (x = 0; x < w; x++)
{
const unsigned char *p = charfont[str[(y*INFO_MAXW) + x]];
const unsigned char *p = charfont[(uint)str[(y*INFO_MAXW) + x]];
for (int i = 0; i < 8; i++) spi8(*p++);
}
@@ -655,7 +655,7 @@ void ScrollText(char n, const char *str, int off, int len, int max_len, unsigned
if (off+len > max_len) // scroll name if longer than display size
{
// reset scroll position if it exceeds predefined maximum
if (scroll_offset >= (len + BLANKSPACE) << 3) scroll_offset = 0;
if (scroll_offset >= (uint)(len + BLANKSPACE) << 3) scroll_offset = 0;
offset = scroll_offset >> 3; // get new starting character of the name (scroll_offset is no longer in 2 pixel unit)
len -= offset; // remaining number of characters in the name

2
osd.h
View File

@@ -84,7 +84,7 @@ void ConfigFloppy(unsigned char drives, unsigned char speed);
void ConfigAutofire(unsigned char autofire, unsigned char mask);
void OSD_PrintText(unsigned char line, const char *text, unsigned long start, unsigned long width, unsigned long offset, unsigned char invert);
void OSD_PrintInfo(const char *message, int *width, int *height, int frame = 0);
void OsdDrawLogo(unsigned char n, char row, char superimpose);
void OsdDrawLogo(int row);
void ScrollText(char n, const char *str, int off, int len, int max_len, unsigned char invert);
void ScrollReset();
void StarsInit();

View File

@@ -53,6 +53,7 @@ uint16_t spi_w(uint16_t word)
void spi_init(int enable)
{
(void)enable;
printf("Init SPI.\n");
}

View File

@@ -100,7 +100,7 @@ void archie_set_ar(char i)
user_io_8bit_set_status((i ? -1 : 0), 2);
}
char archie_get_ar()
int archie_get_ar()
{
return config.system_ctrl & 1;
}
@@ -111,7 +111,7 @@ void archie_set_amix(char i)
user_io_8bit_set_status(config.system_ctrl << 1, 0b1100);
}
char archie_get_amix()
int archie_get_amix()
{
return (config.system_ctrl>>1) & 3;
}

View File

@@ -15,8 +15,8 @@ char archie_floppy_is_inserted(char i);
void archie_save_config(void);
void archie_set_ar(char i);
char archie_get_ar();
int archie_get_ar();
void archie_set_amix(char i);
char archie_get_amix();
int archie_get_amix();
#endif // ARCHIE_H

View File

@@ -41,6 +41,10 @@
#include "../../debug.h"
#include "../../user_io.h"
// Names of the supported machines.
//
static const char *MZMACHINES[MAX_MZMACHINES] = { "MZ80K", "MZ80C", "MZ1200", "MZ80A", "MZ700", "MZ800", "MZ80B", "MZ2000" };
#define sharpmz_debugf(a, ...)
//#define sharpmz_debugf(a, ...) printf("\033[1;31mSHARPMZ: " a "\033[0m\n", ##__VA_ARGS__)
#define sharpmz__x_debugf(a, ...)
@@ -61,7 +65,7 @@ int sharpmz_file_write(fileTYPE *file, const char *fileName)
sprintf(fullPath, "%s/%s/%s", getRootDir(), SHARPMZ_CORE_NAME, fileName);
file->mode = O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRWXU | S_IRWXG | S_IRWXO;
file->mode = O_WRONLY | O_CREAT | O_TRUNC | O_SYNC | S_IRWXU | S_IRWXG | S_IRWXO;
file->type = 0;
file->fd = open(fullPath, file->mode);
@@ -141,7 +145,7 @@ void sharpmz_reset(unsigned long preResetSleep, unsigned long postResetSleep)
//
int sharpmz_reset_config(short setStatus)
{
char i;
int i;
char buf[1024];
// Setup config defaults.
@@ -1967,13 +1971,13 @@ int sharpmz_default_ui_state(void)
// code base and to limit common code case size.
// The same general programming structure is maintained to enable easier changes.
//
void sharpmz_ui(int idleState, int idle2State, int systemState, int selectFile,
unsigned char *parentstate, unsigned char *menustate, unsigned char *menusub, unsigned char *menusub_last,
unsigned int *menumask, char *selectedPath, const char **helptext, char *helptext_custom,
unsigned char *fs_ExtLen, unsigned char *fs_Options, unsigned char *fs_MenuSelect, unsigned char *fs_MenuCancel,
char *fs_pFileExt,
unsigned char menu, unsigned char select, unsigned char up, unsigned char down,
unsigned char left, unsigned char right, unsigned char plus, unsigned char minus)
void sharpmz_ui(int idleState, int idle2State, int systemState, int selectFile,
uint32_t *parentstate, uint32_t *menustate, uint32_t *menusub, uint32_t *menusub_last,
uint32_t *menumask, char *selectedPath, const char **helptext, char *helptext_custom,
uint32_t *fs_ExtLen, uint32_t *fs_Options, uint32_t *fs_MenuSelect, uint32_t *fs_MenuCancel,
char *fs_pFileExt,
unsigned char menu, unsigned char select, unsigned char up, unsigned char down,
unsigned char left, unsigned char right, unsigned char plus, unsigned char minus)
{
// Locals - original variables are generally all lower case, variables specific to this method are capitalised on change of word.
//

View File

@@ -157,10 +157,6 @@
#define CMT_READBIT 7 // Receive bit from MZ.
#define CMT_MOTOR 8 // Motor on/off.
// Names of the supported machines.
//
static const char *MZMACHINES[MAX_MZMACHINES] = { "MZ80K", "MZ80C", "MZ1200", "MZ80A", "MZ700", "MZ800", "MZ80B", "MZ2000" };
// Default load addresses of roms.
//
static const unsigned int MZLOADADDR[MAX_IMAGE_TYPES][MAX_MZMACHINES] =
@@ -459,11 +455,11 @@ char *sharpmz_get_next_filename(char);
void sharpmz_clear_filelist(void);
void sharpmz_select_file(const char*, unsigned char, char *, char, char *);
int sharpmz_default_ui_state(void);
void sharpmz_ui(int, int, int, int,
unsigned char *, unsigned char *, unsigned char *, unsigned char *,
unsigned int *, char *, const char **, char *,
unsigned char *, unsigned char *, unsigned char *, unsigned char *,
char *,
unsigned char, unsigned char, unsigned char, unsigned char,
unsigned char, unsigned char, unsigned char, unsigned char);
void sharpmz_ui(int idleState, int idle2State, int systemState, int selectFile,
uint32_t *parentstate, uint32_t *menustate, uint32_t *menusub, uint32_t *menusub_last,
uint32_t *menumask, char *selectedPath, const char **helptext, char *helptext_custom,
uint32_t *fs_ExtLen, uint32_t *fs_Options, uint32_t *fs_MenuSelect, uint32_t *fs_MenuCancel,
char *fs_pFileExt,
unsigned char menu, unsigned char select, unsigned char up, unsigned char down,
unsigned char left, unsigned char right, unsigned char plus, unsigned char minus);
#endif // SHARPMZ_H

View File

@@ -54,8 +54,6 @@ const char *hwids_01[] = {
"Commodore 128"
};
static const char *build= "20060225";
#define MAJREV 1 // Major revision of the format this program supports
#define MINREV 13 // Minor revision of the format this program supports
@@ -111,7 +109,6 @@ static int not_rec; // Some blocks were not recognised ??
static int starting=1; // starting block
static int ending=0; // ending block
static int pages=0; // Waiting after each page of the info ?
static int expand=0; // Expand Groups ?
static int draw=1; // Local flag for outputing a line when in a group
@@ -135,9 +132,6 @@ static char add_bit;
static int inv = 0;
static char tstr[255];
static char tstr2[255];
static char tstr3[255];
static char tstr4[255];
static char spdstr[255];
static char pstr[255];
@@ -1395,7 +1389,7 @@ int tzx2csw(fileTYPE *f)
PauseWave(200); // Finish always with 200 ms of pause after the last block
PlayFinish();
printf("\n%d bytes sent to the core.\n", oflen);
printf("\n%lu bytes sent to the core.\n", oflen);
free(mem);
return 1;
}

View File

@@ -30,7 +30,7 @@ static char core_path[1024];
uint8_t vol_att = 0;
unsigned long vol_set_timeout = 0;
fileTYPE sd_image[4] = { 0 };
fileTYPE sd_image[4] = {};
static uint64_t buffer_lba[4] = { ULLONG_MAX,ULLONG_MAX,ULLONG_MAX,ULLONG_MAX };
// mouse and keyboard emulation state
@@ -309,7 +309,7 @@ static void parse_config()
if (p[0] == 'O' && p[1] == 'X')
{
unsigned long status = user_io_8bit_set_status(0, 0);
uint32_t status = user_io_8bit_set_status(0, 0);
printf("found OX option: %s, 0x%08X\n", p, status);
unsigned long x = getStatus(p+1, status);
@@ -931,6 +931,8 @@ int user_io_file_mount(char *name, unsigned char index, char pre)
static unsigned char col_attr[1025];
static int col_parse(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, const int n, SAX_Data* sd)
{
(void)sd;
static int in_border = 0;
static int in_color = 0;
static int in_bright = 0;
@@ -1080,6 +1082,8 @@ static const unsigned char defchars[512] = {
static int chr_parse(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, const int n, SAX_Data* sd)
{
(void)sd;
static int in_entry = 0;
static int in_line = 0;
static int code = 0;
@@ -1212,7 +1216,7 @@ static void send_pcolchr(const char* name, unsigned char index, int type)
int user_io_file_tx(const char* name, unsigned char index, char opensave, char mute, char composite)
{
fileTYPE f = { 0 };
fileTYPE f = {};
static uint8_t buf[4096];
if (!FileOpen(&f, name, mute)) return 0;
@@ -1293,6 +1297,7 @@ int user_io_file_tx(const char* name, unsigned char index, char opensave, char m
bytes2send -= chunk;
}
printf("\n");
}
FileClose(&f);
@@ -1370,9 +1375,9 @@ char *user_io_8bit_get_string(char index)
return buffer;
}
unsigned long user_io_8bit_set_status(unsigned long new_status, unsigned long mask)
uint32_t user_io_8bit_set_status(uint32_t new_status, uint32_t mask)
{
static unsigned long status = 0;
static uint32_t status = 0;
// if mask is 0 just return the current status
if (mask) {
@@ -2350,7 +2355,7 @@ void user_io_check_reset(unsigned short modifiers, char useKeys)
if (useKeys >= (sizeof(combo) / sizeof(combo[0]))) useKeys = 0;
if ((modifiers & ~2) == combo[useKeys])
if ((modifiers & ~2) == combo[(uint)useKeys])
{
if (modifiers & 2) // with lshift - cold reset
{
@@ -2693,7 +2698,7 @@ static char new_scaler = 0;
static void setScaler()
{
fileTYPE f = { 0 };
fileTYPE f = {};
static char filename[1024];
if (!spi_uio_cmd_cont(UIO_SET_FLTNUM))
@@ -2715,7 +2720,7 @@ static void setScaler()
{
memset(buf, 0, f.size + 1);
int size;
if (size = FileReadAdv(&f, buf, f.size))
if ((size = FileReadAdv(&f, buf, f.size)))
{
spi_uio_cmd_cont(UIO_SET_FLTCOEF);
@@ -2891,7 +2896,7 @@ void parse_video_mode()
int mode = parse_custom_video_mode();
if (mode >= 0)
{
if (mode >= VMODES_NUM) mode = 0;
if ((uint)mode >= VMODES_NUM) mode = 0;
for (int i = 0; i < 8; i++)
{
vitems[i + 1] = vmodes[mode].vpar[i];
@@ -2917,6 +2922,7 @@ static int adjust_video_mode(uint32_t vtime)
setPLL(Fpix);
setVideo();
user_io_send_buttons(1);
return 1;
}
typedef struct
@@ -2927,7 +2933,7 @@ typedef struct
uint32_t reserved;
} vmode_adjust_t;
vmode_adjust_t vmodes_adj[64] = { 0 };
vmode_adjust_t vmodes_adj[64] = {};
static void adjust_vsize(char force)
{
@@ -2953,9 +2959,7 @@ static void adjust_vsize(char force)
uint32_t mode = scr_hsize | (scr_vsize << 12) | ((res & 0xFF) << 24);
if (mode)
{
int applied = 0;
int empty = -1;
for (int i = 0; i < sizeof(vmodes_adj) / sizeof(vmodes_adj[0]); i++)
for (uint i = 0; i < sizeof(vmodes_adj) / sizeof(vmodes_adj[0]); i++)
{
if (vmodes_adj[i].mode == mode)
{
@@ -3002,7 +3006,7 @@ static void store_vsize()
{
int applied = 0;
int empty = -1;
for (int i = 0; i < sizeof(vmodes_adj) / sizeof(vmodes_adj[0]); i++)
for (int i = 0; (uint)i < sizeof(vmodes_adj) / sizeof(vmodes_adj[0]); i++)
{
if (vmodes_adj[i].mode == mode)
{

View File

@@ -189,7 +189,7 @@ char user_io_user_button();
void user_io_osd_key_enable(char);
void user_io_serial_tx(char *, uint16_t);
char *user_io_8bit_get_string(char);
unsigned long user_io_8bit_set_status(unsigned long, unsigned long);
uint32_t user_io_8bit_set_status(uint32_t, uint32_t);
int user_io_file_tx(const char* name, unsigned char index = 0, char opensave = 0, char mute = 0, char composite = 0);
int user_io_file_mount(char *name, unsigned char index = 0, char pre = 0);
char user_io_dip_switch1(void);