About  Blog

Playpower.org

PLAYPOWER
,,,

We support affordable, effective, fun learning games. We're starting with an existing $10 TV-computer as a platform for learning games in the developing world.

Programming the NES in BASIC?

In 2004, Bob Rost taught a class about programming NES games at Carnegie Melon University.  He built a compiler that enables a person to program NES games in BASIC.   He calls the framework nBASIC, and it is available on this page.  This makes programming so much easier!

Anuj and Jesse have been using nBASIC to start programming Ghanaian content on the $12 computer.  I told Bob about their work, and he replied to me saying:

Games from Bobs class

Games from Bob's class

I’m glad that my course materials have been helpful for you, and I hope the nbasic compiler and other tools prove to be beneficial as well (aside from their occasional bugs). Don’t hesitate to email again if you have any specific questions or design problems that you think I could help to answer.

As a side note, based your previous email, I think you’ll be pleasantly surprised at the efficiency of nbasic’s output in most cases, and the complexity of the games it will allow you to create in any given time frame. You are of course welcome to use, abuse, change, and distribute the source code in any way you like.

Best of luck to you and your team.
-Bob

That is incredible! Do you think this community could help improve the efficacy of nBASIC?  If we could program games using such an accessible language, this would substantially reduce the time, effort, and cash required to write a game in assembly code.  If we want to promote local game production, there needs to be an easier way to program.

Thanks, Bob!

  • nitrofurano
    an important url about Bob Rost's nBasic: http://bobrost.com/nes/files/n...
  • nitrofurano
    would be great nBASIC being gpl-license, ported to Linux, etc. ! :)
  • Bob Rost is a very nice guy--he works downtown in Pittsburgh. The code is
    open source and I'm sure he'd be thrilled to have someone port it to linux.
  • nitrofurano
    would be great contacting Bob Rost, specially if he can be part of this playpower.org project. His nBasic is awesome and very useful (Cory Arcangel did 'Super Mario Clouds' with nBasic, for example) - but it lacks in some issues:
    - there are not so many snippets available to work on (i want to contribute with my own, but it were very hard to start)
    - some 6502asm code sequences could be simplified with commands like 'poke', 'vpoke' (poke on video memory, like msx-basic), 'vpokehex' (would allow you to poke a hexdump string starting on an address, like at namespace or palette area)
  • nitrofurano
    Awesome! But anyway, we must have some care about the 'open source' term - for example, Microsoft created recently some open source licences (some related with Mono, i think) which none are software-libre like GNU-GPL.
  • Doc Van Thorp
    This basic compiler would speed cross-development of NES software useing PCs, but a worthy goal would be compilers and tools for creating games natively on the NES itself.

    What kind of storage should the $12 machine have? Low-capacity SD cards are getting pretty cheap, and are fairly easy to interface to. You don't have to pay licensing if you don't use the encrypted file mode (which hardly anyone does anyway). You can fit hundreds of NES games into a pretty small SD card, and the SD card would be extremely useful for native software development that requires compilation from source files. For a small system like an NES, this would be better than a hard drive.
  • According to the Wiki, the Subor system uses a 25-bit wide addressed Flash memory card in its cartridge, and its main chip includes a single bus mode that allows both program and data memory to connect directly to that same chip. 16 bits is 64KB, 9 more bits is 32MB.

    That's ample for a whole lot of educational games, a word processor program, a text reader program, even a complete Forth development system with a wide range of development tools.

    In that mode, there are at least 8 I/O pins available, which could easily be used to bit-bang a 2-SD card socket for external permanent storage. You need 2 output pins for selecting each SD card in the socket, a pin for Master In / Subordinate Out (MISO), a pin for Master Out / Subordinate In (MOSI), and a pin for the CLK. The problem is that to set a SD card into SPI mode requires operating in a certain clock speed, and its hard to achieve that clock speed with a 6502 software SPI interface.

    It might be possible with a shift register using the built in RS-232C clock in the VT02.

    Far easier would be to use a couple of I/O pins, if any I/O from the VT02 are free in the Subor design, to multiplex a Compact Flash card into some available part of the address space. Several I/O pins would allow access to the Compact Flash and banking some available part of the address space into a 32Kx8 SRAM.

    But if SD cards can be supported with inexpensive glue electronics, they are definitely cheaper and more readily available than compact flash.
  • Matthew Swank
    High level options could include FORTH-- interactive but still efficient and close to the metal, or if you want even higher level facilities, Lisp.

    See http://www.6502.org/source/ for a 6502 Forth interpreter
    See http://zwizwa.be/archive/staap... for an example scheme/forth compiler for an 8 bit PIC microcontroller.
blog comments powered by Disqus