A graphics art pattern easily generated in Atari BASIC

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

Firstly, I should say that I have owned an Amstrad CPC and now own an Atari 8 bit, as well as several other types of computer, but have never owned a Spectrum. I think I may have missed out by never owning a Spectrum, but have been trying to do a bit of Sinclair Spectrum BASIC on emulators. Unfortunately, I’ve never learnt how the keyboard works and it’s more difficult to key in the commands without a marked keyboard to remind you where they are. I think I may buy a Spectrum soon to get the full experience.

A recent post called “Can everyone really program?”, which I think is supposed to mean could everyone really learn to program, listed the following three short programs for the Sinclair Spectrum, Amstrad CPC, and Atari 8 bit computers.

Sinclair Spectrum
10 INK 3
20 PLOT 0,175
30 DRAW 50,-50

Amstrad CPC
10 MODE 1
20 INK 1,4
30 PLOT 0,399,1
40 DRAW 100,299

Atari 8-bit
20 SETCOLOR 1,4,12
30 SETCOLOR 2,4,2
40 PLOT 0,0
50 DRAWTO 50,50

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!! Of course, as anyone reading this blog will know, that will require a whole load of PEEKs and POKEs just to open a graphics screen, even before getting on to plotting any points or drawing a line.

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.

1000 POKE 53265,PEEK(53265) AND 239

1010 POKE 53265,PEEK(53265) OR 32

1020 POKE 53272,(PEEK(53272) AND 200) OR 8

1030 FOR I=8192 TO 16191

1040 POKE I,0

1050 NEXT I

1060 FOR I=1024 TO 1023

1070 POKE I,1

1080 NEXT I

1090 POKE 53265,PEEK(53265) OR 16


Of course, I must point out to TMR that a program such as printing a slash character on the text screen, followed by further slashes on each line going down, each one position to the right of the previous character isn’t allowed. Why not try drawing a circle while you’re at it? I look forward to seeing these two programs!

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! This was after I added the line 60 GOTO 60 , because without this line the program would immediately end and return to the default screen GRAPHICS 0. I thought, as explained in the book Inside Atari BASIC by Bill Carris, that it may be because Atari colours are a bit difficult to understand. 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. This could be why the screen looked blank. I later realised that I could get his program working just by inserting the following line 35 COLOR 1 . Perhaps TMR was testing me. Please remember to specify which colour you want to draw with in Atari BASIC before actually plotting or drawing. Some other dialects of BASIC don’t require this, though.

I’ll leave you with a little program I wrote which produced the picture at the top of this post. I’d love to see a version of this in Commodore BASIC V2! I wonder how long it would take TMR to write it?


20 SETCOLOR 1,5,9

30 SETCOLOR 2,10,11

40 FOR X=150 TO 0 STEP -4

50 COLOR 1:PLOT 0,0

60 DRAWTO X,80


80 GOTO 80


I decided to do some studying up on the Commodore 128 with its Commodore BASIC V7. This was Commodore’s SECOND attempt to fix the crappy BASIC V2 that Jack Tramiel had left the company with. Jack Tramiel left Commodore in 1984 and the Commodore 128 was released in 1985. At the time, of the Commodore 128 I was using my Amstrad CPC664, and when I used to see the Commodore 128 in shops I thought to myself “Too little, too late! I’m well out of it!” 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. 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. Anyway, here’s a rough Commodore BASIC 7 equivalent to my Atari 8 bit listing above and not a PEEK or POKE in sight!

Commodore 128 BASIC 7

20 GRAPHIC 3,1:COLOR 0,1:COLOR 4,1
30 FOR X=100 TO 0 STEP -4
40 DRAW 3,0,0 TO X,200
60 FOR T=1 TO 4000:NEXT T

Some changes I had to make in this program compared with the Atari BASIC program were to count a delay loop in line 60, then give the GRAPHIC 0 command to return to the original text screen I’d started on. This is because Commodore didn’t write this BASIC to do this, unlike various other BASICs and I was left several times thinking this program and others similar to it had crashed!

I plan to study some more Atari BASIC, as well as Commodore BASIC 7 and 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.

Posted August 17, 2013 by C64hater in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: