4 ms·
BootLogo: Logo language in 508 bytes of x86 machine code
- asicsp 3y agoSee https://news.ycombinator.com/from?site=github.com/nanochess https://news.ycombinator.com/from?site=github.com/nanochess for discussions on other such amazing projects.
- wingi 3y agoSame developer
- yc-kraln 3y agoThe other day when I was hacking together on some GCode for a small CNC table, it felt somehow very similar to me: I realized that, as a five or six year old, playing with Logo/Turtle graphics on Apple ][ machines--my first interactions with computers--was essentially the same conceptual loop.
- verticalscaler 3y agoProgramming Computer Animation in 1964 - AT&T Archives: https://www.youtube.com/watch?v=-5mFhDIJfNA https://www.youtube.com/watch?v=-5mFhDIJfNA The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.
- lynx23 3y ago-- Robert Jordan
- MisterTea 3y agoThe same goes for plot(6) on plan 9: http://man.9front.org/6/plot http://man.9front.org/6/plot It's all vectors and arcs though some newer controllers do splines and other curves in hardware during execution using vendor specific instructions.
- igtztorrero 3y agoThank you so much. Logo was the first computer language I learned. Incredible implementation in asm.
- liotier 3y agoSame. Logo taught me the only important part of computer science: the computer does what the program tells it to - no more, no less... Everything else in computer science is implementation details and incident factors !
- anthk 3y agoYes, but in the mid 90's, teaching Logo to Elementary students sucked at lot. We barely touched Logo for a week and doing advanced stuff was just something for kids with computers at home with young parents. I was lucky to get a Debian release from a magazine in early 00's, my relation to computers did a 180 degree turn. That and retroemulation, I even learnt C64 basic just for fun under VICE/CSS64. From that era I loved Perl, text adventures, self-learning from books and lots of howtos on C and PostScript.
- fernandotakai 3y agoah same! i learned logo in my native language (ptbr) when i was in middle school. it absolutely blew my mind that i could "automatically" draw things. first thing i did when i got home was ask my dad for it -- it took him to find the proper floppy (he borrowed from a friend that was a CS teacher!). fun fact: we didn't call it logo, we called it "the little turtle game".
- buescher 3y agoI am an unabashed nanochess fanboy but it’s not really Logo without lists and functions.
- jhbadger 3y agoTrue. People often think Logo is just turtle graphics, but it really is a complete programming language that is, despite the syntax, actually related to Lisp. Brian Harvey even wrote a series of intro CS texts using Logo that didn't use turtle graphics at all. Brian's home page has the full text of them. https://people.eecs.berkeley.edu/~bh/ https://people.eecs.berkeley.edu/~bh/ (that being said, I get that full Logo would not be possible in 508 bytes)
- 082349872349872 3y agoIt seems to be the fate of programming languages (especially ones few people currently use) to get stereotyped by a small fraction of their utility. I guess the best we can hope for is that the stereotype (Lisp: parens; C: segfaults) is at least tangentially related to the reasons people use the language, as opposed to completely unrelated stereotypes (Logo: turtle; ??: ??).
- rvba 3y agoWould it be possible to hack the management engine in such a way that during boot it makes an internet connection and imports some logo from the internet? Or is it more theory?
- aleph_minus_one 3y ago> Would it be possible to hack the management engine in such a way that during boot it makes an internet connection and imports some logo from the internet? This rather sounds like something that one could implement as an UEFI application.
- krallja 3y agoThat sounds like PXE booting with one more step
- pragma_x 3y agomov ax,0x0013 ; VGA 320x200x256 colors mode. int 0x10 ; Set video mode. Oh man that takes me back. Also this is sporting a fixed-point sin table and compiled down to a .com. It's like 1994 all over again.
- pk-protect-ai 3y agoI had repeating dreams about int 10h and EGA back in 1991 ... It was magic ...
- sitzkrieg 3y agomode 13h gfx programming in tasm well after its heyday was my first programming really (i was young and stumbled) fond memories
- alexshendi 3y agoNo way to define procedures and no list processing? Hardly LOGO.
- alexshendi 3y agoBut still impressive. I will see, if I can massage Justine Tunney's sectorlisp into something resembling a (subset of) LOGO, probably w/o turtle graphics. Deliverable will probably be a DOS COM-file rather than a boot sector.
- userbinator 3y agoIt's 508 bytes, much better than what a compiler can do, and yet from a quick glance at the source I can still find a few more bytes to squeeze out.
- zoky 3y agoOh? Do tell.
- userbinator 3y agoLooks like some of the other comments here have found a few of the optimisations already, but another one is that BIOS functions don't change register values unless specifically used for output --- in HLL jargon, all registers are effectively callee-save. Thus no need to e.g. use 16-bit move immediate when an 8-bit would be sufficient due to the other half already having the right value.
- karuvally 3y agoThis look so refreshing OP! Will try to make some changes and have fun!
- jcmeyrignac 3y agoThe jb .5 can be removed, saving 2 bytes. There are other optimizations, like inc di/jmp short avoid_command which could be moved before avoid_command, saving another 2 bytes.
- nanochess 3y agoThanks for the tips! I've updated bootLogo and mentioned you in the manual. Now bootLogo has PU/PD commands.
- anthk 3y agoThtat reminds me that when I was a kid and I knew literally nothing about computers, I hated Logo because of a totally non-intuitive syntax, but I solved a math puzzle (something like the mpuz form Emacs, but for DOS PC's) at great speeds. With Windows 96/98 and C++ it was even worse, as the programming barrier was uber-high with the Win32 API, and most of sysadmin the stuff under Windows was MS's technobabbled nonsense. Thus, I tought computers where a crappy blackbox for College engineers and with no open knowledge. Until early 00's. Then GNU/Linux came, with full manuals included for everything with Debian Woody and then Sarge. I tried to do the same with PostScript, it's kinda the literal same thing as Logo, but now the environment was much saner and understandable, with Emacs calling GV on demand, and the most importang thing: documentation. As simple was that. Bundled help files. You didn't require books not found anywhere else, nor an internet connection, nor people really far from your blue collar relatives who had no connection to computers. The gap between the nerdy kid with young parents around computers and me became much smaller, and the GNU/BSD guys did an oustanding work spreading IT to anyone.
- qgin 3y agoThis makes me so happy. Logo on the Apple IIe was my first exposure to programming ever as a kid.
- dloss 3y agoMade by Oscar Toledo G., who learned assembly language by age 9 and won the International Obfuscated C Contest five times. https://nanochess.org/author.html https://nanochess.org/author.html
- jpablo 3y agoIs he related to the infamous Familia Toledo http://www.biyubi.com/ http://www.biyubi.com/?
- slumberdisrupt 3y agoYes, one and the same (he appears on the homepage you linked)
- fsmv 3y agoHello friend. I'm on a crusade to make people's bootsector code work on real hardware. You're missing several reserved memory areas and state bits to reset. Check out my bootsector I have lots of comments on what things are needed https://github.com/fsmv/bootstrap-os/blob/master/bootloader/bootsect.asm https://github.com/fsmv/bootstrap-os/blob/master/bootloader/... You can probably drop the extra sector loading code and error printing and only use the header and footer.
- ikari_pl 3y agoThis is a crazy comment to find. I LOVE IT.
- mapreduce 3y agoLike others have said this is hardly Logo. Turtle graphics != Logo. Turtle graphics is a tiny tiny subset of Logo. But let us not miss the forest for the trees. It is still very impressive that the tiny tiny subset of Logo fits in 508 bytes of machine code.
- parkertomatoes 3y agoI remember copying logo programs from a whiteboard into an Apple II as a grade schooler. It's a great "instant results" way to introduce kids to programming, and it lends itself to exploration in a way that today's copycats ($10/mo iPad subscriptions and visio diagrams to make a character walk around) don't. Browser emulator link: https://parkertomatoes.github.io/v86/?type=mbr&content=%2FLgTAM0QuACgjtiOwL8A%2BjHAq7Qoq7QZqzH%2FuQAKMMDzqujOAL8A%2B1ewPon6V1C2ALcAtALNEFi5AQC7DwC0Cc0QtADNFl88CHUHifpPsCDr2zxhcgY8e3MCLCCqPA11yuiPAF%2FoAgDrr%2Bg5AL6ffS6tCcB0JTsFdAOt6%2FPoGwAxyYoFLDByEDwKcwyYULAK9%2BFZAcFH6%2Bou%2FySKBSTAPEB1A0fr9YoFRzwgdPlPw%2Bj0%2FzxbdQFHUVdQ6K3%2FWFA8W3UI6OD%2FPF118EeJ%2FlhfWeLliffD6KkA6IwA4vjD6KAAuEz%2F6IIA4vXD99kBDgD6w80g%2FzYC%2Bv82BPr%2FNgD6Mfa5BQDoYADi%2B7hq%2F%2BgfALh0%2F%2BgbALgoAOgVALh0%2F%2BgNAI8GAPqPBgT6jwYC%2BsOxCgEGAProJADi%2B7EFw7toAQnAeQQB2Hj8Kdhz%2FAHYukAA9%2BL387u8fS7XmMPoKgA583QFid6ANw8xwAMGAPpQ6Mv%2FAQYC%2BliDwFrowP8pBgT6w%2BgEAMYHD8NRoQT6sQbT6IseAvrT61m6QAH34gHDw0ZE1XxCS958UlTsfExU6nxSRa98Q0wAfFFV8XwAAAYMExgeJCktMTU4Oz0%2FQEBAPz07ODUxLSkkHhgTDAYA%2BvTt6OLc19PPy8jFw8HAwMDBw8XIy8%2FT19zi6O30%2Bv%2F%2FVao%3D https://parkertomatoes.github.io/v86/?type=mbr&content=%2FLg...
- nanochess 3y agoThanks! Your project is amazing to test with just a browser. Just I've made a link using the newest version of bootLogo (now supporting procedures!) TO CURVE REPEAT 4 [LT 10 FD 10] END TO PETAL [CURVE LT 140 CURVE] END TO FLOWER REPEAT 4 [PETAL LT 50] END FLOWER RT 180 FD 50 RT 140 PETAL PU FD 50 Emulator link: https://parkertomatoes.github.io/v86/?type=mbr&content=Dg4fB%2FzozgC4C4CruAx8ULIA6K4BsCDNEOgSAb8Af1ewPon66wWwIIn6T%2BiVAbEBzRC0AM0WPAh07DxhcgY8e3MCLCCqPA112ejiAF7oPwA8W3UNRugJAOg0ADxddfZGw%2BgrAL%2B1fLkLAK2vdCiu4vq%2FjX%2BNfX47PgmAdAqvdfRWif7ox%2F9erCxBPBpy%2BU6sPCB0%2B07D6O7%2FMcmsLDA8CnMLmFCwCvfhWQHB6%2B5OigWYAcf%2F50NMH0ZEVUJLTlJUWUxUVFJFKVBVVVBEVVNFWFRPJ1FVV7gEAM0QvwCAMcCrtFCrtDKrQKq4Awyrw15WUehZ%2F1ni91%2FDiz4JgKXohv%2B5fgDzpIk%2BCYDDuEz%2FujHA6HMA4vvD99kBDgCAw7AAurABogaAw4gOB4DDzSD%2FNgKA%2FzYEgLkFADHA6GsA4vu%2B2H2shMB0DrEF9uG7gADoPgDi%2BOvtjwYEgI8GAoDDu2gBmff7CdJ5AgHauIAA9%2BL386hAnKggdAI0HyQfu9591510AvfYw%2FYGBoABdBsx21BRsQehAoDT6IsWBIDT6pGhB4AI2M0QWVhQAwYAgFDorf8BBgKAWIPAWuii%2FykGBIBYw7koACjKc%2FkAyrYVuwEAtALNELQJwyoqDhZCQgAGDRMZHyUrMTc8QkdMUVZbX2Nnam5xdHZ5enx%2Bf3%2BAVao%3D https://parkertomatoes.github.io/v86/?type=mbr&content=Dg4fB...
- RantyDave 3y agoSo it loads and boots in ... one ... disk command? Under a millisecond, all up? On actual physical hardware it may well have booted before the power switch makes it all the way back up. Outrageous.