Archive for December 2013



C64MSXBASICThe possible version of BASIC which unsuspecting C64 buyers were deprived of by Jack Tramiel

As you read in a recent article, I’ve decided to look into and attempt to put together an implementation of “Microsoft Extended BASIC” which will run on the Commodore 64 platform, including emulators and the C128 in C64 mode.

I think that this kind of BASIC is exactly what was desperately needed on the Commodore 64, but wasn’t provided, due to Jack Tramiel’s miserly, penny pinching ways. Some other solutions, including Applesoft BASIC, are available on the web page (which even has a link to this blog!). Applesoft BASIC for the C64 provides some extra commands as used on the Apple ][, but I don’t know if it’s a full implementation. The extra commands don’t even start with an unusual character, though. Even the Commodore BASIC abbreviated commands with a shifted 2nd or 3rd character still work. It took me back to the half forgotten hours I spent hanging round the Apple ][ computers at the computer club and the several minutes or even half an hour I spent programming them. Unfortunately, none of these BASICs are the well known, widely documented “Microsoft Extended BASIC”, as featured in various magazine listings and books for different makes and models of computer. Tell me how many magazine articles or third party books were ever written about Simons’ BASIC or Laser BASIC. Hardly any!

Lots of magazines and ads referred to “Microsoft Extended BASIC”, but it seems that computer manufacturers and Microsoft themselves didn’t like to call it that. What I mean when referring to “Microsoft Extended BASIC” is something like Tandy Color Extended BASIC or Tandy BASIC Level 2 or 3, Dragon BASIC, GW BASIC on PCs, Atari Microsoft BASIC, or MSX BASIC. If this kind of BASIC was implemented on the Commodore 64, then it would be as easy to program as those computers and there are lots of programs you could have the fun of typing in or converting and porting from other computers! The conversion may involve saving them as ASCII text, then loading or merging them onto the Commodore 64 platform running “Microsoft Extended BASIC”.

I’ve decided to make a start by at least making plans for how to create an implementation of “Microsoft Extended BASIC” for the Commodore 64. This would obviously require making various flowcharts showing how it’s supposed to work. What’s involved is that a computer is constantly scanning its keyboard to detect when a key has been pressed, as well as if any numbers are typed at the beginning of a line. If numbers are detected at the beginning of a line, then the computer knows this is a program line to be stored in RAM, but if the line doesn’t start with a number, then the computer tries to carry out an instruction immediately. Either way, the computer must first look through its list of BASIC commands to see if what has been typed is one of its commands. If the text isn’t in the list, or if it is in the list, but something is wrong with the format of the command, then it responds with “Syntax Error”. If the command RUN is typed, then the computer looks for a program held in RAM, then tries to run it. BASIC commands are stored as tokens, each of which is a one byte number. Unfortunately, Commodore BASIC V2 starts its list of tokens at 128, wasting half of the possible available entries for commands. I recently read a claim that it had 75 commands instead of 71 or 72. This system seems to limit the number of extended tokenised commands to a maximum of 52, 55, or 56. Another system, which was used a lot of the time was to extend BASIC by using a wedge which required each command to start with an unusual character, such as the @ symbol. This system doesn’t have a limit of about 52 extended commands.

Looking at the various implementations of “Microsoft Extended BASIC” it seems that it must take 16K, compared with the crappy Commodore BASIC V2 8K. I know that Atari BASIC is only 8K, although this is because it’s not Microsoft BASIC, but a specially programmed BASIC designed to fit on an 8K ROM with commands for colour, graphics, and sound. I think that I need to make a list of commands in “Microsoft Extended BASIC” which aren’t in Commodore BASIC V2, but which are in the implementations I’ve mentioned above. These commands should include CLS, SCREEN [number], LINE (x1,y1)-(x2,y2), PSET (x,y), PRESET (x,y), DRAW “[string]”, PLAY “[string]”, PRINT @ [position], INKEY$, KEY [number],[string], CIRCLE, LOCATE [x,y], and possibly a few others. There’s a web site listing the source code for various early versions of Microsoft BASIC, with some instructions on what to do with it, but these are very early versions, without commands for colour, graphics, or sound. I’ve also got an ATR Atari disk image file which contains Atari Microsoft BASIC, so I may be able to load that into the Atari Assembler/Editor and examine the source code. The main things to look out for would be any memory locations or ROM calls which are different on the Commodore 64. I think these would all be JSR instructions, but that not all the JSR instructions would be calls to the Atari ROM. I could refer to the book “Mapping The Atari” to find out which calls are actually to the Atari ROM. I don’t think I’d have to understand all the source code. At least that’s what I hope, anyway.

Of course, various activities described above would probably infringe Microsoft Copyright and/or intellectual property rights, but I’m not doing this to make money, so I suggest that this software will be shareware and if you use it, then you should send some money to Microsoft. This may have been as little as $5, but nowadays $10 or more. This is what that miser Jack Tramiel should have done all those years ago, instead of pushing me to the verge of a nervous breakdown. I don’t think that “Microsoft Extended BASIC” is being marketed anymore, especially as Microsoft have developed what they call “Visual BASIC”, but to me that’s not BASIC at all! It includes a few BASIC commands, but has a C type syntax. BASIC is a language created in 1964 by Kemeny and Kurtz. It can be extended, but not completely rewritten. Perhaps this project will remind Microsoft and other people about real BASIC!

I could also be accused of plagiarism, meaning copying code by people apart from Microsoft. Unfortunately, although there’s more than one way to write any routine in 6502 Assembly Language, I think there are only a limited number of ways to write anything, so it’s obvious that someone has already coded it. This reminds me of an episode of the classic sitcom “Newhart” which I originally saw at about the same time I owned a Commodore 64 . It could be deleted soon, then another copy uploaded, but it says the episode title is No. 53 “Happy Trails To You”, which I think should actually read “Happy Trials To You”.

There will be a startup screen telling users that it’s “Microsoft Extended BASIC” and I think there should be a Copyright notice dated 1982 or 1983. This is because it would be based on code from about that time. I also live in hope that someone will discover the secret of time travel, then go back to 1982 or 1983, drop off some copies on cassette and 5.25 inch/13.34cm disks, complete with the startup screen telling people to send $5 or $10 to Microsoft like that penny pinching, miserly, money worshipping git Jack Tramiel should have done, then this could have a serious effect on the crappy Commodore 64 BASIC V2. I believe anything’s possible! Unless people believe this, then it holds them back. People once thought that the Earth was flat, then later on that if they travelled in trains at speeds of 20mph/32kph then they’d suffocate. Steam engine inventor George Stephenson and computer inventor developer Charles Babbage were dismissed as lunatics. This is where we get the expression “a right Charlie”. I may have told you this before.

I think the best way for me to start on this project is to develop each command as a separate routine, then make them into yet another extended BASIC for the Commodore 64. This means that each command may have to start with a symbol not normally used in Commodore 64 BASIC V2 (i.e. the @ or ! symbols) as used by some other extended BASICs. After this had been done, I could work on turning it into a full implementation of “Microsoft Extended BASIC” which doesn’t depend on copying Commodore BASIC V2 into RAM. It will involve turning off the BASIC V2 ROM, freeing 8K of RAM, but the 16K interpreter loaded into RAM, would leave the C64 with only about 30K of RAM. In spite of this, it would obviously be a lot easier to program than a Commodore 64 with Commodore BASIC V2, and a lot more like a Tandy, Dragon, Spectravideo 328, or MSX computer, so losing 8K wouldn’t really matter. MSX BASIC and Amstrad’s Locomotive BASIC both have commands for interrupts and MSX BASIC even has sprite commands including interrupts, but these weren’t included in earlier Microsoft BASICs, such as Tandy or Dragon.

Probably the most simple missing command is CLS, which isn’t in Atari BASIC either, but Atari BASIC came out in 1979, and was ahead of its time anyway. The most simple way to program CLS in 6502 Assembler on a text screen is by the following code, where $93 is CHR$(147) and $FFD2 prints out the character whose code is held in the Accumulator.

LDA #$93

Of course, this wouldn’t work in the two graphics display modes. These are usually located at 8192-16383/$2000-$3FFF and are 8K in size, but this may be just a limitation of the crappy Commodore BASIC V2. Other possible locations are 16384-32767/$4000-$7FFF, 32768-36863/$8000-$8FFF, 40960-49151/$A000-$BFFF, and 49152-65535/$C000-$FFFF. Notice the logical intervals of those hexadecimal numbers, as mentioned in the classic Doctor Who story “Logopolis”. Much easier to remember than their decimal equivalents! In the case of C64 graphics screens, I think the whole 8K has to be filled with zero bytes.

Computers from this period had separate screens for text and graphics just to save memory. This concept was abolished on the Amstrad CPC, though.

If this project is successful, then you could do things similar to this Tetris clone on a Commodore 64, although of course it would be in 40 column mode, instead of 80 column mode, but in this particular case I think it’s clear that 40 columns would be better. I must also point out that this program makes use of the commands WHILE…WEND, as well as AREA, but I’m sure it’s fairly easy to make up routines that work round the lack of these commands, as with the amazing Dragon BASIC or Tandy BASIC Level 2 or 3, instead of all that PEEKing and POKEing!

That’s more or less what’s involved in this project. I’ll be making more posts about it in the future. Obviously, a lot of data, which I can best describe as “a semi secret stash of information” has recently come my way, but it wasn’t published by Commodore and I couldn’t find any sign of it in 1984 when I was trying to program the Commodore 64, before I gave up and pledged allegiance to more advanced BASICs. More news about this in the near future. Meanwhile, can anyone guess who wrote and published it? Can you also guess why I couldn’t find it? I hope someone replies to this question as a comment.

Posted December 18, 2013 by C64hater in Uncategorized



TandyPricesTandy Color Computers offered a cheap, easy to program, alternative to the Apple ][ AND the Commodore 64!

Be sure not to miss my last post on book reviews which I’ve only posted today!

I just thought I should point out two recent sensible comments which I’ve just replied to, although it took me a little while to think up really good replies. I don’t approve or reply to comments which I think are just C64 propaganda, but if you want to see them, then you can visit where the latest post is about the Commodore 64 hardware itself, not about programming it at all. This blog is about trying to PROGRAM that hardware!

I’ll post links to these comments here, to make them easier to find. (then scroll down to the comment from “cyber” and my amazing reply)

I also thought I should take this opportunity to post a link back to the beginning of this blog, in August 2012.

Posted December 6, 2013 by C64hater in Uncategorized

COMMODORE 64 BOOK REVIEWS   Leave a comment


The Bible of C64 programming?

Here are some book reviews of Commodore 64 books dated 1984 or earlier, which I either read or could have bought and read when I owned a Commodore 64. The reviews are written as if they’d been done in 1984.


This book consists of a serious of type in modules, which means the programs are built up in stages, and some modules can be used independently, as well as together. It includes a simple text editor, and a programmer’s tool kit of routines to merge, delete, and renumber (all available in Sinclair Spectrum BASIC and other BASICs). Unfortunately, there’s also a drawing program which doesn’t allow the user to save the drawings they create, so I think this is a sick joke. Don’t bother buying this book!


This book lists a system for doing LOGO language style turtle graphics in Commodore BASIC V2, which are already built in to Tandy and Dragon BASICs. You have to type in a very long listing from the back of the book, then this allows you to type in various short routines from the rest of the book, as well as make up your own. The whole thing is basically a cheap alternative to LOGO, but without any other features from that language.

Boris Allan sums up the C64’s built in BASIC quite accurately starting in his Introduction, with statements like “As the BASIC is so rudimentary, therefore, you have often to go outside BASIC to do even simple things: such as draw a straight line”, as well as “it is so surprising that Commodore have not provided a better standard BASIC”.

On the back cover, the C64 graphics chip is described as the VIC-Roman II, instead of the VIC-II, so this doesn’t inspire confidence about the accuracy of the type in listings contained in the book! At the end of the day, this book costs £5.95, but Commodore LOGO costs a lot more and only comes on disk! Other cheaper, turtle graphics software is available for the C64, though!

I think that what this book sets out to do could have been achieved much more impressively by listing a well commented Machine Language and Assembly Language programme which extends the limited Commodore BASIC V2 with a DRAW command that can work with a sequence of LOGO type commands, as in Tandy and Dragon BASICs.

Boris Allan is a columnist for the magazine Popular Computing Weekly.


According to Commodore this book is supposed to be more or less the Bible of programming the Commodore 64, but I’ve found it doesn’t live up to that description.

Two examples of hires graphics using the SIN function to draw a wave, as well as a circle, are given, but there aren’t any more examples of hires graphics!

Sprites are also covered, including one shaped like a hot air balloon, as well as another one of a dancing mouse. Unfortunately, after going over these listings in detail, I have no real idea how they work.

There are a lot of numbers representing memory locations given. These numbers are in decimal, as well as Hexadecimal, as used in Assembly Language/Machine Code, but not accepted in Commodore BASIC V2!

Assembly Language/Machine Code is covered briefly, but doesn’t feature any colour, graphics, or sound. The sections which do cover these subjects are all in quite cryptic equations in Commodore BASIC V2. PEEK and POKE commands are required for anything to do with graphics or sound. It’s as clear as mud!

One chapter gives a list of about 40 routines in the Kernal ROM which can be called by the user. Details of what these are and how to call them up in Assembly Language are given. One of this which amazed me was PLOT located at 65520/$FFF0 which allows the user to set the text cursor VERTICAL coordinates as well as the horizontal coordinates!

In short, I wonder what the authors of this book were on when they wrote it?


This book contains a lot of useful information about the C64, especially considering its small size and low price of £1.95!

There are none of the usual Commodore control characters embedded in PRINT statements. Instead of this, the authors have used the PETSCII/ASCII codes for those characters, then put them into FOR…NEXT loops. You can even set the X and Y positions of characters to be printed!

There’s an extended BASIC for you to type in, which provides you with 9 extra commands, mainly for graphics. This was featured in Issue No. 1 of Your 64 magazine, although their instructions for inputting in were wrong. If you don’t feel like typing in all that pure Machine Code using a BASIC loader, then you can send off for a cassette priced at £4.95. It’s a pity the program WASN’T listed in Assembly Language as well, complete with comments.

I think this is an excellent book, especially for the price!


As the title suggests, the Machine Language routines in this book are compatible with various older Commodore computers, including the PET and VIC-20, not just the Commodore 64. Even the newer Commodore 16 and Plus/4 are covered although this book was written before they were released. This is possible, due to compatible processors and ROM routines that exist on all these computers, as well as notes about different memory locations to do the same thing on different Commodore computers, such as the screen RAM location, etc.

This book really is an eye opener giving the reader a good grounding in 6502 Assembly Language, as used in all Commodore computers mentioned above! The approach given is based on the lowest common denominator of PET 2000/4000/8000 range of computers, because it seems all the examples would run on those computers, as well as the Commodore 64. Unfortunately, due to this approach, there don’t seem to be any routines in this book for colour, graphics, or sound on the Commodore 64, because the PET computers don’t have those facilities. I think this book would prepare the reader to take things further with a book specifically covering Commodore 64 colour, graphics, and sound, though.

Author Jim Butterfield is a computer pioneer from Canada, who first used a mainframe computer in 1963, then after a break, he bought a KIM-1 6502 CPU based computer by MOS in 1976, BEFORE that company was bought out by Commodore. He is a long standing Commodore PET user and the Editor of the US magazine “Compute!”, covering various makes and models of computers, which was formerly called “The PET Gazette” and was dedicated to Commodore computers only.

Posted December 6, 2013 by C64hater in Uncategorized