We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Dave's Garage · 107.5K views · 7.1K likes
Analysis Summary
Performed authenticity
The deliberate construction of "realness" — confessional tone, casual filming, strategic vulnerability — designed to lower your guard. When someone appears unpolished and honest, you evaluate their claims less critically. The spontaneity is rehearsed.
Goffman's dramaturgy (1959); Audrezet et al. (2020) on performed authenticity
Worth Noting
Positive elements
- This video provides a highly detailed look at cross-compiling for legacy systems (PDP-11) and the specific constraints of K&R C and 2.11 BSD Unix.
Be Aware
Cautionary elements
- The 'one-prompt' narrative obscures the fact that the AI's success is heavily dependent on the host's ability to provide highly specific technical feedback and environmental context.
Influence Dimensions
How are these scored?About this analysis
Knowing about these techniques makes them visible, not powerless. The ones that work best on you are the ones that match beliefs you already hold.
This analysis is a tool for your own thinking — what you do with it is up to you.
Transcript
Hey, I'm Dave. Welcome to my shop. I've been coding for about 40ome years now. And it all for me began back on the Microsoft 6502 basic interpreter on the Commodore 64. Technically, the first time I coded was on a TRS80 model one level one, but that was also the Microsoft basic interpreter. So, once I got to level two anyway, so it's all very much equivalent. And now my life has come full circle or I'm going to see if it has because I use AI like Codeex a lot to help me write code and it's getting better and better. So, I was curious, could codeex actually crank out an entire Microsoft Basic interpreter, fully functional, with just one prompt? How close could I get with a single prompt to tell it to write basic for me? And once we get the basics of the interpreter running on something like Mac OS and Linux, we'll see if we can get it to work on 211 BSD Unix on my PDP11. Now, the reason I'm doing this little exercise is because I did not have ready access to a basic interpreter on the PDP11. The only one I could find had assembly language. It was written for Unix v7, but I'm on 211 BSD. So I thought, how hard can it be? Let's write one. And so that's how we got here today and we'll try it and see that it actually works if it does on the PDP11. And it all begins with the prompt. So let's try entering the prompt. Create a 211 BSP interpreter for basic. It should accept the source file as the first argument and run it as the script. Your target for functionality is Microsoft CBM Basic version 2 6502 edition equivalency and you should be as close to source code compatible with the Microsoft 6502 basic interpreter as possible. Your code must compile and run on the PDP11 running 211 BSD Unix. That means you are limited to KN&RC version 2. You can use regular function prototypes, but all declarations of variables must be made in the beginning of a scope block and so on. Create a make file to build your application on both Mac OS and on 211BSD on the PDP11. You may need to specify the split ID space in order to get your app to fit or your code to fit. Build and test your code iteratively until it works properly. Your code must also run on Mac OS, but you can use traditional compilation to achieve that where required. Your code must still be 211 BSD compatible as much as possible, but still work on Mac OS or Linux when compiled for it. Your make file should use youame to detect the PDB11 and build for it if detected or the Mac OS Linux build otherwise. Add a new basic command called sleep that accepts a number of ticks to sleep so that the sleep 60 would sleep for 1 second. Note that 211 BSD uses a very different timing mechanism than modern Mac OS. On the PDP11, your minimum sleep time is about 1/30th of a second. Make the code as performance as performant as possible when executing script. Code size is also an issue as it would be nice if the code could fit in non-split ID space and I'll explain more of that later. Use dynamic allocation wherever practical i.e. do not pre-allocate space for the file to be read in. Read it in and allocate the lines dynamically as you go etc. All right, I've got a blank workspace on a blank folder with nothing in it. And I'm going to run my prompt and see what it does. So there's nothing in here. I haven't created a make file other than the folder itself. It's completely empty and it's going to get it as a whole cloth and cut it into pieces or something like that. Now, this is going to take some time. So, I'm going to this time start my stopwatch, reset, start, and try to look at it this time when I'm done, unlike last time when I forgot to look. So, looks like it's got five steps planned out here. It's going to inspect the repo to understand existing files and requirements. Well, that should be easy because there's nothing there. It's going to design the interpreter structure, parsing, execution model, sleep command behavior, and for the PDP11 tick timing, which is going to be complicated because timing on the PDP11 is a little weird. You can't just call you sleep and sleep for a number of microsconds because its timer is all based on the 60 Hz line clock of the power line. So, the minimum that you can wait is 60th of a second. And because you're probably halfway through that window already, on average, about a 30th of a second is probably the minimum that you can wait. Then it's going to implement the interpreter in KN&RC with conditional sections for PDP11 versus Mac OS and Linux. And it's going to use dynamic line storage. It's going to create a make file handling youame detection and split instruction data flags for the PDP11 adjusting for Mac OS and Linux as needed. And then it will build and test locally on MacO Mac OS as a proxy ensuring the basic commands and sleep and iterate on the fixes until it works. I'm going to move myself over here for a moment. Well, this looks like it's going to take some time, so I'm going to put on some tunes. But because of copyright, you can't hear them. So, one moment, please. Zero of five tasks completed so far. All right, it's already started producing code. We can go and have a look at what it's done so far. Holy cow, it's already cranked out thousand lines and it's still thinking. So, here are all the standard includes that it needs. I'm surprised these all work on 211 BSD, but we'll find out if it does when we try to compile it there. And it's got a bunch of defines here for what architecture we're on. And if it's PDP11, then it defines a PDP11 variable. On the Mac, where I'm actually currently running, that will be zero. In a few minutes, hours, days, weeks, whatever it takes. We're going to try it on the actual PDP11 as well. Looks like there's some maximum nesting for go sub and for loops. That's not a bad decision. It's going to keep track of a line of text as the line number, the text itself, and then a link. Obviously, it's a link list to the next line number, which is actually how basic does it too on the 6502. I believe each line is terminated by a pointer to the next line if I'm not mistaken. Got some frame information here for a for loop, some program information, and now we've got all the functions that it's going to write. Let's see what it's going to do. It's going to be able to read files, duplicate strings, trim strings, add lines. So all this stuff is basically to bring the program in line. Now it's going to run the program. It's got to execute statement. It's going to be able to parse an expression, parse a relational, parse a term, factor, primary variable, function, and so on. Now, expect care. Don't know off hand what that's going to do. I guess we'll have to check. Match keyword. I guess that's a quick way to see if a text keyword matches an existing programmatic keyword. And we've got the actual execution of printing input if go to go sub return for an x and sleep. Now what about uh like sign and cosine? Imagine it's doing all those. All right. It's continuing to emit and design code. It's still on step one and it has not completed it yet. So it's step zero complete. But I imagine the later steps may go actually faster than the initial code generation step. But we'll see. All right. It believes it's done. Let's have a look in the console. I'm going to put myself over here couldn't be this simple, could it? Could it really? No such file. I typed it wrong. It'd be simpler if I typed it right. bsdbasic demo.bass survey says hello 123. Oh my goodness, it actually ran and worked. Let's see what demo.bass bass actually does. It's just a for loop. Well, that's not bad. Let's try something else. Let's try coding up a little graphical sine wave and see if it can do trig and so on and tab and some of the more edge cases of basic. I'm going to use nano as an editor and I'm going to say we're going to just call it sign.bass Bass for a = 1 to oh, let's go to 100,000. Step 2. Print tab 40 plus 40 * the sign of a. And we'll print an asterisk at that position. Next A. And that should be it. Did I type everything right? Looks like I did. sign.bass missing line number 10 2030. What's wrong with this? I take the next a off here for some reason unknown function tab. Well, it failed to implement an important function. I will point that out to it and we'll see what it does about it. We'll let that run for a second and see if it can clean up that little problem. All right, it tried it. It evaluated. It did it once and then it fixed something else in there and now it's claiming it's fixed. We'll see. Yes, it's a little fast. So, we'll add a delay. Nano. And this is where the where it really earns its money because I find sleep is hard for it to do. But it works. And now it's running at a reasonable frame rate. So that's not bad. With what did we get? Approximately 10 minutes less than that of codec thinking time. We got a full CBM basic interpreter. This is equivalent to the code that Bill and Paul wrote and took down to MITS in Albuquerque in order to sell their basic. Now, of course, they did not have the benefit of the C compiler and they were writing an 80880 assembly language, but since we have semiodern C, uh I think it's actually still interesting that it was able to compile it and it works on a PDP11. Well, we don't know that it works, I should say. Let's go find out. I am going to configure. Now let's see if I can guess the path there. That should configure it. And now when I go back to my source file and I say save, it should down here connect by FTP. All right. And if we're lucky, what I should be able to do is to sync this code with FTP right onto the PDP11. and then I'll be able to compile it there and run it there natively. To do that, I'm going to sync my folder local to remote. And it's already done. Let's go over to and I'll be back one second here. Let's open up a shell and we're going to tnet into the machine. Actually, let's log in as me. All right. So, we're on 211 BSD Unix on PDP11 systems and we are going to go into source repos PDP source. CDBSD cdbsd basic. Here's our files. I'm going to remove BSDB basic because that one was compiled for the Mac. We don't want that. I'm going to type make. And this is where we're going to have to help the AI along, no doubt, because it's unable to test the PDP11 make file. And it's going to have done things it's not going to work on its first try. So, we're going to feed that back into the AI and get it to fix it. But let's see how far it makes it. Not very far. I'll tell it specifically what error I encountered when running the make file, and it should then revise the make file. All right, it has revised the make file. So, we'll go to the make file and I will save it, which will cause it to automatically be uploaded to the PDP because I have it set to every time I save the file, automatically FTP the entire file over and that will keep that folder up to date as I save things. But I have to remember to save them after the AI has made changes. All right, can't find standard int. That was kind of what I suspected. Okay, we'll sync it up again. This time I'll sync because it's in the main file. We want to change that in the make file at the same time. And we'll try make again. And hey, something worked. There we go. Our next error. Okay, it's made some changes to main. All right, it compiled. Let's try running it. Not sure why this worked on the Mac, but it's not working on the PDP, and I don't know what would be the difference, but we'll let it figure it out. It's sinking a long time on this one. Okay, it's made some changes. We'll sync it up. Make We'll run it. Look at that. It's a little too fast. Now, I'm guessing the delay is not working as expected. So, I'm going to try increasing the delay and see if that works better. Nope. So, we'll let it go and think about how it's implementing its timing on the PDP11. And we'll let it know by telling it what the results are when it makes changes. Okay. And it has made its change. Now, this might be really slow. Wrong architecture. My bad. Build it and we'll run it. There we go. Perfect stuff. So, all in all, not bad. We got it to crank out a basic interpreter with a single prompt that ran out of the box on Mac OS and Linux. And then we had to do a little bit of tweaking and give it some feedback because it was unable to actually do the process in a closed loop where it compiles, tests, evaluates, and then repeats on the PDP11. Maybe I can figure out some way to get it to actually interoperate with the shell by TNetting the VS Code um session into the PDP11 as I've done here and then getting it to interop. the shell that it uses behind the scenes for compiling and so on. I don't know how you change or modify that. So, if you know, let me know in the comments. Uh, thanks for joining me out here in the shop today. If you like this kind of content, let me know. Make sure you subscribe to the channel if you're not already. Please leave a like on the video, and I'll see you next time. Thanks.
Video description
Dave uses OpenAI Codex to create a complete implementation of Microsoft's CBM BASIC v2 for the Commodore 64. Free Sample of my Book on the Spectrum: https://amzn.to/3zBinWM The code: https://github.com/davepl/pdpsrc/tree/main/bsd/basic Black Friday Affiliate Links!! Save on the Slate 7: https://amzn.to/4pJfZ4Q For the Slate AX 1800: https://amzn.to/49hKPt2 Check out ShopTalk, our weekly podcast, every Friday! https://www.youtube.com/@davepl