Lurker News
OFRAK Tetris is a project I started at work about two weeks ago. It's a web-based game that works on desktop and mobile. I made it for my company to bring to events like DEF CON, and to promote our binary analysis and patching framework called OFRAK.

In the game, 32-bit, little-endian ARM assembly instructions fall, and you can modify the operands before executing them on a CPU emulator. There are two segments mapped – one for instructions, and one for data (though both have read, write, and execute permissions). Your score is a four byte signed integer stored at the virtual address pointed to by the R12 register, and the goal is to use the instructions that fall to make the score value in memory as high as possible. When it's game over, you can download your game as an ELF to relive the glory in GDB on your favorite ARM device.
The CPU emulator is a version of Unicorn (https://www.unicorn-engine.org/) that has been cross-compiled to WebAssembly (https://alexaltea.github.io/unicorn.js/), so everything on the page runs in the browser without the need for any complicated infrastructure on the back end.
Since I've only been working on this for a short period of time leading up to its debut at DEF CON, there are still many more features I'd eventually like to implement. These include adding support for other ISAs besides ARM, adding an instruction reference manual, and lots of little cleanups, bug fixes, and adjustments.
My highest score is 509,644,979, but my average is about 131,378.
I look forward to feedback, bug reports, feature requests, and strategy discussions!

Comments (53) 23 threads

Earlier comments
tiborsaas1 reply#
Very cool concept, but my assembly understanding is really poor :)

It says that my score is stored in R12, but then why do I have a score of 16 of R12 is zero?
https://imgur.com/a/RY5jhTu

jstrieb1 reply#
R12 contains the address of your score. In this case, that is address 0 - the start of the data segment.

The score register is yellow, and the corresponding memory region it points to (the actual bytes of your score) are also yellow.

tiborsaas#
Thank you, it makes sense now.

If you'd like to do a video tutorial how to play this well that could be a great resource to learn assembly intuitively.

personjerry1 reply#
I'm computer literate (and know some basic assembly) but wow I did not get it
jstrieb4 replies#
Hey, any specific questions? I'd be happy to explain anything that needs clarification.

More broadly, any thoughts on how to make the game clearer? I know that a manual describing the instructions would help. But other ideas are welcome as well!

rpgwaiter#
Maybe a way to break down a game after it happened, or maybe a sandbox mode to try arbitrary things
ithkuil2 replies#
I don't understand what "rotate the instruction order" keys do. I tried pressing them in many circumstances and nothing happens
jstrieb1 reply#
Yeah, I may have sacrificed clarity for concision in this case.

To answer by way of example, if you are given "add R1, R2, R3" rotating to the right will result in "add R2, R3, R4". As another example, rotating "mov LR, R0" to the left will give "mov R12, SP".
In other words, rotating right changes every register RN in the instruction to be the register R(N + 1). Left changes RN to R(N - 1).
My hope was that if it was not clear from reading, it would be after testing things out. But hearing that this may not be the case is helpful feedback!

Continue this thread — 1 reply

rft1 reply#
Just figured it out. If you select "Adjust Difficulty" and increase the max gadget size (number of instructions that can fall at once) you change their order with these keys.

P.S. thank you for nerd sniping me with this game, I love the idea and execution (pun slightly intended)!

Continue this thread — 1 reply

joshxyz#
i code frontend and backend web apps in javascript and typescript, very comfy with cloud stufd

but oh boy these assembly stuff these are heiroglyphs to me haha

LLyaudet#
You could add a puzzle mode with a fixed set of instructions introducing gameplay elements like rotate after a few puzzles to make it easier and more interesting to learn the game. My first play, I got a lot of sub instructions and my registers had all zero value. It was somehow partly pointless: Should I rotate and do sub R1, R2, R3 or do sub R2, R3, R4 to get a nop somewhere ? ;) XD
shaunxcode1 reply#
Beautiful brutalist ui/ux!
Lapsa#
yeah... wanted to leave a comment I dig the aesthetics.
latexr3 replies#
Before trying it I hit “About” and it opened a new page which says:

> By continuing to use this site, you agree to the use of cookies.
You seem to be in violation of the GDPR. There must be a way to refuse the cookies that is as simple as accepting them. Especially since yours are not needed for the site to function:
> The Services use cookies and similar technologies such as pixel tags, web beacons, clear GIFs and JavaScript (collectively, “Cookies”) to enable our servers to recognize your web browser, tell us how and when you visit and use our Services, analyze trends, learn about our user base and operate and improve our Services. (…) We may also supplement the information we collect from you with information received from third parties, including third parties that have placed their own Cookies on your device(s).
https://ofrak.com/privacy/#tracking-tools-and-opt-out
Telling people to delete cookies via their browser settings (further down that page) is not an acceptable solution.

sabas123#
Not sure if it's an error from using autocorrect, but you probably want to use complying instead of complaining.
hooch2 replies#
Telling site visitors to disable cookies via their browser is precisely how apple.com does it.
matsemann#
GDPR doesn't care about cookies. It depends on what they're used for. If they're not used for tracking or storing personal information, GDPR doesn't apply.

It's easy to read the original comment as if you need to ask permission for any cookie usage. But that's not what they're saying. They're saying it applies for this site's cookies, as the site specify they use cookies in a way that GDPR would say you need consent for.

chronogram#
It's not even storing anything illegal on my end, only the game settings, so I don't know why it shows that banner.

Load more comments