Re: A86: help!!


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

Re: A86: help!!




I can see 2 problems with that code.  First of all, the variable name you
have is "A" rather than "Z", but also, you can't just put the # in hex right
into a real # var...  They need to follow a certain format (stored basically
in scientific notation).  This goes like this (with hl pointing to the 1st
byte of the real var):

(hl)->sign byte:
 bit 0:set=component of a complex #
         res=real #
 bit 7:set=negative #
        res=positive #
(hl+1)->exponent (word - remember, it's in low byte first):
 in the form $FC00+exponent, so if the exponent is 12, it would be
FC00+$000C=$FC0C and would be stored as (hl+1)=0C, (hl+2)=FC.  Negative #'s
are in 2's complement form.
(hl+3)->mantissa stored in BCD (7 bytes)
 so if the # was 1.23456789, the mantissa is 123456789, and would store like
this:
 (hl+3)=12, (hl+4)=34, (hl+5)=56, (hl+6)=78, (hl+7)=90, (hl+8)=00, (hl+9)=00.

So, for example, 7 would be 00 00 FC 70 00 00 00 00 00 00, so you could put
that at the end of your prog and then point hl to it, point de to the var,
and then do a 10-byte ldir...

Muhammed Galadima wrote:

> I wrote this code but when it didn't work I thought maybe I was copying
> BDE to AHL wrong... I guess that's not where the problem is. Maybe there
> is something else that I haven't spotted?
>
> .org _asm_exec_ram
>
>         call _clrLCD
> ;
>         ld hl,file1     ; load file structure into hl
>         rst 20h         ; store stuff at hl to OP1
>         call _CREATEREAL        ; creatte REAL file, based on info in OP1
>         ld a,b
>         ld h,d          ; copy BDE to AHL
>         ld l,e
>         call 462Fh      ; set RAM page to A, put 16 bit address in HL
>         ld a,7
>         ld (hl),a       ; -- shouldn't this put 7 in the real var Z?
>         ret
>
> file1:
>         .db 00h,1,"A"  ; filetype 00=real, namelength=1, name="Z"
>
> ;
> ;
> ; some other stuff here...
> ;
> ;
>
> .end
>
> Thanks in advance,
> Muhammed
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com



--
Stephen Hicks
mailto:shicks@mindspring.com
UIN:5453914
AIM:Kupopo1



References: