Results 1 to 10 of 11

Thread: Expression to ASM

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    About expressions the hardest part (imo) is parsing and generating code for conditionals like "if(a || b && c)" etc where you need to generate compare-and-branch code. There are many good books on the topic of compiler construction, I found lots of good examples in this one.

    Generating native code with register allocation is another topic that is very advanced. There is the alternate path that Adobe has chosen which is to work with LLVM instead and let it generate high quality code for several different architectures.

    You should publish examples of the timings you talk about because it can gather interest to your compiler if it actually does perform better than a C-compiler. Frankly I doubt it but I hold my judgment until I see it

    Looks like an interesting project, good luck with it!
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

  2. #2
    Wow .. again, this is really interesting. If I had more time, I could indulge into this field of expertise aswell.

    You are using a separate assembler right? Because writing plain IA-32 machine code is sheer hell. Also, do you allready use a linker or does it only generate a single module with all the right addresses directly in it? If this project goes any deeper, you could write a nice article about it. Any plans of showing us the source?

    Also your timings are very suprising to me. I also doubt that it will be significantly faster than C, but I am very curious about it's performance anyway (and the things you have to give up in order to squeeze more code into the same nanoseconds).
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3
    @ VilleK my assembler/compiler already handles if, while, repeat and for statements, these are the simple things, they are just cmp and conditional jmp statements, check here to see documentation on control structure http://www.codeziron.com/index.php?page=documentation (all documentation is unfinished) if you mean multiple inline comparisons then yes it is a bit more complicated, i plan to add that next, it still is much more simple than maths expressions since you are not changing registers and so on (which is my main problem - since i dont want it to affect the users code) as for .NET - it is the destruction of programming......i would never advise anyone to even touch any language that is .NET (especially for games)

    as for checking it why, why dont you? it is available for download @ http://www.codeziron.com and of course it is faster than c since it is primarily assembly lol.....c is a nice language but it is still just a compiler and compilers can often struggle to generate optimised code, humans can optimise code far better than any compiler (if they know what they are doing of course)

    @ chronozphere, i do not use a seperate assembler, i am writing the assembler, that is what my project really is, it started as just a regular assembler, but now it is becoming its own language, with high level code etc... my compiler also has a built in linker, compile speeds are also very fast (but they will be much much faster once i fix all bugs etc) and machine code is actually quite easy once you get the hang of it

    here is a sample of ziron code for creating a dialog from resource (very simple sample)

    Code:
    program WIN32GUI 'Sample1';
    
    #resource 'dialog.RES';
                
    //the included RTL files    
    #include 'ziron32.zir';
    #include 'smm32.zir';
                    
    #include 'comctl32.zir';
    #include 'kernel32.zir';
    #include 'user32.zir';
    #include 'messages.zir';
                              
    function dlgFunc(DWord hDlg; DWord uMsg; DWord wParam; DWord lParam) {
      if (uMsg == WM_CLOSE) {
        EndDialog(hDlg, 0);
      } elseif (uMsg == WM_INITDIALOG) {
        ShowWindow(hDlg, SW_SHOWNORMAL);
      }
      return false;
    }
                    
    DWord hInstance = GetModuleHandle(nil);
    DialogBoxParam(hInstance, 1000, 0, @dlgFunc, 0);
    ExitProcess(0);
    anyways check it out.
    Last edited by Colin; 30-05-2011 at 06:18 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •