Post news Report article RSS Feed December 30, 2013 - The Story Continues

I have resumed work on the DaggerXL Beta after taking a break for Christmas. I don’t have much new to show yet but I will talk about a few topics.

Posted by Freak2121 on Dec 30th, 2013

I have resumed work on the DaggerXL Beta after taking a break for Christmas. I don't have much new to show yet but I will talk about a few topics. WebUI On the XL Engine forums there has been mod work towards using the WebUI system that will be present in the Beta release. I talked about this system before in a previous blog post but now Lazaroth has been busy working on a UI mod, using existing web technologies to prototype. I dropped the files into the WebUI folder under the XL Engine and modified a bit of code (that will be externalized for the release) and was able to view the new UI in the current version of the XL Engine. There are a few issues to work out but its a great start and will allow me to work out kinks in the WebUI system. It also shows that using HTML5/CSS/Javascript and a browser is a great way of prototyping new UI ideas and the results can be nearly "drop-in" for use in the XL Engine.

LazarothUI_XLEngine

If you want more information on the mod or to help out, check out Lazaroth's thread on the forums.

Anatomy of a For-Loop in Daggerfall So what does a for-loop look like in Daggerfall? It turns out that recognizing for-loops generated by the compiler is rather simple as you'll see shortly. I have copied some of the actual assembly code with comments.

mov dword [ebp-0018],00000000
[19A283]				;for (int i=0; i<27; i++) {
cmp dword [ebp-0018],001B               ;//comparison block
jl 0019A293
jmp 0019A2D1
[19A28B]			        ;//for-loop counter block
mov eax,[ebp-0018]
inc dword [ebp-0018]
jmp 0019A283
[19A293]			        ;//code block
...
jmp 0019A28B
[19A2D1]				;} //for (int i=0; i<27; i++)
The actual assembly code is on the left, with code addresses shown in brackets [ ]. As you can see the local variable, ‘i' as I named it, is at ebp-0x18. So the first thing that happens is to fill the value with 0, basically the i=0; part of the for-loop. Next it enters the comparison block where the local variable is compared to a value - in this case 0x1B = 27, and if the comparison is successful the execution jumps to the code block, otherwise it jumps to the end of the loop (the last line shown above).


When you see the C/C++ code
for (int i=0; i<27; i++)
{
    //code inside the loop
}

The "code inside the loop" is the code block above. Once the code is executed or a continue is hit - then the execution jumps to the for-loop counter block. Here the counter is incremented, decremented or otherwise modified before jumping back to the comparison block. Obviously if a break is encountered in the code block, the jump will lead directly to the end of the loop or to a another address which will have a jump to the end of the loop if the difference in address is too big for a "short" jump (usually). Remember that for-loops look different with modern compilers and sometimes the format is tweaked a bit even in Daggerfall depending on what the optimizer does. But this is essentially what a for-loop looks like, even nested loops have a similar, though recursive, structure.

The Beta

I have recently continued work towards the Beta release and will start posting updates again as additional progress is made.

Post comment Comments
xivel
xivel Dec 31 2013, 11:36am says:

Very nice!

+2 votes     reply to comment
Guest
Guest Jan 6 2014, 11:19pm says:

This comment is currently awaiting admin approval, join now to view.

Guest
Guest Jan 27 2014, 12:01pm says:

This comment is currently awaiting admin approval, join now to view.

TheUnbeholden
TheUnbeholden May 3 2015, 6:36am says:

Why progress has been slow: Xlengine.com

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

News
Browse
News
New
Post news
Report Abuse
Report article
Share
Related Mods
DaggerXL (Daggerfall)
DaggerXL Daggerfall - Single Player Role Playing
Related Games
Daggerfall
Daggerfall Single Player Role Playing
Related Groups
XL Engine Dev
XL Engine Dev Developer