1 / 12

Chapter 7:

Chapter 7:. 22342 – Computer Organization & Assembly Language. Integer Arithmetic. Shift & Rotate Instructions. SHL (Shift Left) SHL reg , imm8 SHL mem , imm8 SHL reg , CL SHL mem , CL  In bit = 0, Out bit goes to CF SHR (Shift Right) ROL (Rotate Left) ROR (Rotate Right).

fleur
Download Presentation

Chapter 7:

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. Chapter 7: 22342 – Computer Organization & Assembly Language Integer Arithmetic

  2. Shift & Rotate Instructions • SHL (Shift Left) • SHL reg, imm8 • SHLmem, imm8 • SHL reg, CL • SHL mem, CL  In bit = 0, Out bit goes to CF • SHR (Shift Right) • ROL (Rotate Left) • ROR (Rotate Right)

  3. Arithmetic Shift Instructions • SAL (Shift Arithmetic Left) • Same as SHL • SAR (Shift Arithmetic Right) • SAR reg, imm8 • SARmem, imm8 • SARreg, CL • SAR mem, CL  In bit = SF, Out bit goes to CF

  4. Sign Extension Instructions • Convert Byte to Word • CBW • Convert Word to Double • CWD

  5. Addition & Subtraction • ADD Instruction • ADD reg, reg • ADD reg, mem • ADD reg, imm • ADD mem, reg • ADD mem, imm • SUB Instruction • INC Instruction • INC reg • INC mem • DEC Instruction

  6. Multiply Instruction • MUL (Unsigned Multiply) • IMUL (Signed Multiply) • MUL reg or IMUL reg • MUL mem or IMUL mem • 8-bit Multiply • 16-bit Multiply AL × 8-bit AX AX × 16-bit DX AX

  7. Multiply Instruction Program File Example: .Data Var1 DB 2 Var2 DB 3 Var3 DW 3 Var4 DW 4 .Code END

  8. Multiply Instruction Program File Example: .Data Var1 DB 2 Var2 DB - 3 Var3 DW - 3 Var4 DW 4 .Code END

  9. Divide Instruction • DIV (Unsigned Divide) • IDIV (Signed Divide) • DIV reg or IDIV reg • DIV mem or IDIV mem • 8-bit Divide • 16-bit Divide AL 8-bit AX AH AX DX AX 16-bit DX

  10. Divide Instruction Program File Example: .Data Var1 DB 20 Var2 DB 3 Var3 DW 45 Var4 DW 4 .Code END

  11. Divide Instruction Program File Example: .Data Var1 DB - 48 Var2 DB 5 Var3 DW - 1002 Var4 DW 249 .Code END

  12. Chapter 7

More Related