HomeXBIOSInterrupt functionsOverScan XBIOS extension

4.13 Drive functions

DMAread Reads sectors from hard drive.
DMAwrite Writes sectors to hard drive.
Flopfmt Formats track on floppy disk.
Floprate Sets seekrate and timeout of floppy drive.
Floprd Reads individual sectors from floppy disk.
Flopver Verifies sectors of a floppy disk.
Flopwr Writes sectors on floppy disk.
Metaclose Releases a MetaDOS device.
Metadiscinfo Obtains current status information.
Metagettoc Returns the table of contents of a device.
Metainit Obtains information about MetaDOS version.
Metaioctl Sends GEMDOS opcodes to a MetaDOS device.
Metaopen Initializes a MetaDOS device.
Metaread Reads data from a MetaDOS device.
Metasetsongtime Starts audio playback of a timed portion of a track.
Metastartaudio Starts audio playback of one or more songs.
Metastatus Obtains the status of a MetaDOS device.
Metastopaudio Stops audio playback.
Metawrite Writes data to a MetaDOS device.
Protobt Generates a boot-sector for a diskette.

See also: GEMDOS file functions   GEMDOS directory functions

4.13.1 DMAread

Name: »DMA read« - Read individual sectors from a DMA device.
Opcode: 42
Syntax: int16_t DMAread( int32_t sector, int16_t count, void *buffer, int16_t devno );
Description: The XBIOS routine DMAread reads single or multiple sectors from an ACSI or SCSI device. The following apply:
Parameter Meaning
   
sector First sector number to read
count Number of sectors to read
buffer Start address in memory where data stored
devno Device number. This can be:
0..7: ACSI device
8..15: SCSI device

All other values are reserved for future extensions.


Note: In many cases it is more sensible to use Rwabs in place of this function. The specified memory block must be capable of being written to for the hardware used (catchword: Fast-RAM buffer). On the TT030, SCSI devices are handled by this function not via DMA but via handshaking to transfer individual bytes, so alternative RAM may be used. But the Falcon uses DMA for SCSI transfers, so cannot use alternative RAM for this.
Return value: The function returns 0 if the operation was successful and no error occurred, else a negative error-code.
Availability: This function is only available from TOS 3.* (Atari TT030). onwards.
Group: Drive functions
See also: Binding   DMAwrite   Floprd   Flopwr   Rwabs

4.13.1.1 Bindings for DMAread

C: #include

int16_t DMAread( int32_t sector, int16_t count, void *buffer, int16_t devno );
Assembler:
move.w    devno,-(sp)  ; Offset 12
pea       buffer       ; Offset  8
move.w    count,-(sp)  ; Offset  6
move.l    sector,-(sp) ; Offset  2
move.w    #42,-(sp)    ; Offset  0
trap      #14          ; Call XBIOS
lea       $E(sp),sp    ; Correct stack

4.13.2 DMAwrite

Name: »DMA write« - Write individual sectors to a DMA device.
Opcode: 43
Syntax: int16_t DMAwrite( int32_t sector, int16_t count, void *buffer, int16_t devno );
Description: The XBIOS routine DMAwrite writes single or multiple sectors to an ACSI or SCSI device. The following apply:
Parameter Meaning
   
sector First sector number to read
count Number of sectors to read
buffer Start address in memory where data stored
devno Device number. This can be:
0..7: ACSI device
8..15: SCSI device

All other values are reserved for future extensions.


Note: In many cases it is more sensible to use Rwabs in place of this function. The specified memory block must be capable of being read from for the hardware used (catchword: Fast-RAM buffer). SCSI devices are operated by this function not via DMA but via handshaking.
Return value: The function returns 0 if the operation was successful and no error occurred, else a negative error-code.
Availability: This function is only available from TOS 3.* (Atari TT030). onwards.
Group: Drive functions
See also: Binding   DMAread   Floprd   Flopwr   Rwabs

4.13.2.1 Bindings for DMAwrite

C: #include

int16_t DMAwrite( int32_t sector, int16_t count, void *buffer, int16_t devno );
Assembler:
move.w    devno,-(sp)  ; Offset 12
pea       buffer       ; Offset  8
move.w    count,-(sp)  ; Offset  6
move.l    sector,-(sp) ; Offset  2
move.w    #43,-(sp)    ; Offset  0
trap      #14          ; Call XBIOS
lea       $E(sp),sp    ; Correct stack

