Skip to content

Commit d1af2fe

Browse files
committed
Millennnium II now working
1 parent 8ba3521 commit d1af2fe

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/video/vid_mga.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,8 @@ mystique_out(uint16_t addr, uint8_t val, void *priv)
756756
svga->ma_latch <<= 1;
757757
}
758758

759-
svga->ma_latch <<= 1;
759+
if (!(mystique->type >= MGA_2164W))
760+
svga->ma_latch <<= 1;
760761
if (svga->ma_latch != mystique->ma_latch_old) {
761762
if (svga->interlace && svga->oddeven)
762763
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
@@ -949,7 +950,8 @@ mystique_recalctimings(svga_t *svga)
949950
if (mystique->type >= MGA_1064SG) {
950951
/*Mystique, unlike most SVGA cards, allows display start to take
951952
effect mid-screen*/
952-
svga->ma_latch <<= 1;
953+
if (!(mystique->type >= MGA_2164W))
954+
svga->ma_latch <<= 1;
953955
/* Only change maback so the new display start will take effect on the next
954956
horizontal retrace. */
955957
if (svga->ma_latch != mystique->ma_latch_old) {
@@ -1009,6 +1011,7 @@ mystique_recalctimings(svga_t *svga)
10091011
break;
10101012
case 32:
10111013
svga->render = svga_render_32bpp_highres;
1014+
svga->rowoffset <<= 1;
10121015
break;
10131016
}
10141017
}
@@ -1714,6 +1717,7 @@ mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *priv)
17141717
case REG_MACCESS + 3:
17151718
WRITE8(addr, mystique->maccess, val);
17161719
mystique->dwgreg.dither = mystique->maccess >> 30;
1720+
mystique->dwgreg.z_base = mystique->dwgreg.ydstorg * ((mystique->maccess & MACCESS_ZWIDTH) ? 4 : 2) + mystique->dwgreg.zorg;
17171721
break;
17181722

17191723
case REG_MCTLWTST:
@@ -2575,6 +2579,7 @@ mystique_ctrl_write_l(uint32_t addr, uint32_t val, void *priv)
25752579
case REG_PRIMEND:
25762580
thread_wait_mutex(mystique->dma.lock);
25772581
mystique->dma.primend = val;
2582+
//pclog("PRIMADDRESS = 0x%08X, PRIMEND = 0x%08X\n", mystique->dma.primaddress, mystique->dma.primend);
25782583
if (mystique->dma.state == DMA_STATE_IDLE && (mystique->dma.primaddress & DMA_ADDR_MASK) != (mystique->dma.primend & DMA_ADDR_MASK)) {
25792584
mystique->endprdmasts_pending = 0;
25802585
mystique->status &= ~STATUS_ENDPRDMASTS;
@@ -5074,6 +5079,7 @@ blit_bitblt(mystique_t *mystique)
50745079
case DWGCTRL_ATYPE_BLK:
50755080
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) {
50765081
case DWGCTRL_BLTMOD_BMONOLEF:
5082+
case DWGCTRL_BLTMOD_BMONOWF:
50775083
src_addr = mystique->dwgreg.ar[3];
50785084

50795085
for (y = 0; y < mystique->dwgreg.length; y++) {
@@ -5082,7 +5088,7 @@ blit_bitblt(mystique_t *mystique)
50825088
while (1) {
50835089
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot) {
50845090
uint32_t byte_addr = (src_addr >> 3) & mystique->vram_mask;
5085-
int bit_offset = src_addr & 7;
5091+
int bit_offset = ((mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) == DWGCTRL_BLTMOD_BMONOWF) ? (7 - (src_addr & 7)) : (src_addr & 7);
50865092
uint32_t old_dst;
50875093

50885094
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
@@ -5180,6 +5186,7 @@ blit_bitblt(mystique_t *mystique)
51805186
case DWGCTRL_ATYPE_RSTR:
51815187
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) {
51825188
case DWGCTRL_BLTMOD_BMONOLEF:
5189+
case DWGCTRL_BLTMOD_BMONOWF:
51835190
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_PATTERN)
51845191
fatal("BITBLT RPL/RSTR BMONOLEF with pattern\n");
51855192

@@ -5191,7 +5198,7 @@ blit_bitblt(mystique_t *mystique)
51915198

51925199
while (1) {
51935200
uint32_t byte_addr = (src_addr >> 3) & mystique->vram_mask;
5194-
int bit_offset = src_addr & 7;
5201+
int bit_offset = ((mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) == DWGCTRL_BLTMOD_BMONOWF) ? (7 - (src_addr & 7)) : (src_addr & 7);
51955202

51965203
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot && ((svga->vram[byte_addr] & (1 << bit_offset)) || !(mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC)) && trans[x & 3]) {
51975204
uint32_t src = (svga->vram[byte_addr] & (1 << bit_offset)) ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;

0 commit comments

Comments
 (0)