COPY

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: COPY
Abbreviation: CO Shift+P
Type: Command
Token code: 244/$F4
Handling routine
in BASIC ROM:
BASIC 3.5:
51674–51699
$C9DA–$C9F3
BASIC 7.0:
41798–41825
$A346–$A361
List of all BASIC keywords


Remark: This article describes the BASIC command COPY in Commodore BASIC V3.5 or higher.

Type: Command
General Programming-Syntax: 
  COPY <source file> [,D<drive number>] TO <destination file> [,D<drive number>,] [[,]ON U<device number>]
  or
  COPY D<drive number> TO D<drive number> [[,]ON U<device number>]

COPY is a BASIC 3.5 command that is used to copy a file on a diskette.
It can copy from a disk to another disk in the same drive (on a dual-drive), or a file from a disk in one drive to a disk in another drive, or a file to the same disk (with a different name).
A special use case is a source-file string consisting of at least 2 filenames separated by a comma and a destination which serves two purposes:

  1. to append: If the destination is the same as the first filename this corresponds to the APPEND command.
  2. to concatenate: With a distinct destination filename this operation is equivalent with the CONCAT command.

The expression <source file> denotes the string of the source file(s), and expression <destination file> the string with destination file.

Examples[edit]

Copy the whole disk in drive 1 to the disk in drive 0 (on a dual-drive floppy only):

COPY D1 TO D0

A file from drive 0 (on a dual-drive floppy) to drive 1 with new filename:

COPY D0,"FILE 1" TO D1,"FILE 2"

Creates a duplicate named "STILL SAME DRIVE" from file "SAME DRIVE":

COPY "SAME DRIVE" TO "STILL SAME DRIVE"

Appends file "EXTEND" to the existing file "FILE":

COPY "FILE,EXTEND" TO "FILE"

Concatenates files "F1", "F2", and "F3" to file "ALL":

COPY "F1,F2,F3" TO "ALL"


BASIC V3.5 Commands

ABS | ASC | ATN | AUTO | BACKUP | BOX | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLOR | CONT | COPY | COS | DATA | DEC | DEF | DELETE | DIM | DIRECTORY | DLOAD | DO | DRAW | DSAVE | END | ERR$ | EXP | FN | FOR | FRE | GET | GET# | GETKEY | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | MID$ | MONITOR | NEW | NEXT | ON | OPEN | PAINT | PEEK | POKE | POS | PRINT | PRINT USING | PRINT# | PUDEF | RCLR | RDOT | READ | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RLUM | RND | RUN | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SOUND | SPC | SQR | SSHAPE | STOP | STR$ | SYS | TAB | TAN | TRAP | TROFF | TRON | USR | VAL | VERIFY | VOL | WAIT