Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Simple GBA (and maybe DS) compiler/assembler | | | |
Pages: 1 2 | Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Ramsus Octoballoon Level: 19 Posts: 139/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
There are no functions right now (the GBA doesn't have any system software that I know of). You set a pointer to the address that the screen's video memory resides in and a pointer to the address of the register that controls the screen drawing mode, copy a value for the desired mode into the second pointer's location, then copy data to the screen's memory in the format used by the mode you set it to. In other words, this is where you look up basic GBA development documentation. I'll find and list some this weekend. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5762/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I mean library functions, like printf(). (That appears to exist... no errors compiling it anyway.) What all of those are there? And yes, the GBA has a BIOS to do things like math and such (DS should too...?). I don't know a whole lot about it but I do know the basics of how it works. [edit] I looked through the header files, and I just don't get it. It's all Unix stuff. Filesystems, signals, threads... none of this has anything to do with GBA. (edited by HyperHacker on 07-15-05 02:27 AM) |
|||
Sokarhacd Ball and Chain Trooper Resistance is Futile You Will Be Assimilated Hab SoSlI' Quch Level: 61 Posts: 1494/1757 EXP: 1799888 For next: 76708 Since: 03-15-04 Since last post: 6 days Last activity: 4 hours |
| ||
if you want easy functions, that have to do with the GBA, get one of the mentioned, HAM, or DevKitArm, they have headers for stuff, and HAM is better for that, since most functions are already there, like displaying an image, writing text, all that. someone also made a 3rd party library with titlescreen functions, and some other interesting ones, so thats probably worth checking out more(http://ngine.de) its like a 40-50MB download. | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5776/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well I can just as well download a library or write my own... just wanted to know what stuff is available in this one, and why there's all this Unix stuff. | |||
Ramsus Octoballoon Level: 19 Posts: 140/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
Originally posted by HyperHacker Those are just standard C library and POSIX functions that came with newlib. You don't really need them for gameboy development, and most of them shouldn't do anything on the GBA. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5829/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
So there's nothing GBA-specific here? Not even printf()? | |||
Kyoufu Kawa I'm not bad. I'm just drawn that way. Level: 70 Posts: 1842/2481 EXP: 3008456 For next: 7355 Since: 03-19-04 From: Catgirl Central Since last post: 14 hours Last activity: 13 hours |
| ||
Any standard library functions I've seen on GBA weren't in any library. I actually have a printf.c file in Catnip. | |||
Ramsus Octoballoon Level: 19 Posts: 143/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
Originally posted by HyperHacker Nope. You've only installed an assembler/linker, a compiler, and a standard C library, all designed to be portable. These things should just work out of the box: optimized memory copying/clearing functions (written in assembly), most string and math functions, qsort, etc. You'll have to mess with the linker script and crt0.o object image to get things like malloc/free working and to supply some functions for newlib stubs (like _write_r, so you can use newlib's printf, but then you need the newlib documentation for details). You might also consider rolling your own custom allocator instead of using malloc/free. One really nice thing about everyone using GCC and newlib is that there are already custom linker scripts and crt0.s files out there you can just download, assemble, and use -- assuming your setup doesn't have one already. That'll make it so a lot of things work properly on a GBA. You can also write your own versions of whatever functions you might need and link without any standard libraries (-nostdlib to give it a try, use start instead of main as the entry point). If you do this, your code should only have includes for your own headers and use functions in your sources, but it'll be a lot smaller. EDIT: Here's a list of the headers you should have available: _ansi.h _syslist.h alloca.h ar.h argz.h assert.h ctype.h dirent.h envz.h errno.h fastmath.h fcntl.h grp.h iconv.h ieeefp.h langinfo.h libgen.h limits.h locale.h machine/_types.h machine/ansi.h machine/endian.h machine/fastmath.h machine/ieeefp.h machine/malloc.h machine/param.h machine/setjmp-dj.h machine/setjmp.h machine/stdlib.h machine/termios.h machine/time.h machine/types.h malloc.h math.h newlib.h paths.h process.h pthread.h pwd.h reent.h regdef.h search.h setjmp.h signal.h stdio.h stdlib.h string.h sys/_types.h sys/cdefs.h sys/config.h sys/dirent.h sys/errno.h sys/fcntl.h sys/features.h sys/file.h sys/iconvnls.h sys/lock.h sys/param.h sys/queue.h sys/reent.h sys/resource.h sys/sched.h sys/signal.h sys/stat.h sys/stdio.h sys/string.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/unistd.h sys/utime.h sys/wait.h termios.h time.h unctrl.h unistd.h utime.h utmp.h wchar.h wctype.h (edited by Ramsus on 07-17-05 04:24 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5855/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Alright, so how do I use these link scripts? Just replace the existing files in \crtls, and include stdlib like usual? | |||
Ramsus Octoballoon Level: 19 Posts: 144/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
Not quite. Delete the crt0.o files (or move them into a backup folder), then assemble crt0.s (as -o crt0.o crt0.s). Then in your projects, put crt0.o and lnkscript in the same folder and run gcc -T lnkscript to link stuff. You'll also need to use AgbMain instead of main. | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5892/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Wait... I've got a bunch of these. Which do I delete/rename, and where do I put the new ones? F:\DOS\gbadev\arm-agb-elf\lib\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\interwork\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\thumb\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\thumb\interwork\crt0.o F:\DOS\gbadev\crtls\crt0.S F:\DOS\gbadev\link_script\CRT0.S F:\DOS\gbadev\crtls\lnkscript F:\DOS\gbadev\link_script\lnkscript |
|||
Ramsus Octoballoon Level: 19 Posts: 145/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
If lnkscript is already there, then it was probably set up for you. If gcc wants you to use AgbMain, then that's the case and you can forget about setting it up yourself. Otherwise, you'd want to remove these: F:\DOS\gbadev\arm-agb-elf\lib\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\interwork\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\thumb\crt0.o F:\DOS\gbadev\arm-agb-elf\lib\thumb\interwork\crt0.o And put the crt0.o file that you assembled from crtls and the lnkscript file that comes with it in the same folder as the sources you want to compile. Then use gcc -T lnkscript -o whatever.elf main.o graphics.o input.o etc.o and objcopy -O binary whatever.elf whatever.gba |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5896/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well, AgbMain doesn't seem to be throwing any red flags, but there's still nothing happening. I figured this was supposed to be a full GBA library and all, but all I see is Unix stuff. And of course no documentation, because some... I can't think of a bad enough word... deleted all the Wiki pages and just filled them with links to God-knows-what. | |||
Ramsus Octoballoon Level: 19 Posts: 146/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
Yeah, I think the guy who maintains it went on a trip or something. Anyway, certain things like printf won't work without a lot of additional code porting more newlib features, but with crtls, malloc and sprintf should work just fine. Now you just need to write a few letter drawing routines and you can write your own version of printf (also look up varargs if you aren't familiar with them). There's a GBA library called SGADE here: http://www.suddenpresence.com/sgade/ You can make use of it with the newlib C library (now that you know the important parts work), but it doesn't require one. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5907/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Alright, but how do I know what will work and what won't? Trying to compile printf() doesn't raise any errors. | |||
Ramsus Octoballoon Level: 19 Posts: 149/162 EXP: 34651 For next: 1126 Since: 01-24-05 From: United States Since last post: 39 days Last activity: 71 days |
| ||
Generally speaking, you probably won't use the things that don't work. If in doubt, write a program to test it out or don't use it. Some things that won't work: pipes, sockets, files, stream-based I/O, threads, processes Some things that should work: string and memory functions, math Some things that might not work, or might work slowly: Floating point math functions You might consider writing your own memory copying/blitting functions that use GBA-specific code (DMA and what not), as well as your own memory allocator (maybe something stack-based? Also check out the alloca function. Nonstandard but very common.). |
Pages: 1 2 | Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Simple GBA (and maybe DS) compiler/assembler | | | |