9

I'm wondering if anyone has a document that describes the history of the BASIC interpreters used in the various Commodore 8-bit machines?

Ultimately I'm trying to track down how it is that the A% format for integer variables apparently used the existing BCD floating-point code instead of presumably faster integer-only code.

I suspect I'll have to contact the original authors, but perhaps someone here knows?

  • 1
    That second question should be asked as a different question. – wizzwizz4 Mar 9 '18 at 17:06
  • Based on the answer to your question, you are not going to be able to contact any of those three about your programming problems. :( – Grant Garrison Mar 10 '18 at 0:49
  • Actually, I received a response very quickly. – Maury Markowitz Mar 11 '18 at 16:13
26

It is well established that Microsoft's 6502 BASIC (and Commodore BASIC is just a manufacturer specific adaption) is a port of the original 8080 BASIC done for the Altair -- alas, not a direct one, as the prior port to 6800 was used as code base (*1).

The creation is attributed (in its source code) to three programmers:

  • Bill Gates for the execution code (commands, functions and operators)
  • Paul Allen for the 'Environment' code (editor, tokenizer, lister, etc.) and
  • Monte Davidoff for the math libraries (floating point).

So, Davidoff might be the right guy for you to ask.


Caveat: Since Commodore bought the BASIC and only paid for the 2.0 update, every change thereafter will be originated at Commodore, not Microsoft.


*1 - Michael Steil collected many details and did an in depth analysis using the 6502 Easter egg as a marker 'gene'. He even created a nice family tree for Commodore BASIC: MS/Commodore BASIC Family Tree

  • Am I reading that correctly? Was MS's v2 released in late 1977? If so, I suspect my answer will lie in Commodore, not MS. – Maury Markowitz Mar 9 '18 at 21:59
  • @MauryMarkowitz Still not sure what your question here is.But yes, MS V2 was released by Microsoft as seperate package arround Dec77/Jan78. But >Commodore did, at that time still use a V1 based BASIC for the PET. it wasn't until spring of 1979 then MS-BASIC 2.0 got adapted by Commodore as Commodore-BASIC 2.0. So if the issue you are looking for is in Commodore BASIC 2.0, than the MS-BASIC 2.0 source is the one you need to look at. – Raffzahn Mar 9 '18 at 22:21
  • Indeed, I think this answers the version question below. I'll find the MS 2.0 sources and start looking through them. – Maury Markowitz Mar 10 '18 at 13:40
  • @MauryMarkowitz So look at Michael Steil's excelent post including the Source, or, since the server seams to be deconfigured, this backup of the code on Github. – Raffzahn Mar 10 '18 at 13:56
10

The following article details some of the early history of Commodore BASIC (including other Microsoft BASIC 6502 versions), particularly v1 and v2.

Create your own Version of Microsoft BASIC for 6502

Originally, Commodore paid a flat fee for Microsoft's BASIC, instead of a royalty license, reportedly because Jack Tramiel told Bill Gates, "I'm already married". Commodore didn't go back to Microsoft for upgrades, instead creating them out of what they had already purchased for that one time fee.

Later versions of Commodore BASIC were created by Commodore such as BASIC v4 (PET, CBM), BASIC v4+ (CBM-II), and BASIC v3.5 (Commodore 16 and Plus/4).

When Commodore created the Commodore 128, they did go back to Microsoft for updates, and they demanded their name be displayed at boot.

The Wikipedia article linked above will probably answer any related questions you might have.

  • 5
    The OP's question has changed twice since I answered. I give up. – Tim Locke Mar 9 '18 at 19:19
  • 3
    I hate it when the goalposts are moved, too. – Rui F Ribeiro Mar 9 '18 at 21:10
  • 1
    This article is very good, and speaks about the 6-byte and 9-byte formats. – Maury Markowitz Mar 9 '18 at 21:49
  • Which "they" demanded their name be displayed at boot? – RonJohn Mar 10 '18 at 5:53
  • @TimLocke yeah, seams as if he doesn't realy know what he want's to know. – Raffzahn Mar 10 '18 at 16:27
1

The 6800 and 6502 CPUs both have BCD support and it is believed Microsoft's 6502 BASIC was derived from its 6800 BASIC, so the BCD could have been added when creating the 6502 BASIC but it may be more likely it was done for the 6800 BASIC. The 8080 didn't have BCD so it shouldn't have been in that version.

I would check Microsoft's 6800 BASIC (ran on the SwTPc 6800, written by Richard W. Weiland) and perhaps also some of their other 6502 BASICs such as Applesoft to see whether they also use BCD. I suspect Applesoft is the same as Commodore BASIC because BASIC benchmarks run on the Commodore 64 and Apple II are the same speed.

Any version of Microsoft BASIC that asks "MEMORY SIZE?" at startup, will display the author by replying with 'A'.

0

It turns out Monte did not work on the 6502 version, but pointed me in the direction to figure all of this out.

The A% format originates not in MS BASIC, but the one they based it on, BASIC-PLUS on the PDP-11. Like the later MS version, BASIC-PLUS indicated an integer value with the %, so for instance A%. As in the MS version, integer variables were a 16-bit signed value. It is not clear whether BASIC-PLUS had a separate integer math package.

This feature reappeared in later versions of MS BASIC, although I have not tracked down which one exactly. It does not appear to be part of the original 6502 version that was supplied to Atari, for instance. As it was available on some Commodore machines, this implies it happened relatively early in the evolution.

In any case, the MS version used integer variables only as indexes and values in arrays. This allowed a more compact in-memory format, which was especially useful for large arrays of numbers like machine code stored in a SYS array.

With these limited use-cases, there was no need for a separate math unit - this was being done for size not speed - and so any math using these variables simply converted it to the 9-byte FP format and used the existing FP math routines.

It would be interesting to modify the CBM code to add a separate integer math library with just the basic routines in it, perhaps only plus and minus. I suspect this would have a large effect on average program performance.

  • Sorry, but if your question was "Why did Commodore use the percent (%) signe to mark integer variables" then why didn't you ask so? It would have saved quite some detour answering the question you seamingly asked in the title :( – Raffzahn Mar 10 '18 at 14:31
  • That wasn't my question. – Maury Markowitz Mar 10 '18 at 16:01
  • Then above answer doesn't even make less sense, as it answers wheree the % designater was taken from, which is well known anyway. – Raffzahn Mar 10 '18 at 16:11
  • 1
    Excuse me? You are changing the question again. Now you ask for the iintegration of integer math. That is not to be found in above question that was about some obscure A% format, whatever that is supposed to be - and the Title, which shoudl reflect it, ready even again somethign else. How do you expect people to answer it if you mix everything up? It my be a good idea to have some respect for the people spending their time to help you - at least my making clear requests and not moving targets. – Raffzahn Mar 10 '18 at 16:26
  • 1
    @MauryMarkowitz Remember that Stack Exchange questions and answers are supposed to be easily searchable and useful to future readers. Someone searching and clicking on "Who wrote the MS BASIC on the PET/C64/etc?" is going to find Raffzahn's answer useful, yours decidedly less so. That's why we try to put the actual question in the title field. Your answer will likely attract down-votes because it doesn't answer the original question, despite it being your answer to your own question. – mnem Mar 11 '18 at 13:52

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.