Hires Graphics on the Commodore 64   4 comments

Lemans on C64

“Lemans” C64 graphics without using bitmap


Don’t forget that in the early to mid 1980s “home computer” owners usually had BASIC built in on ROM, couldn’t afford a disk drive, and were stuck with the BASIC on ROM to write software that would run on most other computers of the same model. No compilers were available for systems like that! To turn on the high resolution graphics screen on various computers contemporary to the Commodore 64, using their built in ROM BASIC, you had to use one of the following commands, complete with line number 10 prefix for this example.

Atari 400/800/XL/XE (400/800 released in 1979, XL in 1983, XE in 1985)

10 GRAPHICS 8:REM 320 X 200, 2 colours


10 GRAPHICS 7:REM 160 X 96, 4 colours

Tandy Coco and clones (released in 1980, clones incl. Dragon 32/64)

10 PMODE 3,1:PCLS:SCREEN 1,0:REM 256 X 191, 4 colours

Sinclair Spectrum and clones (released in 1982)

(It seems no command was even required before using the graphics commands, as there was only one display mode)

BBC Micro/Acorn Electron (BBC released in 1982, Electron in 1983)

10 MODE 1:REM 320 X 256, 4 colours

Amstrad CPC 464/664/6128 (464 released in 1984, 664 and 6128 released in 1985)

10 MODE 1:REM 320 X 200, 4 colours

MSX (released in 1983 in Japan, other countries in 1984)

10 SCREEN 2:REM 256 X 192, 16 colours

This was all that was required just to turn on the graphics screen, then it was time to type some other commands, such as PLOT (x,y), DRAWTO (x,y), LINE (x1,y1)-(x2,y2),[mode or colour], or DRAW (x,y). That’s all a budding programmer or computer graphics artist needed to know to get started with graphics on these computers, as well as similar commands on nearly all other computers, but NOT on the Commodore 64!

The Commodore 64 had two graphics display modes available, compared with 9 on the early Ataris (which could be upgraded to 12 or 16 later on), 16 on the later Ataris, 8 on the Tandy Coco, 1 on the Sinclair Spectrum, 3 on the Amstrad CPC, and 2 on MSX (later upgraded to 4 with MSX2). The C64 graphics screens were 320×200 pixels (dots) with 4 colours, and 160×200 with 16 colours. The higher resolution mode suffered from a kind of attribute mode (colour bleed) similar to the Sinclair Spectrum, while the lower resolution mode was limited to 4 colours in any 8×8 block.

The Commodore 64 made its début at the CES in January 1982, but wasn’t available to the general public until August 1982. This meant there was plenty of time to write or commission someone else to write a new version of BASIC for it, but fat chance! Thanks to Commodore founder Jack Tramiel’s miserly, penny pinching ways, they reused more or less the same version of BASIC from 1977! A new BASIC may have cost something like $3 per unit sold, or even as much as $6 or $8! This could have raised the price of the Commodore 64 from $595 to $598, $601, or even $603 or a bit more. Who knows? It certainly never bothered Tandy/Radio Shack, who were frequently upgrading. Of course, Commodore could just have been satisfied with less profit and absorbed the cost of a new BASIC. According to various reports, Atari people at the CES were stunned, saying “You can do all THAT for $595?!” Obviously, some of the savings were made because the Commodore 64 had only 16 colours compared with 128 (increasing to 256) on the Atari, as well as the recycled antique BASIC. I’ve read that at the time, Atari was charging $899 in the USA for an Atari 800, but the Atari 400 was cheaper and computer prices were constantly falling anyway. The Tandy Color Computer had gone on sale in 1980 for about $400, so any claims that Commodore brought computing to people who couldn’t afford an Apple II are ludicrous! Apple II computers were even illegally cloned and available for about half price!

Ultima 2

“Ultima 2”, a style of RPG game which limits itself to the C64 character graphics mode

To open a hires graphics screen on the Commodore required something like the following code in a subroutine, instead of a simple GRAPHICS 8 (or 7), PMODE 3,1:PCLS:SCREEN 1,0 , SCREEN 2, or MODE 1.

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


It seems there’s an error in this listing, in line 1060, but I’ll try to explain. The listing won’t even work, unless you use another 2 POKEs first, which are to move or protect the start of BASIC RAM. The saving of about $3-$10 per Commodore 64 made for Commodore by founder Jack Tramiel caused unbelievable, mind blowing stress to any new computer user trying to program it in the BASIC provided, so that their programs would run on all other Commodore 64 computers. When it comes to the listing above, you have to POKE and PEEK to 2 memory locations connected with or to 2 of the 47 registers of the VIC II video chip, involving some understanding of what setting different bits out of a total of 8 or even 16 (numbers up to 255) bits has on these registers, combined with performing the logic operators AND, as well as OR on one or both of these locations or registers! To turn on graphics screens, change foreground and background colours, use sprites and a few other things, you had to memorise most or all of the RAM locations of the 47 registers, keep referring to a manual for every little detail, or have a list of these in your program! First of all, you turn off or blank out the display, which also used to happen when loading from cassette. This, I assume, is to avoid seeing the screen full of graphics and text garbage. You then point the VIC II chip at a particular section of RAM, which seems to be 8192-16191. Next, you POKE each of these locations with 0, representing the colour black, which turns the whole screen black. After having done this, you turn on the display again, which greets you with a blank, black screen with no points or lines drawn on it. In the above example, the origin seems to be location 8192, while the end or furthest point from this seems to be 16191. Actually using these locations to draw a line between them, is probably quite complicated, though. For a start, those addresses are BYTES, but each pixel is represented by a BIT and can be any of four colours.

