TeX emulating an 8-bit AVR CPU
-
From reddit today
Yes, a typesetting language is emulating a 8-bit microcontroller architecture and running Intel HEX files for them.
It can apparently run at 2.5kHz.
Read the README for details, look at the source code to cry.
snippet:
[code]% \avr@bin@getbit bs:byte, bitnum, \result -> \result = (bs >> bitnum)& 1
\def\avr@bin@getbit#1#2#3{%
\avr@count@tmpa=7%
\advance\avr@count@tmpa by -#2\relax%
\def\avr@bin@getbit@helper##1##2@nnil{%
\ifnum \avr@count@tmpa = 0%
\def#3{##1}%
\else%
\advance\avr@count@tmpa by -1\relax%
\avr@bin@getbit@helper##2@nnil%
\fi%
}%
\edef@tmpa{#1}%
\expandafter\avr@bin@getbit@helper@tmpa@nnil%
}\def\avr@bin@setbit#1#2#3#4{%
\def@tempa{}%
\avr@count@tmpa=7%
\advance\avr@count@tmpa by -#2\relax%
\def\avr@bin@setbit@helper##1##2@nnil{%
\ifnum \avr@count@tmpa = 0%
\xdef@tempa{@tempa #3##2}%
\else%
\advance\avr@count@tmpa by -1\relax%
\xdef@tempa{@tempa ##1}%
\avr@bin@setbit@helper##2@nnil%
\fi%
}%
\edef@tmpb{#1}%
\expandafter\avr@bin@setbit@helper@tmpb@nnil%
\edef#4{@tempa}%
}
[/code]
-
This illustrates everything I love and hate about Latex at the same time.
-
TEΧ or LATEΧ? Doing it in the first is a bit crazy. Doing it in the second would be a WTF.
-
Now write a TeX interpreter in Postscript and we can directly send AVR programs to most printers.
-
Fine fine, it's just TeX but it's a little more than a "bit crazy"
-
In a world where XSLT has been used to make a Turing Machine, nothing is too crazy.
-
I think all CS courses processor design should make Tex (eat that, you capitalist pigs!) obligatory for prototyping.
-
Coder challenge: implement an XSLT engine in TMML.
-
I've once read someone posit that any language which is not turing complete will get feature extensions until it is.
We've got an in-house string matching language. I could probably implement a program that converted brainfuck to it. An interpreter would be trickier. I probably would need to stretch some of the buffer/jump limits.
-
TMML
Just a hunch, but I assume you don't mean
-
Which is what came up when I tried to search for TMML.
Turing Machine Markup Language, apparently. That was the bottom of the first page of Google results, below "That Made Me Laugh" and some local town websites.
I don't want to click the Turing Machine link.
-
-
FrostCat:
Turing Machine Markup Language
"That Made Me Laugh"Filed under: laugh bitterly and with sorrow
It's every bit as deliciously verbosely WTFy as you could imagine.
<mapping> <from current-state="replace-symbol" current-symbol="a"/> <to next-state="replace-symbol" next-symbol="n" movement="right"/> </mapping>
-
I wish you where right! I am working with a domain specific language for data analysts called GESS. Unfortunately, GESS has a crappy compiler which only allows ifs nested to 5 levels. Combined with some other restrictions (most notably the missing "and" operator) this leads to lots of very ugly code, which could be so much better if I could define real functions
-
Yes, really boring people can use anything that's Turing-complete to build pointless shit. Whee.
Proving a language/environment/whatever is Turing-complete is interesting. Once it's proved, anything else done with it is tedious.
-
I think @blakeyrat needs a hooker. You are especially cranky today.
-
@Intercourse said:
I think @blakeyrat needs a hooker. You are especially cranky today.
He's also right.
-
That is beside the point. Also, I am trying to make @blakeyrat's head explode because of @-mentions and notifications.
-
He's also right.
He has very low tolerance for things that other people enjoy but that he does not. Which isn't terribly strange for a guy with the tastes of a pre-teen child.
-
He has very low tolerance for things that other people enjoy but that he does not. Which isn't terribly strange for a guy with the tastes for pre-teen children.
FTFY.
Also, @blakeyrat.
-
No I have very low tolerance for shit like this because once you've determined it's Turing-complete, of course you can make a 8-bit CPU emulator on it. You could make a NES emulator in it. You could make whatever.
All it takes it tedium. It's tedious done in Minecraft, it's tedious done in TeX, it's tedious when some idiot ports Doom to their fucking ink jet. It's just people with a high tolerance for tedium going, "hey look at this extremely tedious task I did, and now I'm bragging about it!"
Congratulations you wasted a thousand hours of your life. Now let's actually talk about something interesting.
-
Congratulations you wasted a thousand hours of your life. Now let's actually talk about something interesting.
Such as the inner workings of vital interlocking hardware and firmware, just to give an example?
-
"hey look at this extremely tedious task I did, and now I'm bragging about it!"
Like recording yourself playing a video game?
-
playing videogames isn't tedious
Well, some videogames
-
playing videogames isn't tedious
Neither is solving problems. @blakeyrat is just intolerant and lacks imagination.
-
Yeah, that sounds pretty limited. Ours has goto, and allows multiple rules files to use each other as input (no cyclical dependencies allowed). I've never been asked for true functions.
-
Neither is solving problems. @blakeyrat is just intolerant and lacks imagination.
Ok, fill me in, Einstein. What problem does this solve?
What problem does emulating a 8-bit CPU using a document formatting markup language solve? You opened this can of worms, now you gotta start spitting out words, buddy. What the holy fuck problem could possibly in a billion years be solved by this?
-
So...why in the world would you ever write an interpreter in a document formatting language? Or are you asking this in the same vein as 'why do people climb Mount Everest?'
-
It solves the problem of not having a way of emulating an 8-bit CPU in a document formatting markup language.
Also the problem of having a friend who's lording their epeen over you because they made a NES emulator in Minecraft
-
"Some tedious bastard needs something to do" is technically a problem
-
Congratulations you wasted a thousand hours of your life. Now let's actually talk about something interesting.
Hey fuckhead, to this guy this was interesting. It was a challenge. Not my cup of tea, but so fucking what? I still think it is interesting. It is modifying something beyond what it was built to do. To some people, tedium is fun or relaxing. Like people who build ships in bottles, or put together elaborately detailed model train sets. Again, not my cup of tea but I still find it impressive.
Just because it is not my hobby, does not mean I think it is stupid. You have the narrowest world view of any person I have come across. The world barely exists beyond your nose, you myopic bore.
-
-
this I've got to see...
No, don't. It is boring and tedious and useless and serves no purpose and only stands as a monument to someone wasting thousands of hours of their life, etc, etc, etc. If you seek it out, you are no better than those who downloaded the leaked celebrity nudes. Heathen!!
;)
-
@Intercourse said:
downloaded the leaked celebrity nudes
you didn't?
nnnnnno, that is isn't shocked.... DISCOURSE!
-
I will only say that I am no better than those who downloaded the leaked celebrity nudes and that I was not aware that Jennifer Lawrence was such a dirty, dirty, girl. ;)
-
@Intercourse said:
Hey fuckhead, to this guy this was interesting.
Right; otherwise he would not have done it.
@Intercourse said:
It was a challenge.
No it wasn't. You spent an hour working out how to do your logic gates (or whatever lowest-level of hardware he went to), then you spend 600 hours doing basically copy-and-paste.
In the words of Retsupurae, "what was the challenge!? You're hitting 'A'!"
-
-
What problem does this solve?
It scratches an itch. Obviously that's an experience you've never had. Your skin must be made of plastic like the rest of the aliens.
-
-
No it wasn't. You spent an hour working out how to do your logic gates (or whatever lowest-level of hardware he went to), then you spend 600 hours doing basically copy-and-paste.
A smarter person (using Minecraft) would use an NBT library and write a program to inject the blocks into the save file. I was tempted to do this before but you are really tempting me to do it out of spite.
-
Ok, fill me in, Einstein. What problem does this solve?
The problem of, "How do you do this?" Like a math problem in school. Or finishing Skyrim.
-
No it wasn't. You spent an hour working out how to do your logic gates (or whatever lowest-level of hardware he went to), then you spend 600 hours doing basically copy-and-paste.
Sir Edmund Hillary only took steps. He took one and the rest of them after that were just repeating the same thing over and over again.
Climbing Mount Everest was kind of pointless, it did not solve any problems, I fucking hate the cold and I am shit terrified of heights. But that does not mean that I have to sit here and belittle those that have done it. Unless they were basically carried up by a sherpa, which is apparently a thing now.
-
@Intercourse said:
Sir Edmund Hillary only took steps.
But, like the legendary repairman, taking the steps is the easy part...
knowing where to step, ah!... there's the difficulty.
Also: Tenzing Norgay
-
Also: Tenzing Norgay
Pfffffbt. Don't you know that accomplishments only matter if they are done by European people??
-
@Intercourse said:
Pfffffbt. Don't you know that accomplishments only matter if they are done by European people??
I only keep that fact on the tip of my brain because it was a very classy and canny move on their part to never reveal who reached the summit first.
And all pre-PC.
No, not the IBM PC....
-
It's just people with a high tolerance for tedium going, "hey look at this extremely tedious task I did, and now I'm bragging about it!"
-
I only keep that fact on the tip of my brain because it was a very classy and canny move on their part to never reveal who reached the summit first.
I like to think that upon reaching the summit, they walked those last steps together and summited simultaneously. But then again, he was a Kiwi and my best friend is a Kiwi and a total cock...so Sir Edmund Hillary probably tripped him and then ran ahead.
-
@Intercourse said:
..so Sir Edmund Hillary probably tripped him and then ran ahead.
Not if they were tied together!
"Hey! Tenzig! .... look! ... Over there!....." shuffles ahead
-
I think Mallory and Irvine were the first. Suck it.
EDIT: I also think Gustave Whitehead flew heavier-than-air before the Wrights. That guy was a badass.
-
I think Mallory and Irvine were the first. Suck it.
Perhaps, but Hillary and Norgay were the first to summit and make it back down alive. I think that is a crucial part of the endeavor. Otherwise lots of people could be the first for things, as long as they were willing to die as a result of it.
EDIT: I also think Gustave Whitehead flew heavier-than-air before the Wrights. That guy was a badass.
Not likely, considering that when it came time to prove his claim of flight he could not replicate it. Only hearsay evidence supports his claims.