#178367 - Edward_Stryfe - Wed Apr 08, 2015 3:11 pm
Hello my name is Edward Stryfe[Last one's an alias of course] and I am looking into developing some open source games for gb/c/a. I really can't stand the madness between the copyright people going insane over illegal emulation and the lack of decent legal open source alternatives. Now I'm looking into programming with the C language. While desperately searching for tutorials I noticed that there is this other strange language I've never heard of known as z80, and ASM.
I'm new to coding in general and am probably going to learn C unless one of the latter are a better choice. I really wouldn't know but I do know you can programing applications and parts of operating systems with C. Another thing is that I have now two compilers, a GB[GBDK] and GBA[DEVKITADV]. I noticed that GB programming is super simple and child's play in comparison to the GBA. However, I was wondering if it would be logical to learn GB and port some applications of C into the GBA or is that just utterly ridiculous?
Thanks in advanced for any responces guys n' gals.
#178368 - sverx - Wed Apr 08, 2015 3:56 pm
The GB is a 8 bit machine, you would probably program it in ASM. Its processor is just slightly different from the Z80.
The GBA is a 32 bit ARM machine. You can program it using C and devkitARM.
_________________
libXM7|NDS programming tutorial (Italiano)|Waimanu DS / GBA|A DS Homebrewer's Diary
#178369 - Edward_Stryfe - Wed Apr 08, 2015 4:23 pm
Thanks for the reply but this tutorial gave me some code along these lines:
#include <gb/gb.h>
#include <stdio.h>
void main() {
printf("Hit Start\n\n");
waitpad(J_START);
printf("Ok how about B?\n\n");
waitpad(J_B);
printf("You Win!!\n");
// Other buttons are J_A J_B J_DOWN J_UP J_LEFT J_RIGHT J_START J_SELECT
}
This is C and worked when compiled into a gb rom but not a GBA rom because the keys are different and the void main() function is inapplicable but the GB seems to be more simple over all so I'm trying to figure out if learning it and than moving to GBA would be easier or not.
#178372 - DekuTree64 - Thu Apr 09, 2015 3:49 am
I don't know much about the original Gameboy/color, but I doubt that it would be easier than GBA. I'm not sure exactly what the limitations are when writing C code for an 8-bit processor, but I doubt you could make a game of much complexity before running into trouble. Especially if you're not familiar with the instruction set of said 8-bit processor, so you're likely to make it jump through hoops trying to do apparently simple things.
GBA's ARM7 is a beast by comparison. Writing assembly code for it feels almost like a high level language compared to most processors. And C code is usually quite straightforward to "mentally compile", and is a great match of language for it. Its biggest shortcoming is that there's no hardware divide instruction, so look at any division operations as a fairly expensive function call. There's also no floating point unit, so stick with integer math if possible.
As for the main function, I vaguely recall needing it to be named GbaMain or AgbMain or something like that. If there's any example code with DevKitAdv, you should be able to find it. Or just upgrade to DevKitARM, which uses int main() or void main() like normal.
Also, if you haven't run across a document called GBATEK yet, go look it up. Best reference manual there is for GBA (and DS). Even better than the official manual.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#178373 - Edward_Stryfe - Thu Apr 09, 2015 4:42 pm
Hey man thanks alot for the input, I have not heard of GBATEK but I recently had downloaded a gba programming manual called "A Step By Step Guide to Setting up a Development Enviroemnt for the GBA" by some youtuber called GAMER2020.
Also from what can tell int main() function is working the best awith my compiler. Also would you happen to know the cost of a writable GBA catridge and if it can run GB/C games on it? I don't have a GBA physically at the moment just working with emulators but know a guy that can get me a GBA so I want to know if the hardware is functionally compatable with my stuff also because I preffer to use the actual console as opposed to emulation.
Also is there a way to get/make writable catridges for really cheap? In the case of mass production? Because I'm on a couple of development teams and am in the middle of starting up a company [gotta start sometime XD] and a physical copy of the game would be nice because I want to release the rom version for free.
#178374 - AntonioND - Thu Apr 09, 2015 10:24 pm
The GBA detects if a game is GB/GBC or GBA using the physical shape of the cartridge so you can't have a flashcart for both modes.
Using C in GB is a bad idea. The GB is very slow, so you need to make the code as fast as possible, and that can only be achieved by writing in ASM. GBDK is very buggy, I sometimes came across some errors and the error messages were just "internal error" or things like that, so I had to try random changes in the code until it compiled.
Also, if you want to use the same code in both consoles you'd need cross platform libraies. That's stupid in the case of old consoles like GB or GBA because they are so limited that the only efficient way to code for them is to use specific libraries. For GBA the best idea is to use libgba (the one that comes with devkitPro) or libtonc. Also, Tonc is the best tutorial for GBA: http://www.coranac.com/projects/tonc/
If you want to code something simple, do it in GBA. The GB is a simpler hardware, but that doesn't mean it's easier to code for it, only that it's easier to know how it works. The GBA is much easier if you want to do games.
#178375 - DekuTree64 - Thu Apr 09, 2015 10:55 pm
GBA flash carts seem to be pretty rare these days. None in production as far as I know, so ebay would probably be your best bet. Make sure it includes whatever hardware is needed to write to it. Some use a separate writer that hooks to the computer parallel port, and others just use a little USB cable that plugs to the GBA link port, using the GBA itself as the writer.
GBA flash carts don't work on GB/C, and GB/C flash carts can't run GBA games.
Judging by the fact that Nintendo themselves were unable to get manufacturing costs down very low for cartridge games, I doubt a small operation could either. But I'm sure it's possible to produce physical copies if you really want to. I'd guess $5-10 per cart if you're willing to do soldering and stuff yourself, and making a decent number of them (like 50-100).
It is good to have hardware testing ability, but most of the time emulators are fine. GBA is a pretty simple system, so it's unlikely that you'll run into any differences between emulator and hardware.
And even if emulators are the only way you ever play the game, it's still fun to code for a "virtual machine" where you know exactly what hardware you have, and know that your game will be playable for as long as people keep writing GBA emulators for new computers/game systems in the future. Unlike PC games, which have a relatively short life before there's no hardware/operating system commonly available to play them on.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#178376 - Edward_Stryfe - Thu Apr 09, 2015 11:29 pm
Thanks a ton Deku, I'm probably going to make them myself in that case I've been dealing with that kind of stuff since I was 8. And on the fact of roms emulators and PC games that is almost my exact reason. I think that's all I needed from this thread thanks, now only if I could find a list of the parts in those carts...
_________________
____________________________
__________________________________
A Good Man Fights For Reasons All His Own.
--
A Great Man Fights For The Greater Cause In A Loosing Battle.
-Ed
#178379 - sverx - Fri Apr 10, 2015 12:26 pm
If you need something to test your homebrew ROM on your own GBA I can suggest a SuperCard SD or similar. You basically just put your SD/miniSD into it and fire up.
_________________
libXM7|NDS programming tutorial (Italiano)|Waimanu DS / GBA|A DS Homebrewer's Diary
#178381 - Edward_Stryfe - Sat Apr 11, 2015 10:48 pm
Hey guys I finally found a tutorial on how to make a GBA Cart and a XBoo cable I'm going to make torrents of the tutorials because they're dated and have bad links and the site looks like it's about to go down. I'll have it in a couple of days until then, anyone who doesn't know what a torrent is I will give a full explination and tutorial in the post with the files.
In advanced though you may want to install this application [about 100megabytes][the tutorial with the applications necessary is ~400megabytes]
https://sourceforge.net/projects/darksabre76apps/files/Deluge%20Portable%20%28PortableApps.com%29/Dev%20Tests/DelugePortable_1.3.7_Dev_Test_1_English.paf.exe/download
_________________
____________________________
__________________________________
A Good Man Fights For Reasons All His Own.
--
A Great Man Fights For The Greater Cause In A Loosing Battle.
-Ed
#178382 - Edward_Stryfe - Mon Apr 13, 2015 3:47 pm
Hey guys I have finally finished making the tutorial on how to make your own GBA flash cart. Now it is in a .torrent file and I will give an explanation as to how that works in the lower segment of the post. I have included all the needed applications for the tutorial and a .pdf document giving all the necessary insctructions. Now I have three different types of download, one is all of them in a folder plain and simple, another is downloading the .zip file, and last but not least there is downloading just the .pdf file.
magnet:?xt=urn:btih:5cd5e086dd607e8961540c55a92656820ee1d861&tr=udp://tracker.openbittorrent.com:80/announce
The Full Package ~300 megabytes
magnet:?xt=urn:btih:9d873590b5dc8c9af5ae0ac788ac1ecb99928b7d&tr=udp://tracker.openbittorrent.com:80/announce
The Full Package In a .ZIP File ~120 megabytes
magnet:?xt=urn:btih:16473485e1747ede81769f7ce85bfe8fb8034f6a&tr=udp://tracker.openbittorrent.com:80/announce
Just the .PDF Document ~1 megabyte
Torrents:
Now I'm not going to go into the whole description, functions, bianary make-up and ect. I'm just going over how to use them with a torrent client.
First install the client linked in my above post, than start the .exe file. Then hit the large blue + sign to the upper left of the program, and then select "Url" a text box will than appear. Go to this post and copy the links given [Only one] and paste it into the text box. Than hit "Ok" followed by "Add" to choose your download location go to the "Options" tab and then where it says the directory "Downloads" click it on the dropdown menu and select "Other" and choose your download location. Then hit Add, and your download has begun (Note: I recomend downloading the full package {Not the .zip} you'll get the most millage out of that one)
Thanks again guys for everything you help my winy newbie butt with. You guys are totally awesome!!!
_________________
____________________________
__________________________________
A Good Man Fights For Reasons All His Own.
--
A Great Man Fights For The Greater Cause In A Loosing Battle.
-Ed
#178387 - elhobbs - Tue Apr 14, 2015 5:47 pm
Why an exe? Nobody is going to want to touch that.
#178391 - Edward_Stryfe - Wed Apr 15, 2015 4:25 am
*left wondering whether he was just a serious linux user, mac nerd sarcastic dude, or just cocky* Sorry the tutorial wans't as blunt as it needed to be, I make tutorials for like grandparents, and people who couldn't tell a function from a fraction
_________________
____________________________
__________________________________
A Good Man Fights For Reasons All His Own.
--
A Great Man Fights For The Greater Cause In A Loosing Battle.
-Ed
#178402 - Edward_Stryfe - Tue Apr 28, 2015 1:09 am
How to Create Your Very Own GBA Flash Cart - SeedPeer.me
I have uploaded the main torrent to this site so the links can work better.
_________________
____________________________
__________________________________
A Good Man Fights For Reasons All His Own.
--
A Great Man Fights For The Greater Cause In A Loosing Battle.
-Ed