home *** CD-ROM | disk | FTP | other *** search
- {$m 2000,29000,29000}
- {$s-}
- {$n-}
- {$e-}
- uses dos,modunit,memunit;
- type
- p_string = ^string;
- var
- vol,c : integer;
- oldintfc,oldint9,oldint28 : procedure;
- canload,loaded : boolean;
- filename : p_string;
-
- {$i tsr.inc}
-
- procedure newint28; interrupt;
- begin
- if canload and not loaded then begin
- loaded := true;
- canload := false;
- port[$3c8] := 0;
- port[$3c9] := 20;
- port[$3c9] := 20;
- port[$3c9] := 20;
- {stop_playing;
- free_mod;
- load_mod('no_party.mod');
- start_playing;}
- port[$3c8] := 0;
- port[$3c9] := 0;
- port[$3c9] := 0;
- port[$3c9] := 0;
- end;
- asm
- pushf
- call oldint28;
- end;
- end;
-
- procedure newint9; interrupt;
- begin
- if port[$60] = $bc then begin
- loaded := false;
- end;
- if (mem[$40:$17] and 16 <> 0) and (port[$60]=$3c) then begin
- canload := true;
- end;
- asm
- pushf
- call oldint9
- end;
- end;
-
- function findgus : word;
- var
- n,c,i : word;
- s : string;
- begin
- s := getenv('ultrasnd');
- if s = '' then begin
- findgus := 0;
- exit;
- end;
- val(copy(s,1,3),n,c);
- if c <> 0 then begin
- findgus := 0;
- exit;
- end;
- case n of
- 210 : i := $210;
- 220 : i := $220;
- 230 : i := $230;
- 240 : i := $240;
- 250 : i := $250;
- 260 : i := $260;
- 270 : i := $270;
- else begin
- findgus := 0;
- exit;
- end;
- end;
- for n := 1 to 3 do delete(s,1,pos(',',s));
- if gus_irq = 0 then begin
- val(copy(s,1,pos(',',s)-1),gus_irq,c);
- if c <> 0 then gus_irq := 0;
- end;
- findgus := i;
- end;
-
- function addext(str,ext: string) : string;
- begin
- if pos('.',str) > 0 then addext := str
- else addext := str+ext;
- end;
-
- begin
- writeln('AMODTSR v 0.95');
- if paramcount < 1 then begin
- writeln('Usage: AMODTSR MODULE [vol]');
- exit;
- end;
- gus_base := findgus;
- if gus_base < $200 then gus_base := $200;
- gusfind;
- gusreset;
- init_mod;
- amp_vol := 15;
- if paramcount > 1 then begin
- val(paramstr(2),vol,c);
- if vol <> 0 then amp_vol := vol;
- end;
- if initxms <> 0 then exit;
- if paramstr(1) <> '/' then begin
- load_mod(addext(paramstr(1),'.mod'));
- if mod_error <> 0 then begin
- writeln('Error ',mod_error,' loading module');
- donexms;
- exit;
- end;
- start_playing;
- end;
- canload := false;
- loaded := false;
- getintvec($fc,@oldintfc);
- setintvec($fc,@intfc);
- exec(getenv('COMSPEC'),'');
- setintvec($fc,@oldintfc);
- stop_playing;
- free_mod;
- donexms;
- done_mod;
- end.
-
-