Some code smell fixes from sonarlint

This commit is contained in:
Jasmine Iwanek
2023-05-11 03:02:36 -04:00
parent d314255362
commit 6c1e4a8e2c
137 changed files with 3354 additions and 2900 deletions

View File

@@ -159,8 +159,8 @@ typedef struct {
uint32_t amstrad_latch;
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static int key_queue_start = 0;
static int key_queue_end = 0;
static uint8_t crtc_mask[32] = {
0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f,
0xf3, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff,
@@ -202,7 +202,9 @@ amstrad_log(const char *fmt, ...)
static void
recalc_timings_1512(amsvid_t *vid)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
disptime = /*128*/ 114; /*Fixed on PC1512*/
_dispontime = 80;
@@ -287,7 +289,7 @@ vid_in_1512(uint16_t addr, void *priv)
break;
}
return (ret);
return ret;
}
static void
@@ -331,9 +333,16 @@ vid_poll_1512(void *priv)
amsvid_t *vid = (amsvid_t *) priv;
uint16_t ca = (vid->crtc[15] | (vid->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
uint8_t chr, attr;
uint16_t dat, dat2, dat3, dat4;
int x;
int c;
int xs_temp;
int ys_temp;
uint8_t chr;
uint8_t attr;
uint16_t dat;
uint16_t dat2;
uint16_t dat3;
uint16_t dat4;
int cols[4];
int col;
int oldsc;
@@ -351,25 +360,25 @@ vid_poll_1512(void *priv)
vid->lastline = vid->displine;
for (c = 0; c < 8; c++) {
if ((vid->cgamode & 0x12) == 0x12) {
buffer32->line[(vid->displine << 1)][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->border & 15) + 16;
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->border & 15) + 16;
if (vid->cgamode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = 0;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = 0;
} else {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = 0;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = 0;
}
} else {
buffer32->line[(vid->displine << 1)][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->cgacol & 15) + 16;
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->cgacol & 15) + 16;
if (vid->cgamode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->cgacol & 15) + 16;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->cgacol & 15) + 16;
} else {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->cgacol & 15) + 16;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->cgacol & 15) + 16;
}
}
}
if (vid->cgamode & 1) {
for (x = 0; x < 80; x++) {
chr = vid->vram[((vid->ma << 1) & 0x3fff)];
attr = vid->vram[(((vid->ma << 1) + 1) & 0x3fff)];
chr = vid->vram[(vid->ma << 1) & 0x3fff];
attr = vid->vram[((vid->ma << 1) + 1) & 0x3fff];
drawcursor = ((vid->ma == ca) && vid->con && vid->cursoron);
if (vid->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
@@ -382,19 +391,19 @@ vid_poll_1512(void *priv)
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[vid->displine << 1][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
vid->ma++;
}
} else if (!(vid->cgamode & 2)) {
for (x = 0; x < 40; x++) {
chr = vid->vram[((vid->ma << 1) & 0x3fff)];
attr = vid->vram[(((vid->ma << 1) + 1) & 0x3fff)];
chr = vid->vram[(vid->ma << 1) & 0x3fff];
attr = vid->vram[((vid->ma << 1) + 1) & 0x3fff];
drawcursor = ((vid->ma == ca) && vid->con && vid->cursoron);
if (vid->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
@@ -408,11 +417,11 @@ vid_poll_1512(void *priv)
vid->ma++;
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[vid->fontbase + chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
}
@@ -436,7 +445,7 @@ vid_poll_1512(void *priv)
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000) + 1];
vid->ma++;
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
@@ -450,7 +459,7 @@ vid_poll_1512(void *priv)
vid->ma++;
for (c = 0; c < 16; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = (((dat >> 15) | ((dat2 >> 15) << 1) | ((dat3 >> 15) << 2) | ((dat4 >> 15) << 3)) & (vid->cgacol & 15)) + 16;
buffer32->line[vid->displine << 1][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = (((dat >> 15) | ((dat2 >> 15) << 1) | ((dat3 >> 15) << 2) | ((dat4 >> 15) << 3)) & (vid->cgacol & 15)) + 16;
dat <<= 1;
dat2 <<= 1;
dat3 <<= 1;
@@ -897,7 +906,8 @@ const device_t vid_1640_device = {
extern int nmi_mask;
static uint32_t blue, green;
static uint32_t blue;
static uint32_t green;
static uint32_t lcdcols[256][2][2];
@@ -981,9 +991,8 @@ static void
set_lcd_cols(uint8_t mode_reg)
{
unsigned char *mapping = (mode_reg & 0x80) ? mapping2 : mapping1;
int c;
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
switch (mapping[c]) {
case 0:
lcdcols[c][0][0] = lcdcols[c][1][0] = green;
@@ -1027,7 +1036,7 @@ vid_in_200(uint16_t addr, void *priv)
ret = vid->crtc_index; /* Read NMI reason */
vid->crtc_index &= 0x1f; /* Reset NMI reason */
nmi = 0; /* And reset NMI flag */
return (ret);
return ret;
case 0x03de:
return ((vid->operation_ctrl & 0xc7) | vid->dipswitches); /*External CGA*/
@@ -1216,7 +1225,6 @@ lcd_draw_char_40(amsvid_t *vid, uint32_t *buffer, uint8_t chr,
uint8_t attr, int drawcursor, int blink, int sc,
uint8_t control)
{
int c;
uint8_t bits = fontdat[chr + vid->cga.fontbase][sc];
uint8_t mask = 0x80;
@@ -1225,7 +1233,7 @@ lcd_draw_char_40(amsvid_t *vid, uint32_t *buffer, uint8_t chr,
if (drawcursor)
bits ^= 0xFF;
for (c = 0; c < 8; c++, mask >>= 1) {
for (uint8_t c = 0; c < 8; c++, mask >>= 1) {
if (control & 0x20) {
buffer[c * 2] = buffer[c * 2 + 1] = lcdcols[attr & 0x7F][blink][(bits & mask) ? 1 : 0];
} else {
@@ -1242,7 +1250,8 @@ lcdm_poll(amsvid_t *vid)
int drawcursor;
int x;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
int oldsc;
int blink;
@@ -1351,7 +1360,7 @@ lcdm_poll(amsvid_t *vid)
mda->sc &= 31;
mda->ma = mda->maback;
}
if ((mda->sc == (mda->crtc[10] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[10] & 31) >> 1))))
if (mda->sc == (mda->crtc[10] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[10] & 31) >> 1)))
mda->con = 1;
}
}
@@ -1361,9 +1370,12 @@ lcdc_poll(amsvid_t *vid)
{
cga_t *cga = &vid->cga;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint16_t dat;
int oldsc;
uint16_t ca;
@@ -1391,17 +1403,17 @@ lcdc_poll(amsvid_t *vid)
attr = cga->charbuffer[(x << 1) + 1];
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
lcd_draw_char_80(vid, &(buffer32->line[(cga->displine << 1)])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode);
lcd_draw_char_80(vid, &(buffer32->line[cga->displine << 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode);
lcd_draw_char_80(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode);
cga->ma++;
}
} else if (!(cga->cgamode & 2)) {
for (x = 0; x < cga->crtc[1]; x++) {
chr = cga->vram[((cga->ma << 1) & 0x3fff)];
attr = cga->vram[(((cga->ma << 1) + 1) & 0x3fff)];
chr = cga->vram[(cga->ma << 1) & 0x3fff];
attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
lcd_draw_char_40(vid, &(buffer32->line[(cga->displine << 1)])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode);
lcd_draw_char_40(vid, &(buffer32->line[cga->displine << 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode);
lcd_draw_char_40(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode);
cga->ma++;
}
@@ -1409,7 +1421,7 @@ lcdc_poll(amsvid_t *vid)
for (x = 0; x < cga->crtc[1]; x++) {
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) | cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
cga->ma++;
for (c = 0; c < 16; c++) {
for (uint8_t c = 0; c < 16; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + c] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c] = (dat & 0x8000) ? blue : green;
dat <<= 1;
}
@@ -1546,11 +1558,11 @@ lcdc_poll(amsvid_t *vid)
}
if (cga->cgadispon)
cga->cgastat &= ~1;
if ((cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1))))
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1)))
cga->con = 1;
if (cga->cgadispon && (cga->cgamode & 1)) {
for (x = 0; x < (cga->crtc[1] << 1); x++)
cga->charbuffer[x] = cga->vram[(((cga->ma << 1) + x) & 0x3fff)];
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];
}
}
}
@@ -1981,7 +1993,7 @@ ms_read(uint16_t addr, void *priv)
ams->mousey = 0;
}
return (ret);
return ret;
}
static int
@@ -2004,7 +2016,7 @@ ms_poll(int x, int y, int z, int b, void *priv)
ams->oldb = b;
return (0);
return 0;
}
static void
@@ -2172,7 +2184,7 @@ kbd_read(uint16_t port, void *priv)
amstrad_log("AMDkb: bad keyboard read %04X\n", port);
}
return (ret);
return ret;
}
static void
@@ -2290,7 +2302,7 @@ ams_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
static const scancode scancode_pc200[512] = {

View File

@@ -58,7 +58,8 @@ enum {
#define VID_CLOCK (double) (651 * 416 * 60)
/* Mapping of attributes to colours */
static uint32_t amber, black;
static uint32_t amber;
static uint32_t black;
static uint32_t blinkcols[256][2];
static uint32_t normcols[256][2];
@@ -108,7 +109,9 @@ static void compaq_plasma_recalcattrs(compaq_plasma_t *self);
static void
compaq_plasma_recalctimings(compaq_plasma_t *self)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
if (!self->internal_monitor && !(self->port_23c6 & 1)) {
cga_recalctimings(&self->cga);
@@ -118,8 +121,8 @@ compaq_plasma_recalctimings(compaq_plasma_t *self)
disptime = 651;
_dispontime = 640;
_dispofftime = disptime - _dispontime;
self->dispontime = (uint64_t) (_dispontime * (cpuclock / VID_CLOCK) * (double) (1ull << 32));
self->dispofftime = (uint64_t) (_dispofftime * (cpuclock / VID_CLOCK) * (double) (1ull << 32));
self->dispontime = (uint64_t) (_dispontime * (cpuclock / VID_CLOCK) * (double) (1ULL << 32));
self->dispofftime = (uint64_t) (_dispofftime * (cpuclock / VID_CLOCK) * (double) (1ULL << 32));
}
static void
@@ -146,8 +149,9 @@ static void
compaq_plasma_text80(compaq_plasma_t *self)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int blink;
@@ -165,7 +169,7 @@ compaq_plasma_text80(compaq_plasma_t *self)
else
cursorline = ((self->cga.crtc[10] & 0x0F) * 2 <= sc) && ((self->cga.crtc[11] & 0x0F) * 2 >= sc);
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
chr = self->vram[(addr + 2 * x) & 0x7FFF];
attr = self->vram[(addr + 2 * x + 1) & 0x7FFF];
drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 8) && (self->cga.cgablink & 16));
@@ -197,8 +201,9 @@ static void
compaq_plasma_text40(compaq_plasma_t *self)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int blink;
@@ -216,7 +221,7 @@ compaq_plasma_text40(compaq_plasma_t *self)
else
cursorline = ((self->cga.crtc[10] & 0x0F) * 2 <= sc) && ((self->cga.crtc[11] & 0x0F) * 2 >= sc);
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
chr = self->vram[(addr + 2 * x) & 0x7FFF];
attr = self->vram[(addr + 2 * x + 1) & 0x7FFF];
drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 8) && (self->cga.cgablink & 16));
@@ -249,7 +254,6 @@ compaq_plasma_text40(compaq_plasma_t *self)
static void
compaq_plasma_cgaline6(compaq_plasma_t *self)
{
int x, c;
uint8_t dat;
uint32_t ink = 0;
uint16_t addr;
@@ -263,11 +267,11 @@ compaq_plasma_cgaline6(compaq_plasma_t *self)
} else {
addr = ((self->displine >> 1) & 1) * 0x2000 + (self->displine >> 2) * 80 + ((ma & ~1) << 1);
}
for (x = 0; x < 80; x++) {
dat = self->vram[(addr & 0x7FFF)];
for (uint8_t x = 0; x < 80; x++) {
dat = self->vram[addr & 0x7FFF];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
ink = (dat & 0x80) ? fg : bg;
if (!(self->cga.cgamode & 8))
ink = black;
@@ -282,9 +286,10 @@ compaq_plasma_cgaline6(compaq_plasma_t *self)
static void
compaq_plasma_cgaline4(compaq_plasma_t *self)
{
int x, c;
uint8_t dat, pattern;
uint32_t ink0 = 0, ink1 = 0;
uint8_t dat;
uint8_t pattern;
uint32_t ink0 = 0;
uint32_t ink1 = 0;
uint16_t addr;
uint16_t ma = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x7fff;
@@ -292,11 +297,11 @@ compaq_plasma_cgaline4(compaq_plasma_t *self)
/* 320*200 */
addr = ((self->displine >> 1) & 1) * 0x2000 + (self->displine >> 2) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
dat = self->vram[(addr & 0x7FFF)];
for (uint8_t x = 0; x < 80; x++) {
dat = self->vram[addr & 0x7FFF];
addr++;
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
pattern = (dat & 0xC0) >> 6;
if (!(self->cga.cgamode & 8))
pattern = 0;

View File

@@ -382,7 +382,6 @@ void dump_mappings(void)
void
t3100e_map_ram(uint8_t val)
{
int n;
int32_t upper_len;
#ifdef ENABLE_T3100E_LOG
@@ -433,7 +432,7 @@ t3100e_map_ram(uint8_t val)
mem_mapping_disable(&t3100e_ems.upper_mapping);
}
/* Recalculate EMS mappings */
for (n = 0; n < 4; n++) {
for (uint8_t n = 0; n < 4; n++) {
t3100e_ems_out(t3100e_ems_page_reg[n], t3100e_ems.page[n],
&t3100e_ems);
}

View File

@@ -74,7 +74,8 @@
#define VID_CLOCK (double) (651 * 416 * 60)
/* Mapping of attributes to colours */
static uint32_t amber, black;
static uint32_t amber;
static uint32_t black;
static uint8_t boldcols[256]; /* Which attributes use the bold font */
static uint32_t blinkcols[256][2];
static uint32_t normcols[256][2];
@@ -222,7 +223,8 @@ void
t3100e_recalctimings(t3100e_t *t3100e)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
if (!t3100e->internal) {
cga_recalctimings(&t3100e->cga);
@@ -231,8 +233,8 @@ t3100e_recalctimings(t3100e_t *t3100e)
disptime = 651;
_dispontime = 640;
_dispofftime = disptime - _dispontime;
t3100e->dispontime = (uint64_t) (_dispontime * (cpuclock / VID_CLOCK) * (double) (1ull << 32));
t3100e->dispofftime = (uint64_t) (_dispofftime * (cpuclock / VID_CLOCK) * (double) (1ull << 32));
t3100e->dispontime = (uint64_t) (_dispontime * (cpuclock / VID_CLOCK) * (double) (1ULL << 32));
t3100e->dispofftime = (uint64_t) (_dispofftime * (cpuclock / VID_CLOCK) * (double) (1ULL << 32));
}
/* Draw a row of text in 80-column mode */
@@ -240,8 +242,9 @@ void
t3100e_text_row80(t3100e_t *t3100e)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int bold;
@@ -260,7 +263,7 @@ t3100e_text_row80(t3100e_t *t3100e)
} else {
cursorline = ((t3100e->cga.crtc[10] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[11] & 0x0F) * 2 >= sc);
}
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
chr = t3100e->vram[(addr + 2 * x) & 0x7FFF];
attr = t3100e->vram[(addr + 2 * x + 1) & 0x7FFF];
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & 8) && (t3100e->cga.cgablink & 16));
@@ -300,8 +303,9 @@ void
t3100e_text_row40(t3100e_t *t3100e)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int bold;
@@ -320,7 +324,7 @@ t3100e_text_row40(t3100e_t *t3100e)
} else {
cursorline = ((t3100e->cga.crtc[10] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[11] & 0x0F) * 2 >= sc);
}
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
chr = t3100e->vram[(addr + 2 * x) & 0x7FFF];
attr = t3100e->vram[(addr + 2 * x + 1) & 0x7FFF];
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & 8) && (t3100e->cga.cgablink & 16));
@@ -360,7 +364,6 @@ t3100e_text_row40(t3100e_t *t3100e)
void
t3100e_cgaline6(t3100e_t *t3100e)
{
int x, c;
uint8_t dat;
uint32_t ink = 0;
uint16_t addr;
@@ -375,11 +378,11 @@ t3100e_cgaline6(t3100e_t *t3100e)
} else {
addr = ((t3100e->displine >> 1) & 1) * 0x2000 + (t3100e->displine >> 2) * 80 + ((ma & ~1) << 1);
}
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = t3100e->vram[addr & 0x7FFF];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
ink = (dat & 0x80) ? fg : bg;
if (!(t3100e->cga.cgamode & 8))
ink = black;
@@ -394,9 +397,10 @@ t3100e_cgaline6(t3100e_t *t3100e)
void
t3100e_cgaline4(t3100e_t *t3100e)
{
int x, c;
uint8_t dat, pattern;
uint32_t ink0 = 0, ink1 = 0;
uint8_t dat;
uint8_t pattern;
uint32_t ink0 = 0;
uint32_t ink1 = 0;
uint16_t addr;
uint16_t ma = (t3100e->cga.crtc[13] | (t3100e->cga.crtc[12] << 8)) & 0x7fff;
@@ -407,11 +411,11 @@ t3100e_cgaline4(t3100e_t *t3100e)
{
addr = ((t3100e->displine >> 1) & 1) * 0x2000 + (t3100e->displine >> 2) * 80 + ((ma & ~1) << 1);
}
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = t3100e->vram[addr & 0x7FFF];
addr++;
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
pattern = (dat & 0xC0) >> 6;
if (!(t3100e->cga.cgamode & 8))
pattern = 0;

View File

@@ -143,9 +143,8 @@ elt_vid_in(uint16_t addr, void *p)
static void
load_font_rom(uint32_t font_data)
{
int c, d;
for (c = 0; c < 256; c++)
for (d = 0; d < 8; d++)
for (uint16_t c = 0; c < 256; c++)
for (uint8_t d = 0; d < 8; d++)
fontdat[c][d] = mem_readb_phys(font_data++);
}

View File

@@ -173,7 +173,8 @@ static void
europc_rtc_tick(nvr_t *nvr)
{
uint8_t *regs;
int mon, yr;
int mon;
int yr;
/* Only if RTC is running.. */
regs = nvr->regs;
@@ -266,14 +267,13 @@ static uint8_t
rtc_checksum(uint8_t *ptr)
{
uint8_t sum;
int i;
/* Calculate all bytes with XOR. */
sum = 0x00;
for (i = MRTC_CONF_A; i <= MRTC_CONF_E; i++)
for (uint8_t i = MRTC_CONF_A; i <= MRTC_CONF_E; i++)
sum += ptr[i];
return (sum);
return sum;
}
/* Reset the machine's NVR to a sane state. */
@@ -523,7 +523,7 @@ jim_read(uint16_t addr, void *priv)
europc_log("EuroPC: jim_rd(%04x): %02x\n", addr, r);
#endif
return (r);
return r;
}
/* Initialize the mainboard 'device' of the machine. */
@@ -638,7 +638,7 @@ europc_boot(const device_t *info)
if (hdc_current == 1)
(void) device_add(&xta_hd20_device);
return (sys);
return sys;
}
static void

View File

@@ -107,8 +107,8 @@ static uint8_t crtcmask[32] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static int key_queue_start = 0;
static int key_queue_end = 0;
static void
recalc_address(pcjr_t *pcjr)
@@ -125,7 +125,9 @@ recalc_address(pcjr_t *pcjr)
static void
recalc_timings(pcjr_t *pcjr)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
if (pcjr->array[0] & 1) {
disptime = pcjr->crtc[0] + 1;
@@ -207,7 +209,7 @@ vid_in(uint16_t addr, void *p)
break;
}
return (ret);
return ret;
}
static void
@@ -227,7 +229,7 @@ vid_read(uint32_t addr, void *p)
pcjr_t *pcjr = (pcjr_t *) p;
if (pcjr->memctrl == -1)
return (0xff);
return 0xff;
return (pcjr->b8000[addr & 0x3fff]);
}
@@ -238,9 +240,13 @@ vid_poll(void *p)
pcjr_t *pcjr = (pcjr_t *) p;
uint16_t ca = (pcjr->crtc[15] | (pcjr->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint16_t dat;
int cols[4];
int oldsc;
@@ -265,9 +271,9 @@ vid_poll(void *p)
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[pcjr->displine])[c] = cols[0];
if (pcjr->array[0] & 1) {
buffer32->line[(pcjr->displine << 1)][c + (pcjr->crtc[1] << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 3) + 8] = cols[0];
buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 3) + 8] = cols[0];
} else {
buffer32->line[(pcjr->displine << 1)][c + (pcjr->crtc[1] << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 4) + 8] = cols[0];
buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 4) + 8] = cols[0];
}
}
@@ -288,20 +294,20 @@ vid_poll(void *p)
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
buffer32->line[(pcjr->displine << 1)][(x << 3) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 3) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 3) + 10] = buffer32->line[(pcjr->displine << 1)][(x << 3) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 3) + 12] = buffer32->line[(pcjr->displine << 1)][(x << 3) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 3) + 14] = buffer32->line[(pcjr->displine << 1)][(x << 3) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 3) + 8] = buffer32->line[pcjr->displine << 1][(x << 3) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 3) + 10] = buffer32->line[pcjr->displine << 1][(x << 3) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 3) + 12] = buffer32->line[pcjr->displine << 1][(x << 3) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 3) + 14] = buffer32->line[pcjr->displine << 1][(x << 3) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
}
break;
case 0x12: /*160x200x16*/
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
buffer32->line[(pcjr->displine << 1)][(x << 4) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 9] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 10] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 4) + 12] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 13] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 14] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 4) + 16] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 17] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 18] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 19] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 16] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 17] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 18] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer32->line[(pcjr->displine << 1)][(x << 4) + 20] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 21] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 22] = buffer32->line[(pcjr->displine << 1)][(x << 4) + 23] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 20] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 21] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 22] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 4) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + 9] = buffer32->line[pcjr->displine << 1][(x << 4) + 10] = buffer32->line[pcjr->displine << 1][(x << 4) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 4) + 12] = buffer32->line[pcjr->displine << 1][(x << 4) + 13] = buffer32->line[pcjr->displine << 1][(x << 4) + 14] = buffer32->line[pcjr->displine << 1][(x << 4) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 4) + 16] = buffer32->line[pcjr->displine << 1][(x << 4) + 17] = buffer32->line[pcjr->displine << 1][(x << 4) + 18] = buffer32->line[pcjr->displine << 1][(x << 4) + 19] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 16] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 17] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 18] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 4) + 20] = buffer32->line[pcjr->displine << 1][(x << 4) + 21] = buffer32->line[pcjr->displine << 1][(x << 4) + 22] = buffer32->line[pcjr->displine << 1][(x << 4) + 23] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 20] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 21] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 22] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
}
break;
case 0x03: /*640x200x4*/
@@ -311,7 +317,7 @@ vid_poll(void *p)
for (c = 0; c < 8; c++) {
chr = (dat >> 7) & 1;
chr |= ((dat >> 14) & 2);
buffer32->line[(pcjr->displine << 1)][(x << 3) + 8 + c] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16;
buffer32->line[pcjr->displine << 1][(x << 3) + 8 + c] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16;
dat <<= 1;
}
}
@@ -332,16 +338,16 @@ vid_poll(void *p)
}
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[0];
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[0];
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 3) + c + 8] ^= 15;
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] ^= 15;
buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] ^= 15;
}
}
@@ -365,11 +371,11 @@ vid_poll(void *p)
pcjr->ma++;
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0];
buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0];
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
if (drawcursor) {
@@ -633,14 +639,16 @@ kbd_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
static void
kbd_poll(void *priv)
{
pcjr_t *pcjr = (pcjr_t *) priv;
int c, p = 0, key;
int c;
int p = 0;
int key;
timer_advance_u64(&pcjr->send_delay_timer, 220 * TIMER_USEC);

View File

@@ -233,7 +233,7 @@ ps1_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
static void

View File

@@ -502,15 +502,14 @@ static int
ibm_drive_type(drive_t *drive)
{
const geom_t *ptr;
int i;
for (i = 0; i < (sizeof(ibm_type_table) / sizeof(geom_t)); i++) {
for (uint16_t i = 0; i < (sizeof(ibm_type_table) / sizeof(geom_t)); i++) {
ptr = &ibm_type_table[i];
if ((drive->tracks == ptr->cyl) && (drive->hpc == ptr->hpc) && (drive->spt == ptr->spt))
return (i);
return i;
}
return (HDC_TYPE_USER);
return HDC_TYPE_USER;
}
static void
@@ -534,25 +533,25 @@ get_sector(hdc_t *dev, drive_t *drive, off64_t *addr)
ps1_hdc_log("HDC: get_sector: wrong cylinder %d/%d\n",
drive->cur_cyl, dev->track);
dev->ssb.wrong_cyl = 1;
return (1);
return 1;
}
if (dev->head >= drive->hpc) {
ps1_hdc_log("HDC: get_sector: past end of heads\n");
dev->ssb.cylinder_err = 1;
return (1);
return 1;
}
if (dev->sector > drive->spt) {
ps1_hdc_log("HDC: get_sector: past end of sectors\n");
dev->ssb.mark_not_found = 1;
return (1);
return 1;
}
/* Calculate logical address (block number) of desired sector. */
*addr = ((((off64_t) dev->track * drive->hpc) + dev->head) * drive->spt) + dev->sector - 1;
return (0);
return 0;
}
static void
@@ -590,13 +589,13 @@ do_seek(hdc_t *dev, drive_t *drive, uint16_t cyl)
{
if (cyl >= drive->tracks) {
dev->ssb.cylinder_err = 1;
return (1);
return 1;
}
dev->track = cyl;
drive->cur_cyl = dev->track;
return (0);
return 0;
}
/* Format a track or an entire drive. */
@@ -1128,7 +1127,7 @@ hdc_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
static void
@@ -1240,7 +1239,7 @@ ps1_hdc_init(const device_t *info)
{
drive_t *drive;
hdc_t *dev;
int c, i;
int c;
/* Allocate and initialize device block. */
dev = malloc(sizeof(hdc_t));
@@ -1256,7 +1255,7 @@ ps1_hdc_init(const device_t *info)
/* Load any disks for this device class. */
c = 0;
for (i = 0; i < HDD_NUM; i++) {
for (uint8_t i = 0; i < HDD_NUM; i++) {
if ((hdd[i].bus == HDD_BUS_XTA) && (hdd[i].xta_channel < 1)) {
drive = &dev->drives[hdd[i].xta_channel];
@@ -1299,7 +1298,7 @@ ps1_hdc_init(const device_t *info)
/* Create a timer for command delays. */
timer_add(&dev->timer, hdc_callback, dev, 0);
return (dev);
return dev;
}
static void
@@ -1307,14 +1306,13 @@ ps1_hdc_close(void *priv)
{
hdc_t *dev = (hdc_t *) priv;
drive_t *drive;
int d;
/* Remove the I/O handler. */
io_removehandler(dev->base, 5,
hdc_read, NULL, NULL, hdc_write, NULL, NULL, dev);
/* Close all disks and their images. */
for (d = 0; d < XTA_NUM; d++) {
for (uint8_t d = 0; d < XTA_NUM; d++) {
drive = &dev->drives[d];
if (drive->present)

View File

@@ -398,12 +398,14 @@ model_50_write(uint16_t port, uint8_t val)
static void
model_55sx_mem_recalc(void)
{
int i, j, state;
int state;
#ifdef ENABLE_PS2_MCA_LOG
int enabled_mem = 0;
#endif
int base = 0, remap_size = (ps2.option[3] & 0x10) ? 384 : 256;
int bit_mask = 0x00, max_rows = 4;
int base = 0;
int remap_size = (ps2.option[3] & 0x10) ? 384 : 256;
int bit_mask = 0x00;
int max_rows = 4;
int bank_to_rows[16] = { 4, 2, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 2, 1, 0 };
ps2_mca_log("%02X %02X\n", ps2.option[1], ps2.option[3]);
@@ -412,13 +414,13 @@ model_55sx_mem_recalc(void)
mem_set_mem_state(0x00000000, (mem_size + 384) * 1024, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL);
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_DISABLED);
for (i = 0; i < 2; i++) {
for (uint8_t i = 0; i < 2; i++) {
max_rows = bank_to_rows[(ps2.memory_bank[i] >> 4) & 0x0f];
if (max_rows == 0)
continue;
for (j = 0; j < max_rows; j++) {
for (int j = 0; j < max_rows; j++) {
if (ps2.memory_bank[i] & (1 << j)) {
ps2_mca_log("Set memory at %06X-%06X to internal\n", (base * 1024), (base * 1024) + (((base > 0) ? 1024 : 640) * 1024) - 1);
mem_set_mem_state(base * 1024, ((base > 0) ? 1024 : 640) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
@@ -850,7 +852,8 @@ ps2_mem_expansion_feedb(void *p)
static void
ps2_mca_mem_fffc_init(int start_mb)
{
uint32_t planar_size, expansion_start;
uint32_t planar_size;
uint32_t expansion_start;
planar_size = (start_mb - 1) << 20;
expansion_start = start_mb << 20;
@@ -906,7 +909,8 @@ ps2_mca_mem_fffc_init(int start_mb)
static void
ps2_mca_mem_d071_init(int start_mb)
{
uint32_t planar_size, expansion_start;
uint32_t planar_size;
uint32_t expansion_start;
planar_size = (start_mb - 1) << 20;
expansion_start = start_mb << 20;
@@ -1212,7 +1216,7 @@ ps2_mca_board_model_70_type34_init(int is_type4, int slots)
mem_mapping_add(&ps2.cache_mapping,
0,
(is_type4) ? (8 * 1024) : (64 * 1024),
is_type4 ? (8 * 1024) : (64 * 1024),
ps2_read_cache_ram,
ps2_read_cache_ramw,
ps2_read_cache_raml,

View File

@@ -448,7 +448,9 @@ recalc_timings(tandy_t *dev)
{
t1kvid_t *vid = dev->vid;
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
if (vid->mode & 1) {
disptime = vid->crtc[0] + 1;
@@ -598,7 +600,7 @@ vid_in(uint16_t addr, void *priv)
break;
}
return (ret);
return ret;
}
static void
@@ -629,7 +631,7 @@ vid_read(uint32_t addr, void *priv)
t1kvid_t *vid = dev->vid;
if (vid->memctrl == -1)
return (0xff);
return 0xff;
if (dev->is_sl2) {
if (vid->array[5] & 1)
@@ -637,7 +639,7 @@ vid_read(uint32_t addr, void *priv)
if ((addr & 0x7fff) < vid->b8000_limit)
return (vid->b8000[addr & 0x7fff]);
else
return (0xff);
return 0xff;
} else {
return (vid->b8000[addr & vid->b8000_mask]);
}
@@ -650,9 +652,13 @@ vid_poll(void *priv)
t1kvid_t *vid = dev->vid;
uint16_t ca = (vid->crtc[15] | (vid->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint16_t dat;
int cols[4];
int col;
@@ -674,25 +680,25 @@ vid_poll(void *priv)
cols[0] = (vid->array[2] & 0xf) + 16;
for (c = 0; c < 8; c++) {
if (vid->array[3] & 4) {
buffer32->line[(vid->displine << 1)][c] = buffer32->line[(vid->displine << 1) + 1][c] = cols[0];
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = cols[0];
if (vid->mode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = cols[0];
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = cols[0];
} else {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = cols[0];
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = cols[0];
}
} else if ((vid->mode & 0x12) == 0x12) {
buffer32->line[(vid->displine << 1)][c] = buffer32->line[(vid->displine << 1) + 1][c] = 0;
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = 0;
if (vid->mode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = 0;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = 0;
} else {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = 0;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = 0;
}
} else {
buffer32->line[(vid->displine << 1)][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->col & 15) + 16;
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->col & 15) + 16;
if (vid->mode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->col & 15) + 16;
} else {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->col & 15) + 16;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->col & 15) + 16;
}
}
}
@@ -700,19 +706,19 @@ vid_poll(void *priv)
for (x = 0; x < vid->crtc[1] * 2; x++) {
dat = (vid->vram[(vid->ma << 1) & 0xffff] << 8) | vid->vram[((vid->ma << 1) + 1) & 0xffff];
vid->ma++;
buffer32->line[(vid->displine << 1)][(x << 2) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 8] = vid->array[((dat >> 12) & 0xf) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 2) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 9] = vid->array[((dat >> 8) & 0xf) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 2) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 10] = vid->array[((dat >> 4) & 0xf) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 2) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 11] = vid->array[(dat & 0xf) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 2) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 8] = vid->array[((dat >> 12) & 0xf) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 2) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 9] = vid->array[((dat >> 8) & 0xf) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 2) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 10] = vid->array[((dat >> 4) & 0xf) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 2) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 2) + 11] = vid->array[(dat & 0xf) + 16] + 16;
}
} else if ((vid->array[3] & 0x10) && (vid->mode & 1)) { /*320x200x16*/
for (x = 0; x < vid->crtc[1]; x++) {
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000) + 1];
vid->ma++;
buffer32->line[(vid->displine << 1)][(x << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8] = buffer32->line[(vid->displine << 1)][(x << 3) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 9] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 3) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 10] = buffer32->line[(vid->displine << 1)][(x << 3) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 11] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 3) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 12] = buffer32->line[(vid->displine << 1)][(x << 3) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 13] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 3) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 14] = buffer32->line[(vid->displine << 1)][(x << 3) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 15] = vid->array[(dat & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8] = buffer32->line[vid->displine << 1][(x << 3) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 9] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 10] = buffer32->line[vid->displine << 1][(x << 3) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 11] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 12] = buffer32->line[vid->displine << 1][(x << 3) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 13] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 14] = buffer32->line[vid->displine << 1][(x << 3) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 15] = vid->array[(dat & vid->array[1]) + 16] + 16;
}
} else if (vid->array[3] & 0x10) { /*160x200x16*/
for (x = 0; x < vid->crtc[1]; x++) {
@@ -722,10 +728,10 @@ vid_poll(void *priv)
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000) + 1];
}
vid->ma++;
buffer32->line[(vid->displine << 1)][(x << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 9] = buffer32->line[(vid->displine << 1)][(x << 4) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 10] = buffer32->line[(vid->displine << 1)][(x << 4) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 11] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 4) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 12] = buffer32->line[(vid->displine << 1)][(x << 4) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 13] = buffer32->line[(vid->displine << 1)][(x << 4) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 14] = buffer32->line[(vid->displine << 1)][(x << 4) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 15] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 4) + 16] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 16] = buffer32->line[(vid->displine << 1)][(x << 4) + 17] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 17] = buffer32->line[(vid->displine << 1)][(x << 4) + 18] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 18] = buffer32->line[(vid->displine << 1)][(x << 4) + 19] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 19] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[(vid->displine << 1)][(x << 4) + 20] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 20] = buffer32->line[(vid->displine << 1)][(x << 4) + 21] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 21] = buffer32->line[(vid->displine << 1)][(x << 4) + 22] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 22] = buffer32->line[(vid->displine << 1)][(x << 4) + 23] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 23] = vid->array[(dat & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 8] = buffer32->line[vid->displine << 1][(x << 4) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 9] = buffer32->line[vid->displine << 1][(x << 4) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 10] = buffer32->line[vid->displine << 1][(x << 4) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 11] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 12] = buffer32->line[vid->displine << 1][(x << 4) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 13] = buffer32->line[vid->displine << 1][(x << 4) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 14] = buffer32->line[vid->displine << 1][(x << 4) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 15] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 16] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 16] = buffer32->line[vid->displine << 1][(x << 4) + 17] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 17] = buffer32->line[vid->displine << 1][(x << 4) + 18] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 18] = buffer32->line[vid->displine << 1][(x << 4) + 19] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 19] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 20] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 20] = buffer32->line[vid->displine << 1][(x << 4) + 21] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 21] = buffer32->line[vid->displine << 1][(x << 4) + 22] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 22] = buffer32->line[vid->displine << 1][(x << 4) + 23] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 23] = vid->array[(dat & vid->array[1]) + 16] + 16;
}
} else if (vid->array[3] & 0x08) { /*640x200x4 - this implementation is a complete guess!*/
for (x = 0; x < vid->crtc[1]; x++) {
@@ -734,7 +740,7 @@ vid_poll(void *priv)
for (c = 0; c < 8; c++) {
chr = (dat >> 6) & 2;
chr |= ((dat >> 15) & 1);
buffer32->line[(vid->displine << 1)][(x << 3) + 8 + c] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8 + c] = vid->array[(chr & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 8 + c] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8 + c] = vid->array[(chr & vid->array[1]) + 16] + 16;
dat <<= 1;
}
}
@@ -754,14 +760,14 @@ vid_poll(void *priv)
}
if (vid->sc & 8) {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[0];
buffer32->line[vid->displine << 1][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[0];
}
} else {
for (c = 0; c < 8; c++) {
if (vid->sc == 8) {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0];
} else {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 3) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
}
@@ -1239,7 +1245,7 @@ eep_init(const device_t *info)
io_sethandler(0x037c, 1, NULL, NULL, NULL, eep_write, NULL, NULL, eep);
return (eep);
return eep;
}
static void
@@ -1336,7 +1342,7 @@ tandy_read(uint16_t addr, void *priv)
break;
}
return (ret);
return ret;
}
static void
@@ -1479,7 +1485,7 @@ machine_tandy1k_init(const machine_t *model, int type)
int
tandy1k_eeprom_read(void)
{
return (eep_data_out);
return eep_data_out;
}
int

View File

@@ -51,7 +51,8 @@
int
machine_v86p_init(const machine_t *model)
{
int ret, rom = 0;
int ret;
int rom = 0;
ret = bios_load_interleavedr("roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Even.rom",
"roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Odd.rom",

View File

@@ -67,7 +67,8 @@ machine_pc_init(const machine_t *model)
int
machine_pc82_init(const machine_t *model)
{
int ret, ret2;
int ret;
int ret2;
ret = bios_load_linear("roms/machines/ibmpc82/pc102782.bin",
0x000fe000, 40960, 0);

View File

@@ -39,8 +39,8 @@ get_laserxt_ems_addr(uint32_t addr)
static void
laserxt_write(uint16_t port, uint8_t val, void *priv)
{
int i;
uint32_t paddr, vaddr;
uint32_t paddr;
uint32_t vaddr;
switch (port) {
case 0x0208:
case 0x4208:
@@ -63,7 +63,7 @@ laserxt_write(uint16_t port, uint8_t val, void *priv)
case 0xC209:
laserxt_emscontrol[port >> 14] = val;
laserxt_ems_baseaddr_index = 0;
for (i = 0; i < 4; i++) {
for (uint8_t i = 0; i < 4; i++) {
laserxt_ems_baseaddr_index |= (laserxt_emscontrol[i] & 0x80) >> (7 - i);
}
@@ -116,8 +116,6 @@ mem_read_laserxtems(uint32_t addr, void *priv)
static void
laserxt_init(int is_lxt3)
{
int i;
if (mem_size > 640) {
io_sethandler(0x0208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
io_sethandler(0x4208, 0x0002, laserxt_read, NULL, NULL, laserxt_write, NULL, NULL, NULL);
@@ -126,7 +124,7 @@ laserxt_init(int is_lxt3)
mem_mapping_set_addr(&ram_low_mapping, 0, !is_lxt3 ? 0x70000 + (((mem_size + 64) & 255) << 10) : 0x30000 + (((mem_size + 320) & 511) << 10));
}
for (i = 0; i < 4; i++) {
for (uint8_t i = 0; i < 4; i++) {
laserxt_emspage[i] = 0x7F;
laserxt_emscontrol[i] = (i == 3) ? 0x00 : 0x80;
mem_mapping_add(&laserxt_ems_mapping[i], 0xE0000 + (i << 14), 0x4000, mem_read_laserxtems, NULL, NULL, mem_write_laserxtems, NULL, NULL, ram + 0xA0000 + (i << 14), 0, NULL);

View File

@@ -141,8 +141,8 @@ typedef struct {
} m19_vid_t;
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static int key_queue_start = 0;
static int key_queue_end = 0;
video_timings_t timing_m19_vid = { VIDEO_ISA, 8, 16, 32, 8, 16, 32 };
@@ -346,7 +346,7 @@ mm58274_time_set(uint8_t *regs, struct tm *tm)
regs[MM58274_HOUR10] = (tm->tm_hour / 10);
} else {
regs[MM58274_HOUR1] = ((tm->tm_hour % 12) % 10);
regs[MM58274_HOUR10] = (((tm->tm_hour % 12) / 10));
regs[MM58274_HOUR10] = ((tm->tm_hour % 12) / 10);
if (tm->tm_hour >= 12)
regs[MM58274_SETTINGS] |= 0x04;
else
@@ -419,7 +419,7 @@ mm58274_write(uint16_t addr, uint8_t val, void *priv)
val &= 0x0f;
/* Update non-read-only changed values if not synchronizing time to host */
if ((addr != MM58274_TENTHS))
if (addr != MM58274_TENTHS)
if ((nvr->regs[addr] != val) && !(time_sync & TIME_SYNC_ENABLED))
nvr_dosave = 1;
@@ -680,7 +680,7 @@ m24_kbd_read(uint16_t port, void *priv)
xt_olivetti_log("\nBad M24 keyboard read %04X\n", port);
}
return (ret);
return ret;
}
static void
@@ -733,7 +733,7 @@ ms_poll(int x, int y, int z, int b, void *priv)
m24_kbd->y += y;
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
if ((b & 1) && !(m24_kbd->b & 1))
m24_kbd_adddata(m24_kbd->scan[0]);
@@ -742,7 +742,7 @@ ms_poll(int x, int y, int z, int b, void *priv)
m24_kbd->b = (m24_kbd->b & ~1) | (b & 1);
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
if ((b & 2) && !(m24_kbd->b & 2))
m24_kbd_adddata(m24_kbd->scan[2]);
@@ -751,7 +751,7 @@ ms_poll(int x, int y, int z, int b, void *priv)
m24_kbd->b = (m24_kbd->b & ~2) | (b & 2);
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
if ((b & 4) && !(m24_kbd->b & 4))
m24_kbd_adddata(m24_kbd->scan[1]);
@@ -761,10 +761,10 @@ ms_poll(int x, int y, int z, int b, void *priv)
if (m24_kbd->mouse_mode) {
if (((key_queue_end - key_queue_start) & 0xf) > 12)
return (0xff);
return 0xff;
if (!m24_kbd->x && !m24_kbd->y)
return (0xff);
return 0xff;
m24_kbd->y = -m24_kbd->y;
@@ -790,31 +790,31 @@ ms_poll(int x, int y, int z, int b, void *priv)
} else {
while (m24_kbd->x < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
m24_kbd->x += 4;
m24_kbd_adddata(m24_kbd->scan[3]);
}
while (m24_kbd->x > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
m24_kbd->x -= 4;
m24_kbd_adddata(m24_kbd->scan[4]);
}
while (m24_kbd->y < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
m24_kbd->y += 4;
m24_kbd_adddata(m24_kbd->scan[5]);
}
while (m24_kbd->y > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return (0xff);
return 0xff;
m24_kbd->y -= 4;
m24_kbd_adddata(m24_kbd->scan[6]);
}
}
return (0);
return 0;
}
/* Remapping as follows:
@@ -1604,8 +1604,8 @@ const device_t m19_vid_device = {
static uint8_t
m24_read(uint16_t port, void *priv)
{
uint8_t ret = 0x00;
int i, fdd_count = 0;
uint8_t ret = 0x00;
int fdd_count = 0;
switch (port) {
case 0x62:
@@ -1674,7 +1674,7 @@ m24_read(uint16_t port, void *priv)
* on on EGA/VGA (works only for BIOS ROM 1.43)
*/
case 0x67:
for (i = 0; i < FDD_NUM; i++) {
for (uint8_t i = 0; i < FDD_NUM; i++) {
if (fdd_get_flags(i))
fdd_count++;
}
@@ -1708,14 +1708,14 @@ m24_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
static uint8_t
m240_read(uint16_t port, void *priv)
{
uint8_t ret = 0x00;
int i, fdd_count = 0;
int fdd_count = 0;
switch (port) {
case 0x62:
@@ -1723,7 +1723,7 @@ m240_read(uint16_t port, void *priv)
ret = 0x00;
if (ppi.pb & 0x8) {
/* Switches 4, 5 - floppy drives (number) */
for (i = 0; i < FDD_NUM; i++) {
for (uint8_t i = 0; i < FDD_NUM; i++) {
if (fdd_get_flags(i))
fdd_count++;
}
@@ -1763,7 +1763,7 @@ m240_read(uint16_t port, void *priv)
break;
}
return (ret);
return ret;
}
/*
@@ -1802,7 +1802,7 @@ machine_xt_m24_init(const machine_t *model)
/* Allocate an NVR for this machine. */
nvr = (nvr_t *) malloc(sizeof(nvr_t));
if (nvr == NULL)
return (0);
return 0;
memset(nvr, 0x00, sizeof(nvr_t));
mm58174_init(nvr, model->nvrmask + 1);
@@ -1876,7 +1876,7 @@ machine_xt_m240_init(const machine_t *model)
/* Allocate an NVR for this machine. */
nvr = (nvr_t *) malloc(sizeof(nvr_t));
if (nvr == NULL)
return (0);
return 0;
memset(nvr, 0x00, sizeof(nvr_t));
mm58274_init(nvr, model->nvrmask + 1);

View File

@@ -339,9 +339,9 @@ static uint32_t
ems_execaddr(t1000_t *sys, int pg, uint16_t val)
{
if (!(val & 0x80))
return (0); /* Bit 7 reset => not mapped */
return 0; /* Bit 7 reset => not mapped */
if (!sys->ems_pages)
return (0); /* No EMS available: all used by
return 0; /* No EMS available: all used by
* HardRAM or conventional RAM */
val &= 0x7f;
@@ -354,7 +354,7 @@ ems_execaddr(t1000_t *sys, int pg, uint16_t val)
return ((512 * 1024) + (sys->ems_base * 0x10000) + (0x4000 * val));
}
return (0);
return 0;
}
static uint8_t
@@ -392,8 +392,6 @@ ems_out(uint16_t addr, uint8_t val, void *priv)
static void
ems_set_hardram(t1000_t *sys, uint8_t val)
{
int n;
val &= 0x1f; /* Mask off pageframe address */
if (val && mem_size > 512)
sys->ems_base = val;
@@ -408,7 +406,7 @@ ems_set_hardram(t1000_t *sys, uint8_t val)
sys->ems_pages = 0;
/* Recalculate EMS mappings */
for (n = 0; n < 4; n++)
for (uint8_t n = 0; n < 4; n++)
ems_out(n << 14, sys->ems_reg[n], sys);
}
@@ -473,7 +471,7 @@ ems_read_ram(uint32_t addr, void *priv)
int pg = addr_to_page(addr);
if (pg < 0)
return (0xff);
return 0xff;
addr = sys->page_exec[pg] + (addr & 0x3fff);
return (ram[addr]);
@@ -486,7 +484,7 @@ ems_read_ramw(uint32_t addr, void *priv)
int pg = addr_to_page(addr);
if (pg < 0)
return (0xff);
return 0xff;
#if 0
t1000_log("ems_read_ramw addr=%05x ", addr);
@@ -507,7 +505,7 @@ ems_read_raml(uint32_t addr, void *priv)
int pg = addr_to_page(addr);
if (pg < 0)
return (0xff);
return 0xff;
addr = sys->page_exec[pg] + (addr & 0x3fff);
return (*(uint32_t *) &ram[addr]);
@@ -604,7 +602,7 @@ read_ctl(uint16_t addr, void *priv)
ret = (sys->sys_ctl[addr & 0x0f]);
}
return (ret);
return ret;
}
static void
@@ -693,7 +691,7 @@ t1000_read_nvram(uint16_t addr, void *priv)
break;
}
return (tmp);
return tmp;
}
static void
@@ -790,7 +788,7 @@ t1000_read_rom(uint32_t addr, void *priv)
t1000_t *sys = (t1000_t *) priv;
if (!sys->romdrive)
return (0xff);
return 0xff;
return (sys->romdrive[sys->rom_offset + (addr & 0xffff)]);
}
@@ -801,7 +799,7 @@ t1000_read_romw(uint32_t addr, void *priv)
t1000_t *sys = (t1000_t *) priv;
if (!sys->romdrive)
return (0xffff);
return 0xffff;
return (*(uint16_t *) (&sys->romdrive[sys->rom_offset + (addr & 0xffff)]));
}
@@ -812,7 +810,7 @@ t1000_read_roml(uint32_t addr, void *priv)
t1000_t *sys = (t1000_t *) priv;
if (!sys->romdrive)
return (0xffffffff);
return 0xffffffff;
return (*(uint32_t *) (&sys->romdrive[sys->rom_offset + (addr & 0xffff)]));
}
@@ -821,8 +819,6 @@ int
machine_xt_t1000_init(const machine_t *model)
{
FILE *f;
int pg;
int ret;
ret = bios_load_linear("roms/machines/t1000/t1000.rom",
@@ -861,7 +857,7 @@ machine_xt_t1000_init(const machine_t *model)
mem_mapping_disable(&t1000.rom_mapping);
/* Map the EMS page frame */
for (pg = 0; pg < 4; pg++) {
for (uint8_t pg = 0; pg < 4; pg++) {
mem_mapping_add(&t1000.mapping[pg], 0xd0000 + (0x4000 * pg), 16384,
ems_read_ram, ems_read_ramw, ems_read_raml,
ems_write_ram, ems_write_ramw, ems_write_raml,
@@ -906,8 +902,6 @@ machine_xt_t1000_init(const machine_t *model)
int
machine_xt_t1200_init(const machine_t *model)
{
int pg;
int ret;
ret = bios_load_linear("roms/machines/t1200/t1200_019e.ic15.bin",
@@ -924,7 +918,7 @@ machine_xt_t1200_init(const machine_t *model)
loadfont("roms/machines/t1000/t1000font.bin", 2);
/* Map the EMS page frame */
for (pg = 0; pg < 4; pg++) {
for (uint8_t pg = 0; pg < 4; pg++) {
mem_mapping_add(&t1000.mapping[pg],
0xd0000 + (0x4000 * pg), 16384,
ems_read_ram, ems_read_ramw, ems_read_raml,

View File

@@ -231,8 +231,9 @@ static void
t1000_text_row80(t1000_t *t1000)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int bold;
@@ -251,7 +252,7 @@ t1000_text_row80(t1000_t *t1000)
} else {
cursorline = ((t1000->cga.crtc[10] & 0x0F) <= sc) && ((t1000->cga.crtc[11] & 0x0F) >= sc);
}
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
chr = t1000->vram[(addr + 2 * x) & 0x3FFF];
attr = t1000->vram[(addr + 2 * x + 1) & 0x3FFF];
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & 8) && (t1000->cga.cgablink & 16));

View File

@@ -13092,11 +13092,11 @@ machine_get_machine_from_internal_name(char *s)
while (machines[c].init != NULL) {
if (!strcmp(machines[c].internal_name, (const char *) s))
return (c);
return c;
c++;
}
return (0);
return 0;
}
int