Reference Section
_cbrk_check _cbrk_check();/* pass control if ctrl-break pending */
cbrk_check();/* pass control if ctrl-break pending */
Source file MDCBKCHK.ASM ASM equiv CBRK_CHECK
_cbrk_disable();/* disable DOS ctrl-break checking */
#include <inline.h>
cbrk_disable();/* disable DOS ctrl-break checking */
Source file MDCBKDIS.ASM ASM equiv CBRK_DISABLE
_cbrk_enable();/* enable DOS ctrl-break checking */
#include <inline.h>
cbrk_enable();/* enable DOS ctrl-break checking */
Source file MDCBKDIS.ASM ASM equiv CBRK_ENABLE
int control_break (void)/* simple cbrk handler */
{
_put_str ("\n\rControl-Break pressed");
return (0); /* continue execution */
}
{
...
_cbrk_install (control_break); /* install it */
...
}
#include <inline.h>
{
...
#if __TINY__
mov dx,cs
#else
mov dx,seg control_break
#endif
mov ax,offset control_break/* DX;AX -> new handler */
cbrk_install (); /* install it */
...
}
int control_break (void) /* simple cbrk handler */
{
_put_str ("\n\rControl-Break pressed");
return (0); /* continue execution */
}
Source file _MDCBINS.ASM ASM equiv CBRK_INSTALL
_cbrk_remove(); /* reset ctrl-break handler address */
#include <inline.h>
cbrk_remove(); /* reset ctrl-break handler address */
Source file MDCBKREM.ASM ASM equiv CBRK_REMOVE
_cbrk_save (); /* save DOS ctrl-break status flag */
...
_cbrk_restore ();
#include <inline.h>
cbrk_save (); /* save DOS ctrl-break status flag */
...
cbrk_restore ();
Source file MDCBKSAV.ASM ASM equiv CBRK_RESTORE
_cbrk_save (); /* save DOS ctrl-break status flag */
...
_cbrk_restore (); /* restore DOS ctrl-break status flag */
#include <inline.h>
cbrk_save (); /* save DOS ctrl-break status flag */
...
cbrk_restore (); /* restore DOS ctrl-break status flag */
Source file MDCBKSAV.ASM ASM equiv CBRK_SAVE
void interrupt far ce_handler (int bp, int di, int si, int ds,
int es, int dx, int cx, int bx,
int ax, int ip, int cs,
int flags);
/* set up critical error handler
{
/* handle the critical error here */
}
...
_ce_install ((intaddr) ce_handler);
/* install critical error handler */
...
#include <inline.h>
#ifdef __cplusplus
extern "C" void interrupt far ce_handler (int bp, int di,
int si, int ds, int es, int dx, int cx, int bx, int ax,
int ip, int cs, int flags);
#else
void interrupt far ce_handler (int bp, int di, int si, int ds,
int es, int dx, int cx, int bx, int ax, int ip, int cs,
int flags);
#endif
/* setup critical error handler
{
... /* handle the critical error here */
}
...
#if __TINY__
mov dx,cs /* setup to install critical error handler */
#else
mov dx,seg ce_handler
#endif
mov ax,offset ce_handler
ce_install ();/* install critical error handler
...
Source file _MDCEINS.ASM ASM equiv CE_INSTALL
char ce_manager (char error, char func_num,
char err_inf, char drive, void far * far *device);
...
/* new critical error manager */
{
...
return (3);
}
_cem_install (ce_manager);/* install it */
...
#include <inline.h>
char ce_manager (char error, char func_num,
char err_inf, char drive, void far * far *device);
/* new critical error manager */
{
...
return (3);
}
#if __TINY__
mov dx,cs
#else
mov dx,seg ce_manager
#endif
mov ax,offset ce_manager
/* DX:AX -> new critical error manager */
cem_install (); /* install it */
...
Source file _MDCEMNS.ASM ASM equiv CEM_INSTALL
_ce_remove();
#include <inline.h>
ce_remove();
Source file MDCEREM.ASM ASM equiv CE_REMOVE
_chk_version (0, 3); /* DOS 3.0 required */
#include <inline.h>
...
mov dx,_psp
mov al,0
mov ah,3
chk_version(); /* DOS 3.0 required */
...
Source file _MDCHKVR.ASM ASM equiv CHK_VERSION
_chk_version2 (); /* terminate if DOS 1x */
#include <inline.h>
mov dx,_psp
chk_version2 (); /* terminate if DOS 1x */
Source file _MDCKVR2.ASM ASM equiv CHK_VERSION2
switch (_cmp_version (0, 4))
{
case 1:/* Handle the dos version being later than 4.0 */
break;
case 0:/* Handle the dos version being 4.0 */
break;
case -1:/* Handle the DOS ver being earlier than 4.0 */
break;
}
#include <inline.h>
{
...
mov al,0
mov ah,4
cmp_version ();
ja _main_010/* if DOS later than 4.0 */
jb _main_020/* if DOS earlier than 4.0 */
... /* if DOS is 4.0 */
jmp short _main_030
_main_010:
... /* DOS version later than 4.0 */
jmp short _main_030
_main_020:
... /* DOS version earlier than 4.0 */
_main_030:
...
}
Source file _MDCMPVR.ASM ASM equiv CMP_VERSION
{
char *message;
_dos_errmsg (8);
...
}
#include <inline.h>
mov ax,8
dos_errmsg ();/* DS:SI -> error message */
...
Source file _MDDOSEM.ASM ASM equiv DOS_ERRMSG
{
char *message;
_dos_errmsge ();
...
}
#include <inline.h>
dos_errmsge (); /* DS:SI -> error message */
...
Source file _MDDSEME.ASM ASM equiv DOS_ERRMSGE
{
segaddr heapseg = 0;
int newsize, reqsize = 100, blocksize;
heapseg = _dos_malloc (200);
...
newsize = _dos_mset (heapseg, reqsize);
if (newsize != 0)
{
/* Handle DOS memory control block error */
if (newsize == reqsize)
{
/* insufficient memory to resize block to reqsize */
}
}
...
blocksize = _dos_msize (heapseg);
...
if (_dos_mfree (heapseg))
{
/* Handle error in freeing up memory */
}
}
#include <inline.h>
{
...
mov ax,100
dos_malloc (); /* DX -> allocated block */
jc main_030/* if an error occurred */
...
mov ax,200
dos_mset (); /* AX = size of block */
jnc main_020 /* if no error, continue */
... /* not enough memory to resize */
jmp short main_020
main_020:
...
dos_msize (); /* AX = size of block at DX */
...
dos_mfree (); /* was block freed? */
jnc main_030 /* y: continue */
... /* n: error in freeing block */
main_030:
...
}
Source file _MDDSMAL.ASM ASM equiv DOS_MALLOC
{
unsigned int avail = _dos_mavail ();
}
#include <inline.h>
dos_mavail ();/* AX = # of free paragraphs */
Source file MDDOSMAV.ASM ASM equiv DOS_MAVAIL
{
segaddr heapseg = 0;
int newsize, reqsize = 100, blocksize;
heapseg = _dos_malloc (200);
...
newsize = _dos_mset (heapseg, reqsize);
if (newsize != 0)
{
/* Handle DOS memory control block error */
if (newsize == reqsize)
{
/* insufficient memory to resize block to reqsize */
}
}
...
blocksize = _dos_msize (heapseg);
...
if (_dos_mfree (heapseg))
{
/* Handle error in freeing up memory */
}
}
#include <inline.h>
{
mov ax,100
dos_malloc (); /* DX -> allocated block */
jc main_030/* if an error occurred */
...
mov ax,200
dos_mset (); /* AX = size of block */
jnc main_020 /* if no error, continue */
... /* not enough memory to resize */
jmp short main_020
main_020:
...
dos_msize (); /* AX = size of block at DX */
...
dos_mfree (); /* was bloc freed? */
jnc main_030 /* y: continue */
... /* n: error in freeing block */
main_030:
...
}
Source file _MDDSMFR.ASM ASM equiv DOS_MFREE
{
segaddr heapseg = 0;
int newsize, reqsize = 200, blocksize;
heapseg = _dos_malloc (100);
...
newsize = _dos_mset (heapseg, reqsize);
if (newsize != 0)
{
/* insufficient enough memory to resize block to reqsize */
}
...
blocksize = _dos_msize (heapseg);
...
if (_dos_mfree (heapseg))
{
/* error in freeing up memory */
}
}
#include <inline.h>
{
mov ax,100
dos_malloc (); /* DX -> allocated block */
jc main_030/* if an error occurred */
...
mov ax,200
dos_mset (); /* AX = size of block */
jnc main_020 /* if no error, continue */
... /* insufficient memory to resize block to reqsize */
jmp short main_020
main_020:
...
dos_msize (); /* AX = size of block at DX */
...
dos_mfree (); /* was block freed? */
jnc main_030 /* y: continue */
... /* n: error in freeing block */
main_030:
...
}
Source file _MDDSMST.ASM ASM equiv DOS_MSET
{
segaddr heapseg = 0;
int newsize, reqsize = 100, blocksize;
heapseg = _dos_malloc (200);
...
newsize = _dos_mset (heapseg, reqsize);
if (newsize == 0)
{
/* Handle DOS memory control block error */
}
if (newsize != reqsize)
{
/* insufficient memory to resize block to reqsize */
}
...
blocksize = _dos_msize (heapseg);
...
if (_dos_mfree (heapseg))
{
/* Handle error in freeing up memory */
}
}
#include <inline.h>
{
mov ax,100
dos_malloc (); /* DX -> allocated block */
jc main_030/* if an error occurred */
...
mov ax,200
dos_mset (); /* AX = size of block */
jnc main_020 /* if no error, continue */
... /* insufficient memory to resize block to reqsize */
jmp short main_020
main_020:
...
dos_msize (); /* AX = size of block at DX */
...
dos_mfree (); /* was block freed? */
jnc main_030 /* y: continue */
... /* n: error in freeing block */
main_030:
...
}
Source file _MDDSMSZ.ASM ASM equiv DOS_MSIZE
{
void far *dta;
...
_dta_save ();
_set_dta (dta);
...
_dta_restore ();
}
#include <inline.h>
{
void far *dta;
...
dta_save ();
les di,dta
set_dta ();
...
dta_restore ();
}
Source file MDDTASAV.ASM ASM equiv DTA_RESTORE
{
void far *dta;
...
_dta_save ();
_set_dta (dta);
...
_dta_restore ();
}
#include <inline.h>
{
void far *dta;
...
dta_save ();
les di,dta
set_dta ();
...
dta_restore ();
}
Source file MDDTASAV.ASM ASM equiv DTA_SAVE
if (_get_cbrk ())
{
/* handle control break checking ON */
} else
{
/* handle control break checking OFF */
}
#include <inline.h>
get_cbrk (); /* AL=cbrk status */
cmp al,0
je get_cbrk_010/* if cbrk checking OFF */
... /* if cbrk checking ON */
jmp short get_cbrk_020
get_cbrk_010:
... /* control break checking OFF */
get_cbrk_020:
...
}
Source file MDCBKGET.ASM ASM equiv GET_CBRK
{
long int disk_free = _get_cdfree ();
...
}
#include <inline.h>
get_cdfree (); /* DX;AX = free space */
jncget_cdfree_010/* if successful */
... /* if an error occurred */
jmp short get_cdfree_020
get_cdfree_010:
...
get_cdfree_020:
...
Source file _MDCDFRE.ASM ASM equiv GET_CDFREE
{
disk_info dinfo;
if (_get_cdinfo (&dinfo))
{
/* Handle error obtaining information on current drive */
} else
{
...
}
}
#include <inline.h>
...
get_cdinfo (); /* AX,CX,DX contains info */
jncmain_010/* if successful */
... /* if an error occurred */
jmp short main_020
main_010:
... /* process disk info */
main_020:
...
Source file _MDCDINF.ASM ASM equiv GET_CDINFO
{
long int disk_size = _get_cdsize ();
...
}
#include <inline.h>
get_cdsize (); /* DX;AX = disk size */
jncmain_010/* if successful */
... /* if an error occurred */
jmp short main_020
main_010:
... /* process disk size */
main_020:
...
Source file _MDCDSIZ.ASM ASM equiv GET_CDSIZE
{
unsigned int rcode;
char buffer[sizeof(dcountry)], decbuf[20];
dcountry *cntry;
...
if((cntry = _get_countryinfo(0, buffer, &rcode)) == NULL)
_put_str("Unable to retrieve country information");
else
_put_str(_ui_to_dec(rcode, decbuf)); /* display code */
...
}
#include <inline.h>
{
char buffer[sizeof(dcountry)], decbuf[20];
...
xor ax,ax /* specify current cntry */
lea si,buffer/* SI -> country info buf */
get_countryinfo();/* get current cntry info */
jc label_010
lea si,decbuf/* SI -> conversion buf */
ui_to_dec(); /* int -> ASCII */
put_str(); /* display code */
label_010:
...
}
Source file _MDGCTRY.ASM ASM equiv GET_COUNTRYINFO
{
long int disk_free;
disk_free = _get_dfree ('C');
...
}
#include <inline.h>
...
mov al,'C'
get_dfree (); /* DX;AX = free space */
jncmain_010/* if successful */
... /* if an error occurred */
jmp short main_020
main_010:
...
main_020:
...
Source file _MDDFREE.ASM ASM equiv GET_DFREE
{
disk_info dinfo;
if (_get_dinfo ('C', &dinfo) == -1)
{
.../* error obtaining information on drive C */
} else
{
.../* drive info return successfully */
}
}
#include <inline.h>
...
mov al,'C'
get_dinfo (); /* AX,CX,DX contains info */
jncget_dinfo_010/* if successful */
... /* if an error occurred */
jmp short get_dinfo_020
get_dinfo_010:
... /* process disk info */
get_dinfo_020:
...
Source file _MDDINFO.ASM ASM equiv GET_DINFO
{
long int disk_size;
...
disk_size = _get_dsize ('C');
...
}
#include <inline.h>
...
mov al,'C'
get_dsize (); /* DX;AX = disk size */
jncmain_010/* if successful */
... /* if an error occurred */
jmp short main_020
main_010:
...
main_020:
...
Source file _MDDSIZE.ASM ASM equiv GET_DSIZE
{
void far *dta;
dta = _get_dta();
}
#include <inline.h>
...
get_dta ();/* ES:DI = addr of DTA */
...
Source file _MDDTGET.ASM ASM equiv GET_DTA
{
int error_code = _get_ecode ();
...
}
#include <inline.h>
...
get_ecode ();/* AX = error code */
...
Source file MDGECODE.ASM ASM equiv GET_ECODE
{
char lastdrive;
lastdrive = _get_lastdrive ();
...
}
#include <inline.h>
...
get_lastdrive ();
/* AL = number of logical drives */
...
Source file MDGLSTDR.ASM ASM equiv GET_LASTDRIVE
{
void (interrupt far *int_handler)();
int_handler = _get_vect(0x24);
...
}
#include <inline.h>
...
mov bl,0x24
get_vect ();/* DX:AX -> interrupt routine */
...
Source file _MDGVECT.ASM ASM equiv GET_VECT
{
if (_get_verify ())
{
/* Verify is ON */
} else
{
/* Verify is OFF */
}
}
#include <inline.h>
...
get_verify ();/* AL = state of verify flag */
...
Source file MDGVERIF.ASM ASM equiv GET_VERIFY
{
char major, minor;
_get_version (&minor, &major);
...
}
#include <inline.h>
...
get_version (); /* AL=minor version number,
AH=major version number */
...
Source file _MDGVERS.ASM ASM equiv GET_VERSION
_set_cbrk (BRK_OFF);/* Turn control-break checking off */
...
_set_cbrk (BRK_ON);/* Turn control-break checking back on */
#include <inline.h>
mov al,0
set_cbrk ();/* Turn control-break checking off */
...
mov al,1
set_cbrk ();/* Turn control-break checking back on */
...
Source file _MDCBSET.ASM ASM equiv SET_CBRK
...
if(_set_country(31) == -1)
_put_str("Unable to select Netherlands country info");
...
#include <inline.h>
{
char *sptr;
...
mov ax,3
set_country();
jc label_100
sptr = "Unable to select Latin America country info";
mov si,sptr
put_str(); /* display error message */
label_100:
...
}
Source file _MDSCTRY.ASM ASM equiv SET_COUNTRY
{
void far *dta;
...
_dta_save ();
_set_dta (dta);
...
_dta_restore ();
}
#include <inline.h>
{
void far *dta;
...
dta_save ();
les di,dta
set_dta ();
...
dta_restore ();
}
Source file _MDDTSET.ASM ASM equiv SET_DTA
void interrupt far ce_handler (int bp, int di, int si, int ds,
int es, int dx, int cx, int bx,
int ax, int ip, int cs,
int flags);
/* setup critical error handler
{
/* handle the critical error here */
}
{
void (interrupt far *int_handler)();
int_handler = _get_vect (0x24);
/* get current interrupt function address */
_set_vect (0x24, (intaddr) ce_handler);
/* set vector to new int handler */
...
_set_vect (0x24, (intaddr) int_handler);
/* restore vector to previous interrupt function */
}
#include <inline.h>
void interrupt far ce_handler (int bp, int di, int si, int ds,
int es, int dx, int cx, int bx,
int ax, int ip, int cs,
int flags)
/* setup critical error handler
{
/* handle the critical error here */
}
mov bl,0x24
get_vect (); /* DX:AX = current interrupt
function address */
push dx /* save address */
push ax
#if __TINY__
mov dx,cs
#else
mov dx,seg ce_handler
#endif
mov ax,offset ce_handler/* DX:AX = new interrupt
handler address */
set_vect ();/* set the vector to new int handler */
...
pop ax /* restore previous interrupt address */
pop dx
set_vect ();/* restore previous interrupt function */
...
}
Source file _MDSVECT.ASM ASM equiv SET_VECT
{
_verify_save ();
...
_set_verify (1);/* turn verify on */
...
_set_verify (0);/* turn verify off */
...
_verify_restore ();
}
#include <inline.h>
...
verify_save ();
...
mov al,1
set_verify (); /* turn verify on */
...
mov al,0
set_verify (); /* turn verify off */
...
verify_restore ();
Source file _MDSVERF.ASM ASM equiv SET_VERIFY
_verify_off ()
#include <inline.h>
verify_off ();
Source file MDVEROFF.ASM ASM equiv VERIFY_OFF
_verify_on ()
#include <inline.h>
verify_on ();
Source file MDVERON.ASM ASM equiv VERIFY_ON
{
_verify_save ();
...
_set_verify (1);/* turn verify on */
...
_set_verify (0);/* turn verify off */
...
_verify_restore ();
}
#include <inline.h>
verify_save ();
...
mov al,1
set_verify (); /* turn verify on */
...
mov al,0
set_verify (); /* turn verify off */
...
verify_restore ()
...
Source file MDVERSAV.ASM ASM equiv VERIFY_RESTORE
{
_verify_save ();
...
_set_verify (1);/* turn verify on */
...
_set_verify (0);/* turn verify off */
...
_verify_restore ();
}
#include <inline.h>
verify_save ();
...
mov al,1
set_verify (); /* turn verify on */
...
mov al,0
set_verify (); /* turn verify off */
...
verify_restore ()
Source file MDVERSAV.ASM ASM equiv VERIFY_SAVE