BBC BASIC for Windows
Programming >> Libraries >> Is my SPRITELIB.BBC library corrupted?
http://bb4w.conforums.com/index.cgi?board=libraries&action=display&num=1381324103

Is my SPRITELIB.BBC library corrupted?
Post by 19Grumpah42 on Oct 29th, 2009, 5:39pm

"All at once" I am getting 0 returns from FN_initsprites(2), in my programme and in the provided demo SPRITES.BBC, so I wonder whether the lib file is corrupted. {Utilities}{List Variables} shows that the two FN and PROCs are loaded.

The md5 value for my current SPRITES.BBC file is

73fcfb63bba0da08ddcd13b26706fc2c

Is there some place I can just download a new version of the LIB?
--Grahame

Re: Is my SPRITELIB.BBC library corrupted?
Post by admin on Oct 29th, 2009, 9:19pm

Quote:
I wonder whether the lib file is corrupted

BB4W libraries are just regular (tokenised) BASIC program files, so it's very easy to check for corruption simply by loading them into the editor. It's extremely unlikely that file corruption could cause the symptom you described anyway.

If you look at the code of SPRITELIB you'll see that the only condition under which FN_initsprites() returns zero is when CreateCompatibleBitmap fails. Therefore it's very likely that the problem is that your kernel memory has become fragmented, or a memory leak has resulted in it being almost entirely exhausted, resulting in there being insufficient space to allocate a 1600x1200 bitmap (around 7 Mbytes).

Quote:
Is there some place I can just download a new version of the LIB?

No. In the unlikely event of needing to replace a file just re-install from the Setup.exe or UPGRADE.EXE from which you last installed (and hopefully kept!).

Given the likely cause of the problem (kernel memory) the solution is to reboot your PC. Afterwards you might want to check whether you're doing anything wrong which could have caused the problem (something that definitely will is calling FN_initsprites without later calling PROC_exitsprites).

Richard.
Re: Is my SPRITELIB.BBC library corrupted?
Post by 19Grumpah42 on Nov 1st, 2009, 7:07pm

Thanks Richard. Yes, the problem went away when I re-booted after a MS "update". I think I too suffer from memory leakage these days, probably no simple cure for that!
--G