Overflow

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Overflow

Post by SebMcClouth »

When I tried to rewrite my code (in a new dir) I got this message. When I returned to my original code (which worked fine before) I got the same Overflow.

The overflow message:
Overflow in line 0 of module WAIT at adress 155D:0256
Module WAIT, know to my system as LIB/WAIT.QS0 contains the following code:

Code: Select all

'
' qbinux/lib/wait.qs0
'
' Copyright (C) 2005 Sebastian McClouth

'$INCLUDE: 'include/b4g.ql0'
'$INCLUDE: 'include/qbinux.ql0'
'$INCLUDE: 'include/handle.err'

SUB Delay (Value!)
        t! = TIMER + Value!
        pt = TIMER
        DO: LOOP UNTIL TIMER >= t! OR TIMER < pt
END SUB
The DECLARE is situated in INCLUDE/QBINUX.QL0 and the command which gives the problem is:
Delay 1
Did I do sumfin wrong?

grtz
Seb
I know why you're here. I know what you've been doing... why you hardly sleep, why you live alone, and why night after night, you sit by your computer...<br>
Unfortunately, no one can be told what Qbinux is. You have to see it for yourself.
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

I think you either need to:

Copy the SUB into your main module

Make a lib

Uhh... (this is where someone else picks up)
Image
Guest

Post by Guest »

how can there be a overflow at line 0 as the first 4 are comments
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

1) Any code in the included files?
2) What is your default variable type?
3) If default var type is integer, then: pt = TIMER will cause an overflow
I have left this dump.
User avatar
ShadowWolf
Veteran
Posts: 56
Joined: Thu Mar 04, 2004 1:32 pm
Contact:

Post by ShadowWolf »

it might not be a logical problem. this Shell of yours is getting big right. you simple might have reached the point you have some much Code QB starts acting funny.

try commenting out some unneed or simple take a unneed model and try a compile. another option would be to dump the QB ide and compile at command line.
Seb McClouth

Post by Seb McClouth »

In reply to ShadowWolf: It is compiled at the command line...

In reply to Z!re:
1) Any code in the included files?

Code: Select all

'
' qbinux/include/qbinux.ql0
'
' Copyright (C) 2005 Sebastian McClouth
'
'
'Modification history include/qbinux.ql0
'
'12 Sep 05      Seb McClouth
'       Builded this file. Based upon novix.bi of Novix.

'Used through-out Qbinux               (all)
'$INCLUDE: 'include/qbx.ql0'

'Setup                                 (boot/setup.qs0)
TYPE screeninfo
	CursorPos       AS INTEGER
	HaveVGA         AS INTEGER
	OrigX           AS INTEGER
	OrigY           AS INTEGER
	OrigVideoMode   AS INTEGER
	OrigVideoCols   AS INTEGER
	OrigVideoEGAbx  AS INTEGER
	OrigVideoLines  AS INTEGER
	OrigVideoIsVGA  AS INTEGER
	VideoMode       AS INTEGER
	VideoCols       AS INTEGER
	VideoEGAbx      AS INTEGER
	VideoLines      AS INTEGER
END TYPE

DECLARE SUB BasicDetect ()
DECLARE SUB Setup ()
DECLARE SUB Video ()

'Init                                  (init/main.qs0)
TYPE tm
	sec             AS INTEGER
	min             AS INTEGER
	hour            AS INTEGER
	mday            AS INTEGER
	mon             AS INTEGER
	year            AS INTEGER
	wday            AS INTEGER
	yday            AS INTEGER
	isdst           AS INTEGER
END TYPE

DECLARE FUNCTION CMOSRead! (addr!)
DECLARE SUB Init ()
DECLARE SUB Main ()
DECLARE SUB TimeInit ()

