www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/11/05:00:32

From: brenner AT biochem DOT mpg DOT de (Markus Brenner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: Adding background music to old DOS game
Date: Wed, 11 Feb 98 09:44:33 GMT
Organization: Max-Planck-Institut fuer Biochemie
Lines: 68
Distribution: world
Message-ID: <6brrvp$1pe$1@fu-berlin.de>
References: <6bphi4$8r6$1 AT fu-berlin DOT de> <D$gzrLAWRK40Ewqc AT talula DOT demon DOT co DOT uk>
NNTP-Posting-Host: pcfr21.biochem.mpg.de (141.61.7.150)
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <D$gzrLAWRK40Ewqc AT talula DOT demon DOT co DOT uk>, Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk> wrote:
>Markus Brenner writes:
>>What I'm trying to do is get some MIDI background music into the old 
>>MS-DOS Ultima games. My plan is to start up Allegro's MIDI player in 
>>the background, then hook the 0x21 interrupt and check for the file-
>>open function. My interrupt routine should determine which file name 
>>the Ultima game is about to open, then accordingly change the current 
>>MIDI file playing in the background. 

Firstoff, thanks for the helpful replies! I'm getting convinced I should get 
it to work (if my brain can handle all the interrupts, that is :)

>Hmm. That _might_ work, but there are a lot of potential problems that
>you are likely to run into! In particular, it will be impossible if
>Ultima tries to use the soundcard or timer interrupt for itself, which
>is quite likely. You can find out whether there will be any conflicts by
>using the Allegro ex33 program and seeing whether Ultima can be run from
>within this.

That's nearly exactly what I already did: I modified the ex16 example to issue 
a 'system("ultima")' (removing the install_keyboard() first) and it worked 
splendidly (at least with Ultima 4).

>Under win95, you will also find that the OS resets the soundcard
>whenever an application exits, even if it was actually a child of the
>program that was using the soundcard. This won't be a problem if there
>is only one level of chaining from your wrapper to Ultima, but things
>may go wrong if Ultima then uses multiple executables within itself.

I'll keep my fingers crossed :)

>>From what I learned so far it's pretty tricky to do complex tasks like 
>>changing the running song in the MIDI routines *from out of an 
>>interrupt*, 
>
>I don't think that will be a problem. It would indeed be trick to do
>this from a hardware interrupt, but int 0x21 is a software call made by
>the mainline code, so you can safely call the play_midi() function from
>here. It probably wouldn't be a good idea to actually read in the file
>at this point, though, so I would be inclined to preload the tunes you
>are going to need at startup time.

OK, I was thinking about that, too. I'll do that :) It's good to hear I won't 
have trouble calling the play_midi() from out of the interrupt! I really had 
my doubts there (from reading about TSR routines in several sources).

>>How about the 0x21/open interrupt. Do I use Allegro's _install_irq() 
>>routine to install my own handler?
>
>No, that function is for hooking hardware interrupts. You should use the
>__dpmi_*() routines from libc, but I'm afraid I can't tell you all the
>details because I've never tried to hook a DOS routine myself.

Thanks for the tips! This should set me on the right course :) If this ever 
works I'll let you have it for the Allegro examples sections!

Cheers,

-markus

----
 Markus Brenner             _           no matter how - how hard you try
  -==(UDIC)==-             ( )          in your own life, and through the years
      |\/|                --+--         with every up - must come a down
       \/                   |           enjoy the laughter and the tears
 Minstrel Dragon            |           of happiness     (Roger Taylor)
           Lord High Mucketty-muck of the UDIC Greybeards (tm)
 email: brenner AT biochem DOT mpg DOT de  *  WWW: http://www.biochem.mpg.de/~brenner/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019