Hot answers tagged

229

I'm the author of the TPUG article. The "BILL GATES SUCKS" message isn't really an Easter egg; that was just a conceit of mine to make the article a bit more interesting and to turn it into a bit of a puzzle. Here's how it works and how it was created: In any given infinite sequence random numbers, it's a mathematical certainty that a given subsequence of ...


78

This is an example of BBC BASIC with inline (6502) assembler code. The computer in use would have been a BBC Microcomputer, manufactured by Acorn Computers Ltd. The display was probably a studio monitor of some sort. These could be driven directly using either the RGB output or the composite video output of the microcomputer. It is likely that the actual ...


76

POKE 59458,62 was a trick, sometimes called "Fast Print," used to increase screen refresh rates on older PETs. This page describes the trick succinctly: the system no longer waits for the video sync signal, thinking that it's always present, and updates the screen as fast as it can. In later models this POKE could cause problems. The new video circuitry ...


69

Having a programming language built-in gave you a multi-purpose tool into your hands at the flick of a switch (power on). As to the choice of BASIC vs. other programming languages, microcomputer BASIC dialects are - despite some of their shortcomings - quite accessible to novice programmers. They are a bit like using English in an imperative style ("PRINT ...


67

TL;DR: As explained on Steven Weyhrich's great and authoritative Apple II History Site, Wozniak simply sat down and wrote his Integer-BASIC (*1) on paper, while assembling it at the same time by hand. In his own words: I had no assembler, that was another thing. To use an assembler, they figured that somebody was going to buy this processor to use for a ...


62

I am the author of that video. I wrote a little article about that years ago. I will copy that for you here: Original article here: http://www.zxprojects.com/index.php/the-fix-a-spectrum-blog/29-the-oddities-of-the-inves-spectrum The Inves Spectrum+ was a Spectrum 48K clone made by Investronica, the Spanish partner of Sinclair Research, and responsible for ...


60

That's not a real easter egg. Someone just made an effort to find random seeds that produce the numbers to create the intended words. It would be an easter egg if the seed numbers were in some way related to CBM or Microsoft. A=RND(-A) initializes the (pseudo) random generator with A, generates a random number and stores it in A. The GOSUB20 subroutine then ...


59

Your mention of TRS-80 provides a clue. In the TRS-80 character set, the space normally occupied by the ASCII [ character is instead a ↑ (up arrow) character. Old versions of BASIC (such as this one from 1964) use the up arrow character to indicate exponentiation, probably because at that time the ^ character was not even in the ASCII standard. (There is ...


53

The difference between Applesoft BASIC and the other Microsoft 6502 BASIC derivatives can be explained by the fact that Applesoft BASIC was not the first BASIC for the Apple II; the first was Apple II Integer BASIC, in turn derived from Apple I BASIC, which had been independently created by The Woz. Integer BASIC supported only 16-Bit signed integers as a ...


47

BBC BASIC, first shipped in 1981, includes the EVAL keyword, which means "ask the interpreter to evaluate this string as an expression". Since strings can be mutated, a program can mutate what will be evaluated at runtime. The BBC MOS also provides *SPOOL (write screen output to a file) and *EXEC (read text from a file and act as if it had been typed), if ...


46

People nowadays think of BASIC as something lesser and generally tied to puny microcomputers, but BASIC was the language of choice for many scientific, engineering and business computers in the 1970s. It had a strong foothold with mini computers, years before the microprocessors made its debut on the desktop. Think HP (Instrument) BASIC for all their ...


46

They were awfully slow. And not just because the CPUs they ran on were slow; the interpreters themselves tended to use some terribly inefficient implementation techniques that certainly wouldn’t pass for good practice today: Where a modern programming language interpreter might use a just-in-time compiler or convert the program into bytecode before running ...


45

Having BASIC available for the machine was a selling point so early adopters wouldn't have to wait for software to become available--they could write what they need themselves, and they wouldn't need to learn machine language to do it. [Bill] Gates believed that, by providing a BASIC interpreter for the new [MITS Altair] computer, they could make it ...


45

Yes, BASIC is much slower than assembly for many operations. For an easy example, try out this program on a Commodore 64 or emulator: for i = 1024 to 1984 : poke i,peek(i) or 128 : next You will see each character on the screen reverse, row by row, over the course of ten seconds. By contrast, the exact same routine in machine language inverts the entire ...


45

In the early days, many machines running BASIC had limited character sets. For example, the stock TRS-80 Model I couldn't display the lowercase portion of ASCII, which omitted curly-braces, tilde, and the vertical bar as well. Worse yet, the character codes that usually map to [ \ ] ^ instead mapped to up, down, left, and right arrow characters! Reaching ...


45

The speed of BASIC interpreters has been discussed elsewhere on this site, see How can you measure time using BASIC on Atari XL computers? for example. They were slow, in many cases very slow; bear in mind that micros in the 80s had slow CPUs, small amounts of memory, and most BASIC implementations were interpreted. Even BASIC on PCs was slow (at least, ...


43

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


42

These tricks are usually done to increase speed or reduce space. For most (especially Microsoft) BASIC, constants are stored within a tokenized line as ASCII (as entered), and converted to a floating point number every time they are evaluated. This is a time consuming process. Assigning the number once to a variable to be used thereafter will skip this part ...


42

The floating-point routines for Microsoft BASIC were written by Monte Davidoff in 1975, originally for the Altair, which used an Intel 8080 CPU. The source code had been lost for years, until Bill Gates’ former tutor discovered a copy in 2000 that had fallen behind his file cabinet two decades before. Davidoff needed to invent his own floating-point format, ...


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


39

The problem is simple. At initialisation, Nibbles measures the time it takes to perform 1000 empty iterations of a FOR loop with a DOUBLE counter in order to determine how many such iterations are required to produce a ½ ms delay. Back when this code was written, CPUs were pretty slow (and FPUs even more so, if they were available at all), so it was ...


38

Nobody so far has said the magic words, which is Microsoft BASIC. First developed for the Altair 8800 (the first commercially successful personal computer!), Microsoft spent a lot of energy making sure their BASIC would work on every personal computer in the 1970s and licensing it widely. It ran on CP/M, it ran on the TRS-80, and -- of course -- the IBM PC. ...


38

There are a number of optimisations which, in aggregate, will improve performance somewhat: There are multiple linked lists for the variables, one per first letter of the variable name. This makes name lookup faster compared to a more typical implementation with one linked list. The integer variables @% through Z% have fixed memory locations and do not ...


38

In my view, the brief popularity of BASIC in the 1980s is directly related to the popularity of Javascript today - Simply, it's the Runtime that is Everywhere. That is what BASIC was back then. During the home computer revolution of the 1980s, every new system had to at least have a viable claim to be useful for something in terms of software. By providing ...


38

In old computer books of cheaper sort, (Paperback or pocket books) it was quite common that they couldn't type set all special characters directly. Either they did as in this case, changed the character for something the computer in question didn't use, but the type setter could handle. In this case this is normally mentioned in the foreword of the book. ...


38

One thing is certain: Steve Wozniak was very good at hand assembling 6502. Instead of writing assembler mnemonics he could simply type in the necessary hex code. I realize this isn't a proper answer but this anecdote is simply too good to relegate to a comment. It comes from Bill Atkinson remarking on Steve doing some assembler work: The other thing that ...


36

Contrary to other answers, obliging the user to enter BASIC tokens directly doesn't really save meaningful amounts of RAM. Many of its contemporaries such as the BBC Micro had BASICs where you typed keywords in full which were then immediately tokenised when you pressed enter. If anything, tokenised Sinclair BASIC generally had longer byte sequences than ...


36

DOSBox, with the default CPU speed of 3000 cycles on this Linux box, runs nibbles.bas without problems.


35

There are multiple reasons. First, there was no standards body publishing an official definition of the BASIC language (initially the closest thing to a standard was the Dartmouth version for mainframe computers, eventually the 'de-facto' standard became Microsoft's version simply due to market share). This left people free to fill in perceived gaps in the ...


35

That interpreter apparently parses the source text, or at least the numerical literal values, at every execution. π is a single-byte magic token, therefore, as soon as it is recognized, it is immediately substituted with the value of Pi, and nothing else needs to be done. When a byte that might occur in a number is parsed, the number parsing routine begins....


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