将十进制数55.8125转换为二进制数,和将十六进制数ba转换成二进制数和十进制数,分别写出过程和答

2024-11-19 07:51:15
推荐回答(1个)
回答1:

DATAS SEGMENT
;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV SI,1
MOV DI,0
MOV CL,4
MOV CH,4
SUB BX,BX
COME:MOV AH,01H
INT 21H
CMP AL,'D'
JE ACTION
SUB AL,30H
SHL BX,CL
ADD BL,AL
JMP COME
ACTION:MOV AX,BX
AND AX,000FH
MUL SI
ADD DI,AX
MOV AX,SI
MOV DX,10
MUL DX
MOV SI,AX
MOV AX,BX
SHR AX,CL
MOV BX,AX
DEC CH
CMP CH,0
JNE ACTION

MOV CH,0
HELLO: MOV AX,DI
ROL AX,1
MOV DI,AX
AND AX,0001H
ADD AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
INC CH
CMP CH,10H
JNE HELLO

MOV DL,'B'
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START