www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - int86 is broken

reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Please check the following program:

#include <dos.h>
#include <stdio.h>

void use_asm(){
    printf("Using asm\n");
    asm {
        mov ax, 500h
        int 2ah
        }
    printf("Names: %d, Commands: %d, Sessions: %d\n",
        _BX, _CX, _DX);
    }

int main(){
    union REGS InRegs;
    InRegs.x.ax = 0;
    int active = int86(0x2A, &InRegs, &InRegs) / 256;         // Check
Netbios
    printf("Active: %d\n", active);

    if(active){
        InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
statistics
        int86(0x2A, &InRegs, &InRegs);

        printf("Names: %d, Commands: %d, Sessions: %d\n",
              InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
        use_asm();
        }

    return 0;
    }
Jan 08 2002
next sibling parent "Walter" <walter digitalmars.com> writes:
At least there's an easy workaround! -Walter

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         // Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 08 2002
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
Here's what I get compiling and running it:

-----------------------------------------------
C:\dc>sc -ml test
link test/noi;


C:\dc>test
Active: 1
Names: 16, Commands: 128, Sessions: 64
Using asm
Names: 16, Commands: 128, Sessions: 64

C:\dc>sc -ms test
link test/noi;


C:\dc>test
Active: 1
Names: 16, Commands: 128, Sessions: 64
Using asm
Names: 16, Commands: 128, Sessions: 64

C:\dc>
-------------------------------------------------------

I can't see what the problem is. -Walter

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         // Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 09 2002
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
With sc -ml test, I get this:
Active: 1
Names: 8196, Commands: 31, Sessions: 4623
Using asm
Names: 16, Commands: 16, Sessions: 64

With sc -ms test, I get:
Active: 1
Names: 10872, Commands: 5123, Sessions: 2416
Using asm
Names: 16, Commands: 16, Sessions: 64

Should I send you .cod (or exe) files?
- Rajiv


"Walter" <walter digitalmars.com> wrote in message
news:a1isvq$25c1$1 digitaldaemon.com...
 Here's what I get compiling and running it:

 -----------------------------------------------
 C:\dc>sc -ml test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>sc -ms test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>
 -------------------------------------------------------

 I can't see what the problem is. -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         // Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 09 2002
parent reply "Walter" <walter digitalmars.com> writes:
What's the date/size on your sds.lib?

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a1j9ov$2cv5$1 digitaldaemon.com...
 With sc -ml test, I get this:
 Active: 1
 Names: 8196, Commands: 31, Sessions: 4623
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 With sc -ms test, I get:
 Active: 1
 Names: 10872, Commands: 5123, Sessions: 2416
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 Should I send you .cod (or exe) files?
 - Rajiv


 "Walter" <walter digitalmars.com> wrote in message
 news:a1isvq$25c1$1 digitaldaemon.com...
 Here's what I get compiling and running it:

 -----------------------------------------------
 C:\dc>sc -ml test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>sc -ms test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>
 -------------------------------------------------------

 I can't see what the problem is. -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         // Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 09 2002
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
sds      lib       370,176  08-04-01 11:10a SDS.LIB
snd      lib       469,504  07-28-01  1:51a SND.LIB
sdc      lib       391,168  07-08-01  3:31p SDC.LIB
sdl      lib       398,848  07-08-01  3:31p SDL.LIB
sdm      lib       374,272  07-08-01  3:31p SDM.LIB
-Rajiv

"Walter" <walter digitalmars.com> wrote in message
news:a1jeea$2fg9$1 digitaldaemon.com...
 What's the date/size on your sds.lib?

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1j9ov$2cv5$1 digitaldaemon.com...
 With sc -ml test, I get this:
 Active: 1
 Names: 8196, Commands: 31, Sessions: 4623
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 With sc -ms test, I get:
 Active: 1
 Names: 10872, Commands: 5123, Sessions: 2416
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 Should I send you .cod (or exe) files?
 - Rajiv


 "Walter" <walter digitalmars.com> wrote in message
 news:a1isvq$25c1$1 digitaldaemon.com...
 Here's what I get compiling and running it:

 -----------------------------------------------
 C:\dc>sc -ml test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>sc -ms test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>
 -------------------------------------------------------

 I can't see what the problem is. -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         //
Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 09 2002
parent "Walter" <walter digitalmars.com> writes:
Is it possible there are other register values to that function? Not
initializing all fields of REGS results in garbage being assigned to them.

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a1jg9u$2gms$1 digitaldaemon.com...
 sds      lib       370,176  08-04-01 11:10a SDS.LIB
 snd      lib       469,504  07-28-01  1:51a SND.LIB
 sdc      lib       391,168  07-08-01  3:31p SDC.LIB
 sdl      lib       398,848  07-08-01  3:31p SDL.LIB
 sdm      lib       374,272  07-08-01  3:31p SDM.LIB
 -Rajiv

 "Walter" <walter digitalmars.com> wrote in message
 news:a1jeea$2fg9$1 digitaldaemon.com...
 What's the date/size on your sds.lib?

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1j9ov$2cv5$1 digitaldaemon.com...
 With sc -ml test, I get this:
 Active: 1
 Names: 8196, Commands: 31, Sessions: 4623
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 With sc -ms test, I get:
 Active: 1
 Names: 10872, Commands: 5123, Sessions: 2416
 Using asm
 Names: 16, Commands: 16, Sessions: 64

 Should I send you .cod (or exe) files?
 - Rajiv


 "Walter" <walter digitalmars.com> wrote in message
 news:a1isvq$25c1$1 digitaldaemon.com...
 Here's what I get compiling and running it:

 -----------------------------------------------
 C:\dc>sc -ml test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>sc -ms test
 link test/noi;


 C:\dc>test
 Active: 1
 Names: 16, Commands: 128, Sessions: 64
 Using asm
 Names: 16, Commands: 128, Sessions: 64

 C:\dc>
 -------------------------------------------------------

 I can't see what the problem is. -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a1edfd$2e4b$1 digitaldaemon.com...
 Please check the following program:

 #include <dos.h>
 #include <stdio.h>

 void use_asm(){
     printf("Using asm\n");
     asm {
         mov ax, 500h
         int 2ah
         }
     printf("Names: %d, Commands: %d, Sessions: %d\n",
         _BX, _CX, _DX);
     }

 int main(){
     union REGS InRegs;
     InRegs.x.ax = 0;
     int active = int86(0x2A, &InRegs, &InRegs) / 256;         //
Check
 Netbios
     printf("Active: %d\n", active);

     if(active){
         InRegs.x.ax = 0x0500;             // ah=5, al=0 get
NetBIOS
 statistics
         int86(0x2A, &InRegs, &InRegs);

         printf("Names: %d, Commands: %d, Sessions: %d\n",
               InRegs.x.bx, InRegs.x.cx, InRegs.x.dx );
         use_asm();
         }

     return 0;
     }
Jan 10 2002