6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 12:21 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Debugging FP
PostPosted: Tue Jun 03, 2003 5:43 pm 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 460
Location: Canada
Hi, where is the best place to start debugging this problem ? (It's a cpu problem I think, but I need to trace it down to the exact line of code.)

Ready
?10.*10.
100

Ready
?10.0*10.0
39.0625

Ready
?10.0
9.76563

Ready
?10.0
9.76563

Ready
?10.
10

Ready
?10.0
9.76563


Thanks,
Rob


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jun 04, 2003 5:14 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Hi Rob,

I tried both version 1.03 and the latest, 1.05, on my system and did not have that problem.

What hardware are you running this on? What MPU and what kind of I/O? Could it be that your I/O routines are using (altering) some of the zero-page locations used by the FP routines?

Daryl


Top
 Profile  
Reply with quote  
 Post subject: Re: Debugging FP
PostPosted: Wed Jun 04, 2003 12:36 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Rob Finch wrote:
Hi, where is the best place to start debugging this problem ? (It's a cpu problem I think, but I need to trace it down to the exact line of code.)

Ready
?10.0*10.0
39.0625

Thanks,
Rob


With any problem like this you need to find out what is going wrong and in this case there are three areas where it can all go pear shaped.

In the conversion from a string to a value.

In the conversion from a value to a string.

In the math routines.

The easiest way to find out is to use a machine code monitor and do something like this ..

NEW
A=10

Now drop into the monitor and look for where A is held in memory. It should be at the start of variables space ($0303 usually in this case) and you should see bytes like this..

$41,$00,$84,$20,$00,$00

The $41,$00 is the variable name and the $84,$20,$00,$00 is the packed floating value for 10. If this is correct then you know the string to value is working.

If this was correct the next thing to do is go back into BASIC (warm start) and do something like this ..

B=10
B=B*A

Now drop into the monitor and look for where B is held in memory. It should be immediately after A and you should see bytes like this..

$42,$00,$87,$48,$00,$00

This is B and the packed floating value for 100. If this is correct but doing ...

PRINT B

... gives a silly value then the value to string routine is broke.

Once you determine which bit is broke you can narrow it down to a specific bit of code by entering test values using a monitor and going back into BASIC to see what happens.

With 100'0s of lines of code it's always difficult to say exactly where something is wrong, best you can do is say this routine or that routine and narrow it down from there.

Cheers,

Lee.


Top
 Profile  
Reply with quote  
 Post subject: Re: Debugging FP
PostPosted: Fri Jun 06, 2003 8:26 am 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 460
Location: Canada
Quote:
The easiest way to find out is to use a machine code monitor and do something like this ..

Can you recommend a monitor ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Debugging FP
PostPosted: Mon Jun 09, 2003 11:18 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Rob Finch wrote:
Can you recommend a monitor ?

Not really. I use a hacked version of CEGMON which is, to
be honest, crap. However it's something I grew up with and
like favourite slippers I'm loathe to throw it out.

Anything that can do simple memory view/modify and
perhaps memory dump should do.

Lee.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: