CDROM Functions

From Archaic Pixels
Jump to: navigation, search

CDROM Functions


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


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.


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


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


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)


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')


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


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


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


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)


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.


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.


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.