1 / 17

Computer Architecture CST 250

Computer Architecture CST 250. Assembly Language Prepared by:Omar Hirzallah. Contents. Assembly Language Instruction Types Introduction to Programming With Assembly. Assembly Language.

Download Presentation

Computer Architecture CST 250

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. Computer ArchitectureCST 250 Assembly Language Prepared by:Omar Hirzallah

  2. Contents • Assembly Language • Instruction Types • Introduction to Programming With Assembly

  3. Assembly Language • An assembly language is a low-level programming language for a computer,microcontroller, or other programmable device, in which each statement corresponds to a single machine code instruction. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple systems.

  4. Instructions • Syntax of assembly language • Operation [operand] , [operand/number] Examples:

  5. Instructions • Syntax of assembly language • Operation [operand] , [operand/number] Examples:

  6. Instructions Examples:

  7. Instructions Examples:

  8. Instructions Examples:

  9. Instructions Examples: JUMP (Loops and if statements ) There are two : Conditional and Unconditional

  10. ALU Operation Examples: JUMP (Loops and if statements ) Unconditional jump used at any time without CMP Instruction Conditional jump are used after CMP Instruction

  11. Instruction types • Data transfer instructions: They move data from one register/memory location to another. 2. Arithmetic instructions: They perform arithmetical operations. 3. Logical instructions: They perform logical operations. 4. Control transfer instructions: They modify the program execution sequence. 5. Input/output (I/O) instructions: They transfer information between external peripherals and system components ( CPU/Memory) • Processor control instructions: They control processor operation.

  12. Example of : Arithmetic instruction Add register1, register2 Flags ALU Operation [ A ]

  13. Examples What will be the value of DX register after executing the following assembly code mov DX, 12 shl DX, 1 Add DX, 5 Mov CX, 40 Shr CX, 2 Add DX,CX

  14. Examples How many times the following code block will execute mov DX, 12 XYZ: Sub DX, 02 Add DX, 04 Mov CX, 34 And BX, 03 Xor DX, DX Cmp DX, 0 je XYZ

  15. Examples Write the assembly instruction that clears bit # 1,2,4,7 of CL Register Solution clear means make the bit value is 0 Remember X . 1 = X X . 0 = 0 and CL, 01101001b

  16. Examples Write the assembly instruction that sets bit # 1,2,4,7 of CL Register Solution Set means make the bit value is 1 Remember X + 1 = 1 X + 0 = X Or CL, 10010110b

  17. Examples Write the assembly instruction that changes bit # 1,2,4,7 of CL Register Solution Change means if value is 0 make it 1 and if value is 1 make it 0 Remember X + 1 = X’ X + 0 = X xor CL, 10010110b

More Related