On board Flash/RAM disk BIOS function calls
41
/*************************************************/
/* Function Calls of Flash/RAM disk */
/*************************************************/
int check_funcall()
/* Check existence of Flash/RAM disk function call entry */
{
unsigned far *Int83_Ptr=0x0000020c; /* Points to INT 83H vector */
unsigned far *idptr;
idptr=MK_FP(*(Int83_Ptr),0);
/* Get Function call Parameter */
if (*(idptr)!=0x5678)
/* Check Function call ID code */
return(-1);
/* Function call entry not existed */
else
return(1);
/* Function call entry available */
}
read_devsec(int device_no,int sector_no,int sectors,char *buffer_ptr)
/* Directly read sectors from Flash/RAM disk function call entry
where
Entry int device_no :device No. (0.....)
int sector_no :start sector No. (0....)
int sectors :sectors be read (1....)
int buffer_ptr :data buffer pointer
Exit Datas in buffer_ptr */
{
union REGS xr;
struct SREGS sr;
xr.h.ah=2;
/* Function call no in AH */
xr.h.dl=device_no&0xff;
/* Device No. in DL */
xr.x.cx=sector_no;
/* Sector No. in CX */
On board Flash/RAM disk BIOS function calls
42
xr.h.al=sectors;
/* Sectors in AL */
xr.x.bx=FP_OFF(buffer_ptr);
/* Offset of Buffer pointer in BX */
sr.es=FP_SEG(buffer_ptr);
/* Segment of Buffer pointer in ES */
int86x(0x83,&xr,&xr,&sr);
/* Call function */
}
write_devsec(int device_no,int sector_no,int sectors,char *buffer_ptr)
/* Directly write sectors of device through function call entry
where
Entry int device_no :device No. (0.....)
int sector_no :start sector No. (0....)
int sectors :sectors be written (1....)
int buffer_ptr :data buffer pointer
Exit None */
{
union REGS xr;
struct SREGS sr;
xr.h.ah=3;
/* Function call no in AH */
xr.h.dl=device_no&0xff;
/* Device No. in DL */
xr.x.cx=sector_no;
/* Sector No. in CX */
xr.h.al=sectors;
/* Sectors in AL */
xr.x.bx=FP_OFF(buffer_ptr);
/* Offset of Buffer pointer in BX */
sr.es=FP_SEG(buffer_ptr);
/* Segment of Buffer pointer in ES */
int86x(0x83,&xr,&xr,&sr);
/* Call function */
} End