1 / 11

COSC 456 Lesson 8

COSC 456 Lesson 8. Cool Codes. ADD AL,SI AL AL + SI ADD AL,[SI] AL AL + [SI] INC BX BX BX + 1 INC [BX] Ambiguity error INC BYTE PTR [BX] [BX] [BX] + 1 INC WORD PTR [BX]

erol
Download Presentation

COSC 456 Lesson 8

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. COSC 456Lesson 8

  2. Cool Codes • ADD AL,SI AL AL + SI • ADD AL,[SI] AL AL + [SI] • INC BX BX BX + 1 • INC [BX] Ambiguity error • INC BYTE PTR [BX] [BX] [BX] + 1 • INC WORD PTR [BX] [BX + 1 : BX ] [BX + 1 : BX ] + 1

  3. MUL & DIV • MUL CL CL x AL AX • MUL BX BX x AX DX : AX • DIV CL AX/CL calculated. Quotient in AL and remainder in AH • DIV CX DX:AX/CX calculated. Quotient in AX and remainder in DX

  4. Shift SHR Shift Logical Right 0 MSB LSB CF SAL Shift Arithmetic Left 0 MSB LSB CF • Shift CL times! • SHR BX,CL • SAL BX,1 • SAL AL,CL

  5. XCHG & XLAT • XCHG AX, BX • XCHG BL, [SI + 2] • XLAT Translate. Inherent instruction does not require operand specification. This instruction uses AL and BX in the following way: AL [BX + AL ] This instruction finds applications in data translation tables, look-up tables, and code conversions.

  6. Adder Program MOV CX, 7 MOV SI , 0050 MOV AL,0 AGAIN: ADD AL, [SI] INC SI DEC CX JNE AGAIN INT 3 This program adds 7 numbers stored at the memory locations 0050 through 0056.

  7. Adder Program with LOOP MOV CX, 7 MOV SI , 0050 MOV AL,0 AGAIN: ADD AL, [SI] INC SI LOOP AGAIN INT 3 This program adds 7 numbers stored at the memory locations 0050 through 0056. LOOP automatically uses CX as a counter!

  8. String Along! CLD MOV SI, 0200 MOV DI, 0500 MOV CX, 30 REP MOVSB Program copies 30 (48 decimal) bytes of data beginning at0020 to the destination beginning at 0050

  9. SCAN CLD MOV CX,0100H MOV DI, 0200H BACK: MOV AL,0AAH REPNE SCASB JZ JUSTDOIT INT3 JUSTDOIT: MOV AL, 0BBH DEC DI STOSB JMP BACK Program scans memory and replaces AA with BB

  10. CALL & RET HERE :CALL DELAY MOV AL, E3 MOV SI, 0050 CMP AL, [SI] JB HERE INT 3 . . . DELAY:MOV CX,0FFFFH LOOP AGAIN RET Monitors boiler temperature … remember?

  11. Stack … Push and Pop PUSH Saves word (not byte) on stack. First SP is decremented by 2 and then the operand is saved on the stack. POP Increments SP by 2 and then pulls (pops) the word. Example follows: PUSH CX PUSH BX POP CX POP BX The above program is equivalent to XCHG BX,CX

More Related