1 / 9

CSC2510 - Computer Organization

CSC2510 - Computer Organization. Lecture 6: Pentium IA-32 Additional slides. Conditional jumps. DEC ECX JG STARTADD JG relates to results of the most recently executed data manipulation instruction (in this case DEC ECX) Jumps if result was > 0 (ECX > 0 in this case)

sarah
Download Presentation

CSC2510 - Computer Organization

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. CSC2510 - Computer Organization Lecture 6: Pentium IA-32 Additional slides

  2. Conditional jumps DEC ECX JG STARTADD • JG relates to results of the most recently executed data manipulation instruction (in this case DEC ECX) • Jumps if result was > 0 (ECX > 0 in this case) • Assume STARTADD was 1000 and address after the JG is 1007, relative address is -7 and is stored in the instruction • Since only one byte is used, jump range is -128 to 127. A 4-byte offset is used if the address is outside this range • Other jumps such as jump if equal to 0 (JZ or JE), jump if sign bit is set (i.e. result was negative JS) etc

  3. Compare Instruction • CMP dst,src • [dst]-[src] • Only used to set condition codes • Neither operand changed

  4. Unconditional jump • JMP ADDR • One byte or four byte offset forms just list JG • More powerful addressing modes also allowed e.g. JMP [JUMPTABLE+ESI*4] (index with displacement)

  5. Logical/Shift/Rotate • AND EBX,EAX • E.g. if EAX=0000FFFFH and EBX=02FA62CAH what is the result? • NOT EBX • SHL dst,count • Also SHR, SAL (same as SHL), SAR • ROL, ROR, RCL, RCR

  6. LEA EBP ,LOC EBP p oin ts to first b yte. MO V AL,[EBP] Load first b yte in to AL. SHL AL,4 Shift left b y 4 bit p ositions. MO V BL,[EBP+1] Load second b yte in to BL. AND BL,0FH Clear high-order 4 bits to zero. OR AL,BL Concatenate the BCD digits. MO V P A CKED,AL Store the result. Digit Packing

  7. I/O Operations • READWAIT BT INSTATUS,3 JNC READWAIT MOV AL,DATAIN ; BT transfers INSTATUS bit 3 to the carry flag • WRITEWAIT BT OUTSTATUS,3 JNC WRITEWAIT MOV DATAOUT,AL

  8. LEA EBP ,LOC EBP p oin ts to memory area. READ: BT INST A TUS,3 W ait for c haracter to b e JNC READ en tered in to D A T AIN. MO V AL,DATAIN T ransfer c haracter in to AL. MO V [EBP],AL Store the c haracter in memory INC EBP and incremen t pointer. ECHO: BT OUTST A TUS,3 W ait for displa y to JNC ECHO b e ready . MO V D A T A OUT,AL Send c haracter to displa y . CMP AL,CR If not carriage return, JNE READ read more c haracters. Figure 3.44. An IA-32 program that reads a line of characters and displays it. MEMORY MAPPED I/O

  9. ISOLATED I/O • IN and OUT instructions used only for I/O • Addresses for these instructions are in a separate address space to other instructions • IN REG,DADDR and OUT DEVADDR,REG • REG must be AL or EAX • 16-bit address space, if 0-255, specified in the opcode (takes 2 bytes) • Otherwise use DX for DADDR e.g. IN REG,DX • (IN REG,300 is not allowed because 300 > 255 and doesn’t fit in 8-bits)

More Related