How to write a for loop in y86

943 views Asked by At
.pos 0 code
    jmp _start

.pos 0x100 code
_start:
    xorq %rcx, %rcx
    irmovq $3, %rax
    irmovq $1, %rsi
    jmp loop
loop:
    addq %rsi, %rcx
    pushq %rcx
    subq %rax, %rcx
    popq %rcx
    jle loop
    ret

I am trying to write the equivalent of a for loop in y86 but for some odd reason its only iterating once. Note that y86 doesnt have the cmp instruction so i use push, sub and pop.

0

There are 0 answers