Sponsored Content
Top Forums Programming x86 help value being store passes data type range Post 302520482 by godofdoom999 on Saturday 7th of May 2011 02:05:39 PM
Old 05-07-2011
x86 help value being store passes data type range

Hi im very new to x86 programming and was wonder if there a function or ways to solve my problem. I believe the reason for my inaccurate result are from passing floating point number beyond what a SWORD could hold.
So far I been looking for a function that would allow me to round the floating point number but I cant seem to find any of that info on google. Any help would be appreciated. Thank you.

result from this...
sRoot(4/1) = 2/1
sRoot(9/1) = -13543/4096
sRoot(2/1) = 24023/-14336


Code:
;Find the square root and display the new frac. This uses the babylonian algorithm.

sRoot proc USES ebx, num:SWORD, den:SWORD, num2:SWORD, den2:SWORD
LOCAL dholder:SWORD ;store the past result
LOCAL nholder:SWORD ;store the past result
LOCAL counter:SDWORD

mov counter,0
invoke divFrac, num2,den2,10,1

mov num,cx
mov den,dx
invoke addFrac, 10,1,num,den
mov num,cx
mov den,dx
invoke mulFrac, 1,2,num,den
mov num,cx
mov den,dx

top:
invoke divFrac, num2,den2,num,den
mov nholder,cx
mov dholder,dx
invoke addFrac, num,den,nholder,dholder
mov nholder,cx
mov dholder,dx
invoke mulFrac, 1,2,nholder,dholder
mov num,cx
mov den,dx
inc counter
cmp counter,10
je done
jne top

done:
ret

sRoot endp

;addFrac and mulFrac accept similar value as divFrac

; divides two fractions puts numerator in ecx and denominator in edx
divFrac PROC USES eax ebx, num1:SWORD, den1:SWORD, num2:SWORD, den2:SWORD
LOCAL rNum:SDWORD ;store orignal value
LOCAL rDen:SDWORD
    mov ax,0		;set ax to 0
    mov ax,num1		;move num1 to ax register
    imul ax,den2	;sign multiply den2 to ax
    movsx ecx,ax	;mov ax with sign ext (SWORD) to ecx register
    mov ax,0
    mov ax,num2
    imul ax,den1
    movsx edx,ax
    mov rNum,ecx
    mov rDen,edx
    invoke gcd,rNum,rDen
    ret			;return address

divFrac ENDP

 

9 More Discussions You Might Find Interesting

1. Programming

FILE data type

Hi all, Can anyone tell me a little about the datatype FILE, which represents stream. What does its structure look like, and in which header file is it defined and so on... Ex : FILE *fp ; fp = fopen("filename", "w") ; (6 Replies)
Discussion started by: milhan
6 Replies

2. Programming

data type limitation

I am writing some code to do analysis on the file system (HP-UX 11.11). I am using stat(..) to get file information. My problem is that the file-size may exceed the data types defined in 'sys/stat.h' & 'sys/types.h' respectively. Thus file-sizes in the Giga-byte range are not read correctly.... (2 Replies)
Discussion started by: ALTRUNVRSOFLN
2 Replies

3. Shell Programming and Scripting

How to store Data in a File

I want to read a data from a read command and store it in a file...... Plz send me how I can do that Ex: read val and I want to store this val in a file called temp. (2 Replies)
Discussion started by: krishna_sicsr
2 Replies

4. Shell Programming and Scripting

Perl data type checking

I am using perl 5.8.0. I need to check some values to see it they are floats. Our system does not have Data::Types so I can't use is_float. Is there something else that I can use? The only thing in Data is Dump.pm. I am not allowed to download anything to our system so I have to use what I have.... (3 Replies)
Discussion started by: ajgwin
3 Replies

5. Solaris

Can not type in textbox ( Solaris 10 x86 )

My X86-Solaris 10- server after installed some softwares now has a bug. We can not type anything on the text box of Java applications or CDE such as Add printer or Raid Controller etc.. but i can type on the Command Line Terminal or Star Office applications :eek: I want to ask for a system... (4 Replies)
Discussion started by: tien86
4 Replies

6. Web Development

Data type to use for prices with commas

Hi everybody, I`m very new with PHP and Databases and I having the follow issue with prices data.. The original information is in CSV files. The prices have formatted with commas and dots as follow: 12,300.99 -->(thousands separated by commas) 3,500.25 -->(thousands separated... (10 Replies)
Discussion started by: cgkmal
10 Replies

7. Programming

help with data type sizes

i'm using a C program and running it on a linux server, i got 2 adressess of 2 variables, and 2 addresses of 2 chars, and compared it. and got the size of a int and the size of a char. why is a size of a int (4 bytes) bigger then the size of a char (1 byte)? also if i do &a-&b i get 1, but if i... (30 Replies)
Discussion started by: omega666
30 Replies

8. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

9. Programming

Incompatible data type fpos_t in C

This is from a program I wrote over in 1998 that I am trying to compile on a linux machine: void write_line (FILE *fp, int rec_no, line_rec *arec) { fpos_t woffset; woffset = (rec_no - 1) * sizeof(line_rec); fsetpos(fp,&woffset); fwrite(arec,sizeof(line_rec),1,fp); }On the line... (2 Replies)
Discussion started by: wbport
2 Replies
qtmodernizer(1) 					    BSD General Commands Manual 					   qtmodernizer(1)

NAME
qtmodernizer -- Tool to convert legacy movies to modern format with minimal changes. SYNOPSIS
qtmodernizer [options ...] pathToSource [pathToDestination] DESCRIPTION
qtmodernizer is a command line tool to examine a media file which may be in a legacy format or may contain legacy media tracks. In this case a legacy format is one which cannot be read directly by CoreMedia or AVFoundation frameworks. qtmodernizer examines all the tracks to determine if they are all in a form that can currently be played. If all tracks are playable and the format is readable, qtmodernizer does returns and does nothing. If any of the audio or video tracks are encoded with a codec that CoreMedia does not support, that track will be converted to a modern format, usually H.264 for video and AAC for audio (see --useprores for other choices). Command line options of qtmodernizer: -h | --help -p | --useprores If -p or --useprores is specified, qtmodernizer will use the ProRes video codec and LPCM audio codec instead of H.264 and AAC-LC. For video tracks it will produce AppleProRes422. For audio it will produce uncompressed output (lpcm). Tracks outher than audio or video are not re-encoded and will not be affected. Either AppleProRes422 may be chosen or the AppleProRes4444 option may be chosen but not both. -p4 | --useprores4444 If -p4 or --useprores4444 is specified, qtmodernizer will use the ProRes4444 video codec and LPCM audio codec instead of H.264 and AAC-LC. For video tracks it will produce AppleProRes4444. For audio it will produce uncompressed output (lpcm). Tracks outher than audio or video are not re-encoded and will not be affected. Either AppleProRes4444 may be chosen or the AppleProRes422 option may be chosen but not both. -r | --replace Normally qtmodernizer will not replace any existing files. If --replace is specified, a file already existing at the destination path will be replaced by the new output. qtmodernizer will not replace the file at original source path used in the command. -v | --verbose Normally qtmodernizer only displays important error or warning messages. Specifying --verbose causes other information about the modernization to be displayed on the command line. --infoonly implies --verbose. -i | --infoonly Causes qtmodernizer to display information about the tracks contained in the source file and what the modernization process would be for each track (if any) but does not actually produce an output file. EXAMPLES
qtmodernizer legacy_movie.mov modern_movie.mov Each legacy audio and video track would be re-encoded to a modern (H.264 or AAC) track with other tracks passed through. The resulting movie is saved as modern_movie.mov qtmodernizer -p legacy_movie.mov modern_movie.mov Legacy audio and video tracks would be re-encoded like in the above example but the resulting codecs would be ProRes for video and LPCM for audio qtmodernizer ~/Movies/legacy_movie.mov This command will create a modernized movie in the ~/Movies directory named "legacy_movie-modernized.mov" HISTORY
qtmodernizer command first appeared in Mac OS X 10.9. Mac OS X May 31, 2019 Mac OS X
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy