CDROM Functions

From Archaic Pixels
Revision as of 01:37, 8 May 2020 by Arkhan (Talk | contribs) (cd_fade)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CDROM Functions

cd_reset

void cd_reset(void); [ 3.01+ ]
    Reset the CDROM drive, and stop motor


cd_pause

void cd_pause(void); [ 3.01+ ]
    Pause the CDROM drive during play of an audio track.
    Probably most useful if the player pauses the game in the middle of
    a level which is synchronized to music.


cd_unpause

void cd_unpause(void); [ 3.02+ ]
    Continue the CDROM audio audio track after pause.


cd_status

char cd_status(int mode); [ 3.20+ ]
    Checks status of CDROM device.
    Valid Mode   Meaning           Return value & meaning
    ----------   -------           ----------------------
       0         Drive Busy Check   0     = Drive Not Busy
                                    other = Drive Busy
       other     Drive Ready Check  0     = Drive Ready
                                    other = Sub Error Code

cd_playtrk

char cd_playtrk(int start, int end, int mode); [ 3.01+ ]
    Play one or more CDROM audio tracks in a few different modes.
    This will not play 'end' track, so 'end' >= 'start'+1.  If you wish to
    play until end of disc (or if 'start' track is final track), then set
    'end' to value 'CDPLAY_ENDOFDISC'.
    Attempts to play data tracks will not play, and will return non-zero
    error code.
     Valid modes          Meaning
     -----------          -------
     CDPLAY_MUTE        Plays audio without sound (muted)
     CDPLAY_REPEAT      Plays audio, repeating when track(s) complete
     CDPLAY_NORMAL      Plays audio only until completion of track(s)

cd_playmsf

void cd_playmsf(int strt_m, int strt_s, int strt_f, int end_m, int end_s, int end_f, int mode); [ 3.02+ ]
    Play CDROM audio in a few different modes, as above.
    M/S/F = minute/second/frame indexing technique.
    (Note: there are 75 frames per second)
    (See cd_plytrk() for valid values of 'mode')


cd_getver

int cd_getver(void); [ 3.01+ ]
    Returns CDROM system card version number in BCD.
    (ie. Japanese Super System card = 0x0300, American Duo = 0x301)


cd_numtrk

char cd_numtrk(void); [ 3.02+ ]
    Returns number of tracks on CD.

cd_trktype

char cd_trktype(int track); [ 3.02+ ]
    Returns type of track indicated.
    Valid values are:
     - CDTRK_AUDIO
     - CDTRK_DATA

cd_trkinfo

int cd_trkinfo(int track, char * min, char * sec, char * frame); [ 3.10+ ]
    Given track number:
    - Returns type of track indicated (see cd_trktype() ).
    - Fills min/sec/frame values (char size, but must be sent as addresses)
      with the starting point for the track
    - If track == 0, track type is undefined but min/sec/frame is the
      end of the final track (ie. end of disc)


cd_loaddata

char cd_loaddata(int ovl_idx, int sector_offset, farptr destaddr, int bytes); [ 3.10+ ]
    Read data from CDROM into area (or overlay 'const' or other data)
    specified by 'destaddr', for a length of 'bytes'.
    Read it from the overlay segment specified by 'ovl_idx', with sector
    offset (ie. multiples of 2048 bytes) of 'sector_offset'.
    Non-zero return values indicate errors.

cd_loadvram

char cd_loadvram(int ovl_idx, int sector_offset, int vramaddr, int bytes); [ 3.10+ ]
    Read data from CDROM directly into video RAM at address specified
    by 'destaddr', for a length of 'bytes'.  Note that 2 bytes are required
    to fill one VRAM word.
    Read it from the overlay segment specified by 'ovl_idx', with sector
    offset (ie. multiples of 2048 bytes) of 'sector_offset'.
    Non-zero return values indicate errors.

cd_execoverlay

char cd_execoverlay(int ovl_idx); [ 3.10+ ]
    Load program overlay specified by 'ovl_idx', and execute it.
    If an error occurs during loading, the previous context (ie. the overlay
    running until that moment) is reloaded and an error value is returned
    to the program.

cd_fade

char cd_fade(char type); [ 3.10+ ]
    Fades CD-ROM or ADPCM audio out and remains muted until cancelled.  
    No return value.
    Type           Byte value    Meaning           
    ----------     ----------    ---------          
    CDFADE_CANCEL    0x00        Cancels fade
    CDFADE_PCM6      0x08        6.0 second fade of CD audio
    CDFADE_ADPCM6    0x0A        6.0 second fade of ADPCM
    CDFADE_PCM2      0x0C        2.5 second fade of CD audio
    CDFADE_ADPCM2    0x0E        2.5 second fade of ADPCM