1.已知整数变量X和Y,试编写完整的汇编语言程序实现下列操作:
(1)若X和Y中有一个是奇数,则将奇数存入X中,偶数存入Y中;
(2)若X和Y都是奇数,则X、Y分别加1后存回原变量处;
(3)若X和Y都是偶数,不做处理。
DATA SEGMENT
A DB X
B DB Y
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX,DATA
MOV DS,AX
LEA SI,A
LEA BX,B
MOV AL,[SI]
MOV DL,[BX]
TEST AL,01H
JNZ L1
JMP L2
L1: TEST DL,01H
JNZ L3
MOV [SI] ,AL
MOV [BX],DL
JMP EXIT
L3: INC AL
INC DL
MOV [SI],AL
MOV [BX],DL
JMP EXIT
L2: TEST DL,01H
JNZ L4
JMP EXIT
L4: MOV [SI],AL
MOV [BX],DL
EXIT: MOV AH,4CH
INT 21H
CODE ENDS
END START