---
title: Tetris
description: "[![](/qbi/Tetris - Parallax_files/Tetris-Play.jpg)](/qbi/Tetris - Parallax_files/Tetris-Play.jpg)[![](/qbi/Tetris - Parallax_files/Tetris-C.jpg)](/qbi/Tetris - Parallax_files/Tetris-C.jpg) ##### Description Tetris was contributed by forum member Rayman, and incorporates the Ahle2 simpleSound engine. This code was written in C with FlexProp, and incorporates the use of Spin2 files for…"
url: "https://obex.parallax.com/docs/quick-bytes/propeller-2/tetris/"
updated: "2026-09-29"
category: Propeller 2
---

# Tetris

[![](/qbi/Tetris - Parallax_files/Tetris-Play.jpg)](/qbi/Tetris - Parallax_files/Tetris-Play.jpg)[![](/qbi/Tetris - Parallax_files/Tetris-C.jpg)](/qbi/Tetris - Parallax_files/Tetris-C.jpg)

##### Description

Tetris was contributed by forum member Rayman, and incorporates the Ahle2 simpleSound engine. This code was written in C with FlexProp, and incorporates the use of Spin2 files for video, mouse and keyboard.

[Tetris at 1080p with VGA and Sound](https://www.youtube.com/embed/Ylk_Db_D9X0?feature=oembed)

The hardware is a Propeller 2 board with the P2 Eval A/V Breakout Add-on Board for audio and VGA. In this configuration, you play through the FlexProp terminal with your computer’s WASD keys. You may also use a USB keyboard and mouse connected to the P2 Eval Serial Host Add-on Board. 

![](/qbi/Tetris - Parallax_files/Tetris-hardware-1.jpg)

Open the Platform.h file from FlexProp to configure your own I/O pins:

```c
'//Note:  You must currently edit vga driver to set the base pin
    #define AV_BasePin 0  //Base pin for A/V expansion board connected to Eval Board
    #define AV_LeftPin (AV_BasePin+6)
    #define AV_RightPin (AV_BasePin+7)
    //USB pin definitions Parallax USB adapter board for P2 Eval Board
    #define SERIAL_HOST_BASEPIN 16
    #define USB_BASE_PIN (SERIAL_HOST_BASEPIN+0)
    #define USB_ENABLE_PIN (SERIAL_HOST_BASEPIN+1)
    #define USB_DM_PIN (SERIAL_HOST_BASEPIN+6)  //USB is on +6 and +7 for lower port, +2 and +3 for upper port
    #define USB_ERR_LED_PIN 57       //Using P2 Eval board's P57 led for error display
    #endif // Board_Eval
```

Thank you to Rayman for this entertaining contribution to P2 Quick Bytes! 

##### Parts Used

- [P2 Edge Module](https://www.parallax.com/product/p2-edge-module/)
- [P2 Edge Breadboard](https://www.parallax.com/product/p2-edge-module-breadboard/)
- [VGA Display](https://www.parallax.com/product/10-k-3-pin-3-4-turn-potentiometer/)
- [P2 Eval A/V Breakout Add-on Board (#64006H)](https://www.parallax.com/product/p2-eval-av-breakout-add-on-board/)
- [P2 Eval Serial Host Add-on Board (#64006B)](https://www.parallax.com/product/p2-eval-serial-host-add-on-board/)

##### Source Code

- [Tetris_1c.zip](/qbi/downloads/tetris_1c.zip)

##### Programming Language

- C
- [Spin 2](https://docs.google.com/document/d/16qVkmA6Co5fUNKJHF6pBfGfDupuRwDtf-wyieh_fbqw/)
- [PASM2](https://docs.google.com/spreadsheets/d/1_vJk-Ad569UMwgXTKTdfJkHYHpc1rZwxB-DcIiAZNdk/)

##### Tools and Operating System

- [FlexProp for Windows, Mac and Linux](https://www.patreon.com/totalspectrum)

##### Additional Resources

- [Tetris in 1080p VGA with music and sound (P2 discussion forum)](https://forums.parallax.com/discussion/172931/tetris-in-1080p-vga-with-music-and-sound)
- [simpleSound - A simple to use sound engine for the P2 (P2 discussion forum)](https://forums.parallax.com/discussion/172894/simplesound-a-simple-to-use-sound-engine-for-the-p2/p1)

##### Document Author

- Ken Gracey (from Rayman)

##### Source Code Author

- Rayman
