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

Models: DDI-1

1 103
Download 103 pages 20.5 Kb
Page 38
Image 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

Page 38
Image 38
Amstrad DDI-1 Examples of Using Amsdos Commands in a program, Wild cards, Saving variables and performing a Screen Dump