VOGONS


Reply 23 of 31, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

How does breaking the OR operations into separate statements fix it? Does that mean other instances of multiple values ORed together in a single statement could be broken in VC?

Reply 24 of 31, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The readHandler-functions have a side effect (templatch.d=...). With optimizations on VS swaps the two readHandler calls in readw(...) in VGA_UnchainedRead_Handler which results in the broken display.

1+1=10

Reply 25 of 31, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Wouldn't it be in the VGA_ChainedEGA_Handler for this game? The readw() has two calls to readHandler() ORed together; but how are they "swapped" such that it makes a difference?

    Bitu readw(PhysPt addr) {
addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask;
addr += vga.svga.bank_read_full;
addr = CHECKED(addr);
return
(readHandler(addr+0) << 0) |
(readHandler(addr+1) << 8);
}

Reply 26 of 31, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The chained stuff is used for the 256 color VGA mode. For 16 color modes unchained is used.

MSVC executes readHandler(addr+1) first and then readHandler(addr+0) which causes the problem.

1+1=10

Reply 28 of 31, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author
    case M_EGA:
if (vga.config.chained)
newHandler = &vgaph.cega;
else
newHandler = &vgaph.uega;
break;

I put in some log messages here, and the unchained EGA handler is being activated for this game; and also on all the EGA side-scroller games from Id and Apogee that I've tried. Sorry, was unchained.

Why does changing the order of the readHandler calls make a difference? Same values and bitshifts get ORed together either way... unless you're saying the bitshifts are applied to the wrong values in spite of the parentheses that specifically state which shifts go with which values...