Reference Section
_get_timer0 {
int count = _get_timer0 ();
...
}
#include <inline.h>
...
get_timer0 (); /* CX = count */
...
Source file _MHGTMR0.ASM ASM equiv GET_TIMER0
{
unsigned int reload, mode;
...
mode = _get_timer0mode (&reload);
...
}
#include <inline.h>
get_timer0mode ();/* AL=mode, CX=reload value */
Source file _MHT0MOD.ASM ASM equiv GET_TIMER0MODE
{
int count;
...
count = _get_timer2 ();
...
}
#include <inline.h>
get_timer2 (); /* CX=count */
Source file _MHGTMR2.ASM ASM equiv GET_TIMER0
{
void (interrupt far *intptr)();
...
intptr = _get_vec(0x24);
...
}
#include <inline.h>
{
...
mov bl,0x24 /* bl = int # */
get_vec ();/* DX:AX -> int routine for "int #" */
...
}
Source file _MHGVEC.ASM ASM equiv GET_VEC
if (_is_3270 ())
{
...
} else
{
...
}
#include <inline.h>
...
is_3270 ();
je is_3270_010/* if the host computer is a 3270 */
... /* if the host computer is not a 3270 */
jmp short is_3270_020
is_3270_010:
... /* handle special 3270 setup */
is_3270_020:
...
}
Source file _MH3270.ASM ASM equiv IS_3270
if (_is_compaq ())
{
...
} else
{
...
}
#include <inline.h>
...
is_compaq ();
je compaq_010/* if the host computer is COMPAQ */
... /* if the host computer is not COMPAQ */
jmp short compaq_020
compaq_010:
... /* if the host computer is COMPAQ */
compaq_020:
...
}
Source file _MHCMPAQ.ASM ASM equiv IS_COMPAQ
_reset_timer0 ()
#include <inline.h>
reset_timer0 ();
Source file MHRTMR0.ASM ASM equiv RESET_TIMER0
{
int reload;
...
_set_timer0 (MODE_0, reload);
...
}
#include <inline.h>
{
int reload;
...
mov al,MODE_0
mov cx,reload
set_timer0 ();/* set mode to "MODE_0" */
... /* and reload value "reload" */
}
Source file _MHSTMR0.ASM ASM equiv SET_TIMER0
{
int reload;
_set_timer2 (MODE_3, reload);
...
}
#include <inline.h>
{
int reload;
...
mov al,MODE_3
mov cx,reload
set_timer2 ();/* set timer 2 to mode "MODE_3" */
... /* and reload value "reload" */
}
Source file _MHSTMR2.ASM ASM equiv SET_TIMER0
void interrupt far func ()
{
...
}
{
void (interrupt far *old_int)();
...
old_int = _set_vec (0x24, (intaddr) func);
...
if ((intaddr) _get_vec (0x24) == (intaddr) func)
{
_set_vec (0x24, (intaddr) old_int);
} else
{
/* Handle the interrupt vector being changed */
}
}
#include <inline.h>
#ifdef __cplusplus
extern "C" void interrupt far func ()
#else
void interrupt far func ()
#endif
...
{
...
#if __TINY__
mov dx,cs
#else
mov dx,seg func
#endif
mov ax,offset func/* DX:AX -> new interrupt func */
mov bl,0x24 /* bl = int # */
set_vec (); /* DX:AX -> old interrupt func */
pushdx /* preserve address of old
interrupt routine */
pushax
...
pop ax /* restore address of old
interrupt routine */
pop dx
/* if current interrupt handler =! my interrupt handler,
don't reinstall the old int handler */
cli /* turn interrupts off */
set_vec (); /* DX:AX -> previous int func */
cmp ax,offset func/* "previous" = "new" offset? */
jneset_vec_010/* n: go abort restoration */
#if __TINY__
mov cx,cs /* y: "previous" seg = "new"? */
cmp dx,cx
#else
cmp dx,seg func
#endif
je set_vec_020/* y: keep restoration */
set_vec_010:
set_vec (); /* n: abort restoration */
set_vec_020:
sti /* turn interrupts back on */
...
}
Source file _MHSVEC.ASM ASM equiv SET_VEC
_sound_beep (10000, 50);
#include <inline.h>
...
mov ax,10000/* frequency = 10,000 Hz */
mov dx,50 /* duration = 0.5 sec. */
sound_beep (); /* beep (0.5 sec at 10,000Hz) */
...
Source file _MHSNDBP.ASM ASM equiv SOUND_BEEP
{
/* produce a phaser sound */
int times, freq;
_sound_on (2500);
for (times = 6; times > 0; times--)
for (freq = 2500; freq > 0; freq--)
_sound_change (freq);
_sound_off ();
}
#include <inline.h>
{ /* produce a phaser sound */
int times, freq;
...
mov ax,2500 /* AX = starting frequency */
sound_on ();
mov cx,6 /* CX = # of loops */
sound_020:
sound_change ();/* change freq to value in AX */
dec ax /* decrease freq, at 0 yet? */
jnzsound_020/* n: loop again */
mov ax,2500 /* y: reset start frequency */
loopsound_020/* loop CX times */
sound_off ();
...
}
Source file _MHSNDCH.ASM ASM equiv SOUND_CHANGE
{
/* produce a phaser sound */
int times, freq;
_sound_on (2500);
for (times = 6; times > 0; times--)
for (freq = 2500; freq > 0; freq--)
_sound_change (freq);
_sound_off ();
}
#include <inline.h>
{ /* produce a phaser sound */
int times, freq;
...
mov ax,2500 /* AX = starting frequency */
sound_on ();
mov cx,6 /* CX = # of loops */
sound_020:
sound_change ();/* change freq to value in AX */
dec ax /* decrease freq, at 0 yet? */
jnzsound_020/* n: loop again */
mov ax,2500 /* y: reset start frequency */
loopsound_020/* loop CX times */
sound_off ();
...
}
Source file MHSNDOFF.ASM ASM equiv SOUND_OFF
{
/* produce a phaser sound */
int times, freq;
_sound_on (2500);
for (times = 6; times > 0; times--)
for (freq = 2500; freq > 0; freq--)
_sound_change (freq);
_sound_off ();
}
#include <inline.h>
{ /* produce a phaser sound */
int times, freq;
mov ax,2500 /* AX = starting frequency */
sound_on ();
mov cx,6 /* CX = # of loops */
sound_020:
sound_change ();/* change freq to value in AX */
dec ax /* decrease freq, at 0 yet? */
jnzsound_020/* n: loop again */
mov ax,2500 /* y: reset start frequency */
loopsound_020/* loop CX times */
sound_off ();
...
}
Source file _MHSNDON.ASM ASM equiv SOUND_ON
_sound_pulse (10000, 500);
#include <inline.h>
...
mov ax,10000/* frequency = 10,000 Hz */
mov dx,500 /* duration = 0.5 sec. */
sound_pulse (); /* sound on for 0.5 sec
at 10,000 Hz */
...
Source file _MHSDPLS.ASM ASM equiv SOUND_PULSE