Having got as far as the above, you would then want to try and plot points and draw lines on the screen, in one or more of 3 colours, as the fourth colour was used as the background. On non Commodore computers, this involved a grid laid out in what were called Cartesian coordinates. This is a fairly simple system, where X = horizontal coordinates, and Y = vertical coordinates. On all makes of computer, there was a point of origin (X=0, Y=0), which was always on the left hand side of the screen, but some computers had the origin in the top left hand corner, while others had it in the bottom right hand corner. In the case of a screen measuring 320×200 pixels, these would be numbered 0-319 and 0-199. Simple printed grids, matrixes, or matrices were often supplied in user manuals to help users plan their graphics. Of course, another method would be to create a graphics screen using a paint program or graphics editor, but this may or may not take more RAM (8K on the Commodore 64) and be just a static, unchanging screen, instead of animated patterns, or whatever. With Commodore 64 BASIC V2, there were no Cartesian coordinates, just a series of bytes in RAM, which seemed to start in the top left hand corner, then move down one line at a time. I remember phoning a helpline, correcting a listing which said PI to , then the screen turned on and started to clear from the top down. This system meant that plotting any points at all, let alone drawing lines, required lots of complex mathematical calculations. For a start, 320 X 200=64000 pixels. How is this contained in 8K? The answer is that each pixel occupies one BIT, not one BYTE, hence the term “bitmapped graphics”. Of course, the answer wouldn’t really help, but it’s not something that anyone should need to think about! All you need to know is that if the origin is point 0,0 , then to draw a line to the opposite corner of the screen, your end coordinates are the maximum values allowed, meaning 319,199 on an Atari, or 1279,1023 on the BBC/Electron, where the coordinates system was the same for all graphics screen resolutions, which allowed programs to be easily converted from one graphics display mode to another.

BTW, here’s a video by a Commodore 64 fan “showing off” some games he wrote years ago, but all of them use character graphics only!


As for playing sounds or music (the main reason I bought a Commodore 64) this was about as difficult as the graphics, or even more so! But that’s another story!


Posted August 14, 2012 by C64hater in Uncategorized

4 responses to “Hires Graphics on the Commodore 64

Subscribe to comments with RSS.

  1. People rarely get the number of graphics screen modes correct for the Atari, because there were so doggone many options.

    First, there’s what the OS supports (which is how Atari BASIC gets access to the graphics) — Ever since the first Atari 800 the OS supported 12 modes, (Graphics 0 through 11). Though, only 9 were useful with the original CTIA. The other three are for the 3 GTIA graphics modes. That was Atari planning ahead.

    The Antic/CTIA hardware itself are capable of six text modes, and eight graphics modes (14 total). The GTIA chip didn’t actually add a new mode, but added three new alternative color interpretations of existing modes. OS/Atari BASIC graphics modes 9, 10, 11 are just GTIA color interpretation options of Antic mode F (which is Graphics mode 8 in Atari BASIC.) So, in theory that’s 14 Antic graphics modes times four GTIA color interpretations, for 56 graphics modes. Granted, most combinations are not valid. Realistically, the practical number is 14 ANTIC modes in normal GTIA color interpretation plus the three GTIA options of Antic mode F, for a total of 17 modes.

    It is possible to display the same three GTIA color interpretations properly using character mode 2 (which is OS/Atari BASIC graphics mode 0), though it requires a redefined character set and some POKE’ing to plot on the display properly.

    So, depending on how you want to count it there are 17 or 20 discrete and practically usable graphics display modes inherent to the Atari 8-bit hardware without having to resort to machine language tricks.

    Wait a sec, the Atari OS/Atari basic support split screen graphics and text for the OS graphics modes 0 through 8…

    One more sec, overscan width display can be turned on with one POKE, no assembly required. (Though, the OS doesn’t know about the expanded line length, so it throws off the OS/Atari BASIC point plotting/line drawing algorithms.) …

    Another sec, contrary to popular Atari-bashing ads done by Commodore in the 80s the Atari 800 is not limited to 192 scan lines. Vertical overscan is just a matter of redefining the display list… Some POKE’ing involved, but assembly not required.

    And this is just all the stuff that comes free with Antic/GTIA. On any other 8-bit computer the option isn’t possible, or some kind of assembly language service routine must continuously abuse the video hardware to force output that was not intended by the hardware designers.

    And this doesn’t include the myriad of software driven modes possible on the Atari 8-bits.

    • Thanks for your very informative comment! This blog is about the crap BASIC on the Commodore 64 and why the dialects of BASIC on all other computers (except those by Commodore) were better. For this reason, when I listed how many display modes were available on the Atari 8 bit computers, I was only talking about how many display modes could be accessed using the GRAPHICS [number] command. It seems the display modes available using display lists on the Atari, which can even be done in BASIC, are so numerous it’s impossible to list or count them all! Please read the other articles here and feel free to comment. I hope you come back soon!

  2. This:

    “Wait a sec, the Atari OS/Atari basic support split screen graphics and text for the OS graphics modes 0 through 8…”

    Should say:

    “Wait a sec, the Atari OS/Atari basic support split screen graphics and text for the OS graphics modes 1 through 8…”

  3. Another caveat: The reply describes the original Atari 800 OS that supported screen modes 0 to 8 (and GTIA options 9/10/11). The later XL OS added support for OS modes 12 through 15 which then allows BASIC to support nearly all the text and graphics modes inherent to ANTIC. The only ANTIC mode left unsupported is the 8×10 text mode that displayed lowercase descenders.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: