| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
DCLEAR [ D driveNumber ] [ { , | ON } U unitNumber ] ... [ , ItwoChar ] [ , R ] ...
Initialize media for reading on a specific device.
DCLEAR sends an "initialize" command to the specified (or implied) unitNumber and driveNumber, and then closes all files open on the device (unitNumber), regardless of which driveNumber they are using. This is similar to CLR, but more specific (only affects one device), and more imporatantly DCLEAR really closes the files (CLR just "forgets" them which can result in corrupted data if any files were open for writing). Most devices that allow media swapping will automatically detect a media change and work without this command. At least for reading! For writing, some media may need a one-time special initiialization, often called formatting (see HEADER). If you just want to close all files on a "disk" device, then see DCLOSE. If an expression (enclosed in parentheses) is not valid, or an expression is used without parentheses, SYNTAX ERROR occurs. If any parameter is not the correct type a TYPE MISMATCH ERROR will be generated. Otherwise if a parameter is not a legal value (see table above), an ILLEGAL QUANTITY ERROR is generated. Like all disk commands and statements, the Syntax is more flexible than shown above. In particular, the parameters may be given in any order. The general restrictions are: a comma (,) must not precede the first parameter (ON may do so), any non-literal value (a variable name or expression) must be enclosed in parentheses (), and do not supply the same parameter more than once. Exceptions include the U and R parameters, which may used an unlimited number of times (R is ignored and the last unitNumber is used), and the twoChar parameter which must always be two literal characters (it may not be repeated although it is otherwise ignored). Assuming the syntax is good, BASIC sends the command known as "initialize" in CBM DOS literature to the device (this updates ST); if the device is not connected and powered-on, DEVICE NOT PRESENT ERROR occurs. Otherwise BASIC will not complain. The initialize command basically just tells the drive to re-read the BAM and disk header, as if a new disk were just inserted. You may want to check the error/status channel with DS or DS$ to ensure the command completed successfully. Although it usually succeeds, typical errors include no media (like a floppy disk), unformatted media, or (less likely) media in an unknown/incompatible format, or damaged/unreadable media. Like all disk-based commands, DCLEAR restricts the driveNumber to either 0 or 1 which often makes it unusable on a "disk" with multiple partitions. Like all disk-based commands, DCLEAR will reset DS$ and set the secret variable "DosFA" to the unitNumber (defaults to 8 if not given). Examples:
|