Assorted cleaning
This commit is contained in:
@@ -979,28 +979,28 @@ cdrom_toc_dump(cdrom_t *dev)
|
|||||||
uint8_t b[65536] = { 0 };
|
uint8_t b[65536] = { 0 };
|
||||||
int len = cdrom_read_toc(dev, b, CD_TOC_RAW, 0, 0, 65536);
|
int len = cdrom_read_toc(dev, b, CD_TOC_RAW, 0, 0, 65536);
|
||||||
const char *fn2 = "d:\\86boxnew\\toc_cue.dmp";
|
const char *fn2 = "d:\\86boxnew\\toc_cue.dmp";
|
||||||
FILE * f = fopen(fn2, "wb");
|
FILE * fp = fopen(fn2, "wb");
|
||||||
fwrite(b, 1, len, f);
|
fwrite(b, 1, len, fp);
|
||||||
fflush(f);
|
fflush(fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
cdrom_log(dev->log, "Written TOC of %i bytes to %s\n", len, fn2);
|
cdrom_log(dev->log, "Written TOC of %i bytes to %s\n", len, fn2);
|
||||||
|
|
||||||
memset(b, 0x00, 65536);
|
memset(b, 0x00, 65536);
|
||||||
len = cdrom_read_toc(dev, b, CD_TOC_NORMAL, 0, 0, 65536);
|
len = cdrom_read_toc(dev, b, CD_TOC_NORMAL, 0, 0, 65536);
|
||||||
fn2 = "d:\\86boxnew\\toc_cue_cooked.dmp";
|
fn2 = "d:\\86boxnew\\toc_cue_cooked.dmp";
|
||||||
f = fopen(fn2, "wb");
|
fp = fopen(fn2, "wb");
|
||||||
fwrite(b, 1, len, f);
|
fwrite(b, 1, len, fp);
|
||||||
fflush(f);
|
fflush(fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
cdrom_log(dev->log, "Written cooked TOC of %i bytes to %s\n", len, fn2);
|
cdrom_log(dev->log, "Written cooked TOC of %i bytes to %s\n", len, fn2);
|
||||||
|
|
||||||
memset(b, 0x00, 65536);
|
memset(b, 0x00, 65536);
|
||||||
len = cdrom_read_toc(dev, b, CD_TOC_SESSION, 0, 0, 65536);
|
len = cdrom_read_toc(dev, b, CD_TOC_SESSION, 0, 0, 65536);
|
||||||
fn2 = "d:\\86boxnew\\toc_cue_session.dmp";
|
fn2 = "d:\\86boxnew\\toc_cue_session.dmp";
|
||||||
f = fopen(fn2, "wb");
|
fp = fopen(fn2, "wb");
|
||||||
fwrite(b, 1, len, f);
|
fwrite(b, 1, len, fp);
|
||||||
fflush(f);
|
fflush(fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
cdrom_log(dev->log, "Written session TOC of %i bytes to %s\n", len, fn2);
|
cdrom_log(dev->log, "Written session TOC of %i bytes to %s\n", len, fn2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ fdd_load(int drive, char *fn)
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
int size;
|
int size;
|
||||||
const char *p;
|
const char *p;
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
|
|
||||||
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);
|
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);
|
||||||
|
|
||||||
|
|||||||
@@ -106,10 +106,10 @@ enum {
|
|||||||
#define CDV EMU_VERSION_EX
|
#define CDV EMU_VERSION_EX
|
||||||
|
|
||||||
static const struct cdrom_drive_types_s {
|
static const struct cdrom_drive_types_s {
|
||||||
const char * vendor;
|
const char *vendor;
|
||||||
const char * model;
|
const char *model;
|
||||||
const char * revision;
|
const char *revision;
|
||||||
const char * internal_name;
|
const char *internal_name;
|
||||||
const int bus_type;
|
const int bus_type;
|
||||||
/* SCSI standard for SCSI (or both) devices, early for IDE. */
|
/* SCSI standard for SCSI (or both) devices, early for IDE. */
|
||||||
const int scsi_std;
|
const int scsi_std;
|
||||||
@@ -296,7 +296,7 @@ typedef struct cdrom {
|
|||||||
uint8_t speed;
|
uint8_t speed;
|
||||||
uint8_t cur_speed;
|
uint8_t cur_speed;
|
||||||
|
|
||||||
void * priv;
|
void *priv;
|
||||||
|
|
||||||
char image_path[1024];
|
char image_path[1024];
|
||||||
char prev_image_path[1280];
|
char prev_image_path[1280];
|
||||||
@@ -322,10 +322,10 @@ typedef struct cdrom {
|
|||||||
|
|
||||||
const cdrom_ops_t *ops;
|
const cdrom_ops_t *ops;
|
||||||
|
|
||||||
char * image_history[CD_IMAGE_HISTORY];
|
char *image_history[CD_IMAGE_HISTORY];
|
||||||
|
|
||||||
void * local;
|
void *local;
|
||||||
void * log;
|
void *log;
|
||||||
|
|
||||||
void (*insert)(void *priv);
|
void (*insert)(void *priv);
|
||||||
void (*close)(void *priv);
|
void (*close)(void *priv);
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ typedef struct track_file_t {
|
|||||||
int motorola;
|
int motorola;
|
||||||
} track_file_t;
|
} track_file_t;
|
||||||
|
|
||||||
extern void * image_open(cdrom_t *dev, const char *path);
|
extern void *image_open(cdrom_t *dev, const char *path);
|
||||||
|
|
||||||
#endif /*CDROM_IMAGE_H*/
|
#endif /*CDROM_IMAGE_H*/
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ typedef struct hard_disk_t {
|
|||||||
uint8_t pad;
|
uint8_t pad;
|
||||||
uint8_t pad0;
|
uint8_t pad0;
|
||||||
|
|
||||||
void * priv;
|
void *priv;
|
||||||
|
|
||||||
char fn[1024]; /* Name of current image file */
|
char fn[1024]; /* Name of current image file */
|
||||||
/* Differential VHD parent file */
|
/* Differential VHD parent file */
|
||||||
@@ -185,7 +185,7 @@ typedef struct hard_disk_t {
|
|||||||
uint8_t max_multiple_block;
|
uint8_t max_multiple_block;
|
||||||
uint8_t pad1[3];
|
uint8_t pad1[3];
|
||||||
|
|
||||||
const char * model;
|
const char *model;
|
||||||
|
|
||||||
hdd_zone_t zones[HDD_MAX_ZONES];
|
hdd_zone_t zones[HDD_MAX_ZONES];
|
||||||
|
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ typedef struct mo_drive_t {
|
|||||||
uint8_t pad;
|
uint8_t pad;
|
||||||
uint8_t pad0;
|
uint8_t pad0;
|
||||||
|
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
void * priv;
|
void *priv;
|
||||||
|
|
||||||
char image_path[1024];
|
char image_path[1024];
|
||||||
char prev_image_path[1024];
|
char prev_image_path[1024];
|
||||||
|
|
||||||
char * image_history[MO_IMAGE_HISTORY];
|
char *image_history[MO_IMAGE_HISTORY];
|
||||||
|
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t medium_size;
|
uint32_t medium_size;
|
||||||
@@ -129,16 +129,16 @@ typedef struct mo_drive_t {
|
|||||||
typedef struct mo_t {
|
typedef struct mo_t {
|
||||||
mode_sense_pages_t ms_pages_saved;
|
mode_sense_pages_t ms_pages_saved;
|
||||||
|
|
||||||
mo_drive_t * drv;
|
mo_drive_t *drv;
|
||||||
#ifdef EMU_IDE_H
|
#ifdef EMU_IDE_H
|
||||||
ide_tf_t * tf;
|
ide_tf_t *tf;
|
||||||
#else
|
#else
|
||||||
void * tf;
|
void *tf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * log;
|
void * log;
|
||||||
|
|
||||||
uint8_t * buffer;
|
uint8_t *buffer;
|
||||||
uint8_t atapi_cdb[16];
|
uint8_t atapi_cdb[16];
|
||||||
uint8_t current_cdb[16];
|
uint8_t current_cdb[16];
|
||||||
uint8_t sense[256];
|
uint8_t sense[256];
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ typedef struct zip_drive_t {
|
|||||||
uint8_t pad;
|
uint8_t pad;
|
||||||
uint8_t pad0;
|
uint8_t pad0;
|
||||||
|
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
void * priv;
|
void *priv;
|
||||||
|
|
||||||
char image_path[1024];
|
char image_path[1024];
|
||||||
char prev_image_path[1024];
|
char prev_image_path[1024];
|
||||||
|
|
||||||
char * image_history[ZIP_IMAGE_HISTORY];
|
char *image_history[ZIP_IMAGE_HISTORY];
|
||||||
|
|
||||||
uint32_t is_250;
|
uint32_t is_250;
|
||||||
uint32_t medium_size;
|
uint32_t medium_size;
|
||||||
@@ -74,16 +74,16 @@ typedef struct zip_drive_t {
|
|||||||
typedef struct zip_t {
|
typedef struct zip_t {
|
||||||
mode_sense_pages_t ms_pages_saved;
|
mode_sense_pages_t ms_pages_saved;
|
||||||
|
|
||||||
zip_drive_t * drv;
|
zip_drive_t *drv;
|
||||||
#ifdef EMU_IDE_H
|
#ifdef EMU_IDE_H
|
||||||
ide_tf_t * tf;
|
ide_tf_t *tf;
|
||||||
#else
|
#else
|
||||||
void * tf;
|
void *tf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * log;
|
void *log;
|
||||||
|
|
||||||
uint8_t * buffer;
|
uint8_t *buffer;
|
||||||
uint8_t atapi_cdb[16];
|
uint8_t atapi_cdb[16];
|
||||||
uint8_t current_cdb[16];
|
uint8_t current_cdb[16];
|
||||||
uint8_t sense[256];
|
uint8_t sense[256];
|
||||||
|
|||||||
@@ -104,22 +104,22 @@ glsl_detect_bom(const char *fn)
|
|||||||
|
|
||||||
static char *load_file(const char *fn) {
|
static char *load_file(const char *fn) {
|
||||||
int bom = glsl_detect_bom(fn);
|
int bom = glsl_detect_bom(fn);
|
||||||
FILE *f = plat_fopen(fn, "rb");
|
FILE *fp = plat_fopen(fn, "rb");
|
||||||
if (!f)
|
if (!fp)
|
||||||
return 0;
|
return 0;
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
long fsize = ftell(f);
|
long fsize = ftell(fp);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
if (bom) {
|
if (bom) {
|
||||||
fsize -= 3;
|
fsize -= 3;
|
||||||
fseek(f, 3, SEEK_SET);
|
fseek(fp, 3, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *data = (char*)malloc(fsize + 1);
|
char *data = (char*)malloc(fsize + 1);
|
||||||
|
|
||||||
fread(data, fsize, 1, f);
|
(void *) !fread(data, fsize, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
|
|
||||||
data[fsize] = 0;
|
data[fsize] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void ega_doblit(int wx, int wy, ega_t *ega);
|
|||||||
|
|
||||||
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
|
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
|
||||||
static uint8_t ega_rotate[8][256];
|
static uint8_t ega_rotate[8][256];
|
||||||
static int active = 0;
|
static int active = 0;
|
||||||
uint32_t pallook16[256];
|
uint32_t pallook16[256];
|
||||||
uint32_t pallook64[256];
|
uint32_t pallook64[256];
|
||||||
static int ega_type = EGA_TYPE_IBM;
|
static int ega_type = EGA_TYPE_IBM;
|
||||||
@@ -154,7 +154,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
|||||||
ega_recalctimings(ega);
|
ega_recalctimings(ega);
|
||||||
if ((type == EGA_TYPE_COMPAQ) && !(val & 0x02))
|
if ((type == EGA_TYPE_COMPAQ) && !(val & 0x02))
|
||||||
mem_mapping_disable(&ega->mapping);
|
mem_mapping_disable(&ega->mapping);
|
||||||
else switch (ega->gdcreg[6] & 0xc) {
|
else switch (ega->gdcreg[6] & 0xc) {
|
||||||
case 0x0: /*128k at A0000*/
|
case 0x0: /*128k at A0000*/
|
||||||
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
|
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
|
||||||
break;
|
break;
|
||||||
@@ -225,7 +225,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
|||||||
case 6:
|
case 6:
|
||||||
if ((type == EGA_TYPE_COMPAQ) && !(ega->miscout & 0x02))
|
if ((type == EGA_TYPE_COMPAQ) && !(ega->miscout & 0x02))
|
||||||
mem_mapping_disable(&ega->mapping);
|
mem_mapping_disable(&ega->mapping);
|
||||||
else switch (val & 0xc) {
|
else switch (val & 0xc) {
|
||||||
case 0x0: /*128k at A0000*/
|
case 0x0: /*128k at A0000*/
|
||||||
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
|
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
|
||||||
break;
|
break;
|
||||||
@@ -289,7 +289,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
|||||||
if ((idx == 7) && (ega->crtc[0x11] & 0x80))
|
if ((idx == 7) && (ega->crtc[0x11] & 0x80))
|
||||||
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
|
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
|
||||||
}
|
}
|
||||||
old = ega->crtc[idx];
|
old = ega->crtc[idx];
|
||||||
ega->crtc[idx] = val;
|
ega->crtc[idx] = val;
|
||||||
if (old != val) {
|
if (old != val) {
|
||||||
if ((idx < 0xe) || (idx > 0x10)) {
|
if ((idx < 0xe) || (idx > 0x10)) {
|
||||||
@@ -305,7 +305,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} default:
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +315,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
|||||||
uint8_t
|
uint8_t
|
||||||
ega_in(uint16_t addr, void *priv)
|
ega_in(uint16_t addr, void *priv)
|
||||||
{
|
{
|
||||||
ega_t *ega = (ega_t *) priv;
|
ega_t *ega = (ega_t *) priv;
|
||||||
uint8_t ret = 0xff;
|
uint8_t ret = 0xff;
|
||||||
int type = ega_type;
|
int type = ega_type;
|
||||||
int atype = ega->actual_type;
|
int atype = ega->actual_type;
|
||||||
@@ -494,7 +496,7 @@ ega_in(uint16_t addr, void *priv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x7c6:
|
case 0x7c6:
|
||||||
ret = 0xfd; /* EGA mode supported. */
|
ret = 0xfd; /* EGA mode supported. */
|
||||||
break;
|
break;
|
||||||
case 0xbc6:
|
case 0xbc6:
|
||||||
/* 0000 = None;
|
/* 0000 = None;
|
||||||
@@ -696,7 +698,7 @@ ega_recalctimings(ega_t *ega)
|
|||||||
timer_disable(&ega->dot_timer);
|
timer_disable(&ega->dot_timer);
|
||||||
timer_set_delay_u64(&ega->dot_timer, ega->dot_time);
|
timer_set_delay_u64(&ega->dot_timer, ega->dot_time);
|
||||||
ega->cca = 0;
|
ega->cca = 0;
|
||||||
active = 1;
|
active = 1;
|
||||||
ega->dot = 0;
|
ega->dot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,30 +710,30 @@ ega_recalctimings(ega_t *ega)
|
|||||||
void
|
void
|
||||||
ega_dot_poll(void *priv)
|
ega_dot_poll(void *priv)
|
||||||
{
|
{
|
||||||
ega_t *ega = (ega_t *) priv;
|
ega_t *ega = (ega_t *) priv;
|
||||||
static uint8_t chr;
|
static uint8_t chr;
|
||||||
static uint8_t attr;
|
static uint8_t attr;
|
||||||
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
|
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
|
||||||
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
|
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
|
||||||
const bool attrlinechars = (ega->attrregs[0x10] & 4);
|
const bool attrlinechars = (ega->attrregs[0x10] & 4);
|
||||||
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
|
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
|
||||||
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
|
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
|
||||||
const bool blinked = ega->blink & 0x10;
|
const bool blinked = ega->blink & 0x10;
|
||||||
const int dwshift = doublewidth ? 1 : 0;
|
const int dwshift = doublewidth ? 1 : 0;
|
||||||
const int dotwidth = 1 << dwshift;
|
const int dotwidth = 1 << dwshift;
|
||||||
const int charwidth = dotwidth * (seq9dot ? 9 : 8);
|
const int charwidth = dotwidth * (seq9dot ? 9 : 8);
|
||||||
const int cursoron = (ega->sc == (ega->crtc[10] & 31));
|
const int cursoron = (ega->sc == (ega->crtc[10] & 31));
|
||||||
const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf];
|
const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf];
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
int drawcursor;
|
int drawcursor;
|
||||||
uint32_t charaddr;
|
uint32_t charaddr;
|
||||||
static int fg = 0;
|
static int fg = 0;
|
||||||
static int bg = 0;
|
static int bg = 0;
|
||||||
static uint32_t dat = 0x00000000;
|
static uint32_t dat = 0x00000000;
|
||||||
static int cclock = 0;
|
static int cclock = 0;
|
||||||
static int disptime;
|
static int disptime;
|
||||||
static int _dispontime;
|
static int _dispontime;
|
||||||
static int _dispofftime;
|
static int _dispofftime;
|
||||||
|
|
||||||
if (ega->seqregs[1] & 8) {
|
if (ega->seqregs[1] & 8) {
|
||||||
disptime = ((ega->crtc[0] + 2) << 1);
|
disptime = ((ega->crtc[0] + 2) << 1);
|
||||||
@@ -803,11 +805,9 @@ void
|
|||||||
ega_poll(void *priv)
|
ega_poll(void *priv)
|
||||||
{
|
{
|
||||||
ega_t *ega = (ega_t *) priv;
|
ega_t *ega = (ega_t *) priv;
|
||||||
int x, y;
|
|
||||||
int old_ma;
|
int old_ma;
|
||||||
int wx = 640;
|
int wx = 640;
|
||||||
int wy = 350;
|
int wy = 350;
|
||||||
uint32_t blink_delay;
|
|
||||||
|
|
||||||
if (!ega->linepos) {
|
if (!ega->linepos) {
|
||||||
timer_advance_u64(&ega->timer, ega->dispofftime);
|
timer_advance_u64(&ega->timer, ega->dispofftime);
|
||||||
@@ -826,7 +826,7 @@ ega_poll(void *priv)
|
|||||||
old_ma = ega->ma;
|
old_ma = ega->ma;
|
||||||
ega->displine *= ega->vres + 1;
|
ega->displine *= ega->vres + 1;
|
||||||
ega->y_add *= ega->vres + 1;
|
ega->y_add *= ega->vres + 1;
|
||||||
for (y = 0; y <= ega->vres; y++) {
|
for (int y = 0; y <= ega->vres; y++) {
|
||||||
/* Render scanline */
|
/* Render scanline */
|
||||||
ega->render(ega);
|
ega->render(ega);
|
||||||
|
|
||||||
@@ -925,7 +925,7 @@ ega_poll(void *priv)
|
|||||||
}
|
}
|
||||||
if (ega->vc == ega->dispend) {
|
if (ega->vc == ega->dispend) {
|
||||||
ega->dispon = 0;
|
ega->dispon = 0;
|
||||||
blink_delay = (ega->crtc[11] & 0x60) >> 5;
|
uint32_t blink_delay = (ega->crtc[11] & 0x60) >> 5;
|
||||||
if (ega->crtc[10] & 0x20)
|
if (ega->crtc[10] & 0x20)
|
||||||
ega->cursoron = 0;
|
ega->cursoron = 0;
|
||||||
else if (blink_delay == 2)
|
else if (blink_delay == 2)
|
||||||
@@ -946,14 +946,14 @@ ega_poll(void *priv)
|
|||||||
#if 0
|
#if 0
|
||||||
picint(1 << 2);
|
picint(1 << 2);
|
||||||
#endif
|
#endif
|
||||||
x = ega->hdisp;
|
// x = ega->hdisp;
|
||||||
|
|
||||||
if (ega->interlace && !ega->oddeven)
|
if (ega->interlace && !ega->oddeven)
|
||||||
ega->lastline++;
|
ega->lastline++;
|
||||||
if (ega->interlace && ega->oddeven)
|
if (ega->interlace && ega->oddeven)
|
||||||
ega->firstline--;
|
ega->firstline--;
|
||||||
|
|
||||||
wx = x;
|
wx = ega->hdisp;
|
||||||
|
|
||||||
if (ega->vres) {
|
if (ega->vres) {
|
||||||
wy = (ega->lastline - ega->firstline) << 1;
|
wy = (ega->lastline - ega->firstline) << 1;
|
||||||
@@ -1024,9 +1024,6 @@ ega_doblit(int wx, int wy, ega_t *ega)
|
|||||||
int y_start = enable_overscan ? 0 : (unscaled_overscan_y >> 1);
|
int y_start = enable_overscan ? 0 : (unscaled_overscan_y >> 1);
|
||||||
int x_start = enable_overscan ? 0 : (overscan_x >> 1);
|
int x_start = enable_overscan ? 0 : (overscan_x >> 1);
|
||||||
int bottom = (unscaled_overscan_y >> 1);
|
int bottom = (unscaled_overscan_y >> 1);
|
||||||
uint32_t *p;
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
int xs_temp;
|
int xs_temp;
|
||||||
int ys_temp;
|
int ys_temp;
|
||||||
|
|
||||||
@@ -1073,17 +1070,17 @@ ega_doblit(int wx, int wy, ega_t *ega)
|
|||||||
|
|
||||||
if ((wx >= 160) && ((wy + 1) >= 120)) {
|
if ((wx >= 160) && ((wy + 1) >= 120)) {
|
||||||
/* Draw (overscan_size - scroll size) lines of overscan on top and bottom. */
|
/* Draw (overscan_size - scroll size) lines of overscan on top and bottom. */
|
||||||
for (i = 0; i < ega->y_add; i++) {
|
for (int i = 0; i < ega->y_add; i++) {
|
||||||
p = &buffer32->line[i & 0x7ff][0];
|
uint32_t *p = &buffer32->line[i & 0x7ff][0];
|
||||||
|
|
||||||
for (j = 0; j < (xsize + x_add); j++)
|
for (int j = 0; j < (xsize + x_add); j++)
|
||||||
p[j] = ega->overscan_color;
|
p[j] = ega->overscan_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < bottom; i++) {
|
for (int i = 0; i < bottom; i++) {
|
||||||
p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0];
|
uint32_t *p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0];
|
||||||
|
|
||||||
for (j = 0; j < (xsize + x_add); j++)
|
for (int j = 0; j < (xsize + x_add); j++)
|
||||||
p[j] = ega->overscan_color;
|
p[j] = ega->overscan_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1107,12 +1104,11 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
|
|||||||
// bit 2: 1 = 128K mapping, 0 = other mapping (from memory decode PROM)
|
// bit 2: 1 = 128K mapping, 0 = other mapping (from memory decode PROM)
|
||||||
a0mux = 0;
|
a0mux = 0;
|
||||||
|
|
||||||
if (ega->gdcreg[6] & 2) {
|
if (ega->gdcreg[6] & 2)
|
||||||
a0mux |= 2;
|
a0mux |= 2;
|
||||||
}
|
|
||||||
if (ega->vram_limit <= 64 * 1024) {
|
if (ega->vram_limit <= 64 * 1024)
|
||||||
a0mux |= 1;
|
a0mux |= 1;
|
||||||
}
|
|
||||||
|
|
||||||
switch (ega->gdcreg[6] & 0xC) {
|
switch (ega->gdcreg[6] & 0xC) {
|
||||||
case 0x0: // 128K A000
|
case 0x0: // 128K A000
|
||||||
@@ -1179,9 +1175,8 @@ ega_write(uint32_t addr, uint8_t val, void *priv)
|
|||||||
|
|
||||||
cycles -= video_timing_write_b;
|
cycles -= video_timing_write_b;
|
||||||
|
|
||||||
if (ega->chain2_write) {
|
if (ega->chain2_write)
|
||||||
writemask2 &= 0x5 << (addr & 1);
|
writemask2 &= 0x5 << (addr & 1);
|
||||||
}
|
|
||||||
|
|
||||||
addr = ega_remap_cpu_addr(addr, ega);
|
addr = ega_remap_cpu_addr(addr, ega);
|
||||||
|
|
||||||
@@ -1361,9 +1356,8 @@ ega_read(uint32_t addr, void *priv)
|
|||||||
|
|
||||||
cycles -= video_timing_read_b;
|
cycles -= video_timing_read_b;
|
||||||
|
|
||||||
if (ega->chain2_read) {
|
if (ega->chain2_read)
|
||||||
readplane = (readplane & 2) | (addr & 1);
|
readplane = (readplane & 2) | (addr & 1);
|
||||||
}
|
|
||||||
|
|
||||||
addr = ega_remap_cpu_addr(addr, ega);
|
addr = ega_remap_cpu_addr(addr, ega);
|
||||||
|
|
||||||
@@ -1401,23 +1395,19 @@ ega_read(uint32_t addr, void *priv)
|
|||||||
void
|
void
|
||||||
ega_init(ega_t *ega, int monitor_type, int is_mono)
|
ega_init(ega_t *ega, int monitor_type, int is_mono)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
int d;
|
|
||||||
int e;
|
|
||||||
|
|
||||||
ega->vram = malloc(0x40000);
|
ega->vram = malloc(0x40000);
|
||||||
ega->vrammask = 0x3ffff;
|
ega->vrammask = 0x3ffff;
|
||||||
|
|
||||||
for (c = 0; c < 256; c++) {
|
for (uint16_t c = 0; c < 256; c++) {
|
||||||
e = c;
|
int e = c;
|
||||||
for (d = 0; d < 8; d++) {
|
for (uint8_t d = 0; d < 8; d++) {
|
||||||
ega_rotate[d][c] = e;
|
ega_rotate[d][c] = e;
|
||||||
e = (e >> 1) | ((e & 1) ? 0x80 : 0);
|
e = (e >> 1) | ((e & 1) ? 0x80 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_mono) {
|
if (is_mono) {
|
||||||
for (c = 0; c < 256; c++) {
|
for (uint16_t c = 0; c < 256; c++) {
|
||||||
if (((c >> 3) & 3) == 0)
|
if (((c >> 3) & 3) == 0)
|
||||||
pallook64[c] = pallook16[c] = makecol32(0, 0, 0);
|
pallook64[c] = pallook16[c] = makecol32(0, 0, 0);
|
||||||
else
|
else
|
||||||
@@ -1476,7 +1466,7 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
|
|||||||
|
|
||||||
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
||||||
} else {
|
} else {
|
||||||
for (c = 0; c < 256; c++) {
|
for (uint16_t c = 0; c < 256; c++) {
|
||||||
pallook64[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
|
pallook64[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
|
||||||
pallook64[c] += makecol32(((c >> 5) & 1) * 0x55, ((c >> 4) & 1) * 0x55, ((c >> 3) & 1) * 0x55);
|
pallook64[c] += makecol32(((c >> 5) & 1) * 0x55, ((c >> 4) & 1) * 0x55, ((c >> 3) & 1) * 0x55);
|
||||||
pallook16[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
|
pallook16[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa);
|
||||||
@@ -1562,11 +1552,9 @@ ega_set_type(void *priv, uint32_t local)
|
|||||||
static void *
|
static void *
|
||||||
ega_standalone_init(const device_t *info)
|
ega_standalone_init(const device_t *info)
|
||||||
{
|
{
|
||||||
ega_t *ega = malloc(sizeof(ega_t));
|
ega_t *ega = calloc(1, sizeof(ega_t));
|
||||||
int monitor_type;
|
int monitor_type;
|
||||||
|
|
||||||
memset(ega, 0x00, sizeof(ega_t));
|
|
||||||
|
|
||||||
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ega);
|
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ega);
|
||||||
|
|
||||||
overscan_x = 16;
|
overscan_x = 16;
|
||||||
@@ -1635,8 +1623,7 @@ ega_standalone_init(const device_t *info)
|
|||||||
|
|
||||||
if (ega->chipset) {
|
if (ega->chipset) {
|
||||||
io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
||||||
ega->eeprom = malloc(sizeof(ati_eeprom_t));
|
ega->eeprom = calloc(1, sizeof(ati_eeprom_t));
|
||||||
memset(ega->eeprom, 0, sizeof(ati_eeprom_t));
|
|
||||||
ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800p.nvr", 0);
|
ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800p.nvr", 0);
|
||||||
} else if (info->local == EGA_COMPAQ) {
|
} else if (info->local == EGA_COMPAQ) {
|
||||||
io_sethandler(0x0084, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
io_sethandler(0x0084, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
|
||||||
|
|||||||
@@ -310,16 +310,16 @@ typedef struct da2_t {
|
|||||||
uint8_t fctl[32];
|
uint8_t fctl[32];
|
||||||
uint16_t crtc[32];
|
uint16_t crtc[32];
|
||||||
uint16_t crtc_vpreg[128];
|
uint16_t crtc_vpreg[128];
|
||||||
uint8_t crtc_vpsel;
|
uint8_t crtc_vpsel;
|
||||||
uint8_t gdcreg[64];
|
uint8_t gdcreg[64];
|
||||||
uint8_t reg3ee[16];
|
uint8_t reg3ee[16];
|
||||||
int gdcaddr;
|
int gdcaddr;
|
||||||
uint8_t attrc[0x40];
|
uint8_t attrc[0x40];
|
||||||
int attraddr, attrff;
|
int attraddr, attrff;
|
||||||
int attr_palette_enable;
|
int attr_palette_enable;
|
||||||
int outflipflop;
|
int outflipflop;
|
||||||
int inflipflop;
|
int inflipflop;
|
||||||
int iolatch;
|
int iolatch;
|
||||||
|
|
||||||
int ioctladdr;
|
int ioctladdr;
|
||||||
int fctladdr;
|
int fctladdr;
|
||||||
@@ -385,8 +385,7 @@ typedef struct da2_t {
|
|||||||
card should not attempt to display anything */
|
card should not attempt to display anything */
|
||||||
int override;
|
int override;
|
||||||
|
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
int enable;
|
int enable;
|
||||||
mem_mapping_t mapping;
|
mem_mapping_t mapping;
|
||||||
uint8_t ram[DA2_SIZE_GAIJIRAM];
|
uint8_t ram[DA2_SIZE_GAIJIRAM];
|
||||||
@@ -435,9 +434,9 @@ typedef struct da2_t {
|
|||||||
uint32_t mmrdbg_vidaddr;
|
uint32_t mmrdbg_vidaddr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t pos_regs[8];
|
uint8_t pos_regs[8];
|
||||||
svga_t *mb_vga;
|
svga_t *mb_vga;
|
||||||
uint8_t monitorid;
|
uint8_t monitorid;
|
||||||
pc_timer_t timer_vidupd;
|
pc_timer_t timer_vidupd;
|
||||||
|
|
||||||
int old_pos2;
|
int old_pos2;
|
||||||
@@ -520,7 +519,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s
|
|||||||
da2->changedvram[(DA2_MASK_VRAMPLANE & destaddr) >> 9] = changeframecount;
|
da2->changedvram[(DA2_MASK_VRAMPLANE & destaddr) >> 9] = changeframecount;
|
||||||
destaddr <<= 3;
|
destaddr <<= 3;
|
||||||
/* read destination data with big endian order */
|
/* read destination data with big endian order */
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
writepx[i] = da2_vram_r((destaddr + 24) | i, da2)
|
writepx[i] = da2_vram_r((destaddr + 24) | i, da2)
|
||||||
| (da2_vram_r((destaddr + 16) | i, da2) << 8)
|
| (da2_vram_r((destaddr + 16) | i, da2) << 8)
|
||||||
| (da2_vram_r((destaddr + 8) | i, da2) << 16)
|
| (da2_vram_r((destaddr + 8) | i, da2) << 16)
|
||||||
@@ -532,7 +531,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s
|
|||||||
mask32.b[3] = mask32in.b[0];
|
mask32.b[3] = mask32in.b[0];
|
||||||
mask32.b[2] = mask32in.b[1];
|
mask32.b[2] = mask32in.b[1];
|
||||||
mask32.d &= 0xffff0000;
|
mask32.d &= 0xffff0000;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (da2->bitblt.bitshift_destr > 0)
|
if (da2->bitblt.bitshift_destr > 0)
|
||||||
srcpx->p8[i] <<= 16 - da2->bitblt.bitshift_destr;
|
srcpx->p8[i] <<= 16 - da2->bitblt.bitshift_destr;
|
||||||
// #ifdef ENABLE_DA2_DEBUGBLT
|
// #ifdef ENABLE_DA2_DEBUGBLT
|
||||||
@@ -560,7 +559,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
da2_vram_w(destaddr | i, (writepx[i] >> 24) & 0xff, da2);
|
da2_vram_w(destaddr | i, (writepx[i] >> 24) & 0xff, da2);
|
||||||
da2_vram_w((destaddr + 8) | i, (writepx[i] >> 16) & 0xff, da2);
|
da2_vram_w((destaddr + 8) | i, (writepx[i] >> 16) & 0xff, da2);
|
||||||
}
|
}
|
||||||
@@ -571,7 +570,7 @@ da2_DrawColorWithBitmask(uint32_t destaddr, uint8_t color, uint16_t mask, da2_t
|
|||||||
{
|
{
|
||||||
pixel32 srcpx;
|
pixel32 srcpx;
|
||||||
/* fill data with input color */
|
/* fill data with input color */
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
srcpx.p8[i] = (color & (1 << i)) ? 0xffffffff : 0; /* read in word */
|
srcpx.p8[i] = (color & (1 << i)) ? 0xffffffff : 0; /* read in word */
|
||||||
|
|
||||||
da2_WritePlaneDataWithBitmask(destaddr, mask, &srcpx, da2);
|
da2_WritePlaneDataWithBitmask(destaddr, mask, &srcpx, da2);
|
||||||
@@ -582,7 +581,7 @@ da2_CopyPlaneDataWithBitmask(uint32_t srcaddr, uint32_t destaddr, uint16_t mask,
|
|||||||
pixel32 srcpx;
|
pixel32 srcpx;
|
||||||
srcaddr &= 0xfffffffe;
|
srcaddr &= 0xfffffffe;
|
||||||
srcaddr <<= 3;
|
srcaddr <<= 3;
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
srcpx.p8[i] = da2_vram_r((srcaddr + 24) | i, da2)
|
srcpx.p8[i] = da2_vram_r((srcaddr + 24) | i, da2)
|
||||||
| (da2_vram_r((srcaddr + 16) | i, da2) << 8)
|
| (da2_vram_r((srcaddr + 16) | i, da2) << 8)
|
||||||
| (da2_vram_r((srcaddr + 8) | i, da2) << 16)
|
| (da2_vram_r((srcaddr + 8) | i, da2) << 16)
|
||||||
@@ -592,9 +591,9 @@ da2_CopyPlaneDataWithBitmask(uint32_t srcaddr, uint32_t destaddr, uint16_t mask,
|
|||||||
}
|
}
|
||||||
/* get font data for bitblt operation */
|
/* get font data for bitblt operation */
|
||||||
static uint32_t
|
static uint32_t
|
||||||
getRAMFont(int32_t code, int line, int x, void *p)
|
getRAMFont(int32_t code, int line, int x, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint32_t font = 0;
|
uint32_t font = 0;
|
||||||
#ifdef RESERVED_FOR_FUTURE_USE
|
#ifdef RESERVED_FOR_FUTURE_USE
|
||||||
int fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */
|
int fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */
|
||||||
@@ -617,8 +616,7 @@ getRAMFont(int32_t code, int line, int x, void *p)
|
|||||||
font |= da2->mmio.ram[code + 2];
|
font |= da2->mmio.ram[code + 2];
|
||||||
font <<= 8;
|
font <<= 8;
|
||||||
font |= da2->mmio.ram[code + 3];
|
font |= da2->mmio.ram[code + 3];
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
font = 0;
|
font = 0;
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
@@ -641,12 +639,12 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui
|
|||||||
uint32_t fontinv;
|
uint32_t fontinv;
|
||||||
if (width <= 2) {
|
if (width <= 2) {
|
||||||
fontinv = ~font;
|
fontinv = ~font;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0;
|
srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0;
|
||||||
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0;
|
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0;
|
||||||
}
|
}
|
||||||
da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2);
|
da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2);
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
srcpx.p8[i] = (fg & (1 << i)) ? font : 0;
|
srcpx.p8[i] = (fg & (1 << i)) ? font : 0;
|
||||||
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0;
|
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0;
|
||||||
}
|
}
|
||||||
@@ -654,12 +652,12 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui
|
|||||||
} else {
|
} else {
|
||||||
font = (font & 0xfff80000) | ((font & 0x0000ffff) << 3);
|
font = (font & 0xfff80000) | ((font & 0x0000ffff) << 3);
|
||||||
fontinv = ~font;
|
fontinv = ~font;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0;
|
srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0;
|
||||||
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0;
|
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0;
|
||||||
}
|
}
|
||||||
da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2);
|
da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2);
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
srcpx.p8[i] = (fg & (1 << i)) ? font : 0;
|
srcpx.p8[i] = (fg & (1 << i)) ? font : 0;
|
||||||
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0;
|
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0;
|
||||||
}
|
}
|
||||||
@@ -667,7 +665,7 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui
|
|||||||
da2_WritePlaneDataWithBitmask(destaddr + 2, maskr, &srcpx, da2);
|
da2_WritePlaneDataWithBitmask(destaddr + 2, maskr, &srcpx, da2);
|
||||||
} else {
|
} else {
|
||||||
da2_WritePlaneDataWithBitmask(destaddr + 2, 0xffff, &srcpx, da2);
|
da2_WritePlaneDataWithBitmask(destaddr + 2, 0xffff, &srcpx, da2);
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
srcpx.p8[i] = (fg & (1 << i)) ? font << 16 : 0;
|
srcpx.p8[i] = (fg & (1 << i)) ? font << 16 : 0;
|
||||||
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv << 16 : 0;
|
srcpx.p8[i] |= (bg & (1 << i)) ? fontinv << 16 : 0;
|
||||||
}
|
}
|
||||||
@@ -680,8 +678,8 @@ static uint8_t
|
|||||||
pixel1tohex(uint32_t addr, int index, da2_t *da2)
|
pixel1tohex(uint32_t addr, int index, da2_t *da2)
|
||||||
{
|
{
|
||||||
uint8_t pixeldata = 0;
|
uint8_t pixeldata = 0;
|
||||||
for (int j = 0; j < 8; j++) {
|
for (uint8_t i = 0; i < 8; j++) {
|
||||||
if (da2_vram_r(((addr << 3) | j) & (1 << (7 - index)), da2))
|
if (da2_vram_r(((addr << 3) | i) & (1 << (7 - index)), da2))
|
||||||
pixeldata++;
|
pixeldata++;
|
||||||
}
|
}
|
||||||
return pixeldata;
|
return pixeldata;
|
||||||
@@ -689,14 +687,14 @@ pixel1tohex(uint32_t addr, int index, da2_t *da2)
|
|||||||
static void
|
static void
|
||||||
print_pixelbyte(uint32_t addr, da2_t *da2)
|
print_pixelbyte(uint32_t addr, da2_t *da2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
pclog("%X", pixel1tohex(addr, i, da2));
|
pclog("%X", pixel1tohex(addr, i, da2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
print_bytetobin(uint8_t b)
|
print_bytetobin(uint8_t b)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (b & 0x80)
|
if (b & 0x80)
|
||||||
pclog("1");
|
pclog("1");
|
||||||
else
|
else
|
||||||
@@ -723,13 +721,13 @@ IBMJtoSJIS(uint16_t knj)
|
|||||||
knj -= 0x100;
|
knj -= 0x100;
|
||||||
if (knj <= 0x1f7d)
|
if (knj <= 0x1f7d)
|
||||||
; /* do nothing */
|
; /* do nothing */
|
||||||
else if (knj >= 0xb700 && knj <= 0xb75f) {
|
else if (knj >= 0xb700 && knj <= 0xb75f)
|
||||||
knj -= 0x90ec;
|
knj -= 0x90ec;
|
||||||
} else if (knj >= 0xb3f0 && knj <= 0xb67f) {
|
else if (knj >= 0xb3f0 && knj <= 0xb67f)
|
||||||
knj -= 0x906c;
|
knj -= 0x906c;
|
||||||
} else if (knj >= 0x8000 && knj <= 0x8183) {
|
else if (knj >= 0x8000 && knj <= 0x8183)
|
||||||
knj -= 0x5524;
|
knj -= 0x5524;
|
||||||
} else
|
else
|
||||||
return 0xffff;
|
return 0xffff;
|
||||||
uint32_t knj1 = knj / 0xBC;
|
uint32_t knj1 = knj / 0xBC;
|
||||||
uint32_t knj2 = knj - (knj1 * 0xBC);
|
uint32_t knj2 = knj - (knj1 * 0xBC);
|
||||||
@@ -850,8 +848,7 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
DOS/V Extension 1040x725 some DBCS uses 0xB0 others 0x90
|
DOS/V Extension 1040x725 some DBCS uses 0xB0 others 0x90
|
||||||
*/
|
*/
|
||||||
da2->bitblt.destoption = da2->bitblt.reg[0x2F];
|
da2->bitblt.destoption = da2->bitblt.reg[0x2F];
|
||||||
if (da2->bitblt.destoption & 0x10) /* destaddr -= 2, length += 1; */
|
if (da2->bitblt.destoption & 0x10) { /* destaddr -= 2, length += 1; */
|
||||||
{
|
|
||||||
da2->bitblt.destaddr -= 2;
|
da2->bitblt.destaddr -= 2;
|
||||||
da2->bitblt.size_x += 1;
|
da2->bitblt.size_x += 1;
|
||||||
da2->bitblt.destpitch -= 2;
|
da2->bitblt.destpitch -= 2;
|
||||||
@@ -892,9 +889,9 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.size_x, da2->bitblt.size_y);
|
da2->bitblt.size_x, da2->bitblt.size_y);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
/* Draw a line */
|
/* Draw a line */
|
||||||
else if (da2->bitblt.reg[0x5] == 0x43) {
|
} else if (da2->bitblt.reg[0x5] == 0x43) {
|
||||||
da2->bitblt.exec = DA2_BLT_CLINE;
|
da2->bitblt.exec = DA2_BLT_CLINE;
|
||||||
da2->bitblt.dest_x = (da2->bitblt.reg[0x32] & 0xffff);
|
da2->bitblt.dest_x = (da2->bitblt.reg[0x32] & 0xffff);
|
||||||
da2->bitblt.dest_y = (da2->bitblt.reg[0x34] & 0xffff);
|
da2->bitblt.dest_y = (da2->bitblt.reg[0x34] & 0xffff);
|
||||||
@@ -922,17 +919,17 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
da2_log(" ux1=%d,ux2=%d,uy1=%d,uy2=%d\n",
|
da2_log(" ux1=%d,ux2=%d,uy1=%d,uy2=%d\n",
|
||||||
(da2->bitblt.reg[0x32] >> 16) & 0x7ff, (da2->bitblt.reg[0x33] >> 16) & 0x7ff,
|
(da2->bitblt.reg[0x32] >> 16) & 0x7ff, (da2->bitblt.reg[0x33] >> 16) & 0x7ff,
|
||||||
(da2->bitblt.reg[0x34] >> 16) & 0x7ff, (da2->bitblt.reg[0x35] >> 16) & 0x7ff);
|
(da2->bitblt.reg[0x34] >> 16) & 0x7ff, (da2->bitblt.reg[0x35] >> 16) & 0x7ff);
|
||||||
}
|
|
||||||
/* Fill a rectangle (or draw a horizontal / vertical line) */
|
/* Fill a rectangle (or draw a horizontal / vertical line) */
|
||||||
else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x40 && da2->bitblt.reg[0x3D] == 0) {
|
} else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x40 && da2->bitblt.reg[0x3D] == 0) {
|
||||||
da2_log("fillrect x=%d, y=%d, w=%d, h=%d, c=%d, 2f=%x, rowcount=%x\n",
|
da2_log("fillrect x=%d, y=%d, w=%d, h=%d, c=%d, 2f=%x, rowcount=%x\n",
|
||||||
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.size_x, da2->bitblt.size_y, da2->bitblt.reg[0x0], da2->bitblt.reg[0x2F], da2->rowoffset * 2);
|
da2->bitblt.size_x, da2->bitblt.size_y, da2->bitblt.reg[0x0], da2->bitblt.reg[0x2F], da2->rowoffset * 2);
|
||||||
da2->bitblt.exec = DA2_BLT_CFILLRECT;
|
da2->bitblt.exec = DA2_BLT_CFILLRECT;
|
||||||
da2->bitblt.destaddr += 2;
|
da2->bitblt.destaddr += 2;
|
||||||
}
|
|
||||||
/* Tiling a rectangle ??(transfer tile data multiple times) os/2 only */
|
/* Tiling a rectangle ??(transfer tile data multiple times) os/2 only */
|
||||||
else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x0040 && da2->bitblt.reg[0x3D] == 0x40) {
|
} else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x0040 && da2->bitblt.reg[0x3D] == 0x40) {
|
||||||
da2->bitblt.exec = DA2_BLT_CFILLTILE;
|
da2->bitblt.exec = DA2_BLT_CFILLTILE;
|
||||||
da2->bitblt.destaddr += 2;
|
da2->bitblt.destaddr += 2;
|
||||||
da2->bitblt.srcaddr = da2->bitblt.reg[0x2B];
|
da2->bitblt.srcaddr = da2->bitblt.reg[0x2B];
|
||||||
@@ -942,9 +939,9 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.size_x, da2->bitblt.size_y);
|
da2->bitblt.size_x, da2->bitblt.size_y);
|
||||||
}
|
|
||||||
/* Tiling a rectangle (transfer tile data multiple times) */
|
/* Tiling a rectangle (transfer tile data multiple times) */
|
||||||
else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x40) {
|
} else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x40) {
|
||||||
da2->bitblt.exec = DA2_BLT_CFILLTILE;
|
da2->bitblt.exec = DA2_BLT_CFILLTILE;
|
||||||
da2->bitblt.destaddr += 2;
|
da2->bitblt.destaddr += 2;
|
||||||
da2->bitblt.srcaddr = da2->bitblt.reg[0x2B];
|
da2->bitblt.srcaddr = da2->bitblt.reg[0x2B];
|
||||||
@@ -954,9 +951,9 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.size_x, da2->bitblt.size_y);
|
da2->bitblt.size_x, da2->bitblt.size_y);
|
||||||
}
|
|
||||||
/* Block copy */
|
/* Block copy */
|
||||||
else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x00) {
|
} else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x00) {
|
||||||
da2->bitblt.exec = DA2_BLT_CCOPYF;
|
da2->bitblt.exec = DA2_BLT_CCOPYF;
|
||||||
da2->bitblt.srcaddr = da2->bitblt.reg[0x2A];
|
da2->bitblt.srcaddr = da2->bitblt.reg[0x2A];
|
||||||
da2->bitblt.destaddr += 2;
|
da2->bitblt.destaddr += 2;
|
||||||
@@ -965,9 +962,9 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
da2->bitblt.reg[0x2A] % (da2->rowoffset * 2), da2->bitblt.reg[0x2A] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x2A] % (da2->rowoffset * 2), da2->bitblt.reg[0x2A] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2),
|
||||||
da2->bitblt.size_x, da2->bitblt.size_y);
|
da2->bitblt.size_x, da2->bitblt.size_y);
|
||||||
}
|
|
||||||
/* Block copy but reversed direction */
|
/* Block copy but reversed direction */
|
||||||
else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1140 && da2->bitblt.reg[0x3D] == 0x00) {
|
} else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1140 && da2->bitblt.reg[0x3D] == 0x00) {
|
||||||
da2->bitblt.exec = DA2_BLT_CCOPYR;
|
da2->bitblt.exec = DA2_BLT_CCOPYR;
|
||||||
da2->bitblt.srcaddr = da2->bitblt.reg[0x2A];
|
da2->bitblt.srcaddr = da2->bitblt.reg[0x2A];
|
||||||
da2->bitblt.destaddr -= 2;
|
da2->bitblt.destaddr -= 2;
|
||||||
@@ -980,9 +977,9 @@ da2_bitblt_load(da2_t *da2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_bitblt_exec(void *p)
|
da2_bitblt_exec(void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// timer_set_delay_u64(&da2->bitblt.timer, da2->bitblt.timerspeed);
|
// timer_set_delay_u64(&da2->bitblt.timer, da2->bitblt.timerspeed);
|
||||||
#ifdef ENABLE_DA2_DEBUGBLT_DETAIL
|
#ifdef ENABLE_DA2_DEBUGBLT_DETAIL
|
||||||
if (!(da2->bitblt.debug_exesteps & 0xff))
|
if (!(da2->bitblt.debug_exesteps & 0xff))
|
||||||
@@ -1180,9 +1177,9 @@ da2_bitblt_dopayload(void *priv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_bitblt_addpayload(uint8_t val, void *p)
|
da2_bitblt_addpayload(uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->bitblt.indata = 1;
|
da2->bitblt.indata = 1;
|
||||||
if (da2->bitblt.payload_addr >= DA2_BLT_MEMSIZE)
|
if (da2->bitblt.payload_addr >= DA2_BLT_MEMSIZE)
|
||||||
da2_log("da2_mmio_write payload overflow! addr %x, val %x\n", da2->bitblt.payload_addr, val);
|
da2_log("da2_mmio_write payload overflow! addr %x, val %x\n", da2->bitblt.payload_addr, val);
|
||||||
@@ -1222,9 +1219,9 @@ da2_bitblt_addpayload(uint8_t val, void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_out(uint16_t addr, uint16_t val, void *p)
|
da2_out(uint16_t addr, uint16_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
int oldval;
|
int oldval;
|
||||||
/*
|
/*
|
||||||
3E0 3E1 Sequencer Registers (undoc)
|
3E0 3E1 Sequencer Registers (undoc)
|
||||||
@@ -1403,7 +1400,7 @@ da2_out(uint16_t addr, uint16_t val, void *p)
|
|||||||
if (da2->attraddr < 16)
|
if (da2->attraddr < 16)
|
||||||
da2->fullchange = changeframecount;
|
da2->fullchange = changeframecount;
|
||||||
if (da2->attraddr == LV_MODE_CONTROL || da2->attraddr < 0x10) {
|
if (da2->attraddr == LV_MODE_CONTROL || da2->attraddr < 0x10) {
|
||||||
for (int c = 0; c < 16; c++) {
|
for (uint8_t c = 0; c < 16; c++) {
|
||||||
// if (da2->attrc[LV_MODE_CONTROL] & 0x80) da2->egapal[c] = (da2->attrc[c] & 0xf) | ((da2->attrc[0x14] & 0xf) << 4);
|
// if (da2->attrc[LV_MODE_CONTROL] & 0x80) da2->egapal[c] = (da2->attrc[c] & 0xf) | ((da2->attrc[0x14] & 0xf) << 4);
|
||||||
// else da2->egapal[c] = (da2->attrc[c] & 0x3f) | ((da2->attrc[0x14] & 0xc) << 4);
|
// else da2->egapal[c] = (da2->attrc[c] & 0x3f) | ((da2->attrc[0x14] & 0xc) << 4);
|
||||||
if (da2->attrc[LV_MODE_CONTROL] & 0x80)
|
if (da2->attrc[LV_MODE_CONTROL] & 0x80)
|
||||||
@@ -1486,9 +1483,9 @@ da2_out(uint16_t addr, uint16_t val, void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static uint16_t
|
||||||
da2_in(uint16_t addr, void *p)
|
da2_in(uint16_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint16_t temp = 0xff;
|
uint16_t temp = 0xff;
|
||||||
|
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
@@ -1620,9 +1617,9 @@ da2_in(uint16_t addr, void *p)
|
|||||||
* out b(idx), in w(data)
|
* out b(idx), in w(data)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
da2_outb(uint16_t addr, uint8_t val, void *p)
|
da2_outb(uint16_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2_iolog("DA2 Outb addr %03X val %02X %04X:%04X es:di=%x:%x ds:si=%x:%x\n", addr, val, cs >> 4, cpu_state.pc, ES, DI, DS, SI);
|
da2_iolog("DA2 Outb addr %03X val %02X %04X:%04X es:di=%x:%x ds:si=%x:%x\n", addr, val, cs >> 4, cpu_state.pc, ES, DI, DS, SI);
|
||||||
da2->inflipflop = 0;
|
da2->inflipflop = 0;
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
@@ -1651,10 +1648,10 @@ da2_outb(uint16_t addr, uint8_t val, void *p)
|
|||||||
da2_out(addr, da2->iolatch, da2);
|
da2_out(addr, da2->iolatch, da2);
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
da2_outw(uint16_t addr, uint16_t val, void *p)
|
da2_outw(uint16_t addr, uint16_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_iolog("DA2 Outw addr %03X val %04X\n", addr, val);
|
da2_iolog("DA2 Outw addr %03X val %04X\n", addr, val);
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->inflipflop = 0;
|
da2->inflipflop = 0;
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
case LS_INDEX:
|
case LS_INDEX:
|
||||||
@@ -1703,10 +1700,10 @@ da2_outw(uint16_t addr, uint16_t val, void *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_inb(uint16_t addr, void *p)
|
da2_inb(uint16_t addr, void *priv)
|
||||||
{
|
{
|
||||||
uint8_t temp;
|
uint8_t temp;
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->outflipflop = 0;
|
da2->outflipflop = 0;
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
case LC_DATA:
|
case LC_DATA:
|
||||||
@@ -1736,10 +1733,10 @@ da2_inb(uint16_t addr, void *p)
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
static uint16_t
|
static uint16_t
|
||||||
da2_inw(uint16_t addr, void *p)
|
da2_inw(uint16_t addr, void *priv)
|
||||||
{
|
{
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->inflipflop = 0;
|
da2->inflipflop = 0;
|
||||||
da2->outflipflop = 0;
|
da2->outflipflop = 0;
|
||||||
temp = da2_in(addr, da2);
|
temp = da2_in(addr, da2);
|
||||||
@@ -1748,9 +1745,9 @@ da2_inw(uint16_t addr, void *p)
|
|||||||
}
|
}
|
||||||
/* IO 03DAh : Input Status Register 2 for DOSSHELL used by DOS J4.0 */
|
/* IO 03DAh : Input Status Register 2 for DOSSHELL used by DOS J4.0 */
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_in_ISR(uint16_t addr, void *p)
|
da2_in_ISR(uint16_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint8_t temp = 0;
|
uint8_t temp = 0;
|
||||||
if (addr == 0x3da) {
|
if (addr == 0x3da) {
|
||||||
if (da2->cgastat & 0x01)
|
if (da2->cgastat & 0x01)
|
||||||
@@ -1764,9 +1761,9 @@ da2_in_ISR(uint16_t addr, void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_out_ISR(uint16_t addr, uint8_t val, void *p)
|
da2_out_ISR(uint16_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
// da2_t* da2 = (da2_t*)p;
|
// da2_t* da2 = (da2_t*) priv;
|
||||||
da2_iolog("DA2D Out %04X %04X %04X:%04X\n", addr, val, cs >> 4, cpu_state.pc);
|
da2_iolog("DA2D Out %04X %04X %04X:%04X\n", addr, val, cs >> 4, cpu_state.pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1872,9 +1869,9 @@ The Font ROM can be accessed via 128 KB memory window located at A0000-BFFFFh.
|
|||||||
|
|
||||||
/* Get character line pattern from jfont rom or gaiji volatile memory */
|
/* Get character line pattern from jfont rom or gaiji volatile memory */
|
||||||
static uint32_t
|
static uint32_t
|
||||||
getfont_ps55dbcs(int32_t code, int32_t line, void *p)
|
getfont_ps55dbcs(int32_t code, int32_t line, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint32_t font = 0;
|
uint32_t font = 0;
|
||||||
int32_t fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */
|
int32_t fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */
|
||||||
if (code >= 0x8000 && code <= 0x8183)
|
if (code >= 0x8000 && code <= 0x8183)
|
||||||
@@ -2424,7 +2421,7 @@ da2_mapping_update(da2_t *da2)
|
|||||||
// da2_recalc_mapping(da2);
|
// da2_recalc_mapping(da2);
|
||||||
if (da2->pos_regs[2] & 0x01) {
|
if (da2->pos_regs[2] & 0x01) {
|
||||||
da2_log("DA2 enable registers\n");
|
da2_log("DA2 enable registers\n");
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2_log("DA2 POS[%d]: %x\n", i, da2->pos_regs[i]);
|
da2_log("DA2 POS[%d]: %x\n", i, da2->pos_regs[i]);
|
||||||
io_sethandler(0x03c0, 0x000a, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2);
|
io_sethandler(0x03c0, 0x000a, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2);
|
||||||
io_sethandler(0x03e0, 0x0010, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2);
|
io_sethandler(0x03e0, 0x0010, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2);
|
||||||
@@ -2444,16 +2441,16 @@ da2_mapping_update(da2_t *da2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_mca_read(int port, void *p)
|
da2_mca_read(int port, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
return da2->pos_regs[port & 7];
|
return da2->pos_regs[port & 7];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_mca_write(int port, uint8_t val, void *p)
|
da2_mca_write(int port, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
|
|
||||||
da2_log("da2_mca_write: port=%04x val=%02x\n", port, val);
|
da2_log("da2_mca_write: port=%04x val=%02x\n", port, val);
|
||||||
|
|
||||||
@@ -2473,9 +2470,9 @@ da2_mca_feedb(void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_mca_reset(void *p)
|
da2_mca_reset(void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2_log("da2_mca_reset called.\n");
|
da2_log("da2_mca_reset called.\n");
|
||||||
da2_reset(da2);
|
da2_reset(da2);
|
||||||
da2_mca_write(0x102, 0, da2);
|
da2_mca_write(0x102, 0, da2);
|
||||||
@@ -2485,7 +2482,7 @@ da2_mca_reset(void *p)
|
|||||||
static void
|
static void
|
||||||
da2_gdcropB(uint32_t addr,uint8_t bitmask, da2_t *da2)
|
da2_gdcropB(uint32_t addr,uint8_t bitmask, da2_t *da2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (da2->planemask & (1 << i)) {
|
if (da2->planemask & (1 << i)) {
|
||||||
// da2_log("da2_gdcropB o%x a%x d%x p%d m%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, bitmask);
|
// da2_log("da2_gdcropB o%x a%x d%x p%d m%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, bitmask);
|
||||||
switch (da2->gdcreg[LG_COMMAND] & 0x03) {
|
switch (da2->gdcreg[LG_COMMAND] & 0x03) {
|
||||||
@@ -2518,7 +2515,7 @@ da2_gdcropW(uint32_t addr, uint16_t bitmask, da2_t *da2)
|
|||||||
// if((addr & 8)) bitmask = da2_rightrotate(bitmask, 8);
|
// if((addr & 8)) bitmask = da2_rightrotate(bitmask, 8);
|
||||||
uint8_t bitmask_l = bitmask & 0xff;
|
uint8_t bitmask_l = bitmask & 0xff;
|
||||||
uint8_t bitmask_h = bitmask >> 8;
|
uint8_t bitmask_h = bitmask >> 8;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (da2->planemask & (1 << i)) {
|
if (da2->planemask & (1 << i)) {
|
||||||
// da2_log("da2_gdcropW m%x a%x d%x i%d ml%x mh%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, da2->gdcreg[LG_BIT_MASK_LOW], da2->gdcreg[LG_BIT_MASK_HIGH]);
|
// da2_log("da2_gdcropW m%x a%x d%x i%d ml%x mh%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, da2->gdcreg[LG_BIT_MASK_LOW], da2->gdcreg[LG_BIT_MASK_HIGH]);
|
||||||
switch (da2->gdcreg[LG_COMMAND] & 0x03) {
|
switch (da2->gdcreg[LG_COMMAND] & 0x03) {
|
||||||
@@ -2556,9 +2553,9 @@ da2_gdcropW(uint32_t addr, uint16_t bitmask, da2_t *da2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_mmio_read(uint32_t addr, void *p)
|
da2_mmio_read(uint32_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
addr &= DA2_MASK_MMIO;
|
addr &= DA2_MASK_MMIO;
|
||||||
if (da2->ioctl[LS_MMIO] & 0x10) {
|
if (da2->ioctl[LS_MMIO] & 0x10) {
|
||||||
@@ -2604,14 +2601,14 @@ da2_mmio_read(uint32_t addr, void *p)
|
|||||||
}
|
}
|
||||||
} else if (!(da2->ioctl[LS_MODE] & 1)) { /* 16 or 256 color mode */
|
} else if (!(da2->ioctl[LS_MODE] & 1)) { /* 16 or 256 color mode */
|
||||||
cycles -= video_timing_read_b;
|
cycles -= video_timing_read_b;
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcla[i] = da2->vram[(addr << 3) | i]; /* read in byte */
|
da2->gdcla[i] = da2->vram[(addr << 3) | i]; /* read in byte */
|
||||||
#ifdef ENABLE_DA2_DEBUGVRAM
|
#ifdef ENABLE_DA2_DEBUGVRAM
|
||||||
da2_log("da2_Rb: %05x=%02x\n", addr, da2->gdcla[da2->readplane]);
|
da2_log("da2_Rb: %05x=%02x\n", addr, da2->gdcla[da2->readplane]);
|
||||||
#endif
|
#endif
|
||||||
if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */
|
if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */
|
||||||
uint8_t ret = 0;
|
uint8_t ret = 0;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */
|
if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */
|
||||||
ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xff : 0);
|
ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xff : 0);
|
||||||
}
|
}
|
||||||
@@ -2624,9 +2621,9 @@ da2_mmio_read(uint32_t addr, void *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint16_t
|
static uint16_t
|
||||||
da2_mmio_readw(uint32_t addr, void *p)
|
da2_mmio_readw(uint32_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// da2_log("da2_readW: %x %x %x %x %x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr);
|
// da2_log("da2_readW: %x %x %x %x %x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr);
|
||||||
// da2_log("da2_readW: %x %x %x %x %x CS:PC=%4x:%4x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr, CS, cpu_state.pc);
|
// da2_log("da2_readW: %x %x %x %x %x CS:PC=%4x:%4x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr, CS, cpu_state.pc);
|
||||||
|
|
||||||
@@ -2635,7 +2632,7 @@ da2_mmio_readw(uint32_t addr, void *p)
|
|||||||
} else if (!(da2->ioctl[LS_MODE] & 1)) {/* 16 color or 256 color mode */
|
} else if (!(da2->ioctl[LS_MODE] & 1)) {/* 16 color or 256 color mode */
|
||||||
cycles -= video_timing_read_w;
|
cycles -= video_timing_read_w;
|
||||||
addr &= DA2_MASK_MMIO;
|
addr &= DA2_MASK_MMIO;
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcla[i] = (uint16_t) (da2->vram[(addr << 3) | i]) | ((uint16_t) (da2->vram[((addr << 3) + 8) | i]) << 8); /* read vram into latch */
|
da2->gdcla[i] = (uint16_t) (da2->vram[(addr << 3) | i]) | ((uint16_t) (da2->vram[((addr << 3) + 8) | i]) << 8); /* read vram into latch */
|
||||||
|
|
||||||
#ifdef ENABLE_DA2_DEBUGVRAM
|
#ifdef ENABLE_DA2_DEBUGVRAM
|
||||||
@@ -2643,10 +2640,10 @@ da2_mmio_readw(uint32_t addr, void *p)
|
|||||||
// if (((int)addr - (int)da2->mmrdbg_vidaddr) > 2 || (((int)da2->mmrdbg_vidaddr - (int)addr) > 2) || da2->mmrdbg_vidaddr == addr)
|
// if (((int)addr - (int)da2->mmrdbg_vidaddr) > 2 || (((int)da2->mmrdbg_vidaddr - (int)addr) > 2) || da2->mmrdbg_vidaddr == addr)
|
||||||
//{
|
//{
|
||||||
// fprintf(da2->mmrdbg_fp, "\nR %x ", addr);
|
// fprintf(da2->mmrdbg_fp, "\nR %x ", addr);
|
||||||
// for (int i = 0; i <= 0xb; i++)
|
// for (uint8_t i = 0; i <= 0xb; i++)
|
||||||
// fprintf(da2->mmrdbg_fp, "%02x ", da2->gdcreg[i]);
|
// fprintf(da2->mmrdbg_fp, "%02x ", da2->gdcreg[i]);
|
||||||
// }
|
// }
|
||||||
// for (int i = 0; i < 16; i++)
|
// for (uint8_t i = 0; i < 16; i++)
|
||||||
//{
|
//{
|
||||||
// int pixeldata = 0;
|
// int pixeldata = 0;
|
||||||
// if (da2->gdcla[da2->readplane] & (1 << (15 - i))) pixeldata = 1;
|
// if (da2->gdcla[da2->readplane] & (1 << (15 - i))) pixeldata = 1;
|
||||||
@@ -2658,7 +2655,7 @@ da2_mmio_readw(uint32_t addr, void *p)
|
|||||||
if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */
|
if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */
|
||||||
uint16_t ret = 0;
|
uint16_t ret = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */
|
if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */
|
||||||
ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xffff : 0);
|
ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xffff : 0);
|
||||||
}
|
}
|
||||||
@@ -2674,9 +2671,9 @@ da2_mmio_readw(uint32_t addr, void *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
da2_mmio_write(uint32_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
// da2_log("da2_mmio_write %x %x\n", addr, val);
|
// da2_log("da2_mmio_write %x %x\n", addr, val);
|
||||||
// if ((addr & ~DA2_MASK_MMIO) != 0xA0000)
|
// if ((addr & ~DA2_MASK_MMIO) != 0xA0000)
|
||||||
@@ -2735,10 +2732,10 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
//{
|
//{
|
||||||
if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) {
|
if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) {
|
||||||
fprintf(da2->mmdbg_fp, "\nB %x %02x ", addr, val);
|
fprintf(da2->mmdbg_fp, "\nB %x %02x ", addr, val);
|
||||||
for (int i = 0; i <= 0xb; i++)
|
for (uint8_t i = 0; i <= 0xb; i++)
|
||||||
fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]);
|
fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
int pixeldata = 0;
|
int pixeldata = 0;
|
||||||
if (val & (1 << (7 - i)))
|
if (val & (1 << (7 - i)))
|
||||||
pixeldata = (da2->planemask & 0xf);
|
pixeldata = (da2->planemask & 0xf);
|
||||||
@@ -2751,14 +2748,14 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
da2->changedvram[addr >> 9] = changeframecount;/* 0x1FFFF -> 0x1F */
|
da2->changedvram[addr >> 9] = changeframecount;/* 0x1FFFF -> 0x1F */
|
||||||
addr <<= 3;
|
addr <<= 3;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */
|
da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */
|
||||||
|
|
||||||
// da2_log("da2_Wb m%02x r%02x %05x:%02x %x:%x\n", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, cs >> 4, cpu_state.pc);
|
// da2_log("da2_Wb m%02x r%02x %05x:%02x %x:%x\n", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, cs >> 4, cpu_state.pc);
|
||||||
// da2_log("da2_Wb m%02x r%02x %05x:%02x=%02x%02x%02x%02x->", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, da2->vram[addr + 0], da2->vram[addr + 1], da2->vram[addr + 2], da2->vram[addr + 3]);
|
// da2_log("da2_Wb m%02x r%02x %05x:%02x=%02x%02x%02x%02x->", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, da2->vram[addr + 0], da2->vram[addr + 1], da2->vram[addr + 2], da2->vram[addr + 3]);
|
||||||
|
|
||||||
if (!(da2->gdcreg[LG_COMMAND] & 0x08)) {
|
if (!(da2->gdcreg[LG_COMMAND] & 0x08)) {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
||||||
else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i))
|
else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i))
|
||||||
@@ -2771,7 +2768,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
|
|
||||||
switch (da2->writemode) {
|
switch (da2->writemode) {
|
||||||
case 2: /* equiv to vga write mode 1 */
|
case 2: /* equiv to vga write mode 1 */
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->planemask & (1 << i))
|
if (da2->planemask & (1 << i))
|
||||||
da2_vram_w(addr | i, da2->gdcsrc[i], da2);
|
da2_vram_w(addr | i, da2->gdcsrc[i], da2);
|
||||||
break;
|
break;
|
||||||
@@ -2779,11 +2776,11 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
if (da2->gdcreg[LG_DATA_ROTATION] & 7)
|
if (da2->gdcreg[LG_DATA_ROTATION] & 7)
|
||||||
val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val];
|
val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val];
|
||||||
if (bitmask == 0xff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) {
|
if (bitmask == 0xff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->planemask & (1 << i))
|
if (da2->planemask & (1 << i))
|
||||||
da2_vram_w(addr | i, val, da2);
|
da2_vram_w(addr | i, val, da2);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
||||||
else
|
else
|
||||||
@@ -2792,7 +2789,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:/* equiv to vga write mode 2 */
|
case 1:/* equiv to vga write mode 2 */
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcinput[i] = ((val & (1 << i)) ? 0xff : 0);
|
da2->gdcinput[i] = ((val & (1 << i)) ? 0xff : 0);
|
||||||
da2_gdcropB(addr, bitmask, da2);
|
da2_gdcropB(addr, bitmask, da2);
|
||||||
break;
|
break;
|
||||||
@@ -2801,7 +2798,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p)
|
|||||||
val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val];
|
val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val];
|
||||||
bitmask &= val;
|
bitmask &= val;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0;
|
||||||
da2_gdcropB(addr, bitmask, da2);
|
da2_gdcropB(addr, bitmask, da2);
|
||||||
break;
|
break;
|
||||||
@@ -2818,9 +2815,9 @@ da2_rightrotate(uint16_t data, uint8_t count)
|
|||||||
return (data >> count) | (data << (sizeof(data) * 8 - count));
|
return (data >> count) | (data << (sizeof(data) * 8 - count));
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint16_t bitmask;
|
uint16_t bitmask;
|
||||||
addr &= DA2_MASK_MMIO;
|
addr &= DA2_MASK_MMIO;
|
||||||
bitmask = da2->gdcreg[LG_BIT_MASK_HIGH];
|
bitmask = da2->gdcreg[LG_BIT_MASK_HIGH];
|
||||||
@@ -2832,10 +2829,10 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
|
|
||||||
if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) {
|
if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) {
|
||||||
fprintf(da2->mmdbg_fp, "\nW %x %x ", addr, val);
|
fprintf(da2->mmdbg_fp, "\nW %x %x ", addr, val);
|
||||||
for (int i = 0; i <= 0xb; i++)
|
for (uint8_t i = 0; i <= 0xb; i++)
|
||||||
fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]);
|
fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 16; i++) {
|
for (uint8_t i = 0; i < 16; i++) {
|
||||||
int pixeldata = 0;
|
int pixeldata = 0;
|
||||||
if (val & (1 << (15 - i)))
|
if (val & (1 << (15 - i)))
|
||||||
pixeldata = (da2->planemask & 0xf);
|
pixeldata = (da2->planemask & 0xf);
|
||||||
@@ -2851,11 +2848,11 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
da2->changedvram[addr >> 9] = changeframecount;
|
da2->changedvram[addr >> 9] = changeframecount;
|
||||||
addr <<= 3;
|
addr <<= 3;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */
|
da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */
|
||||||
|
|
||||||
if (!(da2->gdcreg[LG_COMMAND] & 0x08)) {
|
if (!(da2->gdcreg[LG_COMMAND] & 0x08)) {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
||||||
else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i))
|
else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i))
|
||||||
@@ -2869,7 +2866,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
// , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]);
|
// , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]);
|
||||||
switch (da2->writemode) {
|
switch (da2->writemode) {
|
||||||
case 2:
|
case 2:
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->planemask & (1 << i)) {
|
if (da2->planemask & (1 << i)) {
|
||||||
da2_vram_w(addr | i, da2->gdcsrc[i] & 0xff, da2);
|
da2_vram_w(addr | i, da2->gdcsrc[i] & 0xff, da2);
|
||||||
da2_vram_w((addr + 8) | i, da2->gdcsrc[i] >> 8, da2);
|
da2_vram_w((addr + 8) | i, da2->gdcsrc[i] >> 8, da2);
|
||||||
@@ -2879,13 +2876,13 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
if (da2->gdcreg[LG_DATA_ROTATION] & 15)
|
if (da2->gdcreg[LG_DATA_ROTATION] & 15)
|
||||||
val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15);
|
val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15);
|
||||||
if (bitmask == 0xffff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) {
|
if (bitmask == 0xffff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->planemask & (1 << i)) {
|
if (da2->planemask & (1 << i)) {
|
||||||
da2_vram_w(addr | i, val & 0xff, da2);
|
da2_vram_w(addr | i, val & 0xff, da2);
|
||||||
da2_vram_w((addr + 8) | i, val >> 8, da2);
|
da2_vram_w((addr + 8) | i, val >> 8, da2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i))
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
||||||
else
|
else
|
||||||
@@ -2895,7 +2892,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcinput[i] = ((val & (1 << i)) ? 0xffff : 0);
|
da2->gdcinput[i] = ((val & (1 << i)) ? 0xffff : 0);
|
||||||
da2_gdcropW(addr, bitmask, da2);
|
da2_gdcropW(addr, bitmask, da2);
|
||||||
break;
|
break;
|
||||||
@@ -2904,7 +2901,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15);
|
val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15);
|
||||||
bitmask &= val;
|
bitmask &= val;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0;
|
||||||
da2_gdcropW(addr, bitmask, da2);
|
da2_gdcropW(addr, bitmask, da2);
|
||||||
break;
|
break;
|
||||||
@@ -2913,9 +2910,9 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p)
|
|||||||
// , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]);
|
// , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]);
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_mmio_writew(uint32_t addr, uint16_t val, void *p)
|
da2_mmio_writew(uint32_t addr, uint16_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// if (da2->bitblt.exec != DA2_BLT_CIDLE) /* Bitblt is in operation. */
|
// if (da2->bitblt.exec != DA2_BLT_CIDLE) /* Bitblt is in operation. */
|
||||||
// return;
|
// return;
|
||||||
// if ((addr & ~0x1ffff) != 0xA0000) return;
|
// if ((addr & ~0x1ffff) != 0xA0000) return;
|
||||||
@@ -2941,52 +2938,52 @@ da2_mmio_writew(uint32_t addr, uint16_t val, void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_code_write(uint32_t addr, uint8_t val, void *p)
|
da2_code_write(uint32_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// if ((addr & ~0xfff) != 0xE0000) return;
|
// if ((addr & ~0xfff) != 0xE0000) return;
|
||||||
addr &= DA2_MASK_CRAM;
|
addr &= DA2_MASK_CRAM;
|
||||||
da2->cram[addr] = val;
|
da2->cram[addr] = val;
|
||||||
da2->fullchange = 2;
|
da2->fullchange = 2;
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_code_writeb(uint32_t addr, uint8_t val, void *p)
|
da2_code_writeb(uint32_t addr, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// da2_log("DA2_code_writeb: Write to %x, val %x\n", addr, val);
|
// da2_log("DA2_code_writeb: Write to %x, val %x\n", addr, val);
|
||||||
cycles -= video_timing_write_b;
|
cycles -= video_timing_write_b;
|
||||||
da2_code_write(addr, val, da2);
|
da2_code_write(addr, val, da2);
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
da2_code_writew(uint32_t addr, uint16_t val, void *p)
|
da2_code_writew(uint32_t addr, uint16_t val, void *priv)
|
||||||
{
|
{
|
||||||
// da2_log("DA2_code_writ ew: Write to %x, val %x\n", addr, val);
|
// da2_log("DA2_code_writ ew: Write to %x, val %x\n", addr, val);
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
cycles -= video_timing_write_w;
|
cycles -= video_timing_write_w;
|
||||||
da2_code_write(addr, val & 0xff, da2);
|
da2_code_write(addr, val & 0xff, da2);
|
||||||
da2_code_write(addr + 1, val >> 8, da2);
|
da2_code_write(addr + 1, val >> 8, da2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_code_read(uint32_t addr, void *p)
|
da2_code_read(uint32_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
// if ((addr & ~DA2_MASK_CRAM) != 0xE0000)
|
// if ((addr & ~DA2_MASK_CRAM) != 0xE0000)
|
||||||
// return DA2_INVALIDACCESS8;
|
// return DA2_INVALIDACCESS8;
|
||||||
addr &= DA2_MASK_CRAM;
|
addr &= DA2_MASK_CRAM;
|
||||||
return da2->cram[addr];
|
return da2->cram[addr];
|
||||||
}
|
}
|
||||||
static uint8_t
|
static uint8_t
|
||||||
da2_code_readb(uint32_t addr, void *p)
|
da2_code_readb(uint32_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
cycles -= video_timing_read_b;
|
cycles -= video_timing_read_b;
|
||||||
return da2_code_read(addr, da2);
|
return da2_code_read(addr, da2);
|
||||||
}
|
}
|
||||||
static uint16_t
|
static uint16_t
|
||||||
da2_code_readw(uint32_t addr, void *p)
|
da2_code_readw(uint32_t addr, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
cycles -= video_timing_read_w;
|
cycles -= video_timing_read_w;
|
||||||
return da2_code_read(addr, da2) | (da2_code_read(addr + 1, da2) << 8);
|
return da2_code_read(addr, da2) | (da2_code_read(addr + 1, da2) << 8);
|
||||||
}
|
}
|
||||||
@@ -3153,9 +3150,9 @@ da2_poll(void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_loadfont(char *fname, void *p)
|
da2_loadfont(char *fname, void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
uint8_t buf;
|
uint8_t buf;
|
||||||
uint64_t fsize;
|
uint64_t fsize;
|
||||||
if (!fname)
|
if (!fname)
|
||||||
@@ -3239,7 +3236,7 @@ da2_reset(void *priv)
|
|||||||
da2->attr_palette_enable = 0; /* disable attribute generator */
|
da2->attr_palette_enable = 0; /* disable attribute generator */
|
||||||
|
|
||||||
/* Set default color palette (Windows 3.1 display driver won't reset palette) */
|
/* Set default color palette (Windows 3.1 display driver won't reset palette) */
|
||||||
for (int i = 0; i < 256; i++) {
|
for (uint16_t i = 0; i < 256; i++) {
|
||||||
da2->vgapal[i].r = ps55_palette_color[i & 0x3F][0];
|
da2->vgapal[i].r = ps55_palette_color[i & 0x3F][0];
|
||||||
da2->vgapal[i].g = ps55_palette_color[i & 0x3F][1];
|
da2->vgapal[i].g = ps55_palette_color[i & 0x3F][1];
|
||||||
da2->vgapal[i].b = ps55_palette_color[i & 0x3F][2];
|
da2->vgapal[i].b = ps55_palette_color[i & 0x3F][2];
|
||||||
@@ -3320,95 +3317,95 @@ da2_available(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_close(void *p)
|
da2_close(void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
|
|
||||||
/* dump mem for debug */
|
/* dump mem for debug */
|
||||||
#ifdef ENABLE_DA2_LOG
|
#ifdef ENABLE_DA2_LOG
|
||||||
FILE *f;
|
FILE *fp;
|
||||||
f = fopen("da2_cram.dmp", "wb");
|
fp = fopen("da2_cram.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(da2->cram, DA2_SIZE_CRAM, 1, f);
|
fwrite(da2->cram, DA2_SIZE_CRAM, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("da2_vram.dmp", "wb");
|
fp = fopen("da2_vram.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(da2->vram, DA2_SIZE_VRAM, 1, f);
|
fwrite(da2->vram, DA2_SIZE_VRAM, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("da2_gram.dmp", "wb");
|
fp = fopen("da2_gram.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(da2->mmio.ram, DA2_SIZE_GAIJIRAM, 1, f);
|
fwrite(da2->mmio.ram, DA2_SIZE_GAIJIRAM, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("da2_attrpal.dmp", "wb");
|
fp = fopen("da2_attrpal.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(da2->attrc, 32, 1, f);
|
fwrite(da2->attrc, 32, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("da2_dacrgb.dmp", "wb");
|
fp = fopen("da2_dacrgb.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(da2->vgapal, 3 * 256, 1, f);
|
fwrite(da2->vgapal, 3 * 256, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("da2_daregs.txt", "w");
|
fp = fopen("da2_daregs.txt", "w");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
for (int i = 0; i < 0x10; i++)
|
for (uint8_t i = 0; i < 0x10; i++)
|
||||||
fprintf(f, "3e1(ioctl) %02X: %4X\n", i, da2->ioctl[i]);
|
fprintf(fp, "3e1(ioctl) %02X: %4X\n", i, da2->ioctl[i]);
|
||||||
for (int i = 0; i < 0x20; i++)
|
for (uint8_t i = 0; i < 0x20; i++)
|
||||||
fprintf(f, "3e3(fctl) %02X: %4X\n", i, da2->fctl[i]);
|
fprintf(fp, "3e3(fctl) %02X: %4X\n", i, da2->fctl[i]);
|
||||||
for (int i = 0; i < 0x20; i++)
|
for (uint8_t i = 0; i < 0x20; i++)
|
||||||
fprintf(f, "3e5(crtc) %02X: %4X\n", i, da2->crtc[i]);
|
fprintf(fp, "3e5(crtc) %02X: %4X\n", i, da2->crtc[i]);
|
||||||
for (int i = 0; i < 0x40; i++)
|
for (uint8_t i = 0; i < 0x40; i++)
|
||||||
fprintf(f, "3e8(attr) %02X: %4X\n", i, da2->attrc[i]);
|
fprintf(fp, "3e8(attr) %02X: %4X\n", i, da2->attrc[i]);
|
||||||
for (int i = 0; i < 0x10; i++)
|
for (uint8_t i = 0; i < 0x10; i++)
|
||||||
fprintf(f, "3eb(gcr) %02X: %4X\n", i, da2->gdcreg[i]);
|
fprintf(fp, "3eb(gcr) %02X: %4X\n", i, da2->gdcreg[i]);
|
||||||
for (int i = 0; i < 0x10; i++)
|
for (uint8_t i = 0; i < 0x10; i++)
|
||||||
fprintf(f, "3ee(?) %02X: %4X\n", i, da2->reg3ee[i]);
|
fprintf(fp, "3ee(?) %02X: %4X\n", i, da2->reg3ee[i]);
|
||||||
for (int i = 0; i < 0x20; i++) {
|
for (uint8_t i = 0; i < 0x20; i++) {
|
||||||
fprintf(f, "vp %02X: %4X %4X %4X %4X\n", i,
|
fprintf(fp, "vp %02X: %4X %4X %4X %4X\n", i,
|
||||||
da2->crtc_vpreg[0 + i], da2->crtc_vpreg[0x20 + i], da2->crtc_vpreg[0x40 + i], da2->crtc_vpreg[0x60 + i]);
|
da2->crtc_vpreg[0 + i], da2->crtc_vpreg[0x20 + i], da2->crtc_vpreg[0x40 + i], da2->crtc_vpreg[0x60 + i]);
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
f = fopen("ram_low.dmp", "wb");
|
fp = fopen("ram_low.dmp", "wb");
|
||||||
if (f != NULL) {
|
if (fp != NULL) {
|
||||||
fwrite(&ram[0x0], 0x100000, 1, f);
|
fwrite(&ram[0x0], 0x100000, 1, fp);
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
pclog("closed %04X:%04X DS %04X\n", cs >> 4, cpu_state.pc, DS);
|
pclog("closed %04X:%04X DS %04X\n", cs >> 4, cpu_state.pc, DS);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_DA2_DEBUGBLT
|
#ifdef ENABLE_DA2_DEBUGBLT
|
||||||
f = fopen("da2_bltdump.csv", "w");
|
fp = fopen("da2_bltdump.csv", "w");
|
||||||
if (f != NULL && da2->bitblt.debug_reg_ip > 0) {
|
if (fp != NULL && da2->bitblt.debug_reg_ip > 0) {
|
||||||
/* print header */
|
/* print header */
|
||||||
for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) {
|
for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) {
|
||||||
if (da2->bitblt.debug_reg[(da2->bitblt.debug_reg_ip - 1) * DA2_DEBUG_BLTLOG_SIZE + y] != DA2_DEBUG_BLT_NEVERUSED)
|
if (da2->bitblt.debug_reg[(da2->bitblt.debug_reg_ip - 1) * DA2_DEBUG_BLTLOG_SIZE + y] != DA2_DEBUG_BLT_NEVERUSED)
|
||||||
fprintf(f, "\"%02X\"\t", y);
|
fprintf(fp, "\"%02X\"\t", y);
|
||||||
}
|
}
|
||||||
fprintf(f, "\n");
|
fprintf(fp, "\n");
|
||||||
/* print data */
|
/* print data */
|
||||||
for (int x = 0; x < da2->bitblt.debug_reg_ip; x++) {
|
for (int x = 0; x < da2->bitblt.debug_reg_ip; x++) {
|
||||||
for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) {
|
for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) {
|
||||||
if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_NEVERUSED)
|
if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_NEVERUSED)
|
||||||
;
|
;
|
||||||
else if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_USEDRESET)
|
else if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_USEDRESET)
|
||||||
fprintf(f, "\"\"\t");
|
fprintf(fp, "\"\"\t");
|
||||||
else {
|
else {
|
||||||
fprintf(f, "\"%X\"\t", da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y]);
|
fprintf(fp, "\"%X\"\t", da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y]);
|
||||||
if (y == 0x12) {
|
if (y == 0x12) {
|
||||||
int chr = da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + 0x12];
|
int chr = da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + 0x12];
|
||||||
if ((chr >= 0x20) && (chr < 0x7f))
|
if ((chr >= 0x20) && (chr < 0x7f))
|
||||||
fprintf(f, "\"%c\"\t", chr);
|
fprintf(fp, "\"%c\"\t", chr);
|
||||||
else
|
else
|
||||||
fprintf(f, "\"\"\t");
|
fprintf(fp, "\"\"\t");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(f, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
free(da2->bitblt.debug_reg);
|
free(da2->bitblt.debug_reg);
|
||||||
#endif
|
#endif
|
||||||
@@ -3426,28 +3423,28 @@ da2_close(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_speed_changed(void *p)
|
da2_speed_changed(void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->da2const = (uint64_t) ((cpuclock / DA2_PIXELCLOCK) * (double) (1ull << 32));
|
da2->da2const = (uint64_t) ((cpuclock / DA2_PIXELCLOCK) * (double) (1ull << 32));
|
||||||
da2_recalctimings(da2);
|
da2_recalctimings(da2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
da2_force_redraw(void *p)
|
da2_force_redraw(void *priv)
|
||||||
{
|
{
|
||||||
da2_t *da2 = (da2_t *) p;
|
da2_t *da2 = (da2_t *) priv;
|
||||||
da2->fullchange = changeframecount;
|
da2->fullchange = changeframecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t da2_configuration[] = {
|
static const device_config_t da2_configuration[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "charset",
|
.name = "charset",
|
||||||
.description = "Charset",
|
.description = "Charset",
|
||||||
.type = CONFIG_SELECTION,
|
.type = CONFIG_SELECTION,
|
||||||
.default_int = DA2_DCONFIG_CHARSET_JPAN,
|
.default_int = DA2_DCONFIG_CHARSET_JPAN,
|
||||||
.selection = {
|
.selection = {
|
||||||
{
|
{
|
||||||
.description = "932 (Japanese)",
|
.description = "932 (Japanese)",
|
||||||
.value = DA2_DCONFIG_CHARSET_JPAN
|
.value = DA2_DCONFIG_CHARSET_JPAN
|
||||||
@@ -3460,11 +3457,11 @@ static const device_config_t da2_configuration[] = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "montype",
|
.name = "montype",
|
||||||
.description = "Monitor type",
|
.description = "Monitor type",
|
||||||
.type = CONFIG_SELECTION,
|
.type = CONFIG_SELECTION,
|
||||||
.default_int = DA2_DCONFIG_MONTYPE_COLOR,
|
.default_int = DA2_DCONFIG_MONTYPE_COLOR,
|
||||||
.selection = {
|
.selection = {
|
||||||
{
|
{
|
||||||
.description = "Color",
|
.description = "Color",
|
||||||
.value = DA2_DCONFIG_MONTYPE_COLOR
|
.value = DA2_DCONFIG_MONTYPE_COLOR
|
||||||
|
|||||||
@@ -1017,8 +1017,8 @@ loadfont_common(FILE *fp, int format)
|
|||||||
for (uint8_t d = 0; d < 8; d++)
|
for (uint8_t d = 0; d < 8; d++)
|
||||||
fontdatm[c][d + 8] = fgetc(fp) & 0xff;
|
fontdatm[c][d + 8] = fgetc(fp) & 0xff;
|
||||||
(void) fseek(fp, 4096 + 2048, SEEK_SET);
|
(void) fseek(fp, 4096 + 2048, SEEK_SET);
|
||||||
for (uint16_t c = 0; c < 256; c++)
|
for (uint16_t c = 0; c < 256; c++) /* 8x8 CGA (thick, primary) */
|
||||||
for (uint8_t d = 0; d < 8; d++) /* 8x8 CGA (thick, primary) */
|
for (uint8_t d = 0; d < 8; d++)
|
||||||
fontdat[c][d] = fgetc(fp) & 0xff;
|
fontdat[c][d] = fgetc(fp) & 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user