'FileSystem                            (fs/*.qs0)
DECLARE SUB AscendDir ()
DECLARE SUB BackupNVXFS ()
DECLARE FUNCTION Decrypt$ (in$, pass$)
DECLARE FUNCTION Encrypt$ (in$, pass$)
DECLARE SUB FAT2NVXFS (fatfile AS STRING, nvxfsfile AS STRING)
DECLARE SUB FATCopy (file1 AS STRING, file2 AS STRING)
DECLARE FUNCTION FindFatFile% (fil AS STRING)
DECLARE FUNCTION GetID% (filedir AS STRING, typ AS INTEGER)
DECLARE FUNCTION GetName$ (fd AS STRING, typ AS INTEGER)
DECLARE SUB KillDirEntry (search AS STRING)
DECLARE SUB MakDir (dir AS STRING)
DECLARE SUB PackNVXFS ()
DECLARE SUB RemDir (dir AS STRING)
DECLARE SUB RmFile (file AS STRING)
DECLARE SUB SetAttribute (file AS STRING, AttrName AS STRING, AttrData AS STRING)
DECLARE SUB SetDir (DirID AS LONG)
DECLARE SUB SetDrv (DrvID AS LONG)
DECLARE FUNCTION TBSEOF% (handle AS STRING)
DECLARE FUNCTION TBSGet$ (bytes AS INTEGER, offs AS LONG, handle AS STRING)
DECLARE FUNCTION TBSInput$ (handle AS STRING, ln AS INTEGER)
DECLARE FUNCTION TBSList$ (search$, typ%, output$)
DECLARE FUNCTION TBSOpen$ (file AS STRING, mode AS INTEGER)
DECLARE FUNCTION TBSPrint$ (dat AS STRING, extrachar AS INTEGER, handle AS STRING)
DECLARE FUNCTION TBSPut$ (dat AS STRING, offs AS LONG, handle AS STRING)
DECLARE SUB UnPackNVXFS ()
DECLARE FUNCTION WorkPath% (file AS STRING)

'Kernel                                (kernel/*.qs0)
DECLARE SUB Panic (s AS STRING)

'Libraries			       (lib/*.qs0)
DECLARE SUB Delay (Value!)
DECLARE FUNCTION STRIM$ (Value AS INTEGER)
DECLARE FUNCTION TRIM$ (Value AS STRING)

'Shared variables
COMMON SHARED AskVGA AS INTEGER
COMMON SHARED BaseMem, ExtMem AS INTEGER
COMMON SHARED Console AS STRING
COMMON SHARED CurDir AS STRING * 4, CurDrive AS STRING * 4, CurUser AS STRING * 1
COMMON SHARED RegsX AS RegTypeX
COMMON SHARED SVGAMode AS INTEGER

'Constants
CONST True = 1, False = NOT True

'Shared dim's
DIM SHARED time AS tm
DIM SHARED param AS screeninfo
Besides this one, there's QBX.BI and b4g.bi

2) What is your default variable type?
For Delay? Should be Value!

3) If default var type is integer, then: pt = TIMER will cause an overflow
I know that the variable cannot not be an integer. So it's not that.

The drawingtable:
- working qbinux
- new begin of working qbinux (2 diffrent directories)

When I compiled the working version before I started on the new one, everything was fine.
After I started at the new one, I gotten this overflow. When I returned to the working one, and I compiled it, it gave the overflow.

grtz
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

What I mean is, do you use: DEFINT A-Z anywhere in your code.

Thats the default variable type:
DEFault INTeger

As TIMER can return numbers > 32767 you get an overflow on the: pt = TIMER, if pt is an integer. You don't tell pt to be anything, you just use it. So, thats why I'm asking.
I have left this dump.
User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Post by SebMcClouth »

There are some here and there of those DEFine INTegers.

Z!re ones again you were right. pt did it... I just changed it to pt! and it didn't have the overflow anymore.

Now I have a:
Path/File access error in line 0 of module SETUP at address 11A5:14B6
Which I'm figuring out now... I can find it... It'll be okay... If not... I'll be back.

thx all, specially Z!re (no I'm not hitting on you)

grtz
Seb
I know why you're here. I know what you've been doing... why you hardly sleep, why you live alone, and why night after night, you sit by your computer...<br>
Unfortunately, no one can be told what Qbinux is. You have to see it for yourself.
Post Reply