4.13.3 Flopfmt

Name: »Floppy format« - Format specific tracks on a floppy
Opcode: 10
Syntax: int16_t Flopfmt( void *buf, int32_t filler, int16_t devno, int16_t spt, int16_t trackno, int16_t sideno, int16_t interlv, int32_t magic, int16_t virgin );
Description: The XBIOS routine Flopfmt formats one or more tracks on a floppy disk. The following apply:
Parameter Meaning
buf Pointer to a segment of memory where the data for one track may be stored
filler For all TOS versions < 1.02 unused, and to be set to 0. From Blitter-TOS onwards: If interlv = -1, then filler is to be treated as a pointer to a table of sector numbers (16 bit words). This makes it possible to choose the order of the sectors on the track freely.
devno 0 = Drive A:, 1 = Drive B:
spt Sectors per track (normal: 9). If the cookie _FDC is set, then in addition values of 18 (High Density) or 36 (Extra High Density) sectors are permitted. Switching between the various write modes takes place at 13 (HD) or 26 (ED).
trackno Number of the track (0..79)
sideno 0: Side 1
1: Side 2 (for double-sided disks)
interlv Determines how many physical sectors lie between two logical sectors in each case (normal: 1).
magic Must be 0x87654321, otherwise no formatting will be performed.
virgin Bit-pattern that is written during formatting into each sector (normal: 0xe5e5). The upper four bits may not be set, as otherwise this would be interpreted by the controller as a command.


Note: As of the Blitter-TOS, the desktop allows a list of sector numbers to be passed to arrange tracks in a spiral format in such a way that the least possible time is lost at track changes waiting for the next sector.

For a normal format (9 sectors per track) the memory segment specified with the parameter buf must have a size of at least 8 kbyte; in other cases the buffer may have to be increased above this.
Return value: The function returns 0 when no error has occurred in formatting the track. Otherwise a NULL-terminated list of the faulty sectors will be written as a int16_t array into the buffer buf.
Availability: All TOS versions.
Group: Drive functions
See also: Binding   Flopwr

4.13.3.1 Bindings for Flopfmt

C: #include

int16_t Flopfmt( void *buf, int32_t filler, int16_t devno, int16_t spt, int16_t trackno, int16_t sideno, int16_t interlv, int32_t magic, int16_t virgin );
Assembler:
move.w    virgin,-(sp)  ; Offset 24
move.l    magic,-(sp)   ; Offset 20
move.w    interlv,-(sp) ; Offset 18
move.w    sideno,-(sp)  ; Offset 16
move.w    trackno,-(sp) ; Offset 14
move.w    spt,-(sp)     ; Offset 12
move.w    devno,-(sp)   ; Offset 10
move.l    filler,-(sp)  ; Offset  6
pea       buf           ; Offset  2
move.w    #10,-(sp)     ; Offset  0
trap      #14           ; Call XBIOS
lea       $1A(sp),sp    ; Correct stack
GFA-Basic Fehler%=Xbios(10,L:buf%,L:filler%,W:devno%,W:spt%,W:trackno%,W:sideno%,W:interlv%,L:magic%,W:virgin%)

4.13.4 Floprate

Name: »Floppy rate« - Read or set the seek rate of a floppy drive.
Opcode: 41
Syntax: int16_t Floprate( int16_t devno, int16_t newrate );
Description: The XBIOS routine Floprate returns or sets the current seek rate. The following apply:
Parameter Meaning
devno Drive number:

0 = Drive A:
1 = Drive B: etc
newrate

-1 = Do not alter seek rate
0 = Seek rate of 6ms
1 = Seek rate of 12ms
2 = Seek rate of 2ms
3 = Seek rate of 3ms


Note: As of MagiC 3, one can additionally use Floprate (-1, newrate) to set the timeout for the floppy; a value of 300 means 1.5 seconds) this is the value that is set by default at booting).

With older ROM-TOS versions one has to use the previously undocumented system variables:

TOS-Version Drive A: Drive B:
1.00 0x0a08 0xa0c
1.02 0x0a4e 0xa52


