汇编刷题 已知整数变量A和B,试编写完成下列操作的程序
1.若两个数中有一个是奇数,一个是偶数,则将它们互换储存地址
2.若两个数都是奇数,则分别加一
3.若两个数都是偶数,则不变
DATA SEGMENT
A DB 12H
B DB 25H
DATA ENDS
STACK SEGMENT
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
MOV AL,0
MOV BL,A
TEST BL,01H
JZ ADD_TIME_1
ONE:
MOV BL,B
TEST BL,01H
JZ ADD_TIME_2
TWO:
TEST AL,03H
JNZ ONE_ODD
TWO_ODD:
INC A
INC B
JMP EXIT
ADD_TIME_1:
INC AL
JMP ONE
ADD_TIME_2:
INC AL
JMP TWO
ONE_ODD:
TEST AL,01H
JZ ZERO_ODD
MOV DL,A
XCHG DL,B
MOV A,DL
JMP EXIT
ZERO_ODD:
JMP EXIT
EXIT:
MOV BH,A
MOV BL,B
MOV AH,4CH
INT 21H
CODE ENDS
END START