PC-FX BIOS

From Archaic Pixels
Revision as of 00:41, 13 September 2010 by Gravis (Talk | contribs)

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


ROM Font

0xFFF0000C

r7 =
0 = Kanji 16x16
1 = Kanji 12x12
2 = ANK8x16
3 = ANK6x12
4 = ANK8x8
5 = ANK8x12

Filesystem Functions

Calling procedure:

 Load r10 with function number.
 Add -8 to sp.
 Store lp to 0[sp]
 Store gp to 4[sp]

 Set gp to 0.
 Load r12 with 0xFFF00008
 JAL to local code that does JMP [r12]
 (Wait for return)
 Restore lp and gp from stack.
 Add 8 to sp.
 JMP [lp] (return)

Definitions

/* DEV_CTRL & HND_CTRL NO */
#define CTRL_VEC_RD             0
#define CTRL_VEC_WT             1
#define CTRL_NAME_RD            2
#define CTRL_NAME_WT            3
#define CTRL_OPT_JOB            4
#define CTRL_IPLREAD            5
#define CTRL_IPLWRITE           6
#define CTRL_BPBGET             7
#define CTRL_BPBSET             8
#define CTRL_GETSTAT            9

/* open mode */
#define O_READ                  0x0001
#define O_WRITE                 0x0002
#define O_APPEND                0x0008  /* set append mode */
#define O_CREAT                 0x0200  /* create if nonexistant */
#define O_TRUNC                 0x0400  /* truncate to zero length */
#define O_EXCL                  0x0800  /* error if already exists */

/* error trap function */
#define IO_READ                 0
#define IO_WRITE                1
#define IO_CHECK                2
#define IO_CTRL                 3
#define IO_WCHECK               4

/* seek base */
#define SEEK_SET                0       /* TOF base */
#define SEEK_CUR                1       /* current base */
#define SEEK_END                2       /* EOF base */

/* attribute type */
#define ATR_ARC                 0x20
#define ATR_DIR                 0x10
#define ATR_VOL                 0x08
#define ATR_SYS                 0x04
#define ATR_HID                 0x02
#define ATR_RDO                 0x01

/* ipl block data offset */
#define bt_jmp                  0
#define bt_oem                  3
#define bt_secsiz               11
#define bt_clsiz                13
#define bt_nrsvsect             14
#define bt_nfat                 16
#define bt_dirents              17
#define bt_maxsect              19
#define bt_mid                  21
#define bt_fatlen               22
#define bt_nsect                24
#define bt_nheads               26
#define bt_nhs                  28
#define bt_bigsect              32
#define bt_junk                 36

/* error code */
#define BAD_PARA                -1
#define BAD_DRIVE               -10
#define PATH_OVER               -11
#define NAME_OVER               -12
#define EXT_OVER                -13
#define BAD_DEVICE              -14
#define NO_FILES                -15
#define BAD_PATH                -16
#define BAD_NAME                -17
#define MOUNTED                 -18
#define UMOUNTED                -19
#define MOUNTBUSY               -20
#define FCB_EMPTY               -21
#define HND_EMPTY               -22
#define BAD_HND                 -23
#define BAD_MODE                -24
#define SEEK_OVER               -25
#define FSYS_DIFF               -26
#define CUR_DIR                 -27
#define BAD_CMD                 -28
#define NOT_FMT                 -29
#define NO_MEM                  -30
#define IO_BUSY                 -31
#define FILE_EXIST              -32
#define BAD_FAT                 -33
#define DIR_FULL                -34
#define DISK_FULL               -35
#define BAD_EXE                 -36
#define KEEP_PR                 -37
#define WRITE_PRO               -38
#define NOT_RDY                 -39
#define SEC_NFND                -40
#define CRC_ERROR               -41
#define OVER_RUN                -42

Structures

typedef struct fsys {
        unsigned char name[16];
        int (* dev_call)();
        void *dev_type;
        long access_f;
        struct fsys *back;
        struct fsys *next;
        int path_len;
        unsigned char path[128];
} FSYS;

typedef struct filesbf {
        int fsys_flg;
        FSYS *fsysp;
        unsigned char temp[64];
        long fsize;
        long ftime;
        int atr;
        unsigned char path[128];
        unsigned char *name;
        unsigned char *upath;
        int name_max;
} FILESBF;

