Menu

memory reservation

Help
ibo
2003-03-03
2003-03-04
  • ibo

    ibo - 2003-03-03

    how do I translate

    string: DB "Hello world!"
    numbers: DB 10, 20, 30
    table: DB 100 DUP( 0 )

    into intrinistic?

    I imagine it should be something like

    vector<int> numbers;
    vector.push_back( 10 );
    vector.push_back( 20 );
    vector.push_back( 30 );

    x86.db( "text", "Hello world!" );
    x86.db( "numbers", numbers.begin(), numbers.end() );
    x86.db( "table", 100, dup( 0 ) );

     
    • Nicolas Capens

      Nicolas Capens - 2003-03-03

      There are two methods, depending on your goals.

      The easiest method is to define static data in C++, and reference that in the assembly code. This is illustrated in testIntrinsics() in Test.cpp.

      The other method is like this:

      x86.label("numbers");
      x86.db(10);
      x86.db(20);
      x86.db(30);

      Defining 'text' and 'table' doesn't work. Thanks for reporting this bug! I'll also add the 'label' method to the documentation.

       
    • Nicolas Capens

      Nicolas Capens - 2003-03-03

      Ok, table can now be defined like this:

      x86.label("table");
      x86.db(byte [100]);   // Uninitialised

      The changes are in the CVS.

       
    • ibo

      ibo - 2003-03-03

      kewl, I'll try to test it as soon as I find the time to.

      I'v been asking because of the intention to provide non stack, non dynamic, non static, memory allocation for scripts, thus providing the memory areas precompiled with my c++ code woulnd't have serverd me well.

       
    • Nicolas Capens

      Nicolas Capens - 2003-03-04

      It gave me a headache, but I think it's finally working! A string can be defined like:

      x86.label("string");
      x86.db("Hello World!");

      You can reference the string with "string".

      Thanks a lot for pointing out these missing features!

       

Log in to post a comment.

Auth0 Logo