Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Program crashes with no errors in code

Author
Message
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 26th Mar 2003 05:43
The error I get is:

The instruction at "0x01032816" referenced memory at "0x00000000". The memory could not be "read".

The line in the code sample below where this happens is:
"COPY BITMAP 1,0,0,183,160,0,0,25,183,185"

Which worked fine until I added the:
"COPY BITMAP 0,0,25,183,160,12,0,25,183,160"

Now, even with the added code taken out, it does the exact same thing. I have tried closing DBPro and reloading it and my project. I have tried restarting the computer. I even switched out all my RAM to make sure a stick didn't suddenly go bad on me. Nothing. Same error.

Anyway, here's the code:

DO

GUI()
FUNCTION GUI()
LOAD BITMAP "Menus\Images\1.bmp",1
LOAD BITMAP "Menus\Images\2.bmp",2
LOAD BITMAP "Menus\Images\3.bmp",3
LOAD BITMAP "Menus\Images\4.bmp",4
LOAD BITMAP "Menus\Images\5.bmp",5
LOAD BITMAP "Menus\Images\6.bmp",6
LOAD BITMAP "Menus\Images\7.bmp",7
LOAD BITMAP "Menus\Images\8.bmp",8
LOAD BITMAP "Menus\Images\main.bmp",9
LOAD BITMAP "Menus\Images\fbh.bmp",10
LOAD BITMAP "Menus\Images\fb.bmp",11
CREATE BITMAP 12,1024,768

COPY BITMAP 9,0,0,223,25,0,0,0,223,24
Cont()
ENDFUNCTION


FUNCTION Cont()
DO
control:

buf = 0
mx = mousex()
my = mousey()
mc = mouseclick()

IF my 183 OR my > 185 THEN COPY BITMAP 12,0,0,183,160,0,0,25,183,160
IF my
heartbone
23
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 26th Mar 2003 05:49 Edited at: 26th Mar 2003 05:51
What video card? How much SDRAM?
If non nVidia expect certain video ram 'issues'.

Load the images as images to free up the video ram.
A 2D program of mine that should only have needed 8 MB video ram
needed 16MB video for nVidias and 32 MB for SIS cards.

The more you see, the more you know.
The more you know, the more you see.
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 26th Mar 2003 05:49
Ack code button didn't work.. It also seems to have cut it off. I'll try again.



I also have info from C++.

It shows the compiler to have crashed:
"Unhandled Exception in DBProCompiler.exe (D3D8.DLL): 0xC0000005: Access Violation."

The line the pointer is at reads:

01032816 mov eax,dword ptr[ebx]

Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 26th Mar 2003 05:50
Actually,

GeForce 4 MX 440

Ack my 2nd reply to my own post too fast lol
Think that's all the info y'all would need

heartbone
23
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 26th Mar 2003 05:58 Edited at: 26th Mar 2003 06:00
In addition to using images instead of bitmaps,
there are structure problems in your program.
Remove the functions out of any Do -- Loop structures.

Rem ******* MAIN
DO
GUI()
LOOP
End

Rem ******** FUNCTIONS

FUNCTION FilMen()

COPY BITMAP 0,0,25,183,160,12,0,25,183,160
COPY BITMAP 1,0,0,183,160,0,0,25,183,185

buffer = 0
mx = mousex()
my = mousey()
mc = mouseclick()

IF mx > 183 OR my > 185 THEN COPY BITMAP 12,0,0,183,160,0,0,25,183,160
IF my < 25 AND mc = 1 THEN COPY BITMAP 12,0,0,183,160,0,0,25,183,160

ENDFUNCTION

FUNCTION GUI()
LOAD BITMAP "MenusImages1.bmp",1
LOAD BITMAP "MenusImages2.bmp",2
LOAD BITMAP "MenusImages3.bmp",3
LOAD BITMAP "MenusImages4.bmp",4
LOAD BITMAP "MenusImages5.bmp",5
LOAD BITMAP "MenusImages6.bmp",6
LOAD BITMAP "MenusImages7.bmp",7
LOAD BITMAP "MenusImages8.bmp",8
LOAD BITMAP "MenusImagesmain.bmp",9
LOAD BITMAP "MenusImagesfbh.bmp",10
LOAD BITMAP "MenusImagesfb.bmp",11
CREATE BITMAP 12,1024,768

COPY BITMAP 9,0,0,223,25,0,0,0,223,24
Cont()
ENDFUNCTION

FUNCTION Cont()
DO
control:
buf = 0
mx = mousex()
my = mousey()
mc = mouseclick()

IF my < 25 AND mx < 31
COPY BITMAP 10,0,0,31,24,0,0,0,31,24
WHILE my < 25 AND mx < 31
buf = 1
mx = mousex()
my = mousey()
mc = mouseclick()
IF mc = 1 THEN FilMen()
ENDWHILE
ENDIF

If buf = 1 THEN COPY BITMAP 11,0,0,31,24,0,0,0,31,24
LOOP
ENDFUNCTION

The more you see, the more you know.
The more you know, the more you see.
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 26th Mar 2003 06:05
The problem with loading images instead of bitmaps is it reduces the quality of the image. I am using this to make a GUI for a world editor, so I need these images to be as crisp as possible

Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 26th Mar 2003 06:34
Found a working way to do it...

Sorta following your advice, I am deleting each bitmap as soon as it is used.
This will make for tricky code in the GUI editor my program will have, but I'll (hopefully) find a workaround.

Here's the code:



The other loop in Filmen() is needed, so that the position of the mouse cursor is continually updated. This is crucial for the operation of this part of the program.

Login to post a reply

Server time is: 2026-07-11 12:01:53
Your offset time is: 2026-07-11 12:01:53