Types of Programming Languages (2)

Get Started. It's Free
or sign up with your email address
Types of Programming Languages (2) by Mind Map: Types of Programming Languages (2)

1. Assembly Language

1.1. A low level language is one whose programming statements are geared towards a particular CPU family, such as the intel x86 family of processors. Low level languages are almost (Not quite) machine code. Assembly Language is a low level language.

1.1.1. - They are CPU specific, making direct use of internal registers. - 'Mnemonics" are used as programming. code such as MOV or ADD. - Many different memory modes can be used. - Labels are used as reference points to allow the code to jump from one part to another.

1.1.2. Pros - Low level languages are excellent for close control of the CPU, for example device drivers are coded in assembly language. - They can be efficient. Well optimised code written in a low level language can be made to run very quickly compared to code written in a high level language.

1.1.3. Cons - They are difficult to use as the programming commands can be quite obscure. - A good assembly language programmer needs to know a lot of detail about the internal structure of the CPU (register etc.) - Low level languages produce the least portable source code.

2. Modes of addressing memory: There are many ways to locate data and instructions in memory and these methods are called 'memory address modes' Memory address modes determine the method used within the program to access data either from within the CPU or external RAM. Some memory addressing modes can control program flow.

2.1. Indirect Addressing

2.1.1. Indirect addressing means that the address of the data is held in an intermediate location so that the address is first 'looked up' and then used to locate the data itself. Many programs make use of software libraries that get loaded into memory at run time by the loader. The loader will most likely place the library in a different memory location each time. So how does a programmer access the subroutines within the library if he does not know the starting address of each routine? Answer: Indirect Addressing

2.2. Indexed Addressing

2.2.1. Indexed addressing means that the final address for the data is determined by adding an offset to a base address. Very often, a chunk of data is stored as a complete block in memory. For example, it makes sense to store arrays as contiguous (Next to without a gap). The array has a 'base address' which is the location of the first element, then an 'index' is used that adds an offset to the base address in order to fetch any other element within the array. Index addressing is fast and is excellent for manipulating data structures such as arrays as all you need to do is set up a base address then use the index in your code to access individual elements. Another pro of indexed is that if the array is re-loacted in memory at any point then then only the base address needs to be changed. The code making used remain the same.

3. Modes of Addressing

3.1. Immediate Addressing

3.1.1. Immediate addressing means that the data to be used is hard-coded into the instruction itself. This is the fastest method of addressing, as it does not involve main memory at all. For example, you want to add 2 to the content of the accumulator. The instruction is: ADC 2 Nothing has been fetched from memory, the instruction simply adds 2 to the accumulator. Immediate Addressing is very useful to carry out instructions involving constants (as opposed to variables). For example you might want to use 'PI' as a constant 3.14 within code.

3.2. Direct Addressing

3.2.1. This is a very simple way of addressing the memory - direct addressing means the code refers directly to location in memory. For example: SUB (3001) In this instance the value held at the absolute location 3001 in RAM is subtracted from the accumulator. The good thing about direct addressing is that it is fast (But not as fast as immediate addressing) the bad thing about direct addressing is that the code depends on the correct data always being presented at same location. You can use direct addressing on computers that are only running a single program.