--- In gbadev@y..., bradonk@h... wrote:
> Hi,
> I looked for a while and couldn't find anything on this, so
could
> someone help me? I'm trying to make a hw-compatible game, and its
> going to be done using mode 4 graphics. I know that you have to do
> 16bit writes to VRAM, so I made a little read-modify-write
PlotPixel
> function. It looks like this:
>
> void PixelOn(u8 x, u8 y, u8 c)
> {
> u16 *p;
>
> p = &VBUFFER16[((y<<8)-(y<<4)+x)>>1];
>
> *p = (x & 1 ? (*p & 0xFF00) | c : (*p & 0x00FF) | (c << 8));
> }
>
> It gets compiled right, there arent any weird optimizations. After
I
> optimized 2 little stupid lines out, this is the ASM:
>
> void PixelOn(u8 x, u8 y, u8 c) //a1 = x , a2 = y, a3 = color
> {
> __asm
> {
> MOV a4,a2,LSL #8
> SUB a2,a4,a2,LSL #4
> ADD a2,a2,a1
> MOV a4,#0x6000000
> ADD a2,a4,a2
> TST a1,#1
> LDRH a1,[a2,#0]
> ANDNE a1,a1,#0x00ff
> ORRNE a1,a1,a3,LSL #8
> ANDEQ a1,a1,#0xff00
> ORREQ a1,a1,a3
> STRH a1,[a2,#0]
> }
> }
>
> I know it is in ARM, and I don't care for now. The real question is
> why this doesn't work on any emulator but Mappy and VGBA (I'm using
> 0.6)? I'm thinking its an emulator bug. Could someone test my
> function on real hardware?
>
> Thanks
>
> Rattboi
Sorry, I forgot to say what happens in other emulators. It draws
every even pixel, but not the odd ones. So my graphics look like
spaced vertical stripes. That's what leads me to believe that it is
an emulator problem. I don't think I've ever seen a hw-compatible
mode 4 demo that doesn't just do something like DMA a picture on the
screen. Anyways, if I could get some help, that would be greatly
appreciated!