AmigaDOS Inside & Out Ruediger Kerkloh Manfred Tornsdorf Bernd Zoller A Data Becker Book Published by Abacus! Seventh Printing 1991 Printed in U.S.A. Copyright © 1988, 1989, 1990, 1991 Abacus 537052ndStreetSE GrandRapids,MI49512 Copyright © 1988, 1989, 1990, 1991 DataBeckerGmbH Merowingerstrasse30 4000Dusseldorf,Germany This book is copyrighted. No part of this book may be reproduced, stored in a retrieval system,ortransmittedinany form orby any means,electronic, mechanical,photocopying, recording or otherwise without the prior written permission ofAbacus Software or Data BeckerGmbH. Every effort has been made to ensure complete and accurate information concerning the material presented in this book. However, Abacus Software can neither guarantee nor be held legallyresponsibleforanymistakes in printingorfaultyinstructionscontained in this book. Theauthorsalwaysappreciatereceivingnoticeofanyerrorsormisprints. Amiga 500, Amiga 1000, Amiga2000and Amigaaretrademarksorregisteredtrademarks ofCommodore-AmigaInc. ISBN 1-55755-041-7 Table of Contents Preface vii 1. Introduction 1 1.1 TheTaskofAmigaDOS 4 1.2 TheWoikbenchandtheShell 6 1.3 WorkbenchBackup 7 1.4 IntroductiontotheShell 9 1.5 The First Command 10 1.6 DirectoryStructure 12 1.7 CommandTemplates 15 1.8 Quitting the Shell 18 2. AmigaDOS Commands 19 2.1 Disk and File Management 22 2.1.1 Format 22 2.1.2 DIR 25 2.1.3 CD 28 2.1.4 MAKEDIR 31 2.1.5 DELETE 32 2.1.6 COPY 33 2.1.7 LIST 36 2.1.8 RENAME 41 2.1.9 DISKCOPY 43 2.1.10 RELABEL 44 2.1.11 INFO 45 2.1.12 INSTALL 46 2.1.13 TYPE 49 2.1.14 JOIN 50 2.1.15 SEARCH 51 2.1.16 SORT 53 2.1.17 PROTECT 54 2.1.18 FILENOTE 57 2.1.19 SETDATE 58 2.1.20 DISKDOCTOR 59 2.1.21 DISKCHANGE 63 2.2 System Commands 64 2.2.1 NEWCLI 64 2.2.2 ENDCLI .67 2.2.3 RUN 68 2.2.4 STATUS 69 2.2.5 CHANGETASKPRI 71 2.2.6 BREAK 72 2.2.7 PATH 73 2.2.8 ASSIGN 75 Hi 2.2.9 ADDBUFFERS 78 2.2.10 WHY 79 2.2.11 FAULT 80 2.2.12 DATE 80 2.2.13 SETCLOCK 81 2.2.14 PROMPT 82 2.2.15 STACK 84 2.2.16 BINDDRIVERS 85 2.2.17 MOUNT 85 2.3 ScriptFileCommands 89 2.3.1 EXECUTE 89 2.3.2 ECHO 92 2.3.3 FAILAT 93 2.3.4 QUIT 94 2.3.5 IF/ELSE/ENDIF 95 2.3.6 ASK 97 2.3.7 SKIP/LAB 98 2.3.8 WATT. 99 2.3.9 VERSION 100 2.4 TheEditors 102 2.4.1 Reading text with ED 103 2.4.2 TexthandlingwithEDIT 105 2.4.3 ParametersofEDIT 105 2.4.4 Starting EDIT 107 2.4.5 EditingText 108 2.4.6 Multiple Files 109 2.4.7 CommandMacros 109 2.4.8 QuittingEDIT 110 3. Devices Ill 3.1 Floppy Disk Devices (DFX:) 114 3.2 TheRAM-Handler(RAM:) 115 3.3 TheParallelDevice(PAR:) 117 3.4 The Serial Device (SER:) 118 3.5 ThePrinterDevice(PRT:) 120 3.6 The Console Device (CON:) 121 3.7 TheRawDevice(RAW:) 122 3.8 NEWCON-handler (NEWCON:) 123 3.9 The RAD device (RAD:) 124 3.10 The PIPE Handler (PIPE:) 126 3.11 TheSPEAKhandler(SPEAK:) 127 3.12 The AUX Handler (AUX:) 128 3.13 The FastFileSystem 129 4. MoreAmigaDOS Commands 131 4.1 AmigaDOS 1.3 Commands 135 4.1.1 AVAIL 135 4.1.2 FF 136 4.1.3 LOCK 137 4.1.4 NEWSHELL 137 4.1.5 REMRAD 140 IV 4.1.6 RESIDENT 141 4.1.7 SETPATCH 145 4.1.8 SETENV/GETENV 145 4.1.9 ICONX 146 4.2 AmigaDOS 2.0 Commands 147 4.2.1 MAKELINK 147 4.2.2 UNALIAS 147 4.2.3 UNSET/UNSETENV 148 5. AmigaDOSTricksandTips 149 5.1 Input and Output in AmigaDOS 152 5.2 Wildcards 153 5.3 Breaking in AmigaDOS 155 5.4 The RAM Disk and AmigaDOS 157 5.5 Printing from AmigaDOS 158 5.5.1 File printout with COPY 158 5.5.2 Redirectingoutput 159 5.5.3 Printer control characters 160 5.6 Using the Console Device 162 5.7 UsingtheSerialDevice 165 6. Scriptfiles 169 6.1 Introduction to ScriptFileProcessing 172 6.1.1 What are script files? 172 6.1.2 What script files look like 172 6.1.3 Calling script files 173 6.1.4 Asimpleexample 174 6.2 Modifying the Startup-sequence 176 6.2.1 A Custom Startup-sequence 179 6.2.2 Shell-startupsequence 180 6.3 Practical Script Files 182 6.3.1 Aspecialprinterscriptfile 182 6.3.2 Creating your own script files 186 6.3.3 Starting scriptfileswiththemouse 188 6.3.4 TheTypesscriptfile 189 6.3.5 Puttingeverything intotheRAMdisk 190 6.4 UsingALIAS 192 7. AmigaDOS andMultitasking 197 7.1 What is Multitasking? 200 7.2 MultitaskingwithAmigaDOSandWorkbench 201 7.3 Multitasking with NEWSHELL 204 7.4 Multitasking usingRUN 206 7.5 UsingAmigaDOS 209 7.6 CHANGETASKPRI 211 7.7 Multitasking dangers 214 8. Creating AmigaDOS Commands 217 8.1 AmigaDOS CommandsinC 221 8.2 REPLACE 225 8.3 Public Domain AmigaDOS Commands 232 9. AREXX 235 9.1 Running ARexx 238 9.2 ARexx Programs 239 9.3 Program Macros 240 9.4 Multitasking 241 9.5 HowARexxWorks 242 9.5.1 Data 242 9.5.2 Symbols 243 9.5.3 Operators 244 9.5.4 Programs 245 9.5.5 Commands & Functions 246 9.5.6 PurePower 247 9.6 ARexxCommands &Functions 248 9.6.1 Flow & Control 248 9.6.2 Strings 250 9.6.3 Numbers 257 9.6.4 Inter-Process Communications 258 9.6.5 Files....... 259 9.6.6 ConsoleI/O 261 9.6.7 Functions & Procedures 262 9.6.8 System 264 9.6.9 Data 268 9.6.10 Bits 270 9.6.11 Memoiy 272 9.7 ExampleARexxPrograms 274 10 QuickReference 281 10.1 TheEDProgram 284 10.1.1 ED 1.14 284 10.1.2 ED 2.00 286 10.2 TheEditProgram 287 10.3 TheAmigaDOSCommands 290 Appendix 309 Index 315 vi Preface The Amiga Workbench, a user-friendly mouse controlled graphic operating system, makes iteasy for thebeginner to enterthe worldof computers. The windows and icons which appearon the screen after you start the computer are much more attractive to a new user than a plaincursorwaitingforsimplekeyboardinput. Sooner or later, either by mistake or out of curiosity, you click the Shell icon on the Workbench disk. A Shell window appears and theboringCLI (CommandLineInterface)cursorofAmigaDOSmakes its appearance. This userinterface, although itdoesn't use the mouse, is more powerful than theAmigaWorkbench. In fact, the Workbench isloadedfromAmigaDOS when theAmigaisturnedon. You actually can'tgetby withoutusing AmigaDOS ifyou wish to do any meaningful work with the Amiga. The Workbench is a powerful graphic interface that makes it easy forthe average userto access the Amiga. You can only do so much with the Workbench, while AmigaDOS'scapabilitiesarealmostunlimited. This book will be very helpful to you ifyou keep it by your side as you work with AmigaDOS. Aftera simplebutnecessary introduction, you'll find a lot of information about AmigaDOS. You'll learn solutions tocommonproblems,detaileddescriptions ofallAmigaDOS commands, programming script files, multitasking, and even an explanation of the internal workings ofAmigaDOS and the Shell. ThelastfewpagescontainaQuickReferenceofallthecommands. Workbench One final comment: The Amiga is an ever expanding system and the 1.3 Workbench is constantly being improved. This book covers 2.0 AmigaDOS in Workbench 1.2, 1.3 and 2.0. These new system disks work much better than the older versions. So, any additions or differencesbetweentheWorkbenchversionsareindicatedastheyappear in this book. This book supports Workbench 1.3/Kickstart 1.2, Workbench 1.3/Kickstart 1.3andWorkbench2.0/Kickstart2.0. R. Kerkloh, M. Tornsdorf,B. Zoller June1990 vii