110

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


92

The short answer is that DOS was designed to be similar to CP/M, and drawing a quote from here: While 8-bit programs could not run on 16-bit computers, Intel documented how the original software developer could mechanically translate an 8-bit program into a 16-bit program. Only the developer of the program with possession of the source code could ...


73

C did exist when DOS was developed, but it wasn’t used much outside the Unix world, and as mentioned by JdeBP, wouldn’t necessarily have been considered a good language for systems programming on micros anyway — more likely candidates in the late seventies would include Forth and Pascal. SCP developed DOS in assembly for a few very pragmatic reasons: The ...


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


69

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


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


53

The 8 bit 6502 family doesn't have any stack-relative addressing modes that would make it easy to use the stack for variable storage. One can access values on the stack with a sequence such as TSX; LDA &102, X, but that's slower, clobbers X, and uses more memory (both in code size and stack usage) than a global variable. The 65C816 adds stack-relative ...


49

Off the top of my head I can think of two reasons, there are probably more. The first reason is that these variables may be set by a routine each frame, and then a lot of code uses them during the time of the whole frame. Every interrupt routine that fires during that frame may want to read out the current direction. The second reason is that, in a real-...


46

No, DOS won't use any additional CPU (*1) ever. (Though it might run faster due them new CPUs being faster) Quite the same way as DOS doesn't take advantage of the extended memory or additional instructions. DOS is a Single CPU Single User Single Task Single Program Real Mode 8086 operating system. Even through it got a few extensions over time to tap ...


45

As someone who did it.... We wrote an assembler for an 8080, as there was nothing affordable from Intel. We wrote it in ALGOL 60, if I recall, and ran it on a mainframe. the first thing we ran through it was .. itself, re-coded in assembler. Oh, and a boot-loader, though I think maybe we had already hand-assembled a minimal version of that into binary. ...


44

Gates and Allen used remote terminal access to a minicomputer (Harvard's DEC PDP-10) to cross-assemble, and simulate, their implementation of BASIC for the Altair 8800. Commodore Basic (for the 6502) is reportedly derived from Altair Basic, and also cross-assembled using Macro-10 on a DEC 10. Woz (and many other early Apple programmers) could code 6502 ...


44

There are no technical reasons, as any order would work and result in the same amount of gates. More likely it originated in the process by which the 8086 was developed. A main goal was to allow easy conversion of 8080 programs, so the development of the 8086 structure started out from a 8080 programming model. 8080 registers were ordered as 16 bit pairs in ...


42

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


35

Machine language (and Assembly language) don't have the concept of data types, so if you want to add an int and a float variable in Assembly, you have to use the appropriate Assembly instruction that adds an int and a float. Erm... this sounds as if you're mixing up the idea of data types and operations on these. Data types are memory structures. Operations ...


34

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


34

The architecture of the original IBM PC (and its clones) let the BIOS access the video memory directly. So making nice text layouts did not require positioning the cursor or making a sequence of calls like you would do with curses: It was sufficient to set the text mode at startup and write at the right place in memory the character (1 byte) and its ...


32

MADS uses * in three ways (See MADS "Manual") Using the current assembly address for calculation of an address, i.e. the one the actual statement is assembled to. Multiplying in expressions. Mark the beginning of a comment (until line end) In above listing it will be interpreted as the address the JMP instruction is assembled to, so it will form an ...


30

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


30

From The OS/2 Museum page about DOS3: "The new ATTRIB.EXE utility allowed the user to manipulate file attributes (Read-only, Hidden, System, etc.). It is notable for being the first DOS utility written in C (up to that point, all components in DOS were written in assembly language) and contains the string “Zbikowski C startup Copyright 1983 (C) Microsoft ...


29

The MOVE immediate instruction takes 8 cycles in byte and word modes. There are two memory reads, one for the instruction and one for the immediate value. The MOVEQ instruction encodes the immediate value into the instruction op-code itself, so only takes 4 cycles and 1 memory read. It can only take a byte immediate value. MOVEQ #1, D0 (4 clocks, 1 ...


28

MS-DOS (by which I mean the underlying IO.SYS and MSDOS.SYS files) was written in assembly through the first half of the 1990s. In 1995 for Windows 95, which was bootstrapped by what you would call MS-DOS 7.0 (although nobody ran DOS 7.0 as a stand-alone OS), I did write a small piece of code in C and included it in the project. As far as I know, it was the ...


28

TUI-drawing code can be pretty compact when you're working in assembly and relying on the IBM video BIOS to do the heavy lifting. For example: INT 10h/AH=06h and INT 10h/AH=07h can be used either to scroll a rectangular region of the screen or to clear the screen to a specified foreground/background colour combination. INT 10h/AH=09h can be used to tile a ...


25

The same answer as everybody else, just with more detail: What I mean: An assembler is not an application exactly trivial to write. Oh, but it is. A "first" assembler on a platform simply reads some bytes, transforms them in a more or less 1:1 relationship to other bytes, that's it. The target architecture was very simple. There was no shared objects / ...


24

From Byte Magazine article on 6809, by Terry Ritter: Point 11: Tell me again about the stack pointers: why two stack pointers? Answer 11: Good Point. The original reason for adding the user stack pointer was to facilitate the creation of a data stack in memory that is separate from the program stack. This avoids one of the serious problems ...


23

As mentioned previously the timing issue is the cause not to waste time in pushing up parameters, access them with cost-intensive addressing modes and pull them finally from stack. Too much action if this occurs in a tight, time-critical frame building routine. In a games of a certain size usually all could be handled with global variables. Some state of the ...


23

As an addition to Stephen's extensive list, Zuse's 'Planfertigungsteil' (a modern translation might be Program Manufacturing Device) as implemented in 1942-1945 for the Z4 computer might be worth mentioning. While not a program, but a hardware device, it allowed the use of abstract operation names as well as symbolic addresses. There was even functionality ...


23

Low Memory ==> Assembly Language In the early days every byte mattered. MS-DOS was, in many ways, an outgrowth of CP/M. CP/M had a fairly hard limit of 64K. Yes, there were some bank switching in later versions, but for practical purposes for most its popular lifetime it was a 64K O/S. That included O/S resident portion + Application + User Data. MS-DOS ...


23

The code you've posted: loads the immediate value 0 into A; loads the immediate value 3 into Y; then compares the 0 in A to whatever is in memory at the address you've given the label Y. There are no register-to-register comparisons on the 6502.


22

Your code runs through the data ("Hello World" string) interpreting it as (nonsense) machine code - and very probably crashes before it even reaches the jmp instruction. You need to move the jmp instruction to before the string.


22

The 1974 Altair 8800 kick-started the industry but at the time offered no keyboard, no screen, just a bunch of switches and lights connected directly to the bus and a counter to help you input or output sequential values. So you'd work out the binary representation of your program by hand and input it byte by byte, bit by bit. The world's introduction to ...


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