Get Me Out (comrade Gamedev) Mac OS

broken image


This is the first article in a short series on throwing yourself quicklyinto learning game development for the Nintendo Entertainment System.The idea will be to get quick resultsby example, while learning some key details of how the platformand development tools work.

To me, even more important are the non-financial calculations, since Mac players also tend to require a greater amount of post-release customer support, and I'm just one guy Mac players account for 4% of sales but 50% of support requests, one of many such examples I've seen from dev data over the years, including from other roguelike devs. For many of us, the reasons we get into gamedev is that we really want to play a certain game, which doesn't exist, so we toil away at it for months and years to create it. Five years ago I really wanted to play a 3D, topdown, twin-stick shooting game that has some roleplaying, survival, and stealth aspect. Android File Transfer: move Apk file from Mac to Android device via USB cable First time after i'm developed game i try to connect usb cable from android to mac but nothing happen, on windows it's very easy sync by usb cable then i find this app help me work for testing easier than upload and download from file sharing. OK, you got me, so how do I create one? There is more than one way to add a digital signature to your emails and depending on the email carrier you use, more than one way to attach them. I'll take you through a couple of the most common ones. The Simple Version. Using the default on your Mac, let's start with Mail.

  • NES Development Environment
  • Appendices

Introduction

I love the aesthetic of classic videogames, and the technical oddities of their platforms.I got into game development for the NES (Nintendo Entertainment System) to understand and enjoythese aspects more, but also for the challenge and skills to hopefully ready me for somerelated future projects.

After reading a lot of articles I really just wanted small examples that did somethinguseful, while explaining them well. While there are many tutorials on game developmentfor the Nintendo Entertainment System, my objectives in this short series will be tohelp you quickly get an environment going, build some very basic examples, try them out,and then expose exactly what's going on.

In this first article, I cover the bare essentials for Windows, Mac OS X, and Linux.That is, a means to compile code that targets the NES, and a way to see that coderunning on your PC. At the end of this article, you will compile and run some example code toprove that your environment works. This will set the stage for fun stuff starting in the nextarticle, when it is ready.

NES Development Environment

Of all the PC-based tools you may use when developing for the Nintendo Entertainment System,these are the essentials:

  • A compiler/assembler. I strongly recommend the cc65 cross-compiler/assembler for the6502 CPU. It is very well-written, highly configurable, and available forWindows, Linux, and Mac OS X. Future articles will focus on how to use it effectively.

  • A NES emulator1. With an emulator, any NES-format files you create can be rundirectly on your PC – much as they would run on a real NES – for quick testing. Someemulators are better than others at precisely emulating all known features(and quirks) of the real NES hardware. A handful of emulators offerinspection and debugging features, too.

Choosing an emulator depends on your platform, but for now I recommend FCEUXas it is available for Windows, Linux, and Mac OS X. Note that while it hasexcellent debugging featuresin the Windows version, disappointingly these are absent from the Mac and Linuxversions at this time. See thealternative software appendixbelow for other compilers and emulators, but note that this article focuses oncc65 and FCEUX.

In the instructions below, I show you how to install both cc65 and FCEUX, underWindows,OS X, andLinux.

Installing on Windows

  1. First, we install FCEUX:

    Go to the FCEUX download page,download the 'FCEUX win32 Binary' (I used the latest available at the time,2.2.2), and extract it. It has no installer, so just place the extractedfiles wherever you like, and run fceux.exe to test that it launches.

  2. Make sure the location where you placed fceux.exe is added to your system PATH,because you will usually want to launch compiled files with FCEUX, directly fromyour command-line.

  3. Then, we install cc65:

    Download the cc65 installer. You're looking for cc65-2.13.3-1.exe or similar. I went to theoriginal cc65 FTP siteand downloaded cc65-2.13.3-1.exebut that may be closed down at some point. If so,mirrors are available.

  4. Launch the cc65-2.13.3-1.exe installer, and perform a default install.

  5. Verify that it has installed by bringing up a new Command Prompt and running:

Now you can proceed to the ‘Testing your emulator' section.

Installing on Mac OS X

These steps rely onHomebrewto install both cc65 and FCEUX. You can alternativelycompile the latest source for cc65 and FCEUX,but that's the hard way to go about it.

  1. Make sure Homebrew is up-to-date, and that its environment is set up correctly:

  2. Install the cc65 package:

  3. Test:

  4. Next we'll install FCEUX, but please note that FCEUX requires an X11 environment. If you haveOS X 10.7 or below, then you already have X11.app built in, and there's nothing you needto do. If you have OS X 10.8 (Mountain Lion) or above,Apple recommends installing XQuartz.

  5. Now install the fceux package, which for me took about 40 minutes due to allthe extra packages required to build it on OS X:

    NOTE: Previously, FCEUX could be installed with just brew install fceux, but the package hasbeen removed from the standard Homebrew set.

Now you can proceed to the ‘Testing your emulator' section.

Installing on Linux

So far I have only attempted to install cc65 and FCEUX on Ubuntu 12.04 LTS (64-bit), where Irely on APT (i.e. apt-get, as used by Ubuntu and Debian). I also have an appendix forinstructions to compile cc65 and FCEUX on Linux.If you have reliable and complete instructions for other platforms, please let me know.

  1. First we install cc65:

    Spiro Trikaliotishas prepared, and hosts, an APT repository that can be used to install cc65 as a Debian package.To use it, first make sure you have debian-keyring installed.

  2. Add the key for Spiro's repository:

  3. Add Spiro's repository to your APT sources, by editing /etc/apt/sources.list andadding the following lines at the end:

  4. Update your APT sources:

  5. Install specifically2 version 2.13.3-1 of cc65 and cc65-nes:

  6. Check cc65:

  7. Now we install FCEUX:

    First, make sure curl and unzip are installed, as they will come in handy later:

  8. Install the fceux package:

    …which, at the time of writing, installs specifically version 2.1.5+repack-0buntu1on Ubuntu 12.04.

Now you can carry on into the ‘Testing your emulator' section below.

Get me out (comrade gamedev) mac os x

Testing your emulator

  1. Download a NES ROM package file (i.e. a .nes file) from somewhere,and launch it with fceux. For example, grab the freeBombSweeper,extract the file, and launch it.

    On Windows, just download the file and extract it. Then go into Command Prompt,and into the directory where you extracted it, and you should be able to launch itwith:

    On Mac OS X and Linux, you should just be able to do: Endless runner (mmike0) mac os.

  2. You will probably want to scale the display, so go to FCEUX's video configurationand set both the X and Y scaling factors to 2.0 (or maybe even 3.0).

    On Windows, go to the ‘Config' menu, select ‘Video…' andchange the ‘Size Multiplier' fields:

    Brighter day (itch) mac os. On Mac and Linux, you need to go to the ‘Options' menu and select ‘Video Config':

Testing cc65 by building example code

Though I won't get into explaining NES coding concepts until the next articlein this series, we should at least grab some example code now and make sure itcompiles and runs.

I have set up a public GitHub repository(algofoogle/nes-gamedev-examples)which will be fleshed out with example source code corresponding to each articlein this series.

  1. Grab my nes-gamedev-examples repo:

    Alternatively, you candirect-download the master branchas a ZIP file, and extract it.

  2. In your shell/command-prompt, go into the part01/ex01-c-example directory,which is source code in C that displays a simple message and plays a tone.

  3. Build it with cc65 (specifically the cl65 'compile-and-link' tool) as follows:

  4. Try launching the resulting hello.nes file with FCEUX:

    NOTE that I've sometimes seen on Mac OS X that FCEUX will take a longtime to properly launch if X11 is not already running. If you're on OS X 10.7 or below,you can launch X11 in advance with:

    …and there would be an equivalent for OS X 10.8 and above with XQuartz.

NOW we will try assembling an example written in 6502 assembly language:

  1. Go into the the part01/ex02-asm-example directory of the repo.

  2. Assemble the test.s file, with:

    …which produces the test.oobject file.

  3. 'Link' the object file into a .nes binary file, with:

  4. Try launching the resulting test.nes file with FCEUX:

Conclusion

So, where to from here? You now have a way to take raw source code and build a .nesfile from it, that can then be played on your PC in a Nintendo Entertainment System emulator.

You can have a go at figuring out what's going on in theexample source code if youlike, but some of it is quite complex and counter-intuitive, so don't feel badif it just gives you a headache.

In my next article I intend to explain what a .nes file actually is and how cc65'sbuild process (and configuration) works. Then I'll start explaining the core code foundin every game for the Nintendo Entertainment System.I'll begin with much simpler examples (that also uncoverkey 6502 assembly concepts), and work up through essential features of a minimalfunctioning NES program.

If you're keen to get on with it, though, you might want to read the following:

Good luck, and see you next time!

Appendices

Each appendix here is provided in case you are having trouble with installing cc65or FCEUX, or for those who want to try out alternatives to the process I've recommended above. You don't need to read any of this if you have successfullycompleted the above build-and-run test.

Get Me Out (comrade Gamedev) Mac Os Download

Mirrors of cc65

At the time of writing, the latest version of cc65 is maintained by Oliver Schmidt,at the new cc65 website. The latest source codeis available via Oliver's cc65 GitHub repo, and is still actively maintained.

In principle, you can find everything you need via: the new cc65 website;the new cc65 Wiki pages; andthe cc65 GitHub repo.This includesinstructions for building on Windows,where you may prefer (or need) to take the 2nd option ('Use prebuilt cc65 binaries')rather than compiling those binaries yourself – so long as you first install'Make for Windows' as described on that page.

I, however, was lazy and opted to just download the cc65-2.13.3-1.exe installerfor Windows. This can can be obtained (with the source code, amongst otherthings) from any of the following mirrors:

I also have my own copy of all the files; if you're really stuck,contact me.

Building cc65 and FCEUX from source on Mac OS X

Be warned: Compiling cc65 is easy enough, but compiling FCEUX on OS X may bepainful. Installing with Homebrewis strongly preferred. Otherwise, proceed with caution.

Building cc65 on Mac OS X

  1. Make sure you have git installed. If not, see: Set Up Git.

  2. I assume you will keep all your projects in a folder called projects inyour home directory. So, following this, go into Terminal and:

  3. Use git to clone the https://github.com/oliverschmidt/cc65.gitrepository:

  4. You now have the source code for cc65. Simply build it with:

    If it fails straight away on this make command, you probably need toinstall the Xcode Command Line Tools.

    If you do have a working make, it will spew a lot of information as itcompiles all the source files and builds the final binaries. In my caseit also gave a warning at the end:

    …but this can be ignored.

  5. Do a test run:

  6. Now install it system-wide:

    OR if that doesn't work, try this instead:

    …and the binaries (cc65, ca65, etc) should now be found in (say)/usr/local/bin.

  7. Test again:

  8. You should also ensure you have the CC65_HOME environment variable set tothe path which contains your cc65 binaries. You can add this, for example,to your ~/.profile (or, if you already have a ~/.bash_profile file,add it to that instead; ~/.bash_profile overrides ~/.profile):

Building FCEUX on Mac OS X

If you have OS X 10.8 or above, you will need an X11 environment to build andrun FCEUX. Apple recommends installingXQuartz in this case.

Apparently, building FCEUX on Mac OS X is not exactly easy. There are a lotof depenencies required, and many people end up managing these dependencieswith Homebrew, MacPorts, or Fink anyway.

I've found that ConsoleEmu.com – despite occasional page load errors3 – hasbuilds of FCEUX for Mac OS X (with morerecent ones at the bottom). Note that I can't vouch for how good these are, as I haven'ttried them out. If you do have success with them, please let me know, including anythingthat you had to do besides just extracting and launching.

Anyway, if you are determined to build FCEUX on Mac OS X, you may find the followinglinks helpful:

  • Official FCEUX build instructions for OS X;
  • Some tips on building FCEUX on Mountain Lion;
  • FCEUX Homebrew formula code andoriginal announcement, which may give you some tipson how a working build process can be achieved.

Building cc65 and FCEUX from source on Linux

I only tested this lightly, from a fresh install of Ubuntu 12.04 LTS (Precise Pangolin) 64-bit.I did the following:

Get Me Out (comrade Gamedev) Mac Os Catalina

  1. Update APT sources:

  2. Install git and make:

  3. Grab the cc65 repository:

  4. Build cc65:

  5. Install cc65:

  6. Test:

  7. Now, when it came to building FCEUX on Linux, I didn't bother trying.Hopefully you will find adequate instructions via one of the following:

    • Jack David Baucum's instructions for building FCEUX on Ubuntu;
    • The Homebrew formula for building FCEUX.

Alternative Software for NES Development

I won't keep these tables up-to-date. Hence, the 'Version' and 'Last updated' columns may fall behind theactual latest versions.

Below, I have listed some alternative software you can use for assembling NES-targeted6502 assembly code, as well as alternative emulators for running .nes files. I certainlyhaven't done any sort of review of the information below; I have tried to dig around andfind out a little bit about each package, but I haven't really tried any of them out.

Get Me Out (comrade Gamedev) Mac Os 11

NOTE: I'd like to give special mention to NESICIDE, which is a newNES IDE (Integrated Development Environment). It has been in development for some timeand hopes to combine several NES development tools into one package.The plan is that it will comprise a source editor, emulator, compiler/assembler, debugger,and graphics/sound editor. It looks promising, but development on it seems to have slowed,and most features are so far only available for Windows; not so much for Mac OS X and Linux.Keep an eye on it, though, and maybe you feel like contributing to the project, ormaking a donation?

Get Me Out (comrade Gamedev) Mac Os X

Alternative 6502 assemblers

ProductVersionLast updatedWin?Mac?Linux?Source?Notes
cc652.14.02013-10-18YESYESYESYESIncludes C compiler, and config targeting many 6502 systems.
ASM61.62010-11-03YESNoNoYES4Releases of ASM6 are ad-hoc, not 'managed'.
NESASM33.12011-01-08YESNoYes?5YESSimplistic, NES-specific. Focus of 'Nerdy Nights' tutorials.
DASM2.20.112008-09-22YESYes?Yes?YESTargets multiple platforms and other 8-bit CPUs.

Alternative NES emulators

ProductVersionLast updatedWin?Mac?Linux?Source?Notes
FCEUX2.2.22013-09-23YESYESYESYESDebugging excellent in Win, but absent from Mac/Linux.
Macifom0.162011-09-27NoYESNoYESNative Mac app with .dmg available. Basic debugger.
Nintendulator0.9702013-04-236YESNoNoYESGood debugging tools. Trying for high-accuracy.
Nestopia1.45(Various)YESYESYESYESSee below for more info.

Nestopia versions

Nestopia was originally (?) a Windows-only NES emulator, but there have been differentforks of it to support Linux and Mac OS X also.

  • The original Oppression (inuitive feeling) mac os. Windows version of Nestopia is 1.40, and since 2008 has been abandoned.It can be found on theNestopia downloads pagealong with source code.

  • A Mac OS X version (1.4.1), from September 2008, is available viaRichard Bannister's website.

  • It seems rdanbrook (aka 0ldsk00lca)has taken over creating more-recent versions of Nestopia,which is up to version 1.45:

    • A Windows binary is available.
    • Source code is available via GitHub.
    • There are packages available for installing on Debian,Arch Linux,and OpenBSD.
  1. While this article focuses on PC-based emulation for testing, in a futurearticle I will demonstrate making a basic reprogrammable cartridge ('GamePak')that can be used in a real NES.↩

  2. I found that if I did a default install with sudo apt-get install cc65, itwould install a more-recent (unstable?) version: 2.13.9-svn5990-1. This seemsto have a problem where it reports the following errors when I try to targetthe NES using C source:

  3. At the time of writing, links within ConsoleEmu.com are coming up partly blank,or reporting 404 errors. I've noticed that it sometimes appends a PHP Session ID(e.g. ?PHPSESSID=44baf3d2xxx8b610e3b) on some URLs, and these seem to screw upits internal link parsing. In those cases, I just remove this suffix (includingthe question mark), and it seems to work.↩

  4. Source code for ASM6 is supplied as a single C file, along with the ASM6 binary,in the downloadable ASM6 archive.↩

  5. This article on NintendoAgesuggests, in the 'ASSEMBLERS' grid, that NESASM3 isavailable for Linux. It's not clear whether you just have to compile it for Linux yourselffrom the source which appears to be managed as aDev-C++ project.↩

  6. The 'current release' (0.970) is from 2010-01-02.The Downloads page for Nintendulatorhas a sub-heading describing the 'Latest unstable build' which, at the time of writing,is 0.975 Beta, last updated on 2013-04-23.Latest sourceis also available, as well assource code for the mapper DLLs.↩






broken image