PDA

View Full Version : nintendo ds / gba



noeska
07-11-2004, 04:25 PM
It seems that in the future it might be possible to use freepascal for gba and nintendo ds developement. The arm-linux crosscompiler is already available for download.

Anyone interested here?

WILL
07-11-2004, 08:19 PM
Heck yeah! :)

But what else would be required? What would you use for graphics and audio? What are the hardware considerations?

And will Nintendo be forthcoming with such information for indie-developers?

Legolas
07-11-2004, 09:18 PM
Et voila!

www.gbadev.org

:D

noeska
07-11-2004, 09:23 PM
or for the bare bones:
http://linux.gbadev.org/gcc-gba/

could tell use how to mod freepascal if needed

WILL
08-11-2004, 12:53 AM
How similar is the GBA to the GB DS? And what is the processor we're looking at?

noeska
08-11-2004, 09:31 AM
the gba and ds share the ARM7 processor. The DS also has an ARM9 processor. PS the DS is not released yet, so the specs for it are a bit uncertain. Most promising is the dual screen and stylus input. Gives me some great idea's for adventure games.

WILL
09-11-2004, 02:28 AM
Indeed. Well the second screen is supposed to be touch screen aswell.

Perhaps someone with GBA specs and maybe more indepth insight to the hardware(with research) can pioneer a set of Free Pascal docs/tuts/specs/code for others to collaborate on.

A Wiki site might be something great to use for this aswell... just add parts with FPC code and information or an in-progress guide.

WILL
27-11-2004, 09:21 AM
I have just posted a news item on a free online book I found, and it's all about development for the GameBoy Advance.

With a little work and the latest sources of Free Pascal it shouldn't be too hard to get a few GBA demos piped out. For hardware you can easily use an emulator like VirtualBoy. :) Some minor changes in the op codes for ARM7 would need to be adheired to, but other than that you're pretty much good to go at some point.

Legolas
27-11-2004, 01:42 PM
I found this (http://bottledlight.com/mappy/) emulator/debugger/sdk/many_other_things. It's written in Delphi and (!!!) you can download the source code! :D
Pretty interesting! :toocool:

WILL
27-11-2004, 10:15 PM
Thanks! I'll make a news post for next week. :D

I'm also contimplating what to do with all of these sources. There are tons, and with the fact that the new DS supports the ARM7 Advance/Advance SP and all of it's hardware, it makes the mind wander a bit no? :)

noeska
28-11-2004, 10:45 AM
hmm, i just did a try making a gba program using the freepascal arm port, but it seems that direct memory access is not implemented. I have no idea how to write such a thing. e.g assign the address $4000000 to the var (pointer) REG_DISPCNT. Maybe i can use assembly for setting that value, but i feel like cheating that way....

WILL
28-11-2004, 06:30 PM
Don't. :) The whole concept of programming for a console is to practically access the hardware directly. Doing as you suggest may even take better advantage of the system's resources.

My only question with that is, does the ARM variation of FPC support inline ASM for ARM? Some of the function calls are a bit diferent and data conventions are different in describtion(for native ARM anyway). See chapter 11 of that book I posted about in reference to what a byte, word and half-word is for the ARM.

noeska
30-11-2004, 06:55 PM
found out some more:
freepascal allows:
pointername := pointer(memoryaddress);

Next thing that happened is that the program compiles, but then says the generated assembly sourcecode is not valid.... :x

Doing a search for crosscompiling bin utils gave the following site: http://users.pandora.be/Jan.Van.hijfte/qtforfpc/SetupFPCCrossCompile.html

using the as compiler from those binutils i can manualy compile the generated assembly source without complaints.

Now i have to figure out to do this automaticaly as only my unit part gets compiled to an assembly source file. Freepascal does not want to use the right as compiler. Any ideas here....

But there is some progress.... slow but.... :)

noeska
30-11-2004, 10:47 PM
now i got it to compile my test program. But propably it is not a valid gameboy cartridge as visual boy advance under windows does not load it. Trying a linux gameboy emu it loads, but does nothing.....

Now on to finding out how to make a cartridge from the elf executable and replacing crt0.o with something gba like instead of linux arm like.

Ideas on this are welcome....

WILL
01-12-2004, 02:17 AM
Hmm... this might seem like an odd idea... but what about trying to hack around with a simple GBA rom? You could try using it's 'header' or whatever the GBA uses to id a GBA ROM.... maybe the Mappy VM source might give you a hint into this...

If I didn't have a big exam tomorrow I'd look into it tonight for you. :/ If you are still stuck later in the week and I manage to get a bit of time for it I may have a look.

{MSX}
01-12-2004, 07:59 AM
Ideas on this are welcome....

If you can create a correct "cartridge" with C compiler, you could try to do a very simple program (hello world), and do the same with pascal.
Eventually you will get very little code, and you could try to view differencies with headers, code and the like with an hex editor.
If you have some free time :mrgreen:

noeska
01-12-2004, 01:02 PM
i try to spend an hour evening per day on it. Also i keep an eye on: http://linux.gbadev.org/gcc-gba/ as mentioned before. It seems i have to convert the generated .elf file to something binary. Just have to find the tool in my linux as the tool is supposed to be part of the binutils....

The hardest part wil be replacing the crt.o of linux arm with the gba one.

savage
01-12-2004, 01:32 PM
WOW!! This is exciting!!! Look forward to reading more about your progress.

{MSX}
01-12-2004, 06:49 PM
It seems i have to convert the generated .elf file to something binary.

If i remember well this could be done with fpc directly. You can choose the kind of executable i think. Sorry if i can't give more info.

noeska
01-12-2004, 07:20 PM
i now seem to be able to make fake cartridges, but the emulator loads it and does nothing, although i meanth it to draw one pixel. Adding something like writeln('hello') causes the emu to crash.... so at least some code gets executed....

if the free pascal compiler needs to be modified to implement crt0.o for the gba i am not going on with this project as i do not have enough knowledge for changing the free pascal compiler.

Legolas
01-12-2004, 07:26 PM
i try to spend an hour evening per day on it. Also i keep an eye on: http://linux.gbadev.org/gcc-gba/ as mentioned before. It seems i have to convert the generated .elf file to something binary. Just have to find the tool in my linux as the tool is supposed to be part of the binutils....

The hardest part wil be replacing the crt.o of linux arm with the gba one.

gcc-gba needs to link together (with ld) object file (for example yourfile.o) and crt0.o. Maybe your gba emulator can't find start function point because crt0.o is not linked. I don't know if your crt0.o file is good for pascal source... :?:
I must decide to install linux to do some test with fpc and gba :mrgreen:

Legolas
01-12-2004, 07:32 PM
if the free pascal compiler needs to be modified to implement crt0.o for the gba i am not going on with this project as i do not have enough knowledge for changing the free pascal compiler.

crt0.o comes from compiling crt0.s. This file make some initialization on gba hardware and sets the start function for your gba rom.
And, AFAIK, gba can't handle writeln function.

noeska
01-12-2004, 08:12 PM
i have already compiled crt0.s to an crt0.o file. It just does not get included properly so it seems. And i do not know how to change free pascal so it does, nor do i know how to use ld manualy. Replacing the crt.o from free pascal with it brings no avail also....

Who knows how to change free-pascal?

It is important as i discovered something inside that looks like cartridge header inside....

brings to my mind how does one include an .o (or .obj) in an pascal file again.....

PS i do know writeln does not work, just a try to see if anything gets executed at all...

savage
01-12-2004, 10:06 PM
with the knowlede that you have, maybe it could be passed on to someone on the FreePascal team, who could make the changes.

WILL
02-12-2004, 01:49 AM
noeska: If you run into that wall, please tell us all you know about the problem and what the results(debugging information included). I frequent the #fpc IRC channel and keep my ear to the ground and also am able to pop in a question here or there.

Perhaps I can co-ordinate some kind of work-around for the problem. I'm sure that someone will be more than intrigued or excited about the prospect of someone working on GBA development using FPC.

noeska
12-12-2004, 01:09 PM
The main problem for the moment is that ctr0.s is not linked in properly. Without that things will never work as that prepares the gba for code execution. But even more important is the acompanying lnkscript that tells how it should be linked against the code. I did find a newer? version of crt0.s here: http://www.devrs.com/gba/ccode.php#cmisc.

I have no idea what to change in fpc to add those things.

WILL
12-12-2004, 05:21 PM
If FPK were able to provide you with the information you need and work with you on a port of FPC with GBA capabilities, would you be able to maintain it? I think that will be his driving force to help move that forward.

I for one would use it, as would at least 3 or 4 others from this thread alone. Plus who knows who else would be MORE than interested aswell.

I say, make the offer and I'll help you back it up with the user base thats interested simply by announcing it's versions and promoting it's use through tools, projects, etc.