VOGONS

Common searches


Timing patches

Topic actions

Reply 40 of 71, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The reason why i'm asking:
sb dma transfer is active
game reads dma transfer counter (low part)
[here the dma wrapping due to autoinit happens/can happen]
game reads dma transfer counter (high part)

now the highpart<<8 + lowpart is not correct (which is no
problem in general and can happen on a real pc as well as
far as i understand) but there's an overflow
the overflow doesn't happen if the wrapping in-between those
reads ONLY happens if the read low part was <=0x40 (which did
not happen in dosbox before but can happen now due to the
io access reducing cycles)

I'm trying to estimate the port delay as well but i doubt the results
from the p4 are that useful...

Reply 42 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yes on the 386sx too. It even generated a ISA bus cycle when reading from the DMA controller register.
But on the P4 you probably have no ISA bus to compare.

There is one thing I noticed. On the real computer, the DMA transfers do only
one byte of data at time, i.e. every 40 microseconds (22500 8bit mono). In DOSBox this is done with a block of multiple bytes every millisecond. The byte count register content doesn't decrease continually.
On the real computer the game should be able to read the registers with only one decrement (worst case) of the counter.

Or the game is looking at the DMA register at the wrong moment? Is it a timer ISR? What if you restore the older timer code?

1+1=10

Reply 43 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The DMA controller will
also exit the Idle Mode and enter the Program Mode when
the CPU attempts to access its internal registers.

I wonder if this is implemented in DOSBox and might have an effect here?

Reply 44 of 71, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The byte count register content doesn't decrease continually.

Yes, and there's already coding that (tries to) care about this. That is the
counter is adjusted to reflect the estimated position in the buffer, not the
last block position. But it's hard to verify its working so some different thing
will be used. If the counter reading would not impose delays itself this
would have simplified things, but i think it can be assumed that all port
accesses actually have the delaying effect.
Thanks for verifying this!

Reply 45 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

IODelay optimization - don't multiply on every access - improves performance a little bit.

Attachments

  • Filename
    iod2.diff
    File size
    5.16 KiB
    Downloads
    49 downloads
    File license
    Fair use/fair dealing exception

Reply 46 of 71, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Maybe the other direction would be better, that is imposing real delays
on io-access so the reduced cycles "match" the real time spent there
to avoid the cycles guessing go off 😀

Also you shouldn't use that code:

+ if(CPU_Cycles > writedelay) { + CPU_Cycles -= writedelay; + CPU_IODelayRemoved+=writedelay; + } + else CPU_Cycles = 0; […]
Show full quote

+ if(CPU_Cycles > writedelay) {
+ CPU_Cycles -= writedelay;
+ CPU_IODelayRemoved+=writedelay;
+ }
+ else CPU_Cycles = 0;

as the CPU_Cycles=0 breaks some games (exiting to the main loop too early).

Reply 47 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author
inline void IO_USEC_write_delay() {
Bitu delaycyc = CPU_CycleMax/IODELAY_WRITE_MICROSk;
if(GCC_UNLIKELY(CPU_Cycles < 3*delaycyc)) delaycyc=0;
CPU_Cycles -= delaycyc;
CPU_IODelayRemoved += delaycyc;
}

Oh, it can handle negative cycles? Overlooked that.

Reply 48 of 71, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

This part does

if(GCC_UNLIKELY(CPU_Cycles < 3*delaycyc)) delaycyc=0; 

Water flows down the stream
How to ask questions the smart way!

Reply 52 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Patch for Kellogg's game with joystick

They use 0x1 command to latch counter 0. Looks like the 1 should be ignored.

Attachments

  • Filename
    nobcdlatch.diff
    File size
    857 Bytes
    Downloads
    43 downloads
    File license
    Fair use/fair dealing exception

Reply 53 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Timer mode 0 reload patch
for the DoWhackaDo demo
In mode 0 the timer does not fire twice when being reloaded before timeout.

Unfortunately the fix cannot really be seen in a normal dosbox 😉

Attachments

  • Filename
    mode0_reload.diff
    File size
    736 Bytes
    Downloads
    42 downloads
    File license
    Fair use/fair dealing exception

Reply 54 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well I was wrong with the VGA blanking patch. The vertical blanking period doesn't exclude the overscan area.

Scanline.exe is a little tool that counts the lines and reports 400 on a real PC.
In DOSBox it's 415 or so because of the overscan. (In NTVDM on my Notebook it reports 600 😉)

The patch fixes that issue. Improves horizontal scrolling in a demo.

Attachments

  • Filename
    SCANLINE.zip
    File size
    4.15 KiB
    Downloads
    43 downloads
    File comment
    DOS app counting scanlines per frame
    File license
    Fair use/fair dealing exception
  • Filename
    scanline_count.diff
    File size
    1.68 KiB
    Downloads
    45 downloads
    File comment
    Patch for DOSBox
    File license
    Fair use/fair dealing exception

Reply 55 of 71, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Thank you very much!

And no, there's nothing like a golden medal of diff for the 100th patch 😉 (not yet).

The first two things sound sensible, the 3rd one effectively prolongs the
retrace interval, right?

Reply 56 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

> And no, there's nothing like a golden medal of diff for the 100th patch Wink (not yet).

No? 😉

Two of those patches are part of the VGA patch which I thought might be useful otherwise too.

The retrace interval length stays the same but the v blanking gets extended by those ~15 lines. This is critical in the panic demo where they do their line-by-line magic but I also noticed the scrolling improvement in some other demo. Maybe some other software is affected too. This way it should also be a bit faster than before.

(I have another one but that only makes the joystick compatible with timed=true and cycles independent in horde, archon ultra and that kelloggs game)

Reply 59 of 71, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Missing a few modes but enough for those three games...

Attachments

  • Filename
    gate2.diff
    File size
    4.5 KiB
    Downloads
    49 downloads
    File license
    Fair use/fair dealing exception