Download presentation
Presentation is loading. Please wait.
Published byAllan Powell Modified over 9 years ago
2
COSC 456 Lesson 8
3
Cool Codes ADD AL,SIAL AL + SI ADD AL,[SI]AL AL + [SI] INC BXBX BX + 1 INC [BX]Ambiguity error INC BYTE PTR [BX][BX] [BX] + 1 INC WORD PTR [BX] [BX + 1 : BX ] [BX + 1 : BX ] + 1
4
MUL & DIV MUL CLCL x AL AX MUL BXBX x AX DX : AX DIV CLAX/CL calculated. Quotient in AL and remainder in AH DIV CXDX:AX/CX calculated. Quotient in AX and remainder in DX
5
Shift SHR Shift Logical Right 0 MSBLSB CF SAL Shift Arithmetic Left 0 MSBLSB CF Shift CL times! SHR BX,CL SAL BX,1 SAL AL,CL
6
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.
7
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.
8
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!
9
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
10
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
11
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?
12
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. POPIncrements 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.