http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adlib/sb detection



Hi,

Your routine looks fine to me, you might try introducing a short delay
between writing to the registers, that might work, anyway, I might be able
to help you out more, since I'm also working on Adlib (not SB
unfortunately) at this very moment, I'm writing it in Basic (just to get
away from C/Asm for a while). I'm having another, weird problem, I've got
a game that's supposed to play a sound when the player wins, but just
after it plays the sound, the computer locks up! I've tried putting an END
statement just after the sound loop, but that doesn't work either, but if
I skip the sound bit, then the game runs fine, here's the code (Dave,
maybe you can learn something from this):

SUB AdlibInit
    CALL AdlibWrite(&H20, &H1)
    CALL AdlibWrite(&H23, &H1)
    CALL AdlibWrite(&H40, &H10)
    CALL AdlibWrite(&H43, &H0)
    CALL AdlibWrite(&H60, &HF0)
    CALL AdlibWrite(&H63, &HF0)
    CALL AdlibWrite(&H80, &H77)
    CALL AdlibWrite(&H83, &H77)
END SUB

SUB AdlibOff
    CALL AdlibWrite(&HB0, &H11)
END SUB

SUB AdlibReset
    CALL AdlibOff
    FOR Index% = &H0 TO &HF5
        CALL AdlibWrite(Index%, &H0)
    NEXT Index%
END SUB

SUB AdlibTone (F AS INTEGER)
    CALL AdlibWrite(&HA0, F AND &HFF)
    CALL AdlibWrite(&HB0, &H30 + (F AND &HF00 / &H100))
END SUB

SUB AdlibWrite (Index AS INTEGER, Value AS INTEGER)
    CALL delay(1)
    OUT &H388, Index
    CALL delay(1)
    OUT &H389, Value
    CALL delay(4)
END SUB

SUB WinTone
    CALL AdlibReset
    CALL AdlibInit
    FOR Count = 0 TO 4
        CALL AdlibTone(&H1B0)
        CALL delay(175)
        CALL AdlibOff
        CALL delay(100)
    NEXT Count
    CALL AdlibReset
END SUB

'delay' is an Assembly language procedure using interrupt 15h, function
86h. So, can somebody help me out here? I'm totally clueless! It's
probably something small, but I have no idea, sorry.

Lionel

P.s. Sorry for such a long e-mail, but I couldn't find the location of the
problem, sorry.

On Wed, 2 Jan 1980, David Cowolsky wrote:

> hi everybody
> 
> i would just like to know: how can i test for an adlib/sb card under dos?
> and also under windows? i have some information for programming it under
> dos, but i cant get it working, basically my code is something like this:
> 
> 	outportb(0x388, 0x4);
> 	outportb(0x389, 0x60);
> 	outportb(0x388, 0x4);
> 	outportb(0x389, 0x80);
> 	outportb(0x388, 0x2);
> 	outportb(0x389, 0xff);
> 	outportb(0x388, 0x4);
> 	outportb(0x389, 0x21);
> 	stat1 = inport(0x388);
> 	delay(80);
> 	stat2 = inport(0x388);
> 	outportb(0x388, 0x4);
> 	outportb(0x389, 0x60);
> 	outportb(0x388, 0x4);
> 	outportb(0x389, 0x80);
> 	if (stat1 & 0xe0 == 0x0 && stat2 & 0xe0 == 0xc0) {
> 	    /* card detected */
> 	} else {
> 	    /* card not detected */
> 	}
> 
> when i use this code, it always tells me that theres no card detected,
> even though i tried it on both a machine with a card, and on one without a
> card. can somebody please help me out?
> 
> cheers
> 
> dave
> 
> ps i tried writing it in pascal and assembly as well, and i couldnt get it
> working either. dont know maybe im just stupid :-)). or my docs are
> faulty :-)).
> 
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
> 
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html
> 

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html