Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
CHAPTER 3
INSTRUCTION SET AND ASSEMBLY
LANGUAGE PROGRAMMING
CLO 3: construct a simple program in assembly language
to perf...
3.1 UNDERSTANDING
INSTRUCTION SET AND
ASSEMBLY LANGUAGE
3.1.1 Define instruction set,machine
and assembly language
INSTRUCTION SET
• An instruction set is a list of commands read...
Machine Language
• A machine language sometimes referred to
as machine code or object code.
• Machine language is a collec...
Assembly Language
• Is a low-level programming
language for computers,microprocessors,
microcontrollers and other programm...
high Level
Programming
Low
Level
Programming
3.1.2 Describe features and architectures
of various type of microprocessor
MOTOROLA 6800
• The Motorola 68000 is a 32-bit...
INTEL 8086
• 8086 has 16-bit ALU; this means 16-bit
numbers are directly processed by 8086.
• It has 16-bit data bus, so i...
3.1.3 Describe the Addressing
Modes
• Many instructions, such as MOV, operates on
two operands.
– MOV dest, source
• Addre...
ADDRESSING MODES
1. Register Addressing
• Instruction gets its source data from a register.
• Data resulting from the operation is stored i...
1.Register Addressing
• Examples:
– MOV AX, BX ;Copy the 16-bit content of BX to
AX
– MOV AL, BL ;Copy the 8-bit content o...
2. Immediate Addressing
• The source data is coded directly into the
instruction.
– The term immediate means that the data...
3. Direct Addressing
• The operand is stored in a memory location, usually in
data segment.
• The instruction takes the of...
4. Register Indirect Addressing
• Similar to direct data addressing, except
that the offset address is specified using
an ...
5. Base-plus-index Addressing
• Similar to register indirect addressing, except
that the offset address is obtained by add...
6. Register Relative Addressing
• Similar to register indirect addressing,
except that the offset address is obtained
by a...
7. Base Relative-plus-index
Addressing
• Combines the base-plus-index addressing
and relative addressing.
• Examples:
– MO...
3.2 APPLY ASSEMBLY LANGUAGE
3.2.1 Write simple program in
assembly language
Example of assembly languange:
MOV CL, 55H ; move 55H into register CL
MOV...
3.2.2 Tool in analyzing and debugging
assembly language program
• Emulator 8086k –analyze for INTEL 8086
• Easy68k- analyz...
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Upcoming SlideShare
Loading in …5
×

Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING

60,371 views

Published on

3.1 UNDERSTANDING INSTRUCTION SET AND ASSEMBLY LANGUAGE
3.1.1 Define instruction set,machine and assembly language
3.1.2 Describe features and architectures of various type of microprocessor
3.1.3 Describe the Addressing Modes

3.2 APPLY ASSEMBLY LANGUAGE
3.2.1 Write simple program in assembly language
3.2.2 Tool in analyzing and debugging assembly language program

Published in: Technology
  • I also order from www.HelpWriting.net
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Writing good research paper is quite easy and very difficult simultaneously. It depends on the individual skill set also. You can get help from research paper writing. Check out, please ⇒ www.HelpWriting.net ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Don't forget another good way of simplifying your writing is using external resources (such as ⇒ www.WritePaper.info ⇐ ). This will definitely make your life more easier
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Don't forget another good way of simplifying your writing is using external resources (such as ⇒ www.HelpWriting.net ⇐ ). This will definitely make your life more easier
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Legitimate top paying survey, 》》》 https://t.cn/A6ybK1ra
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING

  1. 1. CHAPTER 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING CLO 3: construct a simple program in assembly language to perform a given task Summary : This topic introduces the instruction set, data format, addressing modes, status flag and assembly language programming. RTA: (06 : 06)
  2. 2. 3.1 UNDERSTANDING INSTRUCTION SET AND ASSEMBLY LANGUAGE
  3. 3. 3.1.1 Define instruction set,machine and assembly language INSTRUCTION SET • An instruction set is a list of commands ready to be executed directly by CPU. • We can simply say that the functions of instruction set is to instruct all CPU's with a set of instruction that can – tells the CPU where to find data – when to read the data – what to do with the data Now we will see some of the type of instruction set. • Data transfer instruction • Arithmetic instruction • Logical instruction and bit manipulation • Program control instruction • Processing control instruction • Shift and rotate instruction
  4. 4. Machine Language • A machine language sometimes referred to as machine code or object code. • Machine language is a collection of binary digits or bits that the computer reads and interprets. • Machine language is the only language a computer is capable of understanding. • Machine language consists of 0s and 1s.
  5. 5. Assembly Language • Is a low-level programming language for computers,microprocessors, microcontrollers and other programmable devices. • Assembly language is just one level higher than machine language. – Assembly language consists of simple codes. – Each statement in an assembly language corresponds directly to a machine code understood by the microprocessor. • The software used to convert an assembly program into machines codes is called an assembler.
  6. 6. high Level Programming Low Level Programming
  7. 7. 3.1.2 Describe features and architectures of various type of microprocessor MOTOROLA 6800 • The Motorola 68000 is a 32-bit CISC microprocessor. • 24 bit address bus • 16 bit data bus.
  8. 8. INTEL 8086 • 8086 has 16-bit ALU; this means 16-bit numbers are directly processed by 8086. • It has 16-bit data bus, so it can read data or write data to memory or I/O ports either 16 bits or 8 bits at a time. • It has 20 address lines, so it can address up to 220 i.e. 1048576 = 1Mbytes of memory (words i.e. 16 bit numbers are stored in consecutive memory locations).
  9. 9. 3.1.3 Describe the Addressing Modes • Many instructions, such as MOV, operates on two operands. – MOV dest, source • Addressing mode indicates where the operands are located. • There are various addressing modes in x86. – Register, immediate, direct, register indirect, base- plus-index, register relative, base relative-plus- index,  Register is a storage element inside a microprocessor.
  10. 10. ADDRESSING MODES
  11. 11. 1. Register Addressing • Instruction gets its source data from a register. • Data resulting from the operation is stored in another register. • Data length depends on register being used. – 8-bit registers: AH, AL, BH, BL, CH, CL, DH, DL. – 16-bit registers: AX, BX, CX, DX, SP, BP, SI, DI. – 32-bit registers: EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI. – 64-bit registers: RAX, RBX, RCX, RDX, RSP, RBP, RDI, RSI, and R8 through R15.
  12. 12. 1.Register Addressing • Examples: – MOV AX, BX ;Copy the 16-bit content of BX to AX – MOV AL, BL ;Copy the 8-bit content of BL to AL – MOV SI, DI ;Copy DI into SI – MOV DS, AX ;Copy AX into DS • Note that the instruction must use registers of the same size. – Cannot mix between 8-bit and 16-bit registers. – Will result in an error when assembled.
  13. 13. 2. Immediate Addressing • The source data is coded directly into the instruction. – The term immediate means that the data immediately follows the hexadecimal opcode in the memory. • Immediate data are constant data such as a number, a character, or an arithmetic expression. • Examples: – MOV AX, 100 – MOV BX, 189CH – MOV AH, 10110110B – MOV AL, (2 + 3)/5
  14. 14. 3. Direct Addressing • The operand is stored in a memory location, usually in data segment. • The instruction takes the offset address. – This offset address must be put in a bracket [ ]. • Example: – MOV [1234H], AL – The actual memory location is obtained by combining the offset address with the segment address in the segment register DS (unless specified otherwise) – If we want to use another segment register such as ES, you can use the syntax ES:[1234H] – Assuming DS = 1000H, then this instruction will move the content of AL into the memory location 1234H.
  15. 15. 4. Register Indirect Addressing • Similar to direct data addressing, except that the offset address is specified using an index or base register. – Base registers = BP, BX. Index registers = DI, SI. – In 80386 and above, any register (EAX, EBX, ECX, EDX, EBP, EDI, ESI) can store the offset address. – The registers must be specified using a bracket [ ]. – DS is used as the default segment register for BX, DI and SI. • Example: – MOV AX, [BX] – Assuming DS = 1000H and BX = 1234H, this instruction will move the content memory location 11234H and 11235H into AX.
  16. 16. 5. Base-plus-index Addressing • Similar to register indirect addressing, except that the offset address is obtained by adding a base register (BP, BX) and an index register (DI, SI). • Example: – MOV [BX+SI], BP – Assuming DS = 1000H, BX = 0300H and SI = 0200H, this instruction will move the content of register BP to memory location 10500H.
  17. 17. 6. Register Relative Addressing • Similar to register indirect addressing, except that the offset address is obtained by adding an index or base register with a displacement. • Example 1: – MOV AX, [DI+100H] – Assuming DS = 1000H and DI = 0300H, this instruction will move the content from memory location 10400H into AX. • Example 2: – MOV ARRAY[SI], BL – Assuming DS = 1000H, ARRAY = 5000H and SI = 500H, this instruction will move the content in register BL to memory location 15500H.
  18. 18. 7. Base Relative-plus-index Addressing • Combines the base-plus-index addressing and relative addressing. • Examples: – MOV AH, [BX+DI+20H] – MOV FILE[BX+DI], AX – MOV LIST[BP+SI+4], AL
  19. 19. 3.2 APPLY ASSEMBLY LANGUAGE
  20. 20. 3.2.1 Write simple program in assembly language Example of assembly languange: MOV CL, 55H ; move 55H into register CL MOV DL, CL ; copy the contents of CL into DL (now DL=CL=55H) MOV AH, DL ; copy the contents of DL into AH (now AH=CL=55H) MOV AL, AH ; copy the contents of AH into AL (now AL=AH=55H) MOV BH, CL ; copy the contents of CL into BH (now BH=CL=55H) MOV CH, BH ; copy the contents of BH into CH (now CH=BH=55H) HLT
  21. 21. 3.2.2 Tool in analyzing and debugging assembly language program • Emulator 8086k –analyze for INTEL 8086 • Easy68k- analyze for MOTOROLA 6800

×