Amstrad DDI-1 Reference guide to Amsdos commands, Pre-empting a Garbage Collection, While not EOF

Page 40

The second example (EX2.BAS) is a general purpose screen dump displaying program, using a parameter file to control its action. Note how variables are INPUT from the data file, with the EOF function allowing automatic variation in the size of the file. It is important that the screen dump displayed by this program was saved with the screen in a known position in memory, otherwise the result will be 'skewed'. This is ensured by the saving program executing a MODE command and thereafter being careful not to cause the screen to scroll.

10 DIM colour(15) : REM Provision for 16 colours

20 OPENIN “param.dat”

30 INPUT #9,filename$,screenmode

40 i=0

50 WHILE NOT EOF

60 INPUT #9, colour(i)

70 INK i, colour(i)

80 i=i+1

90 WEND

100 CLOSEIN

110 MODE screenmode:BORDER 0

120 LOAD filename$

2.4.2 Pre-empting a Garbage Collection.

If the program performing data file transactions has a number of string variables, particularly string arrays, it will speed the OPENing of files if the computer is persuaded not to perform a garbage collection at that time. Garbage collection is the process by which the BASIC clears away and tidies up the memory space used for strings in order to dynamically allocate a buffer for the file transfer.

If a program does indeed operate a number of string variables and arrays, incorporate the lines below into the program, and a file buffer will be permanently allocated, which will prevent garbage collection when subsequent files are opened. Note that the lines below should be incorporated after any SYMBOL AFTER commands in the program.

OPENOUT "DUMMY"

MEMORY HIMEM-1

CLOSEOUT

2.5 Reference guide to AMSDOS commands.

Refer to Chapter 8 in your CPC464 User Instruction manual if you are in any doubt about the notation used, or the effect of particular commands when used with cassette.

AMSTRAD Disc Drive & Interface DDI-1 Manual

Chapter 2. 6

Image 40
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 ButtonDrive a disc missing Retry, Ignore or Cancel? Foundations Loading Software/GamesRun rolcave ROLCAVE. not foundBad command Syntax errorDrive a read fail Retry, Ignore or Cancel? Type mismatchFoundations Introducing Amsdos and CP/M Drive B disc missing Retry, Ignore or Cancel Load filenameDisc Tape.inStoring Data Onto Disc First Steps Using The CP/M DiscCpm CLS? Beware Back to AmsdosSaving a Program in Memory onto Disc Loading From Disc CatalogEXAMPLE.BAS Copying Programs From Cassette to Disc Copying Programs From Disc to DiscCopying Programs From Disc to Cassette Copying Using the CP/M System Disc Copying Using DisccopyCopying Using Copydisc Copying started Reading track 0 toWriting track 0 to Do you want to copy another disc Y/NChecking Discs AbortingDiscchk ChkdiscInstallation Amstrad Disc Drive & Interface DDI-1 Manual Backup Master Disc Making Working DiscsWorking SYSTEM/UTILITY disc Basic only discTurnkey Amstrad Basic discs DISCCOPY.COMTurnkey Basic using disc supplied Turnkey CP/M DiscsTurnkey Basic onto your Working disc Creating a Turnkey CP/M System discConfiguring the Output from the package Configuring a CP/M ProgramAmbiguous filename Confirm individual files Y/N ? Starting a Turnkey CP/M Package Configuring the Input to the packagePayroll Autostarting a Turnkey CP/M Package Amsdos Primer IntroductionAmsdos filenames and filetypes Disc DirectoryConstruction of Filenames Filenames on two drives Amsdos headers Save PROG.BAS a Save Bprog .BAS Examples of Using Amsdos Commands in a program Wild cardsSaving variables and performing a Screen Dump BERT.BAS FRED1.BAS FRED2.BAS FRED3.BAK FRED3.BAS FINISH.BASNeat CloseoutReference guide to Amsdos commands Pre-empting a Garbage CollectionWhile not EOF Wend CloseinSummary of Basic commands Summary of Amsdos external commandsSave OPENOUT, Print #9, Write #9, List #9, Closeout CATCPM DIRDisc DISC.INERA RENTape TAPE.INFile Copying procedures Copying FilesAmsdos files with headers Ascii filesFile has a header Amstrad Reference guide to Amsdos Error Messages Drive Drive disc missing Drive Drive disc is write protectedDrive Drive read fail Drive Drive write failOperating with CP/M CP/M PrimerCP/M system tracks Console control codes Configuration SectorLogging in a disc Direct Console Commands Switching default drivesDIR command ERA commandTransient commands REN commandType command Peripheral ManagementFile and disc copying Single file copyingWhole disc copiers and checkers Cassette filesSystem Management StatSetup Do you want to update your system disc Y/NStat SECRET.BAS $DIR Is this correct Y/NDisc Generation AmsdosFormat Format D Format I FormatBootgen Advanced programmingMovcpm SysgenAmstrad Disc Drive & Interface DDI-1 Manual What is Logo Introduction to LogoDr. Logo Getting StartedProcedures with parameters Repeat 4 fd 60 rtTo square Repeat 4 fd 60 rt 90 end To squareanysize side repeat 4 fd side rt 90 endUsing Variables to remember values Editing programs and proceduresCs squareanysize 100 rt 45 squareanysize To triangle Repeat 3 fd edge rt 120 endOperating hints Summary of Dr. Logo primitivesWord and List Processing AsciiChar CountEmptyp FirstFput ListArithmetic Operations Logical Operations Not ?= Logo LogoProcedures VariablesEditing Text ScreenSetsplit ShowClean Graphic ScreenType DotSetpal PalWindow Turtle Graphics WrapSeth SetpcWorkspace Management SetposErn NodesRecycle GlistGprop PlistDisc Files Dir LoadSave KEYBOARD, Joystick buttonpPaddle ?paddle 0?make key rc ?keySound EnvEnt ReleaseLabel RepeatRun StopError CatchPause ThrowSystem Properties Technical information for the user Firmware HeadersChanging Discs Store requirementsBios messages Error MessagesAmsdos messages Failed to load boot sector Disc Organisation Common to ALL FormatsJump Block Re-Interception by the User Jump Block Interception by AmsdosReturn Parameters 132 #BC8C 133 #BC8F 134 #BC92 135 #BC95 #BC98 Intercepted Firmware Calls137 #BC9B 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