Re: A83: a bug in FP numbers code...
[Prev][Next][Index][Thread]
Re: A83: a bug in FP numbers code...
I'm sorry if you've spent any time on this, but I've fixed the problem. I
forgot to load the max. display value into a. I've also added to the
program, so that if it does not turn into a fraction, it will only be
displayed once. If you want to run this yourselves, remove the entire
fraction: from the previous e-mail, and replace it with the one below. This
code compiles fine with tasm, but I'm not sure if a mac-compiler can handle
the "functions" FPmov(), and Input().
Thanks,
Ted
fraction:
FPmov(x1,op1) ;move the slope to op1
call _tofrac ;convert op1 to frac
;op1 = numerator
;op2 = denominator
FPmov(op1,y1) ;move num. to y1
FPmov(op2,y2) ;move den. to y2
jp c,exit ;if can't be reduced, exit
call _newline ;move the cursor down a line
ld hl,slope ;load the slope string
call _puts ;display the slope string
FPmov(y1,op1) ;move num. back to op1
ld a,16 ;16 = maxlentgh
call _formreal ;turn op1 into string
ld hl,op3 ;load string into hl
call _puts ;display and update cursor
ld a,Lslash ;load a "/" into a
call _putc ;display and undate cursor
FPmov(y2,op1) ;move denom. into op1
ld a,16 ;16 = max length
call _formreal ;make op1 a sting
ld hl,op3 ;load that string into hl
call _puts ;display the string
jp exit ;goto exit