Code Cleanup: Warnings

Cleaned up code to remove compiler warnings.
This commit is contained in:
Peter Weingartner 2022-04-18 21:42:23 -04:00
parent 730bb6b209
commit 6bd9908531
22 changed files with 9039 additions and 9022 deletions

View file

@ -4,7 +4,7 @@
# and where the MCP will run (ram or flash)
#
UNIT := a2560k
MEMORY := ram
MEMORY := flash
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */

View file

@ -41,7 +41,7 @@
/* TODO: move this to constants.h */
#define BOOT_SECTOR_BUFFER ((volatile unsigned char *)0x00004000)
#define BOOT_SECTOR_BUFFER ((unsigned char *)0x00004000)
#define BOOT_CODE_MBR_OFF 0x000 /* Offset to the code in the MBR */
#define BOOT_CPUID_MBR_OFF 0x004 /* Offset to the CPUID in the MBR */
#define BOOT_SIG_MBR_OFF 0x006 /* Offset to the boot signature in the MBR */
@ -266,7 +266,7 @@ short boot_screen() {
region.size.height = 20;
txt_set_region(screen, &region);
sprintf(buffer, "\x1b[HFOENIX/MCP V: %02d.%02d.%04d\n", info.mcp_version, info.mcp_rev, info.mcp_build);
sprintf(buffer, "\x1b[HFOENIX/MCP V: %02u.%04u.%04u\n", info.mcp_version, info.mcp_rev, info.mcp_build);
print(screen, buffer);
str_upcase(info.model_name, entry);
sprintf(buffer, " MODEL: %s\n", entry);
@ -274,9 +274,9 @@ short boot_screen() {
str_upcase(info.cpu_name, entry);
sprintf(buffer, " CPU: %s\n", entry);
print(screen, buffer);
sprintf(buffer, " CLOCK (KHZ): %d\n", info.cpu_clock_khz);
sprintf(buffer, " CLOCK (KHZ): %u\n", info.cpu_clock_khz);
print(screen, buffer);
sprintf(buffer, " FPGA V: %02d.%02d.%04d\n", info.fpga_model, info.fpga_version, info.fpga_subver);
sprintf(buffer, " FPGA V: %u.%02u.%04u\n", (unsigned int)info.fpga_model, info.fpga_version, info.fpga_subver);
print(screen, buffer);
/* Wait until the target duration has been reached _or_ the user presses a key */

0
src/build.log Normal file
View file

View file

@ -212,7 +212,7 @@ short cmd_sysinfo(short channel, int argc, const char * argv[]) {
sprintf(buffer, "\nCPU: %s", cli_sys_info.cpu_name);
print(channel, buffer);
sprintf(buffer, "\nClock (kHz): %d", cli_sys_info.cpu_clock_khz);
sprintf(buffer, "\nClock (kHz): %u", cli_sys_info.cpu_clock_khz);
print(channel, buffer);
sprintf(buffer, "\nSystem Memory: 0x%lX", cli_sys_info.system_ram_size);
@ -635,7 +635,7 @@ short cli_readline(short channel, char * command_line) {
case CLI_KEY_RIGHT:
// Move cursor right
if (key_code & CLI_FLAG_CTRL) {
sprintf(buffer, "\x1b[%dG", strlen(command_line) + 3);
sprintf(buffer, "\x1b[%dG", (short)(3 + strlen(command_line)));
print(channel, buffer);
i = strlen(command_line);
} else {
@ -700,7 +700,7 @@ short cli_readline(short channel, char * command_line) {
* @param command_line the command line to process
* @return the result of running the command line
*/
short cli_process_line(short channel, const char * command_line) {
short cli_process_line(short channel, char * command_line) {
char * arg;
char * token_save;
char * delim = " ";
@ -818,7 +818,7 @@ void cli_setup_screen(short channel, const char * path, short is_active) {
print(channel, "\x1b[2J\x1b[1;2H");
print_banner(channel, cli_sys_info.model);
sprintf(message, "\nFoenix/MCP v%02d.%02d.%04d\n\n", cli_sys_info.mcp_version, cli_sys_info.mcp_rev, cli_sys_info.mcp_build);
sprintf(message, "\nFoenix/MCP v%02u.%02u.%04u\n\n", (unsigned int)cli_sys_info.mcp_version, (unsigned int)cli_sys_info.mcp_rev, (unsigned int)cli_sys_info.mcp_build);
print(channel, message);
print(channel, "Type HELP or ? for help.\n");
}

View file

@ -22,6 +22,10 @@
#include "snd/codec.h"
#include "vicky_general.h"
#if MODEL == MODEL_FOENIX_A2560K
#include "dev/kbd_mo.h"
#endif
#define MAX_SETTING_NAME 64
#define MAX_SETTING_HELP 80
@ -586,7 +590,7 @@ short cli_screen_set(short channel, const char * value) {
/**
* Get the number of the text screen to use for interactions
*/
short cli_screen_get(short channel, const char * value) {
short cli_screen_get(short channel, char * value, short size) {
sprintf(value, "%d", cli_txt_screen_get());
return 0;
}

View file

@ -2,6 +2,7 @@
* Commands to work with the sound devices
*/
#include <stdio.h>
#include <string.h>
#include "timers.h"
@ -11,6 +12,7 @@
#include "snd/psg.h"
#include "snd/sid.h"
#include "dev/midi.h"
#include "simpleio.h"
#include "syscalls.h"
#include "include/A2560K/YM2151.h"
@ -66,12 +68,12 @@ short psg_test(short channel, int argc, const char * argv[]) {
/*
* Play a sound on the SID
*/
short sid_test(short channel, int argc, char * argv[]) {
short sid_test(short channel, int argc, const char * argv[]) {
short i;
unsigned char reg;
unsigned char data;
long target_time;
unsigned char * opm_base = OPM_INT_BASE;
volatile unsigned char * opm_base = OPM_INT_BASE;
if (argc >= 2) {
/* Allow the user to select the external OPM */
@ -481,12 +483,12 @@ const unsigned char opm_tone_off[] = {
/*
* Play a sound on the OPM
*/
short opm_test(short channel, int argc, char * argv[]) {
short opm_test(short channel, int argc, const char * argv[]) {
short i;
unsigned char reg;
unsigned char data;
long target_time;
unsigned char * opm_base = OPM_INT_BASE;
volatile unsigned char * opm_base = OPM_INT_BASE;
Test_EXT_FM2151();
//
@ -605,12 +607,12 @@ const unsigned char opn_tone_off[] = {
/*
* Play a sound on the OPN
*/
short opn_test(short channel, int argc, char * argv[]) {
short opn_test(short channel, int argc, const char * argv[]) {
short i;
unsigned char reg;
unsigned char data;
long target_time;
unsigned char * opn_base = OPN2_INT_BASE;
volatile unsigned char * opn_base = OPN2_INT_BASE;
Test_EXT_FM2612();
//
@ -769,8 +771,7 @@ short midi_rx_test(short channel, int argc, const char * argv[]) {
midi_init();
sprintf(message, "Press '1' to start, and 'ESC' to exit test.\n");
sys_chan_write(channel, message, strlen(message));
print(channel, "Press '1' to start, and 'ESC' to exit test.\n");
while (sys_kbd_scancode() != 0x02) ;

View file

@ -13,7 +13,7 @@ extern short psg_test(short channel, int argc, const char * argv[]);
/*
* Play a sound on the SID
*/
extern short sid_test(short channel, int argc, char * argv[]);
extern short sid_test(short channel, int argc, const char * argv[]);
/*
* Play a sound on the OPL3
@ -23,12 +23,12 @@ extern short opl3_test(short channel, int argc, const char * argv[]);
/*
* Play a sound on the OPM
*/
extern short opm_test(short channel, int argc, char * argv[]);
extern short opm_test(short channel, int argc, const char * argv[]);
/*
* Play a sound on the OPN
*/
extern short opn_test(short channel, int argc, char * argv[]);
extern short opn_test(short channel, int argc, const char * argv[]);
/*
* Perform a transmit test on the MIDI ports

View file

@ -29,6 +29,10 @@
#include "uart_reg.h"
#include "vicky_general.h"
#if MODEL == MODEL_FOENIX_A2560K
#include "dev/kbd_mo.h"
#endif
typedef struct s_cli_test_feature {
const char * name;
const char * help;
@ -50,7 +54,7 @@ short kbd_break() {
/*
* Test the PS/2 keyboard
*/
int cli_test_ps2(short channel, int argc, char * argv[]) {
short cli_test_ps2(short channel, int argc, const char * argv[]) {
char message[80];
unsigned short scancode = 0;
@ -71,10 +75,10 @@ int cli_test_ps2(short channel, int argc, char * argv[]) {
/*
* Test the joystick ports
*/
int cli_test_joystick(short channel, int argc, char * argv[]) {
short cli_test_joystick(short channel, int argc, const char * argv[]) {
char message[80];
volatile unsigned int * joystick_port = 0xFEC00500;
volatile unsigned int * game_ctrl_port = 0xFEC00504;
volatile unsigned int * joystick_port = (volatile unsigned int *)0xFEC00500;
volatile unsigned int * game_ctrl_port = (volatile unsigned int *)0xFEC00504;
unsigned int joy_state = 0, old_joy_state = 0xffffffff;
unsigned short scancode = 0;
@ -101,13 +105,13 @@ int cli_test_joystick(short channel, int argc, char * argv[]) {
/*
* Test SNES gamepads
*/
int cli_test_gamepad(short channel, int argc, char * argv[]) {
short cli_test_gamepad(short channel, int argc, const char * argv[]) {
char message[80];
volatile unsigned int * game_ctrl_port = 0xFEC00504;
volatile unsigned int * game_0_0_port = 0xFEC00508;
volatile unsigned int * game_0_1_port = 0xFEC0050C;
volatile unsigned int * game_1_0_port = 0xFEC00510;
volatile unsigned int * game_1_1_port = 0xFEC00514;
volatile unsigned int * game_ctrl_port = (volatile unsigned int *)0xFEC00504;
volatile unsigned int * game_0_0_port = (volatile unsigned int *)0xFEC00508;
volatile unsigned int * game_0_1_port = (volatile unsigned int *)0xFEC0050C;
volatile unsigned int * game_1_0_port = (volatile unsigned int *)0xFEC00510;
volatile unsigned int * game_1_1_port = (volatile unsigned int *)0xFEC00514;
unsigned int game_ctrl;
unsigned int game_status;
unsigned int game_state_0 = 0;
@ -124,7 +128,7 @@ int cli_test_gamepad(short channel, int argc, char * argv[]) {
}
}
sprintf(message, "Testing SNES gamepad port %d... ESC to quit.\n", port);
sprintf(message, "Testing SNES gamepad port %d... ESC to quit.\n", (short)port);
sys_chan_write(channel, message, strlen(message));
/* Make sure we're in SNES mode */
@ -213,7 +217,7 @@ short cli_test_uart(short channel, int argc, const char * argv[]) {
sys_chan_write(0, buffer, strlen(buffer));
for (;;) {
c = kbdmo_getc()
c = kbdmo_getc();
if (c != 0) {
if (c == '~') {
return 0;
@ -338,7 +342,7 @@ short cli_mem_test(short channel, int argc, const char * argv[]) {
}
#if MODEL == MODEL_FOENIX_A2560K
int cli_test_recalibrate(short screen, int argc, char * argv[]) {
short cli_test_recalibrate(short screen, int argc, const char * argv[]) {
unsigned char buffer[512];
short i;
short result;
@ -360,7 +364,7 @@ int cli_test_recalibrate(short screen, int argc, char * argv[]) {
return 0;
}
int cli_test_seek(short screen, int argc, char * argv[]) {
short cli_test_seek(short screen, int argc, const char * argv[]) {
unsigned char buffer[512];
short i;
unsigned char cylinder;
@ -370,7 +374,7 @@ int cli_test_seek(short screen, int argc, char * argv[]) {
cylinder = (unsigned char)cli_eval_number(argv[1]);
sprintf(buffer, "Seeking to %d\n", cylinder);
sprintf(buffer, "Seeking to %d\n", (short)cylinder);
sys_chan_write(screen, buffer, strlen(buffer));
if (fdc_seek(cylinder) == 0) {
@ -388,7 +392,7 @@ int cli_test_seek(short screen, int argc, char * argv[]) {
/*
* Test the FDC interface by reading the MBR
*/
int cli_test_fdc(short screen, int argc, char * argv[]) {
short cli_test_fdc(short screen, int argc, const char * argv[]) {
unsigned char buffer[512];
short i;
short scancode;

View file

@ -265,6 +265,14 @@ extern short chan_seek(short channel, long position, short base);
*/
extern short chan_ioctrl(short channel, short command, uint8_t * buffer, short size);
/**
* Return the device associated with the channel
*
* @param channel the ID of the channel to query
* @return the ID of the device associated with the channel, negative number for error
*/
extern short chan_device(short channel);
/**
* Swap the channel ID assignments for two channels
*

View file

@ -370,7 +370,7 @@ void kbdmo_enqueue_scan(unsigned char scan_code) {
switch (scan_code & 0x7f) {
case 0x01:
/* ESC key pressed... check to see if it's a press with the Foenix key */
if (((g_kbdmo_control.modifiers & KBD_MOD_OS) != 0) && (is_break == 0) {
if (((g_kbdmo_control.modifiers & KBD_MOD_OS) != 0) && (is_break == 0)) {
/* ESC pressed with Foenix key... flag a BREAK. */
g_kbdmo_control.status |= KBD_STAT_BREAK;
}

View file

@ -104,7 +104,7 @@ short lpt_write(p_channel chan, const uint8_t * buffer, short size) {
/**
* Return the status of the printer
*/
short lpt_status() {
short lpt_status(p_channel chan) {
short result = 0;
// Get the status

View file

@ -208,7 +208,7 @@ void txt_a2560k_a_set_border_color(unsigned char red, unsigned char green, unsig
* @param height of a character in pixels
* @param data pointer to the raw font data to be loaded
*/
short txt_a2560k_a_set_font(short width, short height, unsigned char * data) {
short txt_a2560k_a_set_font(short width, short height, const unsigned char * data) {
if (((width == 8) && (height == 8)) || ((width == 8) && (height == 16))) {
int i;
@ -608,7 +608,7 @@ short txt_a2560k_a_install() {
device.set_border_color = txt_a2560k_a_set_border_color;
device.set_font = txt_a2560k_a_set_font;
device.set_cursor = txt_a2560k_a_set_cursor;
device.set_cursor_visible = txt_a2560k_a_set_cursor_visible
device.set_cursor_visible = txt_a2560k_a_set_cursor_visible;
device.get_region = txt_a2560k_a_get_region;
device.set_region = txt_a2560k_a_set_region;
device.get_color = txt_a2560k_a_get_color;

View file

@ -235,7 +235,7 @@ void txt_a2560k_b_set_border_color(unsigned char red, unsigned char green, unsig
* @param height of a character in pixels
* @param data pointer to the raw font data to be loaded
*/
short txt_a2560k_b_set_font(short width, short height, unsigned char * data) {
short txt_a2560k_b_set_font(short width, short height, const unsigned char * data) {
if ((width == 8) && (height == 8)) {
int i;
@ -637,7 +637,7 @@ short txt_a2560k_b_install() {
device.set_cursor = txt_a2560k_b_set_cursor;
device.set_cursor_visible = txt_a2560k_b_set_cursor_visible;
device.set_region = txt_a2560k_b_set_region;
device.get_region = txt_a2560k_b_get_region
device.get_region = txt_a2560k_b_get_region;
device.set_color = txt_a2560k_b_set_color;
device.get_color = txt_a2560k_b_get_color;
device.set_xy = txt_a2560k_b_set_xy;

View file

@ -242,7 +242,7 @@ void txt_set_border_color(short screen, unsigned char red, unsigned char green,
* @param height of a character in pixels
* @param data pointer to the raw font data to be loaded
*/
short txt_set_font(short screen, short width, short height, unsigned char * data) {
short txt_set_font(short screen, short width, short height, const unsigned char * data) {
p_txt_device device = txt_get_device(screen);
if (device) {
if (device->set_font) {
@ -264,7 +264,7 @@ void txt_set_cursor(short screen, short enable, short rate, char c) {
p_txt_device device = txt_get_device(screen);
if (device) {
if (device->set_cursor) {
return device->set_cursor(enable, rate, c);
device->set_cursor(enable, rate, c);
}
}
}
@ -279,7 +279,7 @@ void txt_set_cursor_visible(short screen, short enable) {
p_txt_device device = txt_get_device(screen);
if (device) {
if (device->set_cursor_visible) {
return device->set_cursor_visible(enable);
device->set_cursor_visible(enable);
}
}
}

View file

@ -38,7 +38,7 @@ typedef void (*p_setsizes)();
typedef short (*p_set_resolution)(short width, short height);
typedef void (*p_set_border)(short width, short height);
typedef void (*p_set_border_color)(unsigned char red, unsigned char green, unsigned char blue);
typedef short (*p_set_font)(short width, short height, unsigned char * data);
typedef short (*p_set_font)(short width, short height, const unsigned char * data);
typedef void (*p_set_cursor)(short enable, short rate, char c);
typedef void (*p_set_cursor_visible)(short enable);
typedef short (*p_set_region)(p_rect region);
@ -168,7 +168,7 @@ extern void txt_set_border_color(short screen, unsigned char red, unsigned char
* @param height of a character in pixels
* @param data pointer to the raw font data to be loaded
*/
extern short txt_set_font(short screen, short width, short height, unsigned char * data);
extern short txt_set_font(short screen, short width, short height, const unsigned char * data);
/**
* Set the appearance of the cursor

View file

@ -25,6 +25,7 @@
#include "dev/channel.h"
#include "dev/console.h"
#include "dev/fdc.h"
#include "dev/lpt.h"
#include "dev/txt_screen.h"
#include "dev/txt_a2560k_a.h"
#include "dev/txt_a2560k_b.h"

Binary file not shown.

View file

@ -117,7 +117,7 @@ void panic(void) {
region.origin.y = 0;
region.size.width = 0;
region.size.height = 0;
txt_set_region(0, &region)
txt_set_region(0, &region);
txt_set_color(0, 15, 1);
txt_set_cursor(0, 0, 0, 0);
txt_clear(0, 2);
@ -173,11 +173,11 @@ void panic(void) {
if (address_expected) {
txt_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X Address: %08X \xB3", panic_pc, panic_address);
sprintf(buffer, "\xB3 PC: %08X Address: %08X \xB3", (unsigned int)panic_pc, (unsigned int)panic_address);
txt_print(0, buffer);
} else {
txt_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X \xB3", panic_pc);
sprintf(buffer, "\xB3 PC: %08X \xB3", (unsigned int)panic_pc);
txt_print(0, buffer);
}

View file

@ -43,11 +43,11 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
case KFN_INT_ENABLE:
int_enable((unsigned short)param0);
return;
return 0;
case KFN_INT_DISABLE:
int_disable((unsigned short)param0);
return;
return 0;
case KFN_INT_ENABLE_ALL:
return int_enable_all();
@ -57,14 +57,14 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
case KFN_INT_CLEAR:
int_clear((unsigned short)param0);
return;
return 0;
case KFN_INT_PENDING:
return int_pending((unsigned short)param0);
case KFN_SYS_GET_INFO:
sys_get_information((p_sys_info)param0);
return;
return 0;
default:
return ERR_GENERAL;
@ -84,10 +84,10 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
return chan_read_b((short)param0);
case KFN_CHAN_READ:
return chan_read((short)param0, (const uint8_t *)param1, (short)param2);
return chan_read((short)param0, (unsigned char *)param1, (short)param2);
case KFN_CHAN_READ_LINE:
return chan_readline((short)param0, (const uint8_t *)param1, (short)param2);
return chan_readline((short)param0, (unsigned char *)param1, (short)param2);
case KFN_CHAN_STATUS:
return chan_status((short)param0);
@ -114,7 +114,7 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
return chan_swap((short)param0, (short)param1);
case KFN_CHAN_DEVICE:
return chan_device((short)param0);
return chan_device((short)param0);
default:
return ERR_GENERAL;
@ -190,7 +190,7 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
return fsys_setlabel((short)param0, (char *)param1);
case KFN_GET_CWD:
return fsys_get_cwd((char *)param0);
return fsys_get_cwd((char *)param0, (short)param1);
case KFN_SET_CWD:
return fsys_set_cwd((char *)param0);
@ -208,7 +208,7 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
/* Process and Memory functions */
switch (function) {
case KFN_RUN:
return proc_run((char *)param0, (int)param1, (char *)param2);
return proc_run((char *)param0, (int)param1, (char **)param2);
case KFN_MEM_GET_RAMTOP:
return mem_get_ramtop();

17913
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -788,7 +788,7 @@ void sys_txt_get_xy(short screen, p_point position) {
* @return 0 on success, any other number means the region was invalid
*/
short sys_txt_get_region(short screen, p_rect region) {
syscall(KFN_TXT_GET_REGION, screen, region);
return syscall(KFN_TXT_GET_REGION, screen, region);
}
/**
@ -801,7 +801,7 @@ short sys_txt_get_region(short screen, p_rect region) {
* @return 0 on success, any other number means the region was invalid
*/
short sys_txt_set_region(short screen, p_rect region) {
syscall(KFN_TXT_SET_REGION, screen, region);
return syscall(KFN_TXT_SET_REGION, screen, region);
}
/**
@ -811,8 +811,8 @@ short sys_txt_set_region(short screen, p_rect region) {
* @param foreground the Text LUT index of the new current foreground color (0 - 15)
* @param background the Text LUT index of the new current background color (0 - 15)
*/
short sys_txt_set_color(short screen, unsigned char foreground, unsigned char background) {
return syscall(KFN_TXT_SET_COLOR, screen, foreground, background);
void sys_txt_set_color(short screen, unsigned char foreground, unsigned char background) {
syscall(KFN_TXT_SET_COLOR, screen, foreground, background);
}
/*

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 0
#define VER_MINOR 52
#define VER_BUILD 1
#define VER_BUILD 2
#endif