typedef struct dpb {
        int dev_id;                                     /* SCSI_ID or hnd */
        long rec_offset;                        /* record offset */
        int rec_sft;                            /* dos_record -> bios_rec */
        int sft_byt;                            /* bios_rec -> bytes */
        int (* dev_call)();                     /* device i/o job */
        unsigned short ej_flg;          /* eject ok(=1) ng(=0) flg */
        unsigned short secsiz;          /* Bytes per sector */
        unsigned char secsft;           /* Bytes per sector sft count */
        unsigned char clsiz;            /* Sector per Cluster */
        unsigned char clsft;            /* Sector per Cluster  sft count */
        unsigned char mid;                      /* Media descriptor */
        unsigned long fattop;           /* fat top sector */
        unsigned char nfat;                     /* Number of FAT tables */
        unsigned char fatlen;           /* Sectors in FAT */
        unsigned short fat_max;         /* fat data max 2-??? */
        unsigned long dirtop;           /* root dir top sector */
        unsigned short dircnt;          /* root dir entrys per sector */
        unsigned short dirlen;          /* root dir sectors */
        unsigned long datatop;          /* data top sector */
        long free_fat;                          /* free fat count (-1=no calc) */
        unsigned short new_fat;         /* last accsess new fat */
        unsigned short def_fat;         /* curdir fat(root=0) */
        unsigned char def_dir[64];      /* curdir dir name(root="") */
} DPB ;

typedef struct bpb {
        unsigned short secsiz;          /* Bytes per sector */
        unsigned char clsiz;            /* Cluster size */
        unsigned char nfat;                     /* Number of FAT tables */
        unsigned short nrsvsect;        /* Number of reserved sectors */
        unsigned short dirents;         /* Number of root directory entry */
        unsigned short maxsect;         /* Total sectors on disk */
        unsigned char mid;                      /* Media descriptor */
        unsigned char fatlen;           /* Sectors in FAT */
        unsigned long bigsect;          /* big total sectors (valid maxsect zero) */
        unsigned short nsect;           /* Sectors/track */
        unsigned short nheads;          /* Heads */
        unsigned long nhs;                      /* number of hidden sectors */
} BPB ;


Functions

0 int fsys_init(unsigned char *, unsigned char *, int (*error_trap)());
{{{desc}}}


1 int fsys_mount(unsigned char *, FSYS *);
{{{desc}}}


2 int fsys_ctrl(unsigned char *, int, unsigned char *, int);
{{{desc}}}


3 FSYS *fsys_getfsys(unsigned char *);
{{{desc}}}
4 int fsys_format(unsigned char *, unsigned char *);
{{{desc}}}


5 long fsys_diskfree(unsigned char *);
{{{desc}}}


6 long fsys_getblocks(unsigned char *);
{{{desc}}}


7 int fsys_open(unsigned char *, int);
{{{desc}}}


8 int fsys_read(int, unsigned char *, int);
{{{desc}}}


9 int fsys_write(int, unsigned char *, int);
{{{desc}}}


10 long fsys_seek(int, long, int );
{{{desc}}}


11 long fsys_htime(int, long);
{{{desc}}}


12 int fsys_close(int);
{{{desc}}}


13 int fsys_delete(unsigned char *);
{{{desc}}}


14 int fsys_rename(unsigned char *, unsigned char *);
{{{desc}}}


15 int fsys_mkdir(unsigned char *);
{{{desc}}}


16 int fsys_rmdir(unsigned char *);
{{{desc}}}


17 int fsys_chdir(unsigned char *);
{{{desc}}}


18 int fsys_curdir(unsigned char *);
{{{desc}}}


19 int fsys_ffiles(FILESBF *, unsigned char *);
{{{desc}}}


20 int fsys_nfiles(FILESBF *);
{{{desc}}}


21 int fsys_efiles(FILESBF *);
{{{desc}}}


22 unsigned long fsys_datetime(unsigned long);
{{{desc}}}


23 int fsys_m_init(unsigned char *, unsigned char *);
{{{desc}}}


24 void *fsys_malloc(int);
{{{desc}}}


25 int fsys_free(void *);
{{{desc}}}


26 int fsys_setblock(char *, int);
{{{desc}}}


Information copied and transcribed from header files by saga/HyperClub(APC-Project).