English 中文(简体)
为什么我没有取得正确结果
原标题:Why I don t get the right result

我想加上两位30位数,并加起来。 如你在8086年所知,我们不能增加两个数字,即30位数字。 因此,我不得不在进行扼杀。 而使用AAA指挥系统,使结果大不相同,最后检查我们是否执行过,但主要问题是这一金额的结果不正确。 它给我59427532,其中6 689 + 759133。

你们能否告诉我,究竟是什么问题?

    .model small
    .stack 64
    .data
    max1 db 30  
    acc1 db ?
    num1 db 30 dup( 0 )
    max2 db 30
    acc2 db ?
     num2 db 30
    sum db 31 dup( 0 ), $ 
    .code 
    start:
     mov ax,@data
     mov ds, Ax
     mov ah,0ah
     lea dx, max1   ;take max 1 and length store it to acc1
     int 21h 
     mov ah,0ah
     lea dx,max2    ;take max2 and length store it to acc2
     int 21h
       mov cl,acc1  ;check if they are equal
     cmp cl,acc2
     jne exit
     mov ch,0   ;make sure our cx is the length of our string
     clc
      mov si,cx ;set the length for index the char
      dec si        
      l1:
      mov al,num1[si]   ;sum two hex number
      adc al,num2[si]   ;add with carry flag
       aaa          ;seperate carry and  hex number and store it into al
       pushf    
       add al,30h       ;convert it to ascii again
       mov sum[si+2],al ;because of dec si we have to step
       popf
       dec si
       loop l1
       jne print
        mov sum,31h     ; if we have carry flag add to sum otherwise jumpt print 
       print:
       mov ah,09h       ;the main problem is here shows the result
       lea dx,sum
        int 21h                      
       exit:
      mov ax,4c00h
       int 21h
     end start    
问题回答

Thank you my friend for your help i found the problem. we should have to replace mov sum[si+1], al instead of mov sum[si+2],al





相关问题
How can I do a CPU cache flush in x86 Windows?

I am interested in forcing a CPU cache flush in Windows (for benchmarking reasons, I want to emulate starting with no data in CPU cache), preferably a basic C implementation or Win32 call. Is there a ...

What are the names of the new X86_64 processors registers?

Where can I find the names of the new registers for assembly on this architecture? I am referring to registers in X86 like EAX, ESP, EBX, etc. But I d like them in 64bit. I don t think they are the ...

How do I disassemble raw 16-bit x86 machine code?

I d like to disassemble the MBR (first 512 bytes) of a bootable x86 disk that I have. I have copied the MBR to a file using dd if=/dev/my-device of=mbr bs=512 count=1 Any suggestions for a Linux ...

32bit application access to 64bit registry

I have an OS Shell written in 32bit that is replacing the Explorer.exe of a Vista machine. I run a utility which is also written in 32bit, which allows to switch between the Explorer shell and My ...

Left Shift Overflow on 68k/x86?

I heard that the Motorola 68000 and Intel x86 architectures handle overflow from left shifting differently. Specifically the 68k LSL vs. the Intel SAL/SHL assembly instructions. Does anyone know the ...

Translate a FOR to assembler

I need to translate what is commented within the method, to assembler. I have a roughly idea, but can t. Anyone can help me please? Is for an Intel x32 architecture: int secuencia ( int n, ...

热门标签