More updates regarding the PC-98x1:

1.Fixed I/O step when using interleaving I/O.
2. Add more and fixes of the existing incomplete PC-98x1 core.
This commit is contained in:
TC1995
2024-02-13 01:29:00 +01:00
parent d4cf722d7d
commit 9910b6f3cd
15 changed files with 640 additions and 526 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -994,71 +994,63 @@ upd7220_process_cmd(upd7220_t *dev)
}
/* i/o */
void
upd7220_param_write(uint16_t addr, uint8_t value, void *priv)
upd7220_write(uint16_t addr, uint8_t value, void *priv)
{
/* ioport 0x60(chr), 0xa0(gfx) */
upd7220_t *dev = (upd7220_t *) priv;
if (dev->cmdreg != -1) {
if (dev->params_count < 16)
dev->params[dev->params_count++] = value;
/* ioport 0x62(chr), 0xa2(gfx) */
if (addr & 1) {
if (dev->cmdreg != -1)
upd7220_process_cmd(dev);
dev->cmdreg = value;
dev->params_count = 0;
upd7220_check_cmd(dev);
if (dev->cmdreg == -1)
dev->params_count = 0;
} else {
/* ioport 0x60(chr), 0xa0(gfx) */
if (dev->cmdreg != -1) {
if (dev->params_count < 16)
dev->params[dev->params_count++] = value;
upd7220_check_cmd(dev);
if (dev->cmdreg == -1)
dev->params_count = 0;
}
}
}
uint8_t
upd7220_statreg_read(uint16_t addr, void *priv)
upd7220_read(uint16_t addr, void *priv)
{
/* ioport 0x60(chr), 0xa0(gfx) */
upd7220_t *dev = (upd7220_t *) priv;
pc98x1_vid_t *vid = (pc98x1_vid_t *) dev->priv;
uint8_t value = dev->statreg | vid->vsync;
uint8_t value;
/* ioport 0x62(chr), 0xa2(gfx) */
if (addr & 1)
value = upd7220_fifo_read(dev);
else {
/* ioport 0x60(chr), 0xa0(gfx) */
value = dev->statreg | vid->vsync;
#if 0
if (dev->params_count == 0)
if (dev->params_count == 0)
#endif
value |= GDC_STAT_EMPTY;
value |= GDC_STAT_EMPTY;
if (dev->params_count == 16)
value |= GDC_STAT_FULL;
if (dev->params_count == 16)
value |= GDC_STAT_FULL;
if (dev->data_count > 0)
value |= GDC_STAT_DRDY;
if (dev->data_count > 0)
value |= GDC_STAT_DRDY;
dev->statreg &= ~(GDC_STAT_DMA | GDC_STAT_DRAW);
/* toggle hblank bit */
dev->statreg ^= GDC_STAT_HBLANK;
dev->statreg &= ~(GDC_STAT_DMA | GDC_STAT_DRAW);
/* toggle hblank bit */
dev->statreg ^= GDC_STAT_HBLANK;
}
return value;
}
void
upd7220_cmdreg_write(uint16_t addr, uint8_t value, void *priv)
{
/* ioport 0x62(chr), 0xa2(gfx) */
upd7220_t *dev = (upd7220_t *) priv;
if (dev->cmdreg != -1)
upd7220_process_cmd(dev);
dev->cmdreg = value;
dev->params_count = 0;
upd7220_check_cmd(dev);
}
uint8_t
upd7220_data_read(uint16_t addr, void *priv)
{
/* ioport 0x62(chr), 0xa2(gfx) */
upd7220_t *dev = (upd7220_t *) priv;
return upd7220_fifo_read(dev);
}
void
upd7220_reset(upd7220_t *dev)
{