"Aztec C86 Manual Cover" 1 "Aztec C86 v4.10c Release Document" 2 "New Features" 2 "BUGS FIXED" 2 "NEW COMPILER FEATURES" 2 "NEW LINKER FEATURES" 2 "NEW UTILITIES" 3 "Documentation Corrections" 3 "Packaging" 4 "FILES IN ALL VERSIONS OF AZTEC C86" 4 "Executable Programs" 4 "Libraries" 4 "Object Modules" 5 "New Header File" 5 "Source Archives" 5 "Miscellaneous" 5 "FILES ONLY IN DEVELOPER AND COMMERCIAL SYSTEMS" 6 "Executable Programs" 6 "Libraries" 6 "FILES ONLY IN THE COMMERCIAL SYSTEM" 6 "Libraries" 6 "Source Archives" 6 "Files for Creating ROMable Code" 7 "CHECKING THE FILES" 7 "Common Problems" 7 "Stray Pointers" 7 "Array Index Out of Bounds" 7 "Calls to Library Functions" 8 "Library Function Return Values" 8 "Assignment vs. Equals" 8 "Function Return Values" 8 "TECHNICAL SUPPORT" 8 "CTOENG - C-TO-ENGLISH TRANSLATOR" 9 "ENGTOC - ENGLISH-TO-C TRANSLATOR" 10 "CPP - C-PREPROCESSOR" 11 "PROTO - PROTOTYPE GENERATOR" 12 "HD - HEX DUMP UTILITY" 14 "STR FUNCTIONS" 15 "Aztec C86 v4.10a Release Document" 16 "1. Description of the Package" 16 "1.1 Differences between the three systems" 16 "2. Information for New Users" 17 "3. New features" 17 "3.1 The compiler" 18 "3.1.1 Two passes" 18 "3.1.2 ANSI support" 18 "3.1.3 Inline 8087 support" 18 "3.1.4 Compiler support for inline 80287 instructions" 18 "3.1.5 New keywords: near, far, huge" 18 "3.1.6 New keywords: fortran, pascal, cdecl" 19 "3.2 The assembler" 19 "3.3 SDB: new features" 19 "3.4 Z - new features" 20 "3.5 The printf functions" 20 "3.6 New functions: lmalloc, lcalloc, lrealloc, lfree" 20 "3.7 Standard I/O access of the preopened auxiliary and printer devices" 21 "3.8 New features of the agetc function" 21 "3.9 Linking old and new object modules together" 21 "4. Packaging" 21 "4.1 Files that are in all versions of Aztec C86" 21 "4.1.1 Executable programs" 21 "4.1.2 Libraries" 22 "4.1.3 Object modules" 22 "4.1.4 Header files" 22 "4.1.5 Source archives" 22 "4.1.6 Miscellaneous" 22 "4.2 Files that are only in Developer and Commercial systems" 23 "4.2.1 Executable programs" 23 "4.2.2 Libraries" 23 "4.3 Files that are only in the Commercial System" 23 "4.3.1 Source archives" 23 "4.3.2 Files for creating ROMable code" 23 "4.4 Checking the files" 24 "5. Technical support information" 24 "6. Additional Documentation" 24 "Aztec C86 v4.10a Supplements" 26 "The Compiler: new features" 26 "1. Two passes" 26 "2. ANSI support" 26 "2.1 Function prototypes" 26 "2.2 Support for ANSI preprocessing directives" 27 "2.3 Expression evaluation using ANSI-defined, 'value-preserving' rules" 27 "2.4 Evaluation of shift operations using ANSI-defined rules" 27 "2.5 Support for the type specifiers volatile and const" 28 "3. Inline 8087 support" 28 "4. Compiler support for inline 80287 instructions" 28 "5. Defining the memory model for selected items" 28 "6. The fortran, pascal, cdecl keywords" 29 "7. The -ansi option" 29 "8. The -3 option" 29 "9. Code generator improvements" 30 "10. Support for sdb, the source-level debugger" 30 "11. Placement of string constants" 30 "12. Stack overflow" 30 "13. Summary of new compiler options" 30 "The ANSI C Proprocessor" 32 "1. Directive syntax" 32 "2. The #include Directive" 32 "3. The #if Directive" 33 "4. The #define directive" 33 "4.1 The 'stringize' operator, #" 34 "4.2 The 'concatenate' operator, ##" 35 "4.3 Recursion" 35 "4.4 Predefined macros" 36 "5. Miscellaneous Directives" 36 "Defining the memory model of selected items" 38 "1. Near, far, and huge data items" 38 "2. Near, far, and huge functions" 39 "3. Example 1" 40 "4. Example 2" 40 "5. Example 3" 40 "6. Example 4" 41 "7. Example 5" 41 "8. Example 6" 41 "9. Example 7" 42 "10. Example 8" 42 "The Assembler: new features" 44 "1. 80287 support" 44 "2. New codemacro parameter specifiers: F and T" 44 "3. New types for data items" 44 "4. New codemacro directives" 44 "4.1 RFIX" 44 "4.2 RFIXM" 45 "4.3 RNFIX" 46 "4.4 RNFIXM" 46 "4.5 RWFIX" 47 "The Linker: new features" 48 "1. The CLIB environment variable" 48 "2. Searching for object modules and libraries" 48 "3. Linking programs that have lots of symbols" 49 "4. Support for sdb" 49 "Z - new features" 50 "1. Editing large files" 50 "2. Support for the EGA 43-line display" 50 "3. Support for color displays" 50 "4. ZOPT enhancements" 50 "New features of the printf functions" 52 "LMALLOC" 54 "Standard I/O and the auxiliary and printer devices" 56 "The agetc function: new features" 58 "SDB: new features" 60 "1. Floating point disassembly" 60 "2. New addressing modes for bs command" 60 "3. New display information for the bd command" 60 "4. Changes to the print command" 60 "4.1 The P command" 60 "4.2 Format override character @ is now optional" 60 "4.3 Changes to the string format specifier, 's'" 61 "4.4 Precision specification for strings" 61 "4.5 Precision specifier" 61 "4.6 Repeating a print command" 61 "5. Changes to the 't' command" 61 "6. Suspension of source mode" 61 "7. Qualifying names and expressions" 62 "7.1 Name qualifiers" 62 "7.2 Expression qualifiers" 62 "7.3 Disambiguating qualified names and expressions" 62 "8. Searching for unqualified names" 63 "9. Displaying comments" 63 "10. User names and register names" 63 "11. Executing another command" 63 "12. Separate screens for programs and sdb (the -w option)" 63 "13. Using two screens (the -2 option)" 64 "SDB Tutorial" 66 "1. Getting Started" 66 "2. Starting the sdb" 66 "3. Displaying sections of the source file" 67 "4. Running the program" 67 "5. Displaying the trace of calls" 69 "6. Displaying values and computing expressions" 69 "7. Walking up and down the frames" 70 "8. Displaying assembly" 70 "C Driver" 72 "Enhancements to MAKE" 76 "1. Different directory and drive dependencies" 76 "2. Command line macros" 77 "3. Command line argument order" 77 "OPEN" 78 "FILELOCK" 80 "Using MANX Technical Support" 82 "MANX Problem Report" 88 "Aztec C86 v3.2 Manual" 90 "USE RESTRICTIONS" 92 "RESTRICTED RIGHTS LEGEND" 92 "COPYRIGHT" 92 "DISCLAIMER" 93 "TRADEMARKS" 93 "Manual Revision History" 94 "Summary of Contents" 96 "8086-specific chapters" 96 "System Independent Chapters" 96 "Index" 96 "Contents" 97 "ov - Overview" 108 "Overview" 110 "Versions" 111 "Components" 112 "Preview" 112 "tut - Tutorial Introduction" 114 "Chapter Contents" 115 "Tutorial Introduction" 116 "1. Installing Aztec C86" 116 "Back up the disks" 116 "Check the Files" 116 "Create a working disk" 116 "The working disk and the PCDOS/MSDOS linker" 117 "2. Creating an Executable Program" 120 "Step 0: Create the Source Program" 120 "Step 1: Compile" 120 "Step 2: Assemble" 120 "Step 3: Link" 120 "Creating an executable program, when using the PCDOS/MSDOS linker" 121 "3. Where to go from here" 121 "cc - The Compiler" 124 "Chapter Contents" 125 "The Compiler" 128 "1. Compiler Operating Instructions" 128 "1.1 The C source file" 129 "1.1.1 Source files on MSDOS and PCDOS" 129 "1.1.2 Source files on CP/M-86" 129 "1.1.3 More source file information" 129 "1.2 The output files" 130 "1.2.1 Creating an object code file" 130 "1.2.2 Creating just an assembly language file" 131 "1.3 Searching for #include files" 132 "1.3.1 The -I option" 132 "1.3.1.1 The -I option on MSDOS and PCDOS" 132 "1.3.1.2 The -I option on CP/M-86" 133 "1.3.2 The INCLUDE environment variable" 133 "1.3.3 The search order for include files" 133 "1.3.3.1 The search order on MSDOS and PCDOS" 133 "1.3.3.2 The search order on CP/M-86" 133 "1.4 Memory models" 134 "1.4.1 Selecting a module's memory model" 135 "1.4.2 Multi-module programs" 136 "1.4.2.1 You can't mix 'large code' and 'small code' modules" 136 "1.4.2.2 Mixing 'large data' and 'small data' modules" 136 "1.4.2.3 Libraries" 137 "1.4.3 Program Organization" 138 "1.4.4 'large model' versus overlays" 138 "1.4.5 Implementation of the memory models" 138 "1.4.5.1 Small code" 139 "1.4.5.2 Large code" 139 "1.4.5.3 Small data" 140 "1.4.5.4 Large data" 140 "2. Compiler Options" 142 "2.1 Summary of options" 142 "2.1.1 Machine-independent utility Options" 142 "2.1.2 Table Manipulation Options" 142 "2.1.3 8086 options for the Optimizing Compiler" 143 "2.1.4 8086 options for the Non-optimizing Compilers" 144 "2.2 Detailed description of the options" 145 "2.2.1 Machine-independent utility options" 145 "The -D Option (Define a macro)" 145 "The -I Option (Include another source file)" 145 "The -S Option (Be Silent)" 146 "2.2.2 Table Manipulation Options" 146 "2.2.2.1 The Macro/Global Symbol Table" 146 "2.2.2.2 The Local Symbol Table and the -L Option" 146 "2.2.2.3 The Expression Table and the -E Option" 147 "2.2.2.4 The Case Table and the -Y Option" 147 "2.2.2.5 The String Table and the -Z Option" 148 "2.2.3 8086 options for the Optimizing Compiler" 149 "The +F Option (Generate Fast Code)" 149 "The +C Option (Generate Small Code)" 149 "The +N Option (Foreign Functions)" 149 "The +D Option (Lattice Interface)" 149 "The +DF Option (Lattice Interface)" 149 "The +0, +1, and +2 Options (Processor Selection)" 150 "The +R option (Forget Registers)" 150 "The +U Option (Globals to Externs)" 150 "The +a option" 151 "The +m option" 152 "2.2.4 8086 options for the non-optimizing compilers" 152 "The +F Option (Generate fast code)" 152 "The +J Option (Generate short branches)" 153 "The +U Option (Globals to Externs)" 153 "3. Writing programs" 154 "3.1 Supported language features" 154 "3.1.1 Preprocessor statements" 154 "3.1.1.1 Macros" 154 "Basic definition and use of macros" 154 "Macros having parameters" 155 "Undefining macros" 156 "More features of macros" 156 "3.1.1.2 Conditional compilation statements" 157 "3.1.1.3 More preprocessor statements" 159 "3.1.2 More features" 160 "Structure assignment" 160 "Line continuation" 160 "The void data type" 161 "Special symbols" 161 "3.1.3 Special features" 162 "String merging" 162 "Long names" 162 "Reserved words" 162 "Global variables" 162 "3.2 Data formats" 164 "3.2.1 char" 164 "3.2.2 pointer" 164 "3.2.3 int, short" 164 "3.2.4 long" 164 "3.2.5 float and double" 165 "3.3 Floating Point Exceptions" 165 "3.4 Writing machine-independent code" 165 "3.4.1 Compatibility Between Aztec Products" 165 "3.4.2 Sign Extension For Character Variables" 166 "3.4.3 The MPU... symbols" 166 "3.5 Using long pointers" 167 "3.5.1 Passing pointers between functions" 167 "Declare functions that return pointers" 167 "Declare function arguments that are pointers" 168 "Declare constant pointers to functions" 168 "3.5.2 Expressions involving long pointers to data objects" 169 "Long pointer arithmetic doesn't affect the segment number" 169 "Subtraction of two long pointers doesn't use their segment numbers" 170 "Pointer comparisons sometimes compare the segment numbers" 170 "3.5.3 Creating and accessing huge arrays" 171 "4. Error checking" 173 "as - The Assembler" 176 "Chapter Contents" 177 "The Assembler" 180 "1. Operating Instructions" 180 "1.1 The Source File" 180 "1.1.1 Source files on MSDOS and PCDOS" 180 "1.1.2 Source files on CP/M-86" 180 "1.2 The Object Code File" 181 "1.3 The listing file" 181 "1.4 Searching for include files" 181 "1.4.1 The -I option" 182 "1.4.1.1 The -I option on MSDOS and PCDOS" 182 "1.4.1.2 The -I option on CP/M-86" 182 "1.4.2 The INCLUDE environment variable" 182 "1.4.3 The search order for include files" 182 "1.4.3.1 The search order on MSDOS and PCDOS" 182 "1.4.3.2 The search order on CP/M-86" 182 "2. Assembler Options" 184 "3. Programmer Information" 185 "3.1 Syntax" 185 "Symbol names" 186 "3.2 Symbols" 186 "Variables" 187 "Labels" 187 "3.3 Segmentation" 188 "3.3.1 The SEGMENT and ENDS Directives" 188 "3.3.2 Multiple definitions for a segment" 189 "3.3.3 Nested segments" 189 "3.3.4 The default segment" 190 "3.3.5 The ASSUME Directive" 190 "3.3.6 Using the Uninitialized Data Segment" 191 "3.4 Globally-accessible symbols" 191 "3.4.1 The PUBLIC Directive" 191 "3.4.2 The GLOBAL Directive" 192 "3.4.3 The EXTRN Directive" 192 "3.4.4 Interactions of the GLOBAL, PUBLIC, and EXTRN Directives" 193 "3.5 Operands and expressions" 194 "3.5.1 Registers" 194 "3.5.2 Immediate operands (constants)" 194 "3.5.3 Memory operands" 195 "Accessing data in memory" 195 "Operands to jump and call instructions" 196 "Which segment register is used?" 197 "3.5.4 Operand Expressions" 198 "3.5.5 Arithmetic Operators" 198 "The HIGH and LOW Operators" 198 "The Addition and Subtraction Operators" 198 "The Multiplication and Division Operators" 198 "The Shift Operators" 199 "The Relational Operators" 199 "The Logical Operators" 199 "3.5.6 Attribute-overriding operators" 200 "The Segment Override Operator, ':'" 200 "The PTR Operator" 200 "The SHORT Operator" 202 "3.5.7 Attribute-value operators" 202 "The THIS Operator" 202 "The SEG Operator" 203 "The OFFSET Operator" 203 "The TYPE Operator" 204 "The LENGTH Operator" 204 "The SIZE Operator" 204 "3.5.8 Operator Precedence" 205 "3.6 Instructions" 205 "3.7 Directives" 206 "The ASSUME Directive" 206 "The BSS Directive" 206 "The DB, DW, and DD Directives" 207 "The END Directive" 209 "The EQU Directive" 210 "The '=' (equal sign) Directive" 211 "The EVEN Directive" 211 "The EXTRN Directive" 212 "The GLOBAL Directive" 212 "The GROUP Directive" 212 "The INCLUDE Directive" 212 "The LABEL Directive" 213 "The LARGECODE Directive" 213 "The MOD186 Directive" 214 "The NAME Directive" 214 "The ORG Directive" 214 "The PROC and ENDP Directives" 214 "The PUBLIC Directive" 217 "The RECORD Directive" 217 "Using a User-defined Record Directive" 219 "The SEGMENT and ENDS Directives" 219 "3.8 Macro directives" 219 "3.8.1 Local symbols" 221 "3.8.2 Concatenating parameters to text" 222 "3.8.3 Concatenating parameters to parameters" 223 "3.8.4 Parameter substitution within quoted strings" 224 "3.8.5 Passing a symbol's value to a macro" 225 "3.8.6 Passing comma-containing arguments to macros" 225 "3.8.7 Nesting macros" 226 "3.8.8 Directives for repeatedly assembling a block of statements" 228 "3.8.8.1 The REPT Directive" 228 "3.8.8.2 The IRP directive" 229 "3.8.8.3 The IRPC directive" 230 "3.8.9 Summary of the macro directives" 231 "The ENDM Directive" 231 "The EXITM Directive" 231 "The IRP Directive" 231 "The IRPC Directive" 231 "The LOCAL Directive" 231 "The MACRO Directive" 231 "The PURGE Directive" 232 "The REPT Directive" 232 "3.9 Conditional directives" 232 "The IF Directive" 233 "The IFE Directive" 234 "The IF1 Directive" 234 "The IF2 Directive" 234 "The IFDEF Directive" 234 "The IFNDEF Directive" 234 "The IFB Directive" 234 "The IFNB Directive" 234 "The IFIDN Directive" 235 "The IFDIF Directive" 235 "The ELSE Directive" 235 "The ENDIF Directive" 235 "3.10 Codemacros" 235 "3.10.1 Specifiers" 237 "3.10.2 Modifiers" 238 "3.10.3 Range Specifiers" 238 "3.10.4 The Codemacro Directives" 239 "3.10.4.1 The SEGFIX directive" 239 "3.10.4.2 The NOSEGFIX Directive" 240 "3.10.4.3 The MODRM Directive" 240 "3.10.4.4 The RELB and RELW Directives" 241 "3.10.4.5 The DB, DW, and DD Directives" 241 "3.10.4.6 User-defined Record Directives" 242 "3.10.5 Using the Dot operator to Shift Parameters" 242 "3.10.6 The PROCLEN Symbol" 243 "3.10.7 Matching Instructions to Codemacros" 244 "Specifiers" 244 "Modifiers" 244 "Ranges" 245 "ln - The Linker" 248 "Chapter Contents" 249 "The Linker" 250 "1. Introduction to linking" 250 "Relocatable Object Files" 250 "Linking hello.o" 250 "The Linking Process" 251 "Libraries" 251 "For Example" 251 "The Order of Library Modules" 252 "2. Using the Linker" 254 "The executable file" 254 "Libraries" 254 "3. Linker Options" 256 "3.1 Summary of options" 256 "3.1.1 General Purpose Options" 256 "3.1.2 Options for Segment Address Specification" 256 "3.1.3 Options for Overlay Usage" 257 "3.2 Detailed description of the options" 258 "3.2.1 General Purpose Options" 258 "The -O option" 258 "The -L option" 258 "The -F option" 259 "The -T option" 259 "The -M option" 259 "The -N option" 260 "The -S option" 260 "The -X option" 260 "The -V option" 261 "3.2.2 Options for segment address specification" 261 "3.2.2.1 Segment specification for .exe programs" 261 "3.2.2.2 Segment specification for .com programs" 261 "3.2.3 Options for Overlay Usage" 263 "4. Linker Error Messages" 264 "4.1 Summary of Error Messages" 264 "4.1.1 Command line errors" 264 "4.1.2 I/O errors" 264 "4.1.3 Corrupted object files" 264 "4.1.4 Errors in use of Memory" 264 "4.1.5 Errors arising from source code" 264 "4.2 Description of Linker Error Messages" 266 "4.2.1 Command line errors" 266 "1. unknown option ''" 266 "2. too few arguments in command line" 266 "3. No input given!" 266 "4. Cannot have nested -f options" 266 "5. too few arguments in -f file: " 266 "6. multiple declarations, last one used" 266 "4.2.2 I/O errors" 267 "1. can't open , err=" 267 "2. Cannot open -f file: " 267 "3. I/O error () reading/writing output file" 267 "4. Cannot write output file" 267 "5. Cannot create output file: " 267 "6. Cannot create symbol table output" 267 "7. Cannot create overlay symbol table output" 267 "4.2.3 Corrupted object files" 267 "1. object file is bad!" 267 "2. invalid operator in evaluate " 267 "3. library format is invalid!" 268 "4. Cannot read module from on pass2" 268 "5. Can't find symbol, , on pass two" 268 "6. is not a rel file!" 268 "4.2.4 Errors in use of memory" 268 "1. Insufficient memory!" 268 "2. Too many symbols!" 268 "3. -C or -D value less than base address" 268 "4. Code and Data Regions Overlap" 268 "4.2.5 Errors arising from source code" 268 "1. Undefined symbol: " 268 "2. multiply defined" 269 "3. pass1() and pass2() values differ" 269 "4. symbol type differs on pass two: " 269 "5. Attempt to Initialize Data in Root" 269 "6. undefined COMMON " 269 "util - Utility Programs" 270 "Chapter Contents" 271 "Utility Programs" 272 "arcv (Source dearchiver)" 273 "cnm (Object file utility)" 274 "crc (File verificator)" 278 "hex86 (ROM Hex Generator)" 279 "lb (Object module librarian)" 280 "1. The arguments to lb" 280 "1.1 The library argument" 280 "1.2 The options argument" 280 "1.2.1 Function code options" 280 "1.2.2 Qualifier options" 281 "1.3 The mod arguments" 281 "1.4 Reading arguments from another file" 281 "2. Basic features of lb" 281 "2.1 Creating a Library" 282 "2.1.1 The temporary library" 282 "2.2 Getting the table of contents for a library" 282 "2.3 How modules get their names" 283 "2.4 Order in a library" 283 "2.5 Getting lb arguments from a file" 283 "3. Advanced lb features" 284 "3.1 Adding modules to a library" 284 "3.1.1 Adding modules before an existing module" 285 "3.1.2 Adding modules after an existing module" 285 "3.1.3 Adding modules at the beginning or end of a library" 286 "3.2 Moving modules within a library" 286 "3.2.1 Moving modules before an existing module" 286 "3.2.2 Moving modules to the beginning or end of a library" 287 "3.3 Deleting Modules" 287 "3.4 Replacing Modules" 288 "3.5 Uniqueness" 288 "3.6 Extracting modules from a Library" 289 "3.7 The 'verbose' option" 289 "3.8 The 'silence' option" 289 "3.9 Rebuilding a library" 289 "3.10 Defining the default module extension" 290 "3.11 Help" 290 "ls (list directory contents)" 291 "obd (Object file utility)" 294 "obj (MSDOS/PCDOS Object code generator)" 295 "ord (Object library generation utility)" 296 "prof (Execution profiler)" 297 "sqz (Object file utility)" 298 "term (Terminal emulator for IBM PC)" 299 "libov86 - Library Functions Overview: 8086 Information" 300 "Library Functions Overview: 8086 Information" 302 "1. Overview of I/O: 8086 Information" 302 "1.1 Pre-opened devices and command line arguments" 302 "1.2 File I/O" 303 "1.2.1 Sequential I/O" 303 "1.2.2 Random I/O" 303 "Finding the end of a file on CP/M-86" 303 "1.2.3 Opening Files" 304 "1.2.3.1 Opening files on PCDOS and MSDOS" 304 "1.2.3.2 Opening files on CP/M-86" 304 "1.3 Device I/O" 305 "2: Overview of Standard I/O: 8086 Information" 305 "2.5 Buffering" 305 "4. Console I/O Overview: 8086 Information" 305 "4.2 Character-oriented Input" 305 "4.2.1 Character-oriented Input on CP/M-86" 305 "4.2.2 Character-oriented Input on PCDOS and MSDOS" 306 "4.4 The sgtty fields" 306 "4.4.1 The sg_flags field" 306 "lib86 - 8086 Functions" 308 "Chapter Contents" 309 "8086 Functions" 310 "Index to 8086 Functions" 311 "The functions" 313 "ACCESS" 313 "ASSERT" 315 "BDOS" 316 "BDOSX" 317 "BREAK" 318 "CHMOD" 320 "CIRCLE" 321 "CLOCK" 322 "COLOR" 323 "CSREAD" 324 "DIRECTORY" 325 "DOS" 326 "DUP" 327 "EXEC" 328 "EXIT" 331 "FARCALL" 332 "FCBINIT" 333 "FEXEC" 334 "FILETIME" 336 "GETENV" 338 "LINE" 339 "LONGPTR" 340 "MEMORY" 341 "MKTEMP" 343 "MODE" 345 "MONITOR" 346 "MOVBLOCK" 349 "PEEK" 350 "PERROR" 351 "POINT" 352 "PORT" 353 "SCDIR" 354 "SCREEN" 355 "SEGREAD" 359 "SIGNAL" 360 "SYSTEM" 362 "TIME" 363 "TMPFILE" 365 "TMPNAM" 366 "USER" 367 "tech - Technical Information" 368 "Chapter Contents" 369 "Technical Information" 370 "1. Program Organization" 371 "1.1 The Program Areas" 372 "1.1.1 The Code Area" 372 "1.1.2 The Overlay Code Area" 372 "1.1.3 The Initialized Data, Uninitialized Data, and Overlay Data Areas" 372 "1.1.4 The Stack and Heap Areas" 373 "1.1.4.1 The _STKLOW, _STKSIZ, and _HEAPSIZ variables" 373 "1.2 Program organization for different combinations of factors" 374 "1.2.1 Large data, .exe programs" 375 "1.2.2 'Small data', .exe, 'stack below heap' programs" 376 "1.2.3 'Small data', .exe, 'stack above heap' programs" 377 "1.2.4 'Small data', .com, 'stack below heap' programs" 378 "1.2.5 'Small data', .com, 'stack above heap' programs" 378 "1.2.6 Programs on DOS 1.1 and CP/M-86" 379 "1.3 Symbols related to Program Organization" 380 "1.4 Startup routine termination codes" 381 "2. Overlay Support" 382 "2.1 Introduction to overlays" 382 "What is an Overlay?" 382 "How do I Call an Overlay From a Program?" 382 "How do I make a function an overlay?" 382 "What Files are Created on the Disk?" 383 "What about Overlaying Large Model Programs?" 383 "Sample Run" 383 "2.2 Programmer Information" 386 "The +C and +D options" 386 "Creating a root and overlays" 387 "Example 1" 387 "Example 2: nested overlays" 388 "Determining the size of the overlay area" 389 "Error messages from ovloader" 390 "Possible Problems" 390 "3. Aztec C86 libraries" 392 "4. Cross Development" 393 "5. Using the PC-DOS/MS-DOS Linker" 394 "A simple example" 394 "Using obj" 395 "Converting the libraries" 395 "Global variables" 395 "6. Assembly-Language Functions" 397 "6.1 Conventions for C-callable, assembly-language functions" 397 "6.1.1 Executable code" 397 "6.1.2 Global variables" 397 "6.1.3 'Small code' and 'large code' programs" 398 "6.1.4 'Small data' and 'large data' programs" 398 "6.1.5 Names of external functions and variables" 399 "6.1.6 Function calls and returns" 399 "6.1.7 Register usage" 400 "6.2 Assembly-language Macros" 400 "The PROCDEF macro" 401 "The PEND Macro" 402 "The INTERNAL Macro" 403 "The ENTRDEF Macro" 403 "The INTRDEF Macro" 403 "The PRET Macro" 403 "The LDPTR Macro" 403 "The RETPTRM Macro" 404 "The RETPTRR Macro" 404 "The RETNULL Macro" 405 "The PUSHDS and POPDS Macros" 405 "The FINISH Macro" 405 "6.2.1 Example" 405 "6.3 Embedded Assembler Source" 406 "7. Generating ROMable code" 408 "7.1 Features of ROMable programs" 408 "7.2 Special ROM-related programs" 408 "7.3 The procedure for generating ROMable code" 409 "7.4 Description of hex86" 410 "Burning programs into multiple ROMs" 410 "Code and initialized data" 410 "Using the linker" 410 "Reset code" 410 "hex86 operating instructions" 411 "The -J option" 412 "The -Z option" 412 "The -E and -O options" 412 "The -S option" 412 "The -P option" 413 "The -B option" 413 "unitools - Unitools" 414 "Chapter Contents" 415 "Unitools" 418 "diff (Source File Comparator)" 419 "1. The -b option" 419 "2. The conversion list" 420 "2.1 Conversion items" 420 "2.1.1 The command line" 420 "2.1.2 The affected lines" 421 "3. Differences between the UNIX and Manx versions of diff" 421 "grep (Pattern Matcher)" 423 "1. Input files" 423 "2. Options" 423 "3. Patterns" 424 "3.1 Matching single characters" 424 "3.2 Matching character strings" 425 "3.3 Matching repeating characters" 425 "3.4 Matching strings that begin or end lines" 425 "4. Examples" 426 "4.1 Simple string matching" 426 "4.2 The special character '.'" 426 "4.3 The backslash character" 426 "4.4 The dollar sign and the caret ($ and ^)" 427 "4.5 Using brackets" 428 "4.6 Repeated characters" 428 "5. Differences between the Manx and UNIX versions of grep" 428 "5.1 Option differences" 428 "5.2 Pattern differences" 428 "make (Program Maintainance Utility)" 429 "1. The basics" 429 "1.1 What make does" 430 "1.2 The makefile" 430 "1.3 Rules" 432 "1.3.1 make's use of rules" 433 "1.3.2 An example" 433 "1.3.3 Interaction of rules and dependency entries" 434 "2. Advanced features" 434 "2.1 Dependent Files" 434 "2.2 Macros" 435 "2.2.1 Using macros" 435 "2.2.2 Defining macros in a makefile" 435 "2.2.3 Defining macros in a command line" 436 "2.2.4 Macros used by built-in rules" 436 "2.2.5 Special macros" 436 "2.3 Rules" 437 "2.3.1 Rule definition" 437 "2.3.2 Built-in rules" 438 "2.4 Commands" 439 "2.4.1 Allowed commands" 439 "2.4.2 Logging commands and aborting make" 439 "2.4.3 Long command lines" 439 "2.5 Makefile syntax" 440 "2.5.1 Comments" 440 "2.5.2 Line continuation" 440 "2.6 Starting make" 441 "2.6.1 The command line" 441 "2.6.2 make's standard output" 442 "2.7 Executing commands" 442 "2.8 Differences between the Manx and UNIX 'make' programs" 442 "3. Examples" 443 "3.1 First example" 443 "3.2 Second example" 444 "3.2.1 The makefile in the 'libc' directory" 445 "3.2.2 Makefile for the 'sys' directory" 446 "3.2.3 Makefile for the 'misc' directory" 446 "Z - the text editor" 447 "1. GETTING STARTED" 449 "1.1 Creating a new program" 450 "The screen" 450 "Modes of Z" 450 "Insert mode" 451 "Exiting Z" 451 "1.2 Editing an Existing File" 453 "Starting and stopping Z" 453 "The cursor" 453 "Moving around in the text: scrolling" 453 "Moving around in the text: the 'Go' command" 454 "Moving around in the text: string searching" 454 "Finely tuned moves" 455 "Deleting text" 455 "More insert commands" 456 "Summary" 456 "2. More commands" 458 "2.1 Introduction" 459 "2.1.1 The screen" 459 "2.1.1.1 Displaying unprintable characters" 459 "2.1.1.2 Displaying lines that don't fit on the screen" 459 "2.1.2 Commands" 459 "2.1.3 Special Keys" 460 "2.2 Paging and Scrolling" 461 "2.3 Searching for strings" 462 "2.3.1 The other string-searching commands" 462 "2.3.2 Regular expressions" 462 "2.3.3 Disabling extended pattern matching" 463 "2.4 Local Moves" 465 "2.4.1 Moving around on the screen" 465 "2.4.2 Moving within a line" 465 "2.4.3 Word movements" 466 "2.4.4 Moves within C programs" 466 "2.4.5 Marking and returning" 467 "2.4.6 Adjusting the screen" 468 "2.5 Making changes" 469 "2.5.1 Small changes" 469 "2.5.2 Operators for deleting and changing text" 469 "2.5.3 Deleting and changing lines" 470 "2.5.4 Moving blocks of text" 470 "2.5.5 Duplicating blocks of text: the 'yank' operator" 471 "2.5.6 Named buffers" 472 "2.5.7 Moving text between files" 473 "2.5.8 Shifting text" 473 "2.5.9 Undoing and redoing changes" 473 "2.6 Inserting text" 474 "2.6.1 Additional insert commands" 474 "2.6.2 Insert mode commands" 474 "2.6.3 Autoindent" 474 "2.7 Macros" 476 "2.7.1 Immediate macro definition" 476 "2.7.2 Some examples" 476 "2.7.3 Indirect macro definition" 477 "2.7.4 Re-executing macros" 478 "2.7.5 Wrapping around during macro execution" 478 "2.8 The Ex-like commands" 480 "2.8.1 Addresses in Ex commands" 480 "2.8.2 The 'substitute' command" 481 "2.8.2.1 Examples" 482 "2.8.3 The '&' (repeat last substitution) command" 482 "2.9 Starting and stopping Z" 483 "2.9.1 Starting Z" 483 "2.9.1.1 Starting Z without a filename" 483 "2.9.1.2 Starting Z with a list of files" 483 "2.9.1.3 The options file" 483 "2.9.1.4 Setting options for a file" 484 "2.9.2 Stopping Z" 485 "2.10 Accessing files" 486 "2.10.1 File names" 486 "2.10.2 Writing files" 486 "2.10.3 Reading files" 487 "2.10.4 Editing another file" 487 "2.10.5 File lists" 489 "2.10.6 Tags" 489 "2.10.7 The CTAGS utility" 490 "2.11 Executing system commands" 492 "2.12 Options" 493 "2.13 Z vs. Vi" 494 "2.14 System-dependent features" 495 "2.14.1 IBM PC Features" 495 "2.14.1.1 Two versions of Z" 495 "2.14.1.2 Key substitutions" 495 "2.14.1.3 Function key macros" 496 "3. Command Summary" 498 "Starting Z" 498 "The Display" 498 "Options" 498 "Adjusting the Screen" 498 "Positioning within File" 498 "Marking and Returning" 499 "Line Positioning" 499 "Character Positioning" 499 "Words and Paragraphs" 500 "Insert and Replace" 500 "Corrections During Insert" 500 "Operators" 500 "Miscellaneous Operations" 501 "Yank and Put" 501 "Undo and Redo" 501 "Macros" 501 "Colon Commands" 502 "sdb - Source Level Debugger" 504 "Chapter Contents" 505 "Source Level Debugger" 506 "1. Overview" 508 "1.1 Basic commands" 508 "1.2 Names" 509 "1.2.1 Code and Data symbols" 509 "1.2.2 Operator usage of names" 509 "1.3 Loading programs and symbols" 509 "1.4 Breakpoints" 510 "1.5 Memory-change breakpoints" 511 "1.6 Separate screens for programs and sdb" 511 "1.7 Trace mode" 512 "1.8 Backtracing" 512 "1.9 Macros" 512 "1.10 Displaying source files" 512 "1.11 Other features" 513 "2. Using SDB" 514 "2.1 Starting SDB" 514 "2.2 Commands" 514 "2.2.1 Definitions" 514 "2.2.1.1 The Definition of EXPR" 514 "2.2.1.2 The Definition of ADDR" 515 "2.2.1.3 The Definition of RANGE" 515 "2.2.1.4 The Definition of CMDLIST" 516 "2.3 Command descriptions" 516 "2.3.1 The Breakpoint Commands" 516 "2.3.2 The Display Commands" 519 "2.3.3 The 'Find Source String' Command" 523 "2.3.4 The 'Frame' Commands" 524 "2.3.5 The Go commands" 524 "2.3.6 The Input Commands" 525 "2.3.7 The LOAD Command" 526 "2.3.8 The Memory Modification Commands" 527 "2.3.9 The Output Commands" 528 "2.3.10 The 'Print' Command" 528 "A complete list of the desc_codes" 533 "Codes for printing floating point numbers" 533 "Codes for printing characters" 534 "Special purpose codes" 534 "Codes for setting the p command's current address" 534 "2.3.11 The Quit command" 535 "2.3.12 The Register command" 536 "2.3.13 The Single Step commands" 536 "2.3.14 The Unassemble commands" 537 "2.3.15 The Variable command" 537 "2.3.16 The Macro commands" 538 "2.3.17 The EXPRESSION Commands" 538 "2.3.18 The 'Redirect command input/output' Command" 539 "2.3.19 The Help command" 539 "2.3.20 The Change Mode command" 540 "3. Command Summary" 541 "db - Assembly Language Debugger" 544 "Chapter Contents" 545 "Assembly Language Debugger" 546 "1. Overview" 548 "1.1 Basic commands" 548 "1.2 Names" 548 "1.2.1 Code and Data symbols" 549 "1.2.2 Operator usage of names" 549 "1.3 Loading programs and symbols" 549 "1.4 Breakpoints" 550 "1.5 Memory-change breakpoints" 551 "1.6 Separate screens for programs and db" 551 "1.7 Trace mode" 552 "1.8 Backtracing" 552 "1.9 Macros" 552 "1.10 Displaying source files" 552 "1.11 Other features" 552 "2. Using DB" 554 "2.1 Starting DB" 554 "2.2 Commands" 554 "2.2.1 Definitions" 554 "2.2.1.1 The Definition of EXPR" 554 "2.2.1.2 The Definition of TERM" 555 "2.2.1.3 The Definition of ADDR" 557 "2.2.1.4 The Definition of RANGE" 558 "2.2.1.5 The Definition of CMDLIST" 559 "2.3 Command descriptions" 559 "2.3.1 The Breakpoint Commands" 559 "2.3.2 The Clear Commands" 562 "2.3.3 The Display Commands" 562 "2.3.4 The 'Find Source String' Command" 566 "2.3.5 The Go commands" 567 "2.3.6 The Input Commands" 568 "2.3.7 The Load Commands" 568 "2.3.8 The Memory Modification Commands" 570 "2.3.9 The Output Commands" 572 "2.3.10 The 'Print' Command" 572 "A complete list of the desc_codes" 576 "Codes for printing floating point numbers" 576 "Codes for printing characters" 577 "Special purpose codes" 577 "Codes for setting the p command's current address" 577 "2.3.11 The Quit command" 578 "2.3.12 The Register command" 579 "2.3.13 The Single Step commands" 579 "2.3.14 The Unassemble commands" 580 "2.3.15 The Variable commands" 580 "2.3.16 The Macro command" 581 "2.3.17 The 'Display expression' Command" 581 "2.3.18 The 'Redirect command input' Command" 582 "2.3.19 The Help command" 582 "3. Command Summary" 583 "libov - Overview of Library Functions" 586 "Chapter Contents" 587 "Overview of Library Functions" 588 "1. Overview of I/O" 589 "1.1 Pre-opened devices and command line arguments" 589 "1.2 File I/O" 591 "1.2.1 Sequential I/O" 591 "1.2.2 Random I/O" 591 "1.2.3 Opening files" 591 "1.3 Device I/O" 592 "1.3.1 Console I/O" 592 "1.3.2 I/O to Other Devices" 592 "1.4 Mixing unbuffered and standard i/o calls" 592 "2. Overview of Standard I/O" 594 "2.1 Opening files and devices" 594 "2.2 Closing streams" 594 "2.3 Sequential I/O" 595 "2.4 Random I/O" 595 "2.5 Buffering" 595 "2.6 Errors" 596 "2.7 The standard i/o functions" 597 "3. Overview of Unbuffered I/O" 599 "3.1 File I/O" 600 "3.2 Device I/O" 600 "3.2.1 Unbuffered I/O to the Console" 600 "3.2.2 Unbuffered I/O to Non-Console Devices" 601 "4. Overview of Console I/O" 602 "4.1 Line-oriented input" 602 "4.2 Character-oriented input" 603 "4.2.1 Writing system-independent programs" 603 "4.3 Using ioctl" 604 "4.4 The sgtty fields" 604 "4.4.1 The sg_flags field" 604 "4.5 Examples" 605 "4.5.1 Console input using default mode" 605 "4.5.2 Console input - RAW mode" 605 "4.5.3 Console input - console in CBREAK + ECHO mode" 606 "5. Overview of Dynamic Buffer Allocation" 607 "Dynamic allocation of standard i/o buffers" 607 "Where to go from here" 607 "6. Overview of Error Processing" 608 "lib - System-Independent Functions" 610 "Chapter Contents" 611 "System Independent Functions" 612 "Index to System Independent Functions" 614 "The functions" 617 "ATOF" 617 "CLOSE" 618 "CREAT" 619 "CTYPE" 620 "EXP" 621 "FCLOSE" 623 "FERROR" 624 "FLOOR" 625 "FOPEN" 626 "FREAD" 629 "FREXP" 631 "FSEEK" 632 "GETC" 634 "GETS" 636 "IOCTL" 637 "LSEEK" 638 "MALLOC" 640 "MOVMEM" 642 "OPEN" 643 "PRINTF" 646 "PUTC" 650 "PUTS" 652 "QSORT" 653 "RAN" 655 "READ" 656 "RENAME" 657 "SCANF" 658 "SETBUF" 665 "SETJMP" 666 "SIN" 668 "SINH" 670 "STRING" 671 "TOUPPER" 673 "UNGETC" 674 "UNLINK" 675 "WRITE" 676 "style - Style" 678 "Chapter Contents" 679 "Style" 680 "1. Introduction" 680 "what's in it for me?" 680 "keep it simple" 680 "learn the C idioms" 680 "be flexible in using the library" 681 "write readable code" 682 "use straightforward logical expressions" 682 "learn the rules for expression evaluation" 682 "a matter of taste" 682 "2. Structured Programming" 684 "modularity and block structure" 684 "3. Top-down Programming" 685 "step one" 685 "step two" 685 "4. Defensive Programming and Debugging" 687 "faced with the unknown" 687 "when bugs strike" 688 "from the compiler" 688 "if this ever happens to you" 688 "run-time errors" 689 "checking input data" 689 "printf it" 690 "function calls" 690 "found it" 691 "5. Things to Watch Out for" 692 "missing semicolon or brace" 692 "assignment (=) vs comparison (==)" 692 "misplaced semicolon" 692 "division (/) vs escape sequence (\)" 692 "character constant vs character string" 692 "uninitialized variable" 692 "evaluation of expressions" 693 "undefined order of evaluation" 693 "evaluation of boolean expressions" 693 "badly formed comments" 694 "nesting error" 694 "usage of else" 694 "falling through the cases in a switch" 694 "strange loops" 694 "use of strings" 695 "pointer vs object of a pointer" 695 "array subscripting" 695 "function interface" 695 "be sure of what a function returns" 696 "shared data" 696 "err - Compiler Error Messages" 698 "Chapter Contents" 699 "Compiler Error Messages" 700 "1. Summary of error codes" 701 "2. Explanations" 704 "1: bad digit in octal constant" 704 "2: string space exhausted" 704 "3: unterminated string" 704 "4: internal error" 704 "5: illegal type for function" 704 "6: error in argument declaration" 704 "7: bad declaration syntax" 705 "8: syntax error in type cast" 705 "9: array dimension must be constant" 705 "10: array size must be positive integer" 705 "11: data type too complex" 706 "12: illegal pointer reference" 706 "13: internal [see error 4]" 706 "14: internal [see error 4]" 706 "15: storage class conflict" 706 "16: data type conflict" 707 "17: Unsupported data type" 707 "18: data type conflict" 707 "19: obsolete" 707 "20: structure redeclaration" 708 "21: missing }" 708 "22: syntax error in structure declaration" 708 "23: incorrect type for library function (Apprentice C only)" 708 "23: obsolete (Other Aztec C Compilers)" 708 "24: need right parenthesis or comma" 708 "25: structure member name expected here" 709 "26: must be structure/union member" 709 "27: illegal type cast" 709 "28: incompatible structures" 710 "29: illegal use of structure" 710 "30: missing : in ? conditional expression" 710 "31: call of non-function" 710 "32: illegal pointer calculation" 710 "33: illegal type" 711 "34: undefined symbol" 711 "35: typedef not allowed here" 711 "36: no more expression space" 711 "37: invalid expression" 712 "38: no auto. aggregate initialization" 712 "39: obsolete [see error 19]" 713 "40: internal [see error 4]" 713 "41: initializer not a constant" 713 "42: too many initializers" 713 "43: undefined structure initialization" 714 "44: obsolete [see error 19]" 714 "45: bad declaration syntax" 714 "46: missing closing brace" 714 "47: open failure on include file" 715 "48: illegal symbol name" 715 "49: multiply defined symbol" 715 "50: missing bracket" 716 "51: lvalue required" 716 "52: obsolete [see error 19]" 716 "53: multiply defined label" 716 "54: too many labels" 716 "55: missing quote" 717 "56: missing apostrophe" 717 "57: line too long" 717 "58: illegal # encountered" 717 "59: macro too long" 717 "60: obsolete [see error 19]" 718 "61: reference of member of undefined structure" 718 "62: function body must be compound statement" 718 "63: undefined label" 718 "64: inappropriate arguments" 719 "65: illegal or missing argument name" 719 "66: expected comma" 719 "67: invalid else" 719 "68: syntax error" 720 "69: missing semicolon" 720 "70: bad goto syntax" 720 "71: statement syntax error in do-while" 721 "72: 'for' syntax error: missing first semicolon" 721 "73: 'for' syntax error: missing second semicolon" 721 "74: case value must be integer constant" 721 "75: missing colon on case" 722 "76: too many cases in switch" 722 "77: case outside of switch" 722 "78: missing colon" 722 "79: duplicate default" 722 "80: default outside of switch" 723 "81: break/continue error" 723 "82: illegal character" 723 "83: too many nested includes" 723 "84: too many array dimensions" 723 "85: not an argument" 723 "86: null dimension in array" 723 "87: invalid character constant" 723 "88: not a structure" 724 "89: invalid storage class" 724 "90: symbol redeclared" 724 "91: illegal use of floating point type" 724 "92: illegal type conversion" 724 "93: illegal expression type for switch" 725 "94: bad argument to define" 725 "95: no argument list" 725 "96: missing argument to macro" 725 "97: obsolete [see error 19]" 725 "98: not enough args in macro reference" 725 "99: internal [see error 4]" 725 "100: internal [see error 4]" 725 "101: missing close parenthesis on macro reference" 725 "102: macro arguments too long" 726 "103: #else with no #if" 726 "104: #endif with no #if" 726 "105: #endasm with no #asm" 726 "106: #asm within #asm block" 727 "107: missing #endif" 727 "108: missing #endasm" 727 "109: #if value must be integer constant" 727 "110: invalid use of colon operator" 727 "111: illegal use of a void expression" 727 "112: illegal use of function pointer" 728 "113: duplicate case in switch" 728 "114: macro redefined" 728 "115: keyword redefined" 729 "116: field width must be > 0" 729 "117: invalid 0 length field" 729 "118: field is too wide" 730 "119: field not allowed here" 730 "120: invalid type for field" 730 "121: ptr/int conversion" 730 "122: ptr & int not same size" 730 "123: function ptr & ptr not same size" 730 "124: invalid ptr/ptr assignment" 730 "125: too many subscripts or indirection on integer" 731 "3. Fatal Compiler Error Messages" 732 "Out of disk space!" 732 "unknown option:" 732 "duplicate output file" 732 "too few arguments for -o option" 732 "Open failure on input" 732 "No input!" 732 "Open failure on output" 732 "Local table full! (use -L)" 732 "Out of memory!" 733 "index - Index" 734 "Order of chapters in manual" 734 "System Dependent Chapters" 734 "System Independent Chapters" 734 "Index" 736 "A, B, C" 736 "D" 738 "E, F" 739 "G, H, I" 740 "L, M" 741 "N, O, P" 742 "Q, R, S" 743 "T, U, V, W, Y, Z" 745