VOGONS


First post, by DosWorld

User metadata
Rank Newbie
Rank
Newbie

Hello!

Sorry, may be I am wrond with forum area, but here I can rights to make a post.

I have stable %subj% error and, imho, could help fix it.

1. My source code (small game) often reproduce this error. Problem good reproduced with Sound Blaster (FX) using (play FX at 8-bit mono). But works fine with real hardware (SB AWE32 => SB16, Terratec EWS-64 XXL => SB Pro). I can provide source code and binaries to reproduce it.

2. Imho, Root cause of problem. Dma controller is divided on two parts. First part (first 4 channels), aka "low dma" works in 8bit mode all time, and "hight dma" works into 16-bit mode. As I see source code of dosbox - dosbox work in 16bit mode with "low dma" channels (segment/offset wrapping). This is reason why it cause (segment/offset wrapping for 16-bit dma into 8-bit dma channels).

Here is documentation https://homepages.cae.wisc.edu/~brodskye/sb16 … oc.html#DMAProg

For 8-bit data, offset should be in bytes the start of a 64kb page:

5. Write the offset of the buffer, low byte followed by high byte. For sixteen bit data, the offset should be in words from the […]
Show full quote

5. Write the offset of the buffer, low byte followed by high byte. For sixteen bit data, the offset should be in words from the start of a 128kbyte page. The easiest method for computing 16-bit parameters is to divide the linear address by two before calculating offset.

if SixteenBit then
begin
BufOffset := (LinearAddr div 2) mod 65536;
Port[BaseAddrPort] := Lo(BufOffset);
Port[BaseAddrPort] := Hi(BufOffset);
end
else
begin
BufOffset := LinearAddr mod 65536;
Port[BaseAddrPort] := Lo(BufOffset);
Port[BaseAddrPort] := Hi(BufOffset);
end;

...

7. Write the buffer page to the DMA page register.

  Port[PagePort] := LinearAddr div 65536; 

3. If this point of view is ok, I can try prepare patch for it.

Last edited by DosWorld on 2019-01-10, 16:58. Edited 1 time in total.

CPU: Amd K6/450, RAM: 256M, VIDEO: S3Trio V+, SOUND: EWS64XXL/64M
CPU: iP/100, RAM: 16M, VIDEO: S3Trio V+, SOUND: SB AWE32
IBM Aptiva, CPU i486DX/80, RAM: 96M
Compaq Contura 4/25 2820D, CPU: i486SX/25, RAM: 4M, VGA.
HP 200LX/2M

Reply 1 of 4, by cyclone3d

User metadata
Rank l33t
Rank
l33t

Hopefully the DOSBOX team sees this and replies to your question.

Which version of DOSBOX are you using?

Yamaha YMF modified setupds and drivers
Yamaha XG resource repository - updated November 27, 2018
Yamaha YMF7x4 Guide
AW744L II - YMF744 - AOpen Cobra Sound Card - Install SB-Link Header
Epstein didn't kill himself

Reply 2 of 4, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The code in dma.cpp is perhaps not easy to understand, but I assure you that DOSBox does differentiate between 8-bit and 16-bit DMA channels. If you do decide to investigate improvements for DMA, please be sure you are working with current source.

FYI, the wrapping only causes a log message in SVN, not an error exit as in 0.74(-2). Also, there is a new "ems=emm386" setting in SVN which can eliminate the wrapping in some cases. Though games will continue to work, audio glitches may still occur as a result of wrapping.

Reply 3 of 4, by DosWorld

User metadata
Rank Newbie
Rank
Newbie
cyclone3d wrote:

Hopefully the DOSBOX team sees this and replies to your question.

Which version of DOSBOX are you using?

I am check source code from current trunk into SVN.

My binary dosbox version is:

DOSBox version 0.74
Copyright 2002-2010 DOSBox Team, published under GNU GPL.

This is ubuntu x64 from 18.04.1 LTS (Bionic Beaver) repo.

CPU: Amd K6/450, RAM: 256M, VIDEO: S3Trio V+, SOUND: EWS64XXL/64M
CPU: iP/100, RAM: 16M, VIDEO: S3Trio V+, SOUND: SB AWE32
IBM Aptiva, CPU i486DX/80, RAM: 96M
Compaq Contura 4/25 2820D, CPU: i486SX/25, RAM: 4M, VGA.
HP 200LX/2M

Reply 4 of 4, by DosWorld

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote:

FYI, the wrapping only causes a log message in SVN, not an error exit as in 0.74(-2). Also, there is a new "ems=emm386" setting in SVN which can eliminate the wrapping in some cases. Though games will continue to work, audio glitches may still occur as a result of wrapping.

Hmm... second time I am meet "emm", in this context. Yes, I have a problem with emm386, when do sb-programming. In this case, emm386 halt my PC and show screen with message - suggest to add parameter D=64, when run emm386.exe from config.sys. (DEVICE=EMM386.EXE D=64). I am not use EMS/XMS in my game. After I am add D=64, I am forgot about any problems with emm386.exe.

What I find about this parameter:

D=nnn 
Specifies how many kilobytes of memory should be reserved for buffered direct memory access (DMA). Discounting floppy-disk DMA, this value should reflect the largest DMA transfer that will occur while EMM386 is active. Valid values for nnn are in the range 16 through 256. The default value is 32.

Here is my code to calculate page/offset:
in: AX = ofs, BX = seg
out: AX = ofs, BL = page

usualy I am play seg:0000 (zero offset)

PUSH   AX
PUSH BX
XCHG AX,BX
SHL AX,4
ADD AX,BX
MOV DX,AX
POP BX
POP AX
SHR AX,4
ADD AX,BX
SHR AX,12
MOV BL,AL
MOV AX,DX

Hmm... when I change page/offset (I do it!) - possible step over segment... Ok, I known how to handle this. But what do here emm386?

PS: I am investigate dosbox source more - yes, looks ok. I am was wrong, sorry.
PPS: I am change my code to be sure - dont do step over page. Also remvoe D=64 from config. Emm386 show warrning. So, problem looks like in another place and deeper. 🙁

CPU: Amd K6/450, RAM: 256M, VIDEO: S3Trio V+, SOUND: EWS64XXL/64M
CPU: iP/100, RAM: 16M, VIDEO: S3Trio V+, SOUND: SB AWE32
IBM Aptiva, CPU i486DX/80, RAM: 96M
Compaq Contura 4/25 2820D, CPU: i486SX/25, RAM: 4M, VGA.
HP 200LX/2M