https://forums.atariage.com/topic/353031-lisp-programming-homebrew-wip/ Jump to content AtariAge Forums * * * Existing user? Sign In Sign In + [ ] + [ ] + [*] Remember me Not recommended on shared computers + Sign In Forgot your password? * Sign Up * Atari 2600 Programming * * * Have You Played Atari Today? 2600|5200|7800|Lynx|Jaguar|Forums|Store # * Forums * Clubs * Apps + Blogs + Gallery + Events + More * All Activity * My Activity Streams + Status Updates * More + Leaderboard + Staff + Online Users + Guidelines + More * Subscriptions * More + More [ ] * ( )Everywhere * (*)This Forum * (*)This Topic * ( )Status Updates * ( )Topics * ( )Blog Entries * ( )Images * ( )Albums * ( )Events * ( )Pages * ( )Products * ( )Markers * ( )Members * All Activity * Home * Atari Systems * Atari 2600 * Atari 2600 Programming * LISP Programming (homebrew WIP) IGNORED LISP Programming (homebrew WIP) --------------------------------------------------------------------- Dave C By Dave C Yesterday at 06:06 AM in Atari 2600 Programming Share * * * * --------------------------------------------------------------------- More sharing options... Followers 2 * Reply to this topic * Start new topic Recommended Posts Dave C Chopper Commander +Dave C Posted yesterday at 06:06 AM Dave C * Dave C Chopper Commander * +AtariAge Subscriber * [team_rank_] * + 97 posts * + Share Posted yesterday at 06:06 AM I've been on a bit of a side quest with this WIP... This is the first public alpha, very interested in feedback. I have tested on Stella and Javatari - there are definitely graphical glitches... This WIP is from an alternate reality. * where a computer language from 1960 * is hastily crammed onto a ROM cartridge in 1977 * so you can learn to write programs of the type you find in the first chapter of a textbook published in 1984. It is not a competitor to Basic Programming but I am definitely trying to think in terms of the feature set and capture the spirit of a "programming game". Some screenshots... lisp_NTSC_5.png.155176ca9224a4b48d0ce1ea2f820ed3.png lisp_NTSC_20230714.png.790fbc7655fa6079bc5cbbbf3b6f3c0d.png lisp_NTSC_2.png.fa34cdecc3c703888cb5f5c413a38f29.png Some concept art courtesy of DALL-E mini because why not... lisp-programming1.thumb.png.f95d25a26b4b3aa87967e329c76bc6c2.png Instructions Probably some explanations are needed. The basics: * The main screen is the REPL (read-eval-print-loop). It is preloaded with an expression (+ 1 2) represented as a boxy array of cells. * Moving the joystick up to EVAL and pressing the fire button will evaluate the expression and you will see the result * Pressing the fire button on the +, 1, or 2 cells lets you change the function and the arguments being applied. * Pressing the fire button on the [?] lets you extend the expression (note (+ 1 2 3) will *ignore* the 3 right now) * Pressing the fire button to select the +, -, *, / ... symbols will start a subexpression + Note when you create a subexpression (or make a list longer than 5 entries) the display will shift to display the containing expression vertically * The 0...9 symbols can be used for small numbers, if you press the # symbol you can input any number up to 999 The fun (as in functional) part: * If you move up to "EVAL" and press right you will cycle through various function definitions that can be called from EVAL... * Functions can be named anything you want! As long as the name is one character long and is either a l,Lamedh, or this funky looking f + I hope you get the picture: there are no strings and there are 3 bytes reserved for pointers to functions. You want more? Source code forthcoming, feel free... * Arguments to functions can be anything you want! As long as the first argument is a, the second is b... * For maximum fun I've loaded a few predefined functions + l: starts as (* a a) - if you EVAL (l 5) you will get 25 + Lamedh: takes one argument (a) and calls the funky f... + funky f: this is the fibonacci function, which is a recursively defined function f(n) = f(n-1) + f(n - 2)... o ... to be specific this is the tail recursive variant - and - if you've read this far and see where we're going - yes this LISP has some super simple tail recursion optimization (otherwise we'd blow up the stack very quickly) Some known issues * since I preloaded a bunch of functions - there actually isn't a lot of room left for editing new programs unless you wipe the predefined functions * The REPL will attempt to stop you from blowing up the heap writing programs but I'm sure there are holes * The EVAL will attempt to detect stack overflow before you overwrite critical RAM, but it's not a flawless check * Really complex expressions can take too long to "parse" for display and that will mess with vblank... * Division function not implemented + thinking about it... * No lambda, cons... + thinking about it... Implementation TLDR: Borrowing from PicoLisp, the only data structure is a 2 byte cell that represents either a pair or a number. Evaluator based heavily on Chez Scheme, and I'm looking at uLisp and Basic Programming for ideas for sample programs and games... lisp_NTSC_20230714.bin lisp_PAL60_20230714.bin * Like 6 * * Quote * Link to comment [https://forums.atari] Share on other sites * * * * --------------------------------------------------------------------- More sharing options... JetSetIlly Stargunner JetSetIlly Posted yesterday at 09:12 AM JetSetIlly * JetSetIlly Stargunner * Members * + 551 posts * https://github.com/JetSetIlly/Gopher2600 * + Share Posted yesterday at 09:12 AM Nice idea! I don't understand how sub-expressions work though. For example, what is the correct form if I want to use the result of "+ 1 2" to multiply by 3? * * Quote * Link to comment [https://forums.atari] Share on other sites * * * * --------------------------------------------------------------------- More sharing options... Dave C Chopper Commander +Dave C Posted yesterday at 03:23 PM Dave C * Dave C Chopper Commander * +AtariAge Subscriber * [team_rank_] * + 97 posts * Author * + Share Posted yesterday at 03:23 PM Thanks for checking it out! 5 hours ago, JetSetIlly said: what is the correct form if I want to use the result of "+ 1 2" to multiply by 3? So the steps to get there look something like this: lisp_NTSC_9.png.361a914c1c977a1f488ba5ddb89be529.png -> lisp_NTSC_10.png.c34280a4a8b61a6906bf436ffb642417.png -> lisp_NTSC_11.png.d8606cd2e88e749144e65709f7d00a3f.png -> lisp_NTSC_12.png.9a8dc18ff2975234e6203a2a06c3b7bd.png -> lisp_NTSC_13.png.a500cf4fc1ee3a614782cea0a7bb4392.png Basically, in prefix notation this would look like (* 3 (+ 1 2)) but the editor has no way to say "insert (* 3 in front of (+ 1 2)" - so instead you have to rewrite everything by changing the + to *, the 1 to a 3, the 2 to + ... at which point the editor starts a subexpression and starts a new line.. and so eventually you can get there. * Like 1 * * Quote * Link to comment [https://forums.atari] Share on other sites * * * * --------------------------------------------------------------------- More sharing options... JetSetIlly Stargunner JetSetIlly Posted yesterday at 03:28 PM JetSetIlly * JetSetIlly Stargunner * Members * + 551 posts * https://github.com/JetSetIlly/Gopher2600 * + Share Posted yesterday at 03:28 PM Thanks. I see what's happening now. * Like 1 * * Quote * Link to comment [https://forums.atari] Share on other sites * * * * --------------------------------------------------------------------- More sharing options... utz Space Invader utz Posted 2 hours ago utz * utz Space Invader * Members * + 18 posts * + Share Posted 2 hours ago This is completely and utterly insane. I love it. Lambda is probably out of question, but I think cons could be done. * * Quote * Link to comment [https://forums.atari] Share on other sites * * * * --------------------------------------------------------------------- More sharing options... Join the conversation You can post now and register later. If you have an account, sign in now to post with your account. Note: Your post will require moderator approval before it will be visible. Guest * [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] Reply to this topic... x Pasted as rich text. Paste as plain text instead Only 75 emoji are allowed. x Your link has been automatically embedded. Display as a link instead x Your previous content has been restored. Clear editor x You cannot paste images directly. Upload or insert images from URL. Loading... x * Desktop * Tablet * Phone * [ ] * Submit Reply Share * * * * --------------------------------------------------------------------- More sharing options... Followers 2 Go to topic listing * Recently Browsing 0 members + No registered users viewing this page. * All Activity * Home * Atari Systems * Atari 2600 * Atari 2600 Programming * LISP Programming (homebrew WIP) * Theme + AtariAge (Default) + Dimension + Deflection (Dark) * Privacy Policy * Contact Us Powered by Invision Community AtariAge * Home * 2600 * 5200 * 7800 * Lynx * Jaguar Forums * Forum Home * Clubs * Blogs * Gallery * Subscriptions Store * Store Home * New Products * Bestsellers * Trade Your Games * Gift Certificates General * Contact * Submit News * Privacy Policy * Legal * Mailing List Follow AtariAge * Facebook Like us on Facebook * Facebook AtariAge Facebook Group * Twitter Follow us on Twitter * Instagram AtariAge on Instagram * YouTube Watch us on YouTube * Discord Chat on Discord Copyright (c)1998-2021 AtariAge x * Existing user? Sign In * Sign Up * Forums * Clubs * Apps + Back + Blogs + Gallery + Events * All Activity * My Activity Streams + Back + Status Updates * More + Back + More + Leaderboard + Staff + Online Users + Guidelines * Subscriptions x * Create New...