Presentation on theme: "Assembly & Machine Languages"— Presentation transcript:
1 Assembly & Machine Languages A Brief OverviewJonathan-LeeJones
2 Overview of the Module What operations can a computer can perform The Pep/8 virtual machineImmediate and direct addressing modesWriting simple machine-language programsMachine language and assembly languageCreating and running an assembly-language programWriting simple programs using the Pep/8 virtual machineConcept of assembler instructions
3 What operations can a computer can perform Interact with I/Oreading inputWriting outputreading the program (in memory)reading constant values (in memory)reading and writing variables (in memory)Executing instructions in machine language
5 Differences between machine language and assembly language The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer
6 Differences between machine language and assembly language This is very hard to understand by a human. It is a series of numbers, originally binary, but hexadecimal is more common today.
7 Differences between machine language and assembly language This originated from the early days of computing, where there were limited mechanisms of input; such as punched cards and even just a series of dials and switches.
8 Differences between machine language and assembly language A language that uses mnemonic codes to represent machine-language instructionsMuch easier for the human to understand and read – though nowhere near as easy as high level languages.Harder for the computer to read! Requires and assembler to use. An assembler is program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent
9 Machine LanguageMachine language – The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computerEvery processor type has its own set of specific machine instructions.The relationship between the processor and the instructions it can carry out is completely integrated.Each machine-language instruction does only one very low-level task Typically we have one instruction per “word”Types of Instructiondata movement data processingop-code – what operation is requiredsource 1 – operand 1source 2 – operand 2destinationflow control (jumps)
10 Machine Language Types of Instruction Data Processing Flow control op-code – what operation is requiredsource 1 – operand 1 source 2 – operand 2 destinationFlow controlBranch (jump to address)Conditional Branch (tests values)Subroutine CallsReturn(from Subroutine)Data Move(actually a copy not a move)
11 Machine LanguageProcessing instructionsHow many bits required? addresses of operands and resultsassume a 32 bit address for memory this would allow for 232 bytes of addressable memory this would need 96 bits for the addresses in an instructionlets suppose 16 bits for the op-code (216 instructions) Each instruction is 112 bits !!
13 PEP/8 Virtual Computer Instruction Format Operation code – Specifies which instruction is to be carried outRegister specifier – Specifies which register is to be used (we will only use A for the moment)Addressing-mode specifier – Says how to interpret the operand part of the instruction
14 PEP/8 Virtual Computer Some Sample Instructions 0000 Stop Execution 1100 Load operand to A Register1110 Store contents of A Register into operand0111 Add operand to A Register1000 Subtract operand to A Register01001 Input character to operand01010 Output character from operandDirect Addressing mode 000Indirect addressing mode 001
15 Programming in Assembly Language Program in assembly languageInputOutputProgram in machinelanguageAssembler