Added the Diamond Stealth 64 VRAM (S3 Vision964) and its Brooktree BT485 RAM DAC;

Removed the ExpertColor S3 Vision868 card;
Rewritten the ICD2061 clock chip and moved the Diamond Stealth 32 back to the main branch as it's now fixed;
Fixed the Y offset of the 64x64 hardware cursor of the Cirrus Logic cards.
This commit is contained in:
OBattler
2018-09-30 20:29:44 +02:00
parent f1796e8d1d
commit eba4ca376e
11 changed files with 3101 additions and 2831 deletions

View File

@@ -10,71 +10,106 @@
*
* Used by ET4000w32/p (Diamond Stealth 32)
*
* Version: @(#)vid_icd2061.c 1.0.2 2017/11/04
* Version: @(#)vid_icd2061.c 1.0.3 2018/09/30
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2016-2018 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../mem.h"
#include "video.h"
#include "vid_svga.h"
#include "vid_icd2061.h"
void icd2061_write(icd2061_t *icd2061, int val)
void
icd2061_write(icd2061_t *icd2061, int val)
{
int q, p, m, a;
if ((val & 1) && !(icd2061->state & 1))
{
if (!icd2061->status)
{
if (val & 2)
icd2061->unlock++;
else
{
if (icd2061->unlock >= 5)
{
icd2061->status = 1;
icd2061->pos = 0;
}
else
icd2061->unlock = 0;
}
}
else if (val & 1)
{
icd2061->data = (icd2061->data >> 1) | (((val & 2) ? 1 : 0) << 24);
icd2061->pos++;
if (icd2061->pos == 26)
{
a = (icd2061->data >> 21) & 0x7;
if (!(a & 4))
{
q = (icd2061->data & 0x7f) - 2;
m = 1 << ((icd2061->data >> 7) & 0x7);
p = ((icd2061->data >> 10) & 0x7f) - 3;
if (icd2061->ctrl & (1 << a))
p <<= 1;
icd2061->freq[a] = ((double)p / (double)q) * 2.0 * 14318184.0 / (double)m;
}
else if (a == 6)
{
icd2061->ctrl = val;
}
icd2061->unlock = icd2061->data = 0;
icd2061->status = 0;
}
}
}
icd2061->state = val;
int /*od, */nd, oc, nc;
int a/*, i*/, qa, q, pa, p, m;
#if 0
od = (icd2061->state & 2) >> 1; /* Old data. */
#endif
nd = (val & 2) >> 1; /* Old data. */
oc = icd2061->state & 1; /* Old clock. */
nc = val & 1; /* New clock. */
icd2061->state = val;
if (nc && !oc) { /* Low-to-high transition of CLK. */
if (!icd2061->unlocked) {
if (nd) { /* DATA high. */
icd2061->count++;
/* pclog("Low-to-high transition of CLK with DATA high, %i total\n", icd2061->count); */
} else { /* DATA low. */
if (icd2061->count >= 5) {
icd2061->unlocked = 1;
icd2061->bit_count = icd2061->data = 0;
/* pclog("ICD2061 unlocked\n"); */
} else {
icd2061->count = 0;
/* pclog("ICD2061 locked\n"); */
}
}
} else if (nc) {
icd2061->data |= (nd << icd2061->bit_count);
icd2061->bit_count++;
if (icd2061->bit_count == 26) {
icd2061->data >>= 1;
/* pclog("26 bits received, data = %08X\n", icd2061->data); */
a = ((icd2061->data >> 21) & 0x07); /* A */
if (a < 3) {
#if 0
i = ((icd2061->data >> 17) & 0x0f); /* I */
#endif
pa = ((icd2061->data >> 10) & 0x7f); /* P' */
m = ((icd2061->data >> 7) & 0x07); /* M */
qa = (icd2061->data & 0x7f); /* Q' */
p = pa + 3; /* P */
m = 1 << m;
q = qa + 2; /* Q */
if (icd2061->ctrl & (1 << a))
p <<= 1;
icd2061->freq[a] = ((float)p / (float)q) * 2.0 * 14318184.0 / (float)m;
/* pclog("P = %02X, M = %01X, Q = %02X, freq[%i] = %f\n", p, m, q, a, icd2061->freq[a]); */
} else if (a == 6) {
icd2061->ctrl = val;
/* pclog("ctrl = %02X\n", icd2061->ctrl); */
}
icd2061->count = icd2061->bit_count = icd2061->data = 0;
}
}
}
}
double icd2061_getfreq(icd2061_t *icd2061, int i)
void
icd2061_init(icd2061_t *icd2061)
{
return icd2061->freq[i];
icd2061->freq[0] = 25175000.0;
icd2061->freq[1] = 28322000.0;
icd2061->freq[2] = 28322000.0;
}
float
icd2061_getclock(int clock, void *p)
{
icd2061_t *icd2061 = (icd2061_t *) p;
if (clock > 2)
clock = 2;
return icd2061->freq[clock];
}