For portable setting one can use the following sample routine.
Return value: The function returns the prior seek rate for the drive.
Availability: The function is only available as of TOS 1.04.
Group: Drive functions
See also: Binding   Flopwr   Floprd   Flopver   Flopfmt

4.13.4.1 Bindings for Floprate

C: #include

int16_t Floprate( int16_t devno, int16_t newrate );
Assembler:
move.w    newrate,-(sp) ; Offset 4
move.w    devno,-(sp)   ; Offset 2
move.w    #41,-(sp)     ; Offset 0
trap      #14           ; Call XBIOS
addq.l    #6,sp         ; Correct stack

4.13.4.2 Seekrate for all TOS versions

/* Portable setting of the floppy seek rate for all TOS versions
   (except RAM-TOS 1.00).
   Parameters: As for the XBIOS function "Floprate" */

int16_t SeekRate ( int16_t devno, int16_t newrate )
{
  int32_t stack;
  int16_t version;
  OSHEADER *sys;

  /* Get pointer to OS-header */
  stack = Super (0L);
  sys = *((OSHEADER **) 0x4f2);
  version = sys->os_version;
  Super ((void *)stack);

  /* With newer TOS simply call "Floprate"  */
  if ( version >= 0x0104 )
    return Floprate ( devno, newrate );
  else
  {
    /* otherwise calculate pointer to internal GEMDOS variables */
    int16_t *sk, merk;

    if ( version == 0x0102 )
      sk = (int16_t *) 0x0a4e;
    else
      sk = (int16_t *) 0x0a08;

    /* Drive B: 2 int16_t follows */
    if ( devno ) sk = &(sk[2]);

    merk = *sk;
    /* enter value only if not -1 */
    if ( newrate != -1 ) *sk = newrate;

    /* always return old value */
    return merk;
  }
}

4.13.5 Floprd

Name: »Floppy read« - Read individual sectors from floppy disk.
Opcode: 8
Syntax: int16_t Floprd( void *buf, int32_t filler, int16_t devno, int16_t sectno, int16_t trackno, int16_t sideno, int16_t count );
Description: The XBIOS routine Floprd reads one or more physical sectors from a floppy disk. The following apply:
Parameter Meaning
   
buf Pointer to memory block to be used as a buffer for the read-in sectors
filler Unused
devno Drive (0 = Drive A: etc.)
sectno Start sector (normally between 1 and 9)
trackno Track number (normally between 0 and 79)
sideno Side of the floppy disk (0 or 1)
count Number of sectors to be read
Return value: The function returns 0 if the operation was successful or a non-zero error-code if not.
Availability: All TOS versions.
Group: Drive functions
See also: Binding   DMAread   DMAwrite   Flopwr   Rwabs

4.13.5.1 Bindings for Floprd

C: #include

int16_t Floprd( void *buf, int32_t filler, int16_t devno, int16_t sectno, int16_t trackno, int16_t sideno, int16_t count );
Assembler:
move.w    count,-(sp)   ; Offset 18
move.w    sideno,-(sp)  ; Offset 16
move.w    trackno,-(sp) ; Offset 14
move.w    sectno,-(sp)  ; Offset 12
move.w    devno,-(sp)   ; Offset 10
move.l    filler,-(sp)  ; Offset  6
pea       buf           ; Offset  2
move.w    #8,-(sp)      ; Offset  0
trap      #14           ; Call XBIOS
lea       $14(sp),sp    ; Correct stack
GFA-Basic Fehler%=Xbios(8,L:buf%,L:filler%,W:devno%,W:sectno%,W:trackno%,W:sideno%,W:count%)

4.13.6 Flopver

Name: »Floppy verify« - Verify sectors of a floppy disk.
Opcode: 19
Syntax: int16_t Flopver( void *buf, int32_t filler, int16_t devno, int16_ sectno, int16_t trackno, int16_t sideno, int16_t count );
Description: The XBIOS routine Flopver verifies that a series of sectors can be read without error from a floppy disk drive. The following apply:
Parameter Meaning
   
buf Pointer to a 1024 byte block of memory into which the sectors to be verified can be read
filler Unused (should be set to 0)
devno Drive:
0 = Drive A:
1 = Drive B:
sectno Start sector (normally between 1 and 9)
trackno Track nummer (normally between 0 and 79)
sideno Side of the floppy disk (0 or 1)
count Number of sectors to be verified


Note: After the call one finds in the parameter buf a NULL-terminated list of 16-bit words containing the numbers of the defective sectors. So the function does not compare sectors with a block of memory; instead it always reads the sectors into the same buffer. This only verifies that the sectors can be read correctly, or if read errors occur during reading.
Return value: The function returns the value 0 if the list stored in the parameter buf is valid, or a non-zero value otherwise.
Availability: All TOS versions.
Group: Drive functions
See also: Binding

4.13.6.1 Bindings for Flopver

C: #include

int16_t Flopver( void *buf, int32_t filler, int16_t devno, int16_ sectno, int16_t trackno, int16_t sideno, int16_t count );
Assembler:
move.w    count,-(sp)    ; Offset 18
move.w    sideno,-(sp)   ; Offset 16
move.w    trackno,-(sp)  ; Offset 14
move.w    sectno,-(sp)   ; Offset 12
move.w    devno,-(sp)    ; Offset 10
move.l    filler,-(sp)   ; Offset  6
pea       buf            ; Offset  2
move.w    #19,-(sp)      ; Offset  0
trap      #14            ; Call XBIOS
lea       $14(sp),sp     ; Correct stack
GFA-Basic Fehler%=Xbios(19,L:buf%,L:filler%,W:devno%,W:sectno,W:trackno%,W:sideno%,W:count%)

4.13.7 Flopwr

Name: »Floppy write« - Write individual sectors on a floppy disk.
Opcode: 9
Syntax: int16_t Flopwr( VOID *buf, int32_t filler, int16_t devno, int16_t sectno, int16_t trackno, int16_t sideno, int16_t count );
Description: The XBIOS routine Flopwr writes one or more physical sectors to a floppy disk. The following apply:
Parameter Meaning
   
buf Pointer to memory block to be used as a buffer for the sectors to be written
filler Unused
devno Drive (0 = Drive A: etc.)
sectno Start sector (normally between 1 and 9)
trackno Track number (normally between 0 and 79)
sideno Side of the floppy disk (0 or 1)
count Number of sectors to be written
Return value: The function returns 0 if the operation was successful or a non-zero error-code if not.
Availability: All TOS versions.
Group: Drive functions
See also: Binding   DMAread   DMAwrite   Floprd

4.13.7.1 Bindings for Flopwr

C: #include

int16_t Flopwr( VOID *buf, int32_t filler, int16_t devno, int16_t sectno, int16_t trackno, int16_t sideno, int16_t count );
Assembler:
move.w    count,-(sp)    ; Offset 18
move.w    sideno,-(sp)   ; Offset 16
move.w    trackno,-(sp)  ; Offset 14
move.w    sectno,-(sp)   ; Offset 12
move.w    devno,-(sp)    ; Offset 10
move.l    filler,-(sp)   ; Offset  6
pea       buf            ; Offset  2
move.w    #9,-(sp)       ; Offset  0
trap      #14            ; Call XBIOS
lea       $14(sp),sp     ; Correct stack
GFA-Basic Fehler%=Xbios(9,L:buf%,L:filler%,W:devno%,W:sectno%,W:trackno%,W:sideno,W:count%)

4.13.8 Metaclose

Name: »Metaclose« - Release a MetaDOS device again.
Opcode: 50
Syntax: int32_t Metaclose( int16_t drive );
Description: The function releases the drive drive again.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metaopen

4.13.8.1 Bindings for Metaclose

C: int32_t Metaclose( int16_t drive );
Assembler:
move.w    drive,-(sp)  ; Offset 2
move.w    #50,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #4,sp        ; Correct stack

4.13.9 Metadiscinfo

Name: »Metadiscinfo« - Obtain current status information.
Opcode: 63
Syntax: int32_t Metadiscinfo( int16_t drive, CD_DISC_INFO *p );
Description: The function obtains information about the status of a MetaDOS device. The following applies:

Parameter Meaning
drive Desired drive
p Address of the receiving buffer


Note: The position data within the structure are coded in BCD MSF format. The element index is not set by old BOS drivers, and the element disctype is not set by SCSI CD-ROMs.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metastatus

