Programs, BASIC, stuff like that

Debunking How to program in various dialects of BASIC

Some recent posts on the blog  have had their own subjects instead of being in direct response to my postings here!

Your correspondent had nothing better to do at the time (well strictly speaking he did, but procrastination comes worryingly naturally) so decided to go back and cover points from previous posts more fully. Right now he’s in the middle of finishing off a game for the Atari 8-bit and some writing work so really shouldn’t be doing this but has to make a phone call anyway so will typeset at the same time.

A recent post called “Can everyone really program?”, which I think is supposed to mean could everyone really learn to program

It was more about how not everyone is actually capable of programming; some people simply don’t have the correct mindset so, even if they learn some BASIC or a similar high level language, they still won’t be able to apply that knowledge in any practical way. The language in the post title is a little mangled because it was posted at stupid o’clock after several hours of “proper” writing, but your correspondent still finds the idea of the author trying to correct someone else’s English amusing. The topic of this post is probably similarly skewed for the reasons discussed above.

Each of these programs selects the colour purple to draw on a graphics screen, then draws a 50 pixel long line from the top left hand corner of the screen down and to the right. Unfortunately, no equivalent program has been listed for the Commodore 64! I demand that TMR writes the equivalent program in Commodore 64 BASIC V2 and posts it ASAP!!

And in doing so the author has embarrassingly demonstrated that he failed to understand what he was reading; to reiterate for the hard of thinking, the point was that, although the three BASIC dialects have the same commands, there is no consistency between them so learning one teaches a would-be programmer nothing useful about programming.

As I originally posted last August, here’s a short program which just opens a C64 graphics screen, but there seems to be a bug in line 1060.

1060 FOR I=1024 TO 1023

Your correspondent can see what’s needed to fix that line (somebody has made a relatively small typo, one character is incorrect) but, since this isn’t an issue with the C64’s BASIC because all BASICs will do the same thing with a mistake like that, it would be better to leave the author to work out what is wrong for himself because he’ll never learn otherwise!

Finally, I must mention that I keyed in TMR’s Atari listing above and found out that it just brought up a blank purple screen!

That’s partly because the listings were there to demonstrate the diversity in command implementation, not to actually be typed in and executed! Your correspondent did indeed forgot to transcribe the COLOR command in the Atari 8-bit listing when moving it from emulator to blog post however, so the listing has been updated with a note added to reflect the author’s part in the process.

There’s some kind of relationship between any colours displayed on screen at the same time which can affect how the other colours will look. I think it’s a bit like the Amiga’s HAM mode, and/or colours being generated by setting hue, saturation, and value, instead of RGB values.

Goodness alone knows where the bit about the Amiga’s HAM mode came from because it’s not like that at all! The reason for the purple background colour is clearly explained in the relevant footnote.

This was because it had a 6502 derivative CPU (the 8502) running at only 2Mhz compared to the Amstrad’s Z80 at 4Mhz, only a 16 colour palette compared to the Amstrad’s 27 colour palette, and it still used 51/4 inch flimsy floppy disks, compared to the Amstrad’s 3 inch disks in their hard cases.

Correcting the misunderstandings and mistakes above in order; the difference between a 2MHz 6502 (which is the maximum speed, it doesn’t always run that fast) variant and a 4MHz Z80 is very close to nonexistent because the Z80 takes more cycles to execute commands, on average about twice as many. As far as colours go, over the two displays (they run simultaneously) it’s actually thirty colours in total. The C128 was designed to either use the 1571 or 1581 disk drive (both of which work with a C64 as well) with the latter taking 3.5” DS/DD disks, exactly the same as used by the Atari ST or Commodore Amiga; the Amstrad CPC’s CF2 disks were far harder to come by, had a lower capacity and cost anywhere up to four times the price.

I didn’t really care about its Z80 CPU running at 4Mhz for CP/M use only, but I don’t remember hearing that it had 16 colours in 640×200 mode.

The Z80 isn’t just for CP/M and can quite happily be used all the time. And yes, the 80 column mode (it’s actually larger than 640×200, that’s just the default size) is sixteen colours, has optional character or bitmap modes, hardware smooth and coarse scrolling and it’s own dedicated block of RAM – really, a C128 is either a C144 or C192 depending on the model.

I hope at some stage in the future to post a listing where two Doctor Who TARDIS shaped sprites collide, then bounce off each other and head in opposite directions. Remember that the Commodore group leader of a computer club I went to said “Oh that would be VERY difficult!”, which was when I totally lost faith in the Commodore 64.

Your correspondent awaits this programmatic delight to see if the author really wanted to make two sprites actually bounce (as in rebound in a fairly realistic way) or just do something simple like make them reverse direction on collision.

This entry was posted in Debunking and tagged , , , . Bookmark the permalink.