Arduino Assembly Delay without rcall or call

Hi there, days ago I posted that I needed help with Arduino Assembly. However, I have solved that issue.

Now I have to make a Delay in Assembly, I have the following code:

  .global setup
  .global loop
  
  setup:
         sbi      0x18,5 ; Se iniciliza el pin13
         ret
  
  loop:  ldi      r20,255
         rcall    delayMsecs ; Se llama al delay
         sbi      0x18,5 ; Se enciende el LED
         ldi      r20,255
         rcall    delayMsecs ; Se llama al delay
         cbi      0x18,5 ; Se apaga el LED
         rjmp     loop ; Se vuelve a llamar a loop para hacer el ciclo infinito
         
  delayMsecs:
      ; Se generan ciclos para hacer el delay      
      ldi 31, 10000>>8
      ldi 30, 10000&255
    
  delayLp:
      sbiw r30, 1            
      brne delayLp
      subi r20, 1
      brne delayMsecs
      ret

This works pretty well. However, I have to make the delay without using rcall or call, like adding it inside the loop and not in other routine.

This is an University assignment, and is for investigating purposes, that's why I don't know how to do it, my teacher haven't explained us arduino assembly at all.

I'll appreciate any help :slight_smile:

I think there is a directive that tells the compiler to put the function inline. But it's a long time since I fiddled with assembler on the Arduino.

...R

Just copy and paste the instructions in the subroutine you are calling and replace the rcall instruction with it.