Thiết kế và lập trình hệ thống - Chương 22

11 333 0
Thiết kế và lập trình hệ thống - Chương 22

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Thiết kế và lập trình hệ thống - Chương

Systems Design & Programming 80x86 Assembly IV CMPE 3101 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Intel Assembly Systems Design & Programming 80x86 Assembly IV CMPE 3102 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Arithmetic Operationsadd al, [ARRAY + esi];Adds 1 to any reg/mem except seginc byte [edi];Adds registers + Carry flag.adc ecx, ebx;ecx=ecx+ebx, ebx=original ecx.xadd ecx, ebx;Used for adding 64 bit nums. Systems Design & Programming 80x86 Assembly IV CMPE 3103 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Arithmetic Operationssub eax, ebxdec edi;Subs registers - Carry flag.sbb ecx, ebx;eax=eax-ebxcmp al, 10Hjae LABEL1;Jump if equal or below.jbe LABEL2;if ecx==eax, eax=edx else eax=ecxcmpxchg ecx, edx;Jump if equal or above. Systems Design & Programming 80x86 Assembly IV CMPE 3104 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Arithmetic Operationsmul blimul bx;Special, cx=dx*12H (signed only)imul cx, dx, 12H;edx|eax=eax*ecxmul ecx;ax=al*bl (unsigned);dx|ax=ax*bx (signed)div cl;dx|ax=(dx|ax)/cxidiv cx;ah|al=ax/cl, unsigned quotient; in al, remainder in ah Systems Design & Programming 80x86 Assembly IV CMPE 3105 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Logic OperationsXXXX XXXX Operand0000 1111 Mask0000 XXXX Resultand al, bl ;al=al AND blXXXX XXXX Operand0000 1111 MaskXXXX 1111 Resultor eax, 10 ;eax=eax OR 0000000AH Systems Design & Programming 80x86 Assembly IV CMPE 3106 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Logic OperationsXXXX XXXX Operand0000 1111 MaskXXXX XXXX Resultxor ah, ch ;ah=ah XOR chtest al, 4jz LABEL;Jump to LABEL if bit 2 is zero.;Tests bit 2 in al -- 00000100not ebxneg TEMP Systems Design & Programming 80x86 Assembly IV CMPE 3107 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Logic Operationsshl eax, 1sar esi, cl;eax is logically shifted left 1 bit pos.;esi is arithmetically shifted rightshdr eax, ebx, 12 ;eax shifted right by 12 and filled;from the left with the rightshdl ax, bx, 14;12 bits of ebx.rol si, 14rcr bl, cl;si rotated left by 14 places.;bl rotated right cl places through carry.shl ax, 1 ;Original 48-bit number in dx, bx and ax.;Shift ax left 1 binary place.rcl bx, 1;Rotate carry bit from previous shl into;low order bit of bx.rcl dx, 1;Rotate carry bit from previous rcl in dx. Systems Design & Programming 80x86 Assembly IV CMPE 3108 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Bit/String Scanbsl ebx, eaxbsr bl, cl;eax scanned from the left.;cl scanned from the right. Systems Design & Programming 80x86 Assembly IV CMPE 3109 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6jmp short NEXTNEXT: add ax, bx;short keyword is optional.jmp near eax ;Jump to address given by eax.jmp [eax] ;Jump to address given by [ax].jmp far LABEL ;Jump to address given by LABEL. Systems Design & Programming 80x86 Assembly IV CMPE 31010 (Mar. 1, 2002)UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6Flow-of-Control Instructionsja ;Jump if above (Z=0 and C=0);Jump if below or equal (Z=1 or C=1)jbe;Jump if >= (S=O)jge;Jump if < (S<>O)jl;Jump if != (Z=0)jne;Jump if ==; or jump if zero (Z=1)je or jz;Jump if carry set (C=1)jc;Jump if cx==0jcxz;Jump if ecx==0jecxz [...]... CMPE 310 UMBC 11 (Mar 1, 2002) ;Set al=1 if >than (test Z==0 AND S==0) ;else set al to 0 loop LABEL ;Jump if ecx != 0 loope ;Jump if (Z = 1 AND ecx != 0) loopne ;Jump if (Z = 0 AND ecx != 0) setg al Flow-of-Control Instructions Systems Design & Programming 80x86 Assembly IV MO UN TI RE COUNT Y . 6 6Arithmetic Operationssub eax, ebxdec edi;Subs registers - Carry flag.sbb ecx, ebx;eax=eax-ebxcmp al, 10Hjae LABEL1;Jump if equal or below.jbe LABEL2;if. XOR chtest al, 4jz LABEL;Jump to LABEL if bit 2 is zero.;Tests bit 2 in al -- 00000100not ebxneg TEMP Systems Design & Programming 80x86 Assembly IV

Ngày đăng: 15/11/2012, 11:07

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan