Fw: A86:op1, reg -> fp


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

Fw: A86:op1, reg -> fp




Here is the original info from Pat at TI in response to a question by Steven
Hicks

-----Original Message-----
From: Pat Milheron <pmilheron@ti.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Thursday, October 30, 1997 4:06 PM
Subject: Re: A86:op1, reg -> fp


Steve - Here are a few system routines that might help :

;-----------------------------------------------------------------------
;   SetXXOP1: Convert two digit hex number to floating point in OP1 |
;             The value must be 0 - 100 decimal, else an error is given
;                                                                      |
; INPUT:        |
; A - hex number, 0-63h or 0-100 decimal
;               (HL) - Address to start writing number        |
;        OUTPUT:        |
;               (HL) to (HL+9) - floating point positive number        |
;   USED:        |
;        |
;-----------------------------------------------------------------------
_SetXXOP1   equ   4613h

   ex :    ld a,35d
           call _setxxop1   ; op1 = floating point 35


;-----------------------------------------------------------------------
;   SetXXXXOP2: Convert 4 digit hex number to floating point        |
;                  |
;         INPUT:        |
;               HL - 4 digit hex number (0-FFFF)        |
;         OUTPUT:        |
;               OP2 - floating pt #, max=65535        |
;        |
;-----------------------------------------------------------------------
_SetXXXXOP2   equ  461Bh

    ex :    ld    hl,1256d
            call  _setxxxxop2       ; op2 = floating point 1,256


;-----------------------------------------------------------------------
;   SetXXOP2: Convert two digit hex number to floating point in OP2
;             The value must be 0 - 100 decimal, else an error is given
;
|
; INPUT:        |
;            A - hex number, 0-63h                                  |
;            (HL) - Address to start writing number        |
;        OUTPUT:        |
;            (HL) to (HL+9) - floating point positive number        |
;   USED:        |
;        |
;-----------------------------------------------------------------------
_SetXXOP2     equ  4617h

   ex:      ld    a,25h        ; 25h = 37 decimal
            call  _setxxop2    ; op2 = floating point 37



Later,
Pat

------------------
Original text

From: Steve86Asm@aol.com, on 10/30/97 2:28 PM:
In a message dated 97-10-30 11:01:54 EST, you write:

>
>  > however the caps goes.  Converting a register to an OP is much more
>  > difficult, and can be accomplished with a djnz loop, where you take the
#
> in
>  > b and increment OP1 that many times.
>
>  there HAS to be an easier way than that!
>
>

I haven't found an easier way.  If anyone knows a call (or can think of a
good way of converting to BCD) that converts register->OP, please post it...

I suppose you could do something with unpackhl, like maybe load the first
digit into the 5th digit (woul require some bit shifting...), and so on, or
something, like this:

f.edcbaE+05

into OP1, and maybe it would accept that and convert it to

fedcba

where a,b,c,d,e,f are the A's from unpack hl, in the order you get them in.

That probably makes NO sense!

~Steve




Follow-Ups: