39

Except for the very earliest versions of basic, LET was rarely used, but the LET keyword was not always optional. Early BASIC interpreters required it; however, for most versions that came out for the PC (including Microsoft BASIC), the use of LET was optional. Later standards in BASIC often required that the keyword be supported, but since there was no ...


29

The early versions of Microsoft BASIC required 4KB of ROM The 4k versions lacked a number of major features, including string variables. These were added in the 8k versions. The equivalent 6502 version, which also expanded the floating point from 32 to 40 bits, was about 10k. But Microsoft's IBM BASIC (known as "Cassette BASIC") for the original IBM PC ...


27

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 (...


18

I can only answer to the first question: the LET statement was actually used in 48K Sinclair BASIC, in which due to the way commands are entered, a keyword is needed before an identifier can be typed, so LET was needed in order to write a variable assignment (although there were unofficial patches to the ROM that eliminated that requirement). In fact, and ...


16

If you mean if Microsoft BASIC's core ever used Z80 instructions at all, then I would say no - the code of BASIC is designed using 8080 compatible instructions, and all "drivers" are created as appropriate for the platform. It may happens that some vendors have modified the code to Z80 in order to "compress" it and free some space for special functions, but ...


15

They're two different variables, at least in the version of MS BASIC on the C64: DIM A(4) READY. PRINT A, A(1) 0 0 READY. A = 1 READY. PRINT A, A(1) 1 0 Basically A and A(...) refer to two different variables, just like A$ and A% are also different variables than A.


14

I've seen a number of articles, such as this one which states it was based on 8080 BASIC, and this one which states that 8080 BASIC was first ported to the 6800, which was translated to the 6502. It would make sense to take the methods used in 8080 BASIC and use them on other processors.


13

Yes, Z-80 instructions were used in Microsoft's Z-80 BASIC. For example, look at the TRS-80 Model I or Model III ROM BASIC and you'll find a relative jump JR NZ,0x871 at location 0x88E. The 8080 does not have relative jump instructions. That instruction is part of a routine to shift CDEB right by L bits which is used by the floating point code. Do a ...


13

Do you have any citations for your claim that most MS-BASIC integer multiplication was done by turning into floats? Beside having lived thru it, or noting that the source of MS-BASIC doesn't contain any integer routines (except for conversion)? (*1) I assume the most simple and obvious proof would be to just try it. Commodore 8 bit machines are a great tool ...


12

The two statement forms are slightly different in meaning. The meaning of NEXT is, roughly, "increment the loop variable for the most nested loop and go to the next iteration of the loop". The meaning of NEXT I is, roughly, "while the mentioned variable is not the loop variable for the most nested loop, abandon execution of that loop, then perform as NEXT"...


11

My memory is that the O/S (for want of a better name) occupied the lowest memory followed by the code of your Basic program. Variables were allocated at the highest available address. So, as you wrote longer programs and used more variables, the two converged in the middle You're right - well, BASICly (SCNR). I don't recall any protection, Yes, there is. ...


11

The files are encoded as follows: the first byte is 0xFE to indicate that it’s a protected tokenized file (0xFF for a regular tokenized file); the remainder of the file is encoded using exclusive-ors with two keys, embedded in the interpreter (or in the ROM, for BASICA). The two keys are Key1 db 9Ah, 0F7h, 19h, 83h, 24h, 63h, 43h, 83h, 75h, 0CDh, ...


11

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 ...


11

[Maury Markowitz' answer already nails it, so this is just to add some numbers for comparison] The Cassette BASIC 1.0/1.1 in the IBM PC ROM is a Microsoft BASIC V5.x (*1). It's usually marketed as MBASIC. It was available as stand alone application or as program under CP/M and other OS. MS offered 3 basic flavours: 8 KiB BASIC Extended BASIC Disk BASIC 8 ...


11

Microsoft Extended BASIC, as used by the Dragon, uses a 40 bit (5 byte) float format(*1): Field Size (Bits) Exponent Sign 1 Exponent 7 Mantissa Sign 1 Mantissa 31 -- 40 Numbers are always normalized with the top mantissa bit removed. As an oddity, they are stored in a 6 byte ...


9

And I found the answer only moments later when I came across the original manual. The difference is that the 4k version (mainly) did not have strings (!!), lacked a number of math functions (ATN, etc), logical operators (AND, OR) and PEEK/POKE. UPDATES: And a short form of the differences can be found in the original MITS brochure. Although no specifics ...


9

Your initial interpretation was correct -- Microsoft Basic is storing the address of the first statement of the FOR/NEXT loop. But it is also storing the line number of the first statement. See the comment at the top of flow1.s: ; ---------------------------------------------------------------------------- ; "FOR" STATEMENT ; ; FOR PUSHES 18 BYTES ON THE ...


8

Bill Gates and/or Paul Allen likely did not write the 6502 version of Basic. Marc McDonald, one of the very first Microsoft employees, is reported (on the Wikipedia page for Applesoft BASIC, for instance) as having written the 6502 version of Microsoft Basic. But he would have had access to all the source code to Gates and Allen's 8080 BASIC, as well as the ...


8

Yes, Microsoft 6502 BASIC was clearly a port of their 8080 BASIC. Unfortunately the original 8080 source code for Microsoft BASIC isn't easily available, so we can't compare it directly to that without going to the Harvard University library to read the paper copy. But the Microsoft source code for a later version of their 8080 BASIC, BASIC-80 5.2 (actually ...


7

Monte Davidoff's floating point routines for early Microsoft BASIC used Chebyshev Modified Taylor series for EXP(x). There's a very helpful disassembly of the TRS-80 MC-10 ROM here: http://www.roust-it.dk/coco/mc10/romlist.txt. It's 6800 assembly, and the whole commented routine (using the same constants) is: TBLF59B FCB $81,$38,$AA,$3B,$29 ;1.44269504 (...


6

I honestly don't remember these structures when I ran BASIC-PLUS on RSTS/E, so I never used them. I did, however, use them pretty heavily when I moved to BASIC-PLUS on the VAX. I loved BASIC-PLUS on the VAX. We used it mostly with its first class integration with RMS. My singular complaint at the time was its reliance on line numbers for ON ERROR GOTO, even ...


6

What protection there was depended on whose BASIC interpreter you were running. Applesoft BASIC had a check surrounding most things that pushed the limits of what had been allocated and would trigger an OUT OF MEMORY error if there was going to be a collision. You can see this in action in the source code by looking at the code preceding jumps to MEMERR ...


6

As noted, MS-BASIC implementations such as those found in the Commodore used floating-point math for everything, and the performance implications of this were severe. Consider the following program: 10 TI$="000000" 20 A=32768:B=1:C=2 30 FOR I=1 TO 1000:A=A+B-C:NEXT 40 PRINT TI,A Testing on VICE emulating an NTSC C64, the above code takes 320 ticks (5.33 ...


6

How to quit MBASIC and return to CP/M? SYSTEM See Section D integration to CP/M, page D-4 of the MBASIC Manual


5

Rosetta code has a category dedicated to programs written in Basic: http://rosettacode.org/wiki/Category:BASIC


5

GW-BASIC 3.23 gave an error, "Overflow":


5

As far as I can see, any Microsoft BASIC at that time should have used Microsoft Binary Format for floating-point numbers. Since you found out that numbers are occupying five bytes, that should mean that your implementation is using the 40-bit format. This format is similar enough to IEEE-754 binary formats in that it has a sign bit, a base-2, biased ...


4

They expanded the variable table. Each entry starts with a type byte followed immediately by the full variable name. This is based on an analysis of the Microsoft BASIC-80 5.2 source code found here. The core of the interpreter is BINTRP.MAC, which has most of the definitions used here. This includes NAMCNT (one byte) and NAMBUF (NAMLEN - 2 bytes), which ...


4

Those programs aren't BASIC*. Detokeninzing them with petcat produces: $ petcat bez\ milosti-inst.prg ;bez milosti-inst.prg ==0801== 1991 sys2065 tmc $ petcat bez\ milosti.prg ;bez milosti.prg ==0801== 1987 sys2065 fbg So each of those prg files contains only one line of BASIC code: a sys instruction that jumps into the machine code part of the ...


4

A typical MS-BASIC interpreter would allow configuration of two key addresses: the start and end of the memory space it was allowed to use. The tokenized BASIC program was always expected to start one byte after the bottom address. The interpreter would then maintain and update a few additional addresses: The end of the BASIC program text and start of ...


Only top voted, non community-wiki answers of a minimum length are eligible