The XL Engine is and will remain free, donations are purely optional but greatly appreciated.

Recent Comments

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.


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.




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.

22 Responses to “The Story Continues”

  • tynan:

    This is great stuff, as always. Keep up the outstanding work!

  • Matarael:

    Looks great! Keep it up! :)

  • Dan:

    Excellent! Keep up the good work.

    Given your previous posts about code, I was worried when I read the headline “Anatomy of a For-Loop in Daggerfall” was going to be some nightmare of convoluted spaghetti code, but I was pleasantly surprised!

  • Chris:

    Looking great, thanks for the update.

  • Jake:

    I am absolutely PUMPED for the beta release! Keep up the excellent work, you’re doing a wonderful job!

  • Damanslaya:

    Amazing work Lucius as usual and Lazaroth, the new UI is looks absolutely much better (I like how you changed the health bar from green to red and the stamina bar from red to green. I never knew went in Bethesda’s minds when they originally did that…)

  • Mark:

    Awesome work!! Can’t wait til it’s done!!

  • Thor:

    hello, I came across DarkXL about 2years ago when I was searching for a way to play Dark Forces with higher res. Sadly, there site was not updated so frequently and I thought the project died. I’m glad to see you are working on it, can’t wait to play Daggerfall again. It would be also great if you could do the same for TES Arena ;>

  • deMangler:

    You guys rock! Happy new year and thanks for the updated info – interesting stuff.

  • John Doe:

    What I think would be cool would have like some type of online chat sidebar in the game. In the chat you could talk to others playing the games on the XL engine. Of course it would be optional if you didn’t want it. But I don’t know if it would be used that much or if the time to make that would be even worth it, but it is just a suggestion. =)

  • Thomas:

    Hey there,

    I have been following this project for a few weeks now, after I finally found Dark XL as a possibility to play this beloved game of my youth in a resolution that makes sense on a 27″ display.

    Unfortunately, it behaves erratically on my computer (win7 64 bit) and after a few starts that actually were successful (more or less), I have not been able to start it up (crashes after pressing “begin mission”).

    I am eagerly waiting for the beta now, hoping that some higher power will make it work :-)

    Is there any idea about when the beta for Dark XL will be released? From the progress reports I get the impression that work on the Dark XL part of the project has stopped. Is that correct?

    Best regards,


  • Since it’s the question to ask these days: Are you considering oculus rift support?

  • Nicholas:

    You haven’t posted an update in a while.

  • WtfIsAUsername:

    Where are you’re updates?

  • I couldn’t register on the forum. It says the password doesn’t contain the required characters (i’ve tried every possible way, but nothing works). And the reason i want to register is so that i could contribute to the development of the 3d models mod and the texture mod, as well as telling about my ideas.

    I would love if you could just disable the thing that prevents me from registering.

  • irukanjji:

    I use tle last vs of XL_Engine_Release_02, in DarkXL, how can i enable the console ? ( the tilde button, dont work)

    Thanks for your work, its awesome

  • irukanjji:

    Never mind, i figured out, im ,y keyboard QWERTY portuguese, is “ç” key

  • Robert:

    program crashes for me,
    I get an error about the first item in fall.exe needing to be {Ruby} and it gets a buffer error and I cant run it for daggerfall
    when I try the first mission for dark forces, the game crashes and it closes…. >.>

  • Claus:

    Can’t wait for the next update! I love daggerfall, but it’s not worth busting put a computer from the 90’s, or messing with DOSBox…

  • klapse:

    Hows the project going? Dont give up!

Leave a Reply

The XL Engine is and will remain free, donations are purely optional but greatly appreciated.