Re: A83: Date: Tue, 7 Nov 2000 17:20:21 -0500


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

Re: A83: Date: Tue, 7 Nov 2000 17:20:21 -0500




I think FPMult screws up the A register, so you have to preserve it
(push AF/ pop AF). If you want to count on it :)
The same to the other FP calls...

>
> I need some major help.  Ok, I have this routine that is called when
> decimalpoint = 1.  No problem so far. The other variables:
> decnumtime = 0.
> OP1 =  2
> OP2 = 10
> OP4 =  3
> When the routine is first called.  However, when I run the program I
> always recieve an overflow error.  I think there is an error with the
line
> "jr nz,Multgain".  I can up with that idea after some experimenting,
> but I am not sure why.  Can someone please help debug this?
> Thanks in advance.
> Rob
>
>
> Decsodiv:
>  ld a,(decnumtime)      ;A = (decnumtime)
>  inc a                  	;A++
>  ld (decnumtime),a	;(decnumtime) = A
>  inc a			;A++
> Multgain:
>  B_CALL FPMult	;OP1 = OP1 * OP2
>  dec a		;A--
>  jr nz,Multgain		;if(A != 0) Jump to Multagain
>  xor a			;A = 0
>  ld a,(decnumtime)	;A = (decnumtime)
>  B_CALL OP4ToOP2 	;OP2 = OP4
>  B_CALL FPAdd	;OP1 = OP1 + OP2
>  inc a			;A++
> Divagain:
>  B_CALL FPDiv	;OP1 = OP1 / OP2
>  dec a		;A--
>  jr nz,Divagain		;if(A != 0) Jump to Divagain
>  jp bipassmult		;Jump to bipassmult (No errors From Here on out)
>  ret

PS sorry for screwing up your comments...