1 / 14

Lab 3

Lab 3. LEA Instruction, JMP, CMP, Conditional Jump, Loop. LEA Instruction. LEA. Unconditional Jumps – JMP Instruction. JMP destination_lable LABEL1:. Conditional Jumps – Signed Jumps. Conditional Jumps – Unsigned Jumps. Conditional Jumps – Single Flag Jumps. CMP Instruction.

Download Presentation

Lab 3

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. Lab 3 LEA Instruction, JMP, CMP, Conditional Jump, Loop

  2. LEA Instruction • LEA

  3. Unconditional Jumps – JMP Instruction • JMP destination_lable • LABEL1:

  4. Conditional Jumps – Signed Jumps

  5. Conditional Jumps – Unsigned Jumps

  6. Conditional Jumps – Single Flag Jumps

  7. CMP Instruction CMP destination, source • Just like SUB but the destination does not change. • Changes the Flags • Used with conditional jumps

  8. Example – IF, THEN, ELSE • Suppose AL and BL contain extended ASCII characters,Display the one that comes first in the character sequence

  9. Example – AND condition • Read a character, and if it’s an uppercase letter, Accept it

  10. Example – OR Condition • Read a character. If it’s 'y' or 'Y', display it; otherwise, terminate the program.

  11. LOOP Instruction LOOP destination_Label Display a row of 80 stars

  12. Example – While Loop • Count number of characters entered and terminate if carriage return is entered.

  13. Example – Repeat Loop • Read characters until a blank is read terminate.

  14. Exercises • Read characters from user and count the number of characters if they reached 30 display a message “The Program Cannot Accept anymore characters.” • org 100h • MOV AH,1 ;PREPARE function TO read • MOV CL,0 ;clear the register to count • GO_TOP: • INT 21H ;execute function • INC CL ;increment to count the number of characters entered • CMP CL,30 ;compare if CL equals 30 to break out the loop • JE DISPLAY_MSG ;jumping to display to show • JMP GO_TOP • DISPLAY_MSG: • MOV AH,9 • LEA DX,MESG • INT 21H • ret • MESG DB 0DH,0AH,"The Program Cannot Accept anymore characters$"

More Related