'intr func'에 해당되는 글 1건

  1. 2021.07.03 Watcom C Library : intdos, intdosx, intr, isalnum, isalpha, isascii

 

 

Watcom C Library Reference : intdos, intdosx, intr, isalnum, isalpha, isascii

 

 

 

 

intdos

 

Synopsis : #include <dos.h> 

              int intdos( const union REGS *in_regs, union REGS *out_regs );


Description : The intdos function causes the computer's central processor (CPU) to be interrupted with an interrupt number hexadecimal 21 (0x21), which is a request to invoke a specific DOS function. Before the interrupt, the CPU registers are loaded from the structure located by in_regs. The AH register contains a number indicating the function requested. Following the interrupt, the structure located by out_regs is filled with the contents of the CPU registers. These structures may be located at the same location in memory.


You should consult the technical documentation for the DOS operating system that you are using to determine the expected register contents before and after the interrupt in question.

 

 

Returns : The function returns the value of the AX (EAX in 386 library) register after the interrupt has completed. The CARRY flag (when set, an error has occurred) is copied into the structure located by out_regs. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

See Also : bdos, int386, int386x, int86, int86x, intdosx, intr, segread

 


Example :

#include <dos.h>


#define DISPLAY_OUTPUT 2


void main( )

{
    union REGS in_regs, out_regs;

    int     re;

 

    in_regs.h.ah = DISPLAY_OUTPUT;

    in_regs.h.al = 0;


    in regs.w.dx = 'I';

    rc = intdos( &in_regs, &out_regs );

    in regs.w.dx = 'N';

    rc = intdos( &in_regs, &out_regs );

    in regs.w.dx = 'T';

    rc = intdos( &in_regs, &out_regs);

    in regs.w.dx = 'D';

    rc = intdos( &in_regs, &out_regs);

    in regs.w.dx = 'O';

    rc = intdos( &in_regs, &out_regs);

    in regs.w.dx = 'S';

    rc =  intdos( &in_regs, &out_regs);

}

 

Classification : DOS
Systems : DOS, Win, DOS/PM

 

 

 

 

 

intdosx

 

Synopsis : #include <dos.h> 

              int intdosx( const union REGS *in_regs,

                           union REGS *out_regs,

                           struct SREGS *seg_regs );


Description : The intdosx function causes the computer's central processor (CPU) to be interrupted with an interrupt number hexadecimal 21 (0x21), which is a request to invoke a specific DOS function. Before the interrupt, the CPU registers are loaded from the structure located by in_regs and the segment registers DS and ES are loaded from the structure located by seg_regs.

 

The AH register contains a number indicating the function requested. All of the segment registers must contain valid values. Failure to do so will cause a segment violation when running in protect mode. If you don't care about a particular segment register, then it can be set to 0 which will not cause a segment violation. The function segread can be used to initialize seg_regs to their current values.


Following the interrupt, the structure located by out_regs is filled with the contents of the CPU registers. The in_regs and out_regs structures may be located at the same location in memory. The original values for the DS and ES registers are restored. The structure seg_regs is updated with the values of the segment registers following the interrupt.


You should consult the technical documentation for the DOS operating system that you are using to determine the expected register contents before and after the interrupt in question.

 

 

Returns : The function returns the value of the AX (EAX in 386 library) register after the interrupt has completed. The CARRY flag (when set, an error has occurred) is copied into the structure located by out_regs. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

See Also : bdos, int386, int386x, int86, int86x, intdos, intr, segread

 


Example :

#include <stdio.h> 

#include <dos.h>


/* get current mouse interrupt handler address */


void main( )

{
    union REGS r;

    struct SREGS s;
#if defined (__386__)
    s.ds = s.es = s. fs = s.gs = FP_SEG ( &s );

#endif
    r.h.ah = 0x35;         /* get vector */

    r.h.al = 0x33;          /* vector 0x33 */
    intdosx ( &r, &r, &s );

#if defined (__386__)

    printf( "mouse handler address=%4.4x: %lx\n", s.es, r.x.ebx );

#else

    printf( "mouse handler address=%4.4x:%4.4x\n", s.es, r.x.bx );

#endif

}

 

