F9 = Compile
You already installed ConTEXT and my highlighter. Now we’re going to make F9 our “compile” key :)
Now, there is a slight difficulty because of the way WLA DX works. It works in two stages, “compiling” and “linking”, designed for systems set up for compiling programs with a “make” utility (like Linux). For us normal types, we need to get it going manually :( so I’ve written a batch file to do it. I’m sure there’s a more elegant way to do it, and it will only work with a single source file so for a really advanced project I recommend you figure that stuff out. The batch file is called compile.bat and is included with the WLA DX download above.
Then open ConTEXT and click on Options, Environment Options, Execute Keys. Click Add and enter “asm” in the box. Then click on F9 in the list. Enter the path to compile.bat in the “Execute” box, “%p” in the “Start in” box, “%n” in the “Parameters” box, “*:%n:%l: *” (asterisk, colon, percent, lowercase N, colon, percent, lowercase L, colon, space, asterisk) in the “Compiler output parser rule” box, and check the “Capture console output” and “Scroll console output to the last line” checkboxes, as shown here:
We’ll set up some more stuff later. For now, let’s see if we’re compiling properly. But first, a long and boring rant.
I’m writing this guide to try and help you get going with programming on the SMS. My motivation for this is to encourage others to give it a go, so they can produce new and exciting projects. Now, as a newbie you have to realise that the first few things you produce are not going to be much good - I know mine weren’t. So do yourself a favour, and the rest of the world, and don’t release them.
Why? Because of rom collectors. If you make a tiny, tiny modification to one of the demo programs I’m (hopefully) going to teach you to make, then release it on your webpage, and someone downloads it, then runs GoodSMS (for example), then sends it off to Cowering as a “new, unknown ROM!!!!11!”, then he includes it in the next version of GoodSMS, then EVERY anal rom collector in the world goes crazy because he is “missing” this “ROM”, and they all search it out and find it, and the WORLD HAS GONE CRAZY! So please, keep it to yourself unless it’s actually worth sharing with the world.
OK, no more rant. Download this:
Extract it somewhere and open it in ConTEXT. It should be coloured automatically according to what is written, in dark blue, light blue, black and red. Press F9 and at the bottom of your screen there should appear an Output Console. Resize it to show 3 or 4 lines - they should read something like:
Free space at $7ff8-$7ff9. Free space at $7ffc-$7ffe. 31743 unused bytes of total 32768. > Execution finished.
Congratulations, you’ve just made your first homebrew demo! Go look in the folder where you put the source file and you should find a file called output.sms. Open it in your favourite emulator and marvel at its amazingness!
If it doesn’t compile: oh dear. Did you edit compile.bat? Did you press the right key? What error messages did you get? Try contacting me if you really can’t figure it out.
More action keys
You saw how we set up F9 to compile the program using WLA DX? Well, that was actually the hardest one to do. Now we’re going to add one more, for running the game in the emulator. Fill in the details as follows for key F10:
|Start in||<path to Meka>|
|Hint||Run in MEKA|
Now pressing F10 should start up Meka with the file we just compiled.