1 / 13

Praktikum Organisasi Komputer (Jump)

Praktikum Organisasi Komputer (Jump). Departemen Ilmu Komputer FMIPA IPB 2006. Conditional Jump Instruction. A conditional jump instruction transfer control to a destination address when a flag condition is true J cond destination

cybill
Download Presentation

Praktikum Organisasi Komputer (Jump)

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. Praktikum Organisasi Komputer (Jump) Departemen Ilmu Komputer FMIPA IPB 2006

  2. Conditional Jump Instruction • A conditional jump instruction transfer control to a destination address when a flag condition is true Jcond destination • Destination address must be -128 to +127 bytes from the current location • Cond refer to flag condition, identifying the state of one or more flag

  3. flags are set by arithmetic, comparison, and boolean instruction. Each conditional jump instruction checks one or more flags, returning a result true or false. If the result is TRUE, otherwise, the program does nothing and continue to the next instruction.

  4. cmp ax, bx ; compare ax, bx je equal not equal : ; continue here if ax <> bx . . jmp exit equal : ; jump here if ax = bx ... exit : ; always end up here

  5. Case 1 : AX = 5 and BX = 5 • Case 2 : AX = 5 and BX = 5

  6. Table of Conditional Jump Instruction

  7. Example 1 : larger of two number • We might want to compare unsigned value in AX and BX and move the larger one to DX

  8. -a 100 13A1:0100 mov ax,50 13A1:0103 mov dx,ax 13A1:0105 mov bx,60 13A1:0108 cmp ax,bx 13A1:010A jae 10E 13A1:010C mov dx,bx 13A1:010E int 20 13A1:0110

  9. -a 100 13A1:0100 mov ax,50 13A1:0103 mov dx,ax 13A1:0105 mov bx,10 13A1:0108 cmp ax,bx 13A1:010A jae 10e 13A1:010C mov dx,bx 13A1:010E int 20 13A1:0110

  10. Latihan 1 • After the following instruction are executed, what will be the values of AL and BL ? -a 100 13A1:0100 mov al,6B 13A1:0102 mov bl,3F 13A1:0104 and ax,0FB6 13A1:0107 cmp al,bl 13A1:0109 ja 10F 13A1:010B mov al,bl 13A1:010D jmp 111 13A1:010F mov bl,al 13A1:0111 int 20 13A1:0113

  11. Latihan 2 • After the following instruction are executed, what will be the values of AL and BL ? -a 100 13A1:0100 mov al,3F 13A1:0102 mov bl,6B 13A1:0104 or bl,0F 13A1:0107 sub al,bl 13A1:0109 jb 10F 13A1:010B mov al,1 13A1:010D jmp 111 13A1:010F mov bl,1 13A1:0111 int 20 13A1:0113

  12. Tugas • Buat Program yang Membendingkan 3 bilangan di register al, bl, cl mana yang merupakan bilangan terkecil. Hasilnya di simpan dalam alamat 150, 151, 152 secara berurut mulai dari yang terkecil • Nilai awal dari al, bl, cl secara berurut adalah 27, 3, 11 • hasil di print screen berserta nama, nama kelompok dan nrp pada alamat 160(nama), 170(nama kelompok), • 180 (nrp) • Hint :Gunakan fungsi cmp dan jump

More Related