Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7927613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:23:47+00:00 2026-06-03T19:23:47+00:00

I made a program that reads a string and converts it into a number.

  • 0

I made a program that reads a string and converts it into a number. A string representation of the number entered in the decimal system. The result of of converting is in register ax.
I use tasm16.

How do I do that I can convert a string bigger(more than 65535)?

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:23:49+00:00Added an answer on June 3, 2026 at 7:23 pm

    You could, for example, extend your multiplication by 10 from 16 to 32 bits like this:

    ; file: mul32ten.asm
    ; compile: nasm.exe mul32ten.asm -f bin -o mul32ten.com
    
    bits 16
    org 0x100
    
        xor     dx, dx
        xor     ax, ax
    
        mov     si, MyStr
    
    NextDigit:
        mov     bl, [si]
        or      bl, bl
        je      Done
        call    MulDxAxBy10
        sub     bl, '0'
        add     al, bl
        adc     ah, 0
        adc     dx, 0
        inc     si
        jmp     NextDigit
    
    Done:
        ; dx:ax should be equal to 7FFFFFFF now
        ret
    
    MulDxAxBy10:
        push    si
        push    di
        shld    dx, ax, 1
        shl     ax, 1       ; dx:ax = n * 2
        mov     si, ax
        mov     di, dx      ; di:si = n * 2
        shld    dx, ax, 2
        shl     ax, 2       ; dx:ax = n * 8
        add     ax, si
        adc     dx, di      ; dx:ax = n * 8 + n * 2 = n * (8 + 2) = n * 10
        pop     di
        pop     si
        ret
    
    MyStr db "2147483647", 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have made a program that reads a text file containing words and
I'm learning java and I have made simple program that simply reads value from
I made a program that opens an application, sleeps the thread for 500ms then
I have made a program that scans rss feeds. This same program creates feeds
is it possible to install program that i made in VS2008 (FW3.5) on computer
For an assignment I've made a simple C++ program that uses a superclass (Student)
I have made a script that uses a program called Diascope, its a video
I have a pointer of a structure type that I made. On program start
I have made a program that continuously monitors a log file. But I don't
I need help loading a custom file format into my program made in c++...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.