07 September 2018, 15:59 | #1 |
Registered User
Join Date: Jan 2017
Location: Jakobstad/Finland
Posts: 13
|
INCBIN weirdness
I'd like to include an image, a shape, or module into the executable, just as a challange to see what I can make, for example in just 64k.
I have both BB2.1 and Amiblitz2 and haven't been able to get this to work properly in either. This little example sort of works, but if I run it with the debugger on, it always gives a GURU warning at exit. It might run a few times, but then it always crashes. Code:
BLITZ Bitmap 0,320,256,2 DecodeILBM 0,?img Slice 0,44,2 Show 0 Mousewait img: IncBin "image.iff" There must be a solution to this right? |
07 September 2018, 17:11 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
I think you need to have an End statement before the img: label, otherwise when you click the mouse at the end of the program, the code runs on and tries to execute your image data... Which will not end well.
|
07 September 2018, 17:38 | #3 |
Registered User
Join Date: Jan 2017
Location: Jakobstad/Finland
Posts: 13
|
Of course. I didn't think of that. I omitted the End command, just so I could see the
debugger message at exit. I was hoping to see a "End of program" message, but with the End command the debugger just closes if there is no error it seems. |
08 September 2018, 13:33 | #4 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Use "Stop" if you want to break into the debugger.
|
08 September 2018, 14:14 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
AmiBlitz3 gives you a "Program finished" message in the console, but Blitz just quits back to the IDE. A simple fix:
Code:
NPrint "Program finished. Press Enter." x$ = Edit$(1) End |
08 September 2018, 16:03 | #6 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
By the way, is there no way to force Incbin to include files into chip RAM? If your picture or sound data ends up in fast RAM, you're wasting memory en masse.
|
09 September 2018, 13:23 | #7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
No, there's no way - IncBin files are packed as part of the executable object and so are loaded into fast RAM along with the program itself (if Fast RAM exists). The Decode#? commands then extract this data to chip RAM. So yeah, I guess it is a waste of RAM...
|
09 September 2018, 18:35 | #8 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
Yeah That's actually a big bummer. I stepped at this problem when coding my "Alien Apparat" demo. Too bad Blitz doesn't have SECTIONS
There's also one more problem I encountered while coding the demo. Sometimes DecodePalette command didn't work and hanged the code causing Guru. Till this time I don't know what was the problem. Other Decode commands worked fine but DecodePalette didn't. One of my clues was that maybe the gfx tool I used (Grafx2) didn't save IFF files the right way, but it wasn't the case, as I reproduced the problem with files saved by PPaint... If you guys had the same problems with DecodePalette or other Decode commands pls lat us know here. |
09 September 2018, 21:47 | #9 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
I think Blitz's loading and saving of IFF palettes in general is a little buggy - I ran into some bugs when I was writing a palette manipulation program and ended up just implementing my own load/save routines.
|
10 September 2018, 20:30 | #10 |
Registered User
Join Date: Jan 2017
Location: Jakobstad/Finland
Posts: 13
|
Thanks for your tips on the debugger. I got INCBIN to work with protracker modules (PT Player) by checking if fastmem is installed and copying the module data to a bank in chipmem. I skip the copying if no fastmem is found.
|
13 September 2018, 16:10 | #11 |
Registered User
Join Date: Sep 2018
Location: Chesterfield
Posts: 44
|
The command DecodeModule doesn't seem to exist.
How can you play a MOD that has been INCBINed? |
13 September 2018, 16:26 | #12 | |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Perhaps it's the DecodeMedModule? Interestingly, it seems it doesn't actually do any decoding:
Quote:
|
|
13 September 2018, 21:49 | #13 |
Registered User
Join Date: Sep 2018
Location: Chesterfield
Posts: 44
|
What about non-MED modules?
As Blitz supports 2 types of modules: standard tracker mods and MED mods |
13 September 2018, 22:11 | #14 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
There doesn't seem to be an equivalent for MODs unfortunately.
|
13 September 2018, 23:55 | #15 |
Registered User
Join Date: Sep 2018
Location: Chesterfield
Posts: 44
|
I found out the XBONES CIA Lib on the Blitz Extras CD
DecodeModule is actually a CIA lib command! However once I started to use this, my prog now crashes completely at END If I don't use the StartTracker command all works fine If i switch DEBUGGER ON, all works fine!!! Any ideas? Last edited by bjadams; 14 September 2018 at 11:22. |
14 September 2018, 20:28 | #16 |
Registered User
Join Date: Jan 2017
Location: Jakobstad/Finland
Posts: 13
|
I used the ptplayer which is a protracker player routine that idrougge converted, get it here:
http://eab.abime.net/showthread.php?...light=ptplayer You incbin the mod, but you need to check if fastmem is available, if it is then the module will most likely end up there. So you make a bank in chipmem, the size of the module, and copy the data from fastmem to chipmem. Code:
fastmem.b=AvailMem_(4) ; 4=fast, 2=chip if fastmem ; is fastmem available? if so, better copy the module to chipmem music_length.l=?musicE-?music InitBank 0,music_length,2 For n.l=0 To music_length-1 Step 4 Poke.l Bank(0)+n, Peek.l(?music+n) Next MTInit 0,0 Else ; if no fastmem is detected, the module must be in chipmem MTInit ?music,0,0 EndIf MTPlay On Mousewait MTEnd If fastmem Freebank 0 ; free up the bank we allocated endif End music: IncBin "yourmodule.mod" musicE: Last edited by neumanix; 14 September 2018 at 20:43. |
15 September 2018, 20:40 | #17 |
Registered User
Join Date: Sep 2018
Location: Chesterfield
Posts: 44
|
@neumanix
Thanks a lot, looks very straightforward. Worked great for me! Last edited by bjadams; 16 September 2018 at 19:38. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mouse weirdness | esc | support.WinUAE | 4 | 18 October 2016 07:49 |
DOpus startup weirdness | cmsj | support.Apps | 2 | 17 February 2016 13:04 |
blitz incbin.. | yoki | Coders. General | 5 | 03 April 2009 12:29 |
|
|