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

  • Home
  • SEARCH
  • 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 7626707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:21:42+00:00 2026-05-31T05:21:42+00:00

I have a trouble with simple assembler program.I don’t know what i why happens

  • 0

I have a trouble with simple assembler program.I don’t know what i why happens but there is problem.
Task is : Compute scalar product of two arrays in assembler (emu 8086)
Here is my code

    ; multi-segment executable file template.

data segment
; add your data here!
n1 db 1,2,3
n2 db 4,5,6
i db ?
j db ?

k dw ?
pkey db "press any key...$"

ends

stack segment
dw 128 dup(0)
ends

code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax

mov al,00h
mov ah,02h

mov ch,00h
mov cl,03h

mov bx,offset n1
ciklus:

mov dl,[bx]
;add dl,30h


mov j,0d

add j,dl
int 21h
mov al,j
mov ah,0h


inc bx
inc bx
inc bx
mov dl,[bx]
;add dl,30h

mov i,0d
add i,dl
mul i

mov k,ax


mov al,00h
mov ah,02h
int 21h



dec bx
dec bx
dec bx

inc bx



loop ciklus

lea dx, pkey
mov ah, 9
int 21h        ; output string at ds:dx

; wait for any key....    
mov ah, 1
int 21h

mov ax, 4c00h ; exit to operating system.
int 21h    

ends

end start ; set entry point and stop the assembler.

So when i run program step by step i see strange values in ax. I want
1×4 2×5 3×6 = > 4 10 18 to save in some variable and print to screen .

If someone can help me i will be grateful.
P.S this i’m noob in assembler programming so don’t be angry of my stupid question.

  • 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-05-31T05:21:42+00:00Added an answer on May 31, 2026 at 5:21 am

    After the ciklus: label, you are adding 0x30 to dl, then adding dl to j, so j >= 0x30 at this point. After the interrupt you set al to j, and ah to 0x0, so ax >= 0x30. Later you add 0x30 to dl, then add dl to i.

    So mul i is effectively: [dx:ax] = i * ax, which is going to be at least (0x30 * 0x30), i.e., ax >= 2304, dx = 0. Larger, depending on the contents of [bx], i, j.

    After the mul you overwrite the ax register with the value: 0x200 (512), anyway, so the results are lost. In short, you need to look at saving your running ax [ah:al] register before clobbering it for use as the interrupt service code.

    P.S. You might consider using the si and di registers to save working values.

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

Sidebar

Related Questions

I have a very simple django site but I have trouble getting the images
I have trouble finding way to correctly refactor this code so that there would
I try to use templatetags in django but I have trouble. I defined enumhelper.py
well i have this trouble and ive been dealing with but i just cant
I'm using Bison to create a simple parser and have some trouble understanding the
I have this really simple trouble I can't seem to overcome. I'm trying to
I have trouble comparing 2 double in Excel VBA suppose that I have the
I have trouble with the following piece of code. When I go through with
I have trouble using Perl grep() with a string that may contain chars that
I have trouble defining a trigger for a MySQL database. I want to change

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.