News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

LoadBank / SaveBank

Started by kevin, August 28, 2007, 07:18:03 AM

Previous topic - Next topic

kevin

  Load and Save Banks


PlayBASIC Code: [Select]
Function  LoadBank(Filename$)   
if fileexist(filename$)
Size=Filesize(Filename$)
if Size>0
Index=Newbank(Size)
f=GetfreeFile()
ReadFile filename$,f
ReadMemory f,GetBankptr(index),size
Closefile f
endif
endif
EndFunction Index


Function Savebank(filename$,Index)
if GetBankStatus(index) and (trim$(filename$," "+chr$(9))<>"")
Address=getBankPtr(index)
if Address
if fileexist(filename$) then deletefile Filename$
f=getfreefile()
writefile filename$,f
WriteMemory f,Address,Address+GetBankSize(Index)
Closefile f
endif
endif
EndFunction