0

我刚开始组装,但在显示十进制值时遇到问题。

我有这个代码:

mov ah,09h
mov al,[0fcbh]
mov bh,0
mov bl,0fh
mov cx,0001h
int 10h

我分配给内存位置的数据0fcbh = 55。我不想显示它(这是in"U"的字符),我想显示它本身而不是. 任何人都可以帮忙吗?55ascii55"U"

4

1 回答 1

1
.MODEL SMALL
.STACK 100H
.DATA

MSG1 DB 13,10,"ENTER 1ST NUMBER : $"
MSG2 DB 13,10,"ENTER 2ND NUMBER $"
ADDI DB 13,10,"PRESS 1 FOR ADDITION  $" 

SUBS DB 13,10,"PRESS 2 FOR SUBSTRACTION ? $"
MULT DB 13,10,"PRESS 3 FOR MULTIPLICATION ? $"
DIVI DB 13,10,"PRESS 4 FOR DIVISION ? $"
INVALID DB 13,10,"INVALID NUMBER  $"  
AG   DB 13,10,"WANT TO CALCULATE AGAIN ?? IF YES PRESS Y ELSE  N $" 
PROCESS DB '?'
.CODE



MAIN PROC

    MOV AX,@DATA
    MOV DS,AX 
    AGAIN:          
    MOV AH,2
    MOV DL,13
    INT 21H
    MOV DL,10
    INT 21H

    MOV AH,9
    LEA DX,ADDI
    INT 21H 

    LEA DX,SUBS
    INT 21H

    LEA DX,MULT
    INT 21H

    LEA DX,DIVI
    INT 21H

    MOV AH,1
    INT 21H
    MOV PROCESS,AL

    CMP PROCESS,'1'
    JE ADDITION    

    CMP PROCESS,'2'
    JE SUBSTRACTION 

    CMP PROCESS,'3'
    JE MULTIPLY  

    CMP PROCESS,'4'
    JE DIVISION 

    JNE EXIT 


    ADDITION:
    MOV AH,9

    LEA DX,MSG1
    INT 21H 
    XOR BX,BX
    MOV AH,1
    INT 21H  



    @INPUT:

    CMP AL, 0DH
    JE NEXTNUM
    CMP AL, 30H                 
    JL @ERROR                    

    CMP AL, 39H                 
    JG @ERROR                    

    AND AX, 000FH               

    PUSH AX                      

    MOV AX, 10                   
    MUL BX             
    MOV BX, AX             
    POP AX                   
    ADD BX, AX             
    MOV AH, 1               
    INT 21H
    CMP AL,13
    JE NEXTNUM                          
    JNE @INPUT                   

    @ERROR:
    MOV AH,9
    LEA DX,INVALID
    JMP EXIT

    NEXTNUM:
    MOV AH,9

    LEA DX,MSG2
    INT 21H 
    XOR CX,CX
    XOR AX,AX
    MOV AH,1
    INT 21H 

    INP:                                       
    AND AX,15              
    PUSH AX                      
    MOV AX, 10                
    MUL CX                    
    MOV CX, AX                 
    POP AX                      
    ADD CX, AX  
    MOV AH, 1                  
    INT 21H
    CMP AL,13
    JE PR                                
    JNE INP 


    PR:
    CMP PROCESS,'1'
    JE OUTSUM

    CMP PROCESS,'2'
    JE OUTSUB

    CMP PROCESS,'3'
    JE OUTMUL

    CMP PROCESS,'4'
    JE OUTDIV


    OUTSUM:   
    ADD BX,CX
    JMP EXIT

    OUTSUB:
    SUB BX,CX
    JMP EXIT

    OUTMUL:  
    MOV AX,CX
    MUL BX   
    MOV BX,AX    
    JMP EXIT

    OUTDIV:

    MOV AX,BX
    DIV CX 
    MOV BX,AX
    JMP EXIT















    SUBSTRACTION:
    MOV AH,9

    LEA DX,MSG1
    INT 21H 
    XOR BX,BX
    MOV AH,1
    INT 21H

    JMP @INPUT







    MULTIPLY:

    MOV AH,9

    LEA DX,MSG1
    INT 21H 
    XOR BX,BX
    MOV AH,1
    INT 21H

    JMP @INPUT





    DIVISION:

    MOV AH,9

    LEA DX,MSG1
    INT 21H 
    XOR BX,BX
    MOV AH,1
    INT 21H

    JMP @INPUT



    EXIT:
    MOV AH,9
    LEA DX,AG
    INT 21H
    MOV AH,1
    INT 21H
    CMP AL,'Y'
    JE AGAIN  

    MOV AH,4CH
    INT 21H

    MAIN ENDP
END MAIN
于 2015-12-13T11:18:01.060 回答