Classic Computer Magazine Archive PROGRAM LISTING: bestofanticv1b/MOVEIT.SRC


10 ; This is a position independent subroutine
20 ; found in DATA statements line numbered 250 and 260
30 ; Calling Sequence from BASIC is:
40 ; A = USR(ADR($STR),Start Addr,Count)
50 ;
60          *=  $600 ;can go anywhere
70          PLA     ;ignore argument count
80          PLA     ;save lo-byte of dest addr
90          STA  $CC
0100        PLA ;save hi-byte of dest addr
0110        STA  $CB
0120        PLA     ;save total to be moved
0130        STA  $CE ;*
0140  PLA     ;save total to be moved
0150        STA  $CD  ; *
0160        LDX  $CE  ; count of bytes to move
0170        LDY  #0   ; init index
0180        LDA  #0   ; init character to be moved
0190 MOV    STA  ($CB),Y  ; move data
0200        DEY       ; decrement index
0210        BNE  MOV  ; go move next character
0220        INC  $CC  ; incr dest addr l0-byte
0230        DEX       ; decr lo-byte count to move
0240        BMI  EXIT
0250        BNE  MOV  ; go move next character
0260        LDY  $CD  ; hi-byte of count to move
0270        BNE  MOV  ; go move next character
0280 EXIT   DEC  $CC  ; decr lo-byte dest addr
0290        LDY  #0
0300        STA  ($CB),Y
0310        RTS       ; return to BASIC
0320        .END

Back to previous page