Assembly 用于计数硬币的汇编程序(masm)

Assembly 用于计数硬币的汇编程序(masm),assembly,masm,Assembly,Masm,所以我对汇编语言还是相当陌生的。我的任务是编写一个80x86汇编语言程序(masm),以美元和美分计算和显示硬币的总价值 输入:程序从用户处读取硬币数量(便士、镍币、一角硬币和四分之一硬币) 输出:程序显示总金额的美元和美分,以及硬币的数量,并显示三行消息 我不能使用任何除法指令。数据部分必须包括四个标签,每个标签用于字符串,以提示输入硬币类型的编号 我的代码将找到硬币的数量和总价值,我只是不知道如何输出到多行。感谢您的帮助或指导。这是到目前为止我的代码 .DATA

所以我对汇编语言还是相当陌生的。我的任务是编写一个80x86汇编语言程序(masm),以美元和美分计算和显示硬币的总价值

输入:程序从用户处读取硬币数量(便士、镍币、一角硬币和四分之一硬币)

输出:程序显示总金额的美元和美分,以及硬币的数量,并显示三行消息

我不能使用任何除法指令。数据部分必须包括四个标签,每个标签用于字符串,以提示输入硬币类型的编号

我的代码将找到硬币的数量和总价值,我只是不知道如何输出到多行。感谢您的帮助或指导。这是到目前为止我的代码

.DATA                       ;reserve storage for data
pennies                     DWORD           ?                                       
nickels                     DWORD           ?                                       
dimes                       DWORD           ?                                       
quarters                    DWORD           ?                                       
prompt1                     BYTE            "How many pennies do you have?", 0      
prompt2                     BYTE            "How many nickels do you have?", 0      
prompt3                     BYTE            "How many dimes do you have?", 0        
prompt4                     BYTE            "How many quarters do you have?", 0     
asciiIn                     BYTE            15 DUP (?)                              
resultLbl                   BYTE            "Coin Information", 0                   
resultText                  BYTE            

.CODE                       ;start of main program
_MainProc                   PROC
                        ;read ascii input for pennies, convert to 2's comp, and 
                        input           prompt1, asciiIn, 15                    
                        atod            asciiIn                                 
                        mov             pennies, eax                            

                        ;read ascii input for nickels, convert to 2's comp, and 
                        input           prompt2, asciiIn, 15                    
                        atod            asciiIn                                 
                        mov             nickels, eax                            

                        ;read ascii input for dimes, convert to 2's comp, and st
                        input           prompt3, asciiIn, 15                    
                        atod            asciiIn                                 
                        mov             dimes, eax                              

                        ;read ascii input for quarters, convert to 2's comp, and
                        input           prompt4, asciiIn, 15                    
                        atod            asciiIn                                 
                        mov             quarters, eax                           

                        ;
                        mov             eax, pennies            
                        mov             numCoins, eax
                        mov             pennies, eax            
                        mov             total, eax
                        ;
                        mov             eax, nickels
                        add             numCoins, eax
                        mul             nickel
                        add             total, eax
                        ;
                        mov             eax, dimes
                        add             numCoins, eax
                        mul             dime
                        add             total, eax
                        ;
                        mov             eax, quarters
                        add             numCoins, eax
                        mul             quarter
                        add             total, eax



                        dtoa            resultText, total       
                        output          resultLbl, resultText   


                        mov             eax, 0                                  
                        ret
_MainProc               ENDP                                                    
                        END                                                     
下面是包含的io宏的代码

output  MACRO  outLbl, outStr      ; display label and string
        pushad                     ; save general registers
        cld                        ; clear DF
        lea    eax,outStr          ; string address
        push   eax                 ; string parameter on stack
        lea    eax,outLbl          ; label address
        push   eax                 ; string parameter on stack
        call   _showOutput         ; showOutput(outLbl, outStr)
        add    esp, 8              ; remove parameters
        popad                      ; restore general registers
        ENDM

使用回车?HelloWorld db“Hello World!”,13,10,0-13,10是masm的回车,我相信。宏是从哪里得到的?尤其是
输出
?我包括了输出宏。如果你需要更多,请告诉我。