Amstrad DDI-1 manual Examples of Using Amsdos Commands in a program, Wild cards

Page 38

2.3.3 Wild cards

It is often required to perform some disc operation (Cataloguing, copying, erasing etc) on a number of disc files. When a filename is specified for a particular operation, the software scans the disc directory looking for a name which exactly matches. It is possible, where the command allows, to perform the operation on a set of files where some of the characters can be 'don't care'. This is shown by using the character ? in the don't care position. If the whole block of the filename or type specifier is 'don't care' then the block of ?'s can be abbreviated to the symbol * . Thus, for example, FRED.* is shorthand for FRED.??? and F*.BAS is shorthand for F???????.BAS . Finally the expression *.* means 'all files'.

example:

DIRECTORY

Match *.BAS

Match FRED?.BAS

Match F*.BA?

BERT.BAS

BERT.BAS

FRED1.BAS

FRED1.BAS

FRED1.BAS

FRED1.BAS

FRED2.BAS

FRED2.BAS

FRED2.BAS

FRED2.BAS

FRED3.BAK

FRED3.BAS

FRED3.BAS

FRED3.BAK

FRED3.BAS

FRED3.BAS

FINISH.BAS

FINISH.BAS

 

FINISH.BAS

2.4Examples of Using AMSDOS Commands in a program.

To give you a good understanding of the AMSDOS commands, we recommend that you work through the examples, referring to the relevant sections in the rest of this chapter as you go. DO NOT operate these programs with your original Master System/Utility disc installed - the program writes to the disc and you should NEVER risk writing to the master disc. Use a working disc or copy instead.

2.4.1 Saving variables and performing a Screen Dump

NOTE: the use of .DAT and .SRN filetypes. These filetypes are used to remind us of what is in the file, rather than because they have any inherent significance. The file PARAM.DAT will be an ASCII data file without a header, whilst FLAGDUMP.SRN is an AMSDOS Binary file with a header. The programs have been provided on your Master System/Utility disc in unprotected ASCII form.

The first example (EX1.BAS) draws a Union Jack flag and then saves the whole screen to disc. To run it type RUN"EX1". As we discussed, AMSDOS will search automatically adding the .BAS filetype for you. The particulars of the screen dump, namely the screen mode, palette colours and name of file containing the actual information are saved into a parameter file. This illustrates the use of a data file to WRITE program variables (dumpfile$) and constants (1), saving them for use by another program.

AMSTRAD Disc Drive & Interface DDI-1 Manual

Chapter 2. 4

Image 38
Contents Page Amstrad Disc Drive & Interface DDI-1 Amstrad Contents Contents Page Foundations 1 Setting Up Connecting the Mains LeadConnecting the DDI-1 to the Computer Computer Interface Unit Main Disc Drive Drive a Computer Foundations 2 About Discs Write ProtectionOpen Closed When Your Disc Is Indicator Lamp Eject ButtonRun rolcave Drive a disc missing Retry, Ignore or Cancel?Foundations Loading Software/Games ROLCAVE. not foundDrive a read fail Retry, Ignore or Cancel? Bad commandSyntax error Type mismatchFoundations Introducing Amsdos and CP/M Disc Drive B disc missing Retry, Ignore or CancelLoad filename Tape.inCpm First Steps Using The CP/M DiscStoring Data Onto Disc CLS? Saving a Program in Memory onto Disc Back to AmsdosBeware EXAMPLE.BAS CatalogLoading From Disc Copying Programs From Disc to Cassette Copying Programs From Disc to DiscCopying Programs From Cassette to Disc Copying Using the CP/M System Disc Copying Using DisccopyWriting track 0 to Copying Using CopydiscCopying started Reading track 0 to Do you want to copy another disc Y/NDiscchk Checking DiscsAborting ChkdiscInstallation Amstrad Disc Drive & Interface DDI-1 Manual Backup Master Disc Making Working DiscsTurnkey Amstrad Basic discs Working SYSTEM/UTILITY discBasic only disc DISCCOPY.COMTurnkey Basic onto your Working disc Turnkey Basic using disc suppliedTurnkey CP/M Discs Creating a Turnkey CP/M System discAmbiguous filename Confirm individual files Y/N ? Configuring a CP/M ProgramConfiguring the Output from the package Payroll Configuring the Input to the packageStarting a Turnkey CP/M Package Autostarting a Turnkey CP/M Package Amsdos Primer IntroductionConstruction of Filenames Disc DirectoryAmsdos filenames and filetypes Save PROG.BAS a Save Bprog .BAS Amsdos headersFilenames on two drives Saving variables and performing a Screen Dump Examples of Using Amsdos Commands in a programWild cards BERT.BAS FRED1.BAS FRED2.BAS FRED3.BAK FRED3.BAS FINISH.BASNeat CloseoutWhile not EOF Reference guide to Amsdos commandsPre-empting a Garbage Collection Wend CloseinSave OPENOUT, Print #9, Write #9, List #9, Closeout Summary of Basic commandsSummary of Amsdos external commands CATDisc CPMDIR DISC.INTape ERAREN TAPE.INAmsdos files with headers File Copying proceduresCopying Files Ascii filesFile has a header Amstrad Reference guide to Amsdos Error Messages Drive Drive read fail Drive Drive disc missingDrive Drive disc is write protected Drive Drive write failCP/M system tracks CP/M PrimerOperating with CP/M Logging in a disc Configuration SectorConsole control codes DIR command Direct Console CommandsSwitching default drives ERA commandType command Transient commandsREN command Peripheral ManagementWhole disc copiers and checkers File and disc copyingSingle file copying Cassette filesSystem Management StatStat SECRET.BAS $DIR SetupDo you want to update your system disc Y/N Is this correct Y/NFormat Disc GenerationAmsdos Format D Format I FormatMovcpm BootgenAdvanced programming SysgenAmstrad Disc Drive & Interface DDI-1 Manual What is Logo Introduction to LogoDr. Logo Getting StartedTo square Repeat 4 fd 60 rt 90 end Procedures with parametersRepeat 4 fd 60 rt To squareanysize side repeat 4 fd side rt 90 endCs squareanysize 100 rt 45 squareanysize Using Variables to remember valuesEditing programs and procedures To triangle Repeat 3 fd edge rt 120 endOperating hints Summary of Dr. Logo primitivesChar Word and List ProcessingAscii CountFput EmptypFirst ListArithmetic Operations Logical Operations Not ?= Logo LogoProcedures VariablesSetsplit EditingText Screen ShowType CleanGraphic Screen DotWindow PalSetpal Turtle Graphics WrapSeth SetpcErn Workspace ManagementSetpos NodesGprop RecycleGlist PlistSave Disc Files DirLoad KEYBOARD, Joystick buttonp?make key rc Paddle?paddle 0 ?keyEnt SoundEnv ReleaseRun LabelRepeat StopPause ErrorCatch ThrowSystem Properties Technical information for the user Firmware HeadersChanging Discs Store requirementsAmsdos messages Error MessagesBios messages Failed to load boot sector Disc Organisation Common to ALL FormatsReturn Parameters Jump Block Interception by AmsdosJump Block Re-Interception by the User 137 #BC9B Intercepted Firmware Calls132 #BC8C 133 #BC8F 134 #BC92 135 #BC95 #BC98 Page Appendix Glossary of Terms CP/M Dr.Logo Primitives TPA Amstrad Disc Drive & Interface DDI-1 Manual Appendix Term Limitations of Remedies Amstrad Disc Drive & Interface DDI-1 Manual Appendix Index ERA Setpos