var
 BaseIO: word; IRQ, DMA, DMA16  : byte;

function HexW(W: word): string; {Word}
const
 HexChars: array [0..$F] of Char = '0123456789ABCDEF';

begin
 HexW :=
  HexChars[(W and $F000) shr 12] +
  HexChars[(W and $0F00) shr 8]  +
  HexChars[(W and $00F0) shr 4]  +
  HexChars[(W and $000F)];
end;


procedure Init;
begin
 if not(GetSettings(BaseIO, IRQ, DMA, DMA16)) then
  begin
   writeln('No SoundBlaster or compatable detected');
   Halt(1);
  end
  else
  begin
   InitSB(BaseIO, IRQ, DMA, DMA16);
   writeln('BaseIO=', HexW(BaseIO), 'h    IRQ', IRQ, '    DMA8=', DMA, '    DMA16=', DMA16);
   if not (AutoInit) then
   begin
    writeln('Error initilising SoundBalster');
    halt;
   end;
   if not InitXMS then
   begin
    ('XMS memory not avalible');
   end;
   writeln('Extended memory succesfully initialized');
   write('Free XMS memory:  ', GetFreeXMS, 'k  ');
   If SharedEMB then InitSharing;

   InitMixing;
   writeln;
  end;
end;
