[A86] Re: Fraction ROM Calls


[Prev][Next][Index][Thread]

[A86] Re: Fraction ROM Calls




This is probably fairly reliable:
http://www.ticalc.org/archives/mail/assembly-86/1998_August/msg00285.html
;
;---------------------------------------------------------
;   TOFRAC : CONVERT DECIMAL NUMBER TO FRACTION.         |
;             NUMERATOR / DENOMINATOR.                         |
;                                                         |
;            INPUT : OP1 = DECIMAL NUMBER                 |
;                                                         |
;            OUTPUT : IF SUCCESSFULL :                         |
;                                                         |
;                     OP1 = NUMERATOR                         |
;                     OP2 = DENOMINATOR                         |
;                     CA = 0                                 |
;                                                         |
;                     IF NOT SUCCESSFULL :                 |
;                                                         |
;                     OP1 = ORIGINAL INPUT                 |
;                     CA = 1                                 |
;                                                         |
;            USES : OP1 TO OP6                                 |

_TOFRAC                          equ            4B93h

I think _frac is the equivalent of "fPart" and returns the bit after the
decimal point.

>  ld hl,Avar
>  rst 20h
>  rst 10h
>  ret c
>  ex de,hl 
>  
>  bcall(_Mov9ToOP1)
>  bcall(_ToFrac)
>  bcall(_dispOP1a)

If it's possible to set it up to use the stored answer (Ans), it's much
easier to just use:
 call _rclAns
 call _ToFrac
 etc

It might be possible to use _RCLVARSYM similarly for other variables:
 ld hl,Avar
 rst 20h
 call _RCLVARSYM
 etc

(and if you really want to do it right, it might be best to make sure
you're dealing with a real number before calling _ToFrac, but I wouldn't
bother)

Otherwise, this translates to

 ld hl,Avar
 rst 20h
 rst 10h
 ret c
 ld a,b ; 3-byte address on 86
 ex de,hl
 call _ABS_MOV10TOOP1 ;=5235h
 call _toFrac

and so on...

-josh


On Fri, 21 Jun 2002 13:48:11 -0400 Ricky Cobb <arcadesdude@intercom.net>
writes:
> 
> Hrm...What are the input and output of _tofrac?
> In other words how do I use it?
> 
> 
> What I have here doesnt do anything really...
> 
> I'm trying to look up the real variable A
> and then do >frac on it and have the numerator in op1
> and the denomiator in op2 like you say _toFrac does.
> 
> 
> 
> The code is for the 83plus but is similar to the 86.
> ---------------------------------------------------------
> #include "ti83plus.inc"
> .plugin asm83p.dll ;for cz80 (jonah cohen's z80 compiler)
> #DEFINE TI83P
> #include "ion.inc"
> #ifdef TI83P
> .org progstart-2
>  .db $BB,$6D
> #else
> .org progstart
> #endif
> 
> START:
> 
>  bcall(_homeup)
>  bcall(_ClrScrn)
> 
>  ld hl,Avar
>  rst 20h
>  rst 10h
>  ret c
>  ex de,hl 
>  
>  bcall(_Mov9ToOP1)
>  bcall(_ToFrac)
>  bcall(_dispOP1a)
> 
>  ret
> 
> Avar:
>  .db 0,tA
> 
> .end
> -------------------------------------------------------------------
> 
> 
> 
> 
> Ricky Cobb
> http://tip.ti-programmers.com/
> arcadesdude@intercom.net
> [IM]
> icq 41440378
> msn arcadesdude
> y!  arcadesdude
> aim arcadesdude
> 
> 
> 
> 
> 6/21/02 12:21:01 PM, Xavier LaRue <paxl@videotron.ca> wrote:
> 
> >
> >Hi,
> >If you use _toFrac . The numerator will be stored into op1 and the 
> denomiator 
> into op2.. This work perfectly on the 83+.. But I don't know if that 
> the same on 
> the 86 :)
> >
> >Hope that help,
> >Xavier LaRue
> >
> >On Fri, 21 Jun 2002 11:11:21 -0400
> >Ricky Cobb <arcadesdude@intercom.net> wrote:
> >
> >> 
> >> If there are any expireinced ASM programmers left here
> >> on this mostly dry mailing list (I know you're there)
> >> then I have two questions.
> >> 
> >> I am looking for documentation (and if possible an example)
> >> of two TI-86 ROM Calls. The two ROM calls are:
> >> 
> >> _tofrac equ 4B93h ; convert op1 to op1/op2
> >> _FRAC equ 549Ch ; op1 = frac(op1)
> >> 
> >> The comments arenot very descriptive and I would like to know
> >> how to use these two ROM calls.
> >> 
> >> Input is going to be a fp decimal number
> >> Output I'd like to be op1 as a string that reads
> >> numerator/denomiator (if reducable to a fraction)
> >> or an op as the denomiator and another op as the
> >> numerator.
> >> 
> >> The most I could get was the numerator (but couldnt get
> >> the denomiator or didnt know what the output of each of
> >> these routines is.
> >> 
> >> Any help would be appreciated.
> >> 
> >> (See Also: 
> http://www.ti-programmers.com/ubb/ultimatebb.php?ubb=get_topic;f=
> >> 10;t=000103 )
> >> 
> >> 
> >> Ricky Cobb
> >> http://tip.ti-programmers.com/
> >> arcadesdude@intercom.net
> >> [IM]
> >> icq 41440378
> >> msn arcadesdude
> >> y!  arcadesdude
> >> aim arcadesdude





  

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.



Follow-Ups: