{"id":13778990,"url":"https://github.com/hausdorff/turtles","last_synced_at":"2025-08-16T18:33:14.748Z","repository":{"id":146279464,"uuid":"11397268","full_name":"hausdorff/turtles","owner":"hausdorff","description":"Lisp interpreter written for the Apple //e. It's called turtles because guess how slow it is.","archived":false,"fork":false,"pushed_at":"2013-10-28T05:44:00.000Z","size":268,"stargazers_count":85,"open_issues_count":0,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-17T14:41:14.515Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hausdorff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-14T02:25:57.000Z","updated_at":"2024-10-22T15:59:31.000Z","dependencies_parsed_at":"2023-03-23T22:00:04.401Z","dependency_job_id":null,"html_url":"https://github.com/hausdorff/turtles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hausdorff%2Fturtles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hausdorff%2Fturtles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hausdorff%2Fturtles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hausdorff%2Fturtles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hausdorff","download_url":"https://codeload.github.com/hausdorff/turtles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230050284,"owners_count":18165047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:59.791Z","updated_at":"2024-12-17T01:48:22.596Z","avatar_url":"https://github.com/hausdorff.png","language":"Assembly","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Building and running\n\nThe first thing you need to do is build and compile [apple2e-audio-transport](https://github.com/hausdorff/apple2e-audio-transport) (itself largely derived from a core part of [ADTPro](http://adtpro.cvs.sourceforge.net/)), which will allow you to transport the interpreter over the wire to the Apple IIe. It's a matter of running `make compile` and dumping the binary (which is called `transport` at this point) into the directory of this project.\n\nNext you want to make sure to grab all the other (public, widely-available) source dependencies below.\n\nNow the interesting part.\n\n\u003e **TEMPORARY NOTE:** We have developed a full prototype in C. The file is `a2lisp.c`, and you can compile and send this across the wire. The eventual target is 6502 assembly, which we are in the process of porting now.\n\n[Here](http://www.youtube.com/watch?v=tey9sFqICSk) is a YouTube demo (GitHub doesn't let you embed videos in readmes).\n\nHook up your Apple II e to the audio jack. Run `make send` on your home computer. You should see something like the following:\n\n```\n$ make send\nLength: 351\nLoad at: 0800..095e\nPress enter when ready...\n-: (raw)\n\n  Encoding: Signed PCM\n  Channels: 1 @ 32-bit\nSamplerate: 44100Hz\nReplaygain: off\n  Duration: unknown\n\nIn:0.00% 00:00:00.00 [00:00:00.00] Out:0     [      |      ]        Clip:0\n```\n\nThis program is waiting for you to press return to send the message. Don't press return yet.\n\nThe second line says `Load at: $x..$y`, where `$x` and `$y` are hex addresses. Now go to your Apple IIe and open the monitor program. Usually this is `call -151`, but it might depend on your system. (We're on ProDOS.) The Monitor prompt like this:\n\n`*`\n\nType `$x..$yR` into your Apple IIe's Monitor prompt. This will tell the Apple IIe to load from the audio port.\n\nIt will wait until it receives an answer.\n\nNow press enter on your home machine to transmit the data.\n\nYou might have to run `make send` and press enter again---I'm not sure why it does this, but transmitting the package again should work.\n\nThis should drop you into the prompt.\n\n# Examples\nBelow we provide some examples of what you can do with the current prototype.\n\n## Atoms and primitives\nNumbers evaluate to themselves:\n\n    \u003e 42\n    42\n\nBasic arithmetic is provided by the built-in primitives `PLUS`, `MINUS`,\n`MUL` and `DIV`:\n\n    \u003e (PLUS 5 5)\n    10\n    \u003e (MUL 11 10)\n    110\n    \u003e (PLUS 5 (MUL 10 10))\n    105\n\nLists are constructed using the `CONS` primitive. To extract the first element\nof a list, apply `CAR` to it. To extract the remainder (tail) of the list,\napply `CDR`. The emtpy list is known as `'()` or `NIL`.\n\n    \u003e (CONS 1 NIL)\n    (1)\n    \u003e (CAR (CONS 1 (CONS 2 NIL)))\n    1\n    \u003e (CDR (CONS 1 (CONS 2 NIL)))\n    (2)\n\n## Quotation\nAny datum can be \"quoted\", meaning it is taken literally and returned\nunevaluated:\n\n    \u003e (QUOTE 1)\n    1\n    \u003e (QUOTE (1 2 3))\n    (1 2 3)\n\nThe shorthand `'` can be used for the same effect:\n\n    \u003e '(1 2 3)\n    (1 2 3)\n\n## Conditionals\nThe `IF` form provides conditional tests. Everything that is not `NIL`\nis true:\n\n    \u003e (IF 'FOO 'YES 'NO)\n    YES\n    \u003e (IF CONS 'YES 'NO)\n    YES\n    \u003e (IF '() 'YES 'NO)\n    NO\n\n## Lambdas\nThe `LAMBDA` form can be used to construct an anonymous function.\nTurtles is lexically scoped, meaning that names bind to their lexically\n\"closest\" definition:\n\n    \u003e (LAMBDA () 'FOO)\n    #\u003cLAMBDA\u003e\n    \u003e ((LAMBDA (X) (PLUS X X)) 10)\n    20\n\nWe have full support for closures, meaning that variables in a surrounding\nscope are \"captured\" by the `LAMBDA` form. For example, in this case `X`\nis captured by the inner lambda.\n\n    \u003e (((LAMBDA (X) (LAMBDA (Y) (PLUS X Y))) 5) 10)\n    15\n\n## Global definitions\nGlobal names can be bound to values using the `DEFINE` form:\n\n    \u003e (DEFINE X 42)\n    \u003e X\n    42\n\nGlobal functions are easily defined by combining `DEFINE` with `LAMBDA`:\n\n    \u003e (DEFINE F (LAMBDA (X Y) (PLUS X Y)))\n    \u003e (F 2 3)\n    5\n\n## Basic recursion\nWe can easily define a recursive function to count the elements of a list:\n\n    \u003e (DEFINE LENGTH (LAMBDA (L)\n                       (IF L\n                         (PLUS 1 (LENGTH (CDR L)))\n                         0)))\n\n## Higher order programming\nThe forms we have explored so far are sufficient to define some common\nhigher order programming tools, such as `MAP`:\n\n    \u003e (DEFINE MAP (LAMBDA (F L)\n                    (IF L\n                      (CONS (F (CAR L)) (MAP F (CDR L)))\n                      '())))\n\nWe can use this in conjunction with `LAMBDA` to square the elements of a list:\n\n    \u003e (MAP (LAMBDA (X) (MUL X X)) '(1 2 3)\n    (1 4 9)\n\n# Dependencies\n\n* [apple2e-audio-transport](https://github.com/hausdorff/apple2e-audio-transport), a small library written specifically for this project. Sends the program over the audio jack to the Apple IIe.\n* [sox](http://sox.sourceforge.net/), which we use to emit sound to the Apple IIe.\n* [cpp](http://gcc.gnu.org/onlinedocs/cpp/), the C preprocessor; we write macros to make programming in the 6502 instruction set slightly easier.\n* [xa](http://www.floodgap.com/retrotech/xa/)(aka xa65), assembler for the 6502 instruction set.\n\n# LICENSE\n\nDistributed under MIT, which basically means that if you should use this code for anything, you just have to keep a note saying we wrote the code. That said, God help you should you actually decide to use this code.\n\n\n## MIT License\n\nCopyright (C) 2013 Martin Törnwall (@mtornwall), Alex Clemmer (@hausdorff)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhausdorff%2Fturtles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhausdorff%2Fturtles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhausdorff%2Fturtles/lists"}