Baby steps…

The story so far… I now have a compiler, emulator, tile editor and the NGPC Framework. If you want to play along then I have saved the versions of these that I am using here.

So, where to start…

There are a few bits of admin you need before you can start actually doing something useful.

First step – create a project folder. Simply unzip frmwrk3.zip into a new folder and rename to your preferred project name. By default this will build a NGP file called FRAMEWRK.ngp which probably isn’t what you want.

So start by editing the makefile and changing the NAME = line at the top like so:

NAME = STARTOVR

Use whichever name you like, by convention this should be eight characters, but it can be more or less if you like.

Secondly, edit carthdr.h and change the CartTitle to your project name like so:

const char CartTitle[12] = "STARTINGOVER";

There are some limits here that you need to be aware of. This must be exactly 12 characters long, no longer and no shorter. You can use spaces to pad this out if needed. It should also be as unique as you can manage – this will help if you ever try to bundle it on real hardware or on a multicart, but basically it’s just nice. Don’t tread on someone else’s toes.

Your last step is to create a batch file to do the make. You could do this manually each time using the command prompt, but generally it’s easier to just double click on a file and let the computer do all the hard work. For this, I create a batch file called “makengp.bat” which will look like this:

@path=%PATH%;C:\Data\Development\NGPC\t900\bin
@SET THOME=C:\Data\Development\NGPC\t900\
@PROMPT $P$_NGPC$G
@make
@cmd

Your path names should reflect the locations where you have installed the T900 compiler. This will run the MAKE for the project and leave you at a command line at the end – this is useful in case there are any compiler errors so that you don’t end up swearing at a blank screen wondering what went wrong.

Lets prove that it works, change main.c and edit the void main() function like so:

void main()
{
 InitNGPC();
 SysSetSystemFont();

 // TODO: add game code - and remove hello world :-)

 ClearScreen(SCR_1_PLANE);
 ClearScreen(SCR_2_PLANE);
 SetBackgroundColour(RGB(0, 0, 0));

 SetPalette(SCR_1_PLANE, 0, 0, 0, 0, RGB(15,15,15));
 PrintString(SCR_1_PLANE, 0, 2, 8, "Feels like");
 PrintString(SCR_1_PLANE, 0, 2, 9, "Starting over!");

 while(1); // never fall out of main!!!
}

Don’t fret too much about the function definitions for now, just bear in mind that all co-ordinates are relative to the NGPC screen size of 160×152 (or 20 tiles across and 19 down). Get used to those sizes, as everything you do from now on will be inside that space…

Save this and run makengp.bat. You should have a basic NGP build now, which when run will produce the following output:

startingover

That’s it. I, and you if you are playing along, have now successfully compiled our first NGPC ROM. Granted, it doesn’t do very much yet, but we’ll come on to that next time…

Advertisement

2 thoughts on “Baby steps…

  1. Hmm gives me this error
    make: *** No rule to make target `ngpc.lcf’, needed by `STARTOVR.ngp’. Stop.
    Something missing from the makefile?

    Like

    1. Hmm. Should be okay – it might be a problem with your environment settings. You should have the following in your values for %PATH and %THOME

      @path=%PATH%;D:\Development\NGPC\t900\bin
      @SET THOME=D:\Development\NGPC\t900\

      Where the main path is the installation path on your PC. Once you’ve got that, all you should need to do is to edit the makefile as it appears you’ve already done.

      It might also be that you have the older version of the T900 compiler. There was a previous one for Windows 2k which doesn’t work on current Windows versions.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s