Code Monkey home page Code Monkey logo

10-print-game-boy's Introduction

10 PRINT Game Boy

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 is a concise and elegant single line of code written in BASIC for the Commodore 64 sometime in the early 1980s. When run, it produces a maze-like pattern on the screen in an endless loop.

This is my port of that one-liner for the original Game Boy. Written in assembly language using the RGBDS toolchain.

10 PRINT running on Commodore 64 (left) and Game Boy (right).

How comes is that?

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 is not only a witty one-liner but also the title of a book. With the short program as the lowest common denominator, the authors delve into diverse subjects like the Commodore 64, maze in culture, and randomness in computing and art.

As I read the book and learned about 10 PRINT, I thought that porting it to the Game Boy would be a good learning experience and fun challenge. Not a trivial one, though, as the Game Boy lacks some of the luxuries the Commodore 64 has through its KERNAL operating system and BASIC programming language.

I hope that you, fellow reader, will learn something as well or just have a good time playing around with 10 PRINT.

Watch it on a Game Boy

Wanna watch the mesmerizing maze for real? Sure thing! Just download the preassembled ROM, copy it over to a flash cartridge and boot it up using your Game Boy. You can also load the ROM in your favorite emulator or watch 10 PRINT in your browser.

The ROM should run on all hardware from the original Game Boy to Game Boy Advance SP.

Study the source

Do you want to take a peek behind the curtains? I'm glad to hear that! There's an annotated version of the source code that's easy to read on GitHub. Give it a shot โ€“ if it's not your thing you can always read the plain assembly version.

New to assembly language and low-level programming?

Then you may want to catch up on the basics, before reading the source. A favorite book of mine and its associated web course has you covered: The Elements of Computing Systems and NAND2Tetris. Another great resource is Easy 6502 - an e-book that shows how to get started with 6502 assembly language.

Assemble using RGBDS...

To assemble the 10 PRINT Game Boy ROM, you'll need the assembler, linker and fixer tools provided by the Rednex Game Boy Development System or RGBDS for short. Go ahead and install RGBDS on your system and come back here when you're ready.

...and make

If you are on a *nixy system, like macOS or Ubuntu, and have Make installed, you should be able to run make 10-print.gb in the root of this directory and see 10-print.gb appear before your eyes.

...by hand

If Make is not your cup of tea, you can always do things the manual way. There are three steps to assemble a ROM from source: assembling, linking and fixing.

You should be able to build 10-print.gb by the following steps:

rgbasm -E -v -o "10-print.o" "10-print.asm"
rgblink -d -t -n "10-print.sym" -m "10-print.map" -o "10-print.gb" "10-print.o"
rgbfix -j -p 0x0 -t "10 PRINT" -v "10-print.gb"

License

Licensed under the MIT License โ€“ Copyright ยฉ 2018 Sven Dahlstrand.

10-print-game-boy's People

Contributors

svendahlstrand avatar tobiasvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gb-archive willbr

10-print-game-boy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.