Reference Section
_add_time {
std_time time1, time2;
time1.hours = 10;/* time1 = 10:30:00.00 */
time1.minutes = 30;
time1.seconds = 0;
time1.hseconds = 0;
time2.hours = 10;/* time2 = 10:10:00.00 */
time2.minutes = 10;
time2.seconds = 0;
time2.hseconds = 0;
_add_time(&time1, &time2);
/* time1 = 20:40:00.00 */
}
#include <inline.h>
{
unsigned long sumtime;
...
mov ch,10 /* CL = hours */
mov cl,30 /* CH = minutes */
mov bh,0 /* BH = seconds */
mov bl,0 /* BL = hseconds */
/* (time1 = 10:30:00.00) */
mov dh,10 /* DH = hours */
mov dl,10 /* DL = minutes */
mov ah,0 /* AH = seconds */
mov al,0 /* AL = hseconds */
/* (time2 = 10:10:00.00) */
sumtime = add_time();/* sumtime = 20:40:00.00 */
...
}
Source file _DTADTME.ASM ASM equiv ADD_TIME
{
char datestr[20];
std_date adate;
...
adate.year= 1992;
adate.day= 4;
adate.month= 7;
_put_str(_asc_date(datestr, &adate)); /* "07/04/92" */
...
}
#include <inline.h>
{
char datestr[20];
...
mov dx,1992 /* DX = year */
mov ah,7 /* AH = month */
mov al,4 /* AL = day */
pushds
pop es /* ES=SS(segment of datestr) */
lea si,datestr/* SI = offset of datestr */
asc_date();
put_str(); /* "07/04/92" */
...
}
Source file _DTASCDT.ASM ASM equiv ASC_DATE
{
char timestr[20];
std_time atime;
atime.hours = 13;
atime.minutes = 30;
_put_str(_asc_time(timestr, &atime)); /* "01:30 pm" */
...
}
#include <inline.h>
{
char timestr[20];
mov dh,13 /* DH = hours */
mov dl,30 /* DL = minutes */
xor ax,ax /* AX = seconds, 100ths */
lea si,timestr /* SI = offset timestr */
pushds
pop es /* ES=DS (small data models) */
asc_time(); /* DX;AX = time (long format) */
put_str(); /* "01:30 pm" */
...
}
Source file _DTASCTM.ASM ASM equiv ASC_TIME
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
std_date adate;
unsigned long date;
dtc_addr = &dtc; /* use dtc structure (conversion info) */
_asc_to_date("12-25-1992", DATE_MDY+DATE_4DIGYR, 80, &adate);
/* adate contains date */
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char instr[] = "10-16-1992";
...
dtc_addr = &dtc;/* use dtc struct (conv. info) */
lea si,instr/* SI -> instr */
mov ch,DATE_MDY+DATE_4DIGYR /* set conv. flags */
mov cl,80 /* CL = width */
asc_to_date(); /* DX;AX = dword date */
}
Source file _DTATODT.ASM ASM equiv ASC_TO_DATE
{
dtcopts dtc = {0,'-',0,':','.'," morning", " evening"};
std_time atime;
dtc_addr = &dtc; /* use DTC structure (conversion info) */
_asc_to_time("12:59:59:00 morning", TIME_12HR, 80, &atime);
/* atime contains converted time */
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," morning", " evening"};
char instr[] = "11:59:59:00 morning";
long time;
...
dtc_addr = &dtc;/* use DTC struct (conv. info) */
lea si,instr/* SI -> instr */
mov ch,TIME_12HR/* CH = conversion flags */
mov cl,80 /* CL = width */
time = asc_to_time();/* DX;AX = dword time */
...
}
Source file _DTATOTM.ASM ASM equiv ASC_TO_TIME
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char outstr[80];
std_date adate;
...
dtc_addr = &dtc;/* use dtc structure (conversion info) */
adate.year = 1992;
adate.day = 25;
adate.month = 12;/* adate contains date to convert */
_put_str(_date_to_asc(&adate, DATE_MDY, 80, outstr));
/* "12-26-1992" */
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char outstr[80];
...
dtc_addr = &dtc;/* use dtc struct (conv. info) */
mov ch,DATE_MDY+DATE_4DIGYR /*CH = conv. flags */
mov cl,80 /* CL = width of buffer */
lea si,outstr/* SI -> outstr */
mov dx,1992 /* DX = year */
mov ah,12 /* AH = month */
mov al,25 /* AL = day */
date_to_asc(); /* date -> "string" */
put_str(); /* "16-10-1992" */
...
}
Source file _DTDTASC.ASM ASM equiv DATE_TO_ASC
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char *outstr;
std_date adate;
...
dtc_addr = &dtc;/* use dtc struct (conv. info) */
adate.year = 1992;
adate.month = 12;
adate.day = 25;/* adate contains date to convert */
outstr = " is today's date.";
_date_to_asce(&adate, DATE_MDY, 80, outstr);
_put_str(outstr);/* "10-16-92 is today's date." */
...
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char outstr[] = " is today's date.";
...
dtc_addr = &dtc;/* use dtc struct (conv. info) */
mov ch,DATE_MDY/* CH = conversion flags */
mov cl,80 /* CL = width of buffer */
lea si,outstr/* SI -> outstr */
mov dx,1992 /* DX = year */
mov ah,12 /* AH = month */
mov al,25 /* AL = day */
date_to_asce(); /* date -> "string..." */
lea si,outstr/* reset SI -> outstr */
put_str(); /* "12-25-92 is today's date" */
...
}
Source file _DTDTACE.ASM ASM equiv DATE_TO_ASCE
{
unsigned int numdays;
std_date ddate;
...
ddate.year= 1980;/* ddate = 01-06-1980 */
ddate.month= 1;
ddate.day= 6;
numdays = _date_to_days(&ddate);/* numdays = 5 */
...
}
#include <inline.h>
{
unsigned int numdays;
...
mov dx,1980 /* DX = year */
mov ah,1 /* AH = month */
mov al,6 /* AL = day */
/* date = 01-06-1980 */
numdays = date_to_days();/* numdays = 5 */
...
}
Source file _DTDTDYS.ASM ASM equiv DATE_TO_DAYS
{
std_date ddate;
_days_to_date(10, &ddate);/* ddate = 01-11-1980 */
...
}
#include <inline.h>
{
unsigned long date;
...
mov ax,10 /* AX = days from 01-01-1980 */
date = days_to_date();/* date = 1/11/1980 */
...
}
Source file _DTDYSDT.ASM ASM equiv DAYS_TO_DATE
{
static std_time time1, time2;
time1.hours = 23; /* time1 = 23:59:00.00 */
time1.minutes= 59;
time1.seconds= 0;
time1.hseconds= 0;
time2.hours = 0; /* time2 = 00:01:00.00 */
time2.minutes= 1;
time2.seconds= 0;
time2.hseconds= 0;
_diff_time(&time1, &time2);/* time1 = 00:02:00.00 */
...
}
#include <inline.h>
{
unsigned long diftime;
...
mov ch,23 /* time1 = 23:59:00.00 */
mov cl,59
mov bh,0
mov bl,0
mov dh,0 /* time2 = 00:01:00.00 */
mov dl,1
mov ah,0
mov al,0
diftime = diff_time(); /* diftime = 00:02:00.00 */
...
}
Source file _DTDIFTM.ASM ASM equiv DIFF_TIME
{
dtcopts dtc;
dtc_addr = &dtc;/* use dtc structure (country info) */
if (dtc_init(0) == 0)
_put_str("Unable to initialize DTC structure.");
else
/* ... continue with conversions ... */
}
#include <inline.h>
{
dtcopts dtc;
char msg[] = "Unable to initialize DTC structure";
...
dtc_addr = &dtc;/* use dtc structure */
xor ax,ax/* get current country information */
dtc_init();/* initialize dtc w/DOS country info */
jnccntry_010
lea si,msg/* SI -> message string */
put_str();/* output message */
cntry_010:
...
}
Source file _DTINIT.ASM ASM equiv DTC_INIT
{
unsigned long clock;
clock = _get_clock();
...
}
#include <inline.h>
{
unsigned long clock;
clock = get_clock();
...
}
Source file DTGETCLK.ASM ASM equiv GET_CLOCK
{
std_date gdate;
_get_date(&gdate); /* gdate filled w/current date */
...
}
#include <inline.h>
{
char *str;
unsigned cmpdate;
...
mov cx,word ptr cmpdate+2
mov bx,word ptr cmpdate/* CX:BX = target date */
get_date(); /* DX:AX = current date */
cmp_dd(); /* past target date yet? */
ja chk_date_100/* y: display message */
str = "Not past target date yet.";
jmp short chk_date_200
chk_date_100: /* write "past" message */
str = "Past target date!";
chk_date_200:
mov si,str /* SI = offset of str */
put_str(); /* display message */
...
}
Source file _DTGTDTE.ASM ASM equiv GET_DATE
{
char day;
std_date gday;
gday.year= 2000; /* gday = Jan 1, 2000 */
gday.month= 1;
gday.day= 1;
day = _get_day(&gday); /* day = 6 (Saturday) */
...
}
#include <inline.h>
{
char day;
...
mov dx,2000 /* DX = year */
mov ah,1 /* AH = month */
mov al,1 /* AL = day */
get_day(); /* CL = 6 (Saturday) */
mov day,cl /* day = day of week */
...
}
Source file _DTGTDAY.ASM ASM equiv GET_DAY
{
...
std_time gtime;
_get_time(&gtime);/* gtime filled with current time */
...
}
#include <inline.h>
{
unsigned long gtime, target;
...
gtime = get_time();
if (gtime == target)
_put_str("Currently at target time!");
else if (gtime > target)
_put_str("Past target time!");
else
_put_str("Not yet at target time!");
...
}
Source file _DTGTTME.ASM ASM equiv GET_TIME
std_time htime;
_hund_to_time(92159998, &htime); /* htime = 255:59:59.98 */
...
#include <inline.h>
{
unsigned long target;
char *str;
...
target = get_time();
mov bx,0xF200
mov cx,0x0026/* CX;BX = 8:00:00.00 (100ths) */
if (target < hund_to_time())
{ str = "\n\r Not at target time yet."; }
else
{ str = "\n\r Past target time!"; }
mov si,str
put_str(); /* display "str" */
...
}
Source file _DTHNTME.ASM ASM equiv HUND_TO_TIME
...
_init_msec();
_sleep_msec(100);/* delay for 0.1 second */
...
#include <inline.h>
...
init_msec();
mov ax,200/* AX = thousandths of seconds */
sleep_msec();/* delay for 0.2 seconds */
...
Source file DTINITMS.ASM ASM equiv INIT_MSEC
{
std_date mdate;
fbuf mbuf; /* contains file info from last _find_next */
...
mdate.day= 5;
mdate.month= 11;
mdate.year= 1992;
if(mbuf.date != _merge_date(&mdate))
exit(0); /* exit if file date <> 11-05-1992 */
...
}
#include <inline.h>
{
fbuf mbuf;/* contains file info from last _find_next */
...
mov al,5 /* AL = day */
mov ah,11 /* AH = month */
mov dx,1992 /* DX = year */
merge_date();
cmp word ptr mbuf.date,dx
jnemain_100 /* exit if file date <> 11-05-1992 */
...
main_100:
...
}
Source file _DTMRGDT.ASM ASM equiv MERGE_DATE
{
std_time mtime;
fbuf mbuf;/* info from last _find_next */
...
mtime.hours = 13;
mtime.minutes= 1;
mtime.seconds= 30;
if(mbuf.time != _merge_time(&mtime))
exit(0);/* exit if file time <> 13:01:30 */
...
}
#include <inline.h>
{
fbuf mbuf; /* info from last _find_next */
...
mov dh,12 /* DH = hours */
mov dl,1 /* DL = minutes */
mov ah,30 /* AH = seconds */
merge_time(); /* AX = merged time */
cmp word ptr mbuf.time,ax/* time = 12:01:30? */
jnemain_100 /* n: exit */
... /* y: continue */
main_100:
...
}
Source file _DTMRGTM.ASM ASM equiv MERGE_TIME
...
unsigned long count = 1573039;
_set_clock(count);
...
#include <inline.h>
...
unsigned long count = 1573039;
...
mov ax,word ptr count
mov dx,word ptr count+2/* DX;AX = count */
set_clock();
...
Source file _DTSTCLK.ASM ASM equiv SET_CLOCK
{
std_date sdate;
sdate.year= 2000;
sdate.month= 1;
sdate.day= 1;
_set_date(&sdate); /* set sys date to 01-01-2000 */
...
}
#include <inline.h>
...
mov dx,2000 /* DX = year */
mov ah,1 /* AH = month */
mov al,1 /* AL = day */
set_date(); /* set sys date to 01-01-2000 */
...
Source file _DTSTDTE.ASM ASM equiv SET_DATE
...
std_time stime;
stime.hours= 12;
stime.minutes= 30;
stime.seconds= 30;
if(_set_time(&stime) == -1)
_put_str("Time is invalid.");
...
#include <inline.h>
...
mov dx,12 /* DX = hours */
mov ah,30 /* AH = minutes */
mov al,30 /* AL = seconds */
set_time();
jnclabel_100/* if successful jump to label */
_put_str("Time is invalid.");
label_100:
...
Source file _DTSTTME.ASM ASM equiv_SET_TIME
...
_init_msec();/* initialize millisecond timer first */
_sleep_msec(1000);/* sleep for 1 second */
...
#include <inline.h>
...
init_msec();
mov ax,2000 /* AX = thousandths of seconds */
sleep_msec();/* sleep for 2 seconds */
...
Source file _DTSLMSC.ASM ASM equiv SLEEP_MSEC
_sleep_sec(100);/* sleep for 1 second */
...
#include <inline.h>
...
mov ax,200/* AX = hundredths of seconds */
sleep_sec();/* sleep for 2 seconds */
...
Source file _DTSLPSC.ASM ASM equiv SLEEP_SEC
...
fbuf filebuf; /* file info from last _find_next */
std_date sdate;
...
_split_date(filebuf.date, &sdate);
...
#include <inline.h>
...
unsigned long sdate;
fbuf filebuf;/* info from last _find_next */
...
mov dx,word ptr filebuf.date/* DX=time (int format) */
sdate = split_date();
...
Source file _DTSPLDT.ASM ASM equiv SPLIT_DATE
...
fbuf mbuf;/* info from last _find_next */
std_time stime;
_split_time(mbuf.time, &stime); /* stime struct = file time */
...
#include <inline.h>
...
unsigned long ltime;
fbuf mbuf;/* info from last _find_next */
mov ax,word ptr mbuf.time
/* AX = time in integer format */
ltime = split_time();
/* ltime is time in structure format */
...
Source file _DTSPLTM.ASM ASM equiv SPLIT_time
{
std_time stime;
unsigned long ttime;
ttime = _get_clock();
_ticks_to_time(ttime, &stime);
/* convert ticks to structure format */
}
#include <inline.h>
...
get_clock();/* DX;AX = time in ticks */
ticks_to_time();
/* DX;AX = time in unsigned long format */
...
Source file _DTTKTME.ASM ASM equiv TICKS_TO_TIME
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
std_time atime;
char outstr[80];
dtc_addr = &dtc; /* use dtc structure for conversion info */
atime.hours = 12;
atime.minutes = 59;
atime.seconds = 59;
atime.hseconds = 99; /* atime contains time to convert */
_put_str(_time_to_asc(&atime, 0, 80, outstr));
/* "12:59:59.99 pm" */
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char outstr[80];
...
dtc_addr = &dtc; /* use dtc structure (conv. info) */
xor ch,ch /* CH = conversion flags */
mov cl,80 /* CL = width of buffer */
lea si,outstr/* SI -> outstr */
mov dh,11 /* DH = hours */
mov dl,59 /* DL = minutes */
mov ah,59 /* AH = seconds */
mov al,99 /* AL = 100ths */
time_to_asc(); /* time -> "string" */
put_str(); /* "11:59:59.99 am" */
...
}
Source file _DTTMASC.ASM ASM equiv TIME_TO_ASC
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
std_time atime;
char *outstr;
dtc_addr = &dtc; /* use dtc structure (conversion info) */
atime.hours = 12;
atime.minutes = 59;
atime.seconds = 59;
atime.hseconds = 99; /* atime contains time to convert */
outstr = " is the current time";
_time_to_asce(&atime, 0, 80, outstr);
_put_str(outstr); /* "12:59:59.99 pm is the current time"*/
}
#include <inline.h>
{
dtcopts dtc = {0,'-',0,':','.'," am", " pm"};
char outstr[] = " is the current time";
...
dtc_addr = &dtc; /* use DTC structure (conv. info) */
xor ch,ch /* CH = conversion flags */
mov cl,80 /* CL = width of buffer */
lea si,outstr/* SI -> outstr */
mov dh,11 /* DH = hours */
mov dl,59 /* DL = minutes */
mov ah,59 /* AH = seconds */
mov al,99 /* AL = 100ths */
time_to_asce(); /* time -> "string" */
lea si,outstr/* reset SI -> outstr */
put_str();/* "11:59:59.99 am is the current time"*/
...
}
Source file _DTTMACE.ASM ASM equiv TIME_TO_ASCE
{
unsigned long hundredths;
std_time htime;
htime.hours = 10;
htime.minutes= 30;
htime.seconds= 5;
htime.hseconds = 50;
hundredths = _time_to_hund(&htime);
/* = 3780550 hundredths of a sec */
...
}
#include <inline.h>
{
unsigned long hundredths;
...
mov dh,10 /* DH = hours */
mov dl,30 /* DL = minutes */
mov ah,5 /* AH = seconds */
mov al,50 /* AL = hseconds */
hundredths = time_to_hund();
/* 3780550 100ths of a sec */
...
}
Source file _DTTMHUN.ASM ASM equiv TIME_TO_HUND
{
std_time stime;
unsigned long ttime;
_get_time(&stime);
ttime = _time_to_ticks(&stime);
/* convert structure time to timer ticks format */
}
#include <inline.h>
{
...
get_time();/* DX;AX = unsigned long format time */
time_to_ticks();/* DX;AX = time in ticks */
...
}
Source file _DTTMETK.ASM ASM equiv TIME_TO_TICKS
{
std_time tmrtime;
_tmr_reset();
...
_tmr_read(&tmrtime);
/* tmrtime = elapsed time after 1st section */
...
_tmr_read(&tmrtime); /* tmrtime = elapsed time at end */
...
}
#include <inline.h>
{
unsigned long tmrtime;
...
_tmr_reset(); /* start timer */
...
tmrtime = tmr_read();
/* tmrtime = elapsed time after 1st section */
...
tmrtime = tmr_read();/* tmrtime=elapsed time at end */
...
}
Source file _DTTIMER.ASM ASM equiv TMR_READ
{
std_time tmr;
_tmr_reset();
...
_tmr_read(&tmr);/* tmr = elapsed time */
...
}
#include <inline.h>
{
unsigned long tmr;
...
_tmr_reset(): /* start timer */
...
tmr = _tmr_read();/* tmr = elapsed time */
...
}
Source file DTTIMER.ASM ASM equiv TMR_RESET