Classification : DOS
Systems : DOS, Win, DOS/PM

 

 

 

 

 

intr

 

Synopsis : #include <i86.h> 

              void intr( int inter_no, union REGPACK *regs );

 


Description : The intr function causes the computer's central processor (CPU) to be interrupted with an interrupt whose number is given by inter_no. Before the interrupt, the CPU registers are loaded from the structure located by regs. All of the segment registers must contain valid values. Failure to do so will cause a segment violation when running in protect mode. If you don't care about a particular segment register, then it can be set to 0 which will not cause a segment violation. Following the interrupt, the structure located by regs is filled with the contents of the CPU registers.

 

This function is similar to the int86x function, except that only one structure is used for the register values and that the BP (EBP in 386 library) register is included in the set of registers that are passed and saved.


You should consult the technical documentation for the computer that you are using to determine the expected register contents before and after the interrupt in question.

 


Returns : The function does not return a value.

 

 

See Also : bdos, int386, int386x, int86, int86x, intdos, intdosx, segread

 


Example :

#include <stdio.h> 

#include <string.h> 

#include <i86.h>


void main( ) /* Print location of Break Key Vector */

{
    union REGPACK regs;


    memset( &regs, 0, sizeof (union REGPACK) );

    regs.w.ax = 0x3523;

    intr( 0x21, &regs );
    printf( "Break Key vector is "

#if defined (__386__)
              "%x:%lx\n", regs.w.es, regs.x.ebx );

#else
              "%x: %x\n", regs.w.es, regs.x.bx );

#endif

}

 


produces the following :
Break Key vector is eef:13c

 

Classification : Intel
Systems : DOS, Win, QNX, DOS/PM

 

 

 

 

 

isalnum

 

Synopsis : #include <ctype.h> 

              int isalnum( int c );

 


Description : The isalnum function tests if the argument c is an alphanumeric character ('a' to 'z', 'A' to Z , or '0' to '9'). An alphanumeric character is any character for which isalpha or isdigit is true.

 

 

Returns : The isalnum returns zero if the argument is neither an alphabetic character nor a digit. Otherwise, a non-zero value is returned.

 

 

See Also : isalpha, isdigit, islower

 


Example :

#include <stdio.h> 

#include <ctype.h>


void main( )
{
    if( isalnum( getchar( ) ) ) {
        printf( "is alpha-numeric\n" );

    }

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

isalpha

 

Synopsis : #include <ctype.h> 

              int isalpha( int c );


Description : The isalpha function tests if the argument c is an alphabetic character ('a' to 'z' and 'A' to 'Z'). An alphabetic character is any character for which isupper or islower is true.

 

 

Returns : The isalpha returns zero if the argument is not an alphabetic character otherwise, a non-zero value is returned.

 

 

See Also : isalnum, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper

 


Example :

#include <stdio.h> 

#include <ctype.h>


void main( )

{
    if( isalpha( getchar( ) ) ) {
        printf( "is alphabetic\n" );

    }

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

isascii

 

Synopsis : #include <ctype.h> 

              int isascii( int c );

 


Description : The isascii function tests for a character in the range from 0 to 127.

 

 

Returns : A non-zero value is returned when the character is in the range 0 to 127; otherwise, zero is returned.

 

 

See Also : isalpha, isalnum, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper

 


Example :

#include <stdio.h> 

#include <ctype.h>


char chars[ ] = {

    'A'
    0x80,

    'Z'

};


#define SIZE sizeof( chars) / sizeof( char )


void main( )

{
    int     i;


    for( i = 0; i < SIZE; i++ ) {

        printf( "Char %c is %s an ASCII character\n", chars[i], ( isascii( chars [i] ) ) ? "" : "not " );

    }

}

 


produces the following :
Char A is  an ASCII character 

Char    is not  an ASCII character

Char Z is  an ASCII character

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

 

 

728x90
반응형
Posted by 전화카드
,