' *** SM_INIT.LST *** 2nd GFA-Manual, page 16-12 > PROCEDURE sm_init(file$,buffer%,VAR sm.ok!) ' ' *** Reserve memory for Soundmachine object-file and load it ' *** Also reserve memory for buffer (if buffer%>0: compressed file) ' *** Procedure uses RESERVE and MALLOC ' *** The mouse is disabled (can't be used anyway) ' *** Returns sm.ok!=TRUE if object-file is loaded ' *** Always call Procedure Sm_exit to restore memory ' ' *** Procedure: Program_exit ' *** Global: sm.sam% sm.taon% sm.taoff% sm.flags% sm.song% ' LOCAL file%,m$,k,res.mem%,bufp% IF EXIST(file$) sm.ok!=TRUE file%={FGETDTA()+26} res.mem%=file%+buffer% res.mem%=res.mem%+256-MOD(res.mem%,256) ! multiple of 256 RESERVE -res.mem% ! reserve memory for object-file + buffer sm.sam%=MALLOC(file%) ! object-file (from SAMLINK.PRG) sm.taon%=sm.sam%+&H186 ! special function (Procedure Sm_space) sm.taoff%=sm.sam%+&H1B6 sm.flags%=sm.sam%+&HE76 ! address of the 8 flags bufp%=sm.sam%+&HE7E ! buffer-pointer (uncompress file) BLOAD file$,sm.sam% ! load object-file OUT 4,18 ! disable mouse ~XBIOS(38,L:sm.sam%) ! assembler-routine in Supervisor-mode SDPOKE &H452,0 ! VBL off IF buffer%>0 sm.song%=MALLOC(buffer%) ! buffer (from SAMLINK.PRG) LPOKE (bufp%),sm.song% ! give buffer-address to SOUNDMACHINE ENDIF ELSE m$="*** Error ***| |File "+RIGHT$(file$,LEN(file$)-RINSTR(file$,"\")) m$=m$+"|not found" ALERT 3,m$,1,"Continue|Quit",k IF k=1 sm.ok!=FALSE ELSE @program_exit ENDIF ENDIF RETURN ' ********* '