[AD] Patch for fixed bugs with Soundscape DOS driver

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I finally had the time to reinstall DOS/Windows and to fix a problem I always noticed. With Allegro WIPs, the
Soundscape DOS sound driver didn't work anymore (it was even failing detection), while with Allegro 3.12 compiled on the
same platform, no error occured. So I compared the old and the new code, and I found a really strange bug: the WIP uses
outportb() and inportb() functions for ports I/O, while the old Allegro 3.12 uses inp() and outp(). I've always
believed they are equivalent, but eventually I was wrong... After a bit of hacks, I discovered the problem was
there, and changing all occurencies of them back to inp() and outp() made it to work! I've also found another small bug
in the IRQ handler, that was making the sound output a bit distorted, and I've fixed it too. Here's the patch; I hope
it comes in time for WIP 3.9.33!!

-- 
Angelo Mottola
a.mottola@xxxxxxxxxx
14a15,16
>  *      Minor bugs fixed by Angelo Mottola.
>  *
57c59
< #define OUT_TO_ADDR(n)  outportb(soundscape_waveport + CD_ADDR_OFF, n)
---
> #define OUT_TO_ADDR(n)  outp(soundscape_waveport + CD_ADDR_OFF, n)
220,221c222,223
<    OUT_TO_ADDR((inportb(soundscape_waveport + CD_ADDR_OFF) & 0xF0) | rnum);
<    outportb(soundscape_waveport + CD_DATA_OFF, value);
---
>    OUT_TO_ADDR((inp(soundscape_waveport + CD_ADDR_OFF) & 0xF0) | rnum);
>    outp(soundscape_waveport + CD_DATA_OFF, value);
233,234c235,236
<    OUT_TO_ADDR((inportb(soundscape_waveport + CD_ADDR_OFF) & 0xF0) | rnum);
<    return inportb(soundscape_waveport + CD_DATA_OFF);
---
>    OUT_TO_ADDR((inp(soundscape_waveport + CD_ADDR_OFF) & 0xF0) | rnum);
>    return inp(soundscape_waveport + CD_DATA_OFF);
245,246c247,248
<    outportb(soundscape_baseport + GA_ADDR_OFF, rnum);
<    outportb(soundscape_baseport + GA_DATA_OFF, value);
---
>    outp(soundscape_baseport + GA_ADDR_OFF, rnum);
>    outp(soundscape_baseport + GA_DATA_OFF, value);
257,258c259,260
<    outportb(soundscape_baseport + GA_ADDR_OFF, rnum);
<    return inportb(soundscape_baseport + GA_DATA_OFF);
---
>    outp(soundscape_baseport + GA_ADDR_OFF, rnum);
>    return inp(soundscape_baseport + GA_DATA_OFF);
336c338
<       inportb(soundscape_baseport + GA_ADDR_OFF);
---
>       inp(soundscape_baseport + GA_ADDR_OFF);
357c359
<       if (!(inportb(dmac_reg_p->status) & (0x10 << soundscape_dma)))
---
>       if (!(inp(dmac_reg_p->status) & (0x10 << soundscape_dma)))
522c524
<    if ((inportb(soundscape_baseport + GA_HOSTCTL_OFF) & 0x78) != 0x00)
---
>    if ((inp(soundscape_baseport + GA_HOSTCTL_OFF) & 0x78) != 0x00)
525c527
<    if ((inportb(soundscape_baseport + GA_ADDR_OFF) & 0xF0) == 0xF0)
---
>    if ((inp(soundscape_baseport + GA_ADDR_OFF) & 0xF0) == 0xF0)
528,529c530,531
<    outportb(soundscape_baseport + GA_ADDR_OFF, 0xF5);
<    tmp = inportb(soundscape_baseport + GA_ADDR_OFF);
---
>    outp(soundscape_baseport + GA_ADDR_OFF, 0xF5);
>    tmp = inp(soundscape_baseport + GA_ADDR_OFF);
546c548
<    if ((inportb(soundscape_waveport) & 0x80) != 0x00)
---
>    if ((inp(soundscape_waveport) & 0x80) != 0x00)
574c576
<    if (inportb(soundscape_waveport + CD_STATUS_OFF) & 0x01) {
---
>    if (inp(soundscape_waveport + CD_STATUS_OFF) & 0x01) {
577c579
<       outportb(soundscape_waveport + CD_STATUS_OFF, 0x00);
---
>       outp(soundscape_waveport + CD_STATUS_OFF, 0x00);
580c582
<       if (soundscape_dma_count > 16) {
---
>       if (soundscape_dma_count > 15) {
674,675c676,677
<    outportb(soundscape_waveport + CD_STATUS_OFF, 0x00);
<    inportb(0x22E);
---
>    outp(soundscape_waveport + CD_STATUS_OFF, 0x00);
>    inp(0x22E);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/