6 ms·
Avremu: An AVR Emulator Written in Pure LaTeX
- clifanatic 10y ago"Surely I'm misreading that title..." "Nope, that's really what it is..."
- dcschelt 10y agoMy response exactly.
- JohnHammersley 10y agoMine too! Just when you thought you'd seen everything LaTeX could do (and we see a lot of it at Overleaf[1]!) If the author is reading these comments, what motivated/inspired you to do this? [1] https://www.overleaf.com https://www.overleaf.com
- jpallen 10y agoThis is awesome, great job! How long before we can write ShareLaTeX in ShareLaTeX? ;) I once got as far as writing and http server that used the flexibility of TeX macros to turn headers like 'content-length:' into TeX commands that recorded their value, and then processed the incoming request as if it were TeX code. It wasn't pretty...
- tptacek 10y agoThis is obviously impressive. AVR is surprisingly annoying to emulate! If you're looking to emulate enough to run C on, two platforms that are significantly less painful: * MSP430, whose instruction set fits on a single Wikipedia page while simultaneously being nicer to program than AVR * The c4 compiler's stack machine VM, which was designed specifically to be a minimal machine on which to run C in the smallest number of lines of code.
- teiche 10y agoI'm not very familiar with the AVR instruction set, what makes it difficult to emulate?
- dom0 10y agoAVRs have a few quirks because the original ISA didn't consider parts with more than 8K program memory, so later some longer jumps where tacked on. A few instructions has a bunch of special cases for some common operations (eg. bit-based access to some, but not all, IO registers). It is kind-of-but-not-really orthogonal with comparatively many instructions for an 8 bit controller (about ~120). Not sure how it compares regarding "emulability".
- andars 10y agoI can't comment on the difficulty of emulation, but it's probably 'annoying' because it isn't von Neumann, which makes it a tad bit strange.
- gugagore 10y agoI thought the Harvard architecture was pretty common for microcontrollers, where firmware lives permanently in Flash memory. PIC microcontrollers have opcodes that are 12 and 14 bits, for example.
- andars 10y agoIt certainly isn't uncommon. I didn't mean that it is strange in comparison to other microcontrollers, just that Harvard can be strange for the author of an emulator, depending on their background.
- buserror 10y agoIt's actually not terribly difficult. There are good references, and I remember it took me about 4 days to write the very first version of simavr[0]. What's harder to emulate are all the peripherals, and all their quirks. In simavr the 'core' code is pretty much unchanged (apart from the odd cosmetics) in the last 7 years, while most of the work was to emulate the peripheral blocks. [0]: https://github.com/buserror/simavr https://github.com/buserror/simavr
- Light2Yellow 10y agoMust have been so painful!
- shanth 10y agoWut??? O_O
- wyc 10y agoJust when you thought you've finally grasped LaTeX...
- ezequiel-garzon 10y agoCould anyone point to the main (La)TeX files? I seem to find only documentation such as [1]. [1] https://gitlab.brokenpipe.de/stettberger/avremu/blob/f634322235a6b145535e1a28c2a2f33f91a01d64/source/avremu.tex https://gitlab.brokenpipe.de/stettberger/avremu/blob/f634322...
- btown 10y agohttps://gitlab.brokenpipe.de/stettberger/avremu/tree/master/tex/latex/avremu https://gitlab.brokenpipe.de/stettberger/avremu/tree/master/... instr is a true work of art.
- btown 10y agoBut can it run Doom? https://motherboard.vice.com/read/a-catalogue-of-all-the-devices-that-can-somehow-run-doom https://motherboard.vice.com/read/a-catalogue-of-all-the-dev...
- jacobush 10y agoIt can run linux on an emaluated ARM, so probably yes
- dhosek 10y agoWell TeX is Turing-complete, so any computable program can be written and executed using TeX. Back in the '80s, there was an MIT undergrad named Andrew Marc Greene who wrote a BASIC interpretter in TeX (BaSiX—https://www.ctan.org/tex-archive/macros/generic/basix https://www.ctan.org/tex-archive/macros/generic/basix).
- kahnjw 10y agoThat's what the link says....
- jdnier 10y agoThere's also Stephen Hicks' winning 2008 ICFP programming contest entry, where he writes "a controller for a Mars rover" in TeX. http://sdh33b.blogspot.dk/2008/07/icfp-contest-2008.html http://sdh33b.blogspot.dk/2008/07/icfp-contest-2008.html Rapid Prototyping in TeX: https://wiki.haskell.org/wikiupload/8/85/TMR-Issue13.pdf https://wiki.haskell.org/wikiupload/8/85/TMR-Issue13.pdf
- godmodus 10y agorespect and awe. and a world of hell no, for me personally. it can churn 2.5khz & took it 44 hours to calculate a 250x250 mandelbrot set. > This picture (250x250) took 44 hours to render. The source code can be found in the test-suite directory under mandelbrot.c. here's the instruction code: https://gitlab.brokenpipe.de/stettberger/avremu/blob/master/tex/latex/avremu/avr.instr.tex https://gitlab.brokenpipe.de/stettberger/avremu/blob/master/... pretty nice stuff. it looks simpler than it sounds, and it's probably MUCH harder to properly implement than it looks.
- dancsi 10y agoThe obvious next step is to emulate ARM within it, and use it to run Linux: http://dmitry.gr/index.php?r=05.Projects&proj=07.%20Linux%20on%208bit http://dmitry.gr/index.php?r=05.Projects&proj=07.%20Linux%20...
- i336_ 10y agoWould be excellent for application performance testing.
- akavel 10y agoI like to say that TeX is the best example of an esoteric programming language which sneaked into mainstream use.
- krylon 10y agoIt is amazing what crazy things people do just "because we can". I love that simultaneous feeling of disgust, joy, horror and wonder. ;-)
- szubster 10y agoI wonder whether it runs under http://manuels.github.io/texlive.js/ http://manuels.github.io/texlive.js/
- i336_ 10y agoThis reminds me of https://github.com/uuner/sedtris https://github.com/uuner/sedtris, a console tetris game written in sed. The code has a very similar visual feel to it: https://github.com/uuner/sedtris/blob/master/sedtris.sed https://github.com/uuner/sedtris/blob/master/sedtris.sed