gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > need a little help plz! for starters.. which code to learn ?

#28272 - ThUg4LiFe - Thu Oct 28, 2004 7:41 pm

http://www.gamedev.net/community/forums/topic.asp?topic_id=279158

please see this thread here for details. thanks all :)

#28273 - poslundc - Thu Oct 28, 2004 7:50 pm

Beginner's FAQ

Dan.

#28275 - ThUg4LiFe - Thu Oct 28, 2004 8:10 pm

thanks Dan.

anyone that can help - the tutorial suggests MinGW http://www.mingw.org/download.shtml for the compiler - im not sure which version i should download and how to use it?

Im desperate to learn


i already know how to use BASIC, QBASIC and VisualBasic (aswell as DOS, HTML and others) etc. Can a GBA game be programmed from VisualBasic or other BASIC code languages? Or would it be better and more efficient to use C/C++ ?

#28277 - ThUg4LiFe - Thu Oct 28, 2004 9:03 pm

im reading through the tutorial - and C code just seems kinda natural to learn.. in ways it is very similar to the different forms of "Basic" :) but i still do not have the compiler installed, which do i download from MinGW?? Can someone help me out please? :)

the way it explains things is very good. the writers need a lot of praise :D i feel like its made me understand the whole functioning of a computer better aswell - i can understand how it breaks everything down into codes (ASCII code which i was familiar with as a little kid, using a Amstrad) and eventauly into Binary (0's and 1's obviously)

#28278 - poslundc - Thu Oct 28, 2004 9:05 pm

Dragon BASIC is your only option for BASIC on the GBA. It can apparently do some fairly sophisticated stuff, but will be crippled unless you pay the registration fee, and is ultimately more limited than C/C++.

For the record, GBA programming is entirely different from anything you've done in the Windows or DOS environment, and BASIC is a much more forgiving and less complicated language than C or assembly.

I would recommend starting by learning the basics of C programming for your home computer (google "C tutorial"). Once you've got some practice and are VERY comfortable with pointers, go to a tutorial like The Pern Project and learn the rest from there.

I'm a Mac user so I can't help you choose a C compiler, although DevKit ARM is apparently the popular one these days.

Dan.

#28279 - ThUg4LiFe - Thu Oct 28, 2004 9:07 pm

thanks poslundc

i have decided it would be best in C, i thought it may be a shortcut to use a form of BASIC (thanks for the link) but i think i will keep learning C

no worrys about the compiler question, im sure someone here can help with that??? then i can start practicing what im learning

#28280 - keldon - Thu Oct 28, 2004 9:50 pm

Jumping from C to Basic is an easy step. And working with Qbasic is a great thing because you've probably mastered text mode programming, and understand it fully.

Once you're comfortable compiling code, you'll find that graphics is very similar to BasicA (real name of line numbered basic I think) where you were directly accessing hardware, and you have also have sprites =D

#28283 - ThUg4LiFe - Thu Oct 28, 2004 10:19 pm

i can already use basic

i know how to use and program with:- "VisualBasic" - "BBC Basic" which used the line numbers 10, 20, 30, 40 typically for each piece of the code - an older form of "Basic" but was functionally the same - and also "QBasic" in DOS

i have never used or learnt C before in my life but ive started tonight

i need a compiler though. id use the one suggested in the tutorial but i still have no idea which coz there is several on the page i linked in an earlier post

#28285 - sajiimori - Thu Oct 28, 2004 10:30 pm

Yeah, the MinGW download page sorta hints at which file you want, but it doesn't quite spell it out so it's a little confusing. The basic package is the one labelled simply "MinGW" in the "Current" section.

#28287 - ThUg4LiFe - Thu Oct 28, 2004 10:53 pm

thank you saj. downloading now :)

im three chapters through reading the C tutorial

#28291 - ThUg4LiFe - Fri Oct 29, 2004 1:04 am

okay.. i have the compiler installed. now i just need to know how to use it ???? lol im running WindowsXP..

as for learning C code... am up to chapter 5 of the tutorial in the Sticky thread.. somehow though i dont think it will teach me enough, JUST the tutorial on its own :\

#28292 - sajiimori - Fri Oct 29, 2004 1:08 am

The MinGW site has a documentation area with simple instructions on how to compile, link, and execute programs.

#28293 - ThUg4LiFe - Fri Oct 29, 2004 1:19 am

thanks, i will have a look and see if i can find it tomorrow :)

#28336 - ThUg4LiFe - Fri Oct 29, 2004 8:50 pm

okay i have a problem still, i havent "binded" the MinGW folder.. it had an automatic option during install and i had to enter the directory location of MinGW but i couldnt get it to work, so it said do it manually (as described below) but it doesnt explain very well for someone who doesnt know C code programming lanuage yet (i.e. me!) so i cant practice what im learning yet.. can someone help me understand what im to do and what codes to enter into MSYS to bind MinGW?

Quote:
File: README
Copyright (C): 2001, 2002 Earnie Boyd <earnie@users.sf.net>
Distribution: See MSYS_LICENSE
MSYS Revision: 1.0.10
MSYS Revision date: October 31, 2002

Preface:
Ok, you have installed msys and now you're reading this to understand how to get started. However, I must first explain some important facts about Msys. Msys file system bindings (mounts) are automatic and happens as described in table 1. These automatic file system bindings are not changable by the user. User defined file system bindings can be created by specifying them in the /etc/fstab directory as explained in table 2.

TABLE 1 - Automatic file system maps:
+ ---------------------------------------------------------------------------- +
| The automatic mounts are relative to where the msys-1.0.dll (DLL) is located |
| such that the following is true: |
| |
| / - is the parent directory of the directory containing the DLL |
| /bin - the direcotry containing the DLL |
| /usr - the parent directory of the directory containing the DLL |
| /usr/bin - the directory containing the DLL |
| /tmp - the value of the TMP environment variable |
| /c - C:\ |
| /d - D:\ |
| . . . |
| /z - Z:\ |
| |
+ ---------------------------------------------------------------------------- +

TABLE 2 - /etc/fstab layout:
+ ---------------------------------------------------------------------------- +
| The record format for the /etc/fstab is current a simple one. I need to |
| work on the syntax parsing more so that things like embedded spaces work. |
| If you wish to map a path with spaces you must use the DOS style name. |
| |
| The record format is as follows: |
| d:/some/foo/path /bar |
| |
| As you can see this is simply the Win32 path mapped to a mount point. It is |
| unix practice to have the /bar created as an empty directory before it can |
| mount the mount point. Msys doesn't force this but it will be to advantage |
| if you do. Some programs, e.g. find, and some operations, e.g. tab |
| operate better if the physical directory is present for those mount points. |
| |
| If you create a /etc/fstab record that maps to an automatic mount point Msys |
| will remove it when it adds the automatic point. This means that at some |
| small moment in time your mount point actually exists. However it doesn't |
| exist long enough to be of any use to you. |
| |
+ ---------------------------------------------------------------------------- +

Msys will convert POSIX paths that are used as arguments to Win32 paths. This is done for any executable not in /bin and /usr/bin. If the executable is dependant on the msys-1.0.dll then it must be located in the /bin or /usr/bin directory. This means that you now have a POSIX environment that will automagically do the right thing w.r.t. changing the paths passed as arguments. Arguments beginning with a // are considered to be Win32 style switches and will be passed to the program with // converted to / to allow for the command.com/cmd.exe (Win32) style switch. An example of a Win32 style switch is `write //p /mydocs/msys-rocks.' In this example write (a.k.a. WordPad) exists in the c:\winnt\system32 path on my system. The //p becomes /p which tells write to print the document. And mydocs/msys-rocks converts to c:\msys\1.0\mydocs\msys-rocks so that write can find it.

STARTING Msys:
Starting Msys should just be a matter of clicking on the MSYS icon on your desktop or Start menu. If you have the File Manager window open, you may now click on it and have it start also. Doing these presents you with a console window within which you may enter commands.

Working with MinGW:
If you already have MinGW installed then simply bind the path to MinGW to the /mingw mount point in the /etc/fstab as described above. If you don't have MinGW installed already then simply unarchive the MinGW tar.gz file in the /mingw directory. DO NOT unarchive the MinGW tar.gz file in the / directory.

