把一个数字分成四份分别放到AL,BL,CL,DL

DATA SEGMENT
N DB 12H
DATA ENDS
CODE SEGMENT
MAIN PROC FAR
ASSUME CS: CODE, DS: DATA
START: PUSH DS
MOV AX, 0
PUSH AX
MOV AX, DATA
MOV DS, AX

MOV BX, N

MOV CH, BH
MOV BL,CH
AND BL, 0F0H
MOV CL, 4
SHR BL, CL
MOV DH, BL

MOV BL, CH
AND BL, 0FH
MOV DL, BL

MOV BX, N

MOV CH, BL
AND CL, 0F0H
MOV CL, 4
SHR BL, CL

MOV AL, DH
MOV CL, BL
MOV DH, DL

MOV BL, CH
AND BL, 0FH
MOV DL, BL
MOV BL, DH

RET
MAIN ENDP
CODE ENDS
END START

2 thoughts on “把一个数字分成四份分别放到AL,BL,CL,DL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.