NextBASIC sprites tutorial #1: coding "Connect 4" on the ZX Spectrum Next

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 63

  • @stephenelliott7071
    @stephenelliott7071 4 роки тому +5

    Great stuff Darryl, I'm glad to see people making programming tutorials for the Next.

  • @mikedench1110
    @mikedench1110 3 роки тому

    Thanks Darryl! A very good, very clearly explained demo and for once I didn't feel completely out of my depth! Its been decades since I did any Sinclair Basic programming with serious intent and so I was very relieved to be able to follow how these new commands work. At least, so far....

  • @AndyJohns1701
    @AndyJohns1701 4 роки тому +4

    I think i just learned more about spectrum basic than I ever knew growing up! thanks....do more please !! :)

  • @Steve391
    @Steve391 4 роки тому +2

    Great tutorial, easy to follow and very informative. Thanks Darryl!

  • @mmarkowskieditor
    @mmarkowskieditor 4 роки тому +1

    I can not wait until my Spectrum Next arrives and I can try this. I would love to see another video where you can tackle some sound and adding the game play to get this playable. Thanks for uploading this as it's extremely helpful.

  • @txbrumley
    @txbrumley 4 роки тому

    Great video. I’m still waiting on my Next, but I’m enjoying the flashback feeling I get seeing BASIC programming being done old school.

  • @TheShadman47
    @TheShadman47 8 місяців тому

    Excellent and informative video Darryl. I've recently got an N-GO and I've started dabbling with sprites. Now I just have to find the artist in me! 😂

  • @jimbagley6016
    @jimbagley6016 4 роки тому +9

    Great video Darryl, by the way, it's 16K per bank

    • @darrylsloan
      @darrylsloan  4 роки тому +2

      Good to know. Thanks for the correction. :-)

  • @Daeve42
    @Daeve42 4 роки тому

    Thanks Darryl, another really accessible tutorial. I’ll go through this before I continue my z80 assembly adventure (very slow adventure!).

  • @kevin12567
    @kevin12567 4 роки тому

    Cool! I can't wait for my Next to arrive (I pledged in their second Kickstarter) so I can dive into this myself!

  • @inquisitivechimp5408
    @inquisitivechimp5408 4 роки тому +1

    I am useless with computers (partly by choice but mostly by temperament) and a huge technophobe. No patience for it. However, these retro/vintage programming/computer videos remind me of my childhood and fill me with nostalgia. My dad had a Dragon back in the eighties - if you know what that is - and my brother used to spend endless hours on his 286 in the early nineties. Simpler times.

    • @darrylsloan
      @darrylsloan  4 роки тому +2

      I love programming because it tickles the puzzle-solving urge that's in me, and once the gears start turning, there a magical feeling evoking something out of thin air. A teacher at my school donated a Dragon 32 to me a few years ago, and that was my first use of one. Beautiful looking computer, with that professional keyboard, but performance-wise it didn't grab my interest. Maybe it needed to be a part of my childhood, to ignite something. I ended up passing it on to a retro collector.

    • @inquisitivechimp5408
      @inquisitivechimp5408 4 роки тому

      @@darrylsloan :-) Respect! You are the first person I've ever mentioned the word "Dragon" to who knew what it was! I still use a mobile phone (nokia) manufactured in the early 00s (and it still works!). I fear the day it will give up on me and I will have to engage with new tech... My memories of my brother and his friends computing in his bedroom on the weekends, eating loads of pizzas and drinking tons of coke (kids' stomachs will process anything!), and these retro computer videos of yours, make one thing clear to me: as an activity playing around with a computer is a great way to reach a state of "flow", losing your "self" in the activity, in the moment. Total absorbtion. Therapeutic forgetfulness of the life's less pleasurable sides.
      I've always thought I would become less tech-phobic if I read the following book:
      Code: The Hidden Language of Computer Hardware and Software, by Charles Petzold. I've heard it's so good it can convert even lost causes like myself. Ever read it?

    • @darrylsloan
      @darrylsloan  4 роки тому +2

      @@inquisitivechimp5408 It's great to hear someone else who gets it, regarding what you're calling a state of flow. "I" can disappear for hours at a time within the mental labyrinth of a software engineering puzzle, and it's a wonderful feeling involving absence of self, culminating in the gratification of puzzle solving (or occasional hair-pulling)... I'm more familiar with ancient computers than new ones: Oric 1, Memotech, Sam Coupe, etc. Oh, and until recently, my phone was a Samsung flip-phone. Only changed it because it finally gave up the ghost. So I bought a fresh "burner" for a fiver. :-) New tech is addictive for all the wrong reasons.

    • @inquisitivechimp5408
      @inquisitivechimp5408 4 роки тому

      @@darrylsloan That's the good life! You are wise!

  • @TheBroz
    @TheBroz 4 роки тому +1

    This is amazing Darryl, thank you so much. I can't wait to start cocking around with sprites and basic on my Next.

  • @SpectrumNez
    @SpectrumNez 4 роки тому +1

    This is a super video, thanks! I’m going to be following this when my Next arrives! Thanks for all the explaining. It’s nice to see stuff happening live - helps thickos like me understand things easier!
    I’m slightly concerned at the normal use of x and y in NextBASIC. I can understand why they’ve done it, because it makes total sense, but I’ve just spent the last 6 months conditioning my brain to Sinclair BASIC where x is y and y is x!
    Gotta’ go and unravel all that now! 😂

    • @darrylsloan
      @darrylsloan  4 роки тому +1

      It's not so much that x is y and y is x on the old BASIC, but that y is referenced before x in PRINT AT, etc. I think they made the right choices with NextBASIC, by preserving compatibility.

  • @peterjwest
    @peterjwest 4 роки тому

    Great work. I'd like to eventually get more into Z80 but it's impressive to see what can be achieved with NextBASIC. Thanks for a great tutorial :-)

  • @ped7g
    @ped7g 4 роки тому +7

    line 990... most efficient way is `let c=1-c` (or "xor 1" with integer variables I guess, but I have no idea about NextBASIC syntax)

  • @paulklasmann1218
    @paulklasmann1218 Рік тому

    Hi Darryl, your tutorials are wonderful. Do you plan to make any more tutorials? The Spectrum Nexts from the 2nd kickstarter should be getting delivered soon. We'd love to see more from you.

    • @darrylsloan
      @darrylsloan  Рік тому +1

      Many thanks! I haven't coded in NextBASIC in quite a while, but my most comprehensive NextBASIC tutorial is in issues 9, 10 and 11 of "Eight Bit Magazine". See here: ua-cam.com/video/bQVjDNTt_ck/v-deo.html

  • @laser31415
    @laser31415 3 роки тому

    Green border and yellow paper has been my default choice since 1983. TS2068

  • @vectorrepublic
    @vectorrepublic 4 роки тому

    Great first video on the subject Daryl, really clear and well recorded. I'm gonna convert one of my Vectrex games to the Speccy Next and reckon BASIC with the HW sprites should do the job without having to learn Z80. Vectrex games are in 6809.

  • @RobUttley
    @RobUttley 4 роки тому +2

    Great video Darryl, great if it encourages a few more people to delve into the language and make things on their Nexts :-)

  • @RetroSteveUK
    @RetroSteveUK 4 роки тому +1

    Fascinating! :)

  • @stephenlittle7534
    @stephenlittle7534 4 роки тому

    I am surprised I understood a lot if what you were doing. Yes I AM an old speccy guy and QL. THANKS.

  • @lempika
    @lempika 4 роки тому +1

    I've just tried .spredit with my NEXT, and it seems the command .spredit must be directly followed by the filename, without quotes (or else, as it shows on your video, the sprite doesn't load, nor can it be saved !)

  • @MacSociety
    @MacSociety 4 роки тому

    Wow, I have some watching to do for sure!

  • @MacSociety
    @MacSociety 4 роки тому +1

    I am thinking through this as I watch in bits and pieces... so I take it the connect4.spr contains all the SPRITE 0,1,2 and so on... sprites... I am guessing the Sprite Editor puts a # next to each so we know what one to call?

    • @darrylsloan
      @darrylsloan  4 роки тому +1

      There's no numbering in the sprite editor. It's just organised left to right, starting with pattern 0. These aren't actual sprites. It's a little confusing because you can store 64 patterns and there are 64 hardware sprites. You could give these a one-to-one relationship, but you could equally use patterns 0 to 3 to create a 4-frame animation for a single sprite called sprite 0 or sprite 10 or whatever. They wouldn't be 4 actual sprites. In my game, you can see that I'm assigning pattern 2 to sprites 1 to 42 (each slot of the board). The sprite editor simply stores the data for the graphical patterns in blocks of 256 bytes each that sit snugly together in memory. So the command SPRITE 20,160,90,2,1 would activate hardware sprite #20, place it 160 pixel horizontally from the left, 90 pixel vertically from the top, using pattern 2 from the sprite graphics data, and 1 means visible. The actual x,y value corresponds to the top-left pixel of any 16x16 sprite. There are 64 hardware sprites that exist separate from the Spectrum's memory, all defaulting to 0 (invisible) on their 5th parameter. These sprites are never created or destroyed; they're part of the computer's architecture, and they are manipulated by patterns and x,y co-ordinates assigned to them using the SPRITE command. It's a very well designed command, because animating a sprite just involves changing the 4th parameter (the pattern) as you move it around.

  • @gambleboyen
    @gambleboyen 4 роки тому

    Enjoyed that, thanks!

  • @samcoupe4608KB
    @samcoupe4608KB 4 місяці тому

    Is there a command that can grab a sprite from the screen and convert it to a hradware sprite like grab a$ on sam?

  • @MacSociety
    @MacSociety 4 роки тому

    Is Integer Variable using the % sign something new to NextZXOS?

  • @TheBroz
    @TheBroz 4 роки тому

    Hey Darryl, just to let you know you don’t need to use quotes on the .spredit file name. If you do the application will fail to save.

    • @darrylsloan
      @darrylsloan  4 роки тому

      Are you sure it would fail? Quotes are needed if there are any spaces in the filename.

    • @TheBroz
      @TheBroz 4 роки тому

      Darryl Sloan 100% sure, failed for me after 30min of drawing the sprites out :-p Not sure about when there’s spaces in filenames or if .spredit supports them.

  • @Eratosthenes0815
    @Eratosthenes0815 4 роки тому

    NICE... ;-)
    Using "Just The Board" since 2017 I shall introduce the Spectrum Next @ a retro computer meeting in Germany. May I use your tutorial in some kind to show what the ZX Spectrum Next is about?

    • @darrylsloan
      @darrylsloan  4 роки тому +1

      Please do. I would love that.

    • @Eratosthenes0815
      @Eratosthenes0815 4 роки тому

      @@darrylsloan Great! :)
      Is it possible to get the code and the ressorces somewhere? - I'd like to use your sprite ressources but I don't like to type in... :D
      If you are interested in my "updates": I will update the code a bit. (Do you know that Next Basic supports Subs and Functions?)
      If you like you can use my code for your tutorials of course.

  • @FD-ze1xg
    @FD-ze1xg 2 роки тому

    Hello everyone!
    I can't access 512x192 color resolution (layer 1,2) from zxbasic
    Can you guys help me?
    Thank you all!

  • @fackie
    @fackie 4 роки тому

    Nice one Darryl. I think line 980 warrants a bit of a better explanation of what the maths are, and how you've concluded that - in the interest of education 😁

    • @darrylsloan
      @darrylsloan  4 роки тому +1

      Okay, here's my explanation of "p+7*b(p)" in line 980. :-) We'll use the test data of a counter dropping into the middle column and landing at the very bottom. That means p (player's chosen column) is 4 and b(p) is 6 (it's initial value, meaning 6 drop slots available). Or it would have been 6, but you can see that line 970 has already subtracted 1 from it. So it's 5. We know that the board sprites are assigned from top left to bottom right, as you would read the text of a page, starting with sprite number 1. So, counting manually with your finger on the screen, you can calculate that you want to end up with sprite 39 as the answer. Now to get the computer to work it out: Start the calculation with the horizontal. p takes us to sprite 4 (top of the middle column). Now we need to get to the same slot five rows down. We can get one row down by adding 7, two rows down by adding another 7. So, multiples of 7 is the key. And b(p) is 5, the specific mumber of times we want to move forward by seven. So b(p)*7 or 7*b(p) will do it. BODMAS applies, so multiplication is always done before addition, which is what we want, but you could add brackets for clarity, such as p+(7*b(p)), that is: 4+(7*5)=39. That's it. :-)

    • @fackie
      @fackie 4 роки тому

      @@darrylsloan top job mate - that was exactly the ask. Not only that, but you've also covered very important aspects that can sometimes catch inexperienced people out, like BODMAS. Appreciate your contribution to the community and please keep these lovely down to earth videos coming. ;-)

  • @cthutu
    @cthutu 3 роки тому

    These videos need to be in their own playlist. I am trying to create a link to someone who wants to learn, but they playlist shows them interleaved from non-related vides. Would it be possible for you to create that playlist on your channel?

    • @darrylsloan
      @darrylsloan  3 роки тому

      You're right, Matt. Here's a proper playlist: ua-cam.com/play/PLsoYifahFi52cuSXMsNbQ6Uws5ENXjBiY.html

  • @MacSociety
    @MacSociety 4 роки тому

    "Speech Marks"... hahaha. Never heard that before. May have to use that one day in a video and reference you. ;-)

    • @darrylsloan
      @darrylsloan  4 роки тому

      Possibly a local custom. Like "zee". :-)

  • @joezx3446
    @joezx3446 4 роки тому

    2019-01-04 - Core 2.00.24
    Sprites: Completely New Sprite Engine (128 total sprites,
    100 sprites per line, 4bit colour sprites, sprite scaling
    - four sizes: x1,x2,x4,x8 - Anchored sprites -allowing
    relative movement of sprites together)

    • @darrylsloan
      @darrylsloan  4 роки тому

      I think this might be available in machine code only, for the time being.

  • @MacSociety
    @MacSociety 4 роки тому

    I take it this recording was done direct on the Next? What Video Capture device are you using?

    • @darrylsloan
      @darrylsloan  4 роки тому +2

      Hah! I'm old-school. Camcorder pointed at the monitor.

  • @MacSociety
    @MacSociety 4 роки тому

    Are or can you use a mouse with the Sprite Editor?

    • @darrylsloan
      @darrylsloan  4 роки тому +1

      TJ Ferreira Yes, the mouse works for general painting, but the keys are still required to select various options.

  • @SirThreepio
    @SirThreepio 4 роки тому

    What can we do today with this? This resembles SCRATCH environment! Is this for education?

    • @darrylsloan
      @darrylsloan  4 роки тому

      It's not nearly as easy as Scratch (which is a drag-and-drop approach to programming). It's not intended for education, but I personally do think it could be used that way. I'd love to have a few of these computers for the code club at my school.

  • @stevenqneuk8
    @stevenqneuk8 4 роки тому

    Amazing video. Question, saving my .spr file fails every time :( any ideas?

    • @stevenqneuk8
      @stevenqneuk8 4 роки тому

      Sorted it. no need for the speech marks in the file name

    • @darrylsloan
      @darrylsloan  4 роки тому

      @@stevenqneuk8 Strange solution. Quotes are optional (necessary only when using spaces in a filename), but including them shouldn't cause an error. I was thinking you were maybe using the CSpect emulator? I've heard that the sprite editor won't currently save under emulation.

    • @stevenqneuk8
      @stevenqneuk8 4 роки тому +1

      @@darrylsloan I'm using my brand spanking new Next Plus hardware, just got it delivered a couple of days ago. It's awesome