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 8555655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:10:24+00:00 2026-06-11T15:10:24+00:00

I don’t know what went wrong. I want to input string in WORD size

  • 0

I don’t know what went wrong. I want to input string in WORD size and add a integer to the inputted value of string and reprint the results. I’m not really sure in the arithmetic operations since this is my first time in using many operations in a single program and they are in 16 bits.

clr macro  
mov ax, 03h  
int 10h  
endm  

cseg segment para 'code'  
assume cs:cseg; ds:cseg; ss:cseg; es:cseg  
org 100h  

start: jmp begin  

amount_s label word  
amount_max dw 3  
amount_length dw ?  
amount_field dw 3 dup (?)  

x1 dw 0  
x2 dw 0  

sum1 dw 0
sum2 dw 0

bal dw 10

begin:  clr

mov ah, 0Ah     ;input string
lea dx, amount_s
mov cx, amount_length
lea si, amount_field
int 21h

mov ax, [si]        ;copy si to ax
sub ax, 30h     ;converts value of ax to integer
mov bx, 10      ;copy 10 to bx      
mul bx          ;multiply it ax by bx
mov x1, ax      ; copy ax to x1
inc si          ;move si pointer by 1

mov ax, [si]        ;copy si to ax
sub ax, 30h     ;converts value of ax to integer
mov x2, ax      ; copy ax to x2

add ax, x1      ;add ax which is x2 by x1
add ax, bal     ; add ax by bal which is 10
mov sum1, ax        ;copy the result to sum1

mov dx, 0       ; copy 0 to dx  
mov bx, 10      ; copy 10 to bx
div bx          ;divides ax by bx
mov sum1, ax        ; copy quotient to sum1
mov sum2, dx        ; copy remainder to sum2

add sum1, 30h       ;convert for printing
add sum2, 30h       ;convert for printing

mov ah, 02h     ;prints sum1
mov dx, sum1
int 21h

mov ah, 02h     ;prints sum2
mov dx, sum2
int 21h

int 20h
cseg 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-11T15:10:25+00:00Added an answer on June 11, 2026 at 3:10 pm

    How about debugging and checking reference documentation to see what goes wrong and how? 🙂

    One thing I can tell outright, the structure that the function 0ah of int 21h uses contains byte fields, not word fields.

    And yet you declare them as words (dw), not bytes (db):

    amount_max dw 3
    amount_length dw ?
    amount_field dw 3 dup (?)
    

    And you shouldn’t be accessing them as words as you do with:

    mov ax, [si]
    

    Instead, read bytes:

    mov al, [si]
    

    And if you want to convert byte values into word values, just stick a 0 into the top byte of the word register like so:

    mov ah, 0
    

    The rest looks reasonable, but I have not run the code. You should do it. In a debugger, if it’s not working right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know if I worded the question right, but basically what I want to
Don't know what's wrong here, when I run the application it says Specified method
Don't know what to do with this error. How to add data in SQL
Don't know if it's I'm doing it wrong or if there's a bug (I
I don't know when to add to a dataset a tableadapter or a query
Don't get me wrong, I want them to get saved. But I always thought
don't know if the title describes anything about what I'm trying to say but
don't know what happened in my jcrop selection. I think I pressed some keys
Don't really know how to formulate the title, but it should be pretty obvious
Don't know how to google for such, but is there a way to query

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.