Hot answers tagged

212

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


70

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


67

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


62

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


57

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


54

I don't think that's an 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 ...


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


40

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


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


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


36

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


36

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


36

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


35

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


34

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


32

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


29

Per Sophie Wilson: To prove that [Steve had] designed the microarchitecture correctly, he wrote, in BBC BASIC, a model of the microarchitecture. To prove that I'd designed the architecture correctly, I wrote an interpreter for the processor's instruction set and wrote programs in it. So, well before any actual commitment to doing things, we could ...


27

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


26

Thraka is right that BASIC served the role of operating system on many 8-bit micros. Some OS was needed, that was beyond doubt. But at the time dedicated operating systems were either very limited (say, Atari DOS), overly complex, big and expensive for the tiny computers (Unix), or - for the middle ground, that was "just right" - in their infancy (CP/M). ...


25

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


24

Use the INPUT# command. The INPUT# command is meant for non-interactive I/O on files or devices, i.e. reading from a file on disk, serial port, whatever. Because it is non-interactive, it will not display a prompt anywhere. The keyboard can be opened like any other I/O device, it has device number 0. Knowing that, the implementation is straightforward. 10 ...


24

It is the exponentiation operator. Why is that? On a TRS-80 Model III the line of BASIC entered would literally be: LET Z1 = M * D1 * (PQ / A) [ 3 To get the [ character you would press the up arrow key. You would press the same up arrow key on its predecessor, the TRS-80 Model I. However, it would display as: LET Z1 = M * D1 * (PQ / A) ↑ 3 This is ...


23

I suspect your confusion is because INKEY$ returns the current state of the keyboard, not a buffered stream of up / down key presses (On serial terminal based systems such as CP/M you'd get the character code which might have buffer depending on the hardware). Basically the code could be written: 10 Wait for all keys to be up. 20 Wait for a key to be ...


22

As far as I know it was included because it was essentially the operating system interface. When you installed MS-DOS on a PC it provided you with commands and allowed you to run programs that executed machine code on the machine. BASIC back then was similar. It provided you with a command prompt, operating system-level commands like reading/writing data ...


22

Some comprehensive BASIC to start with There are BASICly three (*1) kinds of statements to handle single keystrokes in various BASICs (*2): Waiting for a single keyvalue to arrive and returning it. Checking if a key has been pressed, if yes, it's read and returned, otherwise an empty value is returned Delivering the actual state of the (decoded) keyboard ...


22

According to http://www.worldofspectrum.org/ZXBasicManual/zxmanchap25.html, addresses 23672-23674 contain a 24 bit count of 50Hz frame ticks in the UK. I wrote a quick program to print the values, which do indeed seem to start at zero on startup and increment at the right rate, and thus serve as an uptime counter. A simple bit of maths indicates that the ...


22

Well, it's a 'trick' to simplify the editor as well as the BASIC editor. After Reset (or NEW) three bytes of Zero are placed at the beginning of the basic RAM. They make it look to the basic interpreter as this looks like the tokenisation of a single, empty BASIC line. Consisting of One byte 00 as line end marker and Two bytes 00 as pointer to the next ...


21

Try using the "new" command. This clears BASIC's memory, so that you can write a new program.


20

BBC BASIC: inline assembly First one that comes to mind would be the BBC BASIC family. Beside many great features to access the OS, Assembly code could be directly inserted. It would be assembled right between the BASIC lines before and after. 10 P%=8000 : REM set Assembly location 20 [ 30 JSR some_function 40 ] 50 CALL 8000 : REM now execute it The ...


20

Given that HP’s Rocky Mountain BASIC could load and run parts of code from disk, and given those parts of code could be plain text and the files could also be saved on the fly, I would say yes it should be possible. I don’t know if anyone tried to do that with RMB though. There were definitely self modifying programs using peek and poke but of course your ...


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