Last active
December 14, 2015 06:49
-
-
Save mikedanese/5045545 to your computer and use it in GitHub Desktop.
Minimal Monitor http://en.wikipedia.org/wiki/Machine_code_monitor http://www.reddit.com/r/programming/comments/9x15g/programming_thought_experiment_stuck_in_a_room/c0ewj2c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef void (*function)(); | |
char program[32]; | |
int main() { | |
char *t = program; | |
unsigned i, n; | |
for (;;) { | |
for (i = 3; i; i--) { | |
n = getch() - '0'; | |
if (n > 7) (*(function)program)(); | |
*t = *t * 8 + n; | |
} | |
t++; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment