I need to make this

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
ZXDunny
Manic Miner
Posts: 249
Joined: Tue Nov 14, 2017 3:45 pm

Re: I need to make this

Post by ZXDunny » Thu Jul 18, 2019 1:21 pm

AndyC wrote:
Thu Jul 18, 2019 11:11 am
ZXDunny wrote:
Thu Jul 18, 2019 9:12 am
Yes. You're better off using something like Beepola though, IMO. At least one of the music players can do interrupt-generated music iirc.
Better off by a country mile. It's hard to argue you are not "better off" by avoiding Sinclair BASIC entirely though. :lol:
Given that the text output part can be done in about four or five lines of BASIC, and the music being the most complex part of the problem... Yeah, you're right :)
0 x

Ralf
Dynamite Dan
Posts: 1311
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: I need to make this

Post by Ralf » Thu Jul 18, 2019 1:36 pm

I believe Basic is the best solution for the original poster as he doesn't have much experience with programming.

I could never understand why in beginner's threads like this one people are suggesting advanced solutions which involve assembler etc.
You don't help the poster this way, just make him confused.
1 x

AndyC
Manic Miner
Posts: 251
Joined: Mon Nov 13, 2017 5:12 am

Re: I need to make this

Post by AndyC » Thu Jul 18, 2019 5:35 pm

Ralf wrote:
Thu Jul 18, 2019 1:36 pm
I believe Basic is the best solution for the original poster as he doesn't have much experience with programming.

I could never understand why in beginner's threads like this one people are suggesting advanced solutions which involve assembler etc.
You don't help the poster this way, just make him confused.
I thought it was obvious I was half joking, however there is a point to it. Sinclair BASIC is very limited in it's capabilities, particularly for things like sounds, and even a skilled developer will quickly run into significant stumbling blocks trying to do something like this. There is a point at which you simply have no choice but to at least partly adopt machine code routines or limit your ambitions significantly.

It's probably easier to learn and code the solution to this in assembly than to engineer a purely BASIC solution to it.
0 x

User avatar
ZXDunny
Manic Miner
Posts: 249
Joined: Tue Nov 14, 2017 3:45 pm

Re: I need to make this

Post by ZXDunny » Thu Jul 18, 2019 6:39 pm

I've already told him how to do the text. I've already told him the only way to get acceptable music. The text can be done in BASIC, the music cannot.

What do you suggest in order to achieve his goals in pure BASIC? I'd be interested to know what about Sinclair BASIC that I've missed.
0 x

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: I need to make this

Post by 1bvl109 » Thu Jul 18, 2019 7:19 pm

Ralf wrote:
Thu Jul 18, 2019 1:36 pm
I could never understand why in beginner's threads like this one people are suggesting advanced solutions which involve assembler etc.
You don't help the poster this way, just make him confused.
I think this is purely cultural.
BASIC is a descendent of FORTRAN, a language aimed at mathematicians doing numerical mathematics.
PLOT is aimed at people having a grasp of Cartesian coordinates.
BASIC is for the kids, who are good in math. Especially they had to have math already.
I can explain this

Code: Select all

ld hl,%0100000000000000
ld (hl),%10101010
to a kid who can somewhat read.
I can demonstrate what it does on graph paper and on the Spectrum.
I can explain this

Code: Select all

21,%0100000000000000
36,%10101010
to a kid who can distinguish 0 to 9 and A to F.
I can explain this

Code: Select all

00100001,%0100000000000000
00110110,%10101010
to a kid who can distinguish 0 and 1 and do some basic logical thinking. What about the 00100001? Oh well dear. This is just a kind of word the computer understands. It is like us assigning words to things we do, like "eat", to talk about them.

Now write a BASIC program to plot four points as above and see what concepts you need to introduce to explain them.

There is no IDE for assembler for kids, because we already "know" that this would be to complicated for them.

Next thing we will do is teaching R in kindergarten.

Weizenbaum was right. We're all batshitcrazy. We don't see the obvious.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

User avatar
PeterJ
Site Admin
Posts: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: I need to make this

Post by PeterJ » Thu Jul 18, 2019 7:28 pm

Ii think it would have taken me much longer to get a grasp of Spectrum specific assembler, if I had not learnt BASIC first.

I agree with @Ralf
1 x

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: I need to make this

Post by 1bvl109 » Thu Jul 18, 2019 8:41 pm

PeterJ wrote:
Thu Jul 18, 2019 7:28 pm
Ii think it would have taken me much longer to get a grasp of Spectrum specific assembler, if I had not learnt BASIC first.

But isn't this just a case of knowing any computer language helps to learn any other one?
1 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

User avatar
ZXDunny
Manic Miner
Posts: 249
Joined: Tue Nov 14, 2017 3:45 pm

Re: I need to make this

Post by ZXDunny » Thu Jul 18, 2019 9:55 pm

I'm not sure tbh.

You could explain that a value in binary equates to a value in decimal. You could explain hex. You could explain how a byte is represented on the screen, as 8 dots. You could then spend a while explaining to the child how the screen layout works - the thirds, how each line is 8 pixels below the last (until you cross a third boundary). You could explain that the screen is just a region of memory, that it sits at $4000 but you can't actually POKE $4000, you have to convert to decimal. You would then explain that in order to plot a single point you need to get the correct bit pattern and use logical ops to remove other bits or set the one you want. And then finally explain that they need to go back to the thirds/8 pixel gap and what they need to do to convert a Y coordinate to a row and then figure out which bit to set to add to the byte that contains their desired x coordinate.

Or you could explain that PLOT x,y will do the same job.

Disclaimer: I'm teaching my seven year old son to code; there's no way he'll grasp asm when he is just now figuring out how binary works. BASIC first, then the hard stuff (machine code) much later.
1 x

AndyC
Manic Miner
Posts: 251
Joined: Mon Nov 13, 2017 5:12 am

Re: I need to make this

Post by AndyC » Fri Jul 19, 2019 6:01 am

You can learn BASIC faster than assembly, that is literally the point of it. But Sinclair BASIC is a crap implementation, it's mind bogglingly slow and extremely feature lacking (really only the C64's half-implementation is worse).

You can do a handful of things easily, but once you cross certain lines it works against you and you will have to either resort to some machine code or engineer a massively more complex solution to retain a pure BASIC program. Playing audio alongside display updates is very definitely in that category.
0 x

User avatar
PeterJ
Site Admin
Posts: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: I need to make this

Post by PeterJ » Fri Jul 19, 2019 6:46 am

I agree about the speed issue @AndyC, but I was always impressed with the screen$ and attr functions in Spectrum BASIC, especially for beginner game developers.

I know the likes of MSX had sprites, but with the chip they used you could only tell there had been a collision, but not with what.

I had a C64 for a while and trying to follow those control codes in badly printed magazine listings. Ohh my word!
0 x

Post Reply