Device numbers are numbers that identify various peripheral devices connected to (or, in some cases, built into) the C64: The device number is used when creating logical files through the KERNAL file system; see OPEN (BASIC command) and OPEN (KERNAL routine).
The first four device numbers relate to various hardware that requires the CPU, memory and other resources of the core C64. Device numbers above 3 all refer to devices connected through the serial port. They are all handled in exactly the same way from KERNAL's point of view, but by convention.
|0||Keyboard||Special routine through KERNAL|
|1||Datasette||Special routine through KERNAL|
|2||RS-232 or Modem||Special routine through KERNAL|
|3||Monitor or text screen||Special routine through KERNAL|
|4||First Printer||from 4: for IEC devices|
|6||e.g. first Plotter|
|7||e.g. second Plotter, RAM-Disk|
|ab 8||Floppy, Harddisk||or other hardware like SD2IEC etc.|
Often the default device number of printers, plotters and disk drives can be changed via dip-switches.