Normally, if a hardware (or similar) error is encountered CP/M will print a message describing the error and then quit to the command prompt. In CP/M 3, BDOS function 45 can be used to modify this behaviour, so that error codes are returned to the program instead.
The codes returned are in the H register:
0 - Software error (eg file not found) 1 - Select error (cannot access drive) 2 - Disc is read-only 3 - File is read-only 4 - Invalid drive 5 - File already open 6 - FCB checksum error (MP/M II) - the calling program has tampered with the FCB. 7 - Password error 8 - File already exists 9 - Filename contains ? 10 - Wheel protection error (ZPM3) / Too many files open (MP/M II) 11 - No room in system lock list (MP/M II) 12 - Not logged on to server (CP/Net)