1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

BESM6: Compiler suggested cleanups (MSVC).

This commit is contained in:
Mark Pizzolato 2014-12-30 17:52:13 -08:00
parent 2819ff634e
commit 76dd31ae02
5 changed files with 20 additions and 17 deletions

View File

@ -45,7 +45,7 @@ static alureg_t toalu (t_value val)
return ret;
}
static int inline is_negative (alureg_t *word)
static int SIM_INLINE is_negative (alureg_t *word)
{
return (word->mantissa & BIT41) != 0;
}

View File

@ -54,9 +54,7 @@
#include <math.h>
#include <float.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
@ -769,11 +767,12 @@ void check_initial_setup ()
pult[5] = 1 << 21;
GRP |= GRP_PANEL_REQ;
} else {
struct tm * d;
/* Яч. ГОД обновляем самостоятельно */
time_t t;
t_value date;
time(&t);
struct tm * d;
d = localtime(&t);
++d->tm_mon;
date = (t_value) (d->tm_mday / 10) << 33 |
@ -803,9 +802,10 @@ void check_initial_setup ()
void cpu_one_inst ()
{
int reg, opcode, addr, nextpc, next_mod;
t_value word;
corr_stack = 0;
t_value word = mmu_fetch (PC);
word = mmu_fetch (PC);
if (RUU & RUU_RIGHT_INSTR)
RK = word; /* get right instruction */
else

View File

@ -139,7 +139,7 @@ t_stat mmu_reset (DEVICE *dptr)
{
int i;
for (i = 0; i < 8; ++i) {
BRZ[i] = BAZ[i] = RP[i] = 0;
BRZ[i] = RP[i] = BAZ[i] = 0;
}
TABST = 0;
OLDEST = 0;
@ -209,12 +209,13 @@ void mmu_protection_check (int addr)
void mmu_flush (int idx)
{
int waddr = BAZ[idx];
if (! BAZ[idx]) {
/* Был пуст после сброса или выталкивания */
return;
}
/* Вычисляем физический адрес выталкиваемого БРЗ */
int waddr = BAZ[idx];
waddr = (waddr > 0100000) ? (waddr - 0100000) :
(waddr & 01777) | (TLB[waddr >> 10] << 10);
memory[waddr] = BRZ[idx];
@ -626,7 +627,7 @@ void mmu_setprotection (int idx, t_value val)
/* Разряды сумматора, записываемые в регистр защиты - 21-28 */
int mask = 0xff << (idx * 8);
val = ((val >> 20) & 0xff) << (idx * 8);
RZ = (RZ & ~mask) | val;
RZ = (uint32)((RZ & ~mask) | val);
}
void mmu_setcache (int idx, t_value val)

View File

@ -24,7 +24,6 @@
*/
#include "besm6_defs.h"
#include <math.h>
#include <unistd.h>
const char *opname_short_bemsh [64] = {
"зп", "зпм", "рег", "счм", "сл", "вч", "вчоб","вчаб",
@ -188,7 +187,7 @@ t_value ieee_to_besm6 (double d)
d = frexp (d, &exponent);
/* 0.5 <= d < 1.0 */
d = ldexp (d, 40);
word = d;
word = (t_value)d;
if (d - word >= 0.5)
word += 1; /* Округление. */
if (exponent < -64)
@ -207,6 +206,7 @@ t_value ieee_to_besm6 (double d)
double besm6_to_ieee (t_value word)
{
double mantissa;
int exponent;
/* Убираем свертку */
word &= BITS48;
@ -214,9 +214,9 @@ double besm6_to_ieee (t_value word)
/* Сдвигаем так, чтобы знак мантиссы пришелся на знак целого;
* таким образом, mantissa равно исходной мантиссе, умноженной на 2**63.
*/
mantissa = (t_int64) word << (64 - 48 + 7);
mantissa = (double)(((t_int64) word) << (64 - 48 + 7));
int exponent = word >> 41;
exponent = word >> 41;
/* Порядок смещен вверх на 64, и мантиссу нужно скорректировать */
return ldexp (mantissa, exponent - 64 - 63);
@ -472,7 +472,7 @@ t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
if (sw & SWMASK ('M')) { /* symbolic decode? */
if (sw & SIM_SW_STOP && addr == PC && !(RUU & RUU_RIGHT_INSTR))
fprintf (of, "-> ");
besm6_fprint_cmd (of, cmd >> 24);
besm6_fprint_cmd (of, (uint32)(cmd >> 24));
if (sw & SIM_SW_STOP) /* stop point */
fprintf (of, ", ");
else
@ -638,7 +638,7 @@ t_stat besm6_load (FILE *input)
case 0: /* EOF */
return SCPE_OK;
case ':': /* address */
addr = word;
addr = (int)word;
break;
case '=': /* word */
if (addr < 010)
@ -655,7 +655,7 @@ t_stat besm6_load (FILE *input)
++addr;
break;
case '@': /* start address */
PC = word;
PC = (uint32)word;
break;
}
if (addr > MEMSIZE)
@ -686,7 +686,7 @@ t_stat besm6_dump (FILE *of, char *fnam)
last_addr = addr;
if (IS_INSN (word)) {
fprintf (of, "к ");
besm6_fprint_cmd (of, word >> 24);
besm6_fprint_cmd (of, (uint32)(word >> 24));
fprintf (of, ", ");
besm6_fprint_cmd (of, word & BITS(24));
fprintf (of, "\t\t; %05o - ", addr);

View File

@ -166,6 +166,8 @@ t_stat tty_reset (DEVICE *dptr)
/* 19 р ГРП, 300 Гц */
t_stat vt_clk (UNIT * this)
{
int num;
/* Телетайпы работают на 10 бод */
static int clk_divider = 1<<29;
GRP |= MGRP & BBIT(19);
@ -184,7 +186,7 @@ t_stat vt_clk (UNIT * this)
}
/* Есть новые сетевые подключения? */
int num = tmxr_poll_conn (&tty_desc);
num = tmxr_poll_conn (&tty_desc);
if (num > 0 && num <= LINES_MAX) {
char buf [80];
TMLN *t = &tty_line [num];