Introduction to C Programming by Rob Miles, Electronic Engineering
Assembly language is the textual way of describing a machine code program. Each individual machine code instruction is represented by a letter sequence called a mnemonic. A program called an assembler converts the assembly language into machine code. You can mix assembler and compiler output by linking together their object files. You write assembler programs when you need great speed, or want to talk to particular pieces of hardware. Assembly language is slow to write and non-portable.
When you want to use a function, you call it. When a function is called the thread of execution switches to that function, starting at the first statement in its body. When the end of the function, or the return statement, is reached the thread of execution returns to the statement immediately following the function call.
A compiler takes a source file and makes sense of it. It is the first stage in the conversion of a program into machine code. The compiler will produce an object file which is linked in with other object files and library files to produce the machine code program which is run. Writing compilers is a specialised busines, they used to be written in assembly language but are now constructed in high level languages (like C!). A compiler is a large program which is specially written for a particular computer and programming language. Most compilers work in several phases. The first phase, the pre-processor, takes the source which the user has written and then performs all the compiler directives, producing a stream of program source which is fed to the "parser" which ensures that the source adheres to the grammar of the programming language in use. The final phase is the code generator, which produces the object file which is later linked by the linker.
A directive is a command of some kind. In C this usually refers to the pre-processor, which acts on these to get particular effects. Some assemblers also support directives which can change the way they work, but these are not the same as the ones used in C.
The formatted print and scan functions, for example scanf and printf, need to know how to format their output. To tell them the layout we use the format string. It contains characters which are to be transferred - for example hello, place markers for values - for example %i for an integer, and control sequences for layout - \n for a newline.
Functional Design Specification
Large software developments follow a particular path, from the initial meeting right up to when the product is handed over. The precise path followed depends on the nature of the job and the techniques in use at the developer; however, all developments must start with a description of what the system is to do. This is the most crucial item in the whole project, and is often called the Functional Design Specification, or FDS.
Machine Code is the language which the processor of the computer actually understands. It contains a number of very simple operations, for example move an item from the processor into memory, or add one to an item in the processor. Each particular range of computer processors has its own specific machine code, which means that machine code written for one kind of machine cannot be easily used on another.
The object file contains the output of a compiler or an assembler and the names and types of variables used in that source file which the object was created from. It also contains references to things which were referred to in the source file but which were not present, for example library functions and external variables. The object file is acted on by the linker.
When applied to computer software, the more portable something is the easier it is to move it onto a different type of computer. Computers contain different kinds of processors and operating systems which can only run programs specifically written for them. A portable application is one which can be transferred to a new processor or operating system with relative ease. High Level languages tend to be portable, machine code is much harder to transfer.
You prepare a source file with a text editor of some kind. It is text which you want to pass through an assembler or a compiler to produce an object file for linking
The test harness will contain simulations of those portions of the input and output which the system being tested will use. You put your program into a test harness and then the program thinks it is in the completed system. A test harness is very useful when debugging as it removes the need for the complete system (for example a trawler!) when testing.