The logical instructions may be used to evaluate logical expressions. The program sequence in Fig. 3-50, which assumes that bits 7, 6, ... , 1, 0 in AL respectively represent the values of the logic variables X7, .... , X0, evaluates the Boolean expression
Figure 3-50 Sequence for evaluating a Boolean expression.
Data related directives, input, and other code
MOV BL,00110101B ;CREATE MASKS FOR OR BL,AL ;EACH OF THE MOV BH,10101000B ;THREE MINTERMS OR BH,AL ;BY SETTING THE DON'T MOV CL,01010101B ;CARE BITS OR CL,AL ;TO 1 XOR BL,10111111B ;BRANCH TO JZ TRUE ;TRUE IF ANY XOR BH,11111011B ;ONE OF THE JZ TRUE ;MINTERMS IS 1 XOR CL,01111101B JZ TRUE XOR AH,AH ;OTHERWISE, AH IS CLEARED JMP CONTINUE TRUE: MOV AH,1 ;AH IS SET TO 1 CONTINUE: . . .Output and other code |
The machine code format of the shift and rotate instructions is of the form
The shift instructions affect all of the condition flags and the rotate instructions affect only the CF and OF flags.
The destination operand, OPR, can have any of the 8086 addressing modes except the immediate mode. CNT can be a 1, a constant expression that evaluates to a 1, or the register designation CL. If it is CL, then the number of positions to be shifted is determined by the contents of CL.
This is page 39.