mirror of
https://github.com/simh/simh.git
synced 2026-05-03 22:48:35 +00:00
BESM6: Compiler suggested cleanups (MSVC).
This commit is contained in:
@@ -45,7 +45,7 @@ static alureg_t toalu (t_value val)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int inline is_negative (alureg_t *word)
|
static int SIM_INLINE is_negative (alureg_t *word)
|
||||||
{
|
{
|
||||||
return (word->mantissa & BIT41) != 0;
|
return (word->mantissa & BIT41) != 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,9 +54,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -769,11 +767,12 @@ void check_initial_setup ()
|
|||||||
pult[5] = 1 << 21;
|
pult[5] = 1 << 21;
|
||||||
GRP |= GRP_PANEL_REQ;
|
GRP |= GRP_PANEL_REQ;
|
||||||
} else {
|
} else {
|
||||||
|
struct tm * d;
|
||||||
|
|
||||||
/* Яч. ГОД обновляем самостоятельно */
|
/* Яч. ГОД обновляем самостоятельно */
|
||||||
time_t t;
|
time_t t;
|
||||||
t_value date;
|
t_value date;
|
||||||
time(&t);
|
time(&t);
|
||||||
struct tm * d;
|
|
||||||
d = localtime(&t);
|
d = localtime(&t);
|
||||||
++d->tm_mon;
|
++d->tm_mon;
|
||||||
date = (t_value) (d->tm_mday / 10) << 33 |
|
date = (t_value) (d->tm_mday / 10) << 33 |
|
||||||
@@ -803,9 +802,10 @@ void check_initial_setup ()
|
|||||||
void cpu_one_inst ()
|
void cpu_one_inst ()
|
||||||
{
|
{
|
||||||
int reg, opcode, addr, nextpc, next_mod;
|
int reg, opcode, addr, nextpc, next_mod;
|
||||||
|
t_value word;
|
||||||
|
|
||||||
corr_stack = 0;
|
corr_stack = 0;
|
||||||
t_value word = mmu_fetch (PC);
|
word = mmu_fetch (PC);
|
||||||
if (RUU & RUU_RIGHT_INSTR)
|
if (RUU & RUU_RIGHT_INSTR)
|
||||||
RK = word; /* get right instruction */
|
RK = word; /* get right instruction */
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ t_stat mmu_reset (DEVICE *dptr)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
BRZ[i] = BAZ[i] = RP[i] = 0;
|
BRZ[i] = RP[i] = BAZ[i] = 0;
|
||||||
}
|
}
|
||||||
TABST = 0;
|
TABST = 0;
|
||||||
OLDEST = 0;
|
OLDEST = 0;
|
||||||
@@ -209,12 +209,13 @@ void mmu_protection_check (int addr)
|
|||||||
|
|
||||||
void mmu_flush (int idx)
|
void mmu_flush (int idx)
|
||||||
{
|
{
|
||||||
|
int waddr = BAZ[idx];
|
||||||
|
|
||||||
if (! BAZ[idx]) {
|
if (! BAZ[idx]) {
|
||||||
/* Был пуст после сброса или выталкивания */
|
/* Был пуст после сброса или выталкивания */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Вычисляем физический адрес выталкиваемого БРЗ */
|
/* Вычисляем физический адрес выталкиваемого БРЗ */
|
||||||
int waddr = BAZ[idx];
|
|
||||||
waddr = (waddr > 0100000) ? (waddr - 0100000) :
|
waddr = (waddr > 0100000) ? (waddr - 0100000) :
|
||||||
(waddr & 01777) | (TLB[waddr >> 10] << 10);
|
(waddr & 01777) | (TLB[waddr >> 10] << 10);
|
||||||
memory[waddr] = BRZ[idx];
|
memory[waddr] = BRZ[idx];
|
||||||
@@ -626,7 +627,7 @@ void mmu_setprotection (int idx, t_value val)
|
|||||||
/* Разряды сумматора, записываемые в регистр защиты - 21-28 */
|
/* Разряды сумматора, записываемые в регистр защиты - 21-28 */
|
||||||
int mask = 0xff << (idx * 8);
|
int mask = 0xff << (idx * 8);
|
||||||
val = ((val >> 20) & 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)
|
void mmu_setcache (int idx, t_value val)
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "besm6_defs.h"
|
#include "besm6_defs.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
const char *opname_short_bemsh [64] = {
|
const char *opname_short_bemsh [64] = {
|
||||||
"зп", "зпм", "рег", "счм", "сл", "вч", "вчоб","вчаб",
|
"зп", "зпм", "рег", "счм", "сл", "вч", "вчоб","вчаб",
|
||||||
@@ -188,7 +187,7 @@ t_value ieee_to_besm6 (double d)
|
|||||||
d = frexp (d, &exponent);
|
d = frexp (d, &exponent);
|
||||||
/* 0.5 <= d < 1.0 */
|
/* 0.5 <= d < 1.0 */
|
||||||
d = ldexp (d, 40);
|
d = ldexp (d, 40);
|
||||||
word = d;
|
word = (t_value)d;
|
||||||
if (d - word >= 0.5)
|
if (d - word >= 0.5)
|
||||||
word += 1; /* Округление. */
|
word += 1; /* Округление. */
|
||||||
if (exponent < -64)
|
if (exponent < -64)
|
||||||
@@ -207,6 +206,7 @@ t_value ieee_to_besm6 (double d)
|
|||||||
double besm6_to_ieee (t_value word)
|
double besm6_to_ieee (t_value word)
|
||||||
{
|
{
|
||||||
double mantissa;
|
double mantissa;
|
||||||
|
int exponent;
|
||||||
|
|
||||||
/* Убираем свертку */
|
/* Убираем свертку */
|
||||||
word &= BITS48;
|
word &= BITS48;
|
||||||
@@ -214,9 +214,9 @@ double besm6_to_ieee (t_value word)
|
|||||||
/* Сдвигаем так, чтобы знак мантиссы пришелся на знак целого;
|
/* Сдвигаем так, чтобы знак мантиссы пришелся на знак целого;
|
||||||
* таким образом, mantissa равно исходной мантиссе, умноженной на 2**63.
|
* таким образом, 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, и мантиссу нужно скорректировать */
|
/* Порядок смещен вверх на 64, и мантиссу нужно скорректировать */
|
||||||
return ldexp (mantissa, exponent - 64 - 63);
|
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 & SWMASK ('M')) { /* symbolic decode? */
|
||||||
if (sw & SIM_SW_STOP && addr == PC && !(RUU & RUU_RIGHT_INSTR))
|
if (sw & SIM_SW_STOP && addr == PC && !(RUU & RUU_RIGHT_INSTR))
|
||||||
fprintf (of, "-> ");
|
fprintf (of, "-> ");
|
||||||
besm6_fprint_cmd (of, cmd >> 24);
|
besm6_fprint_cmd (of, (uint32)(cmd >> 24));
|
||||||
if (sw & SIM_SW_STOP) /* stop point */
|
if (sw & SIM_SW_STOP) /* stop point */
|
||||||
fprintf (of, ", ");
|
fprintf (of, ", ");
|
||||||
else
|
else
|
||||||
@@ -638,7 +638,7 @@ t_stat besm6_load (FILE *input)
|
|||||||
case 0: /* EOF */
|
case 0: /* EOF */
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
case ':': /* address */
|
case ':': /* address */
|
||||||
addr = word;
|
addr = (int)word;
|
||||||
break;
|
break;
|
||||||
case '=': /* word */
|
case '=': /* word */
|
||||||
if (addr < 010)
|
if (addr < 010)
|
||||||
@@ -655,7 +655,7 @@ t_stat besm6_load (FILE *input)
|
|||||||
++addr;
|
++addr;
|
||||||
break;
|
break;
|
||||||
case '@': /* start address */
|
case '@': /* start address */
|
||||||
PC = word;
|
PC = (uint32)word;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (addr > MEMSIZE)
|
if (addr > MEMSIZE)
|
||||||
@@ -686,7 +686,7 @@ t_stat besm6_dump (FILE *of, char *fnam)
|
|||||||
last_addr = addr;
|
last_addr = addr;
|
||||||
if (IS_INSN (word)) {
|
if (IS_INSN (word)) {
|
||||||
fprintf (of, "к ");
|
fprintf (of, "к ");
|
||||||
besm6_fprint_cmd (of, word >> 24);
|
besm6_fprint_cmd (of, (uint32)(word >> 24));
|
||||||
fprintf (of, ", ");
|
fprintf (of, ", ");
|
||||||
besm6_fprint_cmd (of, word & BITS(24));
|
besm6_fprint_cmd (of, word & BITS(24));
|
||||||
fprintf (of, "\t\t; %05o - ", addr);
|
fprintf (of, "\t\t; %05o - ", addr);
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ t_stat tty_reset (DEVICE *dptr)
|
|||||||
/* 19 р ГРП, 300 Гц */
|
/* 19 р ГРП, 300 Гц */
|
||||||
t_stat vt_clk (UNIT * this)
|
t_stat vt_clk (UNIT * this)
|
||||||
{
|
{
|
||||||
|
int num;
|
||||||
|
|
||||||
/* Телетайпы работают на 10 бод */
|
/* Телетайпы работают на 10 бод */
|
||||||
static int clk_divider = 1<<29;
|
static int clk_divider = 1<<29;
|
||||||
GRP |= MGRP & BBIT(19);
|
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) {
|
if (num > 0 && num <= LINES_MAX) {
|
||||||
char buf [80];
|
char buf [80];
|
||||||
TMLN *t = &tty_line [num];
|
TMLN *t = &tty_line [num];
|
||||||
|
|||||||
Reference in New Issue
Block a user