1
我嘗試在asm中創建循環時出現了一些問題。 所以我用循環創建了另一個代碼。 問題是,當我遞減或遞增ecx
時,變量會變得混亂。 如果我使用沒有dec的循環指令,它也不起作用。 如何使用ecx
進行循環?循環裝配不起作用
代碼
section .text
global main
extern printf
section .data
FORMAT: db "L", 10, 0 ; just to print the L 10 times
main:
mov ecx, 10 ; start the counter in 10
jmp runloop ; i imagine i dont need it
runloop:
push FORMAT
call printf
add esp, 4
dec ecx
cmp ecx, 0
jne runloop
你說得對,'jmp runloop'在這裏沒有用處。 – sharptooth