Wie konvertiere ich einen String in eine Zahl in Tasm?

Ich habe ein Programm erstellt, das einen String liest und in eine Zahl umwandelt. Eine Zeichenfolgendarstellung der im Dezimalsystem eingegebenen Zahl. Das Ergebnis der Konvertierung befindet sich im Register ax. Ich benutze tasm16.

Wie kann ich eine Zeichenfolge konvertieren, die größer als 65535 ist?

<code>model small
stack 100h
printstring macro msg
    mov ah,09h
    mov dx,offset msg
    int 21h
endm
data segment
    cr equ 0dh
    lf equ 0ah
    errorInput db 'Wrong input',cr,lf,'$'
    inputAmsg db 'Please input A',cr,lf,'$'
    outstring db 'Output:',cr,lf,'$'
    maxAbuf db 10
        db ?
        db 10 dup(0)
        db '$'
    result dw 0

data ends
code segment
    assume cs:code, ds:data
start:
    mov ax,data
    mov ds,ax
;input A
    printstring inputAmsg
    mov ah,0ah
    lea dx,maxAbuf
    int 21h
    printstring outstring

    mov ah,09h
    lea dx,maxAbuf+2
    int 21h
;in:
;dx:address of string
;out
;dx:ax - result ;work only ax
;
    call Convert
    jmp exit
;in:
;dx:address of string
;out
;dx:ax - result
;9999989d = 989675h
Convert proc
        xor ax,ax
        xor cx,cx
        mov bx,10 ;base
        mov si, offset dx
        xor dx,dx
getnewchar: mov cl,[si]
        cmp cl,0dh ;if `$` exit
        jz endproc
        sub cl,'0' ;or 30h
        mul bx
        add ax,cx
;I do not know what to write here, if there is an exit for the bit grid.
        adc dx,0
        inc si
        jmp getnewchar
endproc:
    ret
    endp

exit:   mov ax,4c00h
    int 21h
code ends
end start
</code>

Antworten auf die Frage(1)

Ihre Antwort auf die Frage