I would say that it's perfectly ok to unroll a loop this small in the way that you're doing it, as in this instance, it's the simplest and fastest way to do what you want to do. If you don't like BeebAsm specific syntax, just write it out in full:
Code:
.positionbeam
ldx vector_pc
ldy quad_index
lda (pos_lookup),y
sta vector_ram,x
inx
iny
lda (pos_lookup),y
sta vector_ram,x
inx
iny
lda (pos_lookup),y
sta vector_ram,x
inx
iny
lda (pos_lookup),y
sta vector_ram,x
inx
; note we don't need the final iny (maybe)
stx vector_pc
rts
The body of the loop is only 7 bytes long, so we're not exactly being wasteful with 21 extra bytes to get the job done, plus it will run slightly faster.
The question though is whether your concern is optimising for speed or for size. If you wanted to write it as a loop to optimise for size, then the easiest way is to use a zero-page variable as your loop counter, like this:
Code:
.positionbeam
ldx vector_pc
ldy quad_index
lda #4
sta counter ; some aliased address in the zero page
.positionbeamloop
lda (pos_lookup),y
sta vector_ram,x
inx
iny
dec counter
bne positionbeamloop ; if counter<>0, reloop
stx vector_pc
rts
This is particularly convenient as you don't refer to the
value of the counter at any point, hence we never need to get it in a register.
Hope that helps - look forward to hearing what you've got up your sleeve!