Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Mode 4 single-pixel problem   Message List  
Reply | Forward Message #4119 of 15019 |
Re: Mode 4 single-pixel problem

--- 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!





Sat Jun 2, 2001 3:32 pm

bradonk@...
Send Email Send Email

Forward
Message #4119 of 15019 |
Expand Messages Author Sort by Date

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...
bradonk@...
Send Email
Jun 2, 2001
3:26 pm

... could ... PlotPixel ... I ... Sorry, I forgot to say what happens in other emulators. It draws every even pixel, but not the odd ones. So my graphics look...
bradonk@...
Send Email
Jun 2, 2001
3:45 pm

... This does work on my GBA (credit to Jeff for the cable) but I think the opinion of many here is that it will be faster just to plot 2 pixels at once and...
Pete
dooby@...
Send Email
Jun 2, 2001
4:25 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help