{$M 16000,0,2000} program example_for_s3mplay; uses emstool,S3MPlay,crt,blaster,dos; const stereo_calc=true; _16bit_calc=false; switch:array[false..true] of string[3] = ('off','on '); var samplerate:word; Stereo:Boolean; _16bit:Boolean; _LQ:boolean; ST3order:Boolean; help:boolean; volume:byte; how2input:byte; { 1-autodetect,2-read blaster enviroment,3-input by hand } disply_c:boolean; screen_no:byte; { current info on screen } startchn:byte; {$L DOSPROC.OBJ} function getfreesize:word; external; function tohexs(w:word):string; const s:string='0123456789ABCDEF'; begin tohexs:=s[(w shr 12)+1] + s[((w shr 8) and $0f)+1] + s[(w and $00ff) shr 4+1] + s[(w and $000f)+1]; end; procedure display_errormsg(err:integer); begin { I know case is stupid - like my code allways is :) } case err of 0: write(' Hmm no error what''s wrong ? '); -1: begin if load_error=-1 then write(' Not enough memory for this module. ') else if player_error=-1 then write(' Not enough memory for internal buffers. '); write('PROGRAMMERS INFO: Try to lower PascalHeap or DMAbuffer. '); end; -2: write(' Wrong file format. Not a S3M ? '); -3: write(' File corrupt. '); -4: write(' File does not exist. '); -7: write(' Need a 386 or higher. '); -8: write(' No sounddevice set. (wrong code - shame on you programmer) '); -11: write(' Loading stoped by user <- only for betatest ! '); else write(' Somethings going wrong, but I dounno about that errorcode: ',err,' '); end; writeln('PROGRAM HALTED.'#7); halt; end; var filename:string; c:char; savchn:array[0..15] of byte; procedure save_chntyps; var i:byte; begin for i:=0 to 15 do savchn[i]:=channel[i].channeltyp; end; procedure revers(n:byte); begin if channel[n].channeltyp=0 then channel[n].channeltyp:=savchn[n] else channel[n].channeltyp:=0 end; procedure hide_cursor; assembler; asm mov ah,01 mov cx,32*256+32 int 10h end; procedure view_cursor; assembler; asm mov ah,01 mov cx,15*256+16 int 10h end; var oldexit:pointer; procedure local_exit; far; begin exitproc:=oldexit; end; function nextord(nr:byte):byte; begin patterndelay:=0;Ploop_on:=false;Ploop_no:=0;Ploop_to:=0; inc(nr); while (nr<=lastorder) and (order[nr]>=254) do inc(nr); if nr>lastorder then if loopS3M then begin nr:=0; while (nr<=lastorder) and (order[nr]>=254) do inc(nr); if nr>lastorder then EndofSong:=true; { stupid order ! (no real entry) } end else begin nr:=0;EndofSong:=true end; nextord:=nr; end; procedure disable_all; var i:byte; begin for i:=0 to usedchannels-1 do channel[i].enabled:=false; { <- use this if you jump to previous order ... } end; function prevorder(nr:byte):byte; begin if nr=0 then begin prevorder:=nr;exit end; dec(nr); while (nr>0) and (order[nr]>=254) do dec(nr); if order[nr]>=254 then { to far - search next playable } begin while (nr<=lastorder) and (order[nr]>=254) do inc(nr); if nr>lastorder then EndofSong:=true; { stupid order ! (no real entry) } end; prevorder:=nr; end; function upstr(s:string):string; var i:byte; begin for i:=1 to length(s) do s[i]:=upcase(s[i]); upstr:=s; end; procedure check_para(p:string); var t:string; b:byte; w:word; i:integer; begin if (p[1]<>'-') and (p[1]<>'/') then begin filename:=p; exit; end; if upcase(p[2])='V' then { Volume } begin t:=copy(p,3,length(p)-2); val(t,b,i); if i=0 then volume:=b; end; if upcase(p[2])='S' then { Samplerate } begin t:=copy(p,3,length(p)-2); val(t,w,i); if i=0 then begin if w<100 then w:=w*1000; SampleRate:=w; end; end; if (upcase(p[2])='H') or (p[2]='?') then { help } help:=true; if upcase(p[2])='M' then { Mono - because default is stereo } stereo:=false; if p[2]='8' then { 8bit - default is 16bit } _16bit:=false; if upcase(p[2])='C' then { display SB config } disply_c:=true; if upcase(p[2])='R' then { show rastertime } rastertime:=true; if upcase(p[2])='O' then { use ST3 order } ST3order:=true; if upstr(copy(p,2,5))='NOEMS' then { don't use EMS } useEMS:=false; if upstr(copy(p,2,3))='ENV' then { read Blaster enviroment } how2input:=2; if upstr(copy(p,2,3))='CFG' then { input SB config by hand } how2input:=3; if upstr(copy(p,2,2))='LQ' then { mix in low quality mode } _LQ:=true; {$IFDEF BETATEST} if upcase(p[2])='B' then begin t:=copy(p,3,length(p)); val(t,b,i); if i=0 then startorder:=b; end; if upcase(p[2])='F' then { set frame rate } begin t:=copy(p,3,length(p)-2); val(t,b,i); if i=0 then FPS:=b; end; {$ENDIF} end; procedure display_keys; begin writeln(' Keys while playing : '#13#10); writeln('
... Pause (only on SB16)');
writeln(' ..