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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:31:18+00:00 2026-05-22T00:31:18+00:00

i´, completely novice in assembly. I want to compare two variables (float) and jump

  • 0

i´, completely novice in assembly.
I want to compare two variables (float) and jump correctly to the right function;
Its a Pong game
Its written in FASM

 ;The right pad
  P0x dd  0.9  ;
  P0y dd  0.05 ;
  P1x dd  0.95 ;
  P1y dd  -0.25 ;

 ;The left pad
  P0x2 dd -0.9
  P0y2 dd  0.05
  P1x2 dd -0.95
  P1y2 dd - 0.25

B0x GLfloat  0.01 ; Its the ball coordinate
...
BvelX GLfloat 0.02 ;Its the velocity that the ball move in x
...

I want that: if the ball position is the same or more then the Pad position, then invert the velocity.
What i do:

;right
 fld [B0x]
 fld [P0x]
 fcomip st1
 jge .changexEsq

 ;left
 fld [B0x]
 fld [P0x2]
 fcomip st1
 jle .changexDir

 ;Up
 fld [B0y]
 fld [TelaComecoY]
 fcomip st1
 jge .changeyBaixo

 ;Down
 fld [B0y]
 fld  [TelaFimY]
 fcomip st1
 jge .changeyBaixo

  ....
.changexEsq:
mov edi,-0.02
mov [BvelX],edi
jmp .main
    ret

.changexDir:
mov edi, 0.02
mov [BvelX],edi
jmp .main
    ret

.changeyBaixo:
mov edi,-0.02
mov [BvelY],edi
jmp .main
    ret

.changeyCima:
mov edi,-0.02
mov [BvelY],edi
jmp .main
    ret

But the comparation is doing nothing ! How could i compare those variables and jump correctly ?

  • 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-22T00:31:18+00:00Added an answer on May 22, 2026 at 12:31 am

    FCOM and company (FCOMP, FCOMPP, FICOM, FICOMP) put results in the floating point status word, not in the main CPU flags register. You can use fstsw to store the floating point status word somewhere you can get at it and act on its contents (e.g., to store to AX, you use FSTSW AX).

    Note that this is somewhat roundabout. In some cases, you may want to consider treating the numbers as if they were integers — IEEE 754 was carefully designed so that integer comparisons for ordering mostly yield correct results for floating point numbers.

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

Sidebar

Related Questions

Not completely a programming question, but its close enough so here goes: In Mac
I want to use this function from mongoid: person.update_attributes(first_name: Jean, last_name: Zorg) But I
So, when I was a comparative novice to the novice I am right now,
I'm a complete novice, looking for instructions on implementing javascript. I am attempting to
I admit - I'm a complete novice when it comes to unit testing. I
What is the average time that it would take a complete novice, whose background
So, to preface, I'm a complete novice at this Excel business. I've found similar
Preface: I consider myself slightly effective in ruby on rails, and a complete novice
I'm a complete perl novice, am running a perl script using perl 5.10 and
Completely new to asp.net mvc... completely new to web apps so bear with me...

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.