Basic Apps take advantage of Turbo modes?

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

SinclairSociety
Posts: 8
Joined: Sat Jan 19, 2019 11:27 pm

Basic Apps take advantage of Turbo modes?

Postby SinclairSociety » Fri Jan 25, 2019 5:48 pm

One of the reasons I hope to buy a Next (2nd kickstarter or extras made... keeping fingers crossed as I would be bummed if I can't buy one) is I want to take a real dive into programming, finally, after being on earth 50 plus years. I dabbled before but want to make a real effort.

One of the things I see in YouTube reviews of games made for Spectrum in basic are too slow and not very good. I mean, were there any good games for Spectrum made in Basic? Name a few if you know of some so I can check them out.

Anyway, made me think, with this new faster Next... will it make things speedy enough to make games in Basic?

Also, can Basic take advantage of the new Sprites?

TJ

Ped7g
Posts: 74
Joined: Mon Jul 16, 2018 7:11 pm

Re: Basic Apps take advantage of Turbo modes?

Postby Ped7g » Fri Jan 25, 2019 6:37 pm

> were there any good games for Spectrum made in Basic?

Good? I think yes (although I can't recall any particular). Fast? No, not in default ZX BASIC.

> will Next make things speedy enough to make games in Basic?

Hmm... depends.. the BASIC itself is still very slow generally, i.e. your game must be super simple in terms of amount of per-frame commands, but you can benefit greatly from some features:
- turbo mode, so the BASIC will be 4x faster than original ZX (you will probably not want to use Layer2 anyway, so no slow downs due to Layer2 visible)
- HW sprites with new BASIC commands for controlling them (still don't expect like move hundreds of them from BASIC)
- integer variables (making whole-number calculations lot more faster than original ZX BASIC having only single 5-byte numeric type including floating-point values)
- HW scroll of screen, DMA, etc... all controllable through BASIC reasonably well (although not as fast as assembly of course, so no truly tricky usage)

Also the classic ZX BASIC was used for some games thanks to the 3rd party "compilers", which turned regular BASIC program into somewhat optimized machine code, that did bring often 10-50x speed boost itself IIRC, and often those compilers come with some library functions to further speed up certain tasks.

The problem is, those compilers are not compatible with the new Next BASIC extensions, so you will have to pick whether you are doing classic ZX or you will fully utilize the Next improvements to salvage some speed back without using compilers.

Overall, after I learned by first hand experience, how slow BASIC is, and how fast assembly must be, if everyone does those cool games in it, I started to learn assembly (or rather machine code, as I didn't have any assembler, so I was poking instructions directly into memory at first)... just to finish my first horizontal screen scrolling, to find out it's running at 2-3 fps even in assembly - teaching me that assembly isn't magically super fast itself, if you don't know how to optimize the code enough... :)

I'm pretty sure Next BASIC will be reasonable as a starting point. At times it will probably feel ridiculously slow, but you have to consider the whole machine is ridiculously slow (by today standards), and to make it "move" seriously needs still some advanced understanding of the machine and good idea how to unlock its potential. If you design some game around that, designed to suit Next BASIC, you can still create reasonably playable thing.

EDIT: but also the Z80 assembly feels reasonably simple to me, like probably after few months with BASIC you may want to take a peek on it. It's sort of missing on the whole experience, if you will not even try. :)


Who is online

Users browsing this forum: No registered users and 2 guests