You want to play Tetris. You want to play Tetris on any operating system. You want to play on an old IBM PC, you want to play Tetris on a new MacBook. You want a Tetris that’ll fit inside the master boot record of a disk. You want Tetris as an operating system. You want TetrOS.
Or maybe you don’t, but it’s a fantastic piece of work, and we love tiny demos. Check it out below the break. Or read through the source code in the banner image.
It doesn’t have scores, or fancy graphics, or an intro splash screen. It doesn’t show the next brick. It doesn’t speed up as you keep playing. The fatal flaw is that it doesn’t play the Tetris theme in the background. But it is tiny, and it is playable.
And speaking of Tetris without an OS, if you’ve got a comparatively spacious Arduino, you can get a version with all the frills.
Science isn’t about “Why?”, it’s about “Why not?”.
Worrrrd. The best projects inspire admiration, confusion, and horror all at the same time. I put this in the same category as Enterprise Fizzbuzz*, and that stripped-down Doom engine for TI-83+**.
* https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
** http://www.benryves.com/journal/3725786
I thought science WAS about why and engineering was about why not?
I think he means “why shouldn’t we try this/study this/think about this?” rather than having to justify every investigation in terms of concrete benefits.
He is referring to Cave Johnson from Portal 2, which I commend!
We need some combustible lemons.
i thought science was all about how
Not bad, not bad, now convert to QR code that can be run on multiple platforms….
PS I now feel like a failure for failing to implement this in the 480 bytes of my FX6500G, I only managed battleships and blackjack.
Ummm… You’re definitely NOT a failure with accomplishments like those.
A good read – if you like 6502 code – is Steve Wozniak’s floating point system in 256 bytes for Apple II. Lets see, floating point Tetris in 700 bytes? Just because.
Woz was coauthor of those routines. The whole FP package was under 512 bytes, and included log, antilog, float to fix, fix to float as well. The core add/sub/mult/div routines were about half of that.
http://archive.org/stream/Apple_2_Woz_Floating_Point_Routines_for_the_6502/Apple_2_Woz_Floating_Point_Routines_for_the_6502_djvu.txt
He says he wrote the core routines himself. I recall he sweated out the end to fit in 256 bytes. Like his FDD software, he obsessed over saving a byte. If you started with boards where 1K was a luxury, you understand.
I’m just putting this here:
https://survex.com/~olly/rheolism/dsm_rheolism/
;)
Told you all BBC basic was the best!
Bah! Here it is in Python:
Which is more readable?!?
Something seems a miss here – that single line is way too long to be entered to a model B; 429 characters, not 256 as suggested.
BASIC keywords are single symbols???
Yes, all became clear when I followed the link to Extra Rheolism – ‘The one line is a byte short of the maximum length when tokenised, and so very hard to type in. Hence, it is distributed in the form of a file which should be *Exec-ed.’ – In other words you can’t just type it in, the normal BASIC editor can’t handle it.
Damn
I usually start development on these little bootsector toys by making a .COM file in DOSBox. I usually use FASM inside of DOSBox, but whatever floats your boat. Once you have a .COM file working, adjust the origin and running it as a boot sector is a minor modification.
Now, add cheesy 8-bit Russian music…because it’s not Tetris without those tunes.
Damn straight!
https://en.wikipedia.org/wiki/Korobeiniki
Relevant : look almost identical, with scoring, 256 bytes, from 2007 : http://www.pouet.net/prod.php?which=29286
I didn’t see any wall kicks in the demo, what rotation system does it use? .
This restored my faith in humanity and our collective future.
I hate this game, but I admire this work.
Quote: “want to play Tetris on any operating system”
Unless I read wrong QEMU will emulate different hardware but the code still must suit the target system. So in theory this code only runs in the hardware it was targeted for or on the emulator in the emulation mode for that hardware ???
You missed it man. The code is a system that runs the OS. The OS is Tetris.
Yes but the code is x86 and only runs on an x86 CPU or emulator. There are lots of other hardware platforms and OS’s that don’t use a x86.
i do not see source code in the banner, it is the executable code
technically your right, but if you know the op-codes for the processor (or microcontroller) then it is pretty much good as the cource-code… it’s not really decompiling when the code was written for the CPU registers themselves; as long as you have access to the datasheet of that specific chip, its just a translation.
that is the simplistic beauty of assembler, you do not need to understand how things MIGHT have been done, you only need to read table of commands and put them in order in a text file :)
eg:
0xFF=NOP (single-byte)
0x30=LD (following byte contains 7bitdata and 1bit that determines if 3rd byte follows)
0x00=END (single-byte)
if it was the binary tetris from a C or BASIC ect compiler then every different version and setting will make huge changes to what actually comes out, even thought the programs do the same thing the binary will be different, often decompliling only does 90-99% of the code and the rest is errors. but when something complex is coded using assembler and MANUALLY optimized BY HAND over and over until its a mere few hundred bytes including graphics(commands), and then decompiled, it will usually be working sourcecode that can be re-compiled without fixing any commands. usually the only ASSEMBLER things not easy to decompile on the first try are things that do not end up in code, like special compliler directives. eg ORG, AVR”fuse-bits”, #library
re: no source. Machine code is just ASM in rot13.
Machine code is HEX
Assembly is mnemonics
Source code can be anything that compiles into the above.
Binary
https://cdn.hackaday.io/images/9611331403149698706.jpg
Is this demo included in the code?
i got this running on VMware … its going to eat up an unnecessary amount of time …
But where’s the AI code that gives you 10 Ts in a row when you’re waiting for a I ?
…I’ve already taken six bytes out of the keyboard routine from a very quick look scrolling through the asm listing. Run it by the old Hugi compo mob on yahoogroups and someone will take this 446 bytes and halve it very easily. There were a number of Tetris’s made for various 256 byte compos over the years as mentioned above.
The gauntlet has been thrown down!
I’ll take that for true when it runs… some of these super tiny programs start doing things like taking an instruction as as a variable input elsewhere, just ‘coz it happens to be the right number, or one that will work.
Self modifying code. ;)
OMG I want to play Tetris on the MBR from a de-lidded IDE drive using a screen from a Nokia 5110 Controlling it with Pots from a car radio
Delid the drive, lock the head movement, make POV display out of rest of platter, run it all on the drive’s microcontroller.
This is almost the level average people could remember the sequence :D
Stack Exchange has a whole section about “code golf” in which the winner is whoever writes a given algorithm in the east amount of code. It’s rather fascinating.