我目前正在做一个项目,该项目需要我提示用户输入三个输入(长度、宽度和高度),然后计算体积(l w h)。计算完成后打印结果时遇到问题。有没有办法打印出十进制值?
.MODEL SMALL
.STACK 100h
.DATA
l DB ?
w DB ?
h DB ?
v DB ?
M1 DB 10,13, "Please enter the length: $"
M2 DB 10,13, "Please enter the width : $"
M3 DB 10,13, "Please enter the height: $"
M4 DB 10,13, "The volume is:$"
.CODE
Main PROC
mov ax, @data ; getting data segment address
mov ds, ax ; initializing the data segment
mov dx, offset M1 ; prompting user for a value
mov ah, 09h ; writing string to STDOUT
int 21h ; BIOS routines
mov ah, 01h ; reading in from STDIN, input stored in al
int 21h
mov bl, al
sub ax,ax ; clearing ax register for the next input
sub bl, 30h
mov l, bl
sub bx,bx
mov dx, offset M2
mov ah, 09h
int 21h
mov ah, 01h
int 21h
mov bl, al
sub ax,ax
sub bl, 30h
mov w, bl
mov al, l
mul bl
mov v, al
sub ax, ax
sub bx,bx
mov dx, offset M3
mov ah, 09h
int 21h
mov ah, 01h
int 21h
sub al, 30h
mov h, al
sub bx, bx
mov bl, v
mul bx
mov v, al
sub ax, ax
sub bx,bx
mov dx, offset M4
mov ah, 09h
int 21h
sub dx, dx
mov dx, offset v
mov ah, 09h
int 21h
mov ax, 400ch ; returning control to OS
int 21h
Main ENDP
END Main