Coding Challenge: 3D on Apple II

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

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

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

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

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

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

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

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

    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.

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

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

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

      i mean he did have experience when he was a kid

    • @metalsuccattack
      @metalsuccattack 28 วันที่ผ่านมา

      yeah but its because graphics stuff wasn't available on JavaScript until like 8 years ago with rhe introduction of the canvas element/webgl. now you can even just emulate an apple ii in html/js and do that

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

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

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

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

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

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

      same!

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

      True, ben eater underrated

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

    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

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

    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.

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

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

    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.

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

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

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

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

    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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    How the hell did you manage to record the screen on a Mac II

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

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

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

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

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

      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.

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

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

    Coding Math (th-cam.com/users/codingmath) is another great place for all sorts of things you need to know coding graphics and such.

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

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

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

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

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

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

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

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

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

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

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

    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

  • @Memiotsinegoocelota
    @Memiotsinegoocelota 3 หลายเดือนก่อน +1

    I think you should calculate pi with different ways and formulas on your apple][+

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

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

    I have not programmed on the Apple but I started on computers of the same generation. Eliminated floating point math would be good. Look up tables and fixed point math should give you a speed boost.

  • @rdubb77
    @rdubb77 6 หลายเดือนก่อน +1

    I don’t understand how people can handle coding in BASIC. It’s all spaghetti

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

  • @9ikopb
    @9ikopb 6 หลายเดือนก่อน +1

    Ай-ай-ай-ай-ай... А кто... а кто это сдееелал? (Глядя на превью видео)

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

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

    An optimization you can do in Applesoft Basic is to put subroutines you call often at the beginning of the source code (ie. low line-number). This is because when you do "GOSUB 1000" the Applesoft interpreter does a linear search through program memory for the line 1000. So your code will look something like this:
    10 GOTO 1000
    100 REM IMPORTANT SUBROUTINE
    ...
    1000 REM MAIN PROGRAM

  • @werewolflover8636
    @werewolflover8636 6 หลายเดือนก่อน +1

    I remember doing this exact code on the same computer in elementary school 40 years ago.

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

    I accidentally full screened on the browser version and can’t get past the starting screen because there is no reset key on my keyboard! Please heeeelp

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

    Truly impressive, Daniel! I really hope you'll do something in machine language. I'm doing that on an Amiga myself these days. 😅😅😅

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

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

    I programmed this on an Atari in 89 or 90, based on the book of Encanarcao, the professor in whose laboratory (FhG Darmstadt) I worked as a student.😂

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

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

    @The Coding Train can you write a radar program with the glow shadow of the radar scan line on the apple 2

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

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

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

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

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

    That inline editing mode reminds me of vi. I wonder if they have similar origins.

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

    Why not ASM?

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

    Topic unrelated but do you know anything regarding the 8 prime spirals and algorithm

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

    Apple II Basic is a mix of command terminal and programming language.

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

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

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

    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.

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

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

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

    I love the entire journey!

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

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

  • @sixty502
    @sixty502 6 หลายเดือนก่อน +1

    I would kill for more apple II coding train content!

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

    0:35 from viewers like you, thank you.
    hmmm....

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

    Love this series. You could simplify the shape entry by using data and read instructions and a for next loop to load them in. Then you could change the shape more easily.

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

      Ah yes, this is an excellent point, thank you!

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

    Further proof that the Apple 2 was the best computer ever made

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

    this feels like it was both made today and also 24 years ago

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

    beautiful... again... thank you! :)

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

    bit shifting to get from 32 to 64 might be faster than multiplying by 0 or 1 and adding. altho I bet the previous was for ease of demonstration

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

      How does a programmer bit shift in basic?

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

      @@eugenetswong Numbers are stored as text strings in AppleSoft BASIC, so bit shifting is not possible (unless the numbers were converted to binary, bit shifted, and then converted back, which would completely defeat any speed gain by bit shifting).

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

      @@TheGuyThatEveryoneIgnores Oh, that's too bad. So, the best speed increase comes from just avoiding the calculating, it seems.
      I wonder if there is a way to calculate at a more convenient time, like when we are waiting for something else.

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

    This is amazing. I grew up with what I'm sure was one of the very few Apple ][+ machines in the UK and this has brought back so many memories! I even remember us having that joystick on the shelf behind you.
    I think I'm right in saying the printout on your wall was made with The Print Shop by Broderbund? Hopefully printed on what looks distinctly like an Epson RX80 something or other I can also spot in the corner.
    Really tempted to go and scour eBay to own a setup of my own again...
    By the way, you shouldn't need to power off/on too often. PR#6 (depending on which slot your disk emulator is in) should do the trick to boot from a "disk".

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

      Thanks! Can you explain more what "PR#6" is?
      The banner was made with print shop! However I did it in an emulator and printed on an Epson LX-350. The one pictured is not currently functional.

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

      @@TheCodingTrain So from memory, "PR" is short for print (there's also "IN" for input) and controls I/O to the card slots. A "PR#6" command will instruct the computer to start printing characters intended for the screen buffer to an address mapped to slot 6 in this case. The controller card for the Disk II listens for a printed character and subsequently runs the boot sequence ROM routines.

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

      @@TheCodingTrain "PR#6" will execute the machine code located at memory location $C600, which is stored on a ROM chip on the peripheral card in slot 6. By convention, the floppy disk controller card was placed in slot 6. Thus, "PR#6" will reboot the floppy disk controller card and (re)load the disk operating system from the floppy disk in the drive.

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

    You can compile this using Einstein for Apple II... it gets so much faster, I used Einstein a lot in the 80´s with my Apple II.
    Apple II also can use shapes in basic, where you can create simple images using vectors (since you do not have sprites).
    Another option you will prefer is to use the language GraForth II for Apple II. It´s easy to build much faster 3D graphics with it (it´s a kind of fortran with 3d graphics lib in it.
    Here you can find the demo included in the disk: th-cam.com/video/4Fay38pUU7Y/w-d-xo.html
    You can rotate, translate and scale 3D objects. Also it adds some sound options for you.

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

    To speed up this program a little bit (maybe), you could remove the point with the smallest Z value. It would draw three fewer lines, and it would look like a solid cube instead of a wireframe. The drawback is that the time saved for those three lines might not make up for the extra code involved in figuring out which point to remove in each frame.

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

    And thats why you need math for programming.
    Well done Mr.

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

    This guy helped me through 3 years of programming classes

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

    You might also use an if instead of multiply in your page swapping. Multiplying is not a machine instruction on the 6502 so it's expensive because it's an ADC, DEX loop. IE 1*32 will add 1 to the accumulator 32 times.
    There could also be a difference in execution time for 1 * 32 vs 32 * 1(I'm 99% sure theres no optimizer in apple basic)

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

      Oh, interesting, thank you again for the info!

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

      Great catch

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

      Kelly, I'm still learning. How does a programmer use IF to page swap?

  • @LongGlovv
    @LongGlovv 8 หลายเดือนก่อน +1

    Ургант то, как изменился =D

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

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

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

    Hi Dan! There is a company that sells special hardware to read old Apple II disks using a (modern!?) PC disk drive. I was able to recover 90% of my 35+ y old BASIC programs, that now I run in an Emulator, just for fun! Let me know if you are interested.

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

      Yes!

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

      @@TheCodingTrain Hi Dan. Did you get my reply? TH-cam removed my comment.

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

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

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

    Fun fact: When you use GOTO or GOSUB, Apple ]['s BASIC interpreter does a linear search for the line number, starting at the first line of the program.
    Therefore, a subroutine runs faster if you give it a lower line number.
    Therefore, when designing an Apple ][ program, you ideally want to reserve all the low line numbers for the most frequently-called subroutines, and put the main program at the highest line number.

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

      I did not know this!

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

      @@TheCodingTrain I had no idea either, back when I was still using an Apple ][e. I guess no reference materials I had were talking about it. I found it randomly (some time within the last month!) on a site which was giving a line by line rundown on performance tweaks in some game code.
      Another one I found which blew my mind at the time was that if you store 1 into Z1, then this:
      20 X = X + Z1
      Supposedly runs faster than this:
      20 X = X + 1
      Which if you have a loop which is doing it every iteration, could pay off. (Literals in Applesoft BASIC apparently remain as text until the line is executed, so you pay the cost of parsing it every time it executes.)

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

    Can you do Geometry Dash on an apple ii plus please?

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

    Should have pre-calculated Rcombined = Rx*Ry*Rz where R* are the respective rotation matrices for a small angle and just repeatedly apply that combined rotation matrix to all points, once every frame. So PTS = Rcombined * PTS each frame (obviously you need to use temporaries, you cannot do the matrix calculation in place) That gets rid of a lot of matrix calculation work as well as all the sine and cosine calculation work in the draw loop.

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

    Have no idea if this could work, but what if you calculated and saved all the required points on startup, and the cycled through them during the animation?

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

      Depending on the memory requirements, this could indeed work very well. However, you would be limiting the number of angles from which the object could be viewed, which is alright for an animation, but what if you wanted the program to be interactive? Also, the pre-calculated 2D points could be saved to a file or even hard-coded into the program itself so that the user would not have to wait so long for the program to start.

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

      @@TheGuyThatEveryoneIgnores to be fair, it would require a lot more memory and calculations, but you could elaborate a set number of points and when interacted with, it would only need to check which points' set is closest to the "interaction objective".
      Otherwise, it could also have two modes, one with pre-elaborated points and another with calculations each frame for the interactive mode

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

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

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

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

    Nos anos 80, um amigo fez um programa (basic) que rotacionava objetos, usando seno e cosseno. Os desenhos iam de uma pirâmido ou um quadrado até uma nave espacial. O programa era pequeno. Ele já usava o esquema de desenhar em segundo plano e trocar os planos. Era incrível! E foi feito em um computador brasileiro chamado TK-2000 (meio compatível com Apple II). Ele era um gênio!
    Do seu vídeo, não gosto do excesso de brincadeiras tira a atenção. Ficar tirando o foco da tela, mostrando você ou a tela de lado, também tira a concentração.

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

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

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

    FWIW, you don't have to convert the `CALL` addresses; the negative values work fine as-is. I always used `CALL -151` to get into the machine language monitor; I have to stop and think to turn that into, uh, 65385.

  • @PrisonerOfTheMind
    @PrisonerOfTheMind 10 วันที่ผ่านมา

    See if you can locate the A23D package. It’s a 3D world description structure and rendering for the Apple ][.

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

    Oh man, although this is a modern video, it brings me right back to the 80s when tv shows such as Bits and Bytes (Fr: Octo-Puce) would teach the rudiments of computing and BASIC. They would often use an Apple II. I was looking into getting one way back when, but finally went with a Commodore c64 for the games (and probably the price)

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

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

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

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

    This gave me flashbacks to the Sublogic Flight Simulator graphics when I'd play as a kid on our Franklin Ace 1000. I thought I was so much cooler than those C64 dorks (spoiler: I wasn't).

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

    1983 I am sitting in the Boys Club in Kingsport, TN on an Apple2e, coding a Dungeons & Dragons "choose your path" program. I used to sit in class and write programs for the Apple 2e. I should have stuck with it, might be a billionaire game developer by now lol