1 / 28

Assembly Programming Sir Joseph Lindo University of the Cordilleras

Assembly Programming Sir Joseph Lindo University of the Cordilleras. Assembly Programming. Registers. Section 1. Registers. Named storage locations inside the CPU, optimized for speed. High speed storage locations directly inside the MPU. Data. + and -. Assembly Programming.

lamont
Download Presentation

Assembly Programming Sir Joseph Lindo University of the Cordilleras

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembly Programming Sir Joseph Lindo University of the Cordilleras

  2. Assembly Programming Registers Section 1 Registers • Named storage locations inside the CPU, optimized for speed. • High speed storage locations directly inside the MPU Data + and -

  3. Assembly Programming Registers Section 1 Registers • There are 8 general purpose registers, 6 segment registers, Eflags registers and instruction pointers. Data + and -

  4. Assembly Programming Instruction Registers Data Data • Operand Types: • Immediate – a constant integer (8, 16, or 32 bits) • Register – the name of a register is converted to a number and encoded within the instruction • Memory – reference to a location in memory + and -

  5. Assembly Programming Data Transfer Mnemonics Registers Data Data + and -

  6. Assembly Programming Addition and Subtraction Registers Data + and - + and -

  7. Assembly Programming --end-- Sir Joseph Lindo University of the Cordilleras

  8. Assembly Programming --end na to-- Sir Joseph Lindo University of the Cordilleras

  9. Online Task CPU vs MPU Provide the differences between CPU and MPU. Post it as comment on our FB Group. (COAL) Due on February 21, 2012

  10. Registers General Purpose Registers Primarily used for arithmetic and data movement. Each register could be addressed as either 8, 16 or 32 bit value.

  11. Registers General Purpose Registers

  12. Data Transfer MOV Moves data fro source to destination Syntax: MOV destination,source Rules: Destination should not be an immediate operand

  13. Data Transfer MOV .data count BYTE 100 wVal WORD 2 .code movbl,count moval,wVal movax,wVal movcount,al movax,count moveax,count

  14. Data Transfer MOV

  15. Data Transfer XCHG XCHG exchanges the values of two operands. Syntax: XCHG operand1,operand2 Rules: At least one operand must be a register. No immediate operands are permitted.

  16. Data Transfer XCHG .data var1 WORD 1000h var2 WORD 2000h .code xchgax,bx xchgah,al xchg var1,bx xchg 3,100 xchgeax,ebx xchg var1,var2

  17. Data Transfer XCHG

  18. Add and Sub INC and DEC • Add 1, subtract 1 from destination operand • operand may be register or memory • INC destination • Logic: destination  destination + 1 • DEC destination • Logic: destination  destination – 1

  19. Add and Sub INC and DEC .data myWord WORD 1000h myDword DWORD 10000000h .code inc myWord decmyWord inc myDword mov ax,00FFh inc ax mov ax,00FFh inc al

  20. Add and Sub INC and DEC

  21. Add and Sub ADD and SUB • ADD destination, source • Logic: destination  destination + source • SUB destination, source • Logic: destination  destination – source • Same operand rules as for the MOV instruction

  22. Add and Sub ADD and SUB .data var1 DWORD 10000h var2 DWORD 20000h .code mov eax,var1 add eax,var2 add var2,var1 add ax,0FFFFh sub 1,2 sub var1,var2 add eax,1 sub ax,1

  23. Add and Sub ADD and SUB

  24. Comprehension Check MOV and XCHG

  25. Comprehension Check INC, DEC ADD and SUB

  26. Assembly Programming --end-- Sir Joseph Lindo University of the Cordilleras

  27. Back Integer Expressions

  28. INC and DEC MOV XCHG Directives Character and String Constants Reserved Word and Identifiers ADD and SUB More

More Related