4.13.9.1 Bindings for Metadiscinfo

C: int32_t Metadiscinfo( int16_t drive, CD_DISC_INFO *p );
Assembler:
pea       p            ; Offset 4
move.w    drive,-(sp)  ; Offset 2
move.w    #63,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #8,sp        ; Correct stack

4.13.10 Metagettoc

Name: »Metagettoc« - Return the table of contents of a device.
Opcode: 62
Syntax: int32_t Metagettoc( int16_t drive, int16_t flag, CD_TOC_ENTRY *buffer );
Description: The function returns the table of contents of a drive. The following applies:

Parameter Meaning
drive Desired drive
flag Reserved for CDAR504
buffer Buffer for receiving the table of contents


Note: The receiving buffer should have room for 128 entries. Each entry consists of a track number and an MSF address (both in BCD format). For the track number the following applies:
0 = Record has no meaning
0x01...0x99 = Track number in BCD coding
0xa0 = First track with programmed order 0xa2 = End of the CD.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metaread   Metawrite

4.13.10.1 Bindings for Metagettoc

C: int32_t Metagettoc( int16_t drive, int16_t flag, CD_TOC_ENTRY *buffer );
Assembler:
pea       buffer       ; Offset 6
move.w    flag,-(sp)   ; Offset 4
move.w    drive,-(sp)  ; Offset 2
move.w    #62,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
lea       $A(sp),sp    ; Correct stack

4.13.11 Metainit

Name: »Metainit« - Obtain information about the installed MetaDOS version.
Opcode: 48
Syntax: void Metainit( META_INFO_1 *buffer );
Description: The XBIOS routine Metainit obtains information about the currently installed version of MetaDOS, and the devices known to it.

The following procedure is suggested:
  • Clear the contents of META_INFO_1 structure
  • Call the function Metainit
  • Test whether the element version still holds a NULL-pointer (then MetaDOS is not installed.
Return value: The function returns no direct result.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding

4.13.11.1 Bindings for Metainit

C: void Metainit( META_INFO_1 *buffer );
Assembler:
pea       buffer       ; Offset 2
move.w    #48,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #6,sp        ; Correct stack

4.13.12 Metaioctl

Name: »Metaioctl« - Send GEMDOS opcodes to a MetaDOS device.
Opcode: 55
Syntax: int32_t Metaioctl( int16_t drive, int32_t magic, int16_t opcode, void *buffer );
Description: The function permits opcodes of the GEMDOS routines Dcntl or Fcntl to be sent to a MetaDOS device. The following apply:

Parameter Meaning
drive Desired drive
magic Must have the value 'FCTL'
opcode Opcode to be sent
buffer Depends on opcode


Note: The list of CD-ROM commands is an itemization of all known opcodes that may occur when working with CD-ROMs.
Return value: The function returns the following values in case of error:
EINVFN: The specified opcode is not supported.
EUNCMD: The function itself (!) is not supported.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Dcntl   Fcntl

4.13.12.1 Bindings for Metaioctl

C: int32_t Metaioctl( int16_t drive, int32_t magic, int16_t opcode, void *buffer );
Assembler:
pea       buffer       ; Offset 10
move.w    opcode,-(sp) ; Offset  8
move.l    magic,-(sp)  ; Offset  4
move.w    drive,-(sp)  ; Offset  2
move.w    #55,-(sp)    ; Offset  0
trap      #14          ; Call XBIOS
lea       $E(sp),sp    ; Correct stack

4.13.13 Metaopen

Name: »Metaopen« - Initialize a MetaDOS device.
Opcode: 49
Syntax: int32_t Metaopen( int16_t drive, META_DRVINFO *buffer );
Description: The function initializes a MetaDOS device. The following applies:
Parameter Meaning
   
drive Desired drive
buffer Pointer for receiving the name of the driver


Note: If the driver name starts with 'CD', one may assume that this is a CD-ROM driver.
Return value: The function returns the value 0 if all was OK, or a negative error number.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metaclose

4.13.13.1 Bindings for Metaopen

C: int32_t Metaopen( int16_t drive, META_DRVINFO *buffer );
Assembler:
pea       buffer       ; Offset 4
move.w    drive,-(sp)  ; Offset 2
move.w    #49,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #8,sp        ; Correct stack

4.13.14 Metaread

Name: »Metaread« - Read data from a MetaDOS device.
Opcode: 51
Syntax: int32_t Metaread( int16_t drive, void *buffer, int32_t blockno, int16_t count );
Description: The function reads data from a MetaDOS device. The following apply:
Parameter Meaning
   
drive Desired drive
buffer Buffer for receiving the data
blockno Number of the start block
count Number of blocks to be read


Note: The block size for CD-ROMs is 2048 bytes; but unfortunately this can not be obtained in each case. Due to a limitation in Atari's BOS drivers, a maximum of 63 blocks can be read at a time.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metawrite

4.13.14.1 Bindings for Metaread

C: int32_t Metaread( int16_t drive, void *buffer, int32_t blockno, int16_t count );
Assembler:
move.w    count,-(sp)   ; Offset 10
move.l    blockno,-(sp) ; Offset  8
pea       buffer        ; Offset  4
move.w    drive,-(sp)   ; Offset  2
move.w    #51,-(sp)     ; Offset  0
trap      #14           ; Call XBIOS
lea       $E(sp),sp     ; Correct stack

4.13.15 Metasetsongtime

Name: »Metasetsongtime« - Start audio playback of a timed portion of the track.
Opcode: 61
Syntax: int32_t Metasetsongtime( int16_t drive, int16_t repeat, int32_t starttime, int32_t endtime );
Description: The function starts audio playback of a specified timed portion of an audio track. The following apply:
Parameter Meaning
   
drive Desired drive
repeat Repeat
0 = Without repeating
1 = With repeating
starttime BCD start time in MSF coding
endtime BCD end time in MSF coding


Note: The repeat mode appears to be supported only by CDARGEN.BOS and also only for the Atari CDAR504 drive.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metastartaudio   Metastopaudio

4.13.15.1 Bindings for Metasetsongtime

C: int32_t Metasetsongtime( int16_t drive, int16_t repeat, int32_t starttime, int32_t endtime );
Assembler:
move.l    endtime,-(sp)    ; Offset 10
move.l    starttime,-(sp)  ; Offset  6
move.w    repeat           ; Offset  4
move.w    drive            ; Offset  2
move.w    #61,-(sp)        ; Offset  0
trap      #14              ; Call XBIOS
lea       $E(sp),sp        ; Correct stack

4.13.16 Metastartaudio

Name: »Metastartaudio« - Start audio playback of one or more songs.
Opcode: 59
Syntax: int32_t Metastartaudio( int16_t drive, int16_t flag, uint8_t *bytearray);
Description: The function starts audio playback of a specified song or songs. The following apply:
Parameter Meaning
   
drive Desired drive
flag Mode
bytearray Dependent on parameter flag


Note: On SCSI devices only one mode exists (flag = 0). In that case one passes in bytearray[0] the number of songs to be played, and in bytearray[1] the number of the first song.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metasetsongtime   Metastopaudio

4.13.16.1 Bindings for Metastartaudio

C: int32_t Metastartaudio( int16_t drive, int16_t flag, uint8_t *bytearray);
Assembler:
pea       bytearray    ; Offset 6
move.w    flag,-(sp)   ; Offset 4
move.w    drive,-(sp)  ; Offset 2
move.w    #59,-(sp)    ; Offset 0
trap      #14          ; Drive functions
lea       $A(sp),sp    ; Call XBIOS

4.13.17 Metastatus

Name: »Metastatus« - Obtain the status of a MetaDOS device.
Opcode: 54
Syntax: int32_t Metastatus( int16_t drive, void *buffer );
Description: The function obtains the status of a MetaDOS device. The following apply:
Parameter Meaning
   
drive Desired drive
buffer Dependent on the implementation of the BOS driver
Return value: The function returns a 32-bit value, which is coded as follows: codiert ist:
High-Word:

0x0000 = All OK
0xffff = Error has arisen
Low-Word :

Bit-15 (Error)
Bit-07 (Timeout)
Bit-02 (Media change)
Bit-01 (Busy)


All other bits of the low word are reserved at present.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metadiscinfo

4.13.17.1 Bindings for Metastatus

C: int32_t Metastatus( int16_t drive, void *buffer );
Assembler:
pea       buffer       ; Offset 4
move.w    drive,-(sp)  ; Offset 2
move.w    #54,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #8,sp        ; Correct stack

4.13.18 Metastopaudio

Name: »Metastopaudio« - Stop audio playback.
Opcode: 60
Syntax: int32_t Metastopaudio( int16_t drive );
Description: The function stops audio playback for the drive drive.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metastartaudio   Metasetsongtime

4.13.18.1 Bindings for Metastopaudio

C: int32_t Metastopaudio( int16_t drive );
Assembler:
move.w    drive,-(sp)  ; Offset 2
move.w    #60,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #4,sp        ; Correct stack

4.13.19 Metawrite

Name: »Metawrite« - Write data to a MetaDOS device.
Opcode: 52
Syntax: int32_t Metawrite( int16_t drive, void *buffer, int32_t blockno, int16_t count );
Description: The function writes data to a MetaDOS device. The following apply:
Parameter Meaning
   
drive Desired drive
buffer Address of the data buffer
blockno Number of the start block
count Number of blocks to be written


Note: With a CD-ROM this function naturally has no effect.
Return value: The function returns a value of the type int32_t.
Availability: This function is only available when MetaDOS has been installed.
Group: Drive functions
See also: Binding   Metaread

4.13.19.1 Bindings for Metawrite

C: int32_t Metawrite( int16_t drive, void *buffer, int32_t blockno, int16_t count );
Assembler:
move.w    count,-(sp)   ; Offset 10
move.l    blockno,-(sp) ; Offset  8
pea       buffer        ; Offset  4
move.w    drive,-(sp)   ; Offset  2
move.w    #52,-(sp)     ; Offset  0
trap      #14           ; Call XBIOS
lea       $E(sp),sp     ; Correct stack

4.13.20 Protobt

Name: »prototype boot sector« - Generate a standard boot-sector for a floppy disk.
Opcode: 18
Syntax: void Protobt( void *buf, int32_t serialno, int16_t disktype, int16_t execflag );
Description: The XBIOS routine Protobt creates a boot-sector for a floppy disk. The argument buf points to a 512 byte sized buffer holding the contents of the boot-sector. The parameter serialno serves to store a serial number in the boot-sector; if the variable serialno is greater than 0x01000000, then a random number will be stored instead. With disktype one of the following floppy disk types will be selected:
disktype Meaning
   
  -1 Don't change disk type
   0 40 tracks, single-sided (180 kbyte)
   1 40 tracks, double-sided (360 kbyte)
   2 80 tracks, single-sided (360 kbyte)
   3 80 tracks, double-sided (720 kbyte)
   4 High Density (1,44 Mbyte)
is only supported if the cookie _FDC holds the value for HD support.
   5 Extra High Density (2,88 Mbyte)
is only supported if the cookie _FDC holds the value for ED support.


Finally, the parameter execflag determines whether the information in the boot-sector can be executed as a program. The following apply:
execflag Meaning
   
-1 Do not alter boot-sector
 0 Boot-sector is not executable
 1 Boot-sector is executable


Note: So that floppy disks may be read on MS-DOS systems as well, the first 3 bytes of the boot-sector have to have the values 0xE9, 0x00 and 0x4E or 0xEB, 0x34 and 0x90 entered; however, floppy disks of this kind are then no longer bootable under TOS.
Return value: The function does not return a result.
Availability: All TOS versions.
Group: Drive functions
See also: Binding   Flopfmt

4.13.20.1 Bindings for Protobt

C: #include

void Protobt( void *buf, int32_t serialno, int16_t disktype, int16_t execflag );
Assembler:
move.w    execflag,-(sp)  ; Offset 12
move.w    disktype,-(sp)  ; Offset 10
move.l    serialno,-(sp)  ; Offset  6
pea       buf             ; Offset  2
move.w    #18,-(sp)       ; Offset  0
trap      #14             ; Call XBIOS
lea       $E(sp),sp       ; Correct stack
GFA-Basic Fehler%=Xbios(18,L:buf%,L:serialno%,W:disktype%,W:execflag%)

HomeXBIOSInterrupt functionsOverScan XBIOS extension