aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/msp430/words/n_to_r.asm
blob: 91807e5a8a1cae5422531885e7480f67d7333af4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
; ( x-n .. x-1 n -- ) (R: -- x-n .. x-1 n)
; Stack
; move n items from data stack to return stack
   CODEHEADER(XT_N_TO_R,3,"n>r")

    MOV TOS, X ; save count cell twice
    MOV TOS, Y
PFA_N_TO_R1:
    MOV @PSP+,TOS
    PUSH TOS
    SUB #1, X
    JNZ PFA_N_TO_R1
    PUSH Y   ; old TOS (count)
    MOV @PSP+,TOS ; get new TOS
    NEXT