Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

QUIZ. Berapakah nilai hexadecimal dari destination operand pada setiap instruksi ? (Jika terdapat instruksi yang ERROR atau ILLEGAL, tuliskan ERROR atau.

Presentasi serupa


Presentasi berjudul: "QUIZ. Berapakah nilai hexadecimal dari destination operand pada setiap instruksi ? (Jika terdapat instruksi yang ERROR atau ILLEGAL, tuliskan ERROR atau."— Transcript presentasi:

1 QUIZ

2 Berapakah nilai hexadecimal dari destination operand pada setiap instruksi ? (Jika terdapat instruksi yang ERROR atau ILLEGAL, tuliskan ERROR atau ILLEGAL sebagai jawaban !) InstructionBeforeAfter Mov ax,bxAX=0022 BX=00A6AX=00A6 Mov ah,3AX=06AFAX=03AF Mov bl,axBX=00A5 AX=4000BL=ERR Mov di,100DI=06E9DI=0100 Mov ds,cxDS=0FB2 CX=0020DS=ERR Mov ah,blAX=0023 BX=00A5AX=A523 Add ah,3AX=06AFAX=09AF Inc blBX=FFFFBX=FF00 Add di,100DI=06E9DI=07E9 Dec cxCX=0000CX=FFFF

3 Berapakah nilai hexadecimal dari destination operand pada setiap instruksi ? (Jika terdapat instruksi yang ERROR atau ILLEGAL, tuliskan ERROR atau ILLEGAL sebagai jawaban !) InstructionBeforeAfter Mov ax,bxAX=0022 BX=00A6AX= Mov ah,3AX=06AFAX= Mov bl,axBX=00A5 AX=4000BL= Mov di,100DI=06E9DI= Mov ds,cxDS=0FB2 CX=0020DS= Mov ah,blAX=0023 BX=00A5AX= Add ah,3AX=06AFAX= Inc blBX=FFFFBX= Add di,100DI=06E9DI= Dec cxCX=0000CX=

4 Departemen Ilmu Komputer FMIPA IPB 2006

5 Perkalian dan Pembagian Integer MUL dan DIV Semua operand diasumsikan biner MUL dan DIV digunakan untuk unsigned binary integers, IMUL (integer MUL) dan IDIV (integer DIV) digunakan untuk signed binary integers

6 MUL (Perkalian) MUL source Merupakan operasi perkalian 8-bit atau 16-bit operand dengan AL atau AX Souce operand bisa berupa register atau memory operand, tetapi tidak boleh immediate data MUL reg16 → reg16 * AX MUL reg8 → reg8 * AL Hasil: Reg16 High byte (bit 16-31) → DX Low byte (bit 0-15) → AX Reg8: AX

7 Contoh MUL Multiply AL dengan 10h mov al,5 mov bl,10 mul bl; AX = 0050h Multiply AX dengan 10h mov ax,2000 mov bx,0010 mul bx

8 DIV (Pembagian) DIV source Merupakan operasi pembagian 8-bit atau 16-bit operand dengan AL atau AX DIV reg16 → DX:AX / reg16 DIV reg8 → AX / reg8 Output: Reg16 Hasil bagi → AX Sisa → DX Reg8 Hasil bagi → AL Sisa → AH Keterangan: hasil bagi tidak boleh melebihi register

9 Contoh DIV DIV dengan reg 8-bit mov ax,0083 mov bl,2 div bl DIV dengan reg 16-bit mov dx,0 mov ax,8003 mov cx,100 div cx

10 Instruksi Boolean AND op1, op2 → op1 = op1 AND op2 AND Destination, Source OR op1, op2 → op1 = op1 OR op2 OR Destination, Source XOR op1, op2 → op1 = op1 XOR op2 XOR Destination, Source NOT op1 → op1 = NOT op1 NOT Destination NEG op1 → op1 = -op1 NEG Destination op1 dan op2 pada AND, OR, dan XOR harus berukuran sama, dan hanya boleh salah satu op yang merupakan memory operand.

11 AND -a 100 1373:0100 mov al,01 1373:0102 and al,00 1373:0104 R T

12 OR -a 100 1373:0100 mov al,01 1373:0102 or al,FE 1373:0104 R T

13 XOR -a 100 1373:0100 mov al,B4 1373:0102 xor al,86 1373:0104 R T

14 NOT -a 100 1373:0100 mov al,23 1373:0102 not al 1373:0104 R T

15 NOT -a 100 1373:0100 mov al,23 1373:0102 not ax 1373:0104 R T

16 NEG -a 100 1373:0100 mov al,12 1373:0102 neg al atau neg ax 1373:0104 R T

17 Perbandingan CMP Instruction CMP destination, source  membandingkan dua buah operand 8-bit atau 16-bit (sama seperti operasi pengurangan) Hasil dapat diamati pada FLAG Reg After CMPFlag Result Destination < SourceCF = 1 Destination = SourceZF = 1 Destination > SourceCF = 0, ZF = 0

18 CMP 1 -a100 1373:0100 mov al,5 1373:0102 cmp al,10 R T

19 CMP 2 -a100 1373:0100 mov ax,ABCD 1373:0102 cmp ax,abcd R T

20 CMP 3 -a100 1373:0100 mov si,105 1373:0102 cmp si,0 R T

21 Latihan Setelah instruksi di bawah ini dieksekusi, berapakah nilai CX, DX dan SI? -a150 1373:0150 dw 026a,3fd9 -a100 1373:0100 mov si,0 1373:0103 mov cx,[150] 1373:0107 mov dx,[152] 1373:010B and cx,00ff 1373:010F not dx 1373:0111 xchg dx,[150] 1373:0115 inc si 1373:0116 dec dx 1373:0117 loop 115 1373:0119


Download ppt "QUIZ. Berapakah nilai hexadecimal dari destination operand pada setiap instruksi ? (Jika terdapat instruksi yang ERROR atau ILLEGAL, tuliskan ERROR atau."

Presentasi serupa


Iklan oleh Google