/*
* character test macro
* 0:FALSE !0:TRUE
*/
#define M_isdigit(c) ((c)>='0'&&(c)<='9')
#define M_islhex(c) ((c)>='a'&&(c)<='f')
#define M_ishhex(c) ((c)>='A'&&(c)<='F')
#define M_ishex(c) (M_islhex(c)||M_ishhex(c))
#define M_isxdigit(c) (M_isdigit(c)||M_ishex(c))
#define M_iskanji(c) (((c)>=0x81&&(c)<=0x9f)|| ¥
((c)>=0xe0&&(c)<=0xfc))
#define M_iskana(c) ((c)>=0xa1&&(c)<=0xdf)
#define M_isank(c) (M_iskana(c)||((c)>=0x20&&(c)<=0x7f))
#define M_islower(c) ((c)>='a'&&(c)<='z')
#define M_isupper(c) ((c)>='A'&&(c)<='Z')
#define M_isalpha(c) (M_islower(c)||M_isupper(c))
#define M_isspecial(c) (((c)>=0x21&&(c)<= 0x2f)|| ¥
((c)>=0x3a&&(c)<= 0x40)|| ¥
((c)>=0x5b&&(c)<= 0x60)|| ¥
((c)>=0x7b&&(c)<= 0x7e))
/*
* character convert macro
* c:char
*/
#define M_toupper(c) (((M_islower(c))?(c)-32:(c)))
#define M_tolower(c) (((M_isupper(c))?(c)+32:(c)))
/*
* etc
*
* DIR_CONSOLE_INPUT ..... ダイレクトコンソール入力 ( [STOP] キーで 0x03 を返す )
*/
#define GETCHLE() (bdos(0x01,0,0)&0x00ff)
#define PUTCH(dl) (bdos(0x02,(dl),0))
#define AUX_GETCH() (bdos(0x03,0,0)&0x00ff)
#define AUX_PUTCH(dl) (bdos(0x04,(dl),0))
#define PRN_PUTCH(dl) (bdos(0x05,(dl),0))
#define GETCH() (bdos(0x06,0xFF,0)&0x00ff)
#define PUTCH2(c) (bdos(0x06,(c),0))
#define GETCHLS() (bdos(0x07,0,0)&0x00ff)
#define GETCHL() (bdos(0x08,0,0)&0x00ff)
#define KBHIT() (bdos(0x0B,0,0)&0x00ff)
#define GETCHM(al) (bdos(0x0C,0,(al))&0x00ff)
#define DISK_RESET() (bdos(0x0D,0,0))
#define SELECT_DISK(dl) (bdos(0x0E,(dl),0)&0x00ff)
#define CURRENT_DISK() (bdos(0x19,0,0)&0x00ff)
#define M_hibyte(x) (BYTE)((WORD)(x)>>8)
#define M_hiword(x) (WORD)((DWORD)(x)>>16)
#define M_lobyte(x) ((WORD)(x)&0xff)
#define M_loword(x) ((DWORD)(x)&0xffffL)
#define M_clear(x) (memset(&(x),0,sizeof(x)))
#define M_ctoi(c) ((int)(M_isdigit(c)?((c)-'0'):0))
#define M_lctoi(c) ((int)(M_islhex(c)?((c)-'a'+10):0))
#define M_hctoi(c) ((int)(M_ishhex(c)?((c)-'A'+10):0))
#define M_xctoi(c) ((int)(M_ctoi(c)+M_lctoi(c)+M_hctoi(c)))
#define M_sgn(val) ((val)==0)?0:(((val)<0)?-1:1)
/*
* セグメント、オフセットから FAR ポインターを生成
* void far *MK_FP( ???? segment, ???? offset )
*/
#ifndef MK_FP
#define MK_FP(s,o) ((void far *)(((DWORD)(s)<<16)|(WORD)(o)))
#endif
/*
* FAR ポインターからセグメント、オフセットを取り出す
* unsigned short FP_SEG( ????