将AX寄存器中的16位数分成4组,每组4位,然后把这四组数分别放在AL、BL、CL、DL中

2024-12-17 16:45:18
推荐回答(2个)
回答1:

DSEG SEGMENT
TEMP DB 4DUP(?)
DSEG ENDS
……
START:MOV CL,4
MOV CH,4
LEA SI,TEMP
L1: MOV DX,AX
AND DX,0FH
MOV BYTE PTR[SI],DL
INC SI
SHR AX,CL
DEC CH
JNZ L1
MOV DL,TEMP
MOV CL,TEMP+1
MOV BL,TEMP+2
MOV AL,TEMP+3
RET

回答2:

.model small
.stack
.code
main proc far
mov ax,12345678H
mov dl,al
and dl,0fh
mov cl,4
rol ax,cl
mov dh,al
and dh,0fh
rol ax,cl
mov bl,al
and bl,0fh
rol ax,cl
mov cl,al
and cl,ofh
mov al,dh
mov ah,4ch
int 21h
main endp
end main