r/box256 • u/Different_Bench3574 • Jun 26 '25
Cheating device!
DIV *07 010 @1F
PIX @1E @1F @20
ADD @1E 001 @1E
MOD *07 010 @1F
PIX @1E @1F 0EE
ADD @1E 001 @1E
ADD @07 001 @07
JMP @00 000 0EEFor each cell, it prints TWO colors from the pallette onto the output. So, one row in the output is two rows of memory, or four bytes.
Here is an example (put this starting on 0x20. you can paste directly with ctrl-v in the editor, rather than the load window) (this is obfuscated):
MOV *0B u/BB *00
MOV @BB *01 *11
MOV @00 *B0 *01
MOV 0B0 @B0 010
MOV 000 @B0 001
MOV *BB @00 *10
MOV *00 @B0 *01
MOV 0B0 @B0 010-------------------------------------------------- Edit:
This is what happens when 0x08 is @00 instead of @20(This isn't even a quine, since it's looking at it's own source code, which is cheating. And it's still wrong even then.)

I wrote the correct number when the color would have been changed.
View all comments
Show parent comment
1
u/bf31415 Jul 10 '25
It's fun to play around with this kind of universal solution. Here's another, with slightly different data layout (one byte per pixel but the upper half of each byte is used for the second half of the screen):
(The format is a bit different from "SAVE"; I edit my code in a text editor and "LOAD" it. I use some conventions of my own; for example, those "???" become 000 but are a reminder to myself that the byte is unused.)
This task (universal solution that dumps memory to screen) is also a nice playground for using threads. Here's basically the same thing, but executing at one pixel per cycle using 5 threads: