Adventures in Internet Publishing
Tuesday, January 11, 2011
  ARM Assembly Gotchas
31 is not the same as 0x31.
Immediate values can only be one (shifted) byte.


 
  Why am I doing this?
I'm getting sucked back into DS programming, because my expedition into Atari programming taught me some basic concepts that I just wasn't finding in the source material for DS stuff. I swear, I need to write a huge book on computer concepts from the ground up.

So the main problem I was having with understanding ARM assembly on the DS was the black magic / voodoo performed behind the scenes by GNU as. Specifically, that it takes labels and creates relocatable code, and that everything resides in memory, usually.

Well ok, so relocatable code means that only offset-based addressing is used, not hard-coded memory locations, so the code can be anywhere in memory. This is why the intermediate format used in compiling/assembling is ELF, I guess. The NDS header specifies where the code is to be placed, namely the start of shared ram, or 0x2000000. So how do we get graphics data in there?

Well, without using some kind of filesystem, all data has to be stored in main memory, either interleaved with the code (yuck) or in a blorb at the end (not as bad). Properly aligned, etc. So my next trick is to figure out what directives I need to use with as to accomplish that.

Update: Well, I figured it out, you can plop in data with either .word or .hword for 32-bit or 16-bit values, respectively. And it survives the objcopy process. I should be able to use output from grit, at this rate.

Update 2: Hooooooly shit it works

Update 3: There is something very strange going on with the code I'm using, time to do it all from scratch.
 

Name:
Location: San Diego, California, United States

I program old computers and calculators in my spare time.

Archives
January 2006 / March 2006 / May 2006 / October 2006 / November 2006 / December 2006 / March 2007 / May 2007 / July 2007 / August 2007 / September 2007 / November 2007 / January 2008 / March 2008 / April 2008 / May 2008 / June 2008 / August 2008 / September 2008 / October 2008 / March 2009 / October 2010 / November 2010 / January 2011 / February 2011 /


Powered by Blogger

Subscribe to
Posts [Atom]