#127569 - mml - Thu May 03, 2007 10:05 am
This has got me stumped.
So I've got a 512x256x8 bitmap background on BG3 in mode 5 on the main screen (wrapping enabled), a basic console on the sub screen, to which I'm printing current x/y co-ordinates so I can keep track of where I am, and a couple of keys set up in my game loop so I can scroll it around.
Everything is working cleanly, except that at BG3_CX=0, the background renders weirdly. Instead of just rendering the "left" half of the image as you'd expect, it renders it, and then on what apppears to be odd scanlines only, it helpfully goes ahead and renders the "right" half too.
As soon as I scroll left or right, it renders correctly at the correct position in the bitmap; if I scroll back to CX=0 it garbles it again. What confuses me the most, though, is that at CX=(512<<8) and CX=(-512<<8) it renders correctly!
I'm testing using no$gba at present (haven't yet got the bits to test on actual hardware), however I would assume that if this was an emulator bug someone would've tickled it long before me and it'd be either fixed or documented all over forums.
Thereby I can only conclude that I'm doing something tragically wrong somewhere, but I can't for the life of me work out what -- the fact that it renders correctly at the wrapped equivalents of 0 suggest that I'm not crapping all over the memory somewhere by mistake (or poor maths), or setting the background size wrong, etc; but I can't think what else I could be doing that might cause this.
Anyone come across this before, or at least have some idea what's happening here?
(Yeah, I know (now) that I'd be better off using tiled backgrounds for what I'm doing at the moment, but I'd like to at least figure out what I'm doing wrong with the bitmap first so I don't make similar mistakes down the track...)
So I've got a 512x256x8 bitmap background on BG3 in mode 5 on the main screen (wrapping enabled), a basic console on the sub screen, to which I'm printing current x/y co-ordinates so I can keep track of where I am, and a couple of keys set up in my game loop so I can scroll it around.
Everything is working cleanly, except that at BG3_CX=0, the background renders weirdly. Instead of just rendering the "left" half of the image as you'd expect, it renders it, and then on what apppears to be odd scanlines only, it helpfully goes ahead and renders the "right" half too.
As soon as I scroll left or right, it renders correctly at the correct position in the bitmap; if I scroll back to CX=0 it garbles it again. What confuses me the most, though, is that at CX=(512<<8) and CX=(-512<<8) it renders correctly!
I'm testing using no$gba at present (haven't yet got the bits to test on actual hardware), however I would assume that if this was an emulator bug someone would've tickled it long before me and it'd be either fixed or documented all over forums.
Thereby I can only conclude that I'm doing something tragically wrong somewhere, but I can't for the life of me work out what -- the fact that it renders correctly at the wrapped equivalents of 0 suggest that I'm not crapping all over the memory somewhere by mistake (or poor maths), or setting the background size wrong, etc; but I can't think what else I could be doing that might cause this.
Anyone come across this before, or at least have some idea what's happening here?
(Yeah, I know (now) that I'd be better off using tiled backgrounds for what I'm doing at the moment, but I'd like to at least figure out what I'm doing wrong with the bitmap first so I don't make similar mistakes down the track...)