MICROSOFT EXTENDED BASIC FOR C64 (PART 1)   Leave a comment

MICROSOFT EXTENDED BASIC FOR C64 (PART 1)

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 http://c64warez.com/files/browse/Basic/Extensions . 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 http://www.pagetable.com/?p=46 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 http://www.youtube.com/watch?v=pY0o32vWx9w . 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
JSR $FFD2
RTS

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 http://www.youtube.com/watch?v=JDnypVoQcPw 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.

Advertisements

Posted December 18, 2013 by C64hater in Uncategorized

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: