gcc (inline assymbly): how to iterate an array?

Тема в разделе "WASM.BEGINNERS", создана пользователем nopnopnop, 20 апр 2006.

  1. nopnopnop

    nopnopnop New Member

    Публикаций:
    0
    Регистрация:
    20 апр 2006
    Сообщения:
    15
    hi all
    problem:
    i have an array defined in some c function
    suppose something like this:
    void dummy()
    {
    int arr[] = {1,2,3};
    asm(...);
    }
    how to iterate this array inside asm(...) block?
    -----------------------------------------------
    P.S. We using gcc!(inline assembly uses GAS syntax)
     
  2. Quantum

    Quantum Паладин дзена

    Публикаций:
    0
    Регистрация:
    6 янв 2003
    Сообщения:
    3.143
    Адрес:
    Ukraine
  3. nopnopnop

    nopnopnop New Member

    Публикаций:
    0
    Регистрация:
    20 апр 2006
    Сообщения:
    15
    hi quantum
    thanks for offering help,but there is no answer for
    my question in GCC-inline-Assembly-HOWTO
    so question stil opened...
     
  4. Quantum

    Quantum Паладин дзена

    Публикаций:
    0
    Регистрация:
    6 янв 2003
    Сообщения:
    3.143
    Адрес:
    Ukraine
    nopnopnop

    That HOWTO explains how to deal with input and output operands in GCC inline assembly blocks. The arr[] array whould be the only operand in your case. You can map it to any register and iterate in a loop. That document also covers some basic AT&T syntax for people who aren't familiar with GAS. The only thing you won't find there is an assembler tutorial for newbies. Do you have any experience coding in asm? If you do, the HOWTO contains enough information, so you can find the answer by yourself.
     
  5. nopnopnop

    nopnopnop New Member

    Публикаций:
    0
    Регистрация:
    20 апр 2006
    Сообщения:
    15
    hi quantum
    i have experience of two weeks of learning assembly...(not a joke) i think better to leave for a while this complicated problem.may be after more two weeks a will be enable of mapping
    array to register and iterating it(array :)
    thank you anyway
    P.S
    i can read russian(and anderstand),but i can't write...
    my ergonomic keybord have not russian letters
     
  6. Quantum

    Quantum Паладин дзена

    Публикаций:
    0
    Регистрация:
    6 янв 2003
    Сообщения:
    3.143
    Адрес:
    Ukraine
    nopnopnop



    Extended asm syntax is a bit tricky and I'm afraid it's also a little buggy. It takes some time to understand it. You'd better use pure assembly compilers, like fasm, nasm or even that GNU tool called GAS. Don't use assembly in GCC unless it's absolutly necessary.



    P.S. You could carve cyrillic chars on your keyboard or screen 'em with some kind of fast colour.
     
  7. nopnopnop

    nopnopnop New Member

    Публикаций:
    0
    Регистрация:
    20 апр 2006
    Сообщения:
    15
    hi quantum
    i thing i will take you advise.allready tryed nasm and as under
    Debian.looks nice...