1
main:
    call foo
    call bar
    ret

foo:
    // code

    cmp $number, 0
    je ret

    // code
    ret

bar:
    // code

    cmp $number, 0
    je ret

    // code
    ret

I would like to write a script like above. I looked it up, but I don't think there's a proper way.

So I have to jump between labels instead of calling.

main:
    jmp foo

foo:
    // code

    cmp $number, 0
    je bar

    // code

    jmp bar

bar:
    // code

    cmp $number, 0
    je ret

    // code
    ret

Is there good way to return when some flag is triggered?

  • you need to have a label before ret to jump to it – Paweł Łukasik Mar 30 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.