0

On two pass assembler, if there is assembly code like

test     start   1000
first    lda     index
         ldx     index
read     jsub    strcpy
         ldch    str,x
         comp    eof
         jeq     end
         lda     index
         add     one
         sta     index
         ldx     index
         j       read  
strcpy   td      indev
         jeq     strcpy
         rd      indev
         stch    str,x
         rsub
end      lda     index
index    word    0
one      word    1
str      resw    5
indev    byte    x'f3'
eof      byte    x'000004'
         end     first

how can I change it to binary code? especially that jump part? Are binary codes in loop section repeated as many time as loop actually executed?

1
  • If you want assemble-time loop unrolling, use assembler macros, not runtime branch instructions. e.g. in NASM, %rep 4 / ... / %endrep. Commented May 5, 2018 at 14:22

1 Answer 1

2

Of course not. What if you had no a priori knowledge of how many times it will be needed? Each label will be an address in memory of the code. The assembler converts these labels into addresses. The jump gets converted into a binary machine code like all other statements in assembler.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.