Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Illegal Function call, but.......

Status
Not open for further replies.

Plystire

Programmer
Aug 11, 2003
13
0
0
US
it only gives me the error when i try to run the program as an executable.

It gives me this "Illegal function call in module SPACDRIV at address 0540:0991"

But i don't get any errors when I run it through QBX

Does anyone know what is causing this? This is very important to me.

~PlystirE~
 
There are a "few" ways you can perform an illegal function call in a compiled EXE that won't show up in the QB IDE. Would you mind posting the relevant code, declarations, etc. so we can take a look at the problem.

We can't even speculate based on a module name and an address.


...helpful...
medal.jpg
 
Without more information it's hard to say what's causing this error with your program, although it does narrow down the bug searching knowing that it runs fine in the IDE but fails when compiled.

Are you using CHAIN at all? If so, don't create a run-time needed EXE - create a standalone one or this error will occur.

Also, having too complex of an equation on a line will often cause this error. If you have a super-size equation on a line, try simplifying it by breaking it up into smaller parts, or compile with the /FPa option(alternative math).

- Dav
Visit THE CODE POST
 
Ok...well at least some people know what might be causing it.

I once tried only compiling my title screen (after declarations and everything) and it gave me the same error, so i don't think it was an equation problem. (plus i have this thing about not seeing the rest of a line while I'm coding)

Here are all of my declarations that I had when the error came up.

DECLARE SUB dead (res$)
DECLARE SUB shop1 ()
DECLARE SUB shoplist ()
DECLARE SUB compo ()
DECLARE SUB specs ()
DECLARE SUB track ()
DECLARE SUB BBS ()
DECLARE SUB missi ()
DECLARE SUB shop3 ()
DECLARE SUB compmiss (miss$)
DECLARE SUB findmission ()
DECLARE SUB waitkey ()
DECLARE FUNCTION shipcolli! (x!, y!, sx!, sy!)
DECLARE SUB printtex (tex$, x1!, y1!)
COMMON SHARED globalct AS DOUBLE, upkey$, downkey$, leftkey$, rightkey$, enterkey$, Drilllev, collectorlev, astdock, Blaster
COMMON SHARED credit, shiptype, Stati, tracktype$, tracknum, fuel, lifesupport
ON ERR GOTO traperr
RANDOMIZE TIMER
upkey$ = CHR$(0) + CHR$(72)
downkey$ = CHR$(0) + CHR$(80)
leftkey$ = CHR$(0) + CHR$(75)
rightkey$ = CHR$(0) + CHR$(77)
enterkey$ = CHR$(13)

'load sprites
DIM ship1u(100)
DIM ship1ub(100)
DIM ship1d(100)
DIM ship1db(100)
DIM ship1l(100)
DIM ship1lb(100)
DIM ship1r(100)
DIM ship1rb(100)
DIM ship1um(100)
DIM ship1ubm(100)
DIM ship1dm(100)
DIM ship1dbm(100)
DIM ship1lm(100)
DIM ship1lbm(100)
DIM ship1rm(100)
DIM ship1rbm(100)
DIM ship2u(100)
DIM ship2ub(100)
DIM ship2d(100)
DIM ship2db(100)
DIM ship2l(100)
DIM ship2lb(100)
DIM ship2r(100)
DIM ship2rb(100)
DIM ship2um(100)
DIM ship2ubm(100)
DIM ship2dm(100)
DIM ship2dbm(100)
DIM ship2lm(100)
DIM ship2lbm(100)
DIM ship2rm(100)
DIM ship2rbm(100)
DIM station(15 * 25)
DIM stationm(15 * 25)
DIM planet1(30 * 30)
DIM planet1m(30 * 30)
DIM sun1(40 * 40)
DIM sun1m(40 * 40)
DIM ast1(100)
DIM ast1m(100)
DIM ast2(100)
DIM ast2m(100)
DIM fuel(18 * 6)
DIM life(45 * 6)
DIM batt(30 * 6)

DEF SEG = VARSEG(ship1u(100))
BLOAD "SHIP1u.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1ub(100))
BLOAD "SHIP1uB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1d(100))
BLOAD "ship1d.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1db(100))
BLOAD "SHIP1dB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1l(100))
BLOAD "SHIP1l.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1lb(100))
BLOAD "SHIP1lB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1r(100))
BLOAD "SHIP1r.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1rb(100))
BLOAD "SHIP1rB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship1um(100))
BLOAD "SHIP1u.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1ubm(100))
BLOAD "SHIP1uB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1dm(100))
BLOAD "SHIP1d.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1dbm(100))
BLOAD "SHIP1dB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1lm(100))
BLOAD "SHIP1l.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1lbm(100))
BLOAD "SHIP1lB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1rm(100))
BLOAD "SHIP1r.msk", 0
DEF SEG
DEF SEG = VARSEG(ship1rbm(100))
BLOAD "SHIP1rB.msk", 0
DEF SEG
DEF SEG = VARSEG(station(25 * 15))
BLOAD "stat1.qxs", 0
DEF SEG
DEF SEG = VARSEG(stationm(25 * 15))
BLOAD "stat1.msk", 0
DEF SEG
DEF SEG = VARSEG(planet1(30 * 30))
BLOAD "planet1.qxs", 0
DEF SEG
DEF SEG = VARSEG(planet1m(30 * 30))
BLOAD "planet1.msk", 0
DEF SEG
DEF SEG = VARSEG(sun1(40 * 40))
BLOAD "sun1.qxs", 0
DEF SEG
DEF SEG = VARSEG(sun1m(40 * 40))
BLOAD "sun1.msk", 0
DEF SEG
DEF SEG = VARSEG(ast1(100))
BLOAD "ast1.QXS", 0
DEF SEG
DEF SEG = VARSEG(ast1m(100))
BLOAD "ast1.msk", 0
DEF SEG
DEF SEG = VARSEG(ast2(100))
BLOAD "ast2.QXS", 0
DEF SEG
DEF SEG = VARSEG(ast2m(100))
BLOAD "ast2.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2u(100))
BLOAD "SHIP2u.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2ub(100))
BLOAD "SHIP2uB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2d(100))
BLOAD "SHIP2d.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2db(100))
BLOAD "SHIP2dB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2l(100))
BLOAD "SHIP2l.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2lb(100))
BLOAD "SHIP2lB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2r(100))
BLOAD "SHIP2r.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2rb(100))
BLOAD "SHIP2rB.QXS", 0
DEF SEG
DEF SEG = VARSEG(ship2um(100))
BLOAD "SHIP2u.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2ubm(100))
BLOAD "SHIP2uB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2dm(100))
BLOAD "SHIP2d.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2dbm(100))
BLOAD "SHIP2dB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2lm(100))
BLOAD "SHIP2l.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2lbm(100))
BLOAD "SHIP2lB.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2rm(100))
BLOAD "SHIP2r.msk", 0
DEF SEG
DEF SEG = VARSEG(ship2rbm(100))
BLOAD "SHIP2rB.msk", 0
DEF SEG
DEF SEG = VARSEG(fuel(18 * 6))
BLOAD "fuel.qxs", 0
DEF SEG
DEF SEG = VARSEG(life(45 * 6))
BLOAD "life.qxs", 0
DEF SEG
DEF SEG = VARSEG(batt(30 * 6))
BLOAD "batt.qxs", 0
DEF SEG