Working with other products:
I find that the easiest thing for working with other products, such as Microsoft Office, is to create a script pointing to the executable. An example of a script for Microsoft Word on my system looks like the example in Table 3. I have this stored in my /usr/local/bin directory with a filename of word. Now all I need to do to edit a word document is `word /mydoc/proposal.doc' and voila up pops a Microsoft Word window with my document in it.

Table 3 - Script to execute MS Word from the command line:
+ ---------------------------------------------------------------------------- +
+ #!/bin/sh +
+ start '/c/Program\ Files/Microsoft\ Office/Office/WINWORD' $@ +
+ ---------------------------------------------------------------------------- +

Other documentation:
Be sure to read the MSYS_ series. I have tried to document how I'm changing the cygwin code to allow us to use it with MSYS. These can be found in the /doc/msys directory, or you can find them in the /usr/doc/msys directory.

Using binaries with different runtimes:
You can't use Cygwin binaries at all and if you try you'll most likely just cause the processes to "hang". You can use Win32 native binaries but you should put them into the /mingw/bin or your /usr/local/bin directory tree. If you wish to replace an MSYS binary with a native win32 version then delete or rename the /bin version.

Effective use of the clipboard:
You may use the clipboard with MSYS. When using rxvt (the default installation) as the terminal, just selecting with data with click and drag of the mouse, copies the data to the clipboard. To paste the clipboard data in the rxvt terminal you can Shift and Left Click or press both mouse buttons if 3 button mouse emulation is on or press the mouse wheel. To copy the highlighted data to your favorite windows email client the you use the paste options for that program, typically Ctrl-V. You can also use interesting bash shell commands such as `cat /dev/clipboard > /tmp/foo' or `less -f /dev/clipboard'. Data entered into the clipboard by non-MSYS programs can also be used by MSYS programs and vice versa.

Bug Reports:
Send your bug reports to MinGW-msys@lists.sf.net.

User Posts:
MinGW-msys@lists.sf.net

Disclaimer:
Products mentioned in this and other documents are solely owned by their trademark owners. We claim no rights to those trademarks and any mention of those products are for example only. Your uses of those products are your responsibility and no endorsement of any mentioned product is being given.

Change History:
Version 1.0.3 added checks for paths following an `=' and `-X' where X
is a program switch.

Version 1.0.4 added symlink resolution, removed the dependancy that the pathmust begin with a / and removed bash.exe since sh.exe is bash.exe anyway. Also added diff, diff3 and head to the distribution. An MSYS icon exists in the rxvt binary.

Version 1.0.5 is a bug fix release that filters out the conversion of quoted relative paths. So that -DSOME_CONSTANT=\"1.0.5\" can be properly input into gcc. Also fixed the problem with sh.exe reading /etc/profile with \r\n line endings. Added the binaries true.exe, false.exe, tail.exe and fold.exe. Updated the gmake binary to the Cygwin version including the --win32 switch. I am suggesting to use this version of make and have copied /bin/gmake.exe to /bin/make (yes without the .exe). If you wish to go back to the "native" version of make typing make.exe will get you there.

Version 1.0.6 through current: See the appropriate MSYS-<version>-changes.rtf document.

#28344 - ThUg4LiFe - Fri Oct 29, 2004 10:19 pm

im dying to get his working

i already have an idea for a simple basic text/character-based game/program like Pac-Man but simpler and just ways pf trying out the basic things ive been reading

but i need this MinGW thing sorted !!!!!!! someone please help lol no-one's here

am also struggling to get my head around how to enter my written code and compile it as a program.. i really need some extra help :(

#28348 - sajiimori - Fri Oct 29, 2004 11:55 pm

I have no idea about MSYS... I only use MinGW. It's easy to install by itself, so I'd suggest stepping back for a moment, uninstalling whatever else you got, and just doing MinGW. It's all you need, and I think the only manual step you have to perform is adding it to your path which is easy.

#28350 - ThUg4LiFe - Sat Oct 30, 2004 12:21 am

adding it to which path..? im so longing for some kind of step-by-step instruction webpage or article on how to get started with this

once i understand what i need to do to get started and how to do it, id have no problem and be able to start testing codes

#28352 - mymateo - Sat Oct 30, 2004 1:22 am

Grr... I had typed out half of the answer to you question, then I opened a folder to make sure I was telling to go to the right place, and it all went away...

Anyways, here goes...

You need to find your autoexec.bat file. You will find it in the root of you windows drive (usually C:\). Double-click "My Computer", then "C" (or whatever drive Windows is on), and there it is.

If you cannot see it, you may need to do one or two things. First, for Windows XP, make sure you click on "Show the contents of this folder". Secondly, click on the "Tools" menu, and then "Folder Options". Switch to the "View" tab, and scroll down just a little ways, maybe 4 lines, until you see the options "Show hidden files and folders" and "Hide protected operating system files (Recommended)". If you only see one of these options, don't worry because not all versions of windows have both. In fact, I think only XP and perhaps 2000 have the second option.

Anyways, select "Show hidden files and folders" and un-check "Hide protected operating system files (Recommended)". Now you should be able to see the autoexec.bat file. Open it with your favorite text editor, notepad is good enough. If you use Word or something of that sort, DO NOT save it with any extra stuff like fonts, just plain text.

You may see the line "Path= blah blah blah", you may not. Simply add the path to the folder you need your programs to have easy access to.

Example 1 - Adding on to an existing path
Before
Path = C:\;C:\Windows
After
Path = C:\;C:\Windows;D:\Progra~1\Myprog

Example 2 - Creating a path
Before

After
Path = D:\Progra~1\Myprog

Save and exit the file. Note what I did in my example also. It's good practice when you have long pathnames or paths with spaces in them to truncate the name. Keep the name of the folder, don't change that! But when you type it in to your path line, type the first 6 letters, the tilde (hold shift and hit the button to the left of the one - on most keyboards), then 1. Keep in mind also that if you have any other folders (or had at one point) with the same first 6 letters, then Windows might not see it as ~1, it might see it as ~2 or ~3. Open the properties of the folder, and see the pathname. Older Windows OS's will show you the actual DOS name (with tildes) to take out the guesswork. XP doesn't, you might just want to experiment with it.

Whew... Okay, hopefully that was helpful and not too long-winded. But, in a nutshell... well, not a nutshell but anyways... that's how to add to your path!

#28353 - ThUg4LiFe - Sat Oct 30, 2004 1:40 am

ahh now i know what is being meant :) i used to mess with the AUTOEXEC.BAT file constantly when i had my 486 running DOS 6.22 and Windows 3.11, and i used DOS almost as much as Windows back then, especially when tryna make programs or games work better or newer games work on my old crap system, or when i upgraded it manually in different ways (CD rom, sound card) and updated the autoexec.bat and config.sys

once i have added it to the autoexec path, how do i actually use it to test a code? compile a code? and how should i go about writing the code before all that? ( also where do i save my written source codes and how should i name them? i think some questions are answered in the tutorial BUT because there are gaps in my knowledge - the same gaps in the tutorial, i cant fill them :-\ ) sorry 4 so many questions :(

#28355 - sajiimori - Sat Oct 30, 2004 2:25 am

WinXP doesn't have autoexec.bat. You set the path in the system control panel, under "environment variables".

You can edit text files with notepad or whatever you like. I like an editor called ConTEXT.

Save files anywhere you want.

Compiling involves using the command prompt. If you don't know how to use the command prompt I think there's a link to a tutorial in the FAQ.

Like I said before, there's a tutorial on actually invoking the compiler on the MinGW site.

Let us know where you get stuck, but try to be specific about what you don't understand.

#28356 - ThUg4LiFe - Sat Oct 30, 2004 2:51 am

thanks, i will try out whats suggested. im trying to be specific but its a little hard at the moment. feel like im lost as its partly new language i dont quite understand pieces of, and the concept of how you program in the language and use your program and such... so at the moment im having quite broad unspecific problems lol because i dont know where im going kinda thing! once i understand the path im taking, im sure i could even work it out for myself.. but i feel like ive got to find the path but the directions are in another language!

sorry for all the metaphors ;)

so for using the command prompt to compile.. do you the DOS command prompt? because before, i had MSYS up and that had the C code programming command prompt

------

also - if im just using a text editor to write my code, that would mean i cannot test it on the C command prompt, and would need to be compiled so it is an executable file? i mean even just to test a code? or is that the only way to do it anyway

#28359 - sajiimori - Sat Oct 30, 2004 3:27 am

I don't want to sound harsh, but you seriously need to go out and read, and keep reading until you know what the little C:\> means, and what a file is, and how files are layed out on your hard drive, because many of your questions are completely unrelated to GBA programming and are more related to using a PC in general.

Until you have some more specific questions, don't expect more than a link to documentation. Why would we duplicate what is already out there?

So, there are link to command line tutorials in the FAQ.

#28372 - mymateo - Sat Oct 30, 2004 8:08 am

I have to hang my head in shame now... I forgot about XP and it's lack of legacy support... not that it won't support DOS apps, it just makes it more "fun" to make 'em work...

Anyways, I have to agree with sajimori. Best to stick to the docs to get you started, and there's an off-topic section if you need help figuring out the compiler and how to set up your computer. Please, try your best, you'll get there!

One little piece of advice... try not to ask too many questions. It would start to look like you're not trying, or trying to get everyone else to do your work for you. I'm not accusing you, just trying to keep you from getting kicked off the forums. Look for posts from someone named "Pirro" and you'll see what I mean.

Good luck, hope to see you back here when you're ready!

#28374 - ThUg4LiFe - Sat Oct 30, 2004 12:11 pm

i do know what "C:\" means in DOS/Windows but i feel like lots of things arent explained in the documentation. or the terminology used throws me :-\ i dont know why im having so much problem

it was the same when i tried to use a Renderer for GMAX called Yafray.. the documentation wasnt that helpful :-\ im just not used to working with scripts, codes and non-executable files for a long long long time. in the end i found out that i have to i) also download the yafray exporter ii) put the exporter scripts in the gmaz scripts folder iii) then do several things to your GMAX scene to make it renderable iv) then run Yafray from a Command Prompt (cmd). NONE of that was explained in the docs and i had to rely on help from those in a forum back then too, and somebodys SELF-wirtten guide and documentation

-----

i mean for e.g. i installed MinGW but then, how do i use it???? it says in the documentation "DECIDE HOW YOU ARE GOING TO USE IT" but then it doesnt give no guide on how to use it and the possibilities. so how can i decide???? :-\ some of the things seem like a vicious circle


ive never had this much problem tryna learn AND USE a code before, BASIC - easy. DOS - easy, QBASIC - easy. VisualBASIC - easy, HTML - easy........................................... C - seems understandable enough - but i dont have the option to use and try it (yet)

#28376 - ThUg4LiFe - Sat Oct 30, 2004 12:26 pm

i feel urges to give up :( i wont... but i have been reading constantly the last few nights and im not any closer to getting over this initial hurdle :-\ i understand how a drive works, how files work, how a structure work

what i dont understand is how you use this to program code with C

some things i dont need explained in great detail AT ALL, i just need to know 'what' needs to be done - then i can do, and understand how to do it by myself

#28378 - ThUg4LiFe - Sat Oct 30, 2004 12:44 pm

hmm actually i think ive understood it now

ive had to go back and look at chapter 1.1 of the C tutorial again (ive read up to chapter 6.3) it explains there the answers to most my questions. i apologise

i guess i just read too much, too quickly, without being able to try anything, and thus forgotten little points already made at the start of the tutorial

but now i have MinGW installed and think i have worked out how to use it now from re-reading this part of the tutorial

thanks for all the help though and im sorry to be a pain

#28379 - ThUg4LiFe - Sat Oct 30, 2004 3:05 pm

should the path be to C:\Progra~1\MinGw\bin where the gcc file is? or just C:\Progra~1\MinGW?

#28380 - ThUg4LiFe - Sat Oct 30, 2004 3:17 pm

never mind. stupid question again :( the answer was in the question lol

i have it working :D

#28382 - tepples - Sat Oct 30, 2004 3:27 pm

mymateo wrote:
I have to hang my head in shame now... I forgot about XP and it's lack of legacy support... not that it won't support DOS apps, it just makes it more "fun" to make 'em work...

Nit: MinGW is not a "DOS app". It's a Windows app, using Win32 API, that happens to operate through a terminal environment rather than inside its own window. Windows 2000 and Windows XP support it just fine; in fact, there are a whole bunch of ways to get folders into the Path, including writing a batch file and having a shortcut to Command Prompt call it (which is what DevKit Advance used).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#28406 - mymateo - Sun Oct 31, 2004 1:52 am

(Sorry, I've never really used MinGW... in fact, never at all. So I was really just referring to WinXP in general, what with no autoexec.bat, although mine has one... never really looked into it before to be honest. But all that aside, thanks for the info!)