Coding Challenge: 3D on Apple II

Take a trip back in time and watch me attempt to build a 3D graphics engine in AppleSoft BASIC on a restored Apple II+ computer! Can I render a spinning cube? Code: thecodingtrain.com/challenges...
🚀 Watch this video ad-free on Nebula nebula.tv/videos/codingtrain-...
🎥 Previous video: • Apple ][ Coding Challe...
🎥 All videos: • Coding Challenges
References:
💾 Big Mess o' Wires: www.bigmessowires.com/floppy-emu/
✨ Nebula: nebula.tv/videos/codingtrain-...
🧠 What is Code?: nebula.tv/what-is-code
🎶 Coding Together: / coding-together
Related Videos:
🎥 Coding Together Track: thecodingtrain.com/tracks/cod...
🎥 Polar Coordinates: • 3.4 Polar Coordinates ...
🎥 3D Rendering with Rotation and Projection: • Coding Challenge #112:...
AppleSoft BASIC:
🐶 Beagle Basic: www.apple-iigs.info/doc/fichie...
🍎 The AppleSoft Tutorial: cini.classiccmp.org/pdf/Apple/...
🍎 Basic Programming Reference Manual: mirrors.apple2.org.za/Apple%2...
🪧 Peeks, Pokes and Pointers: archive.org/details/peeks-pok...
Apple II Emulators:
☕ Applesoft BASIC in JavaScript: www.calormen.com/jsbasic/
🍎 Apple IIjs: www.scullinsteel.com/apple2/
🍎 MicroM8: paleotronic.com/software/micr...
Unedited Raw Footage:
⭐️ Session 1: • Members Live: Recordin...
⭐️ Session 2: • Members Live: Archive ...
⭐️ Session 3: • Member Live: Archive o...
Related Coding Challenges:
🚂 112 3D Rendering with Rotation and Projection: • Coding Challenge #112:...
🚂 173 AppleSoft Basic Snake Game: • What was Coding like 4...
🚂 174 AppleSoft Basic Fractal Tree: • Apple ][ Coding Challe...
Timestamps:
0:00 The future of computer graphics!
0:39 Viewer comments
1:58 Editing code in BASIC
3:28 Floppy Emu disk emulator
5:09 Double buffered animation
6:55 Initialize high resolution graphics for 2 pages
7:42 Animating a line
8:50 CALL to clear the screen
9:22 Switching screens
13:18 The "draw loop"
14:55 Rotate a line
15:45 Add points
16:36 Add a subroutine that draws a line between two points
17:55 Scaling the line
20:55 Matrix Multiplication for Rotation
29:26 Animate rotation
32:00 Clear background
33:17 Subroutine to add the points of a cube
35:40 Subroutine to draw the lines
36:46 Incorporating matrix math.
40:24 Edit code to add more points
41:46 Connect the points to draw a cube
43:03 Beautiful, 3D rotating cube!!
43:17 x-axis rotation
43:52 Ways to optimize the code
44:42 Can you add perspective projection?
45:08 See you next time on Coding Together!
Editing by Mathieu Blanchette
Animations by Jason Heglund
Coding Together Theme by Will from America ( / willfromamerica )
Eye of the Tiger cover by Leon from @neo
Additional music from from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: thecodingtrain.com/discord
💖 Membership: kzread.infojoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#3dgraphics #1980s #appleii #matrixmath #basic

Пікірлер: 721

  • @TheCodingTrain
    @TheCodingTrain Жыл бұрын

    Source code and links to all resources and references! thecodingtrain.com/challenges/175-3D-cube-applesoft-basic

  • @xnick_uy

    @xnick_uy

    Жыл бұрын

    I'm not sure if this can significantly sped up the code, but it is possible to can have static rotation matrices instead of recomputing them for each frame. The modification would be to have the rotation angle at a fixed value and compute its sine and cosine precisely once. You have to store the rotated points at each frame, but you are doing this anyways in order to draw them. You can simply rotated this points instead of the original starting ones. So: - Define ANGLE = 0.1 in line 18, and use the opportunity to compute CS and SN there. - Remove lines 140, 2000 and 2010. - Replace PTS for RXP or RYP in lines 2030 to 2050. I don't really think that's a bottleneck, but a tiny speed boost is a speed boost after all. I imagine that the calls to HPLOT are the slowest thing in the program. Other than that, a performance test should be done to see if the 2D arrays are affecting the performance, because accessing the memory addresses may be taxing for Basic. The simple alternative to avoid the 2D arrays would be to have three separate arrays for the x, y and z coordinates.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    @@xnick_uy Thanks for this feedback!

  • @eugenetswong

    @eugenetswong

    Жыл бұрын

    Mr. Train, thank you so much for this video. I love seeing how you design the features of the code and overcome obstacles.

  • @oresteszoupanos

    @oresteszoupanos

    Жыл бұрын

    Dan, you're a flipping legend, the enthusiasm you bring to each video is BOTTOMLESS!

  • @0011peace

    @0011peace

    Жыл бұрын

    @@TheCodingTrain there ios program for apple called renumber allows you to correct line numbers using & renumber also allows meging two basic programs into one.

  • @ApexSim
    @ApexSim Жыл бұрын

    I don't even code but here I am Professor, right on time.

  • @poof65

    @poof65

    Жыл бұрын

    You should try, it's fun (I say that and this is my job 😁)

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Agreed with poof65! Try these if you like! kzread.info/head/PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

  • @williamdowling7718

    @williamdowling7718

    Жыл бұрын

    @@poof65 same here. There are some frustrating days, but the vast majority of them are a lovely adventure of problem solving and lateral thinking. And the feeling you get when your program finally works and does what you've expected.... No drug could provide that feeling.

  • @DrewWalton

    @DrewWalton

    Жыл бұрын

    Never too late to learn!

  • @ApexSim

    @ApexSim

    Жыл бұрын

    Thanks for the replies motivating me to go deeper into the coding world. I actually did get into coding... only 21 years ago. I ultimately got my degree on 3d rendering and animation but I remember I was in Java courses with the first two semesters being all about how to think in machine code and when it was time to code we were limited to the windows notepad because our teacher believed that coding programs where here only to make future generations too lazy =P

  • @CodingAdventures
    @CodingAdventures Жыл бұрын

    This show is so cool. I like especially the retro-looking artifacts, studio, and happy atmosphere! It transposes you into the 80s when computers just entered personal homes!

  • @theclassyox

    @theclassyox

    Жыл бұрын

    Before that computers were only available in… professional homes? 🤨

  • @whyis2plus2

    @whyis2plus2

    Жыл бұрын

    @@theclassyox A home is professional when you work from home.

  • @zhabiboss
    @zhabiboss Жыл бұрын

    I love this series, you always find ways to create complex projects in Apple basic, while I can’t make them in JavaScript or other easier language. I think you really are a Bob Ross of programming

  • @bennybrouwer

    @bennybrouwer

    Жыл бұрын

    Please please - do not become the Bob Ross of programming. Coding Train is a "must know", and otherwise "programming with Daniel" or so. Ok, thats boring. Suggesting " "programmer's Einstein" is a bit too much I guess??

  • @mrBlagstock
    @mrBlagstock Жыл бұрын

    Daniel is the best teacher any of us could ever had had; thanks to KZread we do have him!!

  • @danielstephenson7558
    @danielstephenson7558 Жыл бұрын

    You, Ben Eater, 3Blue1Brown, Sebastian Lague and Numberphile are my favorite channels at the moment. I struggle to understand some of yhe concepts but more and more is staying in each time I re-watch these videos. Thank you for making them!

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Well, I am so honored to be included on this incredible list!

  • @TheMatto58

    @TheMatto58

    Жыл бұрын

    same!

  • @KopieOG

    @KopieOG

    Жыл бұрын

    True, ben eater underrated

  • @kieran.stafford
    @kieran.stafford Жыл бұрын

    Saturday night in Ireland, cold and rainy. So nothing better than a new vid from the Dan-meister.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Sounds lovely to me, someday I hope to visit the rainy beauty of Ireland!

  • @kieran.stafford

    @kieran.stafford

    Жыл бұрын

    @@TheCodingTrain Dan, you'd be very welcome. If you ever do decide to visit, ping me and I'll hook you up with all the sights, sounds and goodies.

  • @CodingAdventures
    @CodingAdventures Жыл бұрын

    That old BASIC dialect feels a little bit strange nowadays ... but for sure it felt high-tech when we were kids! Those early 8-bit computers provided a very quick and accessible way into coding to people of all ages. Apple II and other micros contained the right recipe for coding: a built in language, a code editor and a decent API for graphics, text and sound. Congrats for making these videos!

  • @pwnmeisterage

    @pwnmeisterage

    Жыл бұрын

    BASIC was a good entry point. But it was slow, clunky, ate half of the available memory. The Apple II also had a decent built-in "monitor" for 6502 assembly code. This was where the full power and performance could be harnessed. It's why all the best 6502 software for decades originally came from programmers who started on Apple II machines.

  • @VincentGroenewold

    @VincentGroenewold

    Жыл бұрын

    Yes, on my C16 that was the first thing you could do immediately and thus peeked my interest. Unfortunately not something kids have anymore, the lack of distraction back then was very nice in a sense.

  • @kasperchristensen8416
    @kasperchristensen8416 Жыл бұрын

    Being a kid from the late 70s who started programming in BASIC on my father's Sharp MZ-700 as an 8-year-old in 1985 I simply LOVE this channel!! Keep up the good work, Mr. Shiffman! Best regards from a fan in Denmark 😉

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Thank you! Visited Copenhagen this past summer, hope to come back again soon!

  • @kasperchristensen8416

    @kasperchristensen8416

    Жыл бұрын

    @@TheCodingTrain Wow, nice! ☺

  • @CallousCoder

    @CallousCoder

    Жыл бұрын

    Perhaps you’ll also like my channel. A lot of retro and low level programming.

  • @kestergreen3844
    @kestergreen3844 Жыл бұрын

    Something I've noticed as someone who's learning to code as an adult learner is how a program lives in your brain whilst writing it. When I watch this I can't get a feel for what's happening and jump to the conclusions you make because I can't image and understand the program. When I write my own code I can imagine my whole program and fully understand it. It's the strangest phenomenon. Thanks for the video. I enjoyed the throwback to writing in basic.

  • @klaxoncow

    @klaxoncow

    Жыл бұрын

    Yeah, people think coding is typing. But, no, code lives in your head. Typing is just how you get the code into the computer. My boss, I'm sure, doesn't understand this and thinks that I'm just slacking off when I go outside for a vape. But, no, I'm totally still working - and my best code is written outside, away from the computer. Because that's when I tend to think laterally and about the whole program's structure, and that's where you nail some amazing optimisations. Your subconscious is a way smarter coder, so give it time to fathom things out and it'll give you your best work. So when I go back in, I type some more and - bang! - it's now ten times faster than it was. The boss thinks it's slacking, failing to understand that, as code lives in your head, then I am, in fact, coding 24 / 7. Yes, even in my sleep, as I've totally woken up with an idea in my head - must have been subconsciously processing it all night long - and then tried it out to great success. Coding is thinking. Typing is just the way you explain your thoughts to the machine.

  • @evilotis01
    @evilotis01 Жыл бұрын

    oh man, when i was a kid, my dad got a Mandelbrot program for our 8086--we left it running all night and all the next day while i was at school, and my mind was pretty blown when i finally got home

  • @JohnGodwin777
    @JohnGodwin777 Жыл бұрын

    Now I remember why I used to write code on paper and where that habit apparently came from since I still hand write code when I’m trying to figure out how to tackle something complicated

  • @peterrealar2.067
    @peterrealar2.067 Жыл бұрын

    Honestly, what I love the most about this channel is the sheer honesty in the process. Dan makes mistakes and also makes happy accidents. It's lovely to see him to create in that fashion. It's only fair to fail to soon find the solution in the end.

  • @hblomqvist
    @hblomqvist Жыл бұрын

    Dan: You should do all the muliply (and divide) using bit shift and addition. Use lookup table for sin and cos. Also, as you said... remove the cls and use clear line function. If possible you could clear screen every vertical blank. You'll need to read that registry. Also I would sort the drawing order so that the line drawing follows the electronic beam in the CRT. just a few suggestions from a retro demo coder.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    More amazing tips!

  • @TakuikaNinja

    @TakuikaNinja

    Жыл бұрын

    The Apple ][ has no interrupt request source. No, not even for vertical blank. Third-party expansion cards had to add them.

  • @dawnadmin8119

    @dawnadmin8119

    Жыл бұрын

    @@TakuikaNinja This is why game programmers “raced the beam” of the CRT by counting how many CPU cycles there were per line and blanking interval.

  • @TakuikaNinja

    @TakuikaNinja

    Жыл бұрын

    @@dawnadmin8119 I know that's what programmers did with the Atari 2600 but at least there was a way to synchronise with the scanlines (wsync, vsync). The Apple ][ doesn't even let you do that, so it seems like a nightmare to code for.

  • @wich1

    @wich1

    Жыл бұрын

    as he is doing the same rotation on each frame there is no point in lookup tables for sin and cos, just pre-calculate a rotation matrix and reuse it every frame

  • @weirdcreature9928
    @weirdcreature9928 Жыл бұрын

    As someone who already grew up with modern computers I love seeing the origins and how people did coding back then. Makes me really grateful for modern IDE's and programming languages + libraries

  • @beauregardslim1914
    @beauregardslim1914 Жыл бұрын

    I, too, wrote a mandelbrot program for my Apple II+ clone in 1987 or so. I ran it overnight and found it had only done about a third of the image, and of course wasn't all that impressive on my amber monochrome monitor. So I hauled the computer down to the family room and plugged it into the TV so I could see colour. It only got about half way through an image before my step-dad insisted I get the computer off of the floor and back to the upstairs office where it belonged. Fun times. As far as 3D animation goes, I remember being fascinated by GraFORTH. It was the second programming language I was exposed to and taught me a lot.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Lots of folks have mentioned GraFORTH, need to check it out!

  • @ChrisPatti
    @ChrisPatti Жыл бұрын

    Such a delight watching you harken back to a simpler time & enjoy coding on your Apple II! Retrocomputing is great fun!

  • @bobweiram6321

    @bobweiram6321

    Жыл бұрын

    LOL! You make the 80s sound like the 1800s.

  • @nionioniosmeg
    @nionioniosmeg Жыл бұрын

    You are incredible, these videos gave me a whole perspective on what my predecessors had to go through and a lot of my older coworkers' habits now make sense to me.

  • @atomicfro
    @atomicfro Жыл бұрын

    I love that he shows us his mistakes as he goes. This is great.

  • @TheSudsy
    @TheSudsy Жыл бұрын

    I wish my Computer studies teachers had your enthusiasm for showing how maths and coding, logic and organisation create wonderment.

  • @CriticalMonkey623
    @CriticalMonkey623 Жыл бұрын

    I adore these videos. I am a second year computer science student, and I'm in the midst of learning C and C* right now. Even though the syntax and functionality between C and Basic are worlds apart, just the barebones breakdown of concepts is so useful for my understanding. I love the style, and I've always loved your energy, so keep up the great content!

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Thank you! this feedback means a lot to me!

  • @nilsmuller-cleve6769
    @nilsmuller-cleve6769 Жыл бұрын

    This series really made me interested in coding on retro computers. As a kid I did not have access to a proper machine and also not speaking english back then made programming really inaccessible. Even though I won't jump into apple II emulation I found that fantasy consoles (in my case pico-8) scratch a similar itch for me. Thanks for being this inspireing!

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    I want to try the pico-8!

  • @nilsmuller-cleve6769

    @nilsmuller-cleve6769

    Жыл бұрын

    @@TheCodingTrain It's a lot of fun! Looking forward to your take on it!

  • @mkiemkie

    @mkiemkie

    Жыл бұрын

    pico-8? never heard of that. just checked - looks like a ton of fun! :)

  • @hrayz
    @hrayz5 ай бұрын

    In 1990, just as I graduated from High School, I set my mind to do exactly this programme. *The biggest differences were an Array to store the points for each line, then an Array of what lines connected to each other. So just a loop in the draw section to draw the right lines. * I did use an Array of the SIN and COS values (the array was multiples of time more efficient!) * In my first iteration, I also skipped the Z-Depth Perspective, but my best friend added that once he saw my code. (He was a great programmer, but I was the Mathematician in the group. He couldn't do 3D Rotation Calculations, but once he had the code he could Optimize and add stuff.) * I did this in BASIC on my CoCo2 TSR-80, almost identical performance as the Apple //e I started on. 21 Points, 23 lines (made a crude Jet Plane). * It got 2 frames every 3 seconds! (My friend typed the nearly exact code into his brand new Amiga 500 using Amiga Basic, it did 150 fps!!)

  • @wyldride
    @wyldride Жыл бұрын

    If you ESC edit a line that you've listed, be careful if it includes any text strings that wrap around to the next line because they'll be indented for clarity in the listing. That means you have to escape over the additional spaces added by the indentation or they'll be added into the string. You can also delete characters by escaping over them or insert characters by escaping back enough characters to type them in.

  • @pwnmeisterage

    @pwnmeisterage

    Жыл бұрын

    POKE 33,33 Takes care of some cursor inconveniences when editing lines in a LIST.

  • @filmamundo9194
    @filmamundo9194 Жыл бұрын

    i remember watching this channel in my childhood and i loved it, but i never expexted it to become a such high quality content

  • @lucasrem

    @lucasrem

    8 ай бұрын

    make graphical games, using ''if/then'' statements....10 If Ship$ = player$ then goto 50... etc

  • @justinnamilee
    @justinnamilee Жыл бұрын

    ~31:30 when you get the rotate without clearing working... I wouldn't even have been mad if you just walked away, it's pretty cool! xD

  • @mads_in_zero
    @mads_in_zero Жыл бұрын

    Hahaha, you listened to the comment last episode about whiteboards being anachronistic future tech. Love the committment to the style, it's like an unusually high quality VHS!

  • @ChokyoDK
    @ChokyoDK Жыл бұрын

    This guy helped me through 3 years of programming classes

  • @TanjoGalbi
    @TanjoGalbi Жыл бұрын

    First optimisation would have to be remove all those multiply by zero for the Z and Y rotations that you left in. Another thing to think about is loops, the fewer the better. If you are looping three times on something to repeat that operation on three elements of the array, type them out in full instead of looping. Sure, the code is longer but it actually speeds it up a little and in BASIC every little helps.

  • @davecarter2508

    @davecarter2508

    Жыл бұрын

    re : 'Another thing to think about is loops, the fewer the better." No do not make the basic interpreter convert 3 times as many lines of code with twice as many numeric literals as before in each as before. Make ALL values variables. The time required by the interpreter to isolate the variable name and fetch its value is far less than the time required for fetch a string literal of a value.

  • @elkeospert9188

    @elkeospert9188

    Жыл бұрын

    @@davecarter2508 "No do not make the basic interpreter convert 3 times as many lines of code with twice as many numeric literals as before in each as before." That is wrong - the BASIC interpreters of that time had to interpretate each line of code every time it was executed: 10 A=A+1 20 A=A+1 30 A=A+1 40 A=A+1 vs 10 FOR N=1 TO 4 20 A=A+1 30 NEXT N Second code is shorter (3 lines instead of 4) but anyway the statement A=A+1 has to be interpreted 4 times and that alone take as much time as the first code. Some extra time is needed to handle the FOR NEXT statements so the first variant is faster.

  • @davecarter2508

    @davecarter2508

    Жыл бұрын

    @@elkeospert9188 Failed to read huh? "Make ALL values variables." Your example uses string literals, I specifically said not to, yet you used examples with them to try and say I was wrong. :(

  • @elkeospert9188

    @elkeospert9188

    Жыл бұрын

    @@davecarter2508 I dont know if Apple II Basic is faster accessing values from variables or from string literals but my point is that avoiding loops by "loop unrolling" makes sense as suggested by Galbi3000. The number of code lines increased but the number of code lines which the interpreter needs to interprete in execution of the code decreases....

  • @davecarter2508

    @davecarter2508

    Жыл бұрын

    @@elkeospert9188 re : "but my point is that avoiding loops by "loop unrolling" makes sense as suggested by Galbi3000." VS "That is wrong - [toward me]" Then if that was your point STICK TO IT, instead of telling me IM WRONG and then admitting YOU DONT KNOW on the subject you just told me I'm wrong on. Which you then didn't show I was wrong on at all, I mean what's the world coming to, you on the left or something? "Make ALL values variables." does not sound anything like "NO USE LOOPS" which is all you countered against. Make ALL values variables take this 10 A=A+1 20 A=A+1 ... 1000 A=A+1 and make it this 5 B=1 10 A=A+B 20 A=A+B ... 1000 A=A+B It will run faster, the interpreter must first isolate if "1" & "B" is a variable name or a letteral, from there it will either look up the binary value or have to convert the letteral to a binary which one is quicker? I KNOW, DO YOU.

  • @ian_b
    @ian_b Жыл бұрын

    I did my Computer Science GCSE in 1983/84 and one of my 3 examination programs was a primitive 3D vector graphics application, written in BASIC on a Research Machines 480Z. I had to work out all the maths myself as there was no internet back then or even books on how to program 3D graphics. I figured out the basic principles of perspective and coordinate systems, though I ended up with this quirky method that had a fixed "vanishing point" beyond the screen in the Z axis. I still feel quite proud of that.

  • @Ro-zn6um
    @Ro-zn6um Жыл бұрын

    I think I almost understand about 10% of the stuff you talk about, but, man! Do I enjoy your enthousiasm! I am glad I stumbled upon your channel and will definately come back to watch.

  • @GutterUnkown
    @GutterUnkown Жыл бұрын

    Dont really code but still find this super fascinating. This video deserves to get way more views, interesting video plus a lot of thought and time put into the editing. 🙏🏽

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Thanks for this kind feedback!

  • @CalculusPhysics
    @CalculusPhysics Жыл бұрын

    The editing of your recent videos has been spectacular!! it feels so professional and dynamic and i think it's a really amazing touch! not to say your old videos aren't good lol, but this definitely adds another spark to make your videos even more engaging than they already were! props to you and your editor!!

  • @_noize
    @_noize Жыл бұрын

    I really enjoy how genuienly excited you are to show us what you‘re doing!

  • @jamescockerham2309
    @jamescockerham230910 ай бұрын

    1:20 - "I remember typing in a Mandlebrot plotting program listing from a copy of Incider magazine..." - Here I was, thinking that was *just me* doing that, while my classmates were eating lunch. This was my gateway drug to CG, years later.

  • @JohnGodwin777
    @JohnGodwin777 Жыл бұрын

    Wow! that line editing trick would have been so handy for me to have known in 1992

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    That's me, providing the cutting edge, newest tips every programmer needs!

  • @K9Megahertz
    @K9Megahertz Жыл бұрын

    Bring back some memories. I started programming on an Apple II when I was in elementary school. Some how managed to break out of the game Oregon Trail while playing it (hit CTRL-C accidentally i guess) and found you could edit the source code. Things just took off from there. Learned BASIC, then moved to C/C++ with some ASM. This was back in the late 80's early 90's

  • @TheGuyThatEveryoneIgnores

    @TheGuyThatEveryoneIgnores

    Жыл бұрын

    I played Oregon Trail on an Apple II+ when I was in grade school and found a bug in it. It did not check for negative values when you bought stuff, so you could enter a negative dollar amount and then get the positive amount added to your money.

  • @Edenwaith17
    @Edenwaith17 Жыл бұрын

    The FloppyEmu is awesome. I used it to help back up some old Mac floppy disks with a Mac SE and then transfer those files to the SD.

  • @magicmulder
    @magicmulder7 ай бұрын

    Apple II was the only computer I ever got to use in school (late 80s). As the others were learning simple programming skills, me and a friend wrote a function plotter.

  • @DavidBauer38
    @DavidBauer38 Жыл бұрын

    Great video, Dan! Loving this Apple II series. The music and 80’s theme are perfect!!!

  • @gilireeves4956
    @gilireeves4956 Жыл бұрын

    This series is so fun and I love all of your videos! You are the best programming teacher on youtube. Also, I love the intro and I listen to it on loop :)

  • @murratosmani6517
    @murratosmani65175 ай бұрын

    Why am I looking that? Because it's real fun. Did this 35yrs ago with an Commodore C64 (man suddenly I'm old). Sometimes took days and how exciting it was to see something working. Even so slow as here (even slower on the C64). Thanks for th great vids!!!

  • @phrebh
    @phrebh Жыл бұрын

    Frogger was one of the few games I had on my IIc. That startup music was a touch of nostalgia.

  • @pavfrang
    @pavfrang Жыл бұрын

    You give immense inspiration and positivity! I like to port your challenges to other languages, such as C#.

  • @constantinelpallas
    @constantinelpallas Жыл бұрын

    What a fantastic video! You have such a magnetic personality, definitely the most excited person I've heard talk about matrix tables! I really like how you show the whole process, including the reasoning. The editing is great as well.

  • @IBJ_yt
    @IBJ_yt Жыл бұрын

    Love this series, have always been into old computers and have always been into rendering

  • @donnierussellii4659
    @donnierussellii4659 Жыл бұрын

    I did something like this on the Gameboy Advance for a tank battle game. It used tables of the trig functions, and "poked" pixels directly to screen memory, then erased the old pixels on the next frame. Double buffering was too slow, or it was some other reason-- I don't recall. I found that making a solid, optimized engine before really starting the game left me with enough processing time for 60 fps gameplay.

  • @seanephram
    @seanephram11 ай бұрын

    dude john whitney and the rest of the pioneers would be so delighted to see this, i have been tinkering in this world since i found out about creative code in general, THANK YOU

  • @CodeWithMario
    @CodeWithMario5 ай бұрын

    I love the warm retro feel to the video 🥰 This is such an awesome demonstration of how accessible programming used to be for anyone with a computer, it’s much more difficult now to know where to begin.

  • @hblomqvist
    @hblomqvist Жыл бұрын

    xy = (x2 + y2 - (x-y)2)/2 can do an 8 × 8 by three lookups in a small squaring table, of just 512 bytes, and a few additional shifts and adds. Also unroll the loops.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Great tip!

  • @vinciith
    @vinciith Жыл бұрын

    Omg! Finally the video I need, I've been looking for this tutorial for 7 years!

  • @icekweebec512
    @icekweebec512 Жыл бұрын

    Such a professional, you wrote the code with errors just to show us the editing function

  • @lop0159
    @lop0159 Жыл бұрын

    I love this series its so cool! Even if i didnt grow up with in the 80s/90s i still think its so cool to learn how you do things on old hardware

  • @AlanFullmer
    @AlanFullmer Жыл бұрын

    wow, this brings back a ton of memories. the printed banner on the wall completes the nostalgia for me.

  • @colonelbarker
    @colonelbarker Жыл бұрын

    I can't tell you how much I'm enjoying this series. I would genuinely enjoy seeing you do it in 6502 and seeing how they run side by side. I do love your other material, but working in such a limited hardware is such an interesting topic. More please! :D

  • @thekeyfox
    @thekeyfox Жыл бұрын

    I'm loving these Apple II+ coding videos! I hope you keep making them!

  • @SpaceByte
    @SpaceByte Жыл бұрын

    this dude would be absolutely amazing in conventional programming tutorial. I don't watch them anymore, but when I was first starting out by watching tutorials, people would just type and I copy, not actually understanding what each line meant (now it feels like common sense, but maybe I was dumb back then). This guy explains such a inefficient and low level language in so much detail and in so much more of a digestible way, than the tutorials I watched ever had,

  • @williamdowling7718
    @williamdowling7718 Жыл бұрын

    Daniel... You are, without a doubt, the most enjoyable KZread personality in history and in perpetuity. You're just absolutely delightful, unbelievably knowledgeable, a phenomenal role model both professionally and in terms of how to carry one's self. Can't wait until my kids are old enough to introduce them to your content. I deeply hope that your excitement and enthusiasm for software inspires them to love it as much as I do. Please never stop what you're doing. This channel and these videos are gifts to the world, and it's not possible for us to show enough appreciation to adequately express our appreciation.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Thank you this kind feedback, it means a lot!

  • @Atomic-Potato
    @Atomic-Potato Жыл бұрын

    I find this series very relaxing

  • @DasHemdchen
    @DasHemdchen Жыл бұрын

    A little short in explaining the Sine, Cosine requirements and matrix multiplication, but I really like the style of the videos, esp. including all the errors we humans make while thinking of something new and complex. It‘s showing the art of creativity, brilliant ideas and finding a way around all obstacles. You‘re very intelligent! And still have enough energy to present everything intelligibly. Thank you, it‘s fun to watch and also inspiring and didactic.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    You might find these 2 videos have the additional explanations you are looking for! kzread.info/dash/bejne/gWmrzLqodtXHpZc.html kzread.info/dash/bejne/omh93JKReryTgc4.html

  • @DasHemdchen

    @DasHemdchen

    Жыл бұрын

    @@TheCodingTrain Much appreciated! Thank you, I‘ll look into it.

  • @steubens7
    @steubens7 Жыл бұрын

    erasing the last one is what a lot of oldschool games did, and usually for just the cost of using the x and y coordinates twice, once preparing and once clearing the frame. even if assembly was fast you're still filling in 99.9% pixels you didn't touch, even a slow line drawing routine can beat that

  • @dionelr
    @dionelr Жыл бұрын

    Thanks for the nostalgia trip. I have so many memories of my older brother and I trying to make little programs on Apple Basic. I remember seeing pokes and calls in other programs but no idea how to use them. Interesting.

  • @54egg
    @54egg Жыл бұрын

    The Apple II was my first real computer, purchased in 1978 when I was 16. I wanted to do computer animation, but it was as you are finding challenging to eek performance out of the 6502. Applesoft for me was useful for creating 8 bit sine lookup tables and that was it. Animation performance in coordinate transforms screams for limited precision and look-up tables. For example coordinate transforms using 8 bit (two's compliment) vertices multiplied by 8 bit sin/cos constant values in a sum of products of 16 bit values then using the most significant byte was a good way to get good performance. Line drawing is a tricky area. I used lookup tables for scanline starting addresses and even byte offsets on line and bit mask calculations. For random point plotting this works fairly well. As I recall WOZ did a good job with calculating move up,down,left,right used with line drawing, but I think I beat the performance just a bit with lookup tables. One thing I never did was optimize 8x8 multiply which is done beautifully in this article www.llx.com/Neil/a2/mult.html. Scroll down to a NEED FOR SPEED. Using 2K lookup and 11 instructions for 8x8 unsigned multiply. Signed multiply takes a bit more effort to check signs / get magnitude / correct result. Unfortunately this method (using a single difference of two table look-ups might not succeed if coded AppleSoft. Ideally performing at least coordinate transforms in asm code might go a long way to speed up graphics. Double buffering is nice. Partial screen clears nice too if you limit area of your graphics. Of course there you get into needing at least base address look-up due to non-linear memory map of Apple II -- and then the need line clipping which is another area of fun.

  • @Warmatx68
    @Warmatx68 Жыл бұрын

    Excellent work, great host, great content and great editing ! Love your energy, keep going

  • @terranceclark3479
    @terranceclark3479 Жыл бұрын

    I love the updates to your setup! Keep these videos coming!

  • @TheCultofshiva
    @TheCultofshiva9 ай бұрын

    Your videos make me wanna go back in time... BASIC was fun to play with. And I understood it much better when I was 10 than I do now. Days I spent typing in lists and troubleshooting them, I still wonder how we got anything to work back then. But it worked, with just a manual, a bunch of magazines and your gray mass. Still love coding, it's amazing

  • @youngun550
    @youngun550 Жыл бұрын

    The amount of expertise, effort and soul that flow from your videos is a wonder to behold. Thank you! 🤩

  • @StaticMusic
    @StaticMusic Жыл бұрын

    I just love these videos. Coding is a big part of my job (aerospace; satellite dynamics engineer) and these are just super entertaining. Thanks!

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Sounds like an amazing gig!

  • @8kBluRay
    @8kBluRay Жыл бұрын

    what an amazing channel, binging all of your videos this past week!

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Welcome aboard!

  • @ArmandKruger
    @ArmandKruger6 ай бұрын

    Dude. I only recently found your channel. It is pure gold and gives my soul so much joy

  • @yuli3873
    @yuli3873 Жыл бұрын

    I love this series! It's beyond awesome! Keep it up

  • @Grzeroli1
    @Grzeroli1 Жыл бұрын

    This series is so cool 😂 My first computer was a 286 so it was plug and play for me. Just start the computer and launch a game 😊 The only coding I had to do back then was creating a boot disk which left 640 kB of „upper memory“ and then I was good to go. I didn’t even know, that you could start coding on a computer directly without loading an operating system. So cool, now I actually want an Apple ][+ replica and try this myself. It looks really easy, when you are doing it. Actually I have to say inserting a line of code directly by typing it with a line number seems pretty convenient , as well 😊

  • @elkeospert9188

    @elkeospert9188

    Жыл бұрын

    "So cool, now I actually want an Apple ][+ replica " Where are a lot of free Apple II emulators available - so you not need by hardware if you just want try that out

  • @Grzeroli1

    @Grzeroli1

    Жыл бұрын

    @@elkeospert9188 yeah, I know. I will try something with the Raspberry 400 when my kids are older. Do you know by chance if there is a BASIC version, that connects to the GPIO pins?

  • @mmille10

    @mmille10

    Жыл бұрын

    Technically, the Apple boots into an OS, but it's in ROM. Basic kind of acts as a primitive UI to it. There is also Apple DOS (as you would guess, called a "disk operating system"), but it's really a disk driver. PCs had a copy of Microsoft Basic on disk. As I remember, it was called "basica". In the late '80s, Microsoft upgraded it to QuickBasic.

  • @darrenball4620
    @darrenball4620 Жыл бұрын

    Perfect timing, I've been meaning to try coding some simple 3d graphics on my Sinclair Spectrum for about 38 years and never really got round to looking at it, till this year! This has been very useful!

  • @csgowoes6319

    @csgowoes6319

    Жыл бұрын

    Lol, 38 years. But same here, pretty much, as a kid in the mid-80s it was my dream to program vector graphics on the C64 because I thought they were so cool (Elite, nuff said), and I even found a book in the library explaining the concepts, but as a 13-year-old, transformation matrices and all that were just way beyond me, never mind how to implement all that in assembly, so I gave up very quickly. One day...

  • @darrenball4620

    @darrenball4620

    Жыл бұрын

    @@csgowoes6319 Same here with the matrix transformation stuff - my brain just said no.... I am now learning z80 assembler (from the books I bought in 1983 and didn't get very far with) - so my goal is to do this in BASIC and then convert to assembler. I just have to try to resist what I did back in the day .... firing up a game instead!

  • @shilpakhadela8856
    @shilpakhadela885611 ай бұрын

    Your computer is so cool, coding on it is really easy for me, cuz in Python, Java, C++, coding has all these really difficult keywords used to run different functions, but in Apple basic, it has simple commands like Run, Goto, Gosub etc. That’s why I love your videos and Apple Basic ❤

  • @ncjunkgoian
    @ncjunkgoian Жыл бұрын

    Takes me back to the 80s, you wonderful man you! I love it.

  • @a-lien
    @a-lien Жыл бұрын

    I don't own an old computer with basic anymore but your enthusiasm is infectious and I'm watching purely for the vibes and interesting facts about the Apple II at this point

  • @suchito_
    @suchito_ Жыл бұрын

    OMG I would love to see some 6502 assembly video made by You. It would be the clearest explanation on this mystic stuff ever created :D

  • @nelbr
    @nelbr Жыл бұрын

    This brings back old memories. Here are some thoughts on increasing performance (excluding reprogramming in assembly language): 1- Use pre-computed sin and cos values as you proposed yourself. 2- Deleting the entire HGR buffer on every frame takes a lot of time. This cannot be done during VSYNC as someone suggested, not even with cycle counting. The filling of the 4K bank with 0 takes almost one second and is probably the largest contributor to the lack of performance. You suggested the solution, which is to redraw the existing lines in black. Just keep 2 arrays and flip among them as you draw each page, so you always have access to the previous points, and alternate the rotate sub-routine to use either one or the other array as input according to the page you are in. 3- You might look at the shape table functionality of Applesoft. These are Applesoft driven but machine language managed drawing routines, including draw, xdraw and rot. 4- Remove those multiplications by zero from the code. 5- You might consider using integer variables for the positions on screen (by using a % on the arrays definition). Integer calculations are much faster than floating point. Or if you are up to a nice challenge, use integer basic instead. It is faster, but the challenge will be the sin/cos multiplication without FP. 6- This is more of a stretch, but if you can find a pair of sin/cos that are very close to multiples of 2, or at least very close to integer amounts, you can use shift operations for multiplication.

  • @flatfingertuning727

    @flatfingertuning727

    Жыл бұрын

    The routine used by HGR to clear the screen is designed for compactness and generality rather than speed, and takes about 6 times as long as an optimized clear-screen function would take. Shape-table routines likewise prioritize compactness and generality over performance. Applesoft's integer variables are slower than floating-point, and the only advantage they offer is that integer arrays are smaller than floating-point arrays.

  • @nelbr

    @nelbr

    Жыл бұрын

    @@flatfingertuning727 Thx for the comments. So maybe integer basic is the option for more speed. And avoiding rewriting the clear screen in assembly or machine language, we are left with drawing the lines in black to clear them quickly (hopefully).

  • @flatfingertuning727

    @flatfingertuning727

    Жыл бұрын

    @@nelbr Using a few pokes to create machine-code routines in memory is really the best way to go, and I don't think it's really "cheating" if the code is simple enough to be generated entirely via individual POKES (as opposed to a READ loop which processes DATA statements generated via other means). As for integer BASIC, it lacks hi-res drawing commands.

  • @nelbr

    @nelbr

    Жыл бұрын

    @@flatfingertuning727 You are right twice. Assembly language is obviously the best approach to write performant graphic routines and if simple enough to be achieved through pokes (maybe from within a read / data loop) then sure. I can't see a faster way of doing it.

  • @flatfingertuning727

    @flatfingertuning727

    Жыл бұрын

    @@nelbr In a different comment, I posted some code which POKEs in a simple but fast machine language routine containing an LDA, LDX, 32 STA (generated via loop), one INX, a BNE, and an RTS. Six different instructions, but six times as fast as the routine in ROM.

  • @bradkuntzelman5343
    @bradkuntzelman5343 Жыл бұрын

    Coding Math (kzread.info) is another great place for all sorts of things you need to know coding graphics and such.

  • @eugenetswong

    @eugenetswong

    Жыл бұрын

    Thank you.

  • @Taigan_HSE
    @Taigan_HSE10 ай бұрын

    Seeing those elephant logos on the front of the floppy disks gave me the biggest feeling of déjà vu.

  • @emo6577
    @emo6577 Жыл бұрын

    I love that you included the step essential to all programmers: claiming that you give up while trying to walk away, only to be drawn back in by a new idea.

  • @GeorgesChannel
    @GeorgesChannel Жыл бұрын

    Great episode and great channel! I love vector graphics on 8 bits :) I dedicated almost all my channel to it. Since BASIC is interpretated, you can compress your BASIC code into as few lines as possible, starting with line number 0, 1, 2, 3, etc and maxing out the line length (max 255 chars) ...so the Interpreter will run the code faster and has fewer codelines jumps... I got amazing speedups with my 3d renderer which i also wrote in BASIC for the commodore Plus/4.

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Oh cool, thank you for this note! Excited to check out your videos!

  • @eugenetswong

    @eugenetswong

    Жыл бұрын

    @@TheCodingTrain Also, for Atari, every GOTO, GOSUB, and loop, causes the computer to start searching for its destination at line 0. Maybe your situation is similar? We should have a line 0, which initializes a few variables, and then must GOTO the farthest set of lines like this. 0 X=1: Y=2: GOTO 32000 Line 10 is the loop that needs the fastest speed.

  • @elkeospert9188

    @elkeospert9188

    Жыл бұрын

    @@eugenetswong Why not jump directly to 32000 and do all the initalization there and then jump back to line 1 where the time critical stuff takes place. But you are right - most BASIC interpreters of that time need more time to jump to a line the more at the end the line was.

  • @eugenetswong

    @eugenetswong

    Жыл бұрын

    @@elkeospert9188 I can't remember my rationale for putting a few things at line 0, but it was probably the idea that we are here anyways. Other than GOTO, wht else can we add to line 0?

  • @elkeospert9188

    @elkeospert9188

    Жыл бұрын

    @@eugenetswong For code statements which are only executed once I think optimization (by putting as much code as possible in a single line) does not make much sense as the difference in runtime is very small but readability is worse.

  • @FryDay444
    @FryDay444 Жыл бұрын

    This is one of my new favorite series on KZread. Please do more!

  • @phlosen7854
    @phlosen7854 Жыл бұрын

    I will never write Code for an Apple II. Still i watched the entire Video and really enjoyed it. You have great Energy!

  • @toor30309
    @toor30309 Жыл бұрын

    I recall doing this exact project in school. How cool to see it done like this Need to find my Apple disk stash.

  • @mohammadaasimuddinraza7846
    @mohammadaasimuddinraza7846 Жыл бұрын

    Man, you deserve more than this! You are the bob ross of coding. Also I want to share one of my projects with you.

  • @conorcatchpole3565
    @conorcatchpole35657 ай бұрын

    I'm new to the channel, and maybe someone has said this before, but this guy is like Casper Darling who is one of the best parts of the game Control (2019)

  • @chris-hayes
    @chris-hayes Жыл бұрын

    Really enjoyed this. The Apple II is before my time, but always found programming with limited constraints to be a fun challenge. Led to me to get into programming for the PICO-8 virtual console.

  • @zachz96
    @zachz96 Жыл бұрын

    I knew about the ESC editing trick. Also I recently bought an Apple IIe from eBay. Th last time I used an Apple II was in either 2002 or 2003 when I was in 5th grade.

  • @Keatosis_Quohotos
    @Keatosis_Quohotos Жыл бұрын

    I'm in love with the production values of this series

  • @ryanjtc
    @ryanjtc Жыл бұрын

    I was just watching a video you made 5 years ago on JS Prototypes and I had to come to a recent video to properly thank you. I've been learning how to code for the last 2 years in college and every single time I'm struggling with a concept I specifically go to your channel and hope that you've made a video about it so that I can hear it from your perspective. -- Learning this stuff can be such a dry process and you make it fun which is beyond a rare skill my friend. At this point if I make it through this program and receive a diploma, I might just replace the schools name with 'The Coding Train'. Thank you, so much.

  • @weamer.
    @weamer. Жыл бұрын

    i love how you limit yourself to only using technology of the time, fun stuff! we don't talk about 25:38 tho....

  • @SoulcatcherLucario
    @SoulcatcherLucario Жыл бұрын

    this is such an amazing video oh my goodness, this really feels like a 1980s show perfectly. as a modern programmer, i love seeing the old high level languages and i am learning them myself!

  • @llaffer
    @llaffer Жыл бұрын

    I recently picked up an Apple ][ machine. I'm glad I found this channel. It will be fun to go through videos to see what can be done with this. I programmed in BASIC in these back in the 80s. I never learned 6052 assembly, but something I do want to learn. I've also picked up that floppy drive emulator he mentioned at the start of the video. I've not yet set it up, but will have fun with it when I do. :)

  • @motbus3
    @motbus3 Жыл бұрын

    Dan still one of most lovely person on KZread. Thank you again for your amazing work! And thanks to the guy who taught Dan to edit lines!

  • @francescocambria2891
    @francescocambria2891 Жыл бұрын

    I just started learning some coding at age 42...just for my curiosity. I ended up to this channel which I find very entertaining, incredibly well done and professionally packed. packed. Great job

  • @usernotfound6407
    @usernotfound6407 Жыл бұрын

    i know your intention of making these videos are probably not to motivate them, but i get motivated when i see your videos. you look so interesting to watch when you re solving a problem that it makes me motivated to go and continue on learning my stuff. thanks please keep it up.

  • @mickehog76
    @mickehog76 Жыл бұрын

    Love it! It's so cool to see you programming on such a modern computer ;).

  • @VideoNOLA
    @VideoNOLA Жыл бұрын

    This brought to mind the Fortran for Apple ][ collection, which included Der Fledermaus demo of a flying bat in 3D.

  • @sunday87
    @sunday87 Жыл бұрын

    You can save some multiplications by merging all three rotations into a single matrix first.