Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Another Game Boy emulator for your terminal (github.com/dobyrch)
73 points by ndrake on Feb 13, 2015 | hide | past | favorite | 19 comments


The bootrom with the copyrighted material patched out of it is a nice touch.

The gameboy bootrom is an epic thing in itself. Its purpose is to scroll the nintendo logo, and to check the integrity of the logo data. If the logo is corrupted, the bootloader crashes.

The logo is read from the game cartridge, so the idea is that unlicensed developers would be forced to distribute the nintendo logo (with the © next to it!) in any cartridges they produced, making it easy for nintendo to sue them into oblivion. Very clever.

Lots of lovely details here: https://realboyemulator.wordpress.com/2013/01/03/a-look-at-t...

and here: http://gbdev.gg8.se/wiki/articles/Gameboy_Bootstrap_ROM


The original LEGO Mindstorms did something similar. In order to upload firmware to the RCX brick (a common operation, since the firmware was stored in volatile RAM) you had to pass a "copyrighted unlock string" ("Do you byte, when I knock?") which would be verified by both the interface DLL and the boot ROM itself.

The intent was apparently to use the copyright on that phrase as a means to force developers to use the officially sanctioned API. I don't know if that was ever legally enforceable; it certainly didn't stop hobbyists from plugging the unlock string into their code.


A lot of countries have provisions in their laws that make breaking DRM legal 'for the purpose of interoperability'.

E.g. http://www.twobirds.com/en/news/articles/2012/decompilation-...


On the trademark side of things, it's not enforceable. Not sure about the copyright side.

http://en.wikipedia.org/wiki/Sega_Enterprises_Ltd._v._Accola....



Thanks, do you know why HN strips the period off of the link?


HN has a very particular parser because a lot of us have found we'll copy paste too much too fast if we don't have a weird parser with separate noprocrast settings from our normal work.


And, it's also how the Star Fox developers got noticed by Nintendo, by demonstrating how it could be broken.


For those curious:

> "The game would only start if the word was correctly in place in the ROM. If anyone wanted to produce a game without Nintendo's permission, they would be claiming to use the word 'Nintendo' without a licensed trademark, and therefore Nintendo would be in a position to sue them for trademark infringement. We figured out that with just a resistor and capacitor - around 1 cent's worth of components - we could find out how to beat the protection. The system read the word 'Nintendo' twice - once to print it on the screen at the boot up, and a second time to check if it was correct before starting the game cartridge. That was a fatal mistake, because the first time they read 'Nintendo' we got it to return 'Argonaut', so that was what dropped down the screen. On the second check, our resistor and capacitor powered up so the correct word 'Nintendo' was in there, and the game booted up perfectly."

Source: http://www.eurogamer.net/articles/2013-07-04-born-slippy-the...


You need to pass a checksum, but you don't need to use (ed: display) the nintendo logo to do so.


If you read the disassembly you'll see that it's first a byte by byte compare of the logo data, followed by the checksum of the header data.

          ; ===== Nintendo logo comparison routine =====
  
  Addr_00E0:	
          LD HL,$0104           ; $00e0 ; point HL to Nintendo logo in cart
          LD DE,$00a8           ; $00e3 ; point DE to Nintendo logo in DMG rom
  
  Addr_00E6:
          LD A,(DE)             ; $00e6
          INC DE                ; $00e7
          CP (HL)               ; $00e8 ;compare logo data in cart to DMG rom
          JR NZ,$fe             ; $00e9 ;if not a match, lock up here
          INC HL                ; $00eb
          LD A,L                ; $00ec
          CP $34                ; $00ed ;do this for $30 bytes
          JR NZ, Addr_00E6      ; $00ef


And yet: https://www.youtube.com/watch?v=rtNZGbpxl8k

"What I did was once the Gameboy starts it reroutes the data from Flash to a data stored on the FPGA containing the custom logo. Once it is done reading the data the first time it changes back the addressing to read from the Flash that contains the ROM. To sum it up shortly it Reads custom data then reads the real data the second time."

Sure, you could argue the rom has the copy protected data, but before the DMCA it was less of a slam dunk case then Nintendo intended because it was more a trademark vs copyright case.


How are the graphics drawn?

I expected the grayscale pixels to be drawn with some kind of grayscale characters (like "-=#$"), but judging from the screenshots those are actual graphics.

Is it messing with the framebuffer, or does it really work with a simple terminal, like over SSH?


It's using a console font:

Ubuntu users may see the message "Failed to set font height." Term Boy uses the setfont command to change the font height, which looks for the font default8x16.psfu in /usr/share/consolefonts. The font can be downloaded from the Kbd project. Download any of the archives and the font will be located in data/consolefonts.


How is this font able to do graphics like this?


The original Game Boy display was 160x144 pixels. The font's name implies that it's made of 8x16 pixel characters. So I'm guessing each glyph in it is used to represent a unique configuration of 2x4 Game Boy pixels because that'd mean an 80x36 character terminal, a fairly common terminal size, would fit perfectly. Since the Game Boy display only has 2-bit color depth (so, 4 colors), that means the font would need 4^8 (65,536) glyphs.


This is amazing. Raspberry pi here we come.


I just compiled it for the RPI (Model B). Make sure you download and compile the latest version of GoLang.

It runs so slowly, but it's still awesome.

I'm going to try it on a Pi2 later tonight.


There's a more full featured C++ version apparently, maybe that runs faster?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: