540 likes | 1.42k Views
Low-level Programming Language. Review on Machine Cycle. Long long time ago …. Each cycle includes four steps: Fetch Decode Execute Store => an instruction is executed (completed)!!. Register (accumulator). register. Instruction. Eg. 1011 1001 0011 0100 0001 0010. One instruction.
E N D
Review on Machine Cycle Long long time ago… • Each cycle includes four steps: • Fetch • Decode • Execute • Store • => aninstruction is executed (completed)!! Register (accumulator) register
Instruction Eg. 1011 1001 0011 0100 0001 0010 One instruction ~One machine cycle
Levels of programming language High level language(3GL,4GL) Low level language *Assembly language(2GLs) assembler *Machine language(1GLs) CPU
The format of an instruction 1st-generation language-Machine languages Eg. Load a value intoregister 8, taken from thememory cell 68cells after the location listed inregister 3 : [opcode|source|destination| memory address ] 35 3 8 68 decimal 100011 00011 01000 00000 00001 000100 binary Operands Opcode * The format of a instruction : opcode + operand(S)
1st-generation language-Machine languages The format of an instruction *Opcode : (operation code) -indicate the command (instruction) to be executed ~ NAME OF THE FUNCTION *Operands: -indicate the registers, values or memory addresses used in the function ~PARAMETER
1st-generation language-Machine languages Features: 1. Understood and executed by a computer at once - binary code =>tedious 2. Each statement represents one instruction => lengthy • * Machine-dependent Platform-dependent (each model of CPU has their own instruction set) Models of CPU (intel) Eg. X86 machine language 1011 1001 0011 0100 0001 0010
1st-generation language-Assembly language * The format of a instruction also consists : opcode + operand(S) Example : Set CX register to be 1234H Mov CX, 1234H Operands Opcode Opcode : makes use ofmnemonics (~memory aid) -”looks” like the meaning -symbolic and meaningful
Mnemonics For your reference only!
1st-generation language-Assembly language Features: 1. 1 instruction in assembly language = 1 instruction in machine language => still lengthy • Machine-dependent => not portable 3. Easier to be understand and remember (make use of meaningful codes like mnemonics)
Machine language V.S. Assembly language • Similarities • Lengthy • Machine independent • Low portability • Execute quickly • Difference • 2GLs uses meaningful codes • Easier to remember • Can be written comparatively efficiently • Less errors • 2GLs need to be translated before running
Application?? • Why learning assembly language is still a good idea? • system programs • driver programs • utility programs