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

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

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
The fastet way to plot a single pixel in mode3   Message List  
Reply | Forward Message #13451 of 15019 |
If you want to plot a single pixel in mode3 you have to read back the
whole halfword from VRAM, mask it, and write it back.
The fastest routine i could come up with is (gcc assembler, plots colour 1):

r0 is the pointer to the byte for this pixel, colour in r2.

ldrh r1, [r0]
tst r0, #1
andEQ r1, r1, #0xFF00
addEQ r1, r1, r2
andNE r1, r1, #0x00FF
addNE r1, r1, r2, lsl #8
strh r1, [r0]


I'm sure this is suboptimal. Does anyone have a faster method?

/David





Fri Dec 6, 2002 10:57 pm

mpe501@...
Send Email Send Email

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

If you want to plot a single pixel in mode3 you have to read back the whole halfword from VRAM, mask it, and write it back. The fastest routine i could come up...
David
mpe501@...
Send Email
Dec 6, 2002
11:02 pm

... From: "David" <mpe501@...> To: <gbadev@yahoogroups.com> Sent: Friday, December 06, 2002 10:57 PM Subject: [gbadev] The fastet way to plot a single...
Mike Wynn
mike.wynn@...
Send Email
Dec 7, 2002
3:56 am

Hi David, ... Won't your code read and write from/to an uneven address if r0 is odd? Here's my code that takes x,y coordinates, checks they're on the screen, ...
James Daniels
j_r_daniels
Offline Send Email
Dec 7, 2002
3:57 am

... You thought right. My code was totally wrong. ... Really? After posting my last message i read the arm7tdmi docs and it said that if you used strh/ldrh you...
David
mpe501@...
Send Email
Dec 7, 2002
12:41 pm

... Yepp, that seems sound. But it still seems a lot of code to plot a single pixel =(...
David
mpe501@...
Send Email
Dec 7, 2002
12:50 pm

Hi David, ... Yes - but do you really need to draw single pixels? If you're drawing almost any kind of shape you can split it up into spans. This allows you to...
James Daniels
j_r_daniels
Offline Send Email
Dec 7, 2002
11:57 pm

... then. ... use ldrb/strb (ewram, iwram can be accessed with 8 bit reads, unlike vram ) then 32 or 16 bit dma from ram to vram. or something like : @;; r0<-...
Mike Wynn
mike.wynn@...
Send Email
Dec 7, 2002
1:47 pm

... unlike vram ) ... Yes, I would use something like this. It defeats the purpose of having a hardware double-buffer, but if you need to do a lot of pixel- ...
Dennis Kincheloe <Dek...
dekutree65
Offline Send Email
Dec 7, 2002
4:13 pm

When I was working on a 3D engine for GBA, a while ago, I experimented with having N number of scan line buffers in fast RAM. Polygons were first "rendered" in...
Martin Piper
fnagaton
Offline Send Email
Dec 7, 2002
4:40 pm

"I could render he next scan line with the CPU and this avoided waiting for the DMA to complete the copy" I'm not sure if I follow you here! Surely DMA halts...
ninge
n1nge
Offline Send Email
Dec 7, 2002
4:59 pm

From what I remember DMA copies to VRAM can only happen during HBLANK and VBLANK. To avoid stalling the CPU the DMA is triggered to start during these periods,...
Martin Piper
fnagaton
Offline Send Email
Dec 7, 2002
6:47 pm

Thanks for the replies everyone! ... This is another issue i've been wondering about. The point of not always inlining (the point of using functions at all) is...
David
mpe501@...
Send Email
Dec 8, 2002
12:56 am

Hi David, ... Sometimes - although you've still got the extra overhead of branching to the function and storing the registers so it's not always that clear ...
James Daniels
j_r_daniels
Offline Send Email
Dec 8, 2002
1:57 am
Advanced

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