#11279 - Mega386 - Wed Oct 01, 2003 1:32 am
i was thinking of making an assembler that will run on the gba itself. i have already written a command line OS for the gba. now i can save things like text files. say i write a prog in asm on the gba and save it to a file, how would i go about making it a runnable application?
#11283 - tepples - Wed Oct 01, 2003 3:20 am
You'll have to write a simple Thumb assembler in C. Don't try adapting the GNU assembler directly because like the rest of the GNU OS, GNU 'as' is optimized for speed and robustness rather than footprint.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#11292 - Lupin - Wed Oct 01, 2003 5:30 pm
hey, that's an very interesting idea, but I think writing an real assembler aint that easy...
you could try to create your own exe file format, since the ROM is already running you don't have to compile an real rom, but perhaps only 1 big function which you call from your OS, this function starts to render to the screen and does it job. You could also think of multi-threading so that the OS will still be able to be used while the program is running, then you could go about implementing an API and all that stuff.... why don't try to install windows CE on an GBA? ^^
#11309 - Mega386 - Thu Oct 02, 2003 3:18 am
i was wondering how would i go about writing a thumb compiler in c? i just need to know how to get started then i should be able to take it from there.
#11313 - sajiimori - Thu Oct 02, 2003 6:46 am
First, you need to know the binary format of each opcode in the Thumb instruction set. The NO$GBA docs seem to have an overview, or you can get the manual straight from ARM.
Then write a tokenizer that will divide a text file into pieces like instruction mnemonics, numbers, register names, and other symbols.
Next you need a parser that looks at the tokens and decides what to do next.
The parser can gather all the information needed to build a binary instruction, and pass it on to an instruction builder that forms the 16-bit value and writes it out.
Since you'll most likely want named labels, it would be easier to make a two-pass assembler that finds all the label names and locations first, then actually generates the opcodes on the second pass. That way you can jump to a label that's later in the file.
If you need any more help, you can IM me...I've written a few compilers and assemblers.