DIM starsx(50)
DIM starsy(50)
DIM stars2x(50)
DIM stars2y(50)
DIM stars3x(50)
DIM stars3y(50)

[/code]

deng, i guess i never realised just how much i had to declare :|

~PlystirE~
 
I noticed that you have a variable called blaster. Is that for a sound library? Lots of libraries will cause errors on some computers.

Also make sure that the BLOAD files are in the correct folder. To make sure try using SHELL "cd c:\folder"

If nothing works the easiest way to find the error is to cut it in half and compile the first part, if that works then the error is in the second half, and just keep breaking it down like that until you've narrowed onto it.

If a man says something in the forest and no woman hears it is he still wrong?
 
No, Blaster is just a variable I use in my program (I have no sound in this game at the moment, as I suck at using sound)

Wouldn't QB give me an error if the BLOAD files were not in the correct folder?

I suppose I better start cutting my declarations down then huh? ;) ;)

~PlystirE~
 
Well I found what has been causing the error.

It turns out that it gets the error when I place sprites onto the screen. Now why is it giving me an error for that?

And why is it only giving me the error when it's ran as a stand-alone exe? Shouldn't it be the same as running from QB?

Is there something wrong with compiler?

~PlystirE~
 
Not being able to test your code, it's almost impossible to replicate your error.

But looking at your declarations I find...
[tt]DECLARE FUNCTION shipcolli! (x!, y!, sx!, sy!)[/tt]
Since your paramenters [tt]x!, y!, sx![/tt] and [tt]sy![/tt] and the function itself are all single precision, it looks like you are dealing with some rather large numbers. Isn't it possible that you are trying to address an area of the screen beyond the physical dimensions of the screen?

You will probably narrow down the source of the error if you convert this function, its parameters and the appropriate variables within the function to the integer variable type. That way your program will error-out while running in the IDE and you can correct the source of the problem (perhaps a faulty formula?) by inspecting the (perhaps large? perhaps negative?) values you are using to address the screen.

Why does your program only crash in compiled form? Once again, without being able to test the code, one can only speculate.


Come on, guys!
beckon.jpg
 
well i can tell you one thing.....it's not that function. and it can't be that i'm putting my sprites off screen because it runs fine when testing. not to mention the fact that the function doesn't even deal with putting sprites to the screen. It returns a 1 if the object i gave it collides with my ship and a 0 if it doesn't.

well i completely reverted my game to work....I had to make all my sprites on screen pixel by pixel.

~PlystirE~
 
You didn't have to do that, it seems like it would slow your program down a lot. Keep PUTting the sprites on the screen, just run a check to see if they will go off screen, then just draw those pixil by pixil.

If a man says something in the forest and no woman hears it is he still wrong?
 
Another alternative (although nasty as it is) is to create some debug subs like so:
------------------------
SUB DebugStart (LocationName$)
open "C:\DebugPRG.txt" for append as #250
print #250, "--Activated: "; LocationName$
Close #250
END SUB

SUB DebugEnd (LocationName$)
open "C:\DebugPRG.txt" for append as #250
print #250, "Deactivated: "; LocationName$
Close #250
END SUB
------------------------
You can all these subs at the beginning of each DECLARED SUB and pass along the name of each...You can also use them in the MAIN module JUST BEFORE CALLING them.

I know it will fill up pretty fast, but it's better than re-writing the whole thing.
--MiggyD
 
qbasicking: I did have to do this. For some reason whenever I used PUT, when using compiled exe, it gave me that error. But it doesn't give me there error when I use pixel by pixel.

MiggyD: Thanks for the Debug info but I've already tried soething like that and this error doesn't seem to be able to be trapped as most errors do.

~PlystirE~
 
You cant have a label name '0' also...

Ive had that problem about 35 times and just found that out about a month ago...

The shadow sees all cause the shadow is all
shadow_master@snowboard.com
 
To speed up the game you might want to use POKE instead of PSET.
 
I hate POKE....I was glad to say goodbye to POKE when I moved away from the C64 ;) ;)

Thanks for the info guys. Much kudos

~PlystirE~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top