Skip to content

An operating system, but it only plays Tetris.

License

Notifications You must be signed in to change notification settings

ali-1995/tetris-os

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a fork of TETRIS-OS originally by jdh

Current improvements (these have already been merged to upstream)
  • Dynamically disabled SB16 so same binary works whether you have an SB16 or not.
  • CHS reads as backup in case LBA reads fail
  • Simple PC Speaker music. (Build by modifying sound.h, uncommenting #define SOUND_PCSPK and commenting #define SOUND_SB16)
Other changes
Planned
  • Simple PC Speaker music playback in case SB16 is not found.
  • Fixing SB16 compatibility
  • High quality PWM-based speaker sound
Wishful thinking
  • Refactor sound API to make writing different sound drivers possible Implemented in upstream
  • AC97 or HD-audio, depending on what is onboard my old computer. Requires PCI setup among other things, so not the easiest thing to combat.

TETRIS-OS: An operating system that only plays Tetris.

screenshot

Video with an explanation of the development process.

Features:

  • It's Tetris.
  • 32-bit (x86)
  • Fully custom bootloader
  • Soundblaster 16 driver
  • Custom music track runner
  • Fully hardcoded tetris theme
  • Double-buffered 60 FPS graphics at 320x200 pixels with custom 8-bit RGB palette

Resources Used

Building & Running

<<<<<<< HEAD Tested on real hardware as well as QEMU.

Mac OS

For the cross-compiler: $ brew tap nativeos/i386-elf-toolchain && brew install i386-elf-binutils i386-elf-gcc

$ make bin
$ qemu-system-i386 -drive format=raw,file=boot.img -d cpu_reset -monitor stdio -device sb16 -audiodev coreaudio,id=coreaudio,out.frequency=48000,out.channels=2,out.format=s32

======= NOTE: This has only been tested in an emulator. Real hardware might not like it.

EDIT: this is not true anymore! @parkerlreed has run this on a Thinkpad T510.

Mac OS

For the cross-compiler: $ brew tap nativeos/i386-elf-toolchain && brew install i386-elf-binutils i386-elf-gcc

To run use $ make qemu-mac

Unix-like

You should not need a cross-compiler in most cases as the gcc shipped in most linux distros will support i386 targets.

If this isn't the case for you, read here about getting a cross-compiler.

To run use $ make qemu-pulse

If you have sound device issues, try the SDL backend for QEMU with $ make qemu-sdl or disable any audio devices with $make qemu-no-audio

If you're having issues with no image showing up/QEMU freezing, this is a known bug with QEMU SB16 emulation under GTK. Please read what @takaswie has written in #2 for a workaround.

Windows

Good luck. Maybe try dual booting with Linux if this doesn't work out :)

  • Follow the Unix-like instructions while using WSL
  • Using MSYS2 and the i386-elf-toolchain
    • Extract the binaries of the GCC and binutils releases to your mingw64 folder (likely at C:\msys64\mingw64)
    • make, gcc, etc. should now be in your PATH
> make img
> qemu-system-i386 -drive format=raw,file=boot.img -display sdl -audiodev id=dsound,driver=dsound -device sb16,audiodev=dsound

If sound is broken or choppy, try running with > qemu-system-i386 -display sdl -drive format=raw,file=boot.img -audiodev id=dsound,driver=dsound,out.fixed-settings=on,out.frequency=22050,out.buffer-length=80000,timer-period=100 -device sb16,audiodev=dsound

Real hardware

You probably know what you're doing if you're going to try this. Just burn boot.img onto some bootable media and give it a go. The SB16 is dynamically disabled in case it's not found or it's reset procedure fails, but if things continue to break try removing all references to sound or music first.

About

An operating system, but it only plays Tetris.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C 88.6%
  • Assembly 8.2%
  • Makefile 2.8%
  • C++ 0.4%