Download presentation
1
Assembly Language
2
Computer language hierarchy
High Level Language Assembly language Machine language Compiled or interpreted One statement maps to one or more assembly language statement Assembled One statement maps to one machine language instruction Loaded directly into the processor memory One statement maps to one or more RTL statements
3
Computer language hierarchy
You can toss in the scripting languages (PERL, Python, PHP, VBScript…) You can toss in the interpreted languages (BASIC, Haskell, Lisp, Forth) And other categories The seem to fit somewhere between HLL and Assembly but don’t run directly on the hardware (virtual machine/interpreter)
4
Assembly language This is as close as you ever get to the hardware (without actually keying in binary values – which no one ever does anymore) Requires a major shift in mindset from programming HLLs
5
Programming In HLL programming you concern yourself with variables, datatypes, and control statements int, float, char, if, for, while, arrays, etc. In assembly language programming you concern yourself with memory and instruction RAM, ROM, registers, instruction classes, addressing modes
6
Programming In HLL programming you concern yourself with keywords and grammars Statements, expressions, etc. In assembly language programming you concern yourself with mnemonics and circuit components Instruction names, arithmetic units, control units, etc.
7
Programming In HLL programming you sit down with a “how to” textbook to guide you In assembly language programming you sit down with a chip specification document to guide you
8
Programming In HLL programming you might be able to estimate how long a program will take to run and how much memory it will use In assembly language programming you can calculate how long a program will take to run and how much memory it will use
9
Assembly programming You must have an understanding of the architecture on which you are running your program Each architecture [or family] has it’s own assembly language The language is intimately tied to the design of the architecture
10
The 8051 architecture 8-bit CPU with A (accumulator) and B registers
16-bit program counter and data pointer 8-bit program status word 8-bit stack pointer Internal ROM Internal RAM Four register banks of 8 registers each Sixteen bytes of bit addressable locations Eighty bytes of general purpose data memory Thirty two input/output pins Two 16-bit timer/counters Various control registers Serial port Interrupt sources
11
The 8051 instruction set Instruction classes Arithmetic operations
Logical operations Data transfer Boolean variable manipulation Program branching
12
The 8051 instruction set The processor status word (PSW) Carry flag
Auxiliary carry flag General purpose flags (2) Register bank selector (2 bits) Overflow flag Parity flag
13
The 8051 instruction set Addressing modes Register Direct
Indirect-register Constant 8-bit Constant 16-bit Address 16-bit Address 11-bit Relative Bit
14
Addressing modes Rn where 0 ≤ n ≤ 7 – the contents of register n; 0x00 (or other hex number) – the contents of a memory location @Ri where 0 ≤ i ≤ 1 – indirect, register holds the memory address #0x00 (or other hex number) – 8-bit constant number #0x00 16 (or other hex number) – 16-bit constant number There are a few others but these are the most commonly used modes
15
Data transfer instructions
MOV op-code Various operands dependant on desired addressing mode Some examples: MOV A, R0 ; A = R0 MOV A, #0x00 ; A = 0 MOV A, 0x00 ; A = memory[0] MOV ; A = memory[R0] MOV R0, A ; R0 = A
16
Simulator We don’t have an 8051 processor
The next best thing is a simulator Download EdSim51 from EdSim51 This is a Java executable (.jar) file that runs on both Windows and MacOS Documentation is available on the download site
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.