A bigger scrolling chessboard with Commodore 64 BASIC

Commodore 64 BASIC can be very fun, even if it lacks commands. In this article I explained my way of creating a scrolling chessboard with BASIC 2.0. Now, I am going to show you an updated version of this program that scrolls a bigger chessboard, made up of 4 x 4 characters squares. It may seem intimidating, and you may think I am cheating. Actually, it’s still a realtime scrolling with no ML aid. And, the code is more or less the same for the 1 x 1 characters chessboard. You only have to set up things in a slightly different way, but the concept is the same. And, again, two pokes on each frame are enough to perform the scroll.

You can download the program here.

chessboard4_4
The program in action. This simple BASIC program performs smooth scrolling of a 4 x 4 characters chessboard.

 

To stop the program, use RUN/STOP and RESTORE.

The explanation for this program adds only a few things on what has been explained on this article.

For a 1 x 1 characters square chessboard, 2 programmable characters are required. This time, as it is a 4 x 4 characters chessboard that it is being scrolled, we need a total of 8 programmable characters. Notice that 16 characters are not required, as each 1 x 4 characters vertical stripe of a square just looks like the other stripes.

On the 1 x 1 chessboard, at the beginning we had to modify the first byte of the first character, and the first byte of the second  character. This time, we have to change the first byte of the first character, and the first byte of the fifth character. And, before we swap the values to be poked in the characters RAM, this time we have to wait until character 4 for one color, and character 8 for the other color, are reached. Then, the values to poke in the character RAM are swapped and the process can start again.

So, in line 13, now the limit for the variable Y is 31, and no longer 7. We now have to scroll by 4 characters, as the chessboard is 4 x 4.

This little program shows that even with a very simple BASIC the Commodore 64 can do nice things. Additional commands for graphics would have been nearly useless to code such a program. Plotting lines on a bitmapped screen with an expanded BASIC simply is not fast enough to achieve these results. Again, this program just makes the illusion of moving many dots, but still, it does take advantage of the way the VIC-II chip works, charging it of most of the work.

And, it doesn’t use scroll registers. So, you are free to expand the program by adding static elements, like a characters made logo for example. No screen split is needed for that. The chessboard will scroll, but any other information you write on the screen will be stationary.

With little program changes, it is possible to scroll a chessboard with squares of different sizes. So, it is flexible.

I have tested this program on a real Commodore 64 with a CRT TV set and the movement is smooth. Much better than what you can see by using an emulator and on a LCD monitor.

 

Precedente Commodore 64 fix: RESTORE key and power switch Successivo The Atari 7800, an underrated gaming system?

2 thoughts on “A bigger scrolling chessboard with Commodore 64 BASIC

  1. Howdy! This is my 1st comment here so I just wanted to give a quick shout out and say I
    truly enjoy reading your articles. Can you suggest any other blogs/websites/forums
    that cover the same subjects? Thanks!

    • retro64 il said:

      Hello, many thanks! There are many resources for C64 coding on the web.
      This site (http://www.bombjack.org/commodore/books.htm) has an amazing number of books available. The books published by Compute! are really nice. On the site archive.org you can find all the issues of Compute! magazine.
      The site http://codebase64.org/doku.php also contains useful information. Also aayc64 by ninja/the dreams is an excellent reference for the C64.
      Programming the Commodore 64 by Raeto West, Mapping the Commodore 64 by Sheldon Leemon, Machine Language for the Commodore 64 and other Commodore Computers by Jim Butterfield… those are masterpieces. Articles by Jim Butterfield are very clear and you can find them on the web (he was a freelance writer, as well as a world-acclaimed computer guru and his articles appeared on many magazines).
      I also find the information on 6502.org awesome.

Lascia un commento

*