gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Plotting a pixel Mode 4

#10305 - slip - Tue Sep 02, 2003 1:29 am

Ok, I'm using ARM asm, it seems a little strange. When I write a single byte to VRAM it appears to write the byte twice, appearing to be two pixels plotted... I'll try and explain a little better..

I have a 32 bit word 00000000000000000000000011111111 which looks like that. that is my 'byte' I want to write. I'll find an address in VRAM and use strb to store the byte... thats what I'm using ^^ I'm asuming that when writting a byte from using a 32bit word the lower 8 bits will be used. The result however looks like this.. say this was a 32bit word in VRAM.

before write
00000000000000000000000000000000

after write
00000000000000001111111111111111

or
11111111111111110000000000000000

depending on the address.

I'm a little confused about this. Does ldrb and strb read and write 16 bit words =\
I'm trying to write a mode 4 pixels plotting routine.
_________________
[url="http://www.ice-d.com"]www.ice-d.com[/url]

#10306 - DekuTree64 - Tue Sep 02, 2003 2:36 am

The VRAM bus is 16/32 bit only, no single bytes. If you want to draw a single pixel in mode4, you have to read 2 pixels, mask to get rid of the one you want to change, OR with the new pixel, and write both of them back. Yes, it's slow, so most of the time you'll want to try your hardest to write more than one pixel at a time.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku