Archive for November 2019



C128 sprite collision 1

Several months ago, I posted here that I was trying to convert a crappy C64 BASIC V2 listing, which contained lots of PEEK and POKE commands, into the much improved C128 Commodore BASIC V7 language, which as you should know from previous posts, documentation in official Commodore manuals, as well as from books and magazines by third party publishers, includes commands for colour, graphics, and sound, which Commodore 64 owners had been deprived of. C64 BASIC contains only 71 commands, while C128 BASIC contains over 140 commands!

Unfortunately, although I seemed to be making progress, I got some unwanted, or even totally weird, effects in my code. I’ve posted some videos here, showing the development process so you can see what happened. I thought there may have been some more videos I made about this, but I can’t find them, so it seems not, because they should all have been automatically uploaded to my Google account, under Google Photos. In this post I may mention something that I attempted to do after making all these videos. This is because the whole process has totally confused me. I eventually gave up, but then people wanted to know what progress I’d made and a possible solution.

C128 sprite collision 2

After extensive research, I think I’ve found out what the problem is. Unfortunately, it’s a problem with Commodore BASIC V7 itself.

During the period after the C64 was released in 1982 with its 1977 style BASIC, other computer desgners (e.g. MSX, Amstrad) started to release versions of BASIC which included interrupt commands. This means commands that constantly monitor the situation, regardless of which other commands anywhere in your program are being executed at the time. Commodore BASIC V7 also includes interrupt commands. The command MOVSPR number, X, Y is a very powerful, interrupt driven command, which will start a sprite moving even in direct mode, without being contained in a program. The problem is that although Commodore BASIC V7 includes interrupt commands to get sprites moving, the way of dealing with collisions is to redirect control to subroutines with the command COLLISION type, line number. The problem seems to be that although this command is also interrupt driven, it needs to redirect control to a line number, can’t override or turn off the MOVSPR command and whatever commands you may include in your subroutine, even when you use another MOVSPR command, aren’t powerful enough to react against the first MOVSPR command, which just continues happily on its merry way! I have done extensive searches, including reading through books on how to program the C128, but haven’t been able to find a single program listing of how to use COLLiSION in a way that would enable this program to work in the same way as on the C64. One game listing I found just stopped and said something like “You’re dead!” when a collision occurred. I eventually came to the conclusion that this would require another routine written in Assembly Language/Machine Code to set up an interrupt, called with a SYS command, which would be constantly checking the situation, ready to redirect control to another Assembly Language/Machine Code routine in the same code that deals with it!

C128 sprite collision 3

I can’t help wondering what happened with Commodore BASIC V7 to cause this problem. I think it may have been yet another case of rushing to release a computer onto the market before development was finished, even though Jack Tramiel left the company before the earlier Commodore 16 and Commodore Plus/4 were released. Unfortunately, he taught the Commodore staff all they knew about business. The C128 development team might have finished work on the MOVSPR number, X, Y command, then been given a deadline by Commodore to have the BASIC completed in time for a show or in tiime to manufacture the first C128 computers.

C128 sprite collision 4

So that’s it, I’m afraid. I can’t find any solution to this problem! Why not try going over the examples I’ve listed on this site? Can anyone reading this provide a solution?

Posted November 30, 2019 by C64hater in Uncategorized