There’s no rush to get it sorted, I can probably figure out the rest with a bit of time.
I tried regenerating the sprite data with img2pok and moving the sprite and both cases came out with the green strip, so it’s either a bug in img2pok or a bug in the bitmap drawing code.
I think it’s the latter.
I’m not sure if I’m doing something wrong or not but it seems that when altering the source code of the library itself, the changes don’t carry through to the examples.
I added a return; to the top of the drawBitmap function, but the Pokitto sprite is still drawing.
I tried to fix the issue but I’m struggling to understand the bitmap code.
Does anyone else get an issue with having a green stripe along the right side of the sprite?
(Using a fresh copy of the Pokitto lib obtained from the master branch, after ammeding bgcolor(1) to bgcolor = 1. My fork fixing that typo can be found here.)
I have not noticed that kind of bug. Is there something particular you are struggling with. The 4bpp code is heavily optimized which makes it a bit hard to understand.
If you make a short example code that produces the issue we can look at it together. The 4bpp code was a real pain to get working with bitmaps of varying widths, screen edge clipping etc. because its all done by bitshifting. There may well be a special situation still where there is an issue.
It’s exactly the same bitmap example, the only code change I made was to make the background index 1 (magenta) instead of 0 (green).
In which case the result was this:
I tried some actual games and they didn’t have any issue (though they were ones I had lying around so they’re probably out of date or built with an older version of the library, I’ll grab some fresh copies later to check if nobody else can reproduce this).
Here’s a list of the exact steps I made to reach this.
(Bear in mind I’m on a Windows 8.1 system.)
Download a fresh copy of the PokittoLib (the master branch, as zip).
Open EmBitz.
Close all other projects.
Open the recently downloaded copy of PokittoLib.
Open bitmap.cpp.
Change mygame.display.bgcolor=0; to mygame.display.bgcolor=1;.
Build > Select target > Bitmap.
Build > Clean target.
Build > Build target.
Find the build folder.
Connect the Pokitto.
Turn the Pokitto on.
Put the Pokitto into CRP DISABLD mode.
Delete firmware.bin.
Copy build/bitmap.bin to the CRP DISABLD drive.
Wait for the copy to finish.
Eject the Pokitto.
Wait for the Pokitto to disconnect.
Turn the Pokitto on and off again.
That’s one of the reasons I gave up looking.
By the time I’ve understood it, someone who already knows how it works could probably have spotted the problem or realised it’s not even in the drawBitmapData function.
I’m fine with shifting and masking, but I don’t know why the odd and even pixel starting lines are treated differently and there’s quite a bit of code to get through.
(Also there’s some other practices I’m not used to, like variables being declared before the scope they’re needed in.)
I am very busy, improving the sound and other things. I am now succesfully transferring data to screen buffer using DMA. So first application of DMA on Pokitto is working, and it means lots of interesting stuff we could do (for example screen scrolling with DMA )
I wasn’t aware that was an issue, so that’s good to know
(There’s probably a way to account for that. Not that it’s particularly important at the moment.)
Is that restriction documented anywhere?
(Come to think of it, I haven’t actually seen/found any documention for the image formats.)
At least now that the cause is clear, it’ll make the issue easier to spot in future (e.g. if someone makes a post saying “there’s an oddly coloured line next to my sprite”).