Hot answers tagged

42

[W]ere these interpreters implemented as tree-walker interpreters or bytecode interpreters? Neither, or both. They are kind of source code interpreters - much like (classic) shell scripts - except they used a tokenized storage format (*1). Their structure was dictated by balancing lack of memory, lack of interpreter code and desired optimization for speed (*...


21

The big improvement to the language in Locomotive BASIC, compared to Sinclair BASIC (and many other BASICs), was the addition of timer support: AFTER 50,0 GOSUB 320 would call the subroutine at line 320 after a second, and EVERY 500,0 GOSUB 320 would call the subroutine every ten seconds. In both cases, the first value is the interval in fiftieths of a ...


19

Was Locomotive BASIC significantly better than Sinclair BASIC? TL;DR: Oh, yes, it was! I'm aware that both Basics were more advanced than the C64 Microsoft implementation, Comparison of C64 BASIC to other BASICs of the same time is never in favour for the C64, as it's a quick port of the original 1977 PET Version. but neither [Locomotive BASIC, ...


17

The Sinclair systems were tokenised directly at the keyboard, so there was almost no lexical analysis. Keys were inputs to a state machine that implemented the BASIC language structure in a ROM table. The first keystroke would have a label on it -- maybe the P key was also labelled Print, G was Goto, and the L key was Let. After that was hit, the state ...


15

Most early 8-bit personal computer Basic interpreters were tokenized recursive descent interpreters. Tokenized to reduce the size of the program text, as well as speed up the interpreter by not have to parse text at runtime, and runtime recursive descent, trading off stack space usage versus having to build a parse tree in memory beforehand. Very few (if ...


14

were these interpreters implemented as tree-walker interpreters (simply traversing the parse tree) or bytecode interpreters? I have been looking at various BASICs for the last while. The answer is "all of the above". Pure interpreters - Tiny BASIC TinyBASIC parsed the line to the extent of converting the line number to an 8-bit value to see if the line ...


8

Considering how much of a rush job Locomotive BASIC was, it's remarkably good. But it's not perfect. Sinclair BASIC has one powerful keyword that Locomotive BASIC lacks: VAL. Sure, Locomotive BASIC has a VAL() function, but Sinclair's one is a function evaluator: 10 FOR X=-5 TO 5 20 PRINT X,VAL ("X * X") 30 NEXT X This would fail on an Amstrad CPC, but on ...


4

If by "unavailable to store BASIC program text," the general answer would be "all sorts of stuff." A typical memory map for an early Apple system would be along the lines of the following: $0000 - $00FF (0 - 255): Zero Page (system variables) $0100 - $01FF (256 - 511): 6502 Processor Stack $0200 - $02FF (512 - 767): GETLN Line Input Buffer $0300 - $03CF (...


4

Let's take for example an MSX computer with 64K RAM. That's what you get on boot: Where does this 28815 come from? To start with, a MSX is a Z80 based machine. The Z80 has an addressing space of 64K. The MSX standard divides these 64K in four 16K pages that can be independently switched to any internal or external memory slot. When booting in BASIC mode (...


4

Dartmouth Basic wasn't an interpreter at all — it compiled directly into machine code when the user typed RUN. It was designed so that the program appeared to start executing almost immediately, and there were a number of tricks that made this possible. Speed of compilation was a design criterion. The compiler only needed a single pass over the input, and ...


1

Beta Basic for the ZX Spectrum had ALTER, which was specifically intended to "alter references in the program" as demonstrated by this code: 1 LET free=MEM() 2 FOR n=1 TO 100 3 ALTER (n) TO "VAL"+CHR$ 34+STR$ n+CHR$ 34 4 NEXT n 5 PRINT "Saved ";MEM()+28-free;" bytes" This replaces all numbers in the program from 1 to 100 with a variable. The manual ...


1

If your looking for concepts to add to BASIC, One of the most advanced BASICS of the time was Microware's BASIC09 for the 6809. It had removed line numbers as well as added structured programming concepts. It had a number of features that took advantage of the processor that might be very difficult to do on a 6502.


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