Close
0%
0%

1024 byte Tetris

This is a Tetris game done in 1024 bytes or less on the Nintendo Gameboy.

Similar projects worth following
HAD 1 KB CHALLENGE, 1024 byte Tetris.

Keep in mind the original Gameboy Tetris was 32768 bytes.

I decided to use GB Z80. A Gameboy Emulator with a memory viewer is required, VisualBoy Advance works pretty well.
No Audio, no GFX, just use the memory viewer at 0xC000, and you are good to go.

Right now I have a reset game subroutine, all vars and play field are correctly set up.

2 IRQs, one for Timer IRQ controlling a LFSR,
the other is for the Joy Pad IRQ.

Pieces currently move left/right/fall down with a variable speed timer.

Line checking and clearing works.

Only one block type is programmed right now, and it doesn't even have rotation.

Project is currently just under half of the 1024 byte limit.

GameboyFPGA.pdf

This schematic shows how the Gameboy can be connected to the Mercury FPGA to sniff the RAM.

Adobe Portable Document Format - 817.52 kB - 01/10/2017 at 05:20

Preview
Download

GB_Hardware_Mod.txt

These are ideas I had for a Gameboy hardware mod to work with LEDs or something.

plain - 1.12 kB - 11/24/2016 at 18:39

Download

HAD.GB

This is a pre assembled Gameboy ROM image. Should be exactly 1024 bytes.

gb - 1.00 kB - 11/24/2016 at 13:16

Download

HAD.ASM

This is the source of the Tetris game, still a work in progress.

asm - 5.21 kB - 11/24/2016 at 13:14

Download

Enjoy this project?

Share

Discussions

Dmitry Grinberg wrote 11/27/2016 at 00:01 point

Keep in mind that the GB has a 256-byte rom which you *DO* rely on as it sets up all the default values to all the registers. so you have to add that to your total as per rules

  Are you sure? yes | no

PixJuan wrote 12/07/2016 at 21:46 point

The 256-byte bootstrap rom also has some DRM part that checks for the authenticity of the GB cartdridge and scrolls the Nintendo Logo:

https://realboyemulator.wordpress.com/2013/01/03/a-look-at-the-game-boy-bootstrap-let-the-fun-begin/

I don't think those parts should count. I think that what would be fair would be to only count the instructions that are really used. For example if there is a very accurate emulator that allows the user to use a custom bootstrap, we could use a bootstrap where the useless parts are replaced by NOPs and count what's left.

  Are you sure? yes | no

Dmitry Grinberg wrote 12/07/2016 at 21:54 point

Should or should not is a futile argument. Rules say that if you repent on piece X in the system, the entirety of X's code counts.

  Are you sure? yes | no

davedarko wrote 11/24/2016 at 16:10 point

there's nothing happening in mGBA :(

  Are you sure? yes | no

tehaxor69 wrote 11/24/2016 at 16:24 point

Does it have a memory viewer? In VBA I just get a white screen, but you can see everything at memory address 0xC000.

  Are you sure? yes | no

davedarko wrote 11/24/2016 at 18:40 point

only now I get what this is about :) k, but the memory viewer of mGBA doesn't work either :( 

  Are you sure? yes | no

tehaxor69 wrote 11/24/2016 at 18:43 point

I'll see if I can get it working with that emulator.

  Are you sure? yes | no

Yvan256 wrote 11/24/2016 at 14:48 point

I don't know if the rules will accept this. I mean, "use the memory viewer at 0xC000" doesn't work on the real thing. If the target system is a Game Boy, shouldn't it be able to run on the real hardware? Given that the Game Boy works with easily accessible sprites and tiles, you should be able to add normal LCD output to the game.

  Are you sure? yes | no

tehaxor69 wrote 11/24/2016 at 15:21 point

All the address and data pins are available on the real Gameboy.

You could use the upper bits to enable/disable a latching type chips, then you could have an array of LEDs showing the data. But an FPGA would make this work far more simpler than glue logic.

I could do some simple graphics with OAMs and tile mapping, but that would require setup of the LCD video registers, GFX ram, OAM attributes, and the OAM DMA.

  Are you sure? yes | no

Yvan256 wrote 11/24/2016 at 15:26 point

It's been a few decades since I've written anything GB-related, but I don't recall my setup being too complicated. I don't even recall "OAM DMA" to be honest. Don't forget the GB initializes most of the hardware by itself when booting.

See yvan256.net/projects/gameboy/ for links to documentations at the bottom of the page.

  Are you sure? yes | no

tehaxor69 wrote 11/24/2016 at 18:15 point

The DMA is used because you can only update the OAM memory while the LCD is off or in VBL/HBL, I'm not sure if the CPU stalls until the write works, or if nothing happens.

Most emulators take a lot of shortcuts, normally hardware is in a off state, but they will make sure that the register pairs have the correct values at the ROM entry point, as not to break Super/Color/Advance Gameboy exclusive games. I guess if the emulator supports and uses a BIOS, minimal setup would be required.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates