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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:53:15+00:00 2026-06-17T15:53:15+00:00

I’m a beginner in programming Assembly. I would like to draw f(x)=x*sin(1/x) curve in

  • 0

I’m a beginner in programming Assembly. I would like to draw f(x)=x*sin(1/x) curve in graphics mode.
I can draw f(x)=sin(x) curve but I’m unable to draw f(x)=x*sin(1/x). How could I do this?

Below you can see my working f(x)=sin(x) code. It’s working and drawing the sine curve perfectly:

    org 100h                   
    mov al,13h
    int 10h

    xor bx,bx

    loopage:
    inc word [angle]

    fld dword [pie]
    fimul word [angle]
    fsin
    fimul word [xradius]
    fistp word [x]
    fimul word [yradius]
    fistp word [y]

    mov al,15

    mov dx,[x]
    add dx,ax
    mov cx,[y]
    add cx,bx

    ;xor ax,ax
    ;int 16h

    inc bl
    mov ah,0Ch
    mov al,bl
    int 10h

    cmp word [angle],360
    je endage
    jb loopage

    mov ax,0a000h
    mov es,ax
    xor ax,ax
    mov cx,32000
    rep stosw

    endage:
    xor ax,ax
    int 16h
    ret

    y dw 0
    x dw 0
    angle dw 0
    a dw -1
    pie dd 0.01756
    yradius dw 50
    one dw 1
    xradius dw 50
    float dd 0

I’d like to change this code to draw the f(x)=x*sin(1/x) curve.

I’ve tried several things to change following section in the code above:

    ...
    fld dword [pie]
    fimul word [angle]
    fsin
    fimul word [xradius]
    fistp word [x]
    fimul word [yradius]
    fistp word [y]
    ...

However without any results so far.

Could you help me please?

=========== EDITED: ====================

I tried out your code. Now my code looks like this:

    ...
    loopage:
    ;inc word [angle]
    ; FP0 <- 1
    fld1
    ; FP0 = FP0 / [pie] / [angle], is equal to FP0 / ([pie] * [angle])
    fidiv dword [pie]
    fidiv word [angle]
    fsin
    fimul dword [pie]
    fimul word [angle]
    fimul word [yradius]
    fistp word [y]

    mov al,15

    mov dx,[angle]
    add dx,ax
    mov cx,[y]
    add cx,bx
    ...

However this code draws only a single line instead of the expected x*sin(1/x) curve. Could you help me please to figure out what could be the problem?

  • 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-17T15:53:15+00:00Added an answer on June 17, 2026 at 3:53 pm

    You have an error in “working” code:

    ....
    ; FP0 <- [pie] ~ Pi/180
    fld dword [pie]
    ; FP0 = FP0 * [angle]
    fimul word [angle]
    ; FP0 = sin(FP0)
    fsin
    ; FP0 = FP0 * [xradius]
    fimul word [xradius]
    ; [x] <- FP0
    fistp word [x]
    ; **ERROR: no FP0!**
    fimul word [yradius]
    fistp word [y]
    ....
    

    Do not ask why it works 😉 actually your [x] must be equal to [angle] in this code, and formula is [y] = ([pie] * [angle]) * sin(1/[pie]/[angle]), [x] = [angle]:

    ; FP0 <- 1
    fld1
    ; FP0 = FP0 / [pie] / [angle], is equal to FP0 / ([pie] * [angle])
    fidiv dword [pie]
    fidiv word [angle]
    fsin
    fimul dword [pie]
    fimul word [angle]
    fimul word [yradius]
    fistp word [y]
    

    So remove [x] and [xradius] variables and change this line:

    mov dx,[x]
    

    to this one:

    mov dx,[angle]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to run a str_replace or preg_replace which looks for certain words
This could be a duplicate question, but I have no idea what search terms
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.