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.

Geek Culture / Theory about DBPro for next loops

Author
Message
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 22nd Apr 2012 08:31
I have noticed int he past that dark basic pro programs dont end without using task manager. I was experimenting with recursion today and using the following code:

I found something. The code above is equivalent in operation to:

However, the recursion code is nearly impossible to close, and like a program that you try to close while executing a for next loop, you need the task manager.

Therefore, i think i have figure out that DBPro uses recursion to simulate for next loops! Does anyone know if im right?

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Apr 2012 18:56 Edited at: 22nd Apr 2012 18:56
Using recursion like that will eventually overflow the stack. The difference between for .. next and other loops in DBPro is that with normal loops, DBPro calls an update function every loop which among other things, checks if the escape key was pressed. The for .. next loop doesn't do this so that it will run faster.

[b]
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Apr 2012 19:26 Edited at: 22nd Apr 2012 19:27
Diggsey is correct, FOR/NEXT loops don't do the check (which is why they are one of the fastest loops). You could have just looked at the assembly output to check this.



Support a charitable indie game project!
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 22nd Apr 2012 19:37
Ah! How would I look at the assembly?

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Apr 2012 21:16
In the DBPro/Temp folder the .dbm file contains the assembly code of the last compiled program.

[b]
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 22nd Apr 2012 21:54
Thanks diggsey!

Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 22nd Apr 2012 21:57
On a related note, is there any way to see the assembly of any program at runtime?

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Apr 2012 22:06
Quote: "On a related note, is there any way to see the assembly of any program at runtime?"


A debugger such as this one will do the job.



Support a charitable indie game project!
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Apr 2012 22:06 Edited at: 22nd Apr 2012 22:07
Quote: "On a related note, is there any way to see the assembly of any program at runtime?"


I use OllyDBG.

Is there a way to modify the assembly output in the DBM file and compile it from there?

[EDIT] Benjamin ninja posted.

TheComet

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 23rd Apr 2012 14:09 Edited at: 23rd Apr 2012 14:11
No, the .dbm file only contains the assembly code created from DBPro code. That assembly code is then packed along with a load of .dlls with an .exe stub that unpacks everything and performs the initialisation.

Also, I highly recommend Cheat Engine for this kind of debugging. It has the best assembly debugger I've ever seen, along with all sorts of built in tools. It also allows you to reassemble specific parts of a program instead of the whole thing, so you could replace the code with your own as its running, and then from that create a patch which can be applied to the original .exe.

[b]

Login to post a reply

Server time is: 2025-05-22 03:23:55
Your offset time is: 2025-05-22 03:23:55