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


25

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


25

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


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


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


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


10

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


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


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


7

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


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


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":


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


4

As for "branch and loop like in-line operators are a waste, because they can be emulated with mutiple lines": It's important to remember that on machines like the PDP-11, a user was restricted to 64 KB or less, and it wasn't particularly fast. And if you have a larger scientific program that needs lots of memory for matrices and arrays, you'll notice the ...


4

It depends on your BASIC. Some Basic distinguish between arrays and simple variables, some don't. MS-BASIC, Sinclair's ZX81 and many other separate them. Similar for simple variables, some BASIC distinguish between simple varables of different type. So A, A$, A! and A% are different variables. The workings come from the way variables are searched. The ...


4

The comma syntax does not work in Commodore BASIC, neither on the PET (Commodore BASIC V4.0), nor on C64 (Commodore BASIC V2.0), C16/116 (Commodore BASIC V3.5) or Commodore 128 (Commodore BASIC V7.0). Using a construction like INPUT "ENTER SOMETHING",A$ yields a SYNTAX ERROR. There are however other ways to suppress the question mark prompt on a C64, see the ...


2

The original Altair BASIC came in three versions; 4k, 8k and Extended. The numbers referred to the amount of RAM required to run it, as BASIC was loaded to RAM from paper tape. The 4k version running in 4k of RAM had a whopping 790 bytes free. The 4k and 8k versions used a 4-byte (6-digit) floating point format. The 4k version lacked string variables and ...


2

Does anyone know why? I imagine that not having to read the I would help a tiny bit, but the time difference seemed far too great to be that alone. Short Answer: It's quite simple. Looking for a NEXT stack entry with a specific variable takes more time then just looking up the last NEXT- and beingpart of a loop makes it even more costly. Detailed Answer: ...


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