The are many different programming language, such as Python, Java, C# and even scratch, these languages are known as High Level Languages, they are relatively easy from humans to understand, they follow a similar flow of loops and iterations, and just a small step from structured English to pseudocode to a high level language such as Python. On the opposite end of the scale is Machine code, this is the 1s and 0s as pass through the processor to represent circuit switches and logical operators, Machine code would be very time consuming for a human to interpret and extremely time consuming to program in binary. An intermediate stage is Assembly language , it is relatively easy to understand and whilst a little time consuming, writing a program in assembly language is realistically possible. Furthermore to have the ability to understand and program in assembly language can lead to very efficient programs, because maximum efficiency of the processor workings can be considered.
Various makes and models of processors have their own instruction set, with instructions such as load data, store data, compare date and many more. The instruction set can be represented in machine code and in assembly code, below is a table showing frequently use instruction set instructions, shown in assembly language.
Instruction set from Cambridge International AS and A level Computer Science 9608, 2017, 2018, 2019 Syllabus
An example of how these instructions are processed using the fetch, decode, execute cycle can be seen in this video. Click Here (HurrayBanana, Published on Oct 11, 2013)
Addressing methods As can be seen in the table above there are various different types of memory addressing mentioned, including the following:
Other addressing methods to review are:
Symbolic and Absolute addressing
Before we can discuss how each type of memory addressing works we first need to understand how an instruction is broken down into two main parts within the machine code instruction, the opcode and the operand. The opcode is the first part of the instruction and will usually hold the instruction name/type. The operand holds the data or the address that holds the data. Whilst the amount of BITs used for the opcode and operand will vary between machines, for the purpose of this study we will use 24 BITs or 3 Bytes to illustrate a machine code instruction. This video gives a clear guidance ono the different addressing methods: Click Here ( Computer Science, Nov 27 2018) Immediate addressing This is when the the processor receives the opcode first followed by data to be manipulated immediately after. When looking at the Von Neumann architecture the opcode will be loaded to CIR (Current Instruction Register) first immediately followed by the data to be manipulated.
Implied addressing With implied addressing there is a presumption (or it is implied) that data to be manipulated is already in the location where it will need to be when a particular part of the program points to that piece of location. An implied addressing instruction may not have an operand in assembly language as it only needs to point to the location that holds the operand. A little bit like setting up a variable before you use it.
Polish notation and Reverse Polish notation In normal mathematic expressions the operator has an infix position for example in addition the plus sign + is noted in between the two numbers. For example: 5 + 4
However it is often inefficient for the processor to process a calculation in this way, therefore Polish notation is used. Polish notation simply places the operator before the numbers to process. For Example + 5 4. With reverse polish notation the operator will be placed a after the numbers to process, for example 5 4 +
All three expressions above yield the same result: 5 + 4 = 9 + 5 4 = 9 (Polish Notation) 5 4 + = 9 (Reverse Polish Notation)
Using parentheses (or parentheses binary notation) is not efficient for the processor. In the expression below the parentheses are moved and reverse polish notation is used to give the same result. The processor needs to process calculations in a simple left to right order, when we as humans calculate infix expressions we will look for the parentheses, work these parts out first then go back and work out the rest and put the calculation together, the process of going back to part of a calculation is not very effective for the process and how the data is fed to the processor in the form of a stack mean that the ability to calculate in one single left to right flow of data is the most effective way for the processor to work. (5 + 4) * 7 = 63 In Reverse Polish Notation: 5 4 + 7 *
For further information on RPN Click Here to watch ( AQA A’Level Reverse Polish Notation - Part 1, by, craigndave Published on Feb 7, 2018.)
Further information can be found here ( Assembly language and machine code - Gary explains!)
Examples of Reverse Polish Notation
What is the difference between a high-level and a low-level programming language?
How does assembly language differ from a high-level language like Python?
What are the advantages and disadvantages of using assembly language in comparison to high-level languages?
How does an assembler translate assembly language into machine code?
What is the purpose of assembly language in the computer programming process?
Can high-level languages be translated directly into machine code, or do they need to be assembled first?
What is the concept of machine independence in low level programming languages?
How does assembly language provide more control over a computer's hardware than a high-level language?
What are some common tasks that are easier to perform in assembly language compared to high-level languages?
How has the use of assembly language changed with the advent of higher-level programming languages and more advanced hardware?