Disk-ROM BIOS
This page was last modified 09:36, 8 May 2020 by Gdx.

Contents

Disk Driver table

4010H (DISKIO) (See PHYDIO in main BIOS)

Effect: Physical input/output for disk devices
Input: F = Carry set for write, carry reset for read

A = Drive number (0=A:)
B = Number of sectors to read/write
C = Media descriptor
DE = Logical sector number (starts at 0)
HL = Transfer address

Output: F = Carry set on error, carry reset on success

A = If error: errorcode
B = Number of sectors transferred (always)

Error codes can be:
        0       Write protected
        2       Not ready
        4       Data (CRC) error
        6       Seek error
        8       Record not found
        10      Write fault
        12      Bad parameter
        14      Out of memory
        16      Other error

4013H (DSKCHG)

Effect: Check if disk has been changed.
Input: A = Drive number (0=A:)

B = Media descriptor
C = Media descriptor
HL = Base address of DPB

Output: F = Carry set on error, carry reset on success

A = If error: errorcode (see DSKIO)
B = if success: 1=Disk not changed, 0=Unknown, -1=Disk changed

Note: If the disk has been changed or may have been changed (unknown) read

the boot sector or the FAT sector for a disk media descriptor and
transfer a new DPB as with GETDPB

4016H (GETDPB)

Effect: Get Drive Parameter Block
Input: A = Drive number

B = First byte of FAT (media descriptor)
C = Media descriptor
HL = Base address of DPB

Output: HL+1 ... HL+18 = DPB for specified drive
Note: DPB consists of
Name   Offset Size Description
----------------------------------------------------------------------------
MEDIA    0     1   Media type (F8..FF)
SECSIZ   1     2   Sector size (must be 2^n)
DIRMSK   3     1   (SECSIZE/32)-1
DIRSHFT  4     1   Number of one bits in DIRMSK
CLUSMSK  5     1   (Sectors per cluster)-1
CLUSSHFT 6     1   (Number of one bits in CLUSMSK)+1
FIRFAT   7     2   Logical sector number of first FAT
FATCNT   8     1   Number of FATs
MAXENT   A     1   Number of directory entries (max 254)
FIRREC   B     2   Logical sector number of first data
MAXCLUS  D     2   (Number of clusters (not including reserved, FAT and
                   directory sectors))+1
FATSIZ   F     1   Number of sectors used
FIRDIR   10    2   FAT logical sector number of start of directory

4019H (CHOICE)

Effect: Get string that describes disk formatting options.
Input: None
Output: HL = Address of zero terminated character string (ASCIIZ) with

the text with choices for a DSKFMT
If there is no choice (only 1 format supported) return HL = 0

401CH (DSKFMT)

Effect: Format disk
Input: A = Choice specified by user (1-9). See CHOICE

D = Drive number (0=A:)
HL = Begin address of work area
BC = Length of work area

Output: F = Carry flag reset on success, carry flag set on error (see DISKIO for error codes)
Notes: Also writes a MSX boot sector at sector 0, clears all FATs (media

descriptor at first byte, 0FFh at second/third byte and rest zero)
and clears the directory (filling it with zeros)

401FH (DSKSTP)

Effect: Stop all local drives
Input: None
Output: None

Kernel table

4022H

Effect: BASIC cold start. Start the Basic environment and eventually run a file of Basic program from a program in machine language.

Set the variable REBOOT (0F340h) to 0 to run the AUTOEXEC.BAS file (at the root of the disk). Otherwise, there will be a return to Basic. Under MSX-DOS, when the REBOOT variable (0F340h) contains a value other than 0 it is possible to run another Basic program whose file name and length is specified in DTA (0080h).

Input: None
Output: None (Does not return)
Examples: 1/
; Quit your DOS program and launch a BASIC program saved as NAME.BAS

CALSLT	equ	001Ch
DTA	equ	0080h
STBAS	equ	04022h
REBOOT	equ	0F340h
DRVINF	equ	0FB21h

	org	0100h

	ld	a,1	; Not 0 to ignore the AUTOEXEC.BAS if present
	ld	(REBOOT),a

	ld	hl,NAME
	ld	de,DTA
	ld	bc,END-NAME
	ldir		; Copy the file name

	ld	ix,STBAS
	ld	iy,(DRVINF)	; Slot of the Master Disk-ROM
	jp	CALSLT
NAME:
	db	END-NAME	; Length
	db	"NAME.BAS",0
END:

2/

; Quit your DOS program and go to BASIC

CALSLT	equ	001Ch
DTA	equ	0080h
STBAS	equ	04022h
REBOOT	equ	0F340h
TEMPST	equ	0F67Ah
DRVINF	equ	0FB21h

	org	0100h

	ld	a,1	; Not 0 to ignore the AUTOEXEC.BAS if present
	ld	(REBOOT),a

	ld	a,0
	ld	(DTA),a	; No file name

	ld	ix,(TEMPST)	; Erases 3 bytes
	ld	(ix),0	; from the
	ld	(ix+1),0	; area reserved for
	ld	(ix+2),0	; the BASIC program

	ld	ix,STBAS
	ld	iy,(DRVINF)	; Slot of the Master Disk-ROM
	jp	CALSLT

3/

; Quit your DOS program and launch the AUTOEXEC.BAS under BASIC

CALSLT	equ	001Ch
STBAS	equ	04022h
REBOOT	equ	0F340h
TEMPST	equ	0F67Ah
DRVINF	equ	0FB21h

	org	0100h

	ld	a,0	; 0 to run the AUTOEXEC.BAS file
	ld	(REBOOT),a

	ld	ix,(TEMPST)	; Erases 3 bytes
	ld	(ix),0	; from the
	ld	(ix+1),0	; area reserved for
	ld	(ix+2),0	; the BASIC program

	ld	ix,STBAS
	ld	iy,(DRVINF)	; Slot of the Master Disk-ROM
	jp	CALSLT

4025H

Effect: Format disk using custom buffer
Input: HL = Start of buffer

BC = Size of buffer

Output: None
Note: This is interactive process with user

4029H

Effect: Stop all drives on all controllers
Input: None
Output: None
Note: Bad idea: This will stop floppy drive motors and power off HDD

motors. (Do not start again automatically) Devices like CD-ROM
and Zip-drives usually handle stop commands as eject requests.

402DH (GETSLT)

Effect: Get slot ID of disk ROM
Input: None
Output: A = Slot ID

4030H

Effect: Get MSX-DOS system bottom
Input: None
Output: HL = Lowest address used by the base MSX-DOS system