assembly - In a loop, dest address cannot apart from current address more than -128~+127 bytes, why? -


I am reading Assembly language for the book Intel based Computers Fifth Edition

The author said like TITLE, but they did not say it. Is this instruction relative to length? Think about this in the next way, making the loop necessary for you:

  mov cx,  

Repeat Labels:; Loop body dc cx; This instruction takes 1 byte jnz label; DC> Long JMP, 5 bytes Use

as soon as there were mostly loops (are?) Very little-specific shortcut instructions were introduced to reduce the size (enough for 640kb):

loop which only takes 2 bytes and works as a DC + small JMP

, the loop is a special "edge" case that I think does not use anymore Done (update: it It can be considered disliked, and it makes sense that the loop forces you to use the CX as a loop variable, so you can not make double loop or use another register. < P> Your question - What to do if your loop body is big:

  1. Try optimizing it, such as mov ax, 0 (3 bytes) With xor ax, ax (1 byte) and so on
  2. Reactivate your code in functions ( They can actually increase your final size, but can reduce the body Notice: 86-286 and 386 + different directions

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -