CONTENTS CHAPTER 1 An Introduction to GS/O$ and ProDOS 8 1 Apple II Operating Systems -A History 2 Comparing ProDOS 8 with DOS 3.3 4 Important Features of ProDOS 8 and BASIC.SYSTEM 5 Comparing GS/OS with ProDOS 8 10 CHAPTER 2 Disk Volumes and File Management 13 Naming Files 13 Directories and Subdirectories 14 Prefixes 16 Fundamental File-Handling Concepts 17 Opening a File 18 Reading and Writing a File 19 Closing a File 19 GS/OS Disk Caching 19 ProDOS File Management 21 Formatting the Disk Medium 21 Disk Volumes and Disk Drives 22 Disk Volume Block Usage 22 The Volume Bit Map 23 Volume Directories and Subdirectories 25 The Directory Header 26 Standard Directory Entries 26 File Type Codes 26 File Access Codes 35 Time and Date Formats 37 Organizing File Data 37 Indexing Schemes 38 Extended Files 39 Sparse Files 41 The READ.BLOCK Program 43 CHAPTER 3 Loading and Installing GS/OS and ProDOS 8 49 The Boot Record 49 The ProDOS 8 Boot 50 ProDOS 8 Memory Usage 51 Bank-Switched RAM 51 Auxiliary Memory 53 Page Zero Usage 54 z Page Two Usage 54 z Page Three Usage 54 ix The ProDOS 8 System Global Page: $BF0~$BFFF 55 The System Bit Map 55 z The Machine Identification Byte 56 z Source Listing of the ProDOS 8 Global Page 57 GS/OS System Disks 57 The GS/OS Boot 65 GS/OS Memory Usage 67 CHAPTER 4 GS/OS and ProDOS 8 Commands 71 Using ProDOS 8 MLI Commands 72 Using GS/OS Commands 76 Stack-Based Calling Method 80 GS/OS and ProDOS 8 Error Handling 80 Command Descriptions 82 Class 0 and Class 1 Input Strings 82 z Class 0 and Class 1 Output Buffers 87 z Prefixes 88 z Access Code 88 z Time and Date 88 z File Type Code 89 z ProDOS 16 Considerations 89 z ALLOC - INTERRUPT 90 BeginSession 92 z BindInt 93 z ChangePath 95 z ClearBacknp 97 Close, CLOSE 99 z Create, CREATE 101 z DControl 105 DEALLOC - INTERRUPT 107z Destroy, DESTROY 109 DInlo 112z DRead 116 z DStatus 118 z DWrite 120 z EndSession 122 EraseDisk 123 z ExpandPath 125 z Flush, FLUSH 126 z Format 128 FSTSpecific 130 z GetBootVol 132 z GETBUF 134 GetDevNumber 136 z GetDirEntry 138 z GetEOF GET_EOF 143 GetFileInfo, GET - FILE - INFO 145 z GetFSTInlo 149 GetLevel 151z GetMark, GET - MARK 152z GetName 154 GetPrefix GET_PREFIX 156 z GetSysPrefs 158 z GETTIME 159 GetVersion 160 z NewLine, NEWLINE 162 z Null 164 ON - LINE 165 z Open, OPEN 168 z OSShutdown 172 z Quit, QUIT 173z Read, READ 182z READ-BLOCK 185z RENAME 188 z ResetCache 190 SessionStatus 191 z SET - BUF 192 z SetEOF, SET - EOF 194 z SetFileInfo SET_FILE - INFO 197 z SetLevel 202 z SetMark, SET - MARK 203 z SetPrefix, SET - PREFIX 205 SetSysPrefs 208 z UnbindInt 209 z Volume 210 z Write, WRITE 213 WRITE BLOCK 216 CHAPTER 5 System Programs 219 The Structure of a GS/OS System Program 220 Entry Conditions 220 The Structure of a ProDOS 8 System Program 222 x The BASIC.SYSTEM Interpreter 225 The BASIC.SYSTEM Commands 226 File Management Commands 228 1 File Loading and Execution Commands 232 File Input/Output Commands 233 Miscellaneous Commands 235 BASIC.SYSTEM and the Input and Output Links 236 Reserving Space Above the File Buffers 237 BASIC.SYSTEM Page Three Usage 238 The BASIC.SYSTEM Global Page: $BE~BEFF 240 The GOSYSTEM Subroutine 240 BASIC.SYSTEM Error Handling 248 Executing Disk Command Strings from Assembly Language 248 Adding Commands to BASIC.SYSTEM 250 The ONLINE Command 255 CHAPTER 6 Interrupts 265 Common Interrupt Sources 266 Reacting to Interrupts 266 Interrupts and ProDOS 8 268 Interrupts During MLI Commands 274 Interrupts and GS/OS 276 GS/OS Interrupt Handling 281 Handling Interrupts When the System Is Busy 282 CHAPTER 7 Disk Devices 287 How GS/OS and ProDOS 8 Keep Track of Disk Devices 288 GS/OS Device Scan 288 ProDOS 8 Device Scan 288 How GS/OS and ProDOS 8 Identif' Disk Devices 291 Extended Protocol for Disk Controller Cards 292 Special Cases 294 Communicating with a ProDOS 8 Disk Driver 294 The SmartPort Controller 295 Using SmartPort Commands 297 Status Command 298z Control Command 300 The ProDOS 8 RAMdisk: The /RAM Volume 301 Characteristics of the /AAM Volume 301 Removing and Reinstalling /RAM 303 Writing a ProDOS 8 Disk Driver 305 Ki CHAPTER 8 Clocks 317 How GS/OS and ProDOS 8 Read the Time and Date 318 How ProDOS 8 Identifies a Clock Card 320 Writing and Installing a ProDOS 8 Clock Driver 321 Time/Date Utility Programs 322 An Applesofr Time and Date Variable 322 Setting the Time and Date on a Clockless Apple 327 CHAPTER 9 GS/OS Character Devices 329 GS/OS Commands for Character Devices 329 Keyboard Input 330 The Input Port 332 UIR Editing 334 Terminator Characters 335 Video Output 336 Control Commands 337 Multiple Windows 337 Device Commands 338 DControl Subcommands 338 DStatus Subcommands 342 Console Driver Programming Example 343 APPENDIX I Using Assemblers 353 Merlin 8/16 353 APW Assembler 354 APPENDIX II ProDOS Blocks and DOS 3.3 Sectors 357 APPENDIX III Bibliography 359 GS/OS and ProDOS 8 Reference Books 359 Apple II Technical Reference Books 359 65816 Assembly-Language Books 360 APPENDIX IV The Program Disk 361 The DISK.MAP Program 362 The PROTIME Program 362 The PROTYPE Program 363 The SMARTPORT Program 364 xii