120

Why is ASCII this way? First of all, there is no one best sorting order for everything. For example, should UPPER or lower case be first? Should numbers be before or after letters? Too many choices, and no way to please everyone. So they came up with specific pieces that "made sense": Numerals 0x30–0x39 - Easy bit mask to get your integer value. ...


119

One use is as a copyright mechanism. Many distributors would steal/copy programs and sell pirate or derivative copies, by changing the text strings inside the code and reordering the blocks, it was hard to prove the code had been stolen. Placing noops of different types you could put a signature sequence which was much easier to detect and hard to hide. A ...


96

Since the few document trails on this topic quickly run cold, I contacted Ken Thompson. He confirmed that if there was anything he would have been influenced by at the time, it would have been BCPL and SMALGOL. But given that these don't use ! for negation, he "might have made it up". I don't suspect there is anything more to it that can be ...


88

FORTRAN made all variables starting with I, J, K, L, M and N integer by default. So just I by itself could be conveniently used as a loop variable. I imagine that choice was made because I, J, K, M and N are very commonly used as indices in mathematics. e.g., a sum of a series will typically be expressed as summing the terms A(i) for i going from 1 to n. ...


85

Because it's not important to ... anything. The compilers don't care. The editors don't care. Back in the day, some operating systems didn't even HAVE "file extensions". DOS mandated them, DEC system mandated them. Unix didn't. What's the standard extension for Fortran? For Pascal? For BASIC? Lots of convention, many system specific. But no ...


70

The NES was also from the era where some sound and graphics resources were also executable code. (Typically, this worked the other way around. Identify a needed sound and listen to chunks of the binary to find a reasonable candidate.) Injecting NOPs can improve the look or sound derived from a section of executable. Example: "One of the more-challenging ...


70

According to Wikipedia, the first assembly language was developed in 1947 by Kathleen Booth (née Britten). The language doesn’t look anything like “modern” assembly though (see the end of this paper); it’s more a mathematical representation of computer operations. The first mnemonic-based assembler was developed by Maurice Wilkes and David Wheeler for the ...


68

Did every programmer of every game implemented all possible various API's that old graphic cards supported? Yes - but it went even deeper than that. Early graphics cards had virtually no callable code associated with them at all, the concept of "drivers" had not quite become a reality yet. There was the concept of a Video BIOS, which were extensions to the ...


63

The definition of PASCAL is, above all else, intended to be simple. PASCAL was designed as a pedagogical language (with aspirations to be useful for commercial purposes, but that was a secondary concern). For this purpose, the definition had to be small and orthogonal so that it could be explained simply and concisely. For ease of implementation, the ...


61

According to ASA X3.4-1963 Appendix A, one of the design considerations was: (7) Ease in the identification of classes of characters Furthermore: A4.4 The character set was structured to enable the easy identification of classes of graphics and controls. And on page 8: A6.3 To simplify the design of typewriter-like devices, it is desirable that ...


58

It's PL/I, promoted by IBM as the successor to FORTRAN, Algol 60, and COBOL. That's actual code as far as I recall, not pseudocode. PL/I had abbreviations for keywords; "DCL" is "DECLARE". It starts off by defining a procedure (routine) named P with one parameter, named MODE, which is a Boolean variable - BIT(1), then defines a bunch of 16-bit signed ...


57

COBOL IF X IS GREATER THAN 0 AND LESS THAN 99 ...


55

The ! was around as part of the B programming language, according to the "User's Reference For B" (K Thompson, Jan 1972). Somewhere between BCPL and B, the decision was made to use !. In the Reference above, I can't find an indication of why it was chosen. "The NOT prefix unary operator ! takes an integer value operand. The result is zero if ...


53

it seems to be a simple bounding box check, as shown here from 6502 code disassembly, collision check between ship and saucer HitDetShip: L6A63: CPX #$01 ;Is object 1 not the player's ship? L6A65: BCS HitDetSaucer ;If not, branch. L6A67: ADC #$1C ;Ship hit box 42+28 = 70 X 70 from center. HitDetSaucer: L6A69: BNE ...


52

I would say one of the versions of the Menabrea paper, written in 1842 by Luigi F. Menabrea. Ada Lovelace became involved in computing when she was asked to translate this paper from Italian to French. She did so, and unlike many translators, was knowledgeable enough about the subject matter that rather than introducing errors into the translation, she ...


51

Pascal does this, I don't know of others. Don't know if the practice move forward with other Wirth languages.


51

The languages in the Visual Basic family do exactly this. This includes VBScript, VBA, Visual Basic and earlier. I believe these inherit the "feature" from QBASIC. For example Public Function AddTwo(something as Integer) AddTwo = something + 2 End Function


48

For type system reasons, and for compatibility with B. B is a programming language that served as the immediate ancestor of C. The salient thing about B is that it had no type system: all values in B are machine words (corresponding to the C type int). In B, there were two ways to represent strings in source code: string literals0, which evaluated to a ...


46

Like all games from that era, cheating and tables. Two 256 byte tables and logarithms gave a 10x speed boost on multiply and divide on Commodore 64 at least. Matrix operations using addition only for fixed known rotation rates. Lazy evaluation. Only convex shapes making hidden line removal simpler and hidden line removal meaning only half the vertices ...


45

K&R first edition (1978) does not mention the NULL terminator in the argv list at all. This was added later, in ANSI C. The relevant paragraph (section 5.11, p. 110) is: In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When main is called to begin execution, it is called ...


43

The premise: Machine language (and Assembly language) don't have the concept of data types is not quite correct, because tagged architecture means exactly this, machine language where the data is tagged for its "type" (even though not quite what we know from higher level languages). Probably the first widespread tagged architecture computer was the ...


37

The Early Days As you said, the most important languages on the Mac in its early days were Microsoft's BASIC, Pascal, and, of course, 68000 assembly. The Macintosh's System Software and ROMs were themselves programmed largely in assembly, with a bit of Pascal thrown in (mostly for pieces that were ported directly from the Lisa). C was merely a niche language ...


37

The early Apple Macintosh computers (original Mac, Mac 512K, Mac Plus) all came with a "Programmer's Switch" installed on the side. Yes and no. While the switch was there, it was on the inside, so, not really accessible. Only after being 'enhanced' with the so called 'Programmers Key Aid', a snap on after market piece of plastic, griping into the ...


36

I'm just speculating here, but one possible reason for using a 2-byte NOP would be if you wanted to change an existing 2-byte instruction into a NOP (to fix a bug, for instance), without changing the byte count for the instruction. (An undocumented 2-byte NOP might execute more quickly than two standard 1-byte NOPs in succession.) You might do this to ...


36

The requirement that argv[argc] be NULL was added in the ANSI C standard; it wasn’t a requirement before then, and some environments didn’t null-terminate the array (the strings themselves were of course null-terminated). In fact, in Unix V4, argv[argc] was documented as being -1 and not 0. Thus before ANSI C, argc was necessary, and it was kept thereafter ...


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

A mistake? The instruction $89 on the 6502 is a two-byte NOP. Based on adjacent instructions in the opcode matrix, especially LDA #ii ($A9 ii), it would have been STA #ii, a store to an immediate value, which makes no sense. On the 65C02, this instruction is changed to BIT #ii, which almost behaves as a two-byte NOP. One hypothesis is that a programmer ...


35

The method depends on whether you have the address space or not, regardless of the RAM limitation. If you already have a 32-bit address space, but simply not much RAM, then the answer is virtual memory.  Virtual memory is generally processor supported: the processor traps accesses to memory that isn't present, and allows the operating system to perform ...


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