www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/10/22:34:28

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: Adding background music to old DOS game
Date: Tue, 10 Feb 1998 19:02:46 +0000
Organization: None
Distribution: world
Message-ID: <D$gzrLAWRK40Ewqc@talula.demon.co.uk>
References: <6bphi4$8r6$1 AT fu-berlin DOT de>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 43
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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. 

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.

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.

>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.

>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.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


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