Compiler identified issues in AltairZ80 simulator

This commit is contained in:
Mark Pizzolato 2013-04-12 06:39:28 -07:00
parent 1936f7ff75
commit 414cf3335f
10 changed files with 69 additions and 70 deletions

View file

@ -1930,7 +1930,7 @@ static t_stat sim_instr_mmu (void) {
while (switch_cpu_now == TRUE) { /* loop until halted */
if (sim_interval <= 0) { /* check clock queue */
#if !UNIX_PLATFORM
if ((reason = sim_os_poll_kbd()) == SCPE_STOP) /* poll on platforms without reliable signalling */
if ((reason = sim_poll_kbd()) == SCPE_STOP) /* poll on platforms without reliable signalling */
break;
#endif
if ((reason = sim_process_event()))

View file

@ -209,7 +209,7 @@ t_stat sim_instr_8086(void) {
while (switch_cpu_now == TRUE) { /* loop until halted */
if (sim_interval <= 0) { /* check clock queue */
#if !UNIX_PLATFORM
if ((reason = sim_os_poll_kbd()) == SCPE_STOP) /* poll on platforms without reliable signalling */
if ((reason = sim_poll_kbd()) == SCPE_STOP) /* poll on platforms without reliable signalling */
break;
#endif
if ( (reason = sim_process_event()) )

View file

@ -206,7 +206,7 @@ static uint8 mfdc_rom[256] = {
};
/* Reset routine */
t_stat mfdc_reset(DEVICE *dptr)
static t_stat mfdc_reset(DEVICE *dptr)
{
uint8 i;
PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt;
@ -228,7 +228,7 @@ t_stat mfdc_reset(DEVICE *dptr)
}
/* Attach routine */
t_stat mfdc_attach(UNIT *uptr, char *cptr)
static t_stat mfdc_attach(UNIT *uptr, char *cptr)
{
t_stat r;
unsigned int i = 0;
@ -283,7 +283,7 @@ t_stat mfdc_attach(UNIT *uptr, char *cptr)
/* Detach routine */
t_stat mfdc_detach(UNIT *uptr)
static t_stat mfdc_detach(UNIT *uptr)
{
t_stat r;
int8 i;

View file

@ -285,7 +285,7 @@ static t_stat disk2_attach(UNIT *uptr, char *cptr)
/* Detach routine */
t_stat disk2_detach(UNIT *uptr)
static t_stat disk2_detach(UNIT *uptr)
{
t_stat r;
int8 i;

View file

@ -351,7 +351,7 @@ static t_stat disk3_attach(UNIT *uptr, char *cptr)
/* Detach routine */
t_stat disk3_detach(UNIT *uptr)
static t_stat disk3_detach(UNIT *uptr)
{
DISK3_DRIVE_INFO *pDrive;
t_stat r;

View file

@ -256,7 +256,7 @@ static t_stat hdc1001_attach(UNIT *uptr, char *cptr)
/* Detach routine */
t_stat hdc1001_detach(UNIT *uptr)
static t_stat hdc1001_detach(UNIT *uptr)
{
HDC1001_DRIVE_INFO *pDrive;
t_stat r;

View file

@ -268,7 +268,7 @@ DEVICE mdsad_dev = {
};
/* Reset routine */
t_stat mdsad_reset(DEVICE *dptr)
static t_stat mdsad_reset(DEVICE *dptr)
{
PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt;
@ -289,7 +289,7 @@ t_stat mdsad_reset(DEVICE *dptr)
}
/* Attach routine */
t_stat mdsad_attach(UNIT *uptr, char *cptr)
static t_stat mdsad_attach(UNIT *uptr, char *cptr)
{
char header[4];
t_stat r;
@ -341,7 +341,7 @@ t_stat mdsad_attach(UNIT *uptr, char *cptr)
/* Detach routine */
t_stat mdsad_detach(UNIT *uptr)
static t_stat mdsad_detach(UNIT *uptr)
{
t_stat r;
int8 i;

View file

@ -437,7 +437,7 @@ t_stat diskCreate(FILE *fileref, char *ctlr_comment)
}
t_stat diskFormat(DISK_INFO *myDisk)
static t_stat diskFormat(DISK_INFO *myDisk)
{
uint8 i;
uint8 sector_map[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};

View file

@ -125,14 +125,14 @@
/* Forward Declaraations of Platform specific routines */
t_stat sim_os_poll_kbd (void);
t_bool sim_os_poll_kbd_ready (int ms_timeout);
t_stat sim_os_putchar (int32 out);
t_stat sim_os_ttinit (void);
t_stat sim_os_ttrun (void);
t_stat sim_os_ttcmd (void);
t_stat sim_os_ttclose (void);
t_bool sim_os_ttisatty (void);
static t_stat sim_os_poll_kbd (void);
static t_bool sim_os_poll_kbd_ready (int ms_timeout);
static t_stat sim_os_putchar (int32 out);
static t_stat sim_os_ttinit (void);
static t_stat sim_os_ttrun (void);
static t_stat sim_os_ttcmd (void);
static t_stat sim_os_ttclose (void);
static t_bool sim_os_ttisatty (void);
#define KMAP_WRU 0
#define KMAP_BRK 1
@ -1130,7 +1130,7 @@ typedef struct {
SENSE_BUF cmd_mode = { 0 };
SENSE_BUF run_mode = { 0 };
t_stat sim_os_ttinit (void)
static t_stat sim_os_ttinit (void)
{
unsigned int status;
IOSB iosb;
@ -1149,7 +1149,7 @@ run_mode.stat2 = cmd_mode.stat2 | TT2$M_PASTHRU;
return SCPE_OK;
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
unsigned int status;
IOSB iosb;
@ -1161,7 +1161,7 @@ if ((status != SS$_NORMAL) || (iosb.status != SS$_NORMAL))
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
unsigned int status;
IOSB iosb;
@ -1173,19 +1173,19 @@ if ((status != SS$_NORMAL) || (iosb.status != SS$_NORMAL))
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
sim_ttcmd ();
sys$dassgn (tty_chan);
return SCPE_OK;
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
return isatty (fileno (stdin));
}
t_stat sim_os_poll_kbd_data (void)
static t_stat sim_os_poll_kbd_data (void)
{
unsigned int status, term[2];
unsigned char buf[4];
@ -1210,7 +1210,7 @@ if (sim_brk_char && (buf[0] == sim_brk_char))
return (buf[0] | SCPE_KFLAG);
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
t_stat response;
@ -1221,7 +1221,7 @@ if (response = buffered_character) {
return sim_os_poll_kbd_data ();
}
t_bool sim_os_poll_kbd_ready (int ms_timeout)
static t_bool sim_os_poll_kbd_ready (int ms_timeout)
{
unsigned int status, term[2];
unsigned char buf[4];
@ -1244,7 +1244,7 @@ return TRUE;
}
t_stat sim_os_putchar (int32 out)
static t_stat sim_os_putchar (int32 out)
{
unsigned int status;
char c;
@ -1300,7 +1300,7 @@ ControlHandler(DWORD dwCtrlType)
return FALSE;
}
t_stat sim_os_ttinit (void)
static t_stat sim_os_ttinit (void)
{
SetConsoleCtrlHandler( ControlHandler, TRUE );
std_input = GetStdHandle (STD_INPUT_HANDLE);
@ -1311,7 +1311,7 @@ if ((std_input) && /* Not Background proces
return SCPE_OK;
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
if ((std_input) && /* If Not Background process? */
(std_input != INVALID_HANDLE_VALUE) &&
@ -1326,7 +1326,7 @@ SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
if (sim_log) {
fflush (sim_log);
@ -1340,19 +1340,19 @@ if ((std_input) && /* If Not Background pro
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
return SCPE_OK;
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
DWORD Mode;
return (std_input) && (std_input != INVALID_HANDLE_VALUE) && GetConsoleMode (std_input, &Mode);
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
int c = -1;
DWORD nkbevents, nkbevent;
@ -1395,7 +1395,7 @@ if ((sim_brk_char && ((c & 0177) == sim_brk_char)) || (c & SCPE_BREAK))
return c | SCPE_KFLAG;
}
t_bool sim_os_poll_kbd_ready (int ms_timeout)
static t_bool sim_os_poll_kbd_ready (int ms_timeout)
{
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_poll_kbd_ready()\n");
if ((std_input == NULL) || /* No keyboard for */
@ -1406,7 +1406,7 @@ if ((std_input == NULL) || /* No keyboard for */
return (WAIT_OBJECT_0 == WaitForSingleObject (std_input, ms_timeout));
}
t_stat sim_os_putchar (int32 c)
static t_stat sim_os_putchar (int32 c)
{
DWORD unused;
@ -1421,32 +1421,32 @@ return SCPE_OK;
#include <conio.h>
t_stat sim_os_ttinit (void)
static t_stat sim_os_ttinit (void)
{
return SCPE_OK;
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
return SCPE_OK;
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
return 1;
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
int c;
@ -1477,13 +1477,13 @@ if (sim_brk_char && ((c & 0177) == sim_brk_char))
return c | SCPE_KFLAG;
}
t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
{
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
return TRUE; /* force a poll */
}
t_stat sim_os_putchar (int32 c)
static t_stat sim_os_putchar (int32 c)
{
if (c != 0177) {
#if defined (__EMX__)
@ -1609,7 +1609,7 @@ int ps_getch(void) {
/* Note that this only works if the call to sim_ttinit comes before any output to the console */
t_stat sim_os_ttinit (void) {
static t_stat sim_os_ttinit (void) {
int i;
/* this blank will later be replaced by the number of characters */
char title[50] = " ";
@ -1632,27 +1632,27 @@ t_stat sim_os_ttinit (void) {
return SCPE_OK;
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
return SCPE_OK;
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
return 1;
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
int c;
@ -1667,13 +1667,13 @@ if (sim_brk_char && ((c & 0177) == sim_brk_char))
return c | SCPE_KFLAG;
}
t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
{
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
return TRUE; /* force a poll */
}
t_stat sim_os_putchar (int32 c)
static t_stat sim_os_putchar (int32 c)
{
if (c != 0177) {
putchar (c);
@ -1695,7 +1695,7 @@ struct tchars cmdtchars,runtchars; /* V7 editing */
struct ltchars cmdltchars,runltchars; /* 4.2 BSD editing */
int cmdfl,runfl; /* TTY flags */
t_stat sim_os_ttinit (void)
static t_stat sim_os_ttinit (void)
{
cmdfl = fcntl (0, F_GETFL, 0); /* get old flags and status */
runfl = cmdfl | FNDELAY;
@ -1722,7 +1722,7 @@ runltchars.t_lnextc = 0xFF;
return SCPE_OK; /* return success */
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
runtchars.t_intrc = sim_int_char; /* in case changed */
fcntl (0, F_SETFL, runfl); /* non-block mode */
@ -1736,7 +1736,7 @@ nice (10); /* lower priority */
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
nice (-10); /* restore priority */
fcntl (0, F_SETFL, cmdfl); /* block mode */
@ -1749,17 +1749,17 @@ if (ioctl (0, TIOCSLTC, &cmdltchars) < 0)
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
return sim_ttcmd ();
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
return isatty (0);
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
int status;
unsigned char buf[1];
@ -1771,7 +1771,7 @@ if (sim_brk_char && (buf[0] == sim_brk_char))
else return (buf[0] | SCPE_KFLAG);
}
t_bool sim_os_poll_kbd_ready (int ms_timeout)
static t_bool sim_os_poll_kbd_ready (int ms_timeout)
{
fd_set readfds;
struct timeval timeout;
@ -1787,7 +1787,7 @@ timeout.tv_usec = (ms_timeout*1000)%1000000;
return (1 == select (1, &readfds, NULL, NULL, &timeout));
}
t_stat sim_os_putchar (int32 out)
static t_stat sim_os_putchar (int32 out)
{
char c;
@ -1806,7 +1806,7 @@ return SCPE_OK;
struct termios cmdtty, runtty;
static int prior_norm = 1;
t_stat sim_os_ttinit (void)
static t_stat sim_os_ttinit (void)
{
if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK;
@ -1848,7 +1848,7 @@ runtty.c_cc[VSTATUS] = 0;
return SCPE_OK;
}
t_stat sim_os_ttrun (void)
static t_stat sim_os_ttrun (void)
{
if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK;
@ -1863,7 +1863,7 @@ if (prior_norm) { /* at normal pri? */
return SCPE_OK;
}
t_stat sim_os_ttcmd (void)
static t_stat sim_os_ttcmd (void)
{
if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK;
@ -1877,17 +1877,17 @@ if (tcsetattr (0, TCSAFLUSH, &cmdtty) < 0)
return SCPE_OK;
}
t_stat sim_os_ttclose (void)
static t_stat sim_os_ttclose (void)
{
return sim_ttcmd ();
}
t_bool sim_os_ttisatty (void)
static t_bool sim_os_ttisatty (void)
{
return isatty (fileno (stdin));
}
t_stat sim_os_poll_kbd (void)
static t_stat sim_os_poll_kbd (void)
{
int status;
unsigned char buf[1];
@ -1899,7 +1899,7 @@ if (sim_brk_char && (buf[0] == sim_brk_char))
else return (buf[0] | SCPE_KFLAG);
}
t_bool sim_os_poll_kbd_ready (int ms_timeout)
static t_bool sim_os_poll_kbd_ready (int ms_timeout)
{
fd_set readfds;
struct timeval timeout;
@ -1915,7 +1915,7 @@ timeout.tv_usec = (ms_timeout*1000)%1000000;
return (1 == select (1, &readfds, NULL, NULL, &timeout));
}
t_stat sim_os_putchar (int32 out)
static t_stat sim_os_putchar (int32 out)
{
char c;

View file

@ -88,7 +88,6 @@ t_stat sim_ttrun (void);
t_stat sim_ttcmd (void);
t_stat sim_ttclose (void);
t_bool sim_ttisatty (void);
t_stat sim_os_poll_kbd (void);
int32 sim_tt_inpcvt (int32 c, uint32 mode);
int32 sim_tt_outcvt (int32 c, uint32 mode);