Call SWI's with the X version; ie XCD_ and trap errors in V flag (bit 0) as not all drives support SWI's. Last updated 29th May 2002. V flag is set if error occurs. -=- CD_Version (&41240) On exit: R0 = pointer to version byte and string of CDFS module -=- CD_DriveStatus (&41243) On entry: R7 = pointer to CDFS control block On exit: R0 = 1 (CD in drive), 2 (Busy), 4 (Drive empty or not ready) or 8 (Unavailable) -=- CD_AudioStatus () On entry: R7 = pointer to CDFS control block On exit: R0 AND &F = 0 (Playing track), 1 (Paused playing), 3 or 5 (Stopped), 4 (Error) -=- CD_AudioPause () On entry: R0 = 0 (Unpause) or 1 (Pause) R7 = pointer to CDFS control block -=- CD_PlayTrack () On entry: R0 = track number R1 = &FF R7 = pointer to CDFS control block -=- CD_DriveReady (&41244) On entry: R7 = pointer to CDFS control block On exit: R0 = 0 (CD in drive) or 1 (Drive empty or not ready) -=- CD_EnquireAddress () On entry: R0 = 0 R7 = pointer to CDFS control block On exit: R0 = head address in LBA. Use CD_ConvertToMSF with R0=0 and R1=head address to return MSF -=- CD_GetParameters (&41245) On entry: R0 = pointer to 20 byte block R7 = pointer to CDFS control block On exit: Returns an error if drive not ready -=- CD_EnquireDataMode (&4124A) On entry: R7 = pointer to CDFS control block On exit: R0 = 1 (CD in drive) Returns an error if drive empty -=- CD_CheckDrive (&41250) On entry: R7 = pointer to CDFS control block On exit: R0 = 0 (CD in drive) Returns an error if drive empty. This call also resets the drive. -=- CD_DiscChanged (&41251) On entry: R7 = pointer to CDFS control block On exit: R0 = 1 (Disc has changed since the last access to it by the block at R7; ie. since your last CD_ call, or this is the first CD_ swi with this control block or 0 (Disc hasn't changed. If the drive is opened & closed, and the same disc is in it, still =0) -=- CD_DiscHasChanged (&41256) On entry: R7 = pointer to CDFS control block Resets the 'disc changed' flag, so that the next call to CD_DiscChanged will return 1. -=- CD_IsDrawerLocked (&4125C) On entry: R7 = pointer to CDFS control block On exit: R0 = 0 (Not locked) or 1 (Locked) Returns an error if not supported. -=- CD_AudioLevel (&4125F) On entry: R7 = pointer to CDFS control block On exit: R0 = 0 Returns an error if not supported. -=- CD_ConvertToMSF (&41265) On entry: R0 = 0 R1 = Head address either in Logical Block Addressing (=0) or Physical Addressing modes (=2) On exit: R1 = Head address as Minutes : Seconds : Frames Extract minutes as ((R1 AND &FF0000) >> 16) seconds as ((R1 AND &FF00) >> 8) frames as (R1 AND &FF) -=- CD_GetAudioParms (&41269) On entry: R0 = 0 R1 = pointer to 20 byte block R7 = pointer to CDFS control block On exit: R0 = 0 Block at R1 is updated with volume in bytes 1 and 5 of block pointed to by R1. Value of 255 = Full volume. Byte 1 is for Left and byte 5 is for Right volumes. Returns an error if not supported. To see if supported then call CD_Supported and check bit 15 is set. -=- CD_SetAudioParms (&4126A) On entry: R0 = 0 R1 = pointer to 20 byte block. Volume in bytes 1 and 5. Bytes 0 and 4 should be set to 0 (This is possibly driver dependent). +0 Left volume, 0-&FFFF +4 Right volume, 0-&FFFF R7 = pointer to CDFS control block On exit: R0 = 0 if successful Returns an error if not supported. The following were from one of the newsgroups, posted by Eddie Edwards:- (I'll get round to tidying up this stuff later, promise !) I put this document together based on a naughty disassembly of CDFS. It describes most of the "undocumented" stuff including CD_ReadAudio. CDFSDriver API -------------- CB format: +0 : device (0-7) +4 : card (0-3) +8 : LUN (0-7) +12: driver handle (see CD_Identify) +16: currently zero Sector numbers: Sector 0 is usually time 00:02:00 (i.e. 150 sectors in) Most calls return sector numbers, but *playlist prints "user times" which equal (time + 150). -=- CD_Inquiry R0 = 36-byte buffer R7 = CB Returns CD-ROM device information: +0 : ??? +4 : ??? +8 : device name (24 chars, spc-pad) +32: device firmware version (4 chars, spc-pad) -=- CD_DiscUsed R0 = 0 or 1 R1 = 8-byte buffer R7 = CB Returns amount of used space on disc: R0 = 0: +0 : number of readable sectors +4 : sector size (always 2048, even for audio discs) R1 = 1: +0 : number of frames \ +1 : number of seconds } includes 151 unreadable sectors +2 : number of minutes / +3 : 0 +4 : sector size (always 2048, even for audio discs) Thus, (min*60+sec)*75+frames = readable + 151 -=- CD_GetParameters R0 = 16-byte buffer R7 = CB Returns current data read parameters: +0 : log spin-down delay 0-15 (0 equiv. to 16; 1 = shortest) +4 : ??? +8 : Read mode (0,1,3 = data; 2 = audio) +12: Speed (e.g. &C = x12) -=- CD_SetParameters R0 = 16-byte buffer R7 = CB Sets data read parameters: +0 : ??? +4 : ??? +8 : Read mode (0,1,3 = data; 2 = audio) +12: Speed -=- CD_DiscHasChanged R7 = CB Forces the "disc changed" flag in the CD driver -=- CD_OpenDrawer R7 = CB Opens the CD-ROM drawer -=- CD_CloseDrawer R7 = CB Closes the CD-ROM drawer -=- CD_EjectButton R0 = 0 (enable) or 1 (disable) R7 = CB Enables or disables the manual eject button, thereby locking or unlocking the drive -=- CD_EnquireTrack R0 = 0 R1 = 2-byte buffer R7 = CB Returns the number of the first and last tracks: +0 : first track number +1 : last track number R0 = track number 1-99 R1 = 5-byte buffer R7 = CB Returns the start sector and type for a track in block pointed to by R1: +0 : start sector +4 : type (0 = audio, 1 = data) -=- CD_StopDisc R7 = CB Stops the disc (doesn't return until the disc has stopped) -=- CD_DriveReady R7 = CB R0 = 0 (ready) else non-0 Checks if the drive is ready to accept commands -=- CD_ByteCopy ??? -=- CD_EnquireDataMode R0 = Mode (0,1 or 2) R1 = Sector R7 = CB R0 = data mode Returns the data mode for a sector The type of a sector can be found by the results from R0 = 0 and R0 = 2 as follows: R0=0 R0=2 Type 0 0 Audio/XA sector - 2340 bytes can be read in mode 2, or 2352 bytes using ReadAudio 0 3 ??? Strange sector ??? 1 x CD-ROM sector - 2048 bytes can be read in mode 1 or 2 2 x CD-XA sector - 2048 (?) bytes can be read in mode 2 only 3 x CD-XA sector - 2048 (?) bytes can be read in mode 1 or 2 Error 3 PSX protected sector - 2340 bytes can be read in mode 1 or 2 Mode 2 reads add a header, depending on the sector type: Audio/XA: No header CD-ROM: 4-byte header: +0 : Minute number for sector, in BCD +1 : Second number for sector, in BCD +2 : Frame number for sector, in BCD +3 : &01 CD-XA: 12-byte header: +0 : Minute number for sector, in BCD +1 : Second number for sector, in BCD +2 : Frame number for sector, in BCD +3 : &02 +4 : 00000000 (PSX protected) 00020000 (Mode 2) 00080000 (Mode 3) +8 : as +4 -=- CD_ReadData R0 = 0 R1 = start sector R2 = number of sectors to read R3 = buffer R4 = length of buffer R7 = CB Reads data from the CD, using the current mode (see CD_SetParameters and CD_InquireDataMode) -=- CD_ReadAudio R0 = 0 R1 = start sector R2 = number of sectors to read R3 = buffer R4 = length of buffer (must be a multiple of 256) R7 = CB Reads audio data from the CD, if the data lies in an audio (CD-DA) track -=- CD_ReadUserData Causes a prefetch abort on a StrongARM ... -=- CD_DriveStatus R7 = CB R0 = status: 1 : OK 4 : drawer open or no CD-ROM in drive -=- CD_Identify R7 = CB with driver handle zero R2 = -1 (drive invalid) else driver handle Returns the driver handle for use with subsequent calls to CD_xxx -=- CD_Control R0 = 1 R7 = CB Initializes the drive -=- CD_DiscChanged R7 = CB R0 = 0 (no change) or 1 (disc has changed) Checks if disc has been changed since the last call -=- And from someone else who's name I have mislaid, sorry ! (From memory apparently !) :- CD_SeekTo On entry: R0= addressing mode R1= address R7= CDFS control block Sends the drive laser to the specified address. If it's an audio track, you can call the unpause CD_ swi and it will continue playing from there. Better than CD_PlayAudio for forward/backward searches.