Discussion:
PB/Dos - questions about int function, serial i/o errors
(too old to reply)
Basic Guy
2009-11-25 13:57:34 UTC
Permalink
Raw Message
Are there any known issues or bugs for the PowerBasic/DOS 3.5 int()
function?

I'm debugging various programs that use the int() function and there's
never any problem with it until at some point PB breaks and claims an
error 5 on the int() line.

for example, the line is something like this:

rt = int (realtime * 10) / 10

If realtime = 10.34567, then I want rt to be 10.3 (ie to strip away all
but one decimal place away from realtime).

I have no idea why that line seems to work fine most of the time, then
all of a sudden stop working.

Does the argument for int() need to be less then 65535?

Also, I'm doing serial I/O between two PC's, and I sometimes get error
57 on a line like this:

a = loc(5)
if a > 0 then a$ = input$(1,5)

where a com port was previously opened under handle #5. I'm checking to
see if there is anything to read in the com buffer before I try to
perform the read, and always there are a few dozen characters in the
buffer when the error happens.

The error 57 happens on the input line.

I have the meta statement COM$ 4096 (to set up a buffer for serial
communications) so I don't think that this is a buffer overrun
situation.
hutch--
2009-11-26 23:42:37 UTC
Permalink
Raw Message
HAY Goy Boy,

You need to go to the PowerBASIC peer support forum to get answers.
JQuick
2009-11-28 06:10:51 UTC
Permalink
Raw Message
Knowing the value of REALTIME when the error occurs might be helpful.

I don't remember ever having any problems with the INT() function, and I
used it in several different applications.

Sometimes when there was an overflow of some sort, the compiler would
begin giving erroneous error messages, so that it was necessary to
reboot to get it working again. I don't recall ever having to uninstall
and reinstall it though.

A number of times I have seen where the error is reported for the wrong
line, but it has always been true that there was a problem someplace.
Try isolating it by putting the division on the next line. If that
doesn't help, write a separate test program and try to find values for
realtime that work and don't work, etc.

For example, insert this:
X = INT(REALTIME)
Y = REALTIME - X
Z = INT(Y * 10!)
RT = X + Z / 10!
Post by Basic Guy
Are there any known issues or bugs for the PowerBasic/DOS 3.5 int()
function?
I'm debugging various programs that use the int() function and there's
never any problem with it until at some point PB breaks and claims an
error 5 on the int() line.
rt = int (realtime * 10) / 10
If realtime = 10.34567, then I want rt to be 10.3 (ie to strip away all
but one decimal place away from realtime).
I have no idea why that line seems to work fine most of the time, then
all of a sudden stop working.
Does the argument for int() need to be less then 65535?
Also, I'm doing serial I/O between two PC's, and I sometimes get error
a = loc(5)
if a > 0 then a$ = input$(1,5)
where a com port was previously opened under handle #5. I'm checking to
see if there is anything to read in the com buffer before I try to
perform the read, and always there are a few dozen characters in the
buffer when the error happens.
The error 57 happens on the input line.
I have the meta statement COM$ 4096 (to set up a buffer for serial
communications) so I don't think that this is a buffer overrun
situation.
Olav
2009-11-28 09:04:51 UTC
Permalink
Raw Message
My experience with PBDOS and weird error messages is that it mostly is
caused by a memory override; somewhere else in the code. Maybe in a
third-party library.

A way to spot this is when you single step a line; the line which is
actually executed is a different one from the line the debugger apparently
is executing.

The way I have solved this is by setting a breakpoint somewhere in the
source code, and when the execution of the code stops at that line; just
make a note of some variable values around that line; preferable the next
line.

For instance you can add a line like

dummy = somevalue

and place a breakpoint on the line just above this line. If this dummy
variable now is assigned "somevalue" when executing the line with a
breakpoint on it; there has been some memory override earlier on in the
code.

Let me know if this was of any help.

--
Olav
Post by Basic Guy
Are there any known issues or bugs for the PowerBasic/DOS 3.5 int()
function?
I'm debugging various programs that use the int() function and there's
never any problem with it until at some point PB breaks and claims an
error 5 on the int() line.
rt = int (realtime * 10) / 10
If realtime = 10.34567, then I want rt to be 10.3 (ie to strip away all
but one decimal place away from realtime).
I have no idea why that line seems to work fine most of the time, then
all of a sudden stop working.
Does the argument for int() need to be less then 65535?
Also, I'm doing serial I/O between two PC's, and I sometimes get error
a = loc(5)
if a > 0 then a$ = input$(1,5)
where a com port was previously opened under handle #5. I'm checking to
see if there is anything to read in the com buffer before I try to
perform the read, and always there are a few dozen characters in the
buffer when the error happens.
The error 57 happens on the input line.
I have the meta statement COM$ 4096 (to set up a buffer for serial
communications) so I don't think that this is a buffer overrun
situation.
Happy Trails
2009-11-28 12:08:32 UTC
Permalink
Raw Message
Post by hutch--
HAY Goy Boy,
You need to go to the PowerBASIC peer support forum to get answers.
========

Hahahahaha!

This newsgroup is working as it should.

By posting his nonsense here, putch is drawing new attention to Basic
Guy's posted questions, and by his contrary attitude is actually
encouraging others to try harder to help Basic Guy.

Thank you putch for helping to keep this thread and this forum active,
alive, and functional (you dumbass!).

========
hutch--
2009-11-30 12:46:37 UTC
Permalink
Raw Message
Why you are improving Slap Happy, you may even end up with a sense of
humour.

Loading...