Coding Challenge: 3D on Apple II

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • 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: th-cam.com/users/thecodingtrainjoin
    🛒 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

ความคิดเห็น • 720

  • @TheCodingTrain
    @TheCodingTrain  ปีที่แล้ว +77

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

    • @xnick_uy
      @xnick_uy ปีที่แล้ว +5

      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  ปีที่แล้ว +2

      @@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 ปีที่แล้ว +322

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

    • @poof65
      @poof65 ปีที่แล้ว +40

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

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +40

      Agreed with poof65! Try these if you like! th-cam.com/play/PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA.html

    • @williamdowling7718
      @williamdowling7718 ปีที่แล้ว +17

      @@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 ปีที่แล้ว +2

      Never too late to learn!

    • @ApexSim
      @ApexSim ปีที่แล้ว +2

      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 ปีที่แล้ว +281

    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 ปีที่แล้ว +6

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

    • @whyis2plus2
      @whyis2plus2 ปีที่แล้ว +7

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

  • @mrBlagstock
    @mrBlagstock ปีที่แล้ว +72

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

  • @zhabiboss
    @zhabiboss ปีที่แล้ว +186

    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 ปีที่แล้ว +2

      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??

  • @danielstephenson7558
    @danielstephenson7558 ปีที่แล้ว +155

    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  ปีที่แล้ว +39

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

    • @TheMatto58
      @TheMatto58 ปีที่แล้ว

      same!

    • @KopieOG
      @KopieOG ปีที่แล้ว +1

      True, ben eater underrated

  • @kieran.stafford
    @kieran.stafford ปีที่แล้ว +8

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

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +5

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

    • @kieran.stafford
      @kieran.stafford ปีที่แล้ว +3

      @@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.

  • @kasperchristensen8416
    @kasperchristensen8416 ปีที่แล้ว +48

    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  ปีที่แล้ว +13

      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 ปีที่แล้ว +9

    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 ปีที่แล้ว +4

      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.

  • @CodingAdventures
    @CodingAdventures ปีที่แล้ว +36

    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 ปีที่แล้ว +2

      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 ปีที่แล้ว +3

      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.

  • @nionioniosmeg
    @nionioniosmeg ปีที่แล้ว +10

    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 ปีที่แล้ว +6

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

  • @ChrisPatti
    @ChrisPatti ปีที่แล้ว +19

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

    • @bobweiram6321
      @bobweiram6321 ปีที่แล้ว +1

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

  • @evilotis01
    @evilotis01 ปีที่แล้ว +5

    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

  • @weirdcreature9928
    @weirdcreature9928 ปีที่แล้ว +9

    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

  • @peterrealar2.067
    @peterrealar2.067 ปีที่แล้ว +3

    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.

  • @JohnGodwin777
    @JohnGodwin777 ปีที่แล้ว +4

    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

  • @hblomqvist
    @hblomqvist ปีที่แล้ว +88

    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  ปีที่แล้ว +18

      More amazing tips!

    • @TakuikaNinja
      @TakuikaNinja ปีที่แล้ว +8

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

    • @dawnadmin8119
      @dawnadmin8119 ปีที่แล้ว +6

      @@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 ปีที่แล้ว +5

      @@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 ปีที่แล้ว +8

      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

  • @CriticalMonkey623
    @CriticalMonkey623 ปีที่แล้ว +12

    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  ปีที่แล้ว +3

      Thank you! this feedback means a lot to me!

  • @justinnamilee
    @justinnamilee ปีที่แล้ว +1

    ~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

  • @DavidBauer38
    @DavidBauer38 ปีที่แล้ว +5

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

  • @beauregardslim1914
    @beauregardslim1914 ปีที่แล้ว +1

    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!

  • @TheSudsy
    @TheSudsy ปีที่แล้ว +3

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

  • @CalculusPhysics
    @CalculusPhysics ปีที่แล้ว +4

    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 ปีที่แล้ว +1

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

  • @vinciith
    @vinciith ปีที่แล้ว +5

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

  • @hrayz
    @hrayz 6 หลายเดือนก่อน

    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!!)

  • @gilireeves4956
    @gilireeves4956 ปีที่แล้ว +6

    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 :)

  • @wyldride
    @wyldride ปีที่แล้ว +15

    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.

  • @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.

  • @filmamundo9194
    @filmamundo9194 ปีที่แล้ว +6

    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

  • @Edenwaith17
    @Edenwaith17 ปีที่แล้ว +1

    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.

  • @Atomic-Potato
    @Atomic-Potato ปีที่แล้ว +1

    I find this series very relaxing

  • @constantinelpallas
    @constantinelpallas ปีที่แล้ว +1

    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.

  • @3DSage
    @3DSage ปีที่แล้ว

    I love the entire journey!

  • @thekeyfox
    @thekeyfox ปีที่แล้ว

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

  • @IBJ_yt
    @IBJ_yt ปีที่แล้ว +5

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

  • @nilsmuller-cleve6769
    @nilsmuller-cleve6769 ปีที่แล้ว +4

    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  ปีที่แล้ว +2

      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! :)

  • @GutterUnkown
    @GutterUnkown ปีที่แล้ว +4

    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. 🙏🏽

  • @hblomqvist
    @hblomqvist ปีที่แล้ว +3

    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.

  • @FryDay444
    @FryDay444 ปีที่แล้ว

    This is one of my new favorite series on TH-cam. Please do more!

  • @ArmandKruger
    @ArmandKruger 7 หลายเดือนก่อน

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

  • @Warmatx68
    @Warmatx68 ปีที่แล้ว +17

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

  • @jamescockerham2309
    @jamescockerham2309 11 หลายเดือนก่อน

    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.

  • @terranceclark3479
    @terranceclark3479 ปีที่แล้ว

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

  • @mohammadaasimuddinraza7846
    @mohammadaasimuddinraza7846 ปีที่แล้ว +2

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

  • @pavfrang
    @pavfrang ปีที่แล้ว +1

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

  • @idlefang5014
    @idlefang5014 ปีที่แล้ว +1

    love your channel! my new fav vids to watch well doing coding of my own!

  • @mads_in_zero
    @mads_in_zero ปีที่แล้ว +1

    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!

  • @JohnGodwin777
    @JohnGodwin777 ปีที่แล้ว +3

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

    • @TheCodingTrain
      @TheCodingTrain  ปีที่แล้ว +6

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

  • @lop0159
    @lop0159 ปีที่แล้ว +1

    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

  • @colonelbarker
    @colonelbarker ปีที่แล้ว +1

    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

  • @youngun550
    @youngun550 ปีที่แล้ว

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

  • @TanjoGalbi
    @TanjoGalbi ปีที่แล้ว +14

    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.

  • @ChokyoDK
    @ChokyoDK ปีที่แล้ว +1

    This guy helped me through 3 years of programming classes

  • @ncjunkgoian
    @ncjunkgoian ปีที่แล้ว +1

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

  • @Keatosis_Quohotos
    @Keatosis_Quohotos ปีที่แล้ว

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

  • @williamdowling7718
    @williamdowling7718 ปีที่แล้ว +1

    Daniel... You are, without a doubt, the most enjoyable TH-cam 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  ปีที่แล้ว +2

      Thank you this kind feedback, it means a lot!

  • @yuli3873
    @yuli3873 ปีที่แล้ว

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

  • @weamer.
    @weamer. ปีที่แล้ว +2

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

  • @ian_b
    @ian_b ปีที่แล้ว +1

    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.

  • @CodeWithMario
    @CodeWithMario 6 หลายเดือนก่อน

    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.

  • @seanephram
    @seanephram 11 หลายเดือนก่อน

    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

  • @AlanFullmer
    @AlanFullmer ปีที่แล้ว

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

  • @steubens7
    @steubens7 ปีที่แล้ว +1

    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

  • @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.

  • @annyone3293
    @annyone3293 ปีที่แล้ว +1

    Finally, I’ve waited for so long. Thank you!

  • @pitachu_s
    @pitachu_s ปีที่แล้ว +2

    Cool ! I was waiting for some more apple 2 videos :)

  • @RicoGalassi
    @RicoGalassi ปีที่แล้ว

    Loving this series Dan!!!

  • @donnierussellii4659
    @donnierussellii4659 ปีที่แล้ว +2

    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.

  • @mickehog76
    @mickehog76 ปีที่แล้ว +1

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

  • @phrebh
    @phrebh ปีที่แล้ว

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

  • @K9Megahertz
    @K9Megahertz ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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.

  • @54egg
    @54egg ปีที่แล้ว +1

    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.

  • @motbus3
    @motbus3 ปีที่แล้ว

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

  • @icekweebec512
    @icekweebec512 ปีที่แล้ว

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

  • @stitchfinger7678
    @stitchfinger7678 ปีที่แล้ว

    These videos have been seriously fun

  • @KangJangkrik
    @KangJangkrik ปีที่แล้ว +2

    I love the opening, please keep it 🙏

  • @Linuxdirk
    @Linuxdirk ปีที่แล้ว +1

    I love the oldschool vibes ❤

  • @leereyno
    @leereyno ปีที่แล้ว +6

    When I was a kid, I wrote a program for the Apple II that created a spinning prism type polygon with a user definable number of sides, using double buffering. It could only spin though, it didn't let you rotate the object in any direction. But it was pretty fast.

  • @philippes6636
    @philippes6636 ปีที่แล้ว

    Love ur channel, you inspired me to start computer sience in France! Cant wait for the next vid

  • @magicmulder
    @magicmulder 8 หลายเดือนก่อน

    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.

  • @SoundAuthor
    @SoundAuthor ปีที่แล้ว

    I love this series. Looking forward to many more.

  • @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.

  • @shilpakhadela8856
    @shilpakhadela8856 ปีที่แล้ว +1

    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 ❤

  • @murratosmani6517
    @murratosmani6517 6 หลายเดือนก่อน

    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!!!

  • @Biactyk
    @Biactyk ปีที่แล้ว

    I want more videos in this style ^^ going along with the code as you type it as very fun and the minimal breaks are nice! I tried your other long form content and I just couldn't get into it as much, not saying they're bad! Just the entertainment value here is much higher for me personally :) keep it up!

  • @alexanderst.7993
    @alexanderst.7993 ปีที่แล้ว

    I'm really excited about this one

  • @phlosen7854
    @phlosen7854 ปีที่แล้ว +3

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

  • @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.

  • @toor30309
    @toor30309 ปีที่แล้ว +1

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

  • @haraldaichinger9335
    @haraldaichinger9335 ปีที่แล้ว +1

    Awesome video, want to see more of that Apple ii content❤❤

  • @xTwisteDx
    @xTwisteDx ปีที่แล้ว

    I swear, this guy is the "Mr. Rogers" of programming. Absolutely love your content!

  • @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

  • @richod9635
    @richod9635 ปีที่แล้ว

    You're bringing a tear to my eye. I loved my ][ and ][+

  • @ctbdjc
    @ctbdjc ปีที่แล้ว +2

    your vhs skills is impossibly good

  • @__Spooky__
    @__Spooky__ ปีที่แล้ว +1

    I love these videos so much.

  • @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!

  • @joshuadaley7069
    @joshuadaley7069 ปีที่แล้ว

    Oh I am excited to watch this!

  • @chrisursich
    @chrisursich ปีที่แล้ว

    OH, what a joy to hear